Xpath having elements with and without prefixes in java

164 views Asked by At

Want to fetch the value at xpaths /SOAP:Envelope/SOAP:Body/generic.GenericObject.configureInstanceWithResult/configInfo/equipment.PhysicalPort/description and

/SOAP:Envelope/SOAP:Body/generic.GenericObject.configureInstanceWithResult/deployer

From the below XML

<?xml version="1.0" encoding="UTF-8"?>
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
     <SOAP:Header>
          <header xmlns="xmlapi_1.0">
               <requestID>XXX</requestID>
          </header>
     </SOAP:Header>
     <SOAP:Body>
          <generic.GenericObject.configureInstanceWithResult xmlns="xmlapi_1.0">
               <deployer>deployer value</deployer>
               <synchronousDeploy>XXX</synchronousDeploy>
               <distinguishedName>XXX</distinguishedName>
               <includeChildren>XXX</includeChildren>
               <configInfo>
                    <equipment.PhysicalPort>
                         <actionMask>
                              <bit>XXX</bit>
                         </actionMask>
                         <administrativeState>XXX</administrativeState>
                         <loadBalanceAlgorithm>XXX</loadBalanceAlgorithm>
                         <description>XXX</description>
                    </equipment.PhysicalPort>
               </configInfo>
          </generic.GenericObject.configureInstanceWithResult>
     </SOAP:Body>
</SOAP:Envelope>

I cannot change the Xml or the xpath so need to come up with a logic to deal with it. Kindly let me know how to handle it.

0

There are 0 answers