XMLParser.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="XMLParser" inherits="Reference" category="Core" version="3.1.2">
  3. <brief_description>
  4. Low-level class for creating parsers for XML files.
  5. </brief_description>
  6. <description>
  7. This class can serve as base to make custom XML parsers. Since XML is a very flexible standard, this interface is low level so it can be applied to any possible schema.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="get_attribute_count" qualifiers="const">
  13. <return type="int">
  14. </return>
  15. <description>
  16. Get the amount of attributes in the current element.
  17. </description>
  18. </method>
  19. <method name="get_attribute_name" qualifiers="const">
  20. <return type="String">
  21. </return>
  22. <argument index="0" name="idx" type="int">
  23. </argument>
  24. <description>
  25. Get the name of the attribute specified by the index in [code]idx[/code] argument.
  26. </description>
  27. </method>
  28. <method name="get_attribute_value" qualifiers="const">
  29. <return type="String">
  30. </return>
  31. <argument index="0" name="idx" type="int">
  32. </argument>
  33. <description>
  34. Get the value of the attribute specified by the index in [code]idx[/code] argument.
  35. </description>
  36. </method>
  37. <method name="get_current_line" qualifiers="const">
  38. <return type="int">
  39. </return>
  40. <description>
  41. Get the current line in the parsed file (currently not implemented).
  42. </description>
  43. </method>
  44. <method name="get_named_attribute_value" qualifiers="const">
  45. <return type="String">
  46. </return>
  47. <argument index="0" name="name" type="String">
  48. </argument>
  49. <description>
  50. Get the value of a certain attribute of the current element by name. This will raise an error if the element has no such attribute.
  51. </description>
  52. </method>
  53. <method name="get_named_attribute_value_safe" qualifiers="const">
  54. <return type="String">
  55. </return>
  56. <argument index="0" name="name" type="String">
  57. </argument>
  58. <description>
  59. Get the value of a certain attribute of the current element by name. This will return an empty [String] if the attribute is not found.
  60. </description>
  61. </method>
  62. <method name="get_node_data" qualifiers="const">
  63. <return type="String">
  64. </return>
  65. <description>
  66. Get the contents of a text node. This will raise an error in any other type of node.
  67. </description>
  68. </method>
  69. <method name="get_node_name" qualifiers="const">
  70. <return type="String">
  71. </return>
  72. <description>
  73. Get the name of the current element node. This will raise an error if the current node type is not [constant NODE_ELEMENT] nor [constant NODE_ELEMENT_END]
  74. </description>
  75. </method>
  76. <method name="get_node_offset" qualifiers="const">
  77. <return type="int">
  78. </return>
  79. <description>
  80. Get the byte offset of the current node since the beginning of the file or buffer.
  81. </description>
  82. </method>
  83. <method name="get_node_type">
  84. <return type="int" enum="XMLParser.NodeType">
  85. </return>
  86. <description>
  87. Get the type of the current node. Compare with [code]NODE_*[/code] constants.
  88. </description>
  89. </method>
  90. <method name="has_attribute" qualifiers="const">
  91. <return type="bool">
  92. </return>
  93. <argument index="0" name="name" type="String">
  94. </argument>
  95. <description>
  96. Check whether or not the current element has a certain attribute.
  97. </description>
  98. </method>
  99. <method name="is_empty" qualifiers="const">
  100. <return type="bool">
  101. </return>
  102. <description>
  103. Check whether the current element is empty (this only works for completely empty tags, e.g. &lt;element \&gt;).
  104. </description>
  105. </method>
  106. <method name="open">
  107. <return type="int" enum="Error">
  108. </return>
  109. <argument index="0" name="file" type="String">
  110. </argument>
  111. <description>
  112. Open a XML file for parsing. This returns an error code.
  113. </description>
  114. </method>
  115. <method name="open_buffer">
  116. <return type="int" enum="Error">
  117. </return>
  118. <argument index="0" name="buffer" type="PoolByteArray">
  119. </argument>
  120. <description>
  121. Open a XML raw buffer for parsing. This returns an error code.
  122. </description>
  123. </method>
  124. <method name="read">
  125. <return type="int" enum="Error">
  126. </return>
  127. <description>
  128. Read the next node of the file. This returns an error code.
  129. </description>
  130. </method>
  131. <method name="seek">
  132. <return type="int" enum="Error">
  133. </return>
  134. <argument index="0" name="position" type="int">
  135. </argument>
  136. <description>
  137. Move the buffer cursor to a certain offset (since the beginning) and read the next node there. This returns an error code.
  138. </description>
  139. </method>
  140. <method name="skip_section">
  141. <return type="void">
  142. </return>
  143. <description>
  144. Skips the current section. If the node contains other elements, they will be ignored and the cursor will go to the closing of the current element.
  145. </description>
  146. </method>
  147. </methods>
  148. <constants>
  149. <constant name="NODE_NONE" value="0" enum="NodeType">
  150. There's no node (no file or buffer opened)
  151. </constant>
  152. <constant name="NODE_ELEMENT" value="1" enum="NodeType">
  153. Element (tag)
  154. </constant>
  155. <constant name="NODE_ELEMENT_END" value="2" enum="NodeType">
  156. End of element
  157. </constant>
  158. <constant name="NODE_TEXT" value="3" enum="NodeType">
  159. Text node
  160. </constant>
  161. <constant name="NODE_COMMENT" value="4" enum="NodeType">
  162. Comment node
  163. </constant>
  164. <constant name="NODE_CDATA" value="5" enum="NodeType">
  165. CDATA content
  166. </constant>
  167. <constant name="NODE_UNKNOWN" value="6" enum="NodeType">
  168. Unknown node
  169. </constant>
  170. </constants>
  171. </class>