Hi All,

Am able to parse svg and traverse through dom tree..The problem is when an
non
svg element is encountered(like <Segments></Segments> or <Planes></Planes>
its
giving exceptions.I dont know how to overcome this problem..plz any help
me...its urgent...

Sample code i used:

class CreateSvgDom
{

private String parser;
private SAXSVGDocumentFactory fact;
private SVGDocument doc;

public SVGDocument createMethod(String uri)
{
try
{
parser = XMLResourceDescriptor.getXMLParserClassName();
fact = new SAXSVGDocumentFactory(parser);
fact.setValidating(false);
doc = fact.createSVGDocument(uri);

}

catch(Exception e)
{
e.printStackTrace();
}
return doc;
}

}

Errors am getting:

org.w3c.dom.DOMException: The current document is unable to create an
element
of the requested type (namespace: http://www.w3.org/
2000/svg, name: Segments).
at org.apache.batik.dom.AbstractNode.createDOMException(Unknown Source)
at org.apache.batik.dom.svg.SVGDOMImplementation.createElementNS(Unknown
Source)
at org.apache.batik.dom.svg.SVGOMDocument.createElementNS(Unknown
Source)
at org.apache.batik.dom.util.SAXDocumentFactory.startElement(Unknown
Source)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.\
\
dispatch(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown
Source)
at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown
Source)
at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
Source)
at
org.apache.batik.dom.svg.SAXSVGDocumentFactory.createSVGDocument(Unknown
Source)
at CreateSvgDom.createMethod(HandlingDomException.java:47)
at HandlingDomException.main(HandlingDomException.java:69)
Exception in thread "main" java.lang.NullPointerException
at HandlingDomException.main(HandlingDomException.java:71)

Thanks 
-- 
View this message in context: 
http://www.nabble.com/parsing-svg-using-xerces-tf2013711.html#a5534297
Sent from the Xerces - J - Dev forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to