Class XMLVisitor

Inheritance Relationships

Derived Type

Class Documentation

class XMLVisitor

Implements the interface to the "Visitor pattern" (see the Accept() method.) If you call the Accept() method, it requires being passed a XMLVisitor class to handle callbacks. For nodes that contain other nodes (Document, Element) you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs are simply called with Visit().

If you return 'true' from a Visit method, recursive parsing will continue. If you return false, no children of this node or its siblings will be visited.

All flavors of Visit methods have a default implementation that returns 'true' (continue visiting). You need to only override methods that are interesting to you.

Generally Accept() is called on the XMLDocument, although all nodes support visiting.

You should never change the document from a callback.

Subclassed by tinyxml2::XMLPrinter

Public Functions

inline virtual ~XMLVisitor()
inline virtual bool VisitEnter(const XMLDocument&)

Visit a document.

inline virtual bool VisitExit(const XMLDocument&)

Visit a document.

inline virtual bool VisitEnter(const XMLElement&, const XMLAttribute*)

Visit an element.

inline virtual bool VisitExit(const XMLElement&)

Visit an element.

inline virtual bool Visit(const XMLDeclaration&)

Visit a declaration.

inline virtual bool Visit(const XMLText&)

Visit a text node.

inline virtual bool Visit(const XMLComment&)

Visit a comment node.

inline virtual bool Visit(const XMLUnknown&)

Visit an unknown node.