ElementTree.hx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package python.lib.xml.etree;
  2. import python.lib.Tuple.Tup2;
  3. import python.NativeIterable;
  4. import python.NativeIterator;
  5. extern class XMLParser {
  6. }
  7. extern class Element {
  8. public function getroot ():ElementTree;
  9. public var tag:String;
  10. public var attrib : Dict<String, String>;
  11. public var text:Null<String>;
  12. public function get <T>(key:String, def:T = null):T;
  13. public function set (key:String, val:String):Void;
  14. public function copy ():Element;
  15. public function keys ():Array<String>;
  16. public function items ():Array<Tup2<String, String>>;
  17. public function iter (tag:String):NativeIterable<Element>;
  18. public function iterfind (tag:String, namespaces:Dict<String,String> = null):NativeIterator<Element>;
  19. public function find (match:String, namespaces:Dict<String,String> = null):Null<Element>;
  20. public function findall (match:String, namespaces:Dict<String,String> = null):Array<Element>;
  21. static function __init__ ():Void
  22. {
  23. Syntax.importFromAs("xml.etree.ElementTree", "Element", "python.lib.xml.etree.Element");
  24. }
  25. }
  26. extern class ElementTree {
  27. public static function XML(text:String, ?parser:XMLParser):Element;
  28. public static function parse(xml:String):ElementTree;
  29. public function iter (tag:String):NativeIterable<Element>;
  30. public function find (match:String, namespaces:Dict<String,String> = null):Null<Element>;
  31. public function getroot ():Element;
  32. static function __init__ ():Void
  33. {
  34. Syntax.importAs("xml.etree.ElementTree", "python.lib.xml.etree.ElementTree");
  35. }
  36. }