XMLParser.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="XMLParser" inherits="Reference" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Low-level class for creating parsers for [url=https://en.wikipedia.org/wiki/XML]XML[/url] 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. <description>
  15. Gets the amount of attributes in the current element.
  16. </description>
  17. </method>
  18. <method name="get_attribute_name" qualifiers="const">
  19. <return type="String" />
  20. <argument index="0" name="idx" type="int" />
  21. <description>
  22. Gets the name of the attribute specified by the index in [code]idx[/code] argument.
  23. </description>
  24. </method>
  25. <method name="get_attribute_value" qualifiers="const">
  26. <return type="String" />
  27. <argument index="0" name="idx" type="int" />
  28. <description>
  29. Gets the value of the attribute specified by the index in [code]idx[/code] argument.
  30. </description>
  31. </method>
  32. <method name="get_current_line" qualifiers="const">
  33. <return type="int" />
  34. <description>
  35. Gets the current line in the parsed file (currently not implemented).
  36. </description>
  37. </method>
  38. <method name="get_named_attribute_value" qualifiers="const">
  39. <return type="String" />
  40. <argument index="0" name="name" type="String" />
  41. <description>
  42. Gets the value of a certain attribute of the current element by name. This will raise an error if the element has no such attribute.
  43. </description>
  44. </method>
  45. <method name="get_named_attribute_value_safe" qualifiers="const">
  46. <return type="String" />
  47. <argument index="0" name="name" type="String" />
  48. <description>
  49. Gets the value of a certain attribute of the current element by name. This will return an empty [String] if the attribute is not found.
  50. </description>
  51. </method>
  52. <method name="get_node_data" qualifiers="const">
  53. <return type="String" />
  54. <description>
  55. Gets the contents of a text node. This will raise an error in any other type of node.
  56. </description>
  57. </method>
  58. <method name="get_node_name" qualifiers="const">
  59. <return type="String" />
  60. <description>
  61. Gets the name of the current element node. This will raise an error if the current node type is neither [constant NODE_ELEMENT] nor [constant NODE_ELEMENT_END].
  62. </description>
  63. </method>
  64. <method name="get_node_offset" qualifiers="const">
  65. <return type="int" />
  66. <description>
  67. Gets the byte offset of the current node since the beginning of the file or buffer.
  68. </description>
  69. </method>
  70. <method name="get_node_type">
  71. <return type="int" enum="XMLParser.NodeType" />
  72. <description>
  73. Gets the type of the current node. Compare with [enum NodeType] constants.
  74. </description>
  75. </method>
  76. <method name="has_attribute" qualifiers="const">
  77. <return type="bool" />
  78. <argument index="0" name="name" type="String" />
  79. <description>
  80. Check whether the current element has a certain attribute.
  81. </description>
  82. </method>
  83. <method name="is_empty" qualifiers="const">
  84. <return type="bool" />
  85. <description>
  86. Check whether the current element is empty (this only works for completely empty tags, e.g. [code]&lt;element \&gt;[/code]).
  87. </description>
  88. </method>
  89. <method name="open">
  90. <return type="int" enum="Error" />
  91. <argument index="0" name="file" type="String" />
  92. <description>
  93. Opens an XML file for parsing. This returns an error code.
  94. </description>
  95. </method>
  96. <method name="open_buffer">
  97. <return type="int" enum="Error" />
  98. <argument index="0" name="buffer" type="PoolByteArray" />
  99. <description>
  100. Opens an XML raw buffer for parsing. This returns an error code.
  101. </description>
  102. </method>
  103. <method name="read">
  104. <return type="int" enum="Error" />
  105. <description>
  106. Reads the next node of the file. This returns an error code.
  107. </description>
  108. </method>
  109. <method name="seek">
  110. <return type="int" enum="Error" />
  111. <argument index="0" name="position" type="int" />
  112. <description>
  113. Moves the buffer cursor to a certain offset (since the beginning) and read the next node there. This returns an error code.
  114. </description>
  115. </method>
  116. <method name="skip_section">
  117. <return type="void" />
  118. <description>
  119. 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.
  120. </description>
  121. </method>
  122. </methods>
  123. <constants>
  124. <constant name="NODE_NONE" value="0" enum="NodeType">
  125. There's no node (no file or buffer opened).
  126. </constant>
  127. <constant name="NODE_ELEMENT" value="1" enum="NodeType">
  128. Element (tag).
  129. </constant>
  130. <constant name="NODE_ELEMENT_END" value="2" enum="NodeType">
  131. End of element.
  132. </constant>
  133. <constant name="NODE_TEXT" value="3" enum="NodeType">
  134. Text node.
  135. </constant>
  136. <constant name="NODE_COMMENT" value="4" enum="NodeType">
  137. Comment node.
  138. </constant>
  139. <constant name="NODE_CDATA" value="5" enum="NodeType">
  140. CDATA content.
  141. </constant>
  142. <constant name="NODE_UNKNOWN" value="6" enum="NodeType">
  143. Unknown node.
  144. </constant>
  145. </constants>
  146. </class>