I'm assuming this must be a JUNOS bug? $ echo '<rpc><get-interface-information/></rpc>' | ssh -s lab-ex netconf [...] <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/12.3R10/junos"> <interface-information xmlns="http://xml.juniper.net/junos/12.3R10/junos-interface" junos:style="normal"> <physical-interface> <name> ge-0/0/0 </name> [...]
The newline characters immediately following <name> and preceeding </name> becomes part of the node value - that is, the interface name becomes "\nge-0/0/0\n" instead of "ge-0/0/0". (This does not happen only with interface names, pretty much any value is wrapped in these newline characters.) This in turn makes using XPath with expressions such as for example «//physical-interface[name="ge-0/0/0"]» to fail miserably. A simple workaround is to strip all the newline characters from the XML string before feeding it to the XML parser. But that of course will also break nodes may actually contain newlines - <junos:comment> comes to mind, are there others? I'm far from being an expert on XML or Netconf for that matter, so I'm wondering if anyone else on the list ran into this issue (surely yes?) and if so if there's a better way to deal with it? Interestingly, running "show interfaces | display xml" from the JUNOS shell looks much better: <rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.3R10/junos"> <interface-information xmlns="http://xml.juniper.net/junos/12.3R10/junos-interface" junos:style="normal"> <physical-interface> <name>ge-0/0/0</name> [...] If I could only convince the Netconf service to give me its replay formatted in this way instead everything would have worked well. Tore _______________________________________________ juniper-nsp mailing list juniper-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/juniper-nsp