|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.graphdrawing.graphml.reader.dom.DOMGraphMLParser
DOM implementation of a GraphML parser.
In order to use the parser, an instance of
GraphElementFactory
has to be provided
which is reponsible for the creation of the graph elements defined in the
input data.
To process data defined in key/data elements, instances of
DOMInputHandler
can be registered.
| Field Summary | |
protected boolean |
validationEnabled
validation |
| Constructor Summary | |
DOMGraphMLParser()
Create a new instance of this parser |
|
| Method Summary | |
void |
addDOMInputHandler(DOMInputHandler handler)
Adds an input handler. |
void |
addXMLAttributeParser(XMLAttributesParser handler)
Adds an XML attributes parser. |
protected DOMGraphMLParseContext |
createParseContext()
Create a new parse context. |
DocumentBuilderFactory |
getDocumentBuilderFactory()
Returns the Document Builder Factory used that is. |
String |
getGraphmlCoreNS()
Deprecated. The core graphml namespace is determined automatically now |
IdAcceptor |
getIdAcceptor()
Get the IdAcceptor instance that has been registered previously with
setIdAcceptor(org.graphdrawing.graphml.reader.IdAcceptor).
|
GraphMLParseErrorHandler |
getParseErrorHandler()
Get the error handler instance that is used for this parse process. |
Object |
parse(InputStream is)
Parses the content of an input stream. |
Object |
parse(InputStream is,
EntityResolver resolver)
Parses the content of an input stream. |
protected void |
parseDataNodes(Map dataNodes,
DOMInputHandler handler)
Called whenever an input handler should parse one or more data tags that are associated with a core graphml
element.
|
Object |
parseDocument(Document doc)
Start parsing a given document. |
protected void |
parseEdgeNode(Node edgeNode)
Called whenever the edge tag in the graphml input is encountered. |
protected void |
parseEndPointNode(Node endPointNode)
Called whenever the node tag for a hyperedge is encountered |
Object |
parseGraphMLNode(Node graphMLNode)
Parses the graphml node in a DOM tree. |
protected void |
parseGraphNode(Node graphNode)
Called whenever the graph tag in the graphml input is encountered. |
protected void |
parseHyperEdgeNode(Node hyperedgeNode)
Called whenever the hyperedge tag in the graphml input is encountered. |
protected void |
parseKeyNode(Node keyNode)
Called whenever the key tag for a data attribute definition is encountered |
protected void |
parseNodeNode(Node nodeNode)
Called whenever the node tag in the graphml input is encountered. |
protected void |
parsePortNode(Node portNode)
Called whenever the port tag in the graphml input is encountered.
|
void |
removeDOMInputHandler(DOMInputHandler handler)
Removes an input handler. |
void |
removeXMLAttributeParser(XMLAttributesParser handler)
Removes an XML attributes parser. |
void |
setContextLookup(Class c,
Object o)
Set a lookup value that will be used by all parse contexts that are created by this parser. |
void |
setContextProperty(String name,
Object o)
Set a property value that will be used by all parse contexts that are created by this parser. |
void |
setGraphElementFactory(GraphElementFactory factory)
Sets the factory for graph element creation. |
void |
setGraphmlCoreNS(String graphmlCoreNS)
Deprecated. The core graphml namespace is determined automatically now |
void |
setIdAcceptor(IdAcceptor idAcceptor)
Set a custom IdAcceptor instance that can be used to store the
special id attribute of core graphml elements.
|
void |
setParseErrorHandler(GraphMLParseErrorHandler customParseErrorHandler)
Register a custom error handler instance. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean validationEnabled
| Constructor Detail |
public DOMGraphMLParser()
| Method Detail |
public void setParseErrorHandler(GraphMLParseErrorHandler customParseErrorHandler)
customParseErrorHandler - the custom error handler instance, or null if the default implementation should be used.public GraphMLParseErrorHandler getParseErrorHandler()
setParseErrorHandler(org.graphdrawing.graphml.reader.GraphMLParseErrorHandler),
a default implementation will be returned.
public String getGraphmlCoreNS()
"http://graphml.graphdrawing.org/xmlns/graphml"
public void setGraphmlCoreNS(String graphmlCoreNS)
"http://graphml.graphdrawing.org/xmlns/graphml"
graphmlCoreNS - the namespace URI where the core GraphML elements livepublic IdAcceptor getIdAcceptor()
IdAcceptor instance that has been registered previously with
setIdAcceptor(org.graphdrawing.graphml.reader.IdAcceptor).
By default, no IdAcceptor is registered.
public void setIdAcceptor(IdAcceptor idAcceptor)
IdAcceptor instance that can be used to store the
special id attribute of core graphml elements.
By default, no IdAcceptor is registered.
public DocumentBuilderFactory getDocumentBuilderFactory()
public void setGraphElementFactory(GraphElementFactory factory)
factory - the GraphElementFactory used for element creationpublic void addDOMInputHandler(DOMInputHandler handler)
handler - the new input handlerpublic void removeDOMInputHandler(DOMInputHandler handler)
handler - the input handler to removepublic void addXMLAttributeParser(XMLAttributesParser handler)
handler - the new XML attributes parserpublic void removeXMLAttributeParser(XMLAttributesParser handler)
handler - the XML attributes parser to remove
public Object parse(InputStream is)
throws GraphMLParseException
is - an input stream which contains graphML data.
createGraphML
method of the current GraphElementFactory.
GraphMLParseException
public Object parse(InputStream is,
EntityResolver resolver)
throws GraphMLParseException
is - an input stream which contains graphML data.
createGraphML
method of the current GraphElementFactory.
GraphMLParseException
public Object parseDocument(Document doc)
throws GraphMLParseException
doc - a document with root node graphml.
GraphMLParseException
public Object parseGraphMLNode(Node graphMLNode)
throws GraphMLParseException
graphml node in a DOM tree.
graphMLNode - a node with value graphml.
GraphMLParseException - if something failed
protected void parseGraphNode(Node graphNode)
throws GraphMLParseException
graph tag in the graphml input is encountered.
graphNode - the DOM node for the graph element
GraphMLParseException - if something failed
protected void parsePortNode(Node portNode)
throws GraphMLParseException
port tag in the graphml input is encountered.
Currently, this method has no effect.
portNode - the DOM node for the port element
GraphMLParseException - if something failed
protected void parseNodeNode(Node nodeNode)
throws GraphMLParseException
node tag in the graphml input is encountered.
nodeNode - the DOM node for the node element
GraphMLParseException - if something failed
protected void parseEdgeNode(Node edgeNode)
throws GraphMLParseException
edge tag in the graphml input is encountered.
edgeNode - the DOM node for the edge element
GraphMLParseException - if something failed
protected void parseHyperEdgeNode(Node hyperedgeNode)
throws GraphMLParseException
hyperedge tag in the graphml input is encountered.
hyperedgeNode - the DOM node for the hyperedge element
GraphMLParseException - if something failed
protected void parseEndPointNode(Node endPointNode)
throws GraphMLParseException
node tag for a hyperedge is encountered
endPointNode - the DOM node for the endpoint element
GraphMLParseException - if something failed
protected void parseKeyNode(Node keyNode)
throws GraphMLParseException
key tag for a data attribute definition is encountered
keyNode - the DOM node for the key element
GraphMLParseException - if something failed
protected void parseDataNodes(Map dataNodes,
DOMInputHandler handler)
throws GraphMLParseException
data tags that are associated with a core graphml
element.
This method can be called multiple times for the same set of data nodes, if there are multiple input handlers registered
dataNodes - Map that contains as keys a data tag refid, as values a list of data elements that have this refid attribute sethandler - the current input handler
GraphMLParseException - if something failed
public void setContextLookup(Class c,
Object o)
c - The class key for the lookupo - the implementation objectGraphMLParseContext.lookup(Class)protected DOMGraphMLParseContext createParseContext()
public void setContextProperty(String name,
Object o)
name - The name of the propertyo - the value of the propertyGraphMLParseContext.setProperty(String,Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||