|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.faceless.graph2.XMLGraph
public class XMLGraph
The XMLGraph class provides a simple XML interface into the Graph library. At it's simplest, it can be used as follows to parse an InputStream containing XML and convert that to a PNG image written to an OutputStream
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.
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
XMLGraph()
Create a new XMLGraph parser |
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
|---|
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String NAMESPACE
protected Locator locator
setDocumentLocator(org.xml.sax.Locator)
| Constructor Detail |
|---|
public XMLGraph()
| Method Detail |
|---|
public void parse(InputSource source)
throws SAXException,
IOException
XMLReader
SAXException
IOException
public void parse(InputSource source,
XMLReader reader)
throws SAXException,
IOException
XMLReader.
SAXException
IOExceptionpublic Graph getGraph()
parse(org.xml.sax.InputSource) method
public Set getFonts()
Set containing 0 or more String objectspublic int getWidth()
width attribute
public int getHeight()
height attribute
public void warning(SAXParseException e)
throws SAXException
warning in interface ErrorHandlerwarning in class DefaultHandlerSAXExceptionpublic 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 ContentHandlersetDocumentLocator in class DefaultHandler
public void startElement(String nspace,
String tag,
String qname,
Attributes atts)
throws SAXException
startElement in interface ContentHandlerstartElement in class DefaultHandlerSAXException
public void endElement(String nspace,
String tag,
String qname)
throws SAXException
endElement in interface ContentHandlerendElement in class DefaultHandlerSAXException
public void characters(char[] buf,
int off,
int len)
throws SAXException
characters in interface ContentHandlercharacters in class DefaultHandlerSAXException
public void endDocument()
throws SAXException
endDocument in interface ContentHandlerendDocument in class DefaultHandlerSAXExceptionpublic static XMLGraphResourceProvider getDefaultResourceProvider(String format)
XMLGraphResourceProvider appropriate for the specified format
format - the output format, eg "png", "pdf", "swf"
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||