Compartilhar via


XML_NODE_INFO

4/8/2010

This structure is used with the IXMLNodeFactory interface.

Syntax

typedef struct _XML_NODE_INFO {
  DWORD dwSize;
  DWORD dwType;
  DWORD dwSubType;
  BOOL fTerminal;
  const WCHAR * pwcText;
  ULONG ulLen;
  ULONG ulNsPrefixLen;
  PVOID pNode;
  PVOID pReserved;
} XML_NODE_INFO;

Members

  • dwSize
    The size of this structure in bytes.
  • dwType
    The node type.
  • dwSubType
    The node subtype.
  • fTerminal
    True if this node cannot have any children. IXMLNodeFactory::BeginChildren and IXMLNodeFactory::EndChildren are guaranteed not to be called for this node.
  • pwcText
    This is either a tag name or a PCDATA text value. The lifetime of this pointer is the lifetime of the IXMLNodeFactory::CreateNode call. Element, attribute, and processing instruction tag names or attribute values of type ID, NMTOKEN, ENTITY, or NOTATION can have namespace prefixes.
  • ulLen
    The length of the element or attribute name.
  • ulNsPrefixLen
    The length of the namespace prefix, when present.
  • pNode
    This field can be used by the IXMLNodeFactory interface to RETURN an object representing the node. Because this is PVOID, the IXMLNodeFactory interface can build any tree representation, even a raw structure hierarchy.
  • pReserved
    For private communication between factories.

Remarks

This is essentially a callback interface so that custom node factories can build different kinds of object hierarchies that reflect the XML document. The IXMLNodeFactory interface does not have to create anything; it can just be searching for something in the XML document.

If a non-NULL pointer is returned in the pNode field of XML_NODE_INFO, this pointer will be passed back in by the parser as the pNodeParent in subsequent calls to IXMLNodeFactory::CreateNode for the children of that node. In other words, the XML parser maintains the parse context and passes in the appropriate parent pointer based on what it finds in the XML. The pNodeParent for root level nodes is equal to the argument provided in the IXMLParser::SetRoot call on the parser.

If the node objects must be reference counted, call IUnknown::AddRef before returning them, and then release them in IXMLNodeFactory::EndChildren. All nodes provided in the IXMLNodeFactory::Error method must be released in case the parser stops on an XML syntax error. The parser will always call IXMLNodeFactory::Error in all cases, eliminating the potential for leaking nodes.

Requirements

Header xmlparser.h
Library xmlparser.lib
Windows Mobile Pocket PC 2000 and later, Smartphone 2002 and later

See Also

Reference

HTML Control API Structures
IXMLNodeFactory
IXMLNodeFactory::CreateNode
IXMLNodeFactory::EndChildren
IXMLNodeFactory::Error
IXMLParser::SetRoot