[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: targetNamespace and default namespace
I have always understood that the elementFormDefault only applies to the way that the element names are written *in the schema*; if there is a target namespace specified, then all elements defined in the schema (and not otherwise namespaced or referenced) must be in that namespace in an instance document, unrelated to the value of elementFormDefault. So I agree with you that an instance document with no namespace declaration cannot possibly validate against this schema. On 9/29/2016 10:23 AM, Elliotte Rusty Harold wrote: Sure? No. It is the baroque mess that is W3C XML schema so I'm sure of nothing. :-) That said, though I didn't include the complete instance document or schema, which you can find here: https://github.com/GoogleCloudPlatform/google-cloud-eclipse/pull/748/files There is an extension element in the plugin.xml file, and it is in no namespace. This seems to be how Eclipse plugin schemas are normally set up, not just an issue with this one pair of files. I think this is wrong, and an abuse of schemas; but I'm not 100% certain of that which is why I'm asking. Should elements declared in a schema be in the targetNamespace in instance documents given that: 1. There is no explicit elementFormDefault in the the schema 2. The element is declared by a top-level xsd:element element in the schema. I think the answer is yes, but I want to sanity check myself before I start filing bugs against Eclipse. On Thu, Sep 29, 2016 at 8:47 AM, Thomas Passin <list1@tompassin.net> wrote:The schema is for element "extension" but your instance contains an element "plugin/extension-point". Are you sure the schema really applies? TomP On 9/29/2016 7:49 AM, Elliotte Rusty Harold wrote:In Eclipse plug-ins we encounter W3C XML Schemas like the following: <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="com.google.cloud.tools.eclipse.appengine.libraries" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="extension"> <complexType> <choice minOccurs="1" maxOccurs="unbounded"> <element ref="library" /> </choice> <attribute name="point" type="string" use="required" /> <attribute name="id" type="string" /> <attribute name="name" type="string"> <annotation> <appinfo> <meta.attribute translatable="true" /> </appinfo> </annotation> </attribute> </complexType> </element> ... Note in particular: 1. elementFormDefault is not specified. Therefore it takes the default value of unqualified. 2. extension is defined by a top-level element. Therefore the targetNamespace applies and extension is defined only in the namespace com.google.cloud.tools.eclipse.appengine.libraries 3. The library element is a child of extension and therefore the targetNamespace does not apply. Note the use of a Java package name as a target namespace. That's not recommended, but what's more shocking are the instance documents this describes. They look like this: <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> <extension-point id="com.google.cloud.tools.eclipse.appengine.libraries" name="App Engine Libraries" schema="schema/com.google.cloud.tools.eclipse.appengine.libraries.exsd"/> Note the complete lack of namespace declarations. In itself this is not a problem. Documents don't have to use namespaces. However, if I'm reading the schema spec correctly, this means that this document is invalid according to the schema. Am I correct? The schema spec is quite opaque on these matters. In more generic terms if a schema declares a target namespace, and elementFormDefault="unqualified", then top-level elements defined in the schema should be in the targetNamespace. Am I readin this right? FWIW, I'm primarily concerned with elements here. The extra complexities of attributes aren't immediately relevant.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|