0

I need to access the child node containing the default namespace For accessing the root node IFX that contains a namespace am using

//ns:IFX/ns:BankSvcRs/ns:RqUID

but now I need to access the <severity> and <SPName> and <CardEmbossNum>

<IFX xmlns="http://www.ifxforum.org/IFX_150">

    <BankSvcRs>
        <RqUID>124566665222</RqUID>
        <com.bac:CardAddRs xmlns:com.bac="http://www.fnf.com/xes/bac">
            <Status>
                <Severity>Info</Severity>

            </Status>
            <RqUID>124566665222</RqUID>
            <com.fnf:CardId xmlns:com.fnf="http://www.fnf.com/xes">
                <CustId>
                    <SPName>com.fnf.xes.BOSS</SPName>
                     <CardLogicalData>
                        <CardEmbossNum/>
                        <Name>SpiderMAN</Name>
                    </CardLogicalData>
                </CustId>
            </com.fnf:CardId>
            <com.bac:CardInfo>
                <com.bac:CardAssociation/>
            </com.bac:CardInfo>
            <com.fnf:CardRec xmlns:com.fnf="http://www.fnf.com/xes">
                <com.fnf:CardId>
                    <CustId>
                        <SPName/>
                        <CardLogicalData>
                            <CardEmbossNum>00000000000000000</CardEmbossNum>
                        </CardLogicalData>
                    </CustId>
                </com.fnf:CardId>
                <com.fnf:CardStatus>
                    <StatusCode>0</StatusCode>
                    <StatusDesc>Fail</StatusDesc>
                </com.fnf:CardStatus>
            </com.fnf:CardRec>
        </com.bac:CardAddRs>
    </BankSvcRs>
</IFX>
0

1 Answer 1

2

You need to either declare the requisite namespaces in whatever API you're using and then use something like:

/ns:IFX/ns:BankSvcRs/com.fnf:CardId/ns:Status/ns:Severity

Or you can do something like this:

/ns:IFX/ns:BankSvcRs/*/ns:Status/ns:Severity

Or if you really wanted to:

/ns:IFX/ns:BankSvcRs/*[local-name() = 'CardAddRs']/ns:Status/ns:Severity

Though personally, I think using local-name() as a way to get around properly using namespaces is not a good practice.

You haven't shown us the code where you're using this XPath, so that's about as much help as I can provide without more information.

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.