Subject: [ietf-provreg] XML namespace shortcuts

From: Otmar Lendl <[email-masked]>
Date: Mon, 19 May 2003 15:59:06 +0200

I've recently come across some issues concerning the use of XML
namespaces within EPP. I think the draft could be a bit more explicit here.

According to http://www.rpbourret.com/xml/NamespacesFAQ.htm#q3_2 ,
namespace definitions tie namespace Names to prefixes; in the case
of epp, this is done e.g. here:

   <host:create xmlns:host="urn:ietf:params:xml:ns:host-1.0">

which makes "host:" basically a shortcut for "urn:ietf:params:xml:ns:host-1.0".

The lastest draft says:

  The EPP <create> command provides a transform operation that allows a
  client to create a host object.  In addition to the standard EPP
  command elements, the <create> command MUST contain a <host:create>
  element that identifies the host namespace and the location of the
  host schema.  

This is IMHO ambiguous. As I read it, it requires that the <create>
tag must be put into the "urn:ietf:params:xml:ns:host-1.0" namespace.

But one could also read that paragraph as requiring that the prefix must
always be "host:". After all, in all the examples that is the case.

What are the real implications?

Example mod_epp:

	mod_epp parses the XML into a DOM-tree and then serializes the
	tree again when passing the command to the backend. The
	expat-light library included in Apache 2.0 uses simple 
	prefixes for all known namespaces when serializing, thus it turns:

	<?xml version="1.0" encoding="UTF-8" standalone="no"?>
	<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
	     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	     xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
	     epp-1.0.xsd">
	  <command>
	    <create>
	      <host:create
	       xmlns:host="urn:ietf:params:xml:ns:host-1.0"
	       xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0
	       host-1.0.xsd">
		<host:name>ns1.example.com</host:name>
		<host:addr ip="v4">192.0.2.2</host:addr>
		<host:addr ip="v4">192.0.2.29</host:addr>
		<host:addr ip="v6">1080:0:0:0:8:800:200C:417A</host:addr>
	      </host:create>
	    </create>
	    <clTRID>ABC-12345</clTRID>
	  </command>
	</epp>

	into

	<ns2:epp ns1:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
	epp-1.0.xsd" xmlns:ns3="urn:ietf:params:xml:ns:host-1.0"
	xmlns:ns2="urn:ietf:params:xml:ns:epp-1.0"
	xmlns:ns1="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="DAV:">
	  <ns2:command>
	    <ns2:create>
	      <ns3:create ns1:schemaLocation="urn:ietf:params:xml:ns:host-1.0
	host-1.0.xsd">
		<ns3:name>ns1.example.com</ns3:name>
		<ns3:addr ip="v4">192.0.2.2</ns3:addr>
		<ns3:addr ip="v4">192.0.2.29</ns3:addr>
		<ns3:addr ip="v6">1080:0:0:0:8:800:200C:417A</ns3:addr>
	      </ns3:create>
	    </ns2:create>
	    <ns2:clTRID>ABC-12345</ns2:clTRID>
	  </ns2:command>
	</ns2:epp> 

	(the xmlns:ns0="DAV:" is leftover from the webDAV implementation
	which caused expat to be included in Apache.)

	As I understand XML namespaces, these two paragraphs define
	the same XML object.

	Is the seconds paragraph RFC-draft-compliant?

Example OpenReg

	OpenReg 1.0.1 completely ignores the namespace definition and
	only relies on the tag's name as encountered between < and >. 
	Thus it would choke on the second paragraph from above.

	Is that ok?

	[I've sent the ISC people a patch which solves this, btw. That
	was only about ~20 lines of diff.]

-=-=-=

I think the correct solution is to allow arbitrary namespace prefixes.

Comments?

/ol
-- 
< Otmar Lendl <[email-masked]>  | nic.at Systems Engineer >

---

From: "Hollenbeck, Scott" <[email-masked]>
Date: Mon, 19 May 2003 10:57:42 -0400

Otmar,

To answer your question: yes, the second form is valid.  A bit wordier than
it needs to be, but valid.  It explicitly identifies all of the involved
namespaces using different strings for the namespace identifiers, whereas
the examples I provide attempt to balance explicit identification with
reading ease and understandability by using "epp:" as a default namespace
and strings like "host" to identify the host namespace.

More below.

-Scott-

> -----Original Message-----
> From: Otmar Lendl [mailto:[email-masked]]
> Sent: Monday, May 19, 2003 9:59 AM
> To: [email-masked]
> Subject: [ietf-provreg] XML namespace shortcuts
> 
> 
> 

Not really.  What it does is say that the string "host" is bound to the
given namespace URI within the scope of the enclosing element.  What's
important is the URI, not the string used to identify the namespace.  That
might be what you meant to say, though, so maybe I'm agreeing with you.

> tag must be put into the "urn:ietf:params:xml:ns:host-1.0" namespace.

That's the correct reading, and that's why you don't see "host" written as
"host:" as you describe below.  I see where the confusion comes in, though:
saying "<host:create>" could be read as "you MUST use the string "host" to
identify the host namespace", though XML doesn't really care which string
you use as long as you use it consistently.

> always be "host:". After all, in all the examples that is the case.

Personally I don't see it that way, but I see how it might be read that way.

> 		<host:addr 
> ip="v6">1080:0:0:0:8:800:200C:417A</host:addr>
> 	      </host:create>
> 	    </create>
> 	      <ns3:create 
> ns1:schemaLocation="urn:ietf:params:xml:ns:host-1.0
> 	host-1.0.xsd">

It's perfectly valid XML that satisfies the schemas listed in the drafts.
Maybe I can do something when I have a chance during the author's 48 hour
editorial review before the documents are published as RFCs.

-Scott-