0

tried below, but until and unless I made AcknowledgeShipmentInbound node empty (deleting releaseID="9.2" xmlns="http://schema.infor.com/InforOAGIS/2" xmlns:xs="http://www.w3.org/2001/XMLSchema") select query is not fetching the value.

    Declare @xmlData xml
    set @xmlData = '<?xml version="1.0"?>
    <AcknowledgeShipmentInbound releaseID="9.2" xmlns="http://schema.infor.com/InforOAGIS/2" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <ApplicationArea>
        <Sender>
            <LogicalID>lid://ln01/2100</LogicalID>
            <ComponentID>erp</ComponentID>
            <ConfirmationCode>OnError</ConfirmationCode>
        </Sender>
        <CreationDateTime>2021-09-02T09:22:03Z</CreationDateTime>
        <BODID>1630574520554:123461:0</BODID>
     </ApplicationArea>
     <DataArea>
        <Acknowledge>
            <TenantID>KP_TRN</TenantID>
            <AccountingEntityID>2100</AccountingEntityID>
            <LocationID>S_2100</LocationID>
            <OriginalApplicationArea xmlns="">
                <Sender>
                    <LogicalID>oracle_erp_ihub_v2</LogicalID>
                    <ComponentID>External</ComponentID>
                    <ConfirmationCode>OnError</ConfirmationCode>
                </Sender>
                <CreationDateTime>2021-09-02T09:22:00.554Z</CreationDateTime>
                <BODID>ihub_v2:1630574520554:123461:0</BODID>
            </OriginalApplicationArea>
            <ResponseCriteria>
                <ResponseExpression actionCode="Rejected"/>
                <ChangeStatus>
                    <ReasonCode>tlbcts0074</ReasonCode>
                    <Reason languageID="en-US">Request validation; SHIPMENTS WITH REQUEST ID 
       2021090205 the value is too long.</Reason>
                </ChangeStatus>
            </ResponseCriteria>
        </Acknowledge>
        <ShipmentInbound>
            <ShipmentInboundHeader>
                <DocumentID>
                    <ID>Shipments with request id 28880902052200</ID>
                </DocumentID>
            </ShipmentInboundHeader>
            <ShipmentInboundLine>NONE</ShipmentInboundLine>
        </ShipmentInbound>
    </DataArea>
    </AcknowledgeShipmentInbound>'

   Declare @DocumentType nvarchar(100)
   DECLARE @DocumentId NVARCHAR(128);

   Select T.c.value('(DocumentID/ID/text())[1]', 'VARCHAR(128)')
   FROM @xmlData.nodes('*:AcknowledgeShipmentInbound/*:DataArea/*:ShipmentInbound/*:ShipmentInboundHeader') T(c)


            select T.c.query('./DocumentID/ID').value('.','nvarchar(128)')   as DocumentID
            from @xmlData.nodes('/AcknowledgeShipmentInbound/DataArea/ShipmentInbound/ShipmentInboundHeader') T(c)
1
  • Hi Larnu, I also need to read BODID which is under <OriginalApplicationArea xmlns=""> could you please help me Commented Dec 3, 2021 at 13:56

1 Answer 1

1

You need to define your namespace:

WITH XMLNAMESPACES (DEFAULT 'http://schema.infor.com/InforOAGIS/2')
SELECT SI.SIH.query('./DocumentID/ID').value('.', 'nvarchar(128)') AS DocumentID
FROM @xmlData.nodes('/AcknowledgeShipmentInbound/DataArea/ShipmentInbound/ShipmentInboundHeader') SI(SIH);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.