Hello Brian,

I have following namespace-related problem, which I'm unable to solve. Maybe you can help me, otherwise it's something to consider for the next version of xmltask.

I have an xml document where each node comes from the same namespace.
I'm trying to loop over all nodes matching an xpath using <call>. For each node I need to access certain subnodes.


Script 1:

<call path="/:some/:path" target="process-node">
   <param name="value" path=":sub-node/text()"/>
</call>

throws

javax.xml.transform.TransformerException: A location path was expected, but the following token was encountered: :sub-node


Script 2:

<call path="/:some/:path" target="process-node">
   <param name="value" path="/:sub-node/text()"/>
</call>

(slash added) fails to match sub-node element.


Script 3:

<call path="/:some/:path" target="process-node" buffer="node"/>

[...]

<target name="process-node">
   <xmltask sourcebuffer="node">
      <copy path=":sub-node/text()" property="value"/>
   </xmltask>
</target>

throws

javax.xml.transform.TransformerException: A location path was expected, but the following token was encountered: :sub-node


Script 4:

<call path="/:some/:path" target="process-node" buffer="node"/>

[...]

<target name="process-node">
   <xmltask sourcebuffer="node">
      <copy path="*/*:sub-node/text()" property="value"/>
   </xmltask>
</target>

(slash added) throws

com.sun.org.apache.xpath.internal.domapi.XPathStylesheetDOM3Exception: Prefix must resolve to a namespace:


Using nested actions instead of target doesn't change anything. Using "sub-node/text()" without a colon fails to match sub-node element for obvious reasons.


Is there a way to achieve what I need with xmltask 1.15.1?

Another idea: <call> seems to make a copy of a matching node which makes it impossible to modify it so that the changes are reflected in original document. How about adding additional parameter, saying whether a copy should be made or not?

Help will be much appreciated.

Michal

Brian Agnew wrote:
Hi -

A number of issues have come up recently regarding XMLTask and namespaces.
I think these can be reduced to 2 fundamental issues:

1) XPaths for namespace-enabled documents are confusing. Or rather, people
are not aware of how these should work.

2) Inserting non-namespaced documents/fragments into namespace-enabled
documents doesn't quite work as expected (resulting in empty xmlns
attributes and the like)

(I believe that XMLTask is doing what it's asked to correctly - however
XMLTask exists to make people's lives easier and so we should be asking it
to do more)

I aim to fix both the above in the next release (no ETA, since I have no
spec!). If there are other namespace issues that you believe are not
covered in the above and that are causing you grief, please let me know.
The development of XMLTask is driven solely by customer requests now!

Brian


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to