Method Parser.XML.Tree.AbstractSimpleNode()->node_factory()


Method node_factory

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

Description

Optional factory for creating contained 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.

Define this function to provide application-specific XML nodes.

Returns

Returns one of

AbstractSimpleNode

A node object representing the XML tag.

int(0)

0 (zero) if the subtree rooted here should be cut.

zero

UNDEFINED to fall back to the next level of parser (ie behave as if this function does not exist).

Note

This function is only relevant for XML_ELEMENT nodes.

Note

This function is not available in Pike 7.6 and earlier.

Note

In Pike 8.0 and earlier this function was only called in root nodes.