All Implemented Interfaces:
XMLReader

public class XMLFragmentReader extends DOMReader
Internal:

Purpose: An implementation of XMLReader for parsing XMLFragment Nodes into SAX events.

Responsibilities:

  • Walk the XMLFragment node's DOM tree and report sax events to the provided content handler
  • Report lexical events to the lexical handler if it's provided
  • Field Details

  • Constructor Details

  • Method Details

    • parse

      public void parse(Node node, String uri, String name) throws SAXException
      Overrides:
      parse in class DOMReader
      Throws:
      SAXException
    • reportElementEvents

      protected void reportElementEvents(Element elem) throws SAXException
      Overrides:
      reportElementEvents in class DOMReader
      Throws:
      SAXException
    • endDocument

      protected void endDocument() throws SAXException
      Trigger an endDocument event on the contenthandler.
      Overrides:
      endDocument in class DOMReader
      Throws:
      SAXException
    • startDocument

      protected void startDocument() throws SAXException
      Trigger a startDocument event on the contenthandler.
      Overrides:
      startDocument in class DOMReader
      Throws:
      SAXException
    • handleNewNamespaceDeclaration

      protected void handleNewNamespaceDeclaration(Element elem, String prefix, String namespaceURI)
      Overrides:
      handleNewNamespaceDeclaration in class DOMReader
    • handlePrefixedAttribute

      protected void handlePrefixedAttribute(Element elem) throws SAXException
      Handle prefixed attribute - may need to declare the namespace URI locally.
      Overrides:
      handlePrefixedAttribute in class DOMReader
      Throws:
      SAXException
    • endPrefixMappings

      protected void endPrefixMappings(Element elem) throws SAXException
      If there is a temporary namespace resolver for a given element, each entry contains a prefix that requires an endPrefixMapping event to be triggered
      Overrides:
      endPrefixMappings in class DOMReader
      Throws:
      SAXException
    • getTempResolver

      protected NamespaceResolver getTempResolver(Element elem)
      Returns the namespace resolver in the map of temporary namespace resolvers for a given element
      Returns:
      the namespace resolver in the map for elem, or a new resolver if none exists
    • cleanupNamespaceResolvers

      protected void cleanupNamespaceResolvers(Element elem)
      Remove any temporary namespace resolvers created while processing a given element.
    • resolveNamespacePrefix

      protected String resolveNamespacePrefix(String prefix)
      Convenience method that iterates over each namespace resolver in the resolver list until it locates a uri for 'prefix' or the final resolver is reached w/o success.
      Returns:
      true if a URI exists in one of the resolvers in the list, false otherwise
    • processParentNamespaces

      protected void processParentNamespaces(Element element) throws SAXException
      Process namespace declarations on parent elements if not the root. For each parent node from current to root place puch each onto a stack, then pop each off, calling startPrefixMapping for each XMLNS attribute. Using a stack ensures that the parent nodes are processed top down.
      Overrides:
      processParentNamespaces in class DOMReader
      Throws:
      SAXException
    • handleXsiTypeAttribute

      protected void handleXsiTypeAttribute(Attr attr) throws SAXException
      Overrides:
      handleXsiTypeAttribute in class DOMReader
      Throws:
      SAXException