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 BEGUE Pierre <pb...@iftechnologies.net> on 2005/07/20 17:31:09 UTC

parseXML

i try to use parseXML and postURL the error message it's :

exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)


cause mère
java.lang.NullPointerException
	org.apache.batik.bridge.BaseScriptingEnvironment.<init>(Unknown Source)
	org.apache.batik.bridge.ScriptingEnvironment.<init>(Unknown Source)
	org.apache.jsp.savesvg_jsp._jspService(savesvg_jsp.java:153)
       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)


and this my code. I don't why he do this :


/*creation du document en utilisant DOMImplementation, Le Document créé 
supporte du XML générique et du SVG,
       Le Document sera casté en (SVGDocument) */
     DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
     String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;

     try{
         String svgURI = new 
File("C:/stage(iftechnologie)/Lege/Lege/LegeParc.svg").toURL().toString();
         FileInputStream instream = new 
FileInputStream("C:/stage(iftechnologie)/Lege/Lege/LegeParc.svg");
         InputStreamReader istream  = new InputStreamReader(instream);
         TranscoderInput input = new TranscoderInput(istream);

         String parser = XMLResourceDescriptor.getXMLParserClassName();
         SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
         Document doc = f.createDocument(svgURI);


         /*Construit le contenu SVG */
         // récupère l'élément « root »
         Element svgRoot = doc.getElementById("map");

         // définie la taille de l'éléemnt « root » pour l'affichage
         svgRoot.setAttributeNS(null, "width", "399");
         svgRoot.setAttributeNS(null, "height", "450");

         SVGGraphics2D svgGenerator = new SVGGraphics2D(doc);
         FileOutputStream outStream = new 
FileOutputStream("C:/stage(iftechnologie)/Lege/Lege/sortieFlux.svg");
         Writer outf = new OutputStreamWriter(outStream, "UTF-8");

         DOMUtilities.writeDocument(doc,outf);
         svgGenerator.stream(outf, true);
         outf.flush();





     /*******/
     /* il va me balancer un string du genre "bati.svg;PLU.svg"
     * en fonction des fichiers svg contenue en fonction du plan 
(LegePlan1..2..)
     * donc je compte le nombre de ";" qui correspond au nombre de truc 
coché
     * ensuite je lis jusqu'a atteindre un ";" et je concatene le tout 
et je fais
     * le appendchild
     * sur chaque fichier lu faut que rajoute le numero en fonction du plan
     */

     String niveau = (String) request.getParameter("niveau");
     String couche = (String) request.getParameter("couche");
     String rep1 = "C:/stage(iftechnologie)/Lege/Lege/LegePlan";

     niveau = "1";
     couche = "LegePlu1.svg";

     rep1 = rep1 + niveau;
     rep1 = rep1 + "/";

     String[] couche1 = couche.split(";");

     UserAgent ua = new UserAgentAdapter();
     BridgeContext bc = new BridgeContext(ua);
     ScriptingEnvironment se = new ScriptingEnvironment(bc);
     Window window = se.createWindow(null,"moi");
     //lecture des niveau couches
     for (int i=0;i<couche1.length;i++)
     {
         String res = " ";

         window.postURL(rep1+couche1[i],res,null);
         //recuperer l'element *.svg
         Node node = window.parseXML(res,doc);

         //ici je replace les differents niveaux dans le nouveau svg 
document géré
         Element svgRoot1= doc.getElementById("map");
         svgRoot1.appendChild(node);

     }
     }
       catch (IOException e){}



thanks very much.




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: parseXML help :'(

Posted by BEGUE Pierre <pb...@iftechnologies.net>.
What the other method to do the parseXML ?

and if it's not can you give me an explain to do it (in other) or with 
the parseXML

thanks VERY MUCH



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: parseXML

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Begue,

    I don't understand what you are asking.
    How about changing the value of an xlink:href on an image element
to load a different set of data?

BEGUE Pierre wrote:
> But my problem i want to use the parse because i want to load different 
> floor in my carto svg. And i thinks to use the node with different 
> document but he dont want to open different document
> 
> how can i ?
> 
> thanks
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: parseXML

Posted by BEGUE Pierre <pb...@iftechnologies.net>.
But my problem i want to use the parse because i want to load different 
floor in my carto svg. And i thinks to use the node with different 
document but he dont want to open different document

how can i ?

thanks



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: parseXML

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Begue,

    You can't just create a ScriptingEnvironment.  One is created
as part of the build of the document (if appropriate).  Unfortunately
we currently don't provide real access to the Window Object from
Java.  Fortunately you can fairly easily implement all the window
object functions yourself in Java - if in no other way than by
copying the implementation that Batik provides in the
BaseScriptingEvironment.Window inner class (although often you
can do a better job by just using the JDK classes).

BEGUE Pierre wrote:
> i try to use parseXML and postURL the error message it's :
> 
> exception
> org.apache.jasper.JasperException
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373) 
> 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) 
> 
> 
> 
> cause mère
> java.lang.NullPointerException
>     org.apache.batik.bridge.BaseScriptingEnvironment.<init>(Unknown Source)
>     org.apache.batik.bridge.ScriptingEnvironment.<init>(Unknown Source)
>     org.apache.jsp.savesvg_jsp._jspService(savesvg_jsp.java:153)
>       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325) 
> 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) 
> 
> 
> 
> and this my code. I don't why he do this :
> 
> 
> /*creation du document en utilisant DOMImplementation, Le Document créé 
> supporte du XML générique et du SVG,
>       Le Document sera casté en (SVGDocument) */
>     DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
>     String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
> 
>     try{
>         String svgURI = new 
> File("C:/stage(iftechnologie)/Lege/Lege/LegeParc.svg").toURL().toString();
>         FileInputStream instream = new 
> FileInputStream("C:/stage(iftechnologie)/Lege/Lege/LegeParc.svg");
>         InputStreamReader istream  = new InputStreamReader(instream);
>         TranscoderInput input = new TranscoderInput(istream);
> 
>         String parser = XMLResourceDescriptor.getXMLParserClassName();
>         SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
>         Document doc = f.createDocument(svgURI);
> 
> 
>         /*Construit le contenu SVG */
>         // récupère l'élément « root »
>         Element svgRoot = doc.getElementById("map");
> 
>         // définie la taille de l'éléemnt « root » pour l'affichage
>         svgRoot.setAttributeNS(null, "width", "399");
>         svgRoot.setAttributeNS(null, "height", "450");
> 
>         SVGGraphics2D svgGenerator = new SVGGraphics2D(doc);
>         FileOutputStream outStream = new 
> FileOutputStream("C:/stage(iftechnologie)/Lege/Lege/sortieFlux.svg");
>         Writer outf = new OutputStreamWriter(outStream, "UTF-8");
> 
>         DOMUtilities.writeDocument(doc,outf);
>         svgGenerator.stream(outf, true);
>         outf.flush();
> 
> 
> 
> 
> 
>     /*******/
>     /* il va me balancer un string du genre "bati.svg;PLU.svg"
>     * en fonction des fichiers svg contenue en fonction du plan 
> (LegePlan1..2..)
>     * donc je compte le nombre de ";" qui correspond au nombre de truc 
> coché
>     * ensuite je lis jusqu'a atteindre un ";" et je concatene le tout et 
> je fais
>     * le appendchild
>     * sur chaque fichier lu faut que rajoute le numero en fonction du plan
>     */
> 
>     String niveau = (String) request.getParameter("niveau");
>     String couche = (String) request.getParameter("couche");
>     String rep1 = "C:/stage(iftechnologie)/Lege/Lege/LegePlan";
> 
>     niveau = "1";
>     couche = "LegePlu1.svg";
> 
>     rep1 = rep1 + niveau;
>     rep1 = rep1 + "/";
> 
>     String[] couche1 = couche.split(";");
> 
>     UserAgent ua = new UserAgentAdapter();
>     BridgeContext bc = new BridgeContext(ua);
>     ScriptingEnvironment se = new ScriptingEnvironment(bc);
>     Window window = se.createWindow(null,"moi");
>     //lecture des niveau couches
>     for (int i=0;i<couche1.length;i++)
>     {
>         String res = " ";
> 
>         window.postURL(rep1+couche1[i],res,null);
>         //recuperer l'element *.svg
>         Node node = window.parseXML(res,doc);
> 
>         //ici je replace les differents niveaux dans le nouveau svg 
> document géré
>         Element svgRoot1= doc.getElementById("map");
>         svgRoot1.appendChild(node);
> 
>     }
>     }
>       catch (IOException e){}
> 
> 
> 
> thanks very much.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org