From: Karr, David <david.karr@wa...> - 2008-10-01 22:28:37
Just to clarify one point of this, in an xpath test app that I wrote, if
I run a query like this on a similar file, if I don't add a mapping for
the "empty" prefix to the appropriate namespace, a query using the blank
prefix fails with "Prefix must resolve to a namespace". It only works
when I add the mapping from the "" prefix to the namespace.
> -----Original Message-----
> From: Brian Agnew [mailto:brian@...]
> Sent: Wednesday, October 01, 2008 12:55 PM
> To: 'xmltask-users@...'
> Subject: [Xmltask-users] [Fwd: Re: Reading out an attribute]
> (forwarded due to mail problems)
> [forwarded message manually inserted here]
> A very quick test with your XML and the following:
> <target name="abc">
> <xmltask source="input.xml">
> <copy path="/:application/:module/@id" attrvalue="true"
> gives me WebModule_1213257640343
> which appears to be correct. In the XPath examples you're looking at,
the chances are they don't involve namespaces. If your example contains
namespaces (e.g. in the below) then you have to qualify your XML
appropriately. The colon indicates the 'local' name of the XML node
(i.e. not including the namespace qualifier) and so XPath can resolve
your XPath query. Note that this is handled entirely by the XML
mechanism in the Java runtime and is not specific to XMLTask.
> Hope that's of use!
> Brian Agnew
> Hybrids IT Development
> Global Derivatives Team
> Direct +44 (0)20 7475 8259
> PO Box 52715, 30 Gresham Street, London EC2P 2XY
Get latest updates about Open Source Projects, Conferences and News.