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)

                                
---------------------------------
 Find out what India is talking about on Yahoo! Answers India.
SMS memory full? Store all your important SMS in your Yahoo! Mail. Register for 
SMS BAK UP now! 

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/7EuRwD/fOaOAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~-> 

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to