public class XMLGraph extends DefaultHandler
XMLGraph parser = new XMLGraph(); parser.parse(new InputSource(inputstream)); Graph graph = parser.getGraph(); ImageOutput out = new ImageOutput(parser.getWidth(), parser.getHeight()); graph.draw(out); out.writePNG(outputstream, 256);Alternatively, as this class implements
ContentHandler
users may
extend the class as necessary or use it as the end stage of an XSL
transformation.Modifier and Type | Field and Description |
---|---|
protected Locator |
locator
The Locator object, as set by
setDocumentLocator(org.xml.sax.Locator) |
static String |
NAMESPACE
The namespace used for the XML parsed by this class.
|
Constructor and Description |
---|
XMLGraph()
Create a new XMLGraph parser
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] buf,
int off,
int len) |
void |
endDocument() |
void |
endElement(String nspace,
String tag,
String qname) |
static XMLGraphResourceProvider |
getDefaultResourceProvider(String format)
Return a
XMLGraphResourceProvider appropriate for the specified format |
Set |
getFonts()
Return the list of font names used in the graph.
|
Graph |
getGraph()
Return the graph generated by the
parse(org.xml.sax.InputSource) method |
int |
getHeight()
Return the width of the graph, as specified in the XML with the
height attribute |
int |
getWidth()
Return the width of the graph, as specified in the XML with the
width attribute |
void |
parse(InputSource source)
Parse the specified InputSource using any available
XMLReader |
void |
parse(InputSource source,
XMLReader reader)
Parse the specified InputSource using the specified
XMLReader . |
void |
setDocumentLocator(Locator locator) |
void |
setResourceProvider(XMLGraphResourceProvider p)
Set the
XMLGraphResourceProvider implementation to use for providing
resources when parsing the graph XML. |
void |
startElement(String nspace,
String tag,
String qname,
Attributes atts) |
void |
warning(SAXParseException e) |
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
public static final String NAMESPACE
protected Locator locator
setDocumentLocator(org.xml.sax.Locator)
public void parse(InputSource source) throws SAXException, IOException
XMLReader
SAXException
IOException
public void parse(InputSource source, XMLReader reader) throws SAXException, IOException
XMLReader
.SAXException
IOException
public Graph getGraph()
parse(org.xml.sax.InputSource)
methodpublic Set getFonts()
Set
containing 0 or more String
objectspublic int getWidth()
width
attributepublic int getHeight()
height
attributepublic void warning(SAXParseException e) throws SAXException
warning
in interface ErrorHandler
warning
in class DefaultHandler
SAXException
public void setResourceProvider(XMLGraphResourceProvider p)
Set the XMLGraphResourceProvider
implementation to use for providing
resources when parsing the graph XML.
p
- the implementation of XMLGraphResourceProvider to usepublic void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class DefaultHandler
public void startElement(String nspace, String tag, String qname, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
public void endElement(String nspace, String tag, String qname) throws SAXException
endElement
in interface ContentHandler
endElement
in class DefaultHandler
SAXException
public void characters(char[] buf, int off, int len) throws SAXException
characters
in interface ContentHandler
characters
in class DefaultHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class DefaultHandler
SAXException
public static XMLGraphResourceProvider getDefaultResourceProvider(String format)
XMLGraphResourceProvider
appropriate for the specified formatformat
- the output format, eg "png", "pdf", "swf"Copyright © 2001-2016 Big Faceless Organization