Sfoglia il codice sorgente

fixed bug : documents can have several children

Nicolas Cannasse 17 anni fa
parent
commit
e5b8e84b35
1 ha cambiato i file con 6 aggiunte e 2 eliminazioni
  1. 6 2
      std/php/PhpXml__.hx

+ 6 - 2
std/php/PhpXml__.hx

@@ -84,10 +84,14 @@ class PhpXml__ {
 		untyped __call__("xml_parser_set_option", xml_parser, __php__("XML_OPTION_CASE_FOLDING"), 0);
 		untyped __call__("xml_parser_set_option", xml_parser, __php__("XML_OPTION_SKIP_WHITE"), 0);
 
-		if(untyped __call__("xml_parse", xml_parser, str, true) != 1) {
-			throw untyped __call__("xml_error_string", xml_parser) + ", at line #" + __call__("xml_get_current_line_number", xml_parser);
+		if(untyped __call__("xml_parse", xml_parser, "<doc>"+str+"</doc>", true) != 1) {
+			throw "Xml parse error ("+untyped __call__("xml_error_string", xml_parser) + ") line #" + __call__("xml_get_current_line_number", xml_parser);
 		}
 		untyped __call__("xml_parser_free", xml_parser);
+		build = build._children[0];
+		build._parent = null;
+		build._nodeName = null;
+		build.nodeType = Document;
 		return build;
 	}