You are viewing limited content. For full access, please sign in.

Question

Question

Having a Problem with an XPATH Expression reading an XML file.

asked on January 28, 2016 Show version history

The following xpath xpression works fine using the following without header information.

//Shipment/DataContext/DataSourceCollection/DataSource[Type='ForwardingShipment']/Key

XML

<Shipment>
    <DataContext>
      <DataSourceCollection>
        <DataSource>
          <Type>ForwardingConsol</Type>
          <Key>C20-001000E</Key>
        </DataSource>
        <DataSource>
          <Type>ForwardingShipment</Type>
          <Key>S20-001001E</Key>
        </DataSource>
      </DataSourceCollection>
     </DataContext>
  </Shipment>

 

However when the used on the following including the full XML file with header information it does not.

<UniversalInterchange xmlns="http://www.cargowise.com/Schemas/Universal/2011/11" version="1.1">
  <Header>
    <SenderID>PF0YYTTRN</SenderID>
    <RecipientID>test</RecipientID>
  </Header>
  <Body>
    <UniversalShipment xmlns="http://www.cargowise.com/Schemas/Universal/2011/11" version="1.1">
  <Shipment>
    <DataContext>
      <DataSourceCollection>
        <DataSource>
          <Type>ForwardingConsol</Type>
          <Key>C20-001000E</Key>
        </DataSource>
        <DataSource>
          <Type>ForwardingShipment</Type>
          <Key>S20-001001E</Key>
        </DataSource>
      </DataSourceCollection>
     </DataContext>
  </Shipment>
</UniversalShipment>
  </Body>
</UniversalInterchange>

 

Looking for suggestions.

Thanks in advacne.

0 0

Replies

replied on January 28, 2016

I found the Advanced Tab for the XML Editor which allows me to disable Namespaces. 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.