You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Panshul Whisper <ou...@gmail.com> on 2013/05/31 01:15:13 UTC

Dom manipulation

Hello,

I am a new user trying modify an SVG file and then render it as a JPEG.

I convert the SVG file into a w3c Document.
then I get the element that I need to update.
but when I try to update the text in that element I get the following error:

java.lang.AbstractMethodError:
org.apache.batik.dom.svg.SVGOMTextElement.getTextContent()Ljava/lang/String;

My code is as follows:

final String parser = XMLResourceDescriptor.getXMLParserClassName();
final SAXSVGDocumentFactory svgDocFactory = new
SAXSVGDocumentFactory(parser);
svgDoc = svgDocFactory.createDocument(svgUri);
final Element element = svgDoc.getElementById("MainTitle");
System.out.println("Element Text:" + element.getTextContent().toString());


Please help me how to update values of elements in the SVG Dom document.

I will be glad if you can point me to a link where I can get samples or
documentation of using the DOM api.

Thanking You,
-- 
Regards,
Ouch Whisper
010101010101

RE: Dom manipulation

Posted by Martin Gainty <mg...@hotmail.com>.
'Morning Gentlemen
 
I am currently compiling the flash.css.Descriptor in Flash from adobe currently stored on googlecode at
 
http://code.google.com/p/flexcover-sdk/source/browse/trunk/flex3.0.x/modules/compiler/src/java/flash/css/Descriptor.java?r=25
 
package flash.css
 
public class Descriptor


{
        private String name;
        private LexicalUnit value;
    private int lineNumber;
    private String path;

        public Descriptor(String name, LexicalUnit lexicalUnit, String path, int lineNumberOffset)
        {
                this.name = name;
                this.value = lexicalUnit;
        this.path = path;

        if (lexicalUnit instanceof CSSLexicalUnit)
        {
            lineNumber = ((CSSLexicalUnit) lexicalUnit).getLineNumber() + lineNumberOffset;
        }
        }

 
there is a build.xml available but the supplied build.xml does not indicate the version of batik to implement here is the property specifier
 
 <property name="mxmlc.classpath" value="xercesPatch.jar asc.jar xercesImpl.jar xmlParserAPIs.jar afe.jar aglj32.jar rideau.jar batik-awt-util.jar batik-bridge.jar batik-css.jar batik-dom.jar batik-ext.jar batik-gvt.jar batik-parser.jar batik-script.jar batik-svg-dom.jar batik-svggen.jar batik-util.jar batik-transcoder.jar batik-xml.jar mm-velocity-1.4.jar commons-collections.jar commons-discovery.jar commons-logging.jar license.jar swfutils.jar flex-fontkit.jar flex-messaging-common.jar mxmlc_ja.jar xalan.jar"/>

mxmlc.classpath is then used to update the manifest.mf for the jar task as seen here:
 
            <manifest>
                <attribute name="Sealed" value="${manifest.sealed}"/>
                <attribute name="Implementation-Title" value="${manifest.Implementation-Title} - MXML Compiler"/>
                <attribute name="Implementation-Version" value="${manifest.Implementation-Version}.${build.number}"/> 
                <attribute name="Implementation-Vendor" value="${manifest.Implementation-Vendor}"/>
                <attribute name="Main-Class" value="${mxmlc.main}"/>
                <attribute name="Class-Path" value="${mxmlc.classpath}"/> 
            </manifest>

does anyone which version of batik contains method CSSLexicalUnit.getLineNumber()?

Thanks ,
Martin Gainty 
(Maven maven)
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

 
From: mgainty@hotmail.com
To: batik-users@xmlgraphics.apache.org
Subject: RE: Dom manipulation
Date: Fri, 31 May 2013 06:06:14 -0400






Hello,
I am a new user trying modify an SVG file and then render it as a JPEG.
I convert the SVG file into a w3c Document.then I get the element that I need to update.
but when I try to update the text in that element I get the following error:
java.lang.AbstractMethodError: org.apache.batik.dom.svg.SVGOMTextElement.getTextContent()Ljava/lang/String;

My code is as follows:
final String parser = XMLResourceDescriptor.getXMLParserClassName();final SAXSVGDocumentFactory svgDocFactory = new SAXSVGDocumentFactory(parser);
svgDoc = svgDocFactory.createDocument(svgUri);final Element element = svgDoc.getElementById("MainTitle");
MG> should be SVGOMTextElement not Base Class Element

System.out.println("Element Text:" + element.getTextContent().toString());
MG>getTextContent is already returning String why are you doing a toString() again?



Please help me how to update values of elements in the SVG Dom document. 
I will be glad if you can point me to a link where I can get samples or documentation of using the DOM api.

Thanking You,-- 
Regards,Ouch Whisper010101010101 
MG>it would be a good idea to send us the maven pom.xml you are using to build with
MG>at least that way we can easily determine the versions of dependencies you are using to build with
MG>using ant or any other build tool that is version-unaware and will lead you down a path where there is no recovery

 		 	   		   		 	   		  

RE: Dom manipulation

Posted by Martin Gainty <mg...@hotmail.com>.

Hello,
I am a new user trying modify an SVG file and then render it as a JPEG.
I convert the SVG file into a w3c Document.then I get the element that I need to update.
but when I try to update the text in that element I get the following error:
java.lang.AbstractMethodError: org.apache.batik.dom.svg.SVGOMTextElement.getTextContent()Ljava/lang/String;

My code is as follows:
final String parser = XMLResourceDescriptor.getXMLParserClassName();final SAXSVGDocumentFactory svgDocFactory = new SAXSVGDocumentFactory(parser);
svgDoc = svgDocFactory.createDocument(svgUri);final Element element = svgDoc.getElementById("MainTitle");
MG> should be SVGOMTextElement not Base Class Element

System.out.println("Element Text:" + element.getTextContent().toString());
MG>getTextContent is already returning String why are you doing a toString() again?



Please help me how to update values of elements in the SVG Dom document. 
I will be glad if you can point me to a link where I can get samples or documentation of using the DOM api.

Thanking You,-- 
Regards,Ouch Whisper010101010101 
MG>it would be a good idea to send us the maven pom.xml you are using to build with
MG>at least that way we can easily determine the versions of dependencies you are using to build with
MG>using ant or any other build tool that is version-unaware and will lead you down a path where there is no recovery