Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Commenting whole Elements?

Commenting whole Elements?

2007-12-06       - By Grzegorz Kaczor

 Back
Reply:     1     2     3  

Hi,

I believe you should not disable escaping when outputting XML file. It is
fine it is working :).

I would serialize the element to ByteArrayOutputStream using XMLOutputter,
then create a string out of it and add a Comment element with the serialized
form of your element as its text.

The only drawback of this solution is that your element will have namespace
declarations inside. From the view of XML infoset this is not a problem - it
will be working if someone uncomments it.

Regards,
Grzegorz

2007/12/6, Jan Brauer <jan.brauer@(protected)>:
>
> Hi,
>
> I'm currently writing a tool to merge different fragments into a
> web.xml. I'm looking for a way to surround an element with comments.
> I've added a namespaced attribute to the element. Based on this I'm
> trying to surround the Element with two Text elements:
>
> Text intro = new Text("<!--");
> Text outro = new Text("-->");
>
> Unfortunately the pointy brackets are escaped. I haven't found a way to
> disable the escaping:
>
> new Text("&lt;--")
> resolves to:
>
> "&amp;lt;--"
>
> What can I do to disable the escaping for those two Text elements? Or is
> there an even better way to accomplish what I'm trying?
>
> Thx,
> Jan
>
>
>
> __ ____ ____ ____ ____ ____ ____ ____ ____ ____
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
>



--
"Cho? tyle wiemy w?asnym do?wiadczeniem:
W nas jest Raj, Piek?o - i do obu - szlaki."
J.K.

Hi,<br><br>I believe you should not disable escaping when outputting XML file.
It is fine it is working :). <br><br>I would serialize the element to
ByteArrayOutputStream using XMLOutputter, then create a string out of it and
add a Comment element with the serialized form of your element as its text.
<br><br>The only drawback of this solution is that your element will have
namespace declarations inside. From the view of XML infoset this is not a
problem - it will be working if someone uncomments it.<br><br>Regards,<br>
Grzegorz<br><br><div><span class="gmail_quote">2007/12/6, Jan Brauer &lt;<a
href="mailto:jan.brauer@(protected)">jan.brauer@(protected)</a>&gt;:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204)
; margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>I&#39;m currently writing a tool to merge different fragments into a
<br>web.xml. I&#39;m looking for a way to surround an element with comments.<br
>I&#39;ve added a namespaced attribute to the element. Based on this I&#39;m
<br>trying to surround the Element with two Text elements:<br><br>Text intro =
new Text(&quot;&lt;!--&quot;);<br>Text outro = new Text(&quot;--&gt;&quot;);<br
><br>Unfortunately the pointy brackets are escaped. I haven&#39;t found a way to
<br>disable the escaping:<br><br>new Text(&quot;&amp;lt;--&quot;)<br>resolves
to:<br><br>&quot;&amp;amp;lt;--&quot;<br><br>What can I do to disable the
escaping for those two Text elements? Or is<br>there an even better way to
accomplish what I&#39;m trying?
<br><br>Thx,<br>Jan<br><br><br><br>__ ____ ____ ____ ____ ____ ____ ____ ______
___<br>To control your jdom-interest membership:<br><a href="http://www.jdom.org
/mailman/options/jdom-interest/youraddr@(protected)">http://www.jdom.org
/mailman/options/jdom-interest/youraddr@(protected)
</a><br></blockquote></div><br><br clear="all"><br>-- <br>&quot;Cho? tyle wiemy
w?asnym do?wiadczeniem:<br>W nas jest Raj, Piek?o - i do obu - szlaki.&quot;<br
>J.K.

__ ____ ____ ____ ____ ____ ____ ____ ____ ____
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.