|
Nux 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nu.xom.NodeFactory nux.xom.sandbox.TreeStructureCollector
public final class 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()
startMakingDocument
in class NodeFactory
public Nodes finishMakingElement(Element elem)
finishMakingElement
in class NodeFactory
public Element startMakingElement(String qname, String namespaceURI)
startMakingElement
in class NodeFactory
public Nodes makeAttribute(String qname, String namespaceURI, String value, Attribute.Type type)
makeAttribute
in class NodeFactory
public Nodes makeComment(String data)
makeComment
in class NodeFactory
public Nodes makeDocType(String rootElementName, String publicID, String systemID)
makeDocType
in class NodeFactory
public Nodes makeProcessingInstruction(String target, String data)
makeProcessingInstruction
in class NodeFactory
public Nodes makeText(String text)
makeText
in class NodeFactory
|
Nux 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |