我从下面的 XML 提取中的 /ShippingDocumentationNotification/ShippingBusinessDocument/ShipmentInformation/DeclarationInformation 节点解析 PartnerDescription 元素的成功率为零。我最近的尝试:
SELECT x.item.value('PartnerName[1]', 'VARCHAR(20)') AS PartnerName
FROM @Data.nodes('/ShippingDocumentationNotification/ShippingBusinessDocument/ShipmentInformation/DeclarationInformation/PartnerDescription/FullPartner/PartnerIdentification/PartnerName')
AS x ( item )
其中@Data 是一个XML 变量,用于存储XML 提取的一个实例。最终,我想解析(即展平)每个 PartnerDescription 节点的 PartnerIdentification 和 PhysicalAddress 子节点中包含的数据。我已经查看了所有谷歌和 SO - 如果有人能让我开始,我将非常感激。
<tns:ShippingDocumentationNotification
xmlns:sha="urn:rosettanet:specification:domain:Shared:xsd:schema:01.17" xmlns:dfpt="urn:rosettanet:specification:domain:Logistics:FreightPaymentTerms:xsd:codelist:01.03" xmlns:uc="urn:rosettanet:specification:universal:Country:xsd:codelist:01.02" xmlns:drl="urn:rosettanet:specification:domain:Logistics:RouteLocation:xsd:codelist:01.03" xmlns:tns="urn:rosettanet:specification:interchange:ShippingDocumentationNotification:xsd:schema:02.07" xmlns:dcst="urn:rosettanet:specification:domain:Logistics:CustomsType:xsd:codelist:01.03" xmlns:dtrt="urn:rosettanet:specification:domain:Logistics:TrackingReferenceType:xsd:codelist:01.06" xmlns:ssdh="urn:rosettanet:specification:system:StandardDocumentHeader:xsd:schema:01.23" xmlns:uci="urn:rosettanet:specification:universal:ContactInformation:xsd:schema:01.04" xmlns:updi="urn:rosettanet:specification:universal:ProductIdentification:xsd:schema:01.04" xmlns:upi="urn:rosettanet:specification:universal:PartnerIdentification:xsd:schema:01.16" xmlns:ucs="urn:rosettanet:specification:universal:CountrySubdivision:xsd:codelist:01.02" xmlns:uuom="urn:rosettanet:specification:universal:UnitOfMeasure:xsd:codelist:01.04" xmlns:ulc="urn:rosettanet:specification:universal:Locations:xsd:schema:01.04" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:upri="urn:rosettanet:specification:universal:ProcessRoleIdentifier:xsd:codelist:01.11" xmlns:dsd="urn:rosettanet:specification:domain:Logistics:ShippingDocument:xsd:codelist:01.02" xmlns:udct="urn:rosettanet:specification:universal:DocumentType:xsd:codelist:01.13" xmlns:upd="urn:rosettanet:specification:universal:PhysicalDimension:xsd:schema:01.07" xmlns:pfx24="http://www.tibco.com/xmlns/ae2xsd/2002/05/ae/ADB/OTMflex" xmlns:udc="urn:rosettanet:specification:universal:Document:xsd:schema:01.12" xmlns:rat="urn:rosettanet:specification:domain:Shared:AmountType:xsd:codelist:01.03" xmlns:dat="urn:rosettanet:specification:domain:Procurement:ActionType:xsd:codelist:01.04" xmlns="http://xyz/" xmlns:dl="urn:rosettanet:specification:domain:Logistics:xsd:schema:02.22" xmlns:dic="urn:rosettanet:specification:domain:Logistics:Incoterms:xsd:codelist:01.03" xmlns:dsm="urn:rosettanet:specification:domain:Logistics:ShipmentMode:xsd:codelist:01.05" xmlns:ume="urn:rosettanet:specification:universal:MonetaryExpression:xsd:schema:01.06" xmlns:dpts="urn:rosettanet:specification:domain:Procurement:PaymentTerms:xsd:codelist:01.04" xmlns:rssl="urn:rosettanet:specification:domain:Shared:ShippingServiceLevel:xsd:codelist:01.01" xmlns:ucr="urn:rosettanet:specification:universal:Currency:xsd:codelist:01.03" xmlns:dp="urn:rosettanet:specification:domain:Procurement:xsd:schema:02.28" xmlns:dsh="urn:rosettanet:specification:domain:Procurement:SpecialHandling:xsd:codelist:01.04">
<ssdh:DocumentHeader>
<ssdh:DocumentInformation>
<ssdh:Creation>2012-05-08T05:12:57-07:00</ssdh:Creation>
<ssdh:DocumentIdentification>
<ssdh:Identifier>25163</ssdh:Identifier>
<ssdh:Type>TRUCK CLOSE</ssdh:Type>
<ssdh:StandardDocumentIdentification>
<ssdh:Standard>RosettaNet</ssdh:Standard>
<ssdh:Version>11.11</ssdh:Version>
</ssdh:StandardDocumentIdentification>
</ssdh:DocumentIdentification>
</ssdh:DocumentInformation>
<ssdh:Receiver>
<upi:PartnerIdentification>
<upi:PartnerName />
<DUNS xmlns="urn:rosettanet:specification:universal:DataType:xsd:schema:01.04">894694306</DUNS>
</upi:PartnerIdentification>
</ssdh:Receiver>
<ssdh:Sender>
<upi:PartnerIdentification>
<upi:PartnerName>CISCO</upi:PartnerName>
<DUNS xmlns="urn:rosettanet:specification:universal:DataType:xsd:schema:01.04">678543210</DUNS>
</upi:PartnerIdentification>
</ssdh:Sender>
</ssdh:DocumentHeader>
<tns:ShippingBusinessDocument>
<dat:ActionType>ADD</dat:ActionType>
<tns:HeaderInformation>
<tns:PackingList>
<udc:DateTime>2012-03-01T00:39:54-07:00</udc:DateTime>
<udct:DocumentType>SHD</udct:DocumentType>
<udc:Identifier>0</udc:Identifier>
<udc:Line>0</udc:Line>
<udc:Revision>F</udc:Revision>
</tns:PackingList>
<tns:ShippingDocument>
<udc:DateTime>2012-03-01T00:39:54-07:00</udc:DateTime>
<udct:DocumentType>SAO</udct:DocumentType>
<udc:Identifier>51548069</udc:Identifier>
<udc:Line>1</udc:Line>
<udc:Revision>Standard - JPN</udc:Revision>
</tns:ShippingDocument>
<tns:ShippingOrderInformation>
<dl:OrderInformation>
<ulc:AlternativeIdentifier>
<ulc:Authority>Cisco Systems</ulc:Authority>
<ulc:Identifier />
</ulc:AlternativeIdentifier>
<dl:OrderAllocationDate>2012-03-16T00:00:00-07:00</dl:OrderAllocationDate>
<dl:OrderReference>
<udc:DateTime>2012-05-08T05:12:57-07:00</udc:DateTime>
<udct:DocumentType>PUO</udct:DocumentType>
<udc:Identifier>X9055411-K2501</udc:Identifier>
</dl:OrderReference>
<dl:TotalAmount>
<ume:Amount>6422.09</ume:Amount>
<ucr:Currency>USD</ucr:Currency>
</dl:TotalAmount>
</dl:OrderInformation>
<tns:RequestingOrderInformation>
<udc:BusinessDocumentReference>
<udct:DocumentType>SAO</udct:DocumentType>
<udc:Identifier>51548069-1</udc:Identifier>
</udc:BusinessDocumentReference>
<tns:IsOrderToBeMerged>0</tns:IsOrderToBeMerged>
<tns:OrderReference>
<udc:DateTime>2012-05-08T05:12:57-07:00</udc:DateTime>
<udct:DocumentType>SNC</udct:DocumentType>
<udc:Identifier>0</udc:Identifier>
<udc:Line>1</udc:Line>
<udc:Revision>1</udc:Revision>
<udc:SubLine>1</udc:SubLine>
</tns:OrderReference>
</tns:RequestingOrderInformation>
<tns:RequestingOrderInformation>
<udc:BusinessDocumentReference>
<udct:DocumentType>SAO</udct:DocumentType>
<udc:Identifier>51548069-1</udc:Identifier>
</udc:BusinessDocumentReference>
<tns:IsOrderToBeMerged>0</tns:IsOrderToBeMerged>
<tns:OrderReference>
<udc:DateTime>2012-05-08T05:12:57-07:00</udc:DateTime>
<udct:DocumentType>SNC</udct:DocumentType>
<udc:Identifier>0</udc:Identifier>
<udc:Line>1</udc:Line>
<udc:Revision>1</udc:Revision>
<udc:SubLine>2</udc:SubLine>
</tns:OrderReference>
</tns:RequestingOrderInformation>
</tns:ShippingOrderInformation>
</tns:HeaderInformation>
<tns:ShipmentInformation>
<tns:ContainerTotalCount>1</tns:ContainerTotalCount>
<dl:CustomsInformation>
<dl:Customs>
<uc:Country>US</uc:Country>
<dcst:CustomsType>EXP</dcst:CustomsType>
<dl:EntryNumber>77-0059951</dl:EntryNumber>
<dl:Identifier />
</dl:Customs>
</dl:CustomsInformation>
<tns:DeclarationInformation>
<tns:Declarant>
<upi:SpecifiedFullPartner schemaVersion="this choice is requried" />
</tns:Declarant>
<tns:IsInformationComplete>1</tns:IsInformationComplete>
<upi:PartnerDescription>
<upi:FullPartner>
<uci:ContactInformation>
<uci:Contact />
<uci:Phone />
</uci:ContactInformation>
<ulc:Location>
<ulc:AlternativeIdentifier>
<ulc:Authority>Cisco Systems</ulc:Authority>
<ulc:Identifier>CCI+CI+PL+PL2+SLI</ulc:Identifier>
</ulc:AlternativeIdentifier>
</ulc:Location>
<upi:PartnerIdentification>
<upi:PartnerName>CISCO SYSTEMS G.K.</upi:PartnerName>
<ulc:AlternativeIdentifier>
<ulc:Authority>Cisco Systems</ulc:Authority>
<ulc:Identifier>68268</ulc:Identifier>
</ulc:AlternativeIdentifier>
</upi:PartnerIdentification>
<ulc:PhysicalAddress>
<ulc:AddressLine1>Midtown Tower</ulc:AddressLine1>
<ulc:AddressLine2>9-7-1, Akasaka</ulc:AddressLine2>
<ulc:AddressLine3>Minato-ku</ulc:AddressLine3>
<ulc:AddressLine4 />
<ulc:AddressLine5 />
<ulc:CityName>Tokyo, 107-6227</ulc:CityName>
<uc:Country>JP</uc:Country>
<ucs:CountrySubdivision />
<ulc:PostalCode />
<ulc:PostOfficeBox />
</ulc:PhysicalAddress>
<upri:ProcessRoleIdentifier>IMB</upri:ProcessRoleIdentifier>
</upi:FullPartner>
</upi:PartnerDescription>
<upi:PartnerDescription>
<upi:FullPartner>
<uci:ContactInformation>
<uci:Contact>None</uci:Contact>
<uci:Phone />
</uci:ContactInformation>
<ulc:Location>
<ulc:AlternativeIdentifier>
<ulc:Authority>Cisco Systems</ulc:Authority>
<ulc:Identifier>CCI+CI+PL+PL2+SLI</ulc:Identifier>
</ulc:AlternativeIdentifier>
</ulc:Location>
<upi:PartnerIdentification>
<upi:PartnerName>CISCO SYSTEMS G.K.</upi:PartnerName>
<ulc:AlternativeIdentifier>
<ulc:Authority>Cisco Systems</ulc:Authority>
<ulc:Identifier />
</ulc:AlternativeIdentifier>
</upi:PartnerIdentification>
<ulc:PhysicalAddress>
<ulc:AddressLine1>C/o Schenker Logistics</ulc:AddressLine1>
<ulc:AddressLine2>MIDTOWN TOWER</ulc:AddressLine2>
<ulc:AddressLine3>9-7-1, AKASAKA</ulc:AddressLine3>
<ulc:AddressLine4 />
<ulc:AddressLine5 />
<ulc:CityName>MINATO-KU</ulc:CityName>
<uc:Country>JP</uc:Country>
<ucs:CountrySubdivision>TOKYO</ucs:CountrySubdivision>
<ulc:PostalCode>107-6227</ulc:PostalCode>
<ulc:PostOfficeBox />
</ulc:PhysicalAddress>
<upri:ProcessRoleIdentifier>ITT</upri:ProcessRoleIdentifier>
</upi:FullPartner>
</upi:PartnerDescription>