Namespaces

24 views
Skip to first unread message

Philip Silva

unread,
Jun 20, 2011, 10:48:31 AM6/20/11
to libslax
Hi,

I have a slax script that processes RPC replies in which there are
default namespaces defined. So instead of writing

expr count(rpc-reply/interface-information/physical-interface);

I need to write:

ns rpc="urn:ietf:params:xml:ns:netconf:base:1.0";
ns jif="http://xml.juniper.net/junos/10.4R1/junos-interface";

/* ... */

expr count(rpc:rpc-reply/jif:interface-information/jif:physical-
interface);

The problem is that my slax script needs to handle RPC replies from
different JunOS versions, so there are cases in which I would have to
define

ns jif="http://xml.juniper.net/junos/10.4S3/junos-interface"; /*
instead of 10.4R1 */

Thus having dozens of different slax scripts for different JunOS
versions. How can I circumvent this problem?

Thanks, Philip

Phil Shafer

unread,
Jun 21, 2011, 10:24:02 AM6/21/11
to lib...@googlegroups.com
On Jun 20, 2011, at 10:48 AM, Philip Silva wrote:
> ns jif="http://xml.juniper.net/junos/10.4S3/junos-interface"; /*
> instead of 10.4R1 */
>
> Thus having dozens of different slax scripts for different JunOS
> versions. How can I circumvent this problem?


In the JUNOS world, we translate namespaces like this before the script is run, so you'll see:

ns junos = "http://xml.juniper.net/junos/*/junos";

where the literal character "*" has replaced the version number. While testing JUNOS scripts using libslax, you'll have to make that change in the input data yourself.

I'd like to see this appear as an option to the <rpc> but that work hasn't been done yet.

Thanks,
Phil

Philip Silva

unread,
Jun 27, 2011, 9:42:43 AM6/27/11
to libslax
Thanks for your help!
Reply all
Reply to author
Forward
0 new messages