Bladeren bron

xml simple quotes

Nicolas Cannasse 18 jaren geleden
bovenliggende
commit
fd8f7721c8
3 gewijzigde bestanden met toevoegingen van 5 en 4 verwijderingen
  1. 1 0
      doc/CHANGES.txt
  2. 2 2
      std/flash9/FlashXml__.hx
  3. 2 2
      std/js/JsXml__.hx

+ 1 - 0
doc/CHANGES.txt

@@ -12,6 +12,7 @@
 	added neko.io.Process and neko.vm.Ui
 	added haxe.xml.Proxy
 	some flash6 fixes
+	allowed simplequotes for xml attributes in Flash9 and JS
 
 2007-05-18: 1.13
 	fixed bug with local variable masking package in catch type

+ 2 - 2
std/flash9/FlashXml__.hx

@@ -35,7 +35,7 @@ class FlashXml__ {
 	static var ecomment = ~/^<!--/;
 	static var eprolog = ~/^<\?[^\?]+\?>/;
 
-	static var eattribute = ~/^[ \r\n\t]*([a-zA-Z0-9:_-]+)[ \r\n\t]*=[ \r\n\t]*"([^"]*)"/; //"
+	static var eattribute = ~/^\s*([a-zA-Z0-9:_-]+)\s*=\s*(['"])(.*?)\2/; //"
 	static var eclose = ~/^[ \r\n\t]*(>|(\/>))/;
 	static var ecdata_end = ~/\]\]>/;
 	static var edoctype_elt = ~/[\[|\]>]/;
@@ -77,7 +77,7 @@ class FlashXml__ {
 						current.addChild(x);
 						str = r.matchedRight();
 						while( eattribute.match(str) ) {
-							x.set(eattribute.matched(1),eattribute.matched(2));
+							x.set(eattribute.matched(1),eattribute.matched(3));
 							str = eattribute.matchedRight();
 						}
 						if( !eclose.match(str) ) {

+ 2 - 2
std/js/JsXml__.hx

@@ -35,7 +35,7 @@ class JsXml__ {
 	static var ecomment = ~/^<!--/;
 	static var eprolog = ~/^<\?[^\?]+\?>/;
 
-	static var eattribute = ~/^[ \r\n\t]*([a-zA-Z0-9:_-]+)[ \r\n\t]*=[ \r\n\t]*"([^"]*)"/; //"
+	static var eattribute = ~/^\s*([a-zA-Z0-9:_-]+)\s*=\s*(["'])(.*?)\2/; //"
 	static var eclose = ~/^[ \r\n\t]*(>|(\/>))/;
 	static var ecdata_end = ~/\]\]>/;
 	static var edoctype_elt = ~/[\[|\]>]/;
@@ -69,7 +69,7 @@ class JsXml__ {
 						current.addChild(x);
 						str = r.matchedRight();
 						while( eattribute.match(str) ) {
-							x.set(eattribute.matched(1),eattribute.matched(2));
+							x.set(eattribute.matched(1),eattribute.matched(3));
 							str = eattribute.matchedRight();
 						}
 						if( !eclose.match(str) ) {