XMLParser.xml 5.4 KB

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