Packages » Package simpledom

Package simpledom

Description:
This package consists of classes that constitute the SimpleDOM API. It allows you to parse well-formed XML documents to produce DOM-like trees that consist of elements, text nodes and processing instructions. You can also create custom parsers to create element trees where elements are represented by objects of different classes to provide some additional functionality on the parsed data.

Authors:
  • Dennis Popel

Classes:
  • SDCDATANode
  • SDCommentNode
  • SDDocument
    This class encapsulates the SimpleDOM document (including the prolog and root element)
  • SDElement
    This class represent a container element in an XML document. It supports adding and removing children as well as getting all elements with specified tag name or nodes that are instances of particular class. You can subclass SDElement and SDParser to provide your custom functionality beyond simple tree-like management of containers and character data nodes.
  • SDNode
    This is a base class for all elements in SimpleDOM API.
  • SDParser
    This is the basic XML parser that parses valid XML documents and returns their root elements. Using methods of SDElement and SDTextNode it is easy to traverse the elements and their attributes. The parser and the SimpleDOM API support UTF-8 encoding only. You can subclass SDParser and/or SDElement and SDTextNode to extend the default functionality (like the HTML package does).
  • SDParserException
    Exception of this type is thrown whenever SDParser encounters errors in source XML document. If this exception occurs, it means that the parsing was unsuccessful; however, this exception will still return partially parsed document in a call to its SDParserException::getRoot method (if any element could be successfully parsed).

    This class also defines several error numbers to supplement the xml extension error reporting (like file not found or CDATA before root etc.)
  • SDProcessingInstruction
    This class encapsulates a single processing instruction encountered in the source XML document. SDDocument implementations may want to extend this class to provide useful functionality of PIs.
  • SDTextNode
    A generic text (CData) node. SDParser will return instances of this class if it encounters character data sections in input document. In custom SDParser implementations it is possible to return subclasses of SDTextNode