You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Mikael Petterson <mi...@ericsson.com.INVALID> on 2022/12/21 14:46:38 UTC

Why does this xpath not work

Hi,

I am trying the below code. I want to get the value for ‘network’ name.
I put a breakpoint System.out.println("test");
And there is nothing in selectPath.

What am I missing?

//mike

public static void main(String[] args) throws Exception {
              RpcReply newRpcReply = NetconfRpc.newRpcReply(reply());
              String expression = "$this/ericsson-sbg-function---n22-cl2-ims1-pcscf-1-1---1-6-0-931/pcscf/access-net-pcscf/network-name/text()";
              XmlObject[] selectPath = newRpcReply.toXmlObject().selectPath(expression);
              System.out.println("test");
       }

       private static String reply() {
              return "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"272\">\r\n"
                           + "<data>\r\n"
                           + "    <ericsson-sbg-function---n22-cl2-ims1-pcscf-1-1---1-6-0-931 xmlns=\"urn:rdns:com:ericsson:oammodel:ericsson-sbg-function---n22-cl2-ims1-pcscf-1-1---1-6-0-931\">\r\n"
                           + "       <pcscf>\r\n"
                           + "         <access-net-pcscf>\r\n"
                           + "            <id>1</id>\r\n"
                           + "           <network-name>Access</network-name>\r\n"
                           + "       </access-net-pcscf>\r\n"
                            + "     </pcscf>\r\n"
                           + "</ericsson-sbg-function---n22-cl2-ims1-pcscf-1-1---1-6-0-931>\r\n"
                           + "</data>\r\n"
                           + "</rpc-reply>";
       }