IP*Works! V9 - Online Help
IP*Works! V9
Questions / Feedback?

XMLp Class

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.

Class Name

IPWorks_XMLp

Procedural Interface

 ipworks_xmlp_open();
 ipworks_xmlp_close($res);
 ipworks_xmlp_register_callback($res, $id, $function);
 ipworks_xmlp_get_last_error($res);
 ipworks_xmlp_get_last_error_code($res);
 ipworks_xmlp_set($res, $id, $index, $value);
 ipworks_xmlp_get($res, $id, $index);
 ipworks_xmlp_do_attr($res, $attrname);
 ipworks_xmlp_do_config($res, $configurationstring);
 ipworks_xmlp_do_flush($res);
 ipworks_xmlp_do_hasxpath($res, $xpath);
 ipworks_xmlp_do_input($res, $text);
 ipworks_xmlp_do_loaddom($res, $filename);
 ipworks_xmlp_do_parsefile($res, $filename);
 ipworks_xmlp_do_reset($res);
 ipworks_xmlp_do_savedom($res, $filename);

Remarks

The XMLp class 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 class 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 class with short descriptions. Click on the links for further details.

BuildDOMWhen True, an internal object model of the XML document is created.
ExtraNameCharsExtra characters for the parser to consider as name characters.
ExtraSpaceCharsExtra characters for the parser to consider as white space.
FlushOnEOLIf set, the parser flushes its text buffer after every line of text.
NamespaceCountThe number of records in the Namespace arrays.
NamespacePrefixThe Prefix for the Namespace .
NamespaceURINamespace URI associated with the corresponding Prefix .
OffsetCurrent offset of the document being parsed.
ValidateWhen True, the parser checks that the document consists of well-formed XML.
AttrCountThe number of records in the Attr arrays.
AttrNameThe Name provides the local name (without prefix) of the attribute.
AttrNamespaceAttribute namespace.
AttrPrefixAttribute prefix (if any).
AttrValueAttribute value.
XChildrenCountThe number of records in the XChild arrays.
XChildNameThe Name property provides the local name (without prefix) of the element.
XChildNamespaceNamespace of the element.
XChildPrefixPrefix of the element (if any).
XChildXTextThe inner text of the element.
XElementThe name of the current element.
XNamespaceThe namespace of the current element.
XParentThe parent of the current element.
XPathProvides a way to point to a specific element in the document.
XPrefixThe prefix of the current element.
XSubTreeA snapshot of the current element in the document.
XTextThe text of the current element.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

AttrReturns the value of the specified attribute.
ConfigSets or retrieves a configuration setting .
FlushFlushes the parser and checks its end state.
HasXPathDetermines whether a specific element exists in the document.
InputProvides input to the parser.
LoadDOMLoads the DOM from a file.
ParseFileParses the file specified by FileName.
ResetResets the parser.
SaveDOMSaves the DOM to a file.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

CharactersFired for plain text segments of the input stream.
CommentFired when a comment section is encountered.
EndElementFired when an end-element tag is encountered.
EndPrefixMappingFired when leaving the scope of a namespace declaration.
ErrorInformation about errors during data delivery.
EvalEntityFired every time an entity needs to be evaluated.
IgnorableWhitespaceFired when a section of ignorable whitespace is encountered.
MetaFired when a meta section is encountered.
PIFired when a processing instruction section is encountered.
SpecialSectionFired when a special section is encountered.
StartElementFired when a begin-element tag is encountered in the document.
StartPrefixMappingFired when entering the scope of a namespace declaration.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

IgnoreBadAttributePrefixesIf true, bad (unknown) attribute prefixes are ignored.
IgnoreBadElementPrefixesIf true, bad (unknown) element prefixes are ignored.
CacheContentIf true, the original XML is saved in a buffer.
ErrorOnEmptyAttrIf true, passing an invalid attribute to the Attr method will throw an exception.
PreserveWhitespaceIf true, leading and trailing whitespace in element text is preserved.
CodePageThe system code page used for Unicode to Multibyte translations.

 
 
Copyright (c) 2018 /n software inc. - All rights reserved.
Build 9.0.6635.0