|
Nux 1.4 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnu.xom.NodeFactory
nux.xom.sandbox.TreeStructureCollector
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.
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 |
public TreeStructureCollector()
Method Detail |
public static void main(String[] args) throws Exception
Exception
public Document collect(Document doc)
public Document startMakingDocument()
public Nodes finishMakingElement(Element elem)
public Element startMakingElement(String qname, String namespaceURI)
public Nodes makeAttribute(String qname, String namespaceURI, String value, Attribute.Type type)
public Nodes makeComment(String data)
public Nodes makeDocType(String rootElementName, String publicID, String systemID)
public Nodes makeProcessingInstruction(String target, String data)
public Nodes makeText(String text)
|
Nux 1.4 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |