[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML namespace advice



Phil Shafer wrote:
Andy Bierman writes:
  Q1: Is it an error if a PDU (e.g., <hello> or <rpc>) is received by
      the peer, which does not use namespaces?  Or is it okay to set
      the default namespace to the NETCONF NS in this case?

Does this fit under the 'be liberal in what you accept'
banner?  JUNOS tries to follow that, accepting either
an empty or an accurate namespace.

I believe the W3C documentation I read a long time ago
said no namespace is different than all the elements
and attributes in a default namespace.  I don't remember why.
If the targetNamespace attribute is missing from the <schema>
element, and the elementFormDefault and attributeFormDefault
are both 'unqualified', then there is no namespace at all.

Even if you assign a namespace, if there are child elements
of <config> or <filter> they should generate errors,
because they are not in the netconf namespace.

Of course, you could really follow the Postel Principle with zeal,
and ignore namespaces in the request entirely, figuring out
which element the manager is specifying (i.e., org. naming conventions
do not rely on namespaces to be unique).  I do that and also allow the
user to enter an owner="foo" attribute to help find the namespace.

However, in the <rpc-reply>, I always use namespaces,
even if they weren't used in the request.



  Q2: Are xmlns declarations special, and not supposed to be
      included in the list of replicated attributes?  All the
      document examples show them replicated in the <rpc-reply>.

They are special, but only slightly.  JUNOS echoes them all,
but I know that some XML parsers discard unused namespaces,
so an xmlns:foo attribute may be trimmed from an element where
nothing in it or its children reference that prefix.  This
trim happens in the parser, so the netconf implementation
may never see the xmlns attribute.


In netconf, only the <rpc-reply> element is special.
There are no attribute requirements for any other element.
I replicate every attribute from the <rpc>, as the doc says,
and then add more attributes as needed.



Thanks,
 Phil



Andy

--
to unsubscribe send a message to netconf-request@ops.ietf.org with
the word 'unsubscribe' in a single line as the message text body.
archive: <http://ops.ietf.org/lists/netconf/>