Hello all, I hope someone can help with this. 

I have a document with a namespace in a buffer, I try to add some nodes
to it with the insert sub-task of xmltask, but when the document is
later written, the nodes I inserted have an attribute of xmlns="" which
seems to explicitly declare NO namespace. I don't want the xmlns to show
up at all, resulting in the nodes I inserted having the same namespace
as the parent node. 

The source document (one in the buffer) looks something like: 

<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd";>
  <portlet>
   <portlet-name>SomePortlet</portlet-name>
   .....
</portlet>
</portlet-app>

Here is the code snippet that does the insert:

          <xmltask sourcebuffer="${frag_tmp}" destbuffer="${frag_tmp}"
failWithoutMatch="true" report="false">
                <insert path="/:portlet-app/:portlet/:portlet-name"
position="before">
                    <![CDATA[<description
xml:lang="${lang}">${portlet.description}</description>]]>
                </insert>
            </xmltask>

This produces: 

<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd";>
  <portlet>
  <description xmlns="" xml:lang="xx">Some Description</description> 
  <portlet-name>SomePortlet</portlet-name>
   .....
</portlet>
</portlet-app>

I also tried inserting an xmlns attribute explicitly matching the
parent document like this: 

                <insert path="/:portlet-app/:portlet/:portlet-name"
position="before">
                    <![CDATA[<description
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd";
xml:lang="${lang}">${portlet.description}</description>]]>
                </insert>

but then I end up with this, which fails validation:

<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd";>
  <portlet>
  <description
__NS1:xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd";
xmlns:__NS1="http://www.w3.org/2000/xmlns/"; xml:lang="xx">Some
Description</description> 
  <portlet-name>SomePortlet</portlet-name>
   .....
</portlet>
</portlet-app>


Is there some trick to getting the text nodes that I insert to assume
the parent node's namespace?

Thank you in advance for any ideas. 




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to