Packagecom.yworks.io.graphml.reader
Classpublic class GraphMLParser
InheritanceGraphMLParser Inheritance Object
Implements IContextLookup

A parser that can handle GraphML data.



Public Properties
 PropertyDefined By
  contextLookup : Dictionary
The context dictionary which is used for populating the parse context lookup.
GraphMLParser
  idAcceptor : IIdAcceptor
Get or set the IIdAcceptor instance that this parser uses.
GraphMLParser
  initialContext : GraphMLParseContext
A custom parse context instance that will be used by the parse process.
GraphMLParser
  inputHandlerProvider : IInputHandlerProvider
Get or set the IInputHandlerProvider instance that this parser uses.
GraphMLParser
  parseErrorHandler : IGraphMLParseErrorHandler
The error handler for parsing.
GraphMLParser
Public Methods
 MethodDefined By
  
Creates a new instance.
GraphMLParser
  
Adds an input handler to this instance
GraphMLParser
  
Adds a parser for xml attributes.
GraphMLParser
  
lookupForItem(item:Object, type:Class):Object
Tries to create or retrieve an implementation of the given type for a given item.
GraphMLParser
  
parse(graphMLElement:XML):void
Parses a GraphML element
GraphMLParser
  
parseKeyElement(keyElement:XML):void
Parses a XML key element
GraphMLParser
  
Register a default deserializer for XML content.
GraphMLParser
  
Register a deserializer.
GraphMLParser
  
Removes a parser for xml attributes.
GraphMLParser
  
setContextProperty(name:String, value:Object):void
Set a context property which is considered when creating a GraphMLParseContext.
GraphMLParser
  
Sets the factory for graph element creation.
GraphMLParser
Protected Methods
 MethodDefined By
  
Gets the GraphMLParseContext.
GraphMLParser
  
nodeCreated(id:Object, node:Object):void
Called when a node was created by parseNodeElement.
GraphMLParser
  
parseDataNodes(dataElements:IMapper, handlerDef:HandlerDefinition):void
Parses the data elements of a graphml element using a suitable handler.
GraphMLParser
  
parseEdgeElement(edgeElement:XML):void
Parses a XML element representing an edge.
GraphMLParser
  
parseFolderElement(element:XML):void
Parses a folder element.
GraphMLParser
  
parseGraphElement(graphElement:XML):void
Parses a XML element representing a graph
GraphMLParser
  
parseNodeElement(nodeElement:XML):void
Parses a XML element representing a node.
GraphMLParser
  
parsePortElement(portElement:XML):void
Parses a port element.
GraphMLParser
  
Called at the end of parse().
GraphMLParser
  
sourceNodeCreated(id:Object, node:Object, edge:Object):void
Called when parseEdgeElement created an edge with a (yet) unparsed source node.
GraphMLParser
  
targetNodeCreated(id:Object, node:Object, edge:Object):void
Called when parseEdgeElement created an edge with a (yet) unparsed target node.
GraphMLParser
Property Detail
contextLookupproperty
contextLookup:Dictionary

The context dictionary which is used for populating the parse context lookup.


Implementation
    public function get contextLookup():Dictionary
    public function set contextLookup(value:Dictionary):void
idAcceptorproperty 
idAcceptor:IIdAcceptor

Get or set the IIdAcceptor instance that this parser uses.


Implementation
    public function get idAcceptor():IIdAcceptor
    public function set idAcceptor(value:IIdAcceptor):void
initialContextproperty 
initialContext:GraphMLParseContext

A custom parse context instance that will be used by the parse process.

If this property is not set, a default implementation that is just able to handle the basic graphml deserialization process is used


Implementation
    public function get initialContext():GraphMLParseContext
    public function set initialContext(value:GraphMLParseContext):void
inputHandlerProviderproperty 
inputHandlerProvider:IInputHandlerProvider

Get or set the IInputHandlerProvider instance that this parser uses.


Implementation
    public function get inputHandlerProvider():IInputHandlerProvider
    public function set inputHandlerProvider(value:IInputHandlerProvider):void

See also

parseErrorHandlerproperty 
parseErrorHandler:IGraphMLParseErrorHandler

The error handler for parsing.


Implementation
    public function get parseErrorHandler():IGraphMLParseErrorHandler
    public function set parseErrorHandler(value:IGraphMLParseErrorHandler):void
Constructor Detail
GraphMLParser()Constructor
public function GraphMLParser()

Creates a new instance.

Method Detail
addInputHandler()method
public function addInputHandler(handler:IInputHandler):void

Adds an input handler to this instance

Parameters

handler:IInputHandler — the input handler to add

addXmlAttributesParser()method 
public function addXmlAttributesParser(attributesParser:IXmlAttributesParser):void

Adds a parser for xml attributes.

Parameters

attributesParser:IXmlAttributesParser — The parser to add.

createParseContext()method 
protected function createParseContext():GraphMLParseContext

Gets the GraphMLParseContext.

Returns
GraphMLParseContext — The GraphMLParseContext.

See also

lookupForItem()method 
public function lookupForItem(item:Object, type:Class):Object

Tries to create or retrieve an implementation of the given type for a given item.

Parameters

item:Object — the item to lookup a type for
 
type:Class — the type to look up

Returns
Object — an implementation or null
nodeCreated()method 
protected function nodeCreated(id:Object, node:Object):void

Called when a node was created by parseNodeElement.

Parameters

id:Object — The id of the newly created node.
 
node:Object — The node which was created.

parse()method 
public function parse(graphMLElement:XML):void

Parses a GraphML element

Parameters

graphMLElement:XML — The element to parse.

parseDataNodes()method 
protected function parseDataNodes(dataElements:IMapper, handlerDef:HandlerDefinition):void

Parses the data elements of a graphml element using a suitable handler. Called for all registered input handlers.

Parameters

dataElements:IMapper
 
handlerDef:HandlerDefinition

parseEdgeElement()method 
protected function parseEdgeElement(edgeElement:XML):void

Parses a XML element representing an edge.

Parameters

edgeElement:XML — The element to parse.

parseFolderElement()method 
protected function parseFolderElement(element:XML):void

Parses a folder element. A folder element contains the subgraph of a closed group node.

This method delegates to parseGraphElement().

Parameters

element:XML — The element to parse.

parseGraphElement()method 
protected function parseGraphElement(graphElement:XML):void

Parses a XML element representing a graph

Parameters

graphElement:XML — The element to parse.

parseKeyElement()method 
public function parseKeyElement(keyElement:XML):void

Parses a XML key element

Parameters

keyElement:XML — The element to parse.

parseNodeElement()method 
protected function parseNodeElement(nodeElement:XML):void

Parses a XML element representing a node.

Parameters

nodeElement:XML — The element to parse.

parsePortElement()method 
protected function parsePortElement(portElement:XML):void

Parses a port element.

Parameters

portElement:XML — The element to parse.

processAfterParsing()method 
protected function processAfterParsing(context:GraphMLParseContext):void

Called at the end of parse(). Can be overridden to apply some context-dependent modification after the graph was completely parsed.

This implementation applies some hierarchy-related modifications (if necessary) after a Java compatible GraphML has been parsed.

Parameters

context:GraphMLParseContext — The current GraphMLParseContext

registerDefaultDeserializer()method 
public function registerDefaultDeserializer(deserializer:IDeserializer):void

Register a default deserializer for XML content.

A default deserializer will only be used if no more specific deserializer for a given XML fragment exists.

Parameters

deserializer:IDeserializer — A deserializer instance that is to be used for graphml reading

registerDeserializer()method 
public function registerDeserializer(deserializer:IDeserializer):void

Register a deserializer.

Parameters

deserializer:IDeserializer — A deserializer instance that is to be used for graphml reading

removeXmlAttributesParser()method 
public function removeXmlAttributesParser(attributesParser:IXmlAttributesParser):void

Removes a parser for xml attributes.

Parameters

attributesParser:IXmlAttributesParser — The parser to remove.

setContextProperty()method 
public function setContextProperty(name:String, value:Object):void

Set a context property which is considered when creating a GraphMLParseContext.

Parameters

name:String — The name of the property
 
value:Object — the property

setGraphItemFactory()method 
public function setGraphItemFactory(factory:IGraphItemFactory):void

Sets the factory for graph element creation.

Parameters

factory:IGraphItemFactory

See also

sourceNodeCreated()method 
protected function sourceNodeCreated(id:Object, node:Object, edge:Object):void

Called when parseEdgeElement created an edge with a (yet) unparsed source node.

Parameters

id:Object — The id of the newly created node.
 
node:Object — The newly created node.
 
edge:Object — The newly created edge.

targetNodeCreated()method 
protected function targetNodeCreated(id:Object, node:Object, edge:Object):void

Called when parseEdgeElement created an edge with a (yet) unparsed target node.

Parameters

id:Object — The id of the newly created node.
 
node:Object — The newly created node.
 
edge:Object — The newly created edge.