OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] 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:


There is an extension element in the plugin.xml file, and it is in no

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?


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 -->
    <element name="extension">
           <choice minOccurs="1" maxOccurs="unbounded">
              <element ref="library" />
           <attribute name="point" type="string" use="required" />
           <attribute name="id" type="string" />
           <attribute name="name" type="string">
                    <meta.attribute translatable="true" />

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
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"?>
id="com.google.cloud.tools.eclipse.appengine.libraries" name="App
Engine Libraries"

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]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS