Home

XPath and name space

%3CLINGO-SUB%20id%3D%22lingo-sub-680695%22%20slang%3D%22en-US%22%3EXPath%20and%20name%20space%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-680695%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everyone.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20get%20the%26nbsp%3B%3CIDENTIFIER%3E%20element%20from%20the%20XML%20below%20using%20xpath%20and%20xmlDoc.SelectNodes(%22%5C%5CIdentifier%22)%20without%20luck.%20It%20seems%20that%20the%20%22n1%3A%22%20qualifier%20has%20to%20be%20incorporated%20but%20I%20cannot%20see%20how.%20Any%20suggestions%3F%3C%2FIDENTIFIER%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EB.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEPCISDOCUMENT%20creationdate%3D%22%26quot%3B2019-06-10T16%3A23%3A07Z%26quot%3B%22%20schemaversion%3D%22%26quot%3B1.1%26quot%3B%22%20epcis%3D%22%26quot%3Burn%3Aepcglobal%3Aepcis%3Axsd%3A1%26quot%3B%22%20gs1ushc%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22http%3A%2F%2Fepcis.gs1us.org%2Fhc%2Fns%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%22%3E%3CA%20href%3D%22http%3A%2F%2Fepcis.gs1us.org%2Fhc%2Fns%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fepcis.gs1us.org%2Fhc%2Fns%3C%2FA%3E%22%20xmlns%3Asbdh%3D%22%3CA%20href%3D%22http%3A%2F%2Fwww.unece.org%2Fcefact%2Fnamespaces%2FStandardBusinessDocumentHeader%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fwww.unece.org%2Fcefact%2Fnamespaces%2FStandardBusinessDocumentHeader%3C%2FA%3E%22%26gt%3B%3CBR%20%2F%3E%3CEPCISHEADER%3E%3CBR%20%2F%3E%3CSTANDARDBUSINESSDOCUMENTHEADER%20n1%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22http%3A%2F%2Fwww.unece.org%2Fcefact%2Fnamespaces%2FStandardBusinessDocumentHeader%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%22%3E%3CA%20href%3D%22http%3A%2F%2Fwww.unece.org%2Fcefact%2Fnamespaces%2FStandardBusinessDocumentHeader%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fwww.unece.org%2Fcefact%2Fnamespaces%2FStandardBusinessDocumentHeader%3C%2FA%3E%22%26gt%3B%3CBR%20%2F%3E%3CHEADERVERSION%3E1.0%3C%2FHEADERVERSION%3E%3CBR%20%2F%3E%3CSENDER%3E%3CBR%20%2F%3E%3CIDENTIFIER%20authority%3D%22%26quot%3BGLN%26quot%3B%22%3E97823048243%3C%2FIDENTIFIER%3E%3CBR%20%2F%3E...%3C%2FSENDER%3E%3C%2FSTANDARDBUSINESSDOCUMENTHEADER%3E%3C%2FEPCISHEADER%3E%3C%2FEPCISDOCUMENT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-680695%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Eexcel%20xpath%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
fdlsmg-ladnsgamgdn1390
New Contributor

Hi everyone.

 

I am trying to get the <n1:Identifier> element from the XML below using xpath and xmlDoc.SelectNodes("\\Identifier") without luck. It seems that the "n1:" qualifier has to be incorporated but I cannot see how. Any suggestions?

 

Thanks

B.

 

<epcis:EPCISDocument creationDate="2019-06-10T16:23:07Z" schemaVersion="1.1" xmlns:epcis="urn:epcglobal:epcis:xsd:1" xmlns:gs1ushc="http://epcis.gs1us.org/hc/ns" xmlns:sbdh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader">
<EPCISHeader>
<n1:StandardBusinessDocumentHeader xmlns:n1="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader">
<n1:HeaderVersion>1.0</n1:HeaderVersion>
<n1:Sender>
<n1:Identifier Authority="GLN">97823048243</n1:Identifier>
...