|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
redefine and target namespace Hi,
I have a schema document that redefines a complex type as following: <xs:redefine schemaLocation="redefine.xsd"> <xs:complexType name="root"> <xs:complexContent> <xs:extension base="tns:root"> <xs:sequence> <xs:element name="b" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:redefine> I thought the element 'b' was defined in the target namespace, but it seems it has to be in no namespace. Is it really the intent of the spec? Did I do anything wrong? I use Xerces 2 for Java (as in Java SE 6.) redefine.xsd: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="tns" targetNamespace="tns" elementFormDefault="qualified"> <xs:element name="root" type="tns:root"/> <xs:complexType name="root"> <xs:sequence> <xs:element name="a" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> redefine-red.xsd: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="tns" xmlns:tns="tns"> <xs:redefine schemaLocation="redefine.xsd"> <xs:complexType name="root"> <xs:complexContent> <xs:extension base="tns:root"> <xs:sequence> <xs:element name="b" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:redefine> <xs:element name="redefined" type="tns:root"/> </xs:schema> Valid redefine.xml: <tns:redefined xmlns:tns="tns"> <tns:a>bla</tns:a> <b>bla</b> </tns:redefined> Expected valid redefine.xml (but actually invalid): <redefined xmlns="tns"> <a>bla</a> <b>bla</b> </redefined> Regards, -- Florent Georges http://www.fgeorges.org/ |
|
|
RE: redefine and target namespace> I thought the element 'b' was defined in the target namespace, but it seems it has to be in no namespace. Just as if you didn't use redefine, your local element declaration will only be in the target namespace if you specify elementFormDefault="qualified" on your xs:schema element. (Or, of course, form="qualified" on the local element declaration itself, but no-one ever does that.) > Is it really the intent of the spec? Yes. I've never heard an adequate explanation of why this extraordinary decision was made, but in practice everyone changes the default by using elementFormDefault="qualified". Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay |
|
|
Re: redefine and target namespaceMichael Kay wrote:
Hi, > > I thought the element 'b' was defined in the target > > namespace, but it seems it has to be in no namespace. > Just as if you didn't use redefine, your local element > declaration will only be in the target namespace if you specify > elementFormDefault="qualified" <blush>Ouch!</blush> It's been a long time since I've been fooled by this one. I guess I was focused on the redefine... Sorry for the noise and thanks for the quick answer! Regards, -- Florent Georges http://www.fgeorges.org/ |
|
|
Re: redefine and target namespace-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Michael Kay writes: > Yes. I've never heard an adequate explanation of why this extraordinary > decision was made, but in practice everyone changes the default by using > elementFormDefault="qualified". At the time the spec. was written, the community was pretty evenly divided between people who thought the attribute model (i.e. not in a namespace as such) was right for leaf node elements as well, and those who thought that all elements should be qualified. Without going into tedious and confidential details about personalities and working group discussions, suffice it to say that the design we have was the only one that included both possibilities which the WG could reach consensus on. ht - -- Henry S. Thompson, School of Informatics, University of Edinburgh Half-time member of W3C Team 10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 651-1426, e-mail: ht@... URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged spam] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQFK5Y5ekjnJixAXWBoRAh2UAJ4gBVgrOq4C+DK22kFTJNRvnLkSFwCfZnsJ jgNXeNgag92u+CLvC5gXK9o= =yYHE -----END PGP SIGNATURE----- |
|
|
Re: redefine and target namespaceHenry S. Thompson wrote:
Hi, > Without going into tedious and confidential details about > personalities and working group discussions, suffice it to say > that the design we have was the only one that included both > possibilities which the WG could reach consensus on. Yes, but that does not answer the interesting question: why the chosen default value ;-) Regards, -- Florent Georges http://www.fgeorges.org/ |
|
|
Re: redefine and target namespace-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Florent Georges writes: > Henry S. Thompson wrote: > >> Without going into tedious and confidential details about >> personalities and working group discussions, suffice it to say >> that the design we have was the only one that included both >> possibilities which the WG could reach consensus on. > > Yes, but that does not answer the interesting question: why the > chosen default value ;-) That was part of the compromise. ht - -- Henry S. Thompson, School of Informatics, University of Edinburgh Half-time member of W3C Team 10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 651-1426, e-mail: ht@... URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged spam] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQFK5beVkjnJixAXWBoRAoT5AJ4yFDcwJ5ffeptvNEzg6ORziuap5gCdFrbr df9/0oDB1kNHtEXZPaHqEks= =ciuI -----END PGP SIGNATURE----- |
|
|
Re: redefine and target namespaceHenry Thompson writes:
> That was part of the compromise. Stated differently: you can infer that there were a significant number of people involved who strongly took the opposite position from yours, and the default you see was in deference to their views of what the community needed. As already noted, it was a long and difficult discussion, with strongly held opinions on both sides. I don't think anyone thought the resulting design was particularly appealing, but given the strongly divergent opinions about what users needed and/or about how namespaces were supposed to be used, the design had the advantage of letting users choose. FWIW: I tend to sympathize with George's feeling that most users do want the qualified idiom, that qualified would have been a better default, etc. Still, it's way too late to reopen it now, and there are schemas out in the wild that use both options as far as I know. Noah -------------------------------------- Noah Mendelsohn IBM Corporation One Rogers Street Cambridge, MA 02142 1-617-693-4036 -------------------------------------- ht@... (Henry S. Thompson) Sent by: xmlschema-dev-request@... 10/26/2009 10:52 AM To: lists@... cc: Michael Kay <mike@...>, xmlschema-dev@..., (bcc: Noah Mendelsohn/Cambridge/IBM) Subject: Re: redefine and target namespace -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Florent Georges writes: > Henry S. Thompson wrote: > >> Without going into tedious and confidential details about >> personalities and working group discussions, suffice it to say >> that the design we have was the only one that included both >> possibilities which the WG could reach consensus on. > > Yes, but that does not answer the interesting question: why the > chosen default value ;-) That was part of the compromise. ht - -- Henry S. Thompson, School of Informatics, University of Edinburgh Half-time member of W3C Team 10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 651-1426, e-mail: ht@... URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged spam] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQFK5beVkjnJixAXWBoRAoT5AJ4yFDcwJ5ffeptvNEzg6ORziuap5gCdFrbr df9/0oDB1kNHtEXZPaHqEks= =ciuI -----END PGP SIGNATURE----- |
| Free embeddable forum powered by Nabble | Forum Help |