| Extracted from Pike v7.8 release 866 at 2018-07-18.

[Top]
Parser
Parser.XML
Parser.XML.Tree
Parser.XML.Tree.XMLParser

# Method Parser.XML.Tree.XMLParser()->node_factory()

Method node_factory

  `this_program node_factory(int type, string name, mapping attr, string text)`

Description

  Factory for creating nodes.

Parameter `type`

  Type of node to create. One of:

  `XML_TEXT` | XML text. text contains a string with the text.
  `XML_COMMENT` | XML comment. text contains a string with the comment text.
  `XML_HEADER` | `<?xml?>`-header attr contains a mapping with the attributes.
  `XML_PI` | XML processing instruction. name contains the name of the processing instruction and text the remainder.
  `XML_ELEMENT` | XML element tag. name contains the name of the tag and attr the attributes.
  `XML_DOCTYPE` | DTD information.
  `DTD_ENTITY`
  `DTD_ELEMENT`
  `DTD_ATTLIST`
  `DTD_NOTATION`

Parameter `name`

  Name of the tag if applicable.

Parameter `attr`

  Attributes for the tag if applicable.

Parameter `text`

  Contained text of the tab if any.

  This function is called during parsning to create the various XML nodes.

  Overload this function to provide application-specific XML nodes.

Returns

  Returns a node object representing the XML tag, or `0` (zero) if the subtree rooted in the tag should be cut.

Note

  This function is not available in Pike 7.6 and earlier.