XMLp Component
Properties Methods Events Configuration Settings Errors
The XMLp component implements a SAX2-compliant XML parser with XPath DOM traversal that can be used to parse and verify the structure of XML documents.
Syntax
TipwXMLp
Remarks
The XMLp component parses XML documents and verifies that they are well-formed. The results are provided through a set of events complying with the SAX2 specification.
In addition, the document structure may be queried through an XPath mechanism that supports a subset of the XPath specification.
The parser is optimized for read applications, with a very fast engine that builds internal DOM structures with close to zero heap allocations.
The component takes pieces of XML code through the Input method, until Flush is called. The document is parsed and fires events like StartElement, EndElement, Characters, IgnorableWhitespace, PI, etc. Entities are evaluated inside the EvalEntity event. If BuildDOM is set to True, an internal DOM structure is created, which in turn enables properties such as XPath, XElement, XText, etc. which allow traversal of the document structure.
When XPath is set to a valid path, XElement points to the name of the element, with XParent, XNamespace, XPrefix, XChildren, and XText providing other properties of the element. The XAttributes properties provides the attributes of the current element.
An additional "relaxed" mode allows for lexical parsing of non-XML documents (e.g. HTML). This is enabled by setting Validate to False. In this case, events will be fired as elements, entities, etc. are encountered, but the structure of the document will not be checked for "well-formedness", and the internal DOM structure will not be built.
Property List
The following is the full list of the properties of the component with short descriptions. Click on the links for further details.
BuildDOM | When True, an internal object model of the XML document is created. |
ExtraNameChars | Extra characters for the parser to consider as name characters. |
ExtraSpaceChars | Extra characters for the parser to consider as white space. |
FlushOnEOL | If set, the parser flushes its text buffer after every line of text. |
NamespaceCount | The number of records in the Namespace arrays. |
NamespacePrefix | The Prefix for the Namespace . |
NamespaceURI | Namespace URI associated with the corresponding Prefix . |
Offset | Current offset of the document being parsed. |
Validate | When True, the parser checks that the document consists of well-formed XML. |
AttrCount | The number of records in the Attr arrays. |
AttrName | The Name provides the local name (without prefix) of the attribute. |
AttrNamespace | Attribute namespace. |
AttrPrefix | Attribute prefix (if any). |
AttrValue | Attribute value. |
XChildrenCount | The number of records in the XChild arrays. |
XChildName | The Name property provides the local name (without prefix) of the element. |
XChildNamespace | Namespace of the element. |
XChildPrefix | Prefix of the element (if any). |
XChildXText | The inner text of the element. |
XElement | The name of the current element. |
XNamespace | The namespace of the current element. |
XParent | The parent of the current element. |
XPath | Provides a way to point to a specific element in the document. |
XPrefix | The prefix of the current element. |
XSubTree | A snapshot of the current element in the document. |
XText | The text of the current element. |
Method List
The following is the full list of the methods of the component with short descriptions. Click on the links for further details.
Attr | Returns the value of the specified attribute. |
Config | Sets or retrieves a configuration setting . |
Flush | Flushes the parser and checks its end state. |
HasXPath | Determines whether a specific element exists in the document. |
Input | Provides input to the parser. |
LoadDOM | Loads the DOM from a file. |
ParseFile | Parses the file specified by FileName. |
Reset | Resets the parser. |
SaveDOM | Saves the DOM to a file. |
Event List
The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.
Characters | Fired for plain text segments of the input stream. |
Comment | Fired when a comment section is encountered. |
EndElement | Fired when an end-element tag is encountered. |
EndPrefixMapping | Fired when leaving the scope of a namespace declaration. |
Error | Information about errors during data delivery. |
EvalEntity | Fired every time an entity needs to be evaluated. |
IgnorableWhitespace | Fired when a section of ignorable whitespace is encountered. |
Meta | Fired when a meta section is encountered. |
PI | Fired when a processing instruction section is encountered. |
SpecialSection | Fired when a special section is encountered. |
StartElement | Fired when a begin-element tag is encountered in the document. |
StartPrefixMapping | Fired when entering the scope of a namespace declaration. |
Configuration Settings
The following is a list of configuration settings for the component with short descriptions. Click on the links for further details.
IgnoreBadAttributePrefixes | If true, bad (unknown) attribute prefixes are ignored. |
IgnoreBadElementPrefixes | If true, bad (unknown) element prefixes are ignored. |
CacheContent | If true, the original XML is saved in a buffer. |
ErrorOnEmptyAttr | If true, passing an invalid attribute to the Attr method will throw an exception. |
PreserveWhitespace | If true, leading and trailing whitespace in element text is preserved. |
CodePage | The system code page used for Unicode to Multibyte translations. |