[Sie-announce] SIEコード [1974] 実体参照の実装をした

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 8月 6日 (金) 20:47:19 JST


Revision: 1974
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1974
Author:   dhrname
Date:     2010-08-06 20:47:19 +0900 (Fri, 06 Aug 2010)

Log Message:
-----------
実体参照の実装をした

Modified Paths:
--------------
    branches/06x/061/org/w3c/dom/svg.js

Modified: branches/06x/061/org/w3c/dom/svg.js
===================================================================
--- branches/06x/061/org/w3c/dom/svg.js	2010-08-02 14:24:53 UTC (rev 1973)
+++ branches/06x/061/org/w3c/dom/svg.js	2010-08-06 11:47:19 UTC (rev 1974)
@@ -1449,6 +1449,20 @@
       NAIBU.doc.validateOnParse = false;
       NAIBU.doc.resolveExternals = false;
       NAIBU.doc.loadXML(str);
+      if (/&[^;]+;/.test(str)) {
+        /*以下の処理は、実体参照を使ったとき
+         *代替の処理を用いて、実体参照を処理するもの
+         */
+        var tmp = str;
+        var enti = (NAIBU.doc.doctype)? NAIBU.doc.doctype.entities: { length:0 };
+        for (var i=0; i<enti.length; i++) {
+        var map = enti.item(i);
+        var regex = new RegExp("&"+map.nodeName+";", "g");
+        tmp = tmp.replace(regex, map.firstChild.xml);
+        }
+        NAIBU.doc.loadXML(tmp);
+        tmp = null;
+      }
       var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg");
       var tar = s.documentElement;
       tar.viewport.top = 0;




Sie-announce メーリングリストの案内
Back to archive index