org.graffiti.plugins.ios.importers.graphml.parser
Class GraphMLFilter

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by org.graffiti.plugins.ios.importers.graphml.parser.GraphMLFilter
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader

public class GraphMLFilter
extends XMLFilterImpl

Class GraphMLFilter processes the SAX events generated by the parser and builds the graph according to the events. In that sense, this class is the heart of the graphML reading library.

Author:
ruediger

Constructor Summary
GraphMLFilter(XMLReader parent, Graph graph)
          Constructs a new GraphMLFilter.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Filter a character data event.
 void endDocument()
          Create NodeLabelAttributes or EdgeLabelAttributes for all found labels.
 void endElement(String uri, String localName, String qName)
          Filter an end element event.
 void startElement(String uri, String localName, String qName, Attributes atts)
          Filter a start element event.
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphMLFilter

public GraphMLFilter(XMLReader parent,
                     Graph graph)
Constructs a new GraphMLFilter.

Parameters:
parent - the parent XMLReader.
graph - the Graph to which to add the read in data.
Method Detail

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Filter a character data event. This method assumes that the character data is not split into multiple events. Depending on whether the event belongs to a default attribute value declaration or a usual attribute value declaration the corrsponding attribute value will be set.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class XMLFilterImpl
Parameters:
ch - an array of characters.
start - the starting position in the array.
length - the number of characters to use from the array.
Throws:
SAXException - The client may throw an exception during processing.

endDocument

public void endDocument()
Create NodeLabelAttributes or EdgeLabelAttributes for all found labels. This is done after parsing the whole graphml file to make sure all needed attributes have been read.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class XMLFilterImpl

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Filter an end element event. Depending on the kind of element certain states of the filter will be reset.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class XMLFilterImpl
Parameters:
uri - the element's Namespace URI, or the empty string.
localName - the element's local name, or the empty string.
qName - the element's qualified (prefixed) name, or the empty string.
Throws:
SAXException - The client may throw an exception during processing.

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Filter a start element event. Depending on the kind of attribute either an element will be added to the graph or the filter is prepared to modify the graph appropriately depending on the next coming events.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class XMLFilterImpl
Parameters:
uri - the element's Namespace URI, or the empty string.
localName - the element's local name, or the empty string.
qName - the element's qualified (prefixed) name, or the empty string.
atts - the element's attributes.
Throws:
SAXException - the client may throw an exception during processing.


Generated at 2012-05-30 11:01:25 PM CEST