JJKing
asked on
Get xml data
Hi
I have the following xml document and I want to retrieve the <env:identity> value. I am using VB.Net and have code to try and extract the data but I cannot seem to get it to work.
Any Ideas ?
<Envelope xmlns="http://www.intentia.com/MBM" xmlns:env="http://www.intentia.com/MBM_Envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.intentia.com/MBM Prototype_Order.xsd">
<Header>
<env:delivery>
<env:to>
<env:address>Movex</env:ad dress>
</env:to>
<env:from>
<env:address>Eprocurement< /env:addre ss>
</env:from>
<env:reliability>
<env:sendReceiptTo>
</env:sendReceiptTo>
<env:receiptRequiredBy>
</env:receiptRequiredBy>
</env:reliability>
</env:delivery>
<env:properties>
<env:identity>100QDP
</env:identity>
<env:sentAt></env:sentAt>
<env:expiresAt>
</env:expiresAt>
<env:topic></env:topic>
</env:properties>
<env:manifest>
<env:reference uri="#BasdaOrder@1">
<env:description></env:des cription>
</env:reference>
</env:manifest>
<env:process>
<env:type>0</env:type>
<env:instance>
</env:instance>
<env:handle>
</env:handle>
</env:process>
</Header>
<Body>
<Order xmlns="urn:schemas-basda-o rg:2000:pu rchaseOrde r:xdr:3.01 " xmlns:xdr="XDR-compat-v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:sc hemas-basd a-org:2000 :purchaseO rder:xdr:3 .01 Order-v3.xsd">
</Order>
</Body>
</Envelope>
I have the following xml document and I want to retrieve the <env:identity> value. I am using VB.Net and have code to try and extract the data but I cannot seem to get it to work.
Any Ideas ?
<Envelope xmlns="http://www.intentia.com/MBM" xmlns:env="http://www.intentia.com/MBM_Envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.intentia.com/MBM Prototype_Order.xsd">
<Header>
<env:delivery>
<env:to>
<env:address>Movex</env:ad
</env:to>
<env:from>
<env:address>Eprocurement<
</env:from>
<env:reliability>
<env:sendReceiptTo>
</env:sendReceiptTo>
<env:receiptRequiredBy>
</env:receiptRequiredBy>
</env:reliability>
</env:delivery>
<env:properties>
<env:identity>100QDP
</env:identity>
<env:sentAt></env:sentAt>
<env:expiresAt>
</env:expiresAt>
<env:topic></env:topic>
</env:properties>
<env:manifest>
<env:reference uri="#BasdaOrder@1">
<env:description></env:des
</env:reference>
</env:manifest>
<env:process>
<env:type>0</env:type>
<env:instance>
</env:instance>
<env:handle>
</env:handle>
</env:process>
</Header>
<Body>
<Order xmlns="urn:schemas-basda-o
</Order>
</Body>
</Envelope>
Public Function RetrieveXMLNodeData() As String
Try
RetrieveXMLNodeData = Nothing
Dim doc As New XmlDocument
doc.Load(MyDocPath)
Dim root As XmlElement = doc.DocumentElement
Dim Nmspc = New XmlNamespaceManager(doc.NameTable)
Nmspc.AddNamespace("A", "env:http://www.intentia.com/MBM_Envelope")
RetrieveXMLNodeData = root.SelectSingleNode("A:properties/A:identity", nmspc).InnerText
Catch ex As Exception
Throw ex
End Try
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER