Nux 1.4

nux.xom.sandbox
Class TreeStructureCollector

java.lang.Object
  extended bynu.xom.NodeFactory
      extended bynux.xom.sandbox.TreeStructureCollector

public final class TreeStructureCollector
extends NodeFactory

Streaming demo that collects and prints a hierarchical statistics summary of element and attribute instances. In practice, the summary can be seen as a first approximation of a formal schema, though it is inferred from a schemaless document.

Time complexity is O(nrNodes), i.e. a single pass algorithm. Space complexity is O(maxTreeDepth) for real-world documents, i.e. memory consumption is negligible; the algorithm can be run over arbitrarily large input documents.

Author:
whoschek.AT.lbl.DOT.gov, $Author: hoschek3 $

Constructor Summary
TreeStructureCollector()
           
 
Method Summary
 Document collect(Document doc)
           
 Nodes finishMakingElement(Element elem)
          
static void main(String[] args)
           
 Nodes makeAttribute(String qname, String namespaceURI, String value, Attribute.Type type)
          
 Nodes makeComment(String data)
          
 Nodes makeDocType(String rootElementName, String publicID, String systemID)
          
 Nodes makeProcessingInstruction(String target, String data)
          
 Nodes makeText(String text)
          
 Document startMakingDocument()
          
 Element startMakingElement(String qname, String namespaceURI)
          
 
Methods inherited from class nu.xom.NodeFactory
finishMakingDocument, makeRootElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeStructureCollector

public TreeStructureCollector()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

collect

public Document collect(Document doc)

startMakingDocument

public Document startMakingDocument()


finishMakingElement

public Nodes finishMakingElement(Element elem)


startMakingElement

public Element startMakingElement(String qname,
                                  String namespaceURI)


makeAttribute

public Nodes makeAttribute(String qname,
                           String namespaceURI,
                           String value,
                           Attribute.Type type)


makeComment

public Nodes makeComment(String data)


makeDocType

public Nodes makeDocType(String rootElementName,
                         String publicID,
                         String systemID)


makeProcessingInstruction

public Nodes makeProcessingInstruction(String target,
                                       String data)


makeText

public Nodes makeText(String text)


Nux 1.4