0

I have the below xml

<?xml version="1.0"?>
<response status="200">
  <ns3:output xmlns="http://xmlns.oracle.com/apps/fnd/wf/worklist/service/rt/artifacts/notificationdetails/" 
              xmlns:ns2="http://xmlns.oracle.com/apps/fnd/wf/worklist/service/rt/artifacts/worklistmgmt/" 
              xmlns:ns3="http://xmlns.oracle.com/apps/fnd/wf/worklist/service/rt/artifacts/worklist/">
    <ns2:notifications count="140552">
      <ns2:notification>
        <ns2:NotificationId>4687807</ns2:NotificationId>
      </ns2:notification>
    </ns2:notifications>
  </ns3:output>
</response>

I need to parse this and get the NotificationId value for each row. I tried using the below code to get the list but it returned 0.

notificationrows = xmlDoc.documentElement.selectNodes("/ns3:output/ns2:notifications");

can anyone tell how to achieve this?

1
  • 3
    What language are you using? Commented Jan 16, 2013 at 15:26

1 Answer 1

1

As per the comment you haven't told us which language / parser you are using, but you can use local-name() to achieve namespace agnostic xpath, to avoid using a NamespaceManager or similar, as follows:

notificationrows = xmlDoc.documentElement.selectNodes("/response/*[local-name()='output']/*[local-name()='notifications']");

Update

Note that your root element is response (in global namespace), so you'll either need to navigate it explicitly, or use // to find matching descendants.

Sign up to request clarification or add additional context in comments.

1 Comment

can u please provide the exact or sample code on how to do this.

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.