Explorar el Código

Xml.createProlog -> Xml.createProcessingInstruction (fixed issue #1435)

Simon Krajewski hace 12 años
padre
commit
e19512f8e3

+ 1 - 0
main.ml

@@ -99,6 +99,7 @@ let deprecated = [
 	"Class not found : neko.zip.Reader", "neko.zip.Reader has been removed, use haxe.zip.Reader instead";
 	"Class not found : neko.zip.Reader", "neko.zip.Writer has been removed, use haxe.zip.Writer instead";
 	"Class not found : haxe.Public", "Use @:publicFields instead of implementing or extending haxe.Public";
+	"#Xml has no field createProlog", "Xml.createProlog was renamed to Xml.createProcessingInstruction";
 ]
 
 let error ctx msg p =

+ 2 - 2
std/Xml.hx

@@ -66,7 +66,7 @@ extern class Xml {
 	/**
 		A type of Xml node.
 	**/
-	static var Prolog(default,null) : XmlType;
+	static var ProcessingInstruction(default,null) : XmlType;
 
 	/**
 		A type of Xml node.
@@ -106,7 +106,7 @@ extern class Xml {
 	/**
 		Creates a node of the given type.
 	**/
-	static function createProlog( data : String ) : Xml;
+	static function createProcessingInstruction( data : String ) : Xml;
 
 	/**
 		Creates a node of the given type.

+ 7 - 7
std/cpp/_std/Xml.hx

@@ -28,7 +28,7 @@ enum XmlType {
 	public static var CData(default,null) : XmlType;
 	public static var Comment(default,null) : XmlType;
 	public static var DocType(default,null) : XmlType;
-	public static var Prolog(default,null) : XmlType;
+	public static var ProcessingInstruction(default,null) : XmlType;
 	public static var Document(default,null) : XmlType;
 
 
@@ -79,7 +79,7 @@ enum XmlType {
 				var x = new Xml();
 				x._parent = untyped __this__.cur;
 				if( untyped text.cca(0) == 63 ) {
-					x.nodeType = Xml.Prolog;
+					x.nodeType = Xml.ProcessingInstruction;
 					text = new String(text);
 					text = text.substr(1, text.length - 2);
 				} else {
@@ -144,9 +144,9 @@ enum XmlType {
 		return r;
 	}
 
-	public static function createProlog( data : String ) : Xml {
+	public static function createProcessingInstruction( data : String ) : Xml {
 		var r = new Xml();
-		r.nodeType = Xml.Prolog;
+		r.nodeType = Xml.ProcessingInstruction;
 		r._nodeValue = data;
 		return r;
 	}
@@ -393,7 +393,7 @@ enum XmlType {
 			s.add("<!DOCTYPE ");
 			s.add(_nodeValue);
 			s.add(">");
-		case Xml.Prolog:
+		case Xml.ProcessingInstruction:
 			s.add("<?");
 			s.add(_nodeValue);
 			s.add("?>");
@@ -406,14 +406,14 @@ enum XmlType {
 		CData =  Type.createEnum(XmlType,"__");
 		Comment = Type.createEnum(XmlType,"__");
 		DocType = Type.createEnum(XmlType,"__");
-		Prolog =  Type.createEnum(XmlType,"__");
+		ProcessingInstruction =  Type.createEnum(XmlType,"__");
 		Document = Type.createEnum(XmlType,"__");
 		__global__.__hxcpp_enum_force(PCData , "pcdata", 0);
 		__global__.__hxcpp_enum_force(Element , "element", 1);
 		__global__.__hxcpp_enum_force(CData , "cdata", 2);
 		__global__.__hxcpp_enum_force(Comment , "comment", 3);
 		__global__.__hxcpp_enum_force(DocType , "doctype", 4);
-		__global__.__hxcpp_enum_force(Prolog , "prolog", 5);
+		__global__.__hxcpp_enum_force(ProcessingInstruction , "processingInstruction", 5);
 		__global__.__hxcpp_enum_force(Document , "document", 6);
 	}
 

+ 6 - 6
std/cs/_std/Xml.hx

@@ -29,7 +29,7 @@ private enum RealXmlType {
         CData;
         Comment;
         DocType;
-        Prolog;
+        ProcessingInstruction;
         Document;
 }
 
@@ -40,7 +40,7 @@ private enum RealXmlType {
 	public static var CData(default,null) : XmlType;
 	public static var Comment(default,null) : XmlType;
 	public static var DocType(default,null) : XmlType;
-	public static var Prolog(default,null) : XmlType;
+	public static var ProcessingInstruction(default,null) : XmlType;
 	public static var Document(default,null) : XmlType;
 
 	public var nodeType(default,null) : XmlType;
@@ -98,9 +98,9 @@ private enum RealXmlType {
 		return r;
 	}
 
-	public static function createProlog( data : String ) : Xml {
+	public static function createProcessingInstruction( data : String ) : Xml {
 		var r = new Xml();
-		r.nodeType = Xml.Prolog;
+		r.nodeType = Xml.ProcessingInstruction;
 		r.set_nodeValue( data );
 		return r;
 	}
@@ -300,7 +300,7 @@ private enum RealXmlType {
 			return "<!--"+_nodeValue+"-->";
 		if( nodeType == Xml.DocType )
 			return "<!DOCTYPE "+_nodeValue+">";
-		if( nodeType == Xml.Prolog )
+		if( nodeType == Xml.ProcessingInstruction )
 			return "<?"+_nodeValue+"?>";
 		var s = new StringBuf();
 
@@ -338,7 +338,7 @@ private enum RealXmlType {
 		Xml.CData = cast RealXmlType.CData;
 		Xml.Comment = cast RealXmlType.Comment;
 		Xml.DocType = cast RealXmlType.DocType;
-		Xml.Prolog = cast RealXmlType.Prolog;
+		Xml.ProcessingInstruction = cast RealXmlType.ProcessingInstruction;
 		Xml.Document = cast RealXmlType.Document;
 	}
 

+ 6 - 6
std/flash/_std/Xml.hx

@@ -32,7 +32,7 @@ extern enum XmlType {
 	public static var CData(default,null) : XmlType;
 	public static var Comment(default,null) : XmlType;
 	public static var DocType(default,null) : XmlType;
-	public static var Prolog(default,null) : XmlType;
+	public static var ProcessingInstruction(default,null) : XmlType;
 	public static var Document(default,null) : XmlType;
 
 	public var nodeType(default,null) : XmlType;
@@ -92,9 +92,9 @@ extern enum XmlType {
 		return wrap( new flash.xml.XML("<!DOCTYPE "+data+">"), Xml.DocType );
 	}
 
-	public static function createProlog( data : String ) : Xml {
+	public static function createProcessingInstruction( data : String ) : Xml {
 		XML.ignoreProcessingInstructions = false;
-		return wrap( new flash.xml.XML("<?"+data+"?>"), Xml.Prolog );
+		return wrap( new flash.xml.XML("<?"+data+"?>"), Xml.ProcessingInstruction );
 	}
 
 	public static function createDocument() : Xml {
@@ -108,7 +108,7 @@ extern enum XmlType {
 		case "text":
 			return Xml.PCData;
 		case "processing-instruction":
-			return Xml.Prolog;
+			return Xml.ProcessingInstruction;
 		case "comment":
 			return Xml.Comment;
 		default :
@@ -160,7 +160,7 @@ extern enum XmlType {
 		else if( nodeType == Xml.DocType )
 			x = createDocType(v);
 		else
-			x = createProlog(v);
+			x = createProcessingInstruction(v);
 		var p = _node.parent();
 		if( p != null ) {
 			p.insertChildAfter(_node, x._node);
@@ -404,7 +404,7 @@ extern enum XmlType {
 		CData = "cdata";
 		Comment = "comment";
 		DocType = "doctype";
-		Prolog = "prolog";
+		ProcessingInstruction = "processingInstruction";
 		Document = "document";
 	}
 

+ 5 - 5
std/flash8/_std/Xml.hx

@@ -29,7 +29,7 @@ enum XmlType {
 	public static var CData(default,null) : XmlType;
 	public static var Comment(default,null) : XmlType;
 	public static var DocType(default,null) : XmlType;
-	public static var Prolog(default,null) : XmlType;
+	public static var ProcessingInstruction(default,null) : XmlType;
 	public static var Document(default,null) : XmlType;
 
 
@@ -108,9 +108,9 @@ enum XmlType {
 		return x;
 	}
 
-	public static function createProlog( data : String ) : Xml {
+	public static function createProcessingInstruction( data : String ) : Xml {
 		var x = createPCData("");
-		x.nodeType = Xml.Prolog;
+		x.nodeType = Xml.ProcessingInstruction;
 		x.nodeValue = data;
 		return x;
 	}
@@ -292,7 +292,7 @@ enum XmlType {
 		// only works for toplevel elements
 		if( nodeType == Xml.CData )
 			return "<![CDATA["+__x[untyped "nodeValue"]+"]]>";
-		if( nodeType == Xml.Prolog )
+		if( nodeType == Xml.ProcessingInstruction )
 			return "<?"+__x[untyped "nodeValue"]+"?>";
 		if( nodeType == Xml.DocType )
 			return "<!DOCTYPE "+__x[untyped "nodeValue"]+">";
@@ -306,7 +306,7 @@ enum XmlType {
 		Xml.CData = "cdata";
 		Xml.Comment = "comment";
 		Xml.DocType = "doctype";
-		Xml.Prolog = "prolog";
+		Xml.ProcessingInstruction = "processingInstruction";
 		Xml.Document = "document";
 		#if swf_mark
 		flash.Lib.current["Xml"] = Xml;

+ 1 - 1
std/haxe/xml/Parser.hx

@@ -301,7 +301,7 @@ class Parser
 					{
 						p++;
 						var str = str.substr(start + 1, p - start - 2);
-						parent.addChild(Xml.createProlog(str));
+						parent.addChild(Xml.createProcessingInstruction(str));
 						state = S.BEGIN;
 					}
 				case S.ESCAPE:

+ 6 - 6
std/java/_std/Xml.hx

@@ -29,7 +29,7 @@ private enum RealXmlType {
         CData;
         Comment;
         DocType;
-        Prolog;
+        ProcessingInstruction;
         Document;
 }
 
@@ -40,7 +40,7 @@ private enum RealXmlType {
 	public static var CData(default,null) : XmlType;
 	public static var Comment(default,null) : XmlType;
 	public static var DocType(default,null) : XmlType;
-	public static var Prolog(default,null) : XmlType;
+	public static var ProcessingInstruction(default,null) : XmlType;
 	public static var Document(default,null) : XmlType;
 
 	public var nodeType(default,null) : XmlType;
@@ -98,9 +98,9 @@ private enum RealXmlType {
 		return r;
 	}
 
-	public static function createProlog( data : String ) : Xml {
+	public static function createProcessingInstruction( data : String ) : Xml {
 		var r = new Xml();
-		r.nodeType = Xml.Prolog;
+		r.nodeType = Xml.ProcessingInstruction;
 		r.set_nodeValue( data );
 		return r;
 	}
@@ -300,7 +300,7 @@ private enum RealXmlType {
 			return "<!--"+_nodeValue+"-->";
 		if( nodeType == Xml.DocType )
 			return "<!DOCTYPE "+_nodeValue+">";
-		if( nodeType == Xml.Prolog )
+		if( nodeType == Xml.ProcessingInstruction )
 			return "<?"+_nodeValue+"?>";
 		var s = new StringBuf();
 
@@ -338,7 +338,7 @@ private enum RealXmlType {
 		Xml.CData = cast RealXmlType.CData;
 		Xml.Comment = cast RealXmlType.Comment;
 		Xml.DocType = cast RealXmlType.DocType;
-		Xml.Prolog = cast RealXmlType.Prolog;
+		Xml.ProcessingInstruction = cast RealXmlType.ProcessingInstruction;
 		Xml.Document = cast RealXmlType.Document;
 	}
 

+ 5 - 5
std/js/_std/Xml.hx

@@ -29,7 +29,7 @@ enum XmlType {
 	public static var CData(default,null) : XmlType;
 	public static var Comment(default,null) : XmlType;
 	public static var DocType(default,null) : XmlType;
-	public static var Prolog(default,null) : XmlType;
+	public static var ProcessingInstruction(default,null) : XmlType;
 	public static var Document(default,null) : XmlType;
 
 	public var nodeType(default,null) : XmlType;
@@ -87,9 +87,9 @@ enum XmlType {
 		return r;
 	}
 
-	public static function createProlog( data : String ) : Xml {
+	public static function createProcessingInstruction( data : String ) : Xml {
 		var r = new Xml();
-		r.nodeType = Xml.Prolog;
+		r.nodeType = Xml.ProcessingInstruction;
 		r.set_nodeValue( data );
 		return r;
 	}
@@ -287,7 +287,7 @@ enum XmlType {
 			return "<!--"+_nodeValue+"-->";
 		if( nodeType == Xml.DocType )
 			return "<!DOCTYPE "+_nodeValue+">";
-		if( nodeType == Xml.Prolog )
+		if( nodeType == Xml.ProcessingInstruction )
 			return "<?"+_nodeValue+"?>";
 		var s = new StringBuf();
 
@@ -325,7 +325,7 @@ enum XmlType {
 		Xml.CData = "cdata";
 		Xml.Comment = "comment";
 		Xml.DocType = "doctype";
-		Xml.Prolog = "prolog";
+		Xml.ProcessingInstruction = "processingInstruction";
 		Xml.Document = "document";
 	}
 

+ 6 - 6
std/neko/_std/Xml.hx

@@ -29,7 +29,7 @@ enum XmlType {
 	public static var CData(default,null) : XmlType;
 	public static var Comment(default,null) : XmlType;
 	public static var DocType(default,null) : XmlType;
-	public static var Prolog(default,null) : XmlType;
+	public static var ProcessingInstruction(default,null) : XmlType;
 	public static var Document(default,null) : XmlType;
 
 
@@ -91,7 +91,7 @@ enum XmlType {
 				var x : Dynamic = new Xml();
 				x._parent = untyped __this__.cur;
 				if( untyped __dollar__sget(text,0) == 63 ) {
-					x.nodeType = Xml.Prolog;
+					x.nodeType = Xml.ProcessingInstruction;
 					text = new String(text);
 					text = text.substr(1,text.length - 2);
 				} else {
@@ -156,9 +156,9 @@ enum XmlType {
 		return r;
 	}
 
-	public static function createProlog( data : String ) : Xml {
+	public static function createProcessingInstruction( data : String ) : Xml {
 		var r = new Xml();
-		r.nodeType = Xml.Prolog;
+		r.nodeType = Xml.ProcessingInstruction;
 		r._nodeValue = data;
 		return r;
 	}
@@ -400,7 +400,7 @@ enum XmlType {
 			s.add("<!DOCTYPE ");
 			s.add(_nodeValue);
 			s.add(">");
-		case Xml.Prolog:
+		case Xml.ProcessingInstruction:
 			s.add("<?");
 			s.add(_nodeValue);
 			s.add("?>");
@@ -413,7 +413,7 @@ enum XmlType {
 		Xml.CData = "cdata";
 		Xml.Comment = "comment";
 		Xml.DocType = "doctype";
-		Xml.Prolog = "prolog";
+		Xml.ProcessingInstruction = "processingInstruction";
 		Xml.Document = "document";
 	}
 

+ 8 - 8
std/php/_std/Xml.hx

@@ -31,7 +31,7 @@ enum XmlType {
 	public static var CData(default,null) : XmlType;
 	public static var Comment(default,null) : XmlType;
 	public static var DocType(default,null) : XmlType;
-	public static var Prolog(default,null) : XmlType;
+	public static var ProcessingInstruction(default,null) : XmlType;
 	public static var Document(default,null) : XmlType;
 
 	public var nodeType(default,null) : XmlType;
@@ -124,9 +124,9 @@ enum XmlType {
 		if (null != doctype)
 			build.insertChild(createDocType(doctype), 0);
 
-		var prolog = reHeader.matched(1);
-		if (null != prolog)
-			build.insertChild(createProlog(prolog), 0);
+		var ProcessingInstruction = reHeader.matched(1);
+		if (null != ProcessingInstruction)
+			build.insertChild(createProcessingInstruction(ProcessingInstruction), 0);
 
 		return build;
 	}
@@ -180,9 +180,9 @@ enum XmlType {
 		return r;
 	}
 
-	public static function createProlog( data : String ) : Xml {
+	public static function createProcessingInstruction( data : String ) : Xml {
 		var r = new Xml();
-		r.nodeType = Xml.Prolog;
+		r.nodeType = Xml.ProcessingInstruction;
 		r.set_nodeValue( data );
 		return r;
 	}
@@ -332,7 +332,7 @@ enum XmlType {
 			return "<!--"+_nodeValue+"-->";
 		else if( nodeType == Xml.DocType )
 			return "<!DOCTYPE "+_nodeValue+">";
-		else if ( nodeType == Xml.Prolog )
+		else if ( nodeType == Xml.ProcessingInstruction )
 			return "<?"+_nodeValue+"?>";
 
 
@@ -353,7 +353,7 @@ enum XmlType {
 		Xml.CData = "cdata";
 		Xml.Comment = "comment";
 		Xml.DocType = "doctype";
-		Xml.Prolog = "prolog";
+		Xml.ProcessingInstruction = "processingInstruction";
 		Xml.Document = "document";
 	}
 

+ 3 - 3
tests/unit/TestXML.hx

@@ -126,11 +126,11 @@ class TestXML extends Test {
 		eq( Xml.createComment("Hello").toString(), "<!--Hello-->" );
 		
 		#if flash9
-		eq( Xml.createProlog("XHTML").toString(), "<?XHTML ?>");
+		eq( Xml.createProcessingInstruction("XHTML").toString(), "<?XHTML ?>");
 		// doctype is parsed but not printed
 		eq( Xml.createDocType("XHTML").toString(), "" );
 		#else
-		eq( Xml.createProlog("XHTML").toString(), "<?XHTML?>");
+		eq( Xml.createProcessingInstruction("XHTML").toString(), "<?XHTML?>");
 		eq( Xml.createDocType("XHTML").toString(), "<!DOCTYPE XHTML>" );
 		#end
 				
@@ -177,7 +177,7 @@ class TestXML extends Test {
 	function testNodetype() {
 		var element = Xml.createElement("x");
 
-		var l = [Xml.createPCData("x"), Xml.createCData("x"), Xml.createDocType("x"), Xml.createProlog("x") #if !flash8, Xml.createComment("x") #end];
+		var l = [Xml.createPCData("x"), Xml.createCData("x"), Xml.createDocType("x"), Xml.createProcessingInstruction("x") #if !flash8, Xml.createComment("x") #end];
 		for (xml in l)
 		{
 			exc(function() xml.firstChild());