Your start is the Feed element in the pr namespace.

The u2 xml extraction does not always work too well with namespaces.

If required I can supply you an xsl to 'de namepsace' an xml - it is then
simple preprocessing task using xmltproc to give you a cleaner (in u2
regards) xml.

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bobby Worley
Sent: 09 November 2011 18:45
To: U2 Users List
Subject: [U2] Extracting XML attributes

Does anyone have an example of an XPath definition to extract an attribute
from an XML element?  The universe documentation for 10.3 and
11.1 doesn't cover this.   

I am trying to get the value of "ProductId" from the following XML
example:

<pr:Feed xmlns:pr="urn:someurl">
  <Data>
    <Products>
      <Product ProductId="ABC">
          ...
      </Product>
      <Product ProductId="123">
          ...
      </Product>
      <Product ProductId="XYZ">
          ...
      </Product>
   </Products>
  </Data>
</pr>

Using the this extraction file:

<U2XML_extraction xmlns:USxml="http://www.rocketU2.com/U2-xml"; >
   <file_extraction start="/Data" dictionary="XMLTESTFILE" null="EMPTY"
/>
   <field_extraction field="@ID" path="Products/Product/@ProductId" ,/>
</U2XML_extraction>

I get the following error:

>LIST XMLDATA EDGENET_XML "&XML&/test.ext"
Open XML data file failed.
XMLParser error message: Fatal error at file '/Volume1/MIS/&XML&/test.ext',
line 3, column 69. Message: Expected an attribute name

Open XML data file failed.
XMLParser error message: Fatal error at file '/Volume1/MIS/&XML&/test.ext',
line 3, column 69. Message: Expected an attribute name

Unable to open "XMLDATA:EDGENET_XML,&XML&/test.ext" file.
>
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1411 / Virus Database: 2092/4006 - Release Date: 11/09/11

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to