2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-03-16 23:01:02 +01:00
<class name= "XMLParser" inherits= "Reference" version= "3.5" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 22:42:36 +02:00
<brief_description >
2019-06-22 01:04:47 +02:00
Low-level class for creating parsers for [url=https://en.wikipedia.org/wiki/XML]XML[/url] files.
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2019-06-22 01:04:47 +02:00
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.
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "get_attribute_count" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Gets the amount of attributes in the current element.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_attribute_name" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "String" />
<argument index= "0" name= "idx" type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Gets the name of the attribute specified by the index in [code]idx[/code] argument.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_attribute_value" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "String" />
<argument index= "0" name= "idx" type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Gets the value of the attribute specified by the index in [code]idx[/code] argument.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_current_line" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Gets the current line in the parsed file (currently not implemented).
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_named_attribute_value" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "String" />
<argument index= "0" name= "name" type= "String" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
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.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_named_attribute_value_safe" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "String" />
<argument index= "0" name= "name" type= "String" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
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.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_node_data" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "String" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Gets the contents of a text node. This will raise an error in any other type of node.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_node_name" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "String" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
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].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_node_offset" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Gets the byte offset of the current node since the beginning of the file or buffer.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_node_type" >
2021-07-30 15:28:05 +02:00
<return type= "int" enum= "XMLParser.NodeType" />
2017-09-12 22:42:36 +02:00
<description >
2019-12-06 23:09:20 +01:00
Gets the type of the current node. Compare with [enum NodeType] constants.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "has_attribute" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
<argument index= "0" name= "name" type= "String" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Check whether the current element has a certain attribute.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "is_empty" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Check whether the current element is empty (this only works for completely empty tags, e.g. [code]< element \> [/code]).
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "open" >
2021-07-30 15:28:05 +02:00
<return type= "int" enum= "Error" />
<argument index= "0" name= "file" type= "String" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Opens an XML file for parsing. This returns an error code.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "open_buffer" >
2021-07-30 15:28:05 +02:00
<return type= "int" enum= "Error" />
<argument index= "0" name= "buffer" type= "PoolByteArray" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Opens an XML raw buffer for parsing. This returns an error code.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "read" >
2021-07-30 15:28:05 +02:00
<return type= "int" enum= "Error" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Reads the next node of the file. This returns an error code.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "seek" >
2021-07-30 15:28:05 +02:00
<return type= "int" enum= "Error" />
<argument index= "0" name= "position" type= "int" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Moves the buffer cursor to a certain offset (since the beginning) and read the next node there. This returns an error code.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "skip_section" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2017-09-12 22:42:36 +02:00
<description >
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.
</description>
</method>
</methods>
<constants >
2017-11-24 23:16:30 +01:00
<constant name= "NODE_NONE" value= "0" enum= "NodeType" >
2020-01-23 11:14:14 +01:00
There's no node (no file or buffer opened).
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "NODE_ELEMENT" value= "1" enum= "NodeType" >
2020-01-23 11:14:14 +01:00
Element (tag).
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "NODE_ELEMENT_END" value= "2" enum= "NodeType" >
2020-01-23 11:14:14 +01:00
End of element.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "NODE_TEXT" value= "3" enum= "NodeType" >
2020-01-23 11:14:14 +01:00
Text node.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "NODE_COMMENT" value= "4" enum= "NodeType" >
2020-01-23 11:14:14 +01:00
Comment node.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "NODE_CDATA" value= "5" enum= "NodeType" >
2020-01-23 11:14:14 +01:00
CDATA content.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "NODE_UNKNOWN" value= "6" enum= "NodeType" >
2020-01-23 11:14:14 +01:00
Unknown node.
2017-09-12 22:42:36 +02:00
</constant>
</constants>
</class>