Visitor class for an XML document.
This interface uses the Visitor pattern. The XML parser walks through the XML document and invokes the appropriate method in this visitor for each piece of markup it finds. By default, the methods do nothing; the application must subclass the visitor and override the methods for the events it's interested in. All applications are required to provide an implementation for the error callback.
virtual void XMLVisitor::data |
( |
const char * |
s, |
|
|
int |
length |
|
) |
| |
|
inlinevirtual |
Callback for a chunk of character data.
The XML parser will invoke this method once for every chunk of character data in the XML document, including whitespace separating elements (as required by the XML recommendation). Note that character data may be chunked arbitrarily: the character data content of an element may be returned in one large chunk or several consecutive smaller chunks.
- Parameters
-
s | A pointer to the beginning of the character data (not null). |
length | The number of characters in the chunk (may be zero). |
Reimplemented in KMLVisitor, VisitorOSM, StructVisitorGML, VisitorRawXML, VisitorGU, StructureVisitor, ContentVisitor, AnimPathVisitor, TagVisitor, LocationVisitor, EnviroOptionsVisitor, and PathsVisitor.
virtual void XMLVisitor::endXML |
( |
) | |
|
|
inlinevirtual |
Callback for the end of an XML document.
The XML parser will invoke this method once, at the end of the XML document, after all other methods are invoked, and only if there have been no parsing errors. The application can use this callback to close or write files, finalize data structures, and so on, but the application will need to be prepared to clean up any resources without this callback in the event of an error.
- See Also
- startXML
-
#error
Reimplemented in StructVisitorGML, StructureVisitor, ContentVisitor, AnimPathVisitor, MaterialDescriptorArrayVisitor, and LocationVisitor.
virtual void XMLVisitor::startElement |
( |
const char * |
name, |
|
|
const XMLAttributes & |
atts |
|
) |
| |
|
inlinevirtual |
Callback for the start of an XML element.
The XML parser will invoke this method at the beginning of every XML element. Start and end element calls will be balanced and properly nested: every element has both a start and end callback (even if it was specified with an XML empty element tag), there is exactly one root element, and every element must end before its parent does. Elements may not overlap. Note that the attribute list provided is volatile; it's contents are not guaranteed to persist after the end of the callback. If the application needs to keep a copy of the attribute list, it can make the copy with the XMLAttributesDefault class.
- Parameters
-
name | The name of the element that is starting (not null). |
atts | The element's attributes (not null). |
- See Also
- endElement
Reimplemented in KMLVisitor, VisitorOSM, StructVisitorGML, VisitorRawXML, VisitorGU, BioRegionVisitor, StructureVisitor, ContentVisitor, TParamsVisitor, AnimPathVisitor, PlantListVisitor, MaterialDescriptorArrayVisitor, TagVisitor, LocationVisitor, EnviroOptionsVisitor, and PathsVisitor.
virtual void XMLVisitor::startXML |
( |
) | |
|
|
inlinevirtual |
Callback for the start of an XML document.
The XML parser will invoke this method once, at the beginning of the XML document, before any other methods are invoked. The application can use this callback to set up data structures, open files, etc.
- See Also
- endXML
Reimplemented in StructVisitorGML, BioRegionVisitor, StructureVisitor, ContentVisitor, AnimPathVisitor, PlantListVisitor, MaterialDescriptorArrayVisitor, and LocationVisitor.