Here's what I used to recreate this:

JDK 1.4.2
WinXP Pro

Tomcat 5.0.28
Xerces 2.6.2 & Xalan 2.6.0 installed in $CATALINA_HOME/common/endorsed

WEB-INF/lib
XTags nightly (20050315)
dom4j 1.5.2

xtags.jsp:
----------
<%@ page contentType="text/xml" %>

<%@ taglib prefix="xtags" uri="http://jakarta.apache.org/taglibs/xtags-1.0"; %>

<xtags:parse id="lxml">
<my>
<loc url="http://localhost:8084/checklist/update.jsp";>My location</loc>
</my>
</xtags:parse>

<xtags:parse id="streamxml">
<job>
</job>
</xtags:parse>

<xtags:context select="$streamxml/job">
<xtags:add>
<var name="url"><![CDATA[<xtags:valueOf select="$lxml/my/loc/@url"/>]]></var>
</xtags:add>
</xtags:context>

<xtags:copyOf select="$streamxml"/>

Which produced:

<job>
<var name="url"><![CDATA[http://localhost:8084/checklist/update.jsp]]></var>
</job>

Is that what you wanted?

Quoting Malcolm Cowe <[EMAIL PROTECTED]>:

> Hi,
> 
> I'm trying to assemble an XML document that contains a URL as CDATA in
> one of the tags. I'm using xtags:add to insert elements into an existing
> XML structure, and I'm getting the following output:
> 
> <job>
>   <var
>
name="url"><![CDATA[http://localhost:8084/checkl]]><![CDATA[ist/update.jsp]]></var>
> </job>
> 
> As you can see, the URL is cut in two, making 2 CDATA segments, which is
> not what I expected. This is based on the following code fragment:
> 
> <xtags:context select="$streamxml/job">
> <xtags:add>  <var name="url"><![CDATA[<xtags:valueOf
> select="$lxml/my/loc/@url"/>]]></var>
> </xtags:add>
> </xtags:context>
> 
> The "<xtags:valueOf select="$lxml/my/loc/@url"/>" statement yields
> this when called elsewhere in the code (as expected):
> 
> http://localhost:8084/checklist/update.jsp
> 
> Furthermore, if I add a second var element with exactly the same
> content, the second element is rendered correctly:
> 
> <job>
>   <var
>
name="url"><![CDATA[http://localhost:8084/checkl]]><![CDATA[ist/update.jsp]]></var>
>   <var
> name="url"><![CDATA[http://localhost:8084/checklist/update.jsp]]></var>
> </job>
> 
> <xtags:context select="$streamxml/job">
> <xtags:add>  <var name="url"><![CDATA[<xtags:valueOf
> select="$lxml/my/loc/@url"/>]]></var>
>    <var name="url"><![CDATA[<xtags:valueOf
> select="$lxml/my/loc/@url"/>]]></var>
> </xtags:add>
> </xtags:context>
> 
> 
> Bizarre. This is quite frustrating, but I have started to remove these
> CDATA wrappers in order to work around the problem. The reason for
> their inclusion in the first place to to be in 100% compliance with
> an external interface specification, but the interface works without
> the CDATA wrapper, so I'm in the clear for now.
> 
> Is this a real bug, or have I missed something obvious?
> 
> Regards,
> 
> 
> Malcolm.

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

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

Reply via email to