[jdom-interest] Adding node with namespace without declaring namespace.

J S ladyslipper98201 at yahoo.com
Fri May 24 17:00:55 PDT 2002


I would like to insert a piece of text simliar to the
following:

<javacustomtag:GetName/> into the text of element
using JDOM.

So I have something that looks like:

<xml>
<title id="2005"></title>
</xml>

Now I grab the id and I lookup the value of title in
java and it returns the following text:

<javacustomtag:GetName/>

Now I save the children of the title element into a
List I create a new vector and add the custom tag into
the vector and then add all the children into the
vector.  I then clear the children from the title
element and add the vector in. 

Now when I output my title element the result is:

<title id="2005"> &lt;javacustomtag:GetName/&gt;
</title>

Clearly when my jsp is executed this will not be
detected as a custom tag.  I can declare the namespace
but then I end up with the following

<title id="2005"> <javacustomtag:GetName
xmlns:javacustomtag/> </title>

and this prevents the custom tag from properly
executing.

Any ideas would be most welcome!

The only backup plan that I have now is to first
insert it as javacustomtag-GetName and then use an
XSLT again to transform it into javacustomtag:GetName
but this seems like an extra step that shouldn't be
necessary.



__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com



More information about the jdom-interest mailing list