您好我有以下XML消息
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<p66:retrieveOrderStatusResponse
xmlns:p66="http://v1_2.ostat.services.view.jdpoint.parts.deere.com">
<p66:retrieveOrderStatusReturn xmlns:p499="http://beans.v1_2.ostat.services.view.jdpoint.parts.deere.com">
<p499:version>1.2</p499:version>
<p499:accountNumber></p499:accountNumber>
<p499:currency></p499:currency>
<p499:dateOrdered>09Sep2011 07:25:17</p499:dateOrdered>
<p499:dealerRef>P1092293</p499:dealerRef>
<p499:destination xsi:nil="true"/>
<p499:discountTotal>0,00</p499:discountTotal>
<p499:estimatedOrderValue>162,71</p499:estimatedOrderValue>
<p499:exceptionReport xsi:nil="true"/>
<p499:extendedPriceTotal>162,71</p499:extendedPriceTotal>
<p499:lastChanged>SYSTEM</p499:lastChanged>
<p499:lineOfCredit xsi:nil="true"/>
<p499:merchandiseTotal></p499:merchandiseTotal>
<p499:orderNumber></p499:orderNumber>
<p499:orderStatus>RLSED</p499:orderStatus>
<p499:orderType>ORD_EMER</p499:orderType>
<p499:partialShip>1 - PRTSHP_CD1</p499:partialShip>
<p499:orderNotes/>
<p499:shipAddress>
<p499:shipAddressName></p499:shipAddressName>
<p499:shipAddressLine1></p499:shipAddressLine1>
<p499:shipAddressLine2/>
<p499:shipAddressCity></p499:shipAddressCity>
<p499:shipAddressStateProvince/>
<p499:shipPostalCode></p499:shipPostalCode>
<p499:shipAddressCountry></p499:shipAddressCountry>
<p499:shipAddressPhone/>
</p499:shipAddress>
<p499:billingAddress>
<p499:billAddressName></p499:billAddressName>
<p499:billAddressLine1></p499:billAddressLine1>
<p499:billAddressLine2></p499:billAddressLine2>
<p499:billAddressCity></p499:billAddressCity>
<p499:billAddressStateProvince/>
<p499:billPostalCode></p499:billPostalCode>
<p499:billAddressCountry></p499:billAddressCountry>
<p499:billAddressPhone/>
</p499:billingAddress>
<p499:poolCode>UF</p499:poolCode>
<p499:programNumber/>
<p499:programTerm/>
<p499:returnCode>1</p499:returnCode>
<p499:submittedBy>PMLINK</p499:submittedBy>
<p499:surchargeTotal>0,00</p499:surchargeTotal>
<p499:vin/>
<p499:orderLines>
<p499:orderLine>
<p499:type>ProcessedOrderLine</p499:type>
<p499:lineNumber>0001</p499:lineNumber>
<p499:splitLineNumber>01</p499:splitLineNumber>
<p499:quantity>2</p499:quantity>
<p499:partNumber>F025234</p499:partNumber>
<p499:binLocation></p499:binLocation>
<p499:partDescription>O-Ring</p499:partDescription>
<p499:partName xsi:nil="true"/>
<p499:extendedPrice></p499:extendedPrice>
<p499:shipDate>14Sep2011</p499:shipDate>
<p499:depot></p499:depot>
<p499:packlistNumber></p499:packlistNumber>
<p499:status>SHIPPED</p499:status>
<p499:lineNotes/>
<p499:investigations/>
<p499:specialPrice xsi:nil="true"/>
<p499:specialPriceNote xsi:nil="true"/>
<p499:drivenPrice xsi:nil="true"/>
</p499:orderLine>
<p499:orderLine>
<p499:type>ProcessedOrderLine</p499:type>
<p499:lineNumber>0002</p499:lineNumber>
<p499:splitLineNumber>01</p499:splitLineNumber>
<p499:quantity>2</p499:quantity>
<p499:partNumber>F003308</p499:partNumber>
<p499:binLocation></p499:binLocation>
<p499:partDescription>O-Ring</p499:partDescription>
<p499:partName xsi:nil="true"/>
<p499:extendedPrice></p499:extendedPrice>
<p499:shipDate>09Sep2011</p499:shipDate>
<p499:depot></p499:depot>
<p499:packlistNumber></p499:packlistNumber>
<p499:status>SHIPPED</p499:status>
<p499:lineNotes/>
<p499:investigations/>
<p499:specialPrice xsi:nil="true"/>
<p499:specialPriceNote xsi:nil="true"/>
<p499:drivenPrice xsi:nil="true"/>
</p499:orderLine>
<p499:orderLine>
<p499:type>ProcessedOrderLine</p499:type>
<p499:lineNumber>0003</p499:lineNumber>
<p499:splitLineNumber>01</p499:splitLineNumber>
<p499:quantity>1</p499:quantity>
<p499:partNumber>F050813</p499:partNumber>
<p499:binLocation></p499:binLocation>
<p499:partDescription>Seal</p499:partDescription>
<p499:partName xsi:nil="true"/>
<p499:extendedPrice></p499:extendedPrice>
<p499:shipDate>09Sep2011</p499:shipDate>
<p499:depot></p499:depot>
<p499:packlistNumber></p499:packlistNumber>
<p499:status>SHIPPED</p499:status>
<p499:lineNotes/>
<p499:investigations/>
<p499:specialPrice xsi:nil="true"/>
<p499:specialPriceNote xsi:nil="true"/>
<p499:drivenPrice xsi:nil="true"/>
</p499:orderLine>
<p499:orderLine>
<p499:type>ProcessedOrderLine</p499:type>
<p499:lineNumber>0004</p499:lineNumber>
<p499:splitLineNumber>01</p499:splitLineNumber>
<p499:quantity>1</p499:quantity>
<p499:partNumber>F009469</p499:partNumber>
<p499:binLocation></p499:binLocation>
<p499:partDescription>Seal</p499:partDescription>
<p499:partName xsi:nil="true"/>
<p499:extendedPrice>30,00</p499:extendedPrice>
<p499:shipDate>09Sep2011</p499:shipDate>
<p499:depot>Stockholm</p499:depot>
<p499:packlistNumber></p499:packlistNumber>
<p499:status>SHIPPED</p499:status>
<p499:lineNotes/>
<p499:investigations/>
<p499:specialPrice xsi:nil="true"/>
<p499:specialPriceNote xsi:nil="true"/>
<p499:drivenPrice xsi:nil="true"/>
</p499:orderLine>
<p499:orderLine>
<p499:type>EnteredOrderLine</p499:type>
<p499:lineNumber>0005</p499:lineNumber>
<p499:splitLineNumber/>
<p499:quantity>1</p499:quantity>
<p499:partNumber>F009465</p499:partNumber>
<p499:binLocation></p499:binLocation>
<p499:partDescription>Sealing Ring</p499:partDescription>
<p499:partName xsi:nil="true"/>
<p499:extendedPrice/>
<p499:shipDate xsi:nil="true"/>
<p499:depot/>
<p499:packlistNumber xsi:nil="true"/>
<p499:status>ORDERED</p499:status>
<p499:lineNotes xsi:nil="true"/>
<p499:investigations/>
<p499:specialPrice xsi:nil="true"/>
<p499:specialPriceNote xsi:nil="true"/>
<p499:drivenPrice xsi:nil="true"/>
</p499:orderLine>
<p499:orderLine>
<p499:type>ProcessedOrderLine</p499:type>
<p499:lineNumber>0005</p499:lineNumber>
<p499:splitLineNumber>01</p499:splitLineNumber>
<p499:quantity>2</p499:quantity>
<p499:partNumber>F009465</p499:partNumber>
<p499:binLocation></p499:binLocation>
<p499:partDescription>Sealing Ring</p499:partDescription>
<p499:partName xsi:nil="true"/>
<p499:extendedPrice></p499:extendedPrice>
<p499:shipDate>0</p499:shipDate>
<p499:depot>S</p499:depot>
<p499:packlistNumber>4200D252100185</p499:packlistNumber>
<p499:status>SHIPPED</p499:status>
<p499:lineNotes/>
<p499:investigations/>
<p499:specialPrice xsi:nil="true"/>
<p499:specialPriceNote xsi:nil="true"/>
<p499:drivenPrice xsi:nil="true"/>
</p499:orderLine>
</p499:orderLines>
<p499:shipments>
<p499:shipment>
<p499:shipUnit></p499:shipUnit>
<p499:lineCount>5</p499:lineCount>
<p499:viaUnit>DIRECT</p499:viaUnit>
<p499:carrierService>203 SE - DANX DANX</p499:carrierService>
<p499:requestedShipDate>09Sep2011</p499:requestedShipDate>
<p499:estWeight>0,057</p499:estWeight>
<p499:breakPointCarrier/>
<p499:breakPointCity/>
<p499:breakPointState/>
<p499:carrierPaymentRespInd></p499:carrierPaymentRespInd>
<p499:freightChargesNeededInd></p499:freightChargesNeededInd>
</p499:shipment>
</p499:shipments>
<p499:investigations/>
</p66:retrieveOrderStatusReturn>
</p66:retrieveOrderStatusResponse>
</soapenv:Body>
</soapenv:Envelope>
我想提取p499:partNumber值(在p499中:orderLines / p499:orderLine路径。
我将xml消息存储在名为l_resp_xml_的XMLType变量中:= XMLType.createXML(soap_respond _);
我试图在此主题上关注此代码:Trying to loop through XML to extract values in PLSQL
这给了我这个:
FOR x in(
SELECT * FROM XMLTABLE('//p66:retrieveOrderStatusResponse/p66:retrieveOrderStatusReturn/p499:orderLines/p499:orderLine/partNumber'
PASSING l_resp_xml_
COLUMNS partNumber varchar2(200) PATH '.'))
然后我做一个dmbs_output.put_line(x.partNumber); 但是这出现了空白,我收到一条错误消息: ORA-19228:XPST0008 - 未声明的标识符:前缀&#39; p66&#39; local-name&#39; p66:retrieveOrderStatusResponse&#39;
任何人都可以帮助我做错吗?
由于
答案 0 :(得分:0)
您需要添加XMLNAMESPACES
子句:
SELECT * FROM XMLTABLE(xmlnamespaces( 'http://schemas.xmlsoap.org/soap/envelope/' as "soapenv",
'http://v1_2.ostat.services.view.jdpoint.parts.deere.com' as "p66",
'http://beans.v1_2.ostat.services.view.jdpoint.parts.deere.com' as "p499"
),'/soapenv:Envelope/soapenv:Body/p66:retrieveOrderStatusResponse/p66:retrieveOrderStatusReturn/p499:orderLines/p499:orderLine/p499:partNumber'
PASSING l_resp_xml_
COLUMNS partNumber varchar2(200) PATH '.')