浏览代码

fixed Xml.

Nicolas Cannasse 19 年之前
父节点
当前提交
e0b0e9ec32
共有 7 个文件被更改,包括 161 次插入154 次删除
  1. 7 7
      std/Xml.hx
  2. 39 38
      std/flash/FlashXml__.hx
  3. 0 1
      std/haxe/ImportAll.hx
  4. 19 1
      std/js/HtmlDom.hx
  5. 28 39
      std/js/JsXml__.hx
  6. 37 37
      std/neko/NekoXml__.hx
  7. 31 31
      std/tools/haxedoc/Main.hx

+ 7 - 7
std/Xml.hx

@@ -28,7 +28,7 @@ enum XmlType {
 
 extern class Xml {
 
-	static property Node(default,null) : XmlType;
+	static property Element(default,null) : XmlType;
 	static property PCData(default,null) : XmlType;
 	static property CData(default,null) : XmlType;
 	static property Comment(default,null) : XmlType;
@@ -38,7 +38,7 @@ extern class Xml {
 
 	static function parse( s : String ) : Xml;
 
-	static function createNode( name : String ) : Xml;
+	static function createElement( name : String ) : Xml;
 	static function createPCData( data : String ) : Xml;
 	static function createCData( data : String ) : Xml;
 	static function createComment( data : String ) : Xml;
@@ -67,11 +67,11 @@ extern class Xml {
 
 	// children method : only works for Node and Document
 	// exception if child is Document (can't add Documents together)
-	function iterator() : Iterator<Xml>; // all children
-	function nodes() : Iterator<Xml>; // only nodes
-	function nodesNamed( name : String ) : Iterator<Xml>; // only nodes with this nodeName
+	function iterator() : Iterator<Xml>;
+	function elements() : Iterator<Xml>;
+	function elementsNamed( name : String ) : Iterator<Xml>; // only nodes with this nodeName
 	function firstChild() : Xml;
-	function firstNode() : Xml;
+	function firstElement() : Xml;
 	function addChild( x : Xml ) : Void;
 	function removeChild( x : Xml ) : Bool;
 	function insertChild( x : Xml, pos : Int ) : Void;
@@ -88,7 +88,7 @@ extern class Xml {
 		#else error
 		#end
 
-		Node = "node";
+		Element = "element";
 		PCData = "pcdata";
 		CData = "cdata";
 		Comment = "comment";

+ 39 - 38
std/flash/FlashXml__.hx

@@ -30,26 +30,26 @@ class FlashXml__ {
 	public property nodeName(getNodeName,setNodeName) : String;
 	public property nodeValue(getNodeValue,setNodeValue) : String;
 	public property nodeType(default,null) : XmlType;
-	
+
 	private var __x : Dynamic;
 
 	private static function convert( o : Dynamic ) : Xml {
 		if( o == null ) return null;
 		if( o.__w != null ) return o.__w;
-		
+
 		var r = new FlashXml__();
 		r.__x = o;
 		o.__w = r;
 
 		r.nodeType = switch( o.nodeType ) {
 			case 1:
-				Xml.Node;
+				Xml.Element;
 			case 3:
 				Xml.PCData;
 			default:
 				throw "unknow nodeType: "+o.nodeType;
 		}
-		
+
 		return untyped r;
 	}
 
@@ -58,7 +58,7 @@ class FlashXml__ {
 		x.parseXML(xmlData);
 		if( x.status != 0 )
 			throw ("Xml parse error #"+x.status);
-		
+
 		var r = convert(x);
 		untyped r.nodeType = Xml.Document;
 		return r;
@@ -74,17 +74,18 @@ class FlashXml__ {
 
 	public static function createCData( s : String ) : Xml {
 		var o = untyped __new__(_global["XML"]).createTextNode( s );
-		
-		return convert(o);
+		var x = convert(o);
+		untyped x.nodeType = Xml.CData;
+		return x;
 	}
 
 	public static function createPCData( s : String ) : Xml {
 		var o = untyped __new__(_global["XML"]).createTextNode( s );
-		
+
 		return convert(o);
 	}
 
-	public static function createNode( s : String ) : Xml {
+	public static function createElement( s : String ) : Xml {
 		var o = untyped __new__(_global["XML"]).createElement( s );
 
 		return convert(o);
@@ -112,25 +113,24 @@ class FlashXml__ {
 		return convert(this.__x.firstChild);
 	}
 
-	public function firstNode(){
-		var e = firstChild();
-		while( e != null && e.nodeType != Xml.Node ){
-			e = untyped convert(e.__x.nextSibling);
-		}
-		return e;
+	public function firstElement(){
+		var e = __x.firstChild;
+		while( e != null && e.nodeType != 3 )
+			e = e.nextSibling;
+		return convert(e);
 	}
 
 	private function setNodeName( n : String ) : String {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
+
 		untyped {
 			return __x.nodeName = n;
 		}
 	}
 
 	private function setNodeValue( v : String ) : String {
-		if( nodeType == Xml.Node || nodeType == Xml.Document ) 
+		if( nodeType == Xml.Element || nodeType == Xml.Document )
 			throw "bad nodeType";
 
 		untyped {
@@ -139,14 +139,14 @@ class FlashXml__ {
 	}
 
 	private function getNodeName() : String {
-		if( nodeType != Xml.Node )
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
+
 		return __x.nodeName;
 	}
 
 	private function getNodeValue() : String {
-		if( nodeType == Xml.Node || nodeType == Xml.Document )
+		if( nodeType == Xml.Element || nodeType == Xml.Document )
 			throw "bad nodeType";
 
 		return __x.nodeValue;
@@ -166,9 +166,9 @@ class FlashXml__ {
 		}
 	}
 
-	public function nodes(){
+	public function elements(){
 		var nextElement = untyped function( e ) {
-			while( e != null && e.nodeType != Xml.Node ){
+			while( e != null && e.nodeType != Xml.Element ){
 				e = convert(e.__x.nextSibling);
 			}
 			return e;
@@ -188,9 +188,9 @@ class FlashXml__ {
 		}
 	}
 
-	public function nodesNamed( nodeName : String ){
+	public function elementsNamed( nodeName : String ){
 		var nextElement = untyped function( e ) {
-			while( e != null && (e.nodeType != Xml.Node || e.nodeName != nodeName) ){
+			while( e != null && (e.nodeType != Xml.Element || e.nodeName != nodeName) ){
 				e = convert(e.__x.nextSibling);
 			}
 			return e;
@@ -210,38 +210,38 @@ class FlashXml__ {
 		}
 	}
 
-	public function get( k : String ) : String {	
-		if( nodeType != Xml.Node ) 
+	public function get( k : String ) : String {
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-			
+
 		return Reflect.field(__x.attributes,k);
 	}
 
 	public function set( k : String, v : String ) : Void {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-			
+
 		return Reflect.setField(__x.attributes,k,v);
 	}
 
 	public function exists( k : String ) : Bool {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-			
+
 		return Reflect.hasField(__x.attributes,k);
 	}
 
 	public function remove( k : String ) : Void {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-			
+
 		Reflect.deleteField(__x.attributes,k);
 	}
 
 	public function attributes() : Iterator<String> {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
+
 		return untyped __keys__(__x.attributes).iterator();
 	}
 
@@ -252,7 +252,7 @@ class FlashXml__ {
 	public function removeChild( child : Xml ) : Bool {
 		untyped if( child.__x.parentNode != __x )
 			return false;
-			
+
 		untyped child.__x.removeNode();
 		return true;
 	}
@@ -275,7 +275,8 @@ class FlashXml__ {
 			}
 			return s;
 		}
-		
+		if( nodeType == Xml.CData )
+			return "<![CDATA["+__x.nodeValue+"]]>";
 		return __x.toString();
 	}
 

+ 0 - 1
std/haxe/ImportAll.hx

@@ -36,7 +36,6 @@ import Lambda;
 import List;
 import Math;
 import Md5;
-import Node;
 import Reflect;
 import Std;
 import StdTypes;

+ 19 - 1
std/js/HtmlDom.hx

@@ -24,8 +24,26 @@
  */
 package js;
 
-extern class HtmlDom extends Node {
+extern class HtmlDom {
 
 	var style : Style;
+	var attributes : HtmlCollection<HtmlDom>; // on IE6 also ?
+	var nodeName : String;
+	var nodeType : Int;
+	var nodeValue : String;
+
+	var parentNode : HtmlDom;
+	var childNodes : Array<HtmlDom>;
+	var firstChild : HtmlDom;
+	var lastChild : HtmlDom;
+	var nextSibling : HtmlDom;
+	var previousSibling : HtmlDom;
+
+	function appendChild( child : HtmlDom ) : Void;
+	function cloneNode( deep : HtmlDom ) : HtmlDom;
+	function hasChildNodes() : Bool;
+	function insertBefore( newChild : HtmlDom, refChild : HtmlDom ) : Void;
+	function removeChild( child : HtmlDom ) : Void;
+	function replaceChild( child : HtmlDom, oldChild : HtmlDom ) : Void;
 
 }

+ 28 - 39
std/js/JsXml__.hx

@@ -60,7 +60,7 @@ class JsXml__ {
 				if( r.match(str) ) {
 					switch( i ) {
 					case 0: // Node
-						var x = Xml.createNode(r.matched(1));
+						var x = Xml.createElement(r.matched(1));
 						current.addChild(x);
 						str = r.matchedRight();
 						while( eattribute.match(str) ) {
@@ -81,7 +81,6 @@ class JsXml__ {
 						current.addChild(x);
 						str = r.matchedRight();
 					case 2: // CData
-						
 						str = r.matchedRight();
 						if( !ecdata_end.match(str) )
 							throw "End of CDATA section not found";
@@ -109,7 +108,7 @@ class JsXml__ {
 						var x = Xml.createDocType(old.substr(0,pos));
 						current.addChild(x);
 					case 4: // End Node
-						untyped if( current._children != null && current._children.length == 0 ) {	
+						untyped if( current._children != null && current._children.length == 0 ) {
 							var e = Xml.createPCData("");
 							current.addChild(e);
 						}
@@ -148,10 +147,10 @@ class JsXml__ {
 	private function new(){
 	}
 
-	static function createNode( name : String ) : Xml {
+	static function createElement( name : String ) : Xml {
 		var r = new JsXml__();
 		untyped {
-			r.nodeType = Xml.Node;
+			r.nodeType = Xml.Element;
 			r._children = new Array();
 			r._attributes = new Hash();
 			r.setNodeName( name );
@@ -207,64 +206,56 @@ class JsXml__ {
 
 	public property nodeName(getNodeName,setNodeName) : String;
 	private function getNodeName() : String {
-		if( nodeType != Xml.Node )
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
 
 		return _nodeName;
 	}
 	private function setNodeName( n : String ) : String {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-
 		return _nodeName = n;
 	}
 
 	public property nodeValue(getNodeValue,setNodeValue) : String;
 	private function getNodeValue() : String {
-		if( nodeType == Xml.Node || nodeType == Xml.Document ) 
+		if( nodeType == Xml.Element || nodeType == Xml.Document )
 			throw "bad nodeType";
-
 		return _nodeValue;
 	}
 	private function setNodeValue( v : String ) : String {
-		if( nodeType == Xml.Node || nodeType == Xml.Document ) 
+		if( nodeType == Xml.Element || nodeType == Xml.Document )
 			throw "bad nodeType";
-		
 		return _nodeValue = v;
 	}
 
 	public function get( att : String ) : String {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
 		return _attributes.get( att );
 	}
-	
+
 	public function set( att : String, value : String ) : Void {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
 		_attributes.set( att, value );
 	}
-	
+
 	public function remove( att : String ) : Void{
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
 		_attributes.remove( att );
 	}
-	
+
 	public function exists( att : String ) : Bool {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
 		return _attributes.exists( att );
 	}
 
 	public function attributes() : Iterator<String> {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-
 		return _attributes.keys();
 	}
 
@@ -281,9 +272,9 @@ class JsXml__ {
 		}
 	}
 
-	public function nodes(){
+	public function elements(){
 		var nextElement = untyped function( cur, x ) {
-			while( x[cur] != null && x[cur].nodeType != Xml.Node ){
+			while( x[cur] != null && x[cur].nodeType != Xml.Element ){
 				cur++;
 			}
 			return cur;
@@ -304,10 +295,10 @@ class JsXml__ {
 		}
 	}
 
-	public function nodesNamed( name : String ){
+	public function elementsNamed( name : String ){
 		var nextElement = untyped function( cur, x ) {
 			var t = x[cur];
-			while( t != null && (t.nodeType != Xml.Node || t.nodeName != name) ){
+			while( t != null && (t.nodeType != Xml.Element || t.nodeName != name) ){
 				cur++;
 			}
 			return cur;
@@ -332,23 +323,21 @@ class JsXml__ {
 		return _children[0];
 	}
 
-	public function firstNode() : Xml {
+	public function firstElement() : Xml {
 		var cur = 0;
-		while( _children[cur] != null && _children[cur].nodeType != Xml.Node ){
+		while( _children[cur] != null && _children[cur].nodeType != Xml.Element )
 			cur++;
-		}
-
 		return _children[cur];
 	}
-	
+
 	public function addChild( x : Xml ) : Void {
 		_children.push( x );
 	}
-	
+
 	public function removeChild( x : Xml ) : Bool {
 		return _children.remove( x );
 	}
-	
+
 	public function insertChild( x : Xml, pos : Int ) : Void {
 		_children.insert( pos, x );
 	}
@@ -359,7 +348,7 @@ class JsXml__ {
 
 		var s = new StringBuf();
 
-		if( nodeType == Xml.Node ) {
+		if( nodeType == Xml.Element ) {
 			s.add("<");
 			s.add(nodeName);
 			for( k in _attributes.keys() ){
@@ -375,11 +364,11 @@ class JsXml__ {
 			}
 			s.add(">");
 		}
-	
+
 		for( x in iterator() )
 			s.add(x);
 
-		if( nodeType == Xml.Node ) {
+		if( nodeType == Xml.Element ) {
 			s.add("</");
 			s.add(nodeName);
 			s.add(">");

+ 37 - 37
std/neko/NekoXml__.hx

@@ -33,7 +33,7 @@ class NekoXml__ {
 	private var _nodeName : String;
 	private var _nodeValue : String;
 	private var _attributes : Dynamic<String>;
-	
+
 	private function new() {
 		_attributes = untyped Reflect.empty();
 		_children = new Array();
@@ -45,13 +45,13 @@ class NekoXml__ {
 
 	static function parse( xmlData : String ) : Xml {
 		var x = new NekoXml__();
-		
+
 		var parser = {
 			cur : x,
-			xml : function(name,att) {	
+			xml : function(name,att) {
 				var x : Dynamic = new NekoXml__();
 				untyped x._parentNode = this.cur;
-				x.nodeType = Xml.Node;
+				x.nodeType = Xml.Element;
 				x._nodeName = new String(name);
 				x._attributes = att;
 				untyped {
@@ -87,7 +87,7 @@ class NekoXml__ {
 					x.nodeType = Xml.Prolog;
 				}else{
 					x.nodeType = Xml.Comment;
-				}				
+				}
 				x._nodeValue = new String(text);
 				untyped this.cur.addChild(x);
 			},
@@ -108,10 +108,10 @@ class NekoXml__ {
 	}
 
 
-	static function createNode( name : String ) : Xml {
+	static function createElement( name : String ) : Xml {
 		var r = new NekoXml__();
 		untyped {
-			r.nodeType = Xml.Node;
+			r.nodeType = Xml.Element;
 			r.setNodeName( name );
 			return r;
 		}
@@ -165,13 +165,13 @@ class NekoXml__ {
 
 	public property nodeName(getNodeName,setNodeName) : String;
 	private function getNodeName() : String {
-		if( nodeType != Xml.Node )
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
 
 		return _nodeName;
 	}
 	private function setNodeName( n : String ) : String {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
 
 		return _nodeName = n;
@@ -179,54 +179,54 @@ class NekoXml__ {
 
 	public property nodeValue(getNodeValue,setNodeValue) : String;
 	private function getNodeValue() : String {
-		if( nodeType == Xml.Node || nodeType == Xml.Document ) 
+		if( nodeType == Xml.Element || nodeType == Xml.Document )
 			throw "bad nodeType";
 
 		return _nodeValue;
 	}
 	private function setNodeValue( v : String ) : String {
-		if( nodeType == Xml.Node || nodeType == Xml.Document ) 
+		if( nodeType == Xml.Element || nodeType == Xml.Document )
 			throw "bad nodeType";
-		
+
 		return _nodeValue = v;
 	}
 
 	public function get( att : String ) : String {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
+
 		return Reflect.field( _attributes, att );
 	}
-	
+
 	public function set( att : String, value : String ) : Void {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
+
 		Reflect.setField (_attributes, att, value );
 	}
-	
+
 	public function remove( att : String ) : Void{
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
+
 		Reflect.deleteField( _attributes, att );
 	}
-	
+
 	public function exists( att : String ) : Bool {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		
+
 		return Reflect.hasField( _attributes, att );
 	}
 
 	public function attributes() : Iterator<String> {
-		if( nodeType != Xml.Node ) 
+		if( nodeType != Xml.Element )
 			throw "bad nodeType";
 
 		return Reflect.fields( _attributes ).iterator();
 	}
 
-	
+
 	public function iterator(){
 		return untyped {
 			cur: 0,
@@ -240,9 +240,9 @@ class NekoXml__ {
 		}
 	}
 
-	public function nodes(){
+	public function elements(){
 		var nextElement = untyped function( cur, x ) {
-			while( x[cur] != null && x[cur].nodeType != Xml.Node ){
+			while( x[cur] != null && x[cur].nodeType != Xml.Element ){
 				cur++;
 			}
 			return cur;
@@ -263,10 +263,10 @@ class NekoXml__ {
 		}
 	}
 
-	public function nodesNamed( name : String ){
+	public function elementsNamed( name : String ){
 		var nextElement = untyped function( cur, x ) {
 			var t = x[cur];
-			while( t != null && (t.nodeType != Xml.Node || t.nodeName != name) ){
+			while( t != null && (t.nodeType != Xml.Element || t.nodeName != name) ){
 				cur++;
 			}
 			return cur;
@@ -291,23 +291,23 @@ class NekoXml__ {
 		return _children[0];
 	}
 
-	public function firstNode() : Xml {
+	public function firstElement() : Xml {
 		var cur = 0;
-		while( _children[cur] != null && _children[cur].nodeType != Xml.Node ){
+		while( _children[cur] != null && _children[cur].nodeType != Xml.Element ){
 			cur++;
 		}
 
 		return _children[cur];
 	}
-	
+
 	public function addChild( x : Xml ) : Void {
 		_children.push( x );
 	}
-	
+
 	public function removeChild( x : Xml ) : Bool {
 		return _children.remove( x );
 	}
-	
+
 	public function insertChild( x : Xml, pos : Int ) : Void {
 		_children.insert( pos, x );
 	}
@@ -318,7 +318,7 @@ class NekoXml__ {
 
 		var s = new StringBuf();
 
-		if( nodeType == Xml.Node ) {
+		if( nodeType == Xml.Element ) {
 			s.add("<");
 			s.add(nodeName);
 			for( k in Reflect.fields(_attributes) ) {
@@ -334,11 +334,11 @@ class NekoXml__ {
 			}
 			s.add(">");
 		}
-	
+
 		for( x in iterator() )
 			s.add(x);
 
-		if( nodeType == Xml.Node ) {
+		if( nodeType == Xml.Element ) {
 			s.add("</");
 			s.add(nodeName);
 			s.add(">");

+ 31 - 31
std/tools/haxedoc/Main.hx

@@ -257,15 +257,15 @@ class DocView {
 
 	static var entries = new Array();
 
-	static function processType( x : Node ) {
+	static function processType( x : Xml ) {
 		var p = new Array();
 		switch( x.nodeName )  {
 		case "unknown":
 			return tunknown;
 		case "c":
-			return tclass(x.attributes.path,Lambda.amap(Lambda.array(x.nodes()),processType));
+			return tclass(x.get("path"),Lambda.amap(Lambda.array(x.elements()),processType));
 		case "e":
-			var path = x.attributes.path.split(".");
+			var path = x.get("path").split(".");
 			if( path.length >= 2 ) {
 				var c = path[path.length-2].charAt(0);
 				if( c >= "A" && c <= "Z" ) {
@@ -273,10 +273,10 @@ class DocView {
 					return tparam(path.join("."),name);
 				}
 			}
-			return tenum(x.attributes.path,Lambda.amap(Lambda.array(x.nodes()),processType));
+			return tenum(x.get("path"),Lambda.amap(Lambda.array(x.elements()),processType));
 		case "f":
-			var params = x.attributes.a.split(":");
-			var it = x.nodes();
+			var params = x.get("a").split(":");
+			var it = x.elements();
 			var pl = Lambda.amap(Lambda.array(params.iterator()),function(name) {
 				return {
 					name : name,
@@ -285,49 +285,49 @@ class DocView {
 			});
 			return tfunction(pl,processType(it.next()));
 		case "a":
-			var fields = Lambda.amap(Lambda.array(x.nodes()),function(x : Node) {
-				return { name : x.nodeName, t : processType(x.nodes().next()) };
+			var fields = Lambda.amap(Lambda.array(x.elements()),function(x : Xml) {
+				return { name : x.nodeName, t : processType(x.firstElement()) };
 			});
 			return tanon(fields);
 		case "d":
-			var x = x.nodes().next();
+			var x = x.firstElement();
 			return tdynamic( if( x == null) null else processType(x) );
 		default:
 			throw ("Unknown type "+x.nodeName);
 		}
 	}
 
-	static function processField( c : DocClass, x : Node ) {
-		var stat = try Reflect.field(x.attributes,"static") == "1" catch( e : Dynamic ) false;
-		var nl = x.nodes();
+	static function processField( c : DocClass, x : Xml ) {
+		var stat = x.get("static") == "1";
+		var nl = x.elements();
 		var t = processType(nl.next());
 		var f = new DocField(x.nodeName,stat,t);
 		f.parent = c;
 		var doc = nl.next();
 		if( doc != null )
-			f.doc = doc.firstChild.nodeValue;
+			f.doc = doc.firstChild().nodeValue;
 		return f;
 	}
 
-	static function processClass(x : Node) {
-		var path = x.attributes.path;
-		if( try Reflect.field(x.attributes,"private") == "1" catch( e : Dynamic ) false )
+	static function processClass(x : Xml) {
+		var path = x.get("path");
+		if( x.get("private") == "1" )
 			return;
 		if( StringTools.endsWith(path,"__") )
 			return;
 		if( findEntry(entries,path.split(".")) != null )
 			return;
 		var c = new DocClass(path,x.nodeName != "class");
-		c.params = x.attributes.params.split(":");
+		c.params = x.get("params").split(":");
 		if( c.isEnum ) {
-			for( m in x.nodes() ) {
+			for( m in x.elements() ) {
 				if( m.nodeName == "haxe:doc" ) {
-					c.doc = m.firstChild.nodeValue;
+					c.doc = m.firstChild().nodeValue;
 					continue;
 				}
-				var l = Lambda.array(m.nodes());
-				var t = if( m.attributes.a == null ) null else {
-					var names = m.attributes.a.split(":");
+				var l = Lambda.array(m.elements());
+				var t = if( m.get("a") == null ) null else {
+					var names = m.get("a").split(":");
 					var params = Lambda.amap(names,function(name) {
 						return {
 							name : name,
@@ -341,12 +341,12 @@ class DocView {
 				c.fields.push(f);
 			}
 		} else {
-			for( m in x.nodes() ) {
+			for( m in x.elements() ) {
 				if( m.nodeName == "haxe:doc" ) {
-					c.doc = m.firstChild.nodeValue;
+					c.doc = m.firstChild().nodeValue;
 					continue;
 				}
-				if( try Reflect.field(m.attributes,"public") == "1" catch( e : Dynamic ) false )
+				if( m.get("public") == "1" )
 					c.fields.push(processField(c,m));
 			}
 		}
@@ -454,8 +454,8 @@ class DocView {
 
 	static function loadFile(file) {
 		var data = neko.File.getContent(Web.getCwd()+file);
-		var x = XmlParser.parse(data).firstChild;
-		for( c in x.nodes() )
+		var x = Xml.parse(data).firstChild();
+		for( c in x.elements() )
 			processClass(c);
 	}
 
@@ -463,8 +463,8 @@ class DocView {
 		Url.buffer.add(s);
 	}
 
-	static function displayHtml(html : Node) {
-		if( html.nodeType != Node.ELEMENT_NODE ) {
+	static function displayHtml(html : Xml) {
+		if( html.nodeType != Xml.Element ) {
 			print(html.toString());
 			return;
 		}
@@ -492,8 +492,8 @@ class DocView {
 		}
 		print("<");
 		print(html.nodeName);
-		for( k in Reflect.fields(html.attributes) )
-			print(" "+k+"=\""+Reflect.field(html.attributes,k)+"\"");
+		for( k in html.attributes() )
+			print(" "+k+"=\""+html.get(k)+"\"");
 		print(">");
 		for( c in html.childNodes )
 			displayHtml(c);