![]() |
Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2024.
|
Allow to read xml files. More...
Public Types | |
enum | ErrorEnum { NoError = 0 , NotWellFormedError = 3 , PrematureEndOfDocumentError = 4 , UnexpectedElementError = 1 } |
The type of the current error. More... | |
enum | TokenTypeEnum { NoToken = 0 , Invalid = 1 , StartDocument = 2 , EndDocument = 3 , StartElement = 4 , EndElement = 5 , Characters = 6 , Comment = 7 , DTD = 8 , EntityReference = 9 , ProcessingInstruction = 10 } |
The token type. More... | |
Public Member Functions | |
boolean | AtEnd () |
Return if the end of the file has been reached (all the file has been read or an error has occurred) More... | |
Array< Object > | Attributes () |
Get the attributes of a StartElement. More... | |
string | DocumentEncoding () |
If the TokenType() is StartDocument, this function returns the encoding string as specified in the XML declaration. Otherwise an empty string is returned. More... | |
string | DocumentVersion () |
If the TokenType() is StartDocument, this function returns the version string as specified in the XML declaration. Otherwise an empty string is returned. More... | |
ErrorEnum | Error () |
Return the type of the current error, or NoError if no error occurred. More... | |
boolean | HasError () |
Return if an error has occurred. More... | |
boolean | IsStandaloneDocument () |
Return if this document has been declared standalone in the XML declaration. If no XML declaration has been parsed, this function returns false. More... | |
boolean | IsWhitespace () |
Return if the reader reports characters that only consist of white-space. More... | |
number | LineNumber () |
Return the current line number, starting with 1. More... | |
string | Name () |
Return the local name of a StartElement, EndElement, or an EntityReference. More... | |
string | NamespaceUri () |
Return the namespaceUri of a StartElement or EndElement. More... | |
TokenTypeEnum | ReadNext () |
Read the next token and return its type. More... | |
SetFile (SFile file) | |
Set the current file to device. Setting the device resets reader. More... | |
SkipCurrentElement () | |
Read until the end of the current element, skipping any child nodes. This function is useful for skipping unknown elements. The current element is the element matching the most recently parsed start element of which a matching end element has not yet been reached. When the parser has reached the end element, the current element becomes the parent element. More... | |
SXmlReader () | |
Default constructor to instantiate a XmlReader. More... | |
string | Text () |
Return the text of Characters, Comment, DTD, or EntityReference. More... | |
string | TokenString () |
Return the reader's current token as string. More... | |
TokenTypeEnum | TokenType () |
Return the type of the current token. More... | |
string | toString () |
Get the type of the variable. More... | |
Static Public Member Functions | |
static SXmlReader | New () |
Default constructor to instantiate a XmlReader. More... | |
Allow to read xml files.
Sample on how to use this class:
The type of the current error.
The token type.
Enumerator | |
---|---|
NoToken | The reader has not yet read anything. |
Invalid | An error has occurred, reported in Error(). |
StartDocument | The reader reports the XML version number in DocumentVersion(), and the encoding as specified in the XML document in DocumentEncoding(). |
EndDocument | The reader reports the end of the document. |
StartElement | The reader reports the start of an element. |
EndElement | The reader reports the end of an element with NamespaceUri() and Name(). |
Characters | IsWhitespace() returns true. |
Comment | The reader reports a comment in Text(). |
DTD | The reader reports a DTD (Document Type Definition) in Text() |
EntityReference | The reader reports an entity reference that could not be resolved. |
ProcessingInstruction | The reader reports a processing instruction. |
SXmlReader::SXmlReader | ( | ) |
Default constructor to instantiate a XmlReader.
boolean SXmlReader::AtEnd | ( | ) |
Return if the end of the file has been reached (all the file has been read or an error has occurred)
Array< Object > SXmlReader::Attributes | ( | ) |
Get the attributes of a StartElement.
string SXmlReader::DocumentEncoding | ( | ) |
If the TokenType() is StartDocument, this function returns the encoding string as specified in the XML declaration. Otherwise an empty string is returned.
string SXmlReader::DocumentVersion | ( | ) |
If the TokenType() is StartDocument, this function returns the version string as specified in the XML declaration. Otherwise an empty string is returned.
ErrorEnum SXmlReader::Error | ( | ) |
Return the type of the current error, or NoError if no error occurred.
boolean SXmlReader::HasError | ( | ) |
Return if an error has occurred.
boolean SXmlReader::IsStandaloneDocument | ( | ) |
Return if this document has been declared standalone in the XML declaration. If no XML declaration has been parsed, this function returns false.
boolean SXmlReader::IsWhitespace | ( | ) |
Return if the reader reports characters that only consist of white-space.
number SXmlReader::LineNumber | ( | ) |
Return the current line number, starting with 1.
string SXmlReader::Name | ( | ) |
Return the local name of a StartElement, EndElement, or an EntityReference.
string SXmlReader::NamespaceUri | ( | ) |
Return the namespaceUri of a StartElement or EndElement.
|
static |
Default constructor to instantiate a XmlReader.
TokenTypeEnum SXmlReader::ReadNext | ( | ) |
Read the next token and return its type.
SXmlReader::SetFile | ( | SFile | file | ) |
Set the current file to device. Setting the device resets reader.
file | (SFile) The name of the file. |
SXmlReader::SkipCurrentElement | ( | ) |
Read until the end of the current element, skipping any child nodes. This function is useful for skipping unknown elements. The current element is the element matching the most recently parsed start element of which a matching end element has not yet been reached. When the parser has reached the end element, the current element becomes the parent element.
string SXmlReader::Text | ( | ) |
Return the text of Characters, Comment, DTD, or EntityReference.
string SXmlReader::TokenString | ( | ) |
Return the reader's current token as string.
TokenTypeEnum SXmlReader::TokenType | ( | ) |
Return the type of the current token.
string SXmlReader::toString | ( | ) |
Get the type of the variable.