Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » xs:import problem
xs:import problem [message #6998] Fri, 13 December 2002 05:05 Go to next message
Eclipse User
Originally posted by: Michael.Hartmeier.softwareag.com

Hi!

I'm using Eclipse XSD for about 1 month now, and I'm pretty impressed. I
didn't experience a single bug so far (and I fed it about 100+ different
schemas). Great!

Here's my problem: I have a schema with an

<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="xml_lang_space" />

statement and I wrote a URIResolver to resolve the schema location. This
works fine if the namespace is not the xml namespace. However, if the
namespace attribute points to the xml namespace (as shown above), the
import statement is not resolved and all references to elements/attributes
defined in "xml_lang_space" are broken.

Could anybody provide some help? I'm using the 1023 version.

Michael
Re: xs:import problem [message #7046 is a reply to message #6998] Fri, 13 December 2002 16:23 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Michael,

There is code like this in XSDSchemImpl:


Michael Hartmeier wrote:

> Hi!
>
> I'm using Eclipse XSD for about 1 month now, and I'm pretty impressed. I
> didn't experience a single bug so far (and I fed it about 100+ different
> schemas). Great!
>
> Here's my problem: I have a schema with an
>
> <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="xml_lang_space" />
>
> statement and I wrote a URIResolver to resolve the schema location. This
> works fine if the namespace is not the xml namespace. However, if the
> namespace attribute points to the xml namespace (as shown above), the
> import statement is not resolved and all references to elements/attributes
> defined in "xml_lang_space" are broken.
>
> Could anybody provide some help? I'm using the 1023 version.
>
> Michael

--
Ed Merks
Re: xs:import problem [message #7071 is a reply to message #6998] Fri, 13 December 2002 16:38 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------4061972D7A4B84D33A364860
Content-Type: multipart/alternative;
boundary="------------9B157E022886706ADF9E45F1"


--------------9B157E022886706ADF9E45F1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Michael,

Sorry for the earlier miss-send...

There is code like this in XSDSchemImpl:

/**
* This returns set of schemas with the given namespace as it's
target namespace.
*/
public Collection resolveSchema(String namespace)
{
if ("".equals(namespace))
{
namespace = null;
}

if (namespace == null ? getTargetNamespace() == null ||
hasRetargetedNamespace() : namespace.equals(getTargetNamespace()))
{
return Collections.singleton(this);
}
else if (XSDConstants.isSchemaInstanceNamespace(namespace))
{
return Collections.singleton(getSchemaInstance(namespace));
}
else if (XSDConstants.isXMLNamespace(namespace))
{
return
getSchemaForSchema() == this && getSchemaLocation() == null
?
Collections.EMPTY_SET :
Collections.singleton(getSchemaXML(namespace));
}

which makes the XML namespace special; it's needed by the schema for schemas,
which bootstraps the whole model.

There is a locally cached version of this schema in

plugins/org.eclipse.xsd/cache/www.w3.org/XML/1998/namespace. xsd

(and also in the xsd.resources.jar). It recently came to my attention that
the version actually on the web has changed, although that version is still
not XML Schema 1.0 correct. So there is a new cached version that is not yet
in a published driver, which I've attached. In the latest Xerces, it's not
correct to bind the XML namespace URI to any prefix, it's pre-bound to prefix
xml, so the old cached version is invalid.

I've also been able to reproduce the problem that a reference such as
xml:space is unresolved in my schema. So I will track that down and fix the
cause. Thanks for bringing this to my attention. (And for your kind words.)


Michael Hartmeier wrote:

> Hi!
>
> I'm using Eclipse XSD for about 1 month now, and I'm pretty impressed. I
> didn't experience a single bug so far (and I fed it about 100+ different
> schemas). Great!
>
> Here's my problem: I have a schema with an
>
> <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="xml_lang_space" />
>
> statement and I wrote a URIResolver to resolve the schema location. This
> works fine if the namespace is not the xml namespace. However, if the
> namespace attribute points to the xml namespace (as shown above), the
> import statement is not resolved and all references to elements/attributes
> defined in "xml_lang_space" are broken.
>
> Could anybody provide some help? I'm using the 1023 version.
>
> Michael

--
Ed Merks


--------------9B157E022886706ADF9E45F1
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Michael,
<p>Sorry for the earlier miss-send...
<p>There is code like this in XSDSchemImpl:
<blockquote>&nbsp; /**
<br>&nbsp;&nbsp; * This returns set of schemas with the given namespace
as it's target namespace.
<br>&nbsp;&nbsp; */
<br>&nbsp; public Collection resolveSchema(String namespace)
<br>&nbsp; {
<br>&nbsp;&nbsp;&nbsp; if ("".equals(namespace))
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; namespace = null;
<br>&nbsp;&nbsp;&nbsp; }
<p>&nbsp;&nbsp;&nbsp; if (namespace == null ? getTargetNamespace() == null
|| hasRetargetedNamespace() : namespace.equals(getTargetNamespace()))
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Collections.singleton(this);
<br>&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp; else if (XSDConstants.isSchemaInstanceNamespace(namespace))
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Collections.singleton(getSchemaInstance(namespace));
<br>&nbsp;&nbsp;&nbsp; }
<br><b>&nbsp;&nbsp;&nbsp; else if (XSDConstants.isXMLNamespace(namespace))</b>
<br><b>&nbsp;&nbsp;&nbsp; {</b>
<br><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return</b>
<br><b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; getSchemaForSchema()
== this &amp;&amp; getSchemaLocation() == null ?</b>
<br><b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Collections.EMPTY_SET
:</b>
<br><b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Collections.singleton(getSchemaXML(namespace));</b>
<br><b>&nbsp;&nbsp;&nbsp; }</b></blockquote>
which makes the XML namespace special; it's needed by the schema for schemas,
which bootstraps the whole model.
<p>There is a locally cached version of this schema in
<p>&nbsp;&nbsp; plugins/org.eclipse.xsd/cache/www.w3.org/XML/1998/namespace. xsd
<p>(and also in the xsd.resources.jar).&nbsp; It recently came to my attention
that the version actually on the web has changed, although that version
is still not XML Schema 1.0 correct.&nbsp; So there is a new cached version
that is not yet in a published driver, which I've attached.&nbsp; In the
latest Xerces, it's not correct to bind the XML namespace URI to any prefix,
it's pre-bound to prefix xml, so the old cached version is invalid.
<p>I've also been able to reproduce the problem that a reference such as
xml:space is unresolved in my schema.&nbsp; So I will track that down and
fix the cause.&nbsp; Thanks for bringing this to my attention. (And for
your kind words.)
<br>&nbsp;
<p>Michael Hartmeier wrote:
<blockquote TYPE=CITE>Hi!
<p>I'm using Eclipse XSD for about 1 month now, and I'm pretty impressed.
I
<br>didn't experience a single bug so far (and I fed it about 100+ different
<br>schemas). Great!
<p>Here's my problem: I have a schema with an
<p>&nbsp; &lt;xs:import namespace="<a href="http://www.w3.org/XML/1998/namespace">http://www.w3.org/XML/1998/namespace</a>"
<br>schemaLocation="xml_lang_space" />
<p>statement and I wrote a URIResolver to resolve the schema location.
This
<br>works fine if the namespace is not the xml namespace. However, if the
<br>namespace attribute points to the xml namespace (as shown above), the
<br>import statement is not resolved and all references to elements/attributes
<br>defined in "xml_lang_space" are broken.
<p>Could anybody provide some help? I'm using the 1023 version.
<p>Michael</blockquote>
--
<br>Ed Merks
<br>&nbsp;</html>

--------------9B157E022886706ADF9E45F1--

--------------4061972D7A4B84D33A364860
Content-Type: text/plain; charset=us-ascii;
name="namespace.xsd"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="namespace.xsd"

<?xml version='1.0'?>
<schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns="http://www.w3.org/2001/XMLSchema">

<annotation>
<documentation>
See http://www.w3.org/XML/1998/namespace.html and
http://www.w3.org/TR/REC-xml for information about this namespace.
</documentation>
</annotation>

<annotation>
<documentation>This schema defines attributes and an attribute group
suitable for use by
schemas wishing to allow xml:lang, xml:space or xml:base attributes
on elements they define.

To enable this, such a schema must first declare the XML
namespace, and then import this schema
for the XML namespace, e.g. as follows:
&lt;schema . . . xmlns:xml="http://www.w3.org/XML/1998/namespace">
. . .
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2000/10/xml.xsd"/>

Subsequently, qualified reference to any of the attributes
or the group defined below will have the desired effect, e.g.

&lt;type . . .>
. . .
&lt;attributeGroup ref="xml:specialAttrs"/>

will define a type which will schema-validate a instance
element with any of those attributes</documentation>
</annotation>

<attribute name="lang" type="language">
<annotation>
<documentation>In due course, we should install the relevant ISO 2- and 3-letter
codes as the enumerated possible values . . .</documentation>
</annotation>
</attribute>

<attribute name="space" default="preserve">
<simpleType>
<restriction base="NCName">
<enumeration value="default"/>
<enumeration value="preserve"/>
</restriction>
</simpleType>
</attribute>

<attribute name="base" type="anyURI"/>

<attributeGroup name="specialAttrs">
<attribute ref="xml:lang"/>
<attribute ref="xml:space"/>
<attribute ref="xml:base"/>
</attributeGroup>

</schema>

--------------4061972D7A4B84D33A364860--
Re: xs:import problem [message #11598 is a reply to message #7071] Sat, 01 March 2003 04:30 Go to previous messageGo to next message
Eclipse User
Originally posted by: Michael.Hartmeier.softwareag.com

Ed,

if've re-tested this problem with the latest build (1207):

My schema contains an import
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="xml_lang_space" />

and an attribute reference
<xs:attribute ref='xml:space'/>

If I create an XSDSchema object for this, I get the diagnostic

severity: warning, message: XSD: The location
'xml_lang_space' has not been resolved, locationURI: null,
line: 1, column: 1, node: [xs:import: null], annotationURI: null)]

The attribute reference seems to be resolved, because if I remove
the import from the schema, the XSDSchema object looks fine -- no
diagnostics.

But I think the schema should contain the import: this is my understanding
of the XSD Schema spec and Xerces (2.1.) schema validation rejects the
schema without import.

As far as I understand the code, there's a bug in
XSDSchemaImpl.resolveSchema:
If the method is invoked with a "normal" namespace, it resolves all import
statements for this namespace by calling XSDImport.importSchema - fine.
However, when call with the "special" namespace, it doesn't resolve
imports. XSDImport.importSchema would probably fail because you need to
reference to your builr-in schema. But shouldn't you add
XSDSchema.imported() calls for all imports in the schema? This seems to
fix the problem for me: if i call the method below before checking the
diagnostics, everything looks fine.

What's your understanding of the XSD Schema spec, does there have to be an
import?

Do you think my work-around is ok?

Michael


public static void fixImports(XSDSchema initialSchema) {
XSDSchemaImpl xsdnsschema;
List lst;
int i;
XSDSchema schema;
XSDSchema imported;
Iterator iter;
Object obj;
XSDImport import_;

xsdnsschema = (XSDSchemaImpl)
XSDSchemaImpl.getSchemaXML(XSDConstants.XML_NAMESPACE_URI_19 98);
lst = new ArrayList();
lst.add(initialSchema);
for (i = 0; i < lst.size(); i++) { // lst grows!
schema = (XSDSchema) lst.get(i);
for (iter = schema.getContents().iterator(); iter.hasNext(); ) {
obj = (XSDSchemaContent) iter.next();
if (obj instanceof XSDImport) {
import_ = (XSDImport)obj;
imported = import_.getResolvedSchema();
if (imported == null) {
if
(XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace())) {
xsdnsschema.imported(import_);
} else {
// do nothing, this import has failed
}
} else {
if (lst.indexOf(imported) == -1) {
lst.add(imported);
}
}
}
}
}
}
Re: xs:import problem [message #11919 is a reply to message #11598] Mon, 03 March 2003 10:08 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Michael,

You're right that the import is needed. It looks like I can get rid of all
the special support for this schema, including the XMLSchemaImpl.getSchemaXML
method, which you use in your workaround. So your workaround is okay for now
but won't be needed with then next driver. (Again, I'm hopeful to have a 1.0.2
version out early this week.)


Michael Hartmeier wrote:

> Ed,
>
> if've re-tested this problem with the latest build (1207):
>
> My schema contains an import
> <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="xml_lang_space" />
>
> and an attribute reference
> <xs:attribute ref='xml:space'/>
>
> If I create an XSDSchema object for this, I get the diagnostic
>
> severity: warning, message: XSD: The location
> 'xml_lang_space' has not been resolved, locationURI: null,
> line: 1, column: 1, node: [xs:import: null], annotationURI: null)]
>
> The attribute reference seems to be resolved, because if I remove
> the import from the schema, the XSDSchema object looks fine -- no
> diagnostics.
>
> But I think the schema should contain the import: this is my understanding
> of the XSD Schema spec and Xerces (2.1.) schema validation rejects the
> schema without import.
>
> As far as I understand the code, there's a bug in
> XSDSchemaImpl.resolveSchema:
> If the method is invoked with a "normal" namespace, it resolves all import
> statements for this namespace by calling XSDImport.importSchema - fine.
> However, when call with the "special" namespace, it doesn't resolve
> imports. XSDImport.importSchema would probably fail because you need to
> reference to your builr-in schema. But shouldn't you add
> XSDSchema.imported() calls for all imports in the schema? This seems to
> fix the problem for me: if i call the method below before checking the
> diagnostics, everything looks fine.
>
> What's your understanding of the XSD Schema spec, does there have to be an
> import?
>
> Do you think my work-around is ok?
>
> Michael
>
> public static void fixImports(XSDSchema initialSchema) {
> XSDSchemaImpl xsdnsschema;
> List lst;
> int i;
> XSDSchema schema;
> XSDSchema imported;
> Iterator iter;
> Object obj;
> XSDImport import_;
>
> xsdnsschema = (XSDSchemaImpl)
> XSDSchemaImpl.getSchemaXML(XSDConstants.XML_NAMESPACE_URI_19 98);
> lst = new ArrayList();
> lst.add(initialSchema);
> for (i = 0; i < lst.size(); i++) { // lst grows!
> schema = (XSDSchema) lst.get(i);
> for (iter = schema.getContents().iterator(); iter.hasNext(); ) {
> obj = (XSDSchemaContent) iter.next();
> if (obj instanceof XSDImport) {
> import_ = (XSDImport)obj;
> imported = import_.getResolvedSchema();
> if (imported == null) {
> if
> (XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace())) {
> xsdnsschema.imported(import_);
> } else {
> // do nothing, this import has failed
> }
> } else {
> if (lst.indexOf(imported) == -1) {
> lst.add(imported);
> }
> }
> }
> }
> }
> }
Re: xs:import problem [message #13447 is a reply to message #11919] Tue, 04 March 2003 09:07 Go to previous messageGo to next message
Eclipse User
Originally posted by: Michael.Hartmeier.softwareag.com

We just noticed another problem in this area. Eclipse complains about
unresolved imports if a schema contains an import statement which is never
used (i.e. nothing in the child schema is referenced from the parent
schema).

I modified the workaround like this:
if (imported == null) {
if (XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace()))
{
xsdnsschema.imported(import_);
} else {
((XSDImportImpl) import_).importSchema();
}
} else {
if (lst.indexOf(imported) == -1) {
lst.add(imported);
}
}

and it seems to work.


Michael

Ed Merks wrote:

> Michael,

> You're right that the import is needed. It looks like I can get rid of all
> the special support for this schema, including the XMLSchemaImpl.getSchemaXML
> method, which you use in your workaround. So your workaround is okay for now
> but won't be needed with then next driver. (Again, I'm hopeful to have a
1.0.2
> version out early this week.)


> Michael Hartmeier wrote:

> > Ed,
> >
> > if've re-tested this problem with the latest build (1207):
> >
> > My schema contains an import
> > <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> > schemaLocation="xml_lang_space" />
> >
> > and an attribute reference
> > <xs:attribute ref='xml:space'/>
> >
> > If I create an XSDSchema object for this, I get the diagnostic
> >
> > severity: warning, message: XSD: The location
> > 'xml_lang_space' has not been resolved, locationURI: null,
> > line: 1, column: 1, node: [xs:import: null], annotationURI: null)]
> >
> > The attribute reference seems to be resolved, because if I remove
> > the import from the schema, the XSDSchema object looks fine -- no
> > diagnostics.
> >
> > But I think the schema should contain the import: this is my understanding
> > of the XSD Schema spec and Xerces (2.1.) schema validation rejects the
> > schema without import.
> >
> > As far as I understand the code, there's a bug in
> > XSDSchemaImpl.resolveSchema:
> > If the method is invoked with a "normal" namespace, it resolves all import
> > statements for this namespace by calling XSDImport.importSchema - fine.
> > However, when call with the "special" namespace, it doesn't resolve
> > imports. XSDImport.importSchema would probably fail because you need to
> > reference to your builr-in schema. But shouldn't you add
> > XSDSchema.imported() calls for all imports in the schema? This seems to
> > fix the problem for me: if i call the method below before checking the
> > diagnostics, everything looks fine.
> >
> > What's your understanding of the XSD Schema spec, does there have to be an
> > import?
> >
> > Do you think my work-around is ok?
> >
> > Michael
> >
> > public static void fixImports(XSDSchema initialSchema) {
> > XSDSchemaImpl xsdnsschema;
> > List lst;
> > int i;
> > XSDSchema schema;
> > XSDSchema imported;
> > Iterator iter;
> > Object obj;
> > XSDImport import_;
> >
> > xsdnsschema = (XSDSchemaImpl)
> > XSDSchemaImpl.getSchemaXML(XSDConstants.XML_NAMESPACE_URI_19 98);
> > lst = new ArrayList();
> > lst.add(initialSchema);
> > for (i = 0; i < lst.size(); i++) { // lst grows!
> > schema = (XSDSchema) lst.get(i);
> > for (iter = schema.getContents().iterator(); iter.hasNext(); ) {
> > obj = (XSDSchemaContent) iter.next();
> > if (obj instanceof XSDImport) {
> > import_ = (XSDImport)obj;
> > imported = import_.getResolvedSchema();
> > if (imported == null) {
> > if
> > (XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace())) {
> > xsdnsschema.imported(import_);
> > } else {
> > // do nothing, this import has failed
> > }
> > } else {
> > if (lst.indexOf(imported) == -1) {
> > lst.add(imported);
> > }
> > }
> > }
> > }
> > }
> > }
Re: xs:import problem [message #13465 is a reply to message #13447] Tue, 04 March 2003 10:18 Go to previous message
Eclipse User
Originally posted by: merks.ca.ibm.com

Michael,

This is intentional. It's warning you that the import is unused and hence
unnecessary. (Imports are resolved on demand.) This is just like how the Eclipse
2.1 Java compiler warns (by default) about unused imports. Note that the spec
says that failure to resolve an import is not an error; if the import is actually
required, there will be other actual errors for QNames that don't resolve...


Michael Hartmeier wrote:

> We just noticed another problem in this area. Eclipse complains about
> unresolved imports if a schema contains an import statement which is never
> used (i.e. nothing in the child schema is referenced from the parent
> schema).
>
> I modified the workaround like this:
> if (imported == null) {
> if (XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace()))
> {
> xsdnsschema.imported(import_);
> } else {
> ((XSDImportImpl) import_).importSchema();
> }
> } else {
> if (lst.indexOf(imported) == -1) {
> lst.add(imported);
> }
> }
>
> and it seems to work.
>
> Michael
>
> Ed Merks wrote:
>
> > Michael,
>
> > You're right that the import is needed. It looks like I can get rid of all
> > the special support for this schema, including the XMLSchemaImpl.getSchemaXML
> > method, which you use in your workaround. So your workaround is okay for now
> > but won't be needed with then next driver. (Again, I'm hopeful to have a
> 1.0.2
> > version out early this week.)
>
> > Michael Hartmeier wrote:
>
> > > Ed,
> > >
> > > if've re-tested this problem with the latest build (1207):
> > >
> > > My schema contains an import
> > > <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> > > schemaLocation="xml_lang_space" />
> > >
> > > and an attribute reference
> > > <xs:attribute ref='xml:space'/>
> > >
> > > If I create an XSDSchema object for this, I get the diagnostic
> > >
> > > severity: warning, message: XSD: The location
> > > 'xml_lang_space' has not been resolved, locationURI: null,
> > > line: 1, column: 1, node: [xs:import: null], annotationURI: null)]
> > >
> > > The attribute reference seems to be resolved, because if I remove
> > > the import from the schema, the XSDSchema object looks fine -- no
> > > diagnostics.
> > >
> > > But I think the schema should contain the import: this is my understanding
> > > of the XSD Schema spec and Xerces (2.1.) schema validation rejects the
> > > schema without import.
> > >
> > > As far as I understand the code, there's a bug in
> > > XSDSchemaImpl.resolveSchema:
> > > If the method is invoked with a "normal" namespace, it resolves all import
> > > statements for this namespace by calling XSDImport.importSchema - fine.
> > > However, when call with the "special" namespace, it doesn't resolve
> > > imports. XSDImport.importSchema would probably fail because you need to
> > > reference to your builr-in schema. But shouldn't you add
> > > XSDSchema.imported() calls for all imports in the schema? This seems to
> > > fix the problem for me: if i call the method below before checking the
> > > diagnostics, everything looks fine.
> > >
> > > What's your understanding of the XSD Schema spec, does there have to be an
> > > import?
> > >
> > > Do you think my work-around is ok?
> > >
> > > Michael
> > >
> > > public static void fixImports(XSDSchema initialSchema) {
> > > XSDSchemaImpl xsdnsschema;
> > > List lst;
> > > int i;
> > > XSDSchema schema;
> > > XSDSchema imported;
> > > Iterator iter;
> > > Object obj;
> > > XSDImport import_;
> > >
> > > xsdnsschema = (XSDSchemaImpl)
> > > XSDSchemaImpl.getSchemaXML(XSDConstants.XML_NAMESPACE_URI_19 98);
> > > lst = new ArrayList();
> > > lst.add(initialSchema);
> > > for (i = 0; i < lst.size(); i++) { // lst grows!
> > > schema = (XSDSchema) lst.get(i);
> > > for (iter = schema.getContents().iterator(); iter.hasNext(); ) {
> > > obj = (XSDSchemaContent) iter.next();
> > > if (obj instanceof XSDImport) {
> > > import_ = (XSDImport)obj;
> > > imported = import_.getResolvedSchema();
> > > if (imported == null) {
> > > if
> > > (XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace())) {
> > > xsdnsschema.imported(import_);
> > > } else {
> > > // do nothing, this import has failed
> > > }
> > > } else {
> > > if (lst.indexOf(imported) == -1) {
> > > lst.add(imported);
> > > }
> > > }
> > > }
> > > }
> > > }
> > > }
Re: xs:import problem [message #564117 is a reply to message #6998] Fri, 13 December 2002 16:23 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25948
Registered: July 2009
Senior Member
Michael,

There is code like this in XSDSchemImpl:


Michael Hartmeier wrote:

> Hi!
>
> I'm using Eclipse XSD for about 1 month now, and I'm pretty impressed. I
> didn't experience a single bug so far (and I fed it about 100+ different
> schemas). Great!
>
> Here's my problem: I have a schema with an
>
> <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="xml_lang_space" />
>
> statement and I wrote a URIResolver to resolve the schema location. This
> works fine if the namespace is not the xml namespace. However, if the
> namespace attribute points to the xml namespace (as shown above), the
> import statement is not resolved and all references to elements/attributes
> defined in "xml_lang_space" are broken.
>
> Could anybody provide some help? I'm using the 1023 version.
>
> Michael

--
Ed Merks
Re: xs:import problem [message #564141 is a reply to message #6998] Fri, 13 December 2002 16:38 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25948
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------4061972D7A4B84D33A364860
Content-Type: multipart/alternative;
boundary="------------9B157E022886706ADF9E45F1"


--------------9B157E022886706ADF9E45F1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Michael,

Sorry for the earlier miss-send...

There is code like this in XSDSchemImpl:

/**
* This returns set of schemas with the given namespace as it's
target namespace.
*/
public Collection resolveSchema(String namespace)
{
if ("".equals(namespace))
{
namespace = null;
}

if (namespace == null ? getTargetNamespace() == null ||
hasRetargetedNamespace() : namespace.equals(getTargetNamespace()))
{
return Collections.singleton(this);
}
else if (XSDConstants.isSchemaInstanceNamespace(namespace))
{
return Collections.singleton(getSchemaInstance(namespace));
}
else if (XSDConstants.isXMLNamespace(namespace))
{
return
getSchemaForSchema() == this && getSchemaLocation() == null
?
Collections.EMPTY_SET :
Collections.singleton(getSchemaXML(namespace));
}

which makes the XML namespace special; it's needed by the schema for schemas,
which bootstraps the whole model.

There is a locally cached version of this schema in

plugins/org.eclipse.xsd/cache/www.w3.org/XML/1998/namespace. xsd

(and also in the xsd.resources.jar). It recently came to my attention that
the version actually on the web has changed, although that version is still
not XML Schema 1.0 correct. So there is a new cached version that is not yet
in a published driver, which I've attached. In the latest Xerces, it's not
correct to bind the XML namespace URI to any prefix, it's pre-bound to prefix
xml, so the old cached version is invalid.

I've also been able to reproduce the problem that a reference such as
xml:space is unresolved in my schema. So I will track that down and fix the
cause. Thanks for bringing this to my attention. (And for your kind words.)


Michael Hartmeier wrote:

> Hi!
>
> I'm using Eclipse XSD for about 1 month now, and I'm pretty impressed. I
> didn't experience a single bug so far (and I fed it about 100+ different
> schemas). Great!
>
> Here's my problem: I have a schema with an
>
> <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="xml_lang_space" />
>
> statement and I wrote a URIResolver to resolve the schema location. This
> works fine if the namespace is not the xml namespace. However, if the
> namespace attribute points to the xml namespace (as shown above), the
> import statement is not resolved and all references to elements/attributes
> defined in "xml_lang_space" are broken.
>
> Could anybody provide some help? I'm using the 1023 version.
>
> Michael

--
Ed Merks


--------------9B157E022886706ADF9E45F1
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Michael,
<p>Sorry for the earlier miss-send...
<p>There is code like this in XSDSchemImpl:
<blockquote>&nbsp; /**
<br>&nbsp;&nbsp; * This returns set of schemas with the given namespace
as it's target namespace.
<br>&nbsp;&nbsp; */
<br>&nbsp; public Collection resolveSchema(String namespace)
<br>&nbsp; {
<br>&nbsp;&nbsp;&nbsp; if ("".equals(namespace))
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; namespace = null;
<br>&nbsp;&nbsp;&nbsp; }
<p>&nbsp;&nbsp;&nbsp; if (namespace == null ? getTargetNamespace() == null
|| hasRetargetedNamespace() : namespace.equals(getTargetNamespace()))
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Collections.singleton(this);
<br>&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp; else if (XSDConstants.isSchemaInstanceNamespace(namespace))
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Collections.singleton(getSchemaInstance(namespace));
<br>&nbsp;&nbsp;&nbsp; }
<br><b>&nbsp;&nbsp;&nbsp; else if (XSDConstants.isXMLNamespace(namespace))</b>
<br><b>&nbsp;&nbsp;&nbsp; {</b>
<br><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return</b>
<br><b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; getSchemaForSchema()
== this &amp;&amp; getSchemaLocation() == null ?</b>
<br><b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Collections.EMPTY_SET
:</b>
<br><b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Collections.singleton(getSchemaXML(namespace));</b>
<br><b>&nbsp;&nbsp;&nbsp; }</b></blockquote>
which makes the XML namespace special; it's needed by the schema for schemas,
which bootstraps the whole model.
<p>There is a locally cached version of this schema in
<p>&nbsp;&nbsp; plugins/org.eclipse.xsd/cache/www.w3.org/XML/1998/namespace. xsd
<p>(and also in the xsd.resources.jar).&nbsp; It recently came to my attention
that the version actually on the web has changed, although that version
is still not XML Schema 1.0 correct.&nbsp; So there is a new cached version
that is not yet in a published driver, which I've attached.&nbsp; In the
latest Xerces, it's not correct to bind the XML namespace URI to any prefix,
it's pre-bound to prefix xml, so the old cached version is invalid.
<p>I've also been able to reproduce the problem that a reference such as
xml:space is unresolved in my schema.&nbsp; So I will track that down and
fix the cause.&nbsp; Thanks for bringing this to my attention. (And for
your kind words.)
<br>&nbsp;
<p>Michael Hartmeier wrote:
<blockquote TYPE=CITE>Hi!
<p>I'm using Eclipse XSD for about 1 month now, and I'm pretty impressed.
I
<br>didn't experience a single bug so far (and I fed it about 100+ different
<br>schemas). Great!
<p>Here's my problem: I have a schema with an
<p>&nbsp; &lt;xs:import namespace="<a href="http://www.w3.org/XML/1998/namespace">http://www.w3.org/XML/1998/namespace</a>"
<br>schemaLocation="xml_lang_space" />
<p>statement and I wrote a URIResolver to resolve the schema location.
This
<br>works fine if the namespace is not the xml namespace. However, if the
<br>namespace attribute points to the xml namespace (as shown above), the
<br>import statement is not resolved and all references to elements/attributes
<br>defined in "xml_lang_space" are broken.
<p>Could anybody provide some help? I'm using the 1023 version.
<p>Michael</blockquote>
--
<br>Ed Merks
<br>&nbsp;</html>

--------------9B157E022886706ADF9E45F1--

--------------4061972D7A4B84D33A364860
Content-Type: text/plain; charset=us-ascii;
name="namespace.xsd"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="namespace.xsd"

<?xml version='1.0'?>
<schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns="http://www.w3.org/2001/XMLSchema">

<annotation>
<documentation>
See http://www.w3.org/XML/1998/namespace.html and
http://www.w3.org/TR/REC-xml for information about this namespace.
</documentation>
</annotation>

<annotation>
<documentation>This schema defines attributes and an attribute group
suitable for use by
schemas wishing to allow xml:lang, xml:space or xml:base attributes
on elements they define.

To enable this, such a schema must first declare the XML
namespace, and then import this schema
for the XML namespace, e.g. as follows:
&lt;schema . . . xmlns:xml="http://www.w3.org/XML/1998/namespace">
. . .
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2000/10/xml.xsd"/>

Subsequently, qualified reference to any of the attributes
or the group defined below will have the desired effect, e.g.

&lt;type . . .>
. . .
&lt;attributeGroup ref="xml:specialAttrs"/>

will define a type which will schema-validate a instance
element with any of those attributes</documentation>
</annotation>

<attribute name="lang" type="language">
<annotation>
<documentation>In due course, we should install the relevant ISO 2- and 3-letter
codes as the enumerated possible values . . .</documentation>
</annotation>
</attribute>

<attribute name="space" default="preserve">
<simpleType>
<restriction base="NCName">
<enumeration value="default"/>
<enumeration value="preserve"/>
</restriction>
</simpleType>
</attribute>

<attribute name="base" type="anyURI"/>

<attributeGroup name="specialAttrs">
<attribute ref="xml:lang"/>
<attribute ref="xml:space"/>
<attribute ref="xml:base"/>
</attributeGroup>

</schema>

--------------4061972D7A4B84D33A364860--
Re: xs:import problem [message #565394 is a reply to message #7071] Sat, 01 March 2003 04:30 Go to previous message
Michael Hartmeier is currently offline Michael Hartmeier
Messages: 21
Registered: July 2009
Junior Member
Ed,

if've re-tested this problem with the latest build (1207):

My schema contains an import
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="xml_lang_space" />

and an attribute reference
<xs:attribute ref='xml:space'/>

If I create an XSDSchema object for this, I get the diagnostic

severity: warning, message: XSD: The location
'xml_lang_space' has not been resolved, locationURI: null,
line: 1, column: 1, node: [xs:import: null], annotationURI: null)]

The attribute reference seems to be resolved, because if I remove
the import from the schema, the XSDSchema object looks fine -- no
diagnostics.

But I think the schema should contain the import: this is my understanding
of the XSD Schema spec and Xerces (2.1.) schema validation rejects the
schema without import.

As far as I understand the code, there's a bug in
XSDSchemaImpl.resolveSchema:
If the method is invoked with a "normal" namespace, it resolves all import
statements for this namespace by calling XSDImport.importSchema - fine.
However, when call with the "special" namespace, it doesn't resolve
imports. XSDImport.importSchema would probably fail because you need to
reference to your builr-in schema. But shouldn't you add
XSDSchema.imported() calls for all imports in the schema? This seems to
fix the problem for me: if i call the method below before checking the
diagnostics, everything looks fine.

What's your understanding of the XSD Schema spec, does there have to be an
import?

Do you think my work-around is ok?

Michael


public static void fixImports(XSDSchema initialSchema) {
XSDSchemaImpl xsdnsschema;
List lst;
int i;
XSDSchema schema;
XSDSchema imported;
Iterator iter;
Object obj;
XSDImport import_;

xsdnsschema = (XSDSchemaImpl)
XSDSchemaImpl.getSchemaXML(XSDConstants.XML_NAMESPACE_URI_19 98);
lst = new ArrayList();
lst.add(initialSchema);
for (i = 0; i < lst.size(); i++) { // lst grows!
schema = (XSDSchema) lst.get(i);
for (iter = schema.getContents().iterator(); iter.hasNext(); ) {
obj = (XSDSchemaContent) iter.next();
if (obj instanceof XSDImport) {
import_ = (XSDImport)obj;
imported = import_.getResolvedSchema();
if (imported == null) {
if
(XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace())) {
xsdnsschema.imported(import_);
} else {
// do nothing, this import has failed
}
} else {
if (lst.indexOf(imported) == -1) {
lst.add(imported);
}
}
}
}
}
}
Re: xs:import problem [message #565669 is a reply to message #11598] Mon, 03 March 2003 10:08 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25948
Registered: July 2009
Senior Member
Michael,

You're right that the import is needed. It looks like I can get rid of all
the special support for this schema, including the XMLSchemaImpl.getSchemaXML
method, which you use in your workaround. So your workaround is okay for now
but won't be needed with then next driver. (Again, I'm hopeful to have a 1.0.2
version out early this week.)


Michael Hartmeier wrote:

> Ed,
>
> if've re-tested this problem with the latest build (1207):
>
> My schema contains an import
> <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="xml_lang_space" />
>
> and an attribute reference
> <xs:attribute ref='xml:space'/>
>
> If I create an XSDSchema object for this, I get the diagnostic
>
> severity: warning, message: XSD: The location
> 'xml_lang_space' has not been resolved, locationURI: null,
> line: 1, column: 1, node: [xs:import: null], annotationURI: null)]
>
> The attribute reference seems to be resolved, because if I remove
> the import from the schema, the XSDSchema object looks fine -- no
> diagnostics.
>
> But I think the schema should contain the import: this is my understanding
> of the XSD Schema spec and Xerces (2.1.) schema validation rejects the
> schema without import.
>
> As far as I understand the code, there's a bug in
> XSDSchemaImpl.resolveSchema:
> If the method is invoked with a "normal" namespace, it resolves all import
> statements for this namespace by calling XSDImport.importSchema - fine.
> However, when call with the "special" namespace, it doesn't resolve
> imports. XSDImport.importSchema would probably fail because you need to
> reference to your builr-in schema. But shouldn't you add
> XSDSchema.imported() calls for all imports in the schema? This seems to
> fix the problem for me: if i call the method below before checking the
> diagnostics, everything looks fine.
>
> What's your understanding of the XSD Schema spec, does there have to be an
> import?
>
> Do you think my work-around is ok?
>
> Michael
>
> public static void fixImports(XSDSchema initialSchema) {
> XSDSchemaImpl xsdnsschema;
> List lst;
> int i;
> XSDSchema schema;
> XSDSchema imported;
> Iterator iter;
> Object obj;
> XSDImport import_;
>
> xsdnsschema = (XSDSchemaImpl)
> XSDSchemaImpl.getSchemaXML(XSDConstants.XML_NAMESPACE_URI_19 98);
> lst = new ArrayList();
> lst.add(initialSchema);
> for (i = 0; i < lst.size(); i++) { // lst grows!
> schema = (XSDSchema) lst.get(i);
> for (iter = schema.getContents().iterator(); iter.hasNext(); ) {
> obj = (XSDSchemaContent) iter.next();
> if (obj instanceof XSDImport) {
> import_ = (XSDImport)obj;
> imported = import_.getResolvedSchema();
> if (imported == null) {
> if
> (XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace())) {
> xsdnsschema.imported(import_);
> } else {
> // do nothing, this import has failed
> }
> } else {
> if (lst.indexOf(imported) == -1) {
> lst.add(imported);
> }
> }
> }
> }
> }
> }
Re: xs:import problem [message #565712 is a reply to message #11919] Tue, 04 March 2003 09:07 Go to previous message
Michael Hartmeier is currently offline Michael Hartmeier
Messages: 21
Registered: July 2009
Junior Member
We just noticed another problem in this area. Eclipse complains about
unresolved imports if a schema contains an import statement which is never
used (i.e. nothing in the child schema is referenced from the parent
schema).

I modified the workaround like this:
if (imported == null) {
if (XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace()))
{
xsdnsschema.imported(import_);
} else {
((XSDImportImpl) import_).importSchema();
}
} else {
if (lst.indexOf(imported) == -1) {
lst.add(imported);
}
}

and it seems to work.


Michael

Ed Merks wrote:

> Michael,

> You're right that the import is needed. It looks like I can get rid of all
> the special support for this schema, including the XMLSchemaImpl.getSchemaXML
> method, which you use in your workaround. So your workaround is okay for now
> but won't be needed with then next driver. (Again, I'm hopeful to have a
1.0.2
> version out early this week.)


> Michael Hartmeier wrote:

> > Ed,
> >
> > if've re-tested this problem with the latest build (1207):
> >
> > My schema contains an import
> > <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> > schemaLocation="xml_lang_space" />
> >
> > and an attribute reference
> > <xs:attribute ref='xml:space'/>
> >
> > If I create an XSDSchema object for this, I get the diagnostic
> >
> > severity: warning, message: XSD: The location
> > 'xml_lang_space' has not been resolved, locationURI: null,
> > line: 1, column: 1, node: [xs:import: null], annotationURI: null)]
> >
> > The attribute reference seems to be resolved, because if I remove
> > the import from the schema, the XSDSchema object looks fine -- no
> > diagnostics.
> >
> > But I think the schema should contain the import: this is my understanding
> > of the XSD Schema spec and Xerces (2.1.) schema validation rejects the
> > schema without import.
> >
> > As far as I understand the code, there's a bug in
> > XSDSchemaImpl.resolveSchema:
> > If the method is invoked with a "normal" namespace, it resolves all import
> > statements for this namespace by calling XSDImport.importSchema - fine.
> > However, when call with the "special" namespace, it doesn't resolve
> > imports. XSDImport.importSchema would probably fail because you need to
> > reference to your builr-in schema. But shouldn't you add
> > XSDSchema.imported() calls for all imports in the schema? This seems to
> > fix the problem for me: if i call the method below before checking the
> > diagnostics, everything looks fine.
> >
> > What's your understanding of the XSD Schema spec, does there have to be an
> > import?
> >
> > Do you think my work-around is ok?
> >
> > Michael
> >
> > public static void fixImports(XSDSchema initialSchema) {
> > XSDSchemaImpl xsdnsschema;
> > List lst;
> > int i;
> > XSDSchema schema;
> > XSDSchema imported;
> > Iterator iter;
> > Object obj;
> > XSDImport import_;
> >
> > xsdnsschema = (XSDSchemaImpl)
> > XSDSchemaImpl.getSchemaXML(XSDConstants.XML_NAMESPACE_URI_19 98);
> > lst = new ArrayList();
> > lst.add(initialSchema);
> > for (i = 0; i < lst.size(); i++) { // lst grows!
> > schema = (XSDSchema) lst.get(i);
> > for (iter = schema.getContents().iterator(); iter.hasNext(); ) {
> > obj = (XSDSchemaContent) iter.next();
> > if (obj instanceof XSDImport) {
> > import_ = (XSDImport)obj;
> > imported = import_.getResolvedSchema();
> > if (imported == null) {
> > if
> > (XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace())) {
> > xsdnsschema.imported(import_);
> > } else {
> > // do nothing, this import has failed
> > }
> > } else {
> > if (lst.indexOf(imported) == -1) {
> > lst.add(imported);
> > }
> > }
> > }
> > }
> > }
> > }
Re: xs:import problem [message #565770 is a reply to message #13447] Tue, 04 March 2003 10:18 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25948
Registered: July 2009
Senior Member
Michael,

This is intentional. It's warning you that the import is unused and hence
unnecessary. (Imports are resolved on demand.) This is just like how the Eclipse
2.1 Java compiler warns (by default) about unused imports. Note that the spec
says that failure to resolve an import is not an error; if the import is actually
required, there will be other actual errors for QNames that don't resolve...


Michael Hartmeier wrote:

> We just noticed another problem in this area. Eclipse complains about
> unresolved imports if a schema contains an import statement which is never
> used (i.e. nothing in the child schema is referenced from the parent
> schema).
>
> I modified the workaround like this:
> if (imported == null) {
> if (XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace()))
> {
> xsdnsschema.imported(import_);
> } else {
> ((XSDImportImpl) import_).importSchema();
> }
> } else {
> if (lst.indexOf(imported) == -1) {
> lst.add(imported);
> }
> }
>
> and it seems to work.
>
> Michael
>
> Ed Merks wrote:
>
> > Michael,
>
> > You're right that the import is needed. It looks like I can get rid of all
> > the special support for this schema, including the XMLSchemaImpl.getSchemaXML
> > method, which you use in your workaround. So your workaround is okay for now
> > but won't be needed with then next driver. (Again, I'm hopeful to have a
> 1.0.2
> > version out early this week.)
>
> > Michael Hartmeier wrote:
>
> > > Ed,
> > >
> > > if've re-tested this problem with the latest build (1207):
> > >
> > > My schema contains an import
> > > <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> > > schemaLocation="xml_lang_space" />
> > >
> > > and an attribute reference
> > > <xs:attribute ref='xml:space'/>
> > >
> > > If I create an XSDSchema object for this, I get the diagnostic
> > >
> > > severity: warning, message: XSD: The location
> > > 'xml_lang_space' has not been resolved, locationURI: null,
> > > line: 1, column: 1, node: [xs:import: null], annotationURI: null)]
> > >
> > > The attribute reference seems to be resolved, because if I remove
> > > the import from the schema, the XSDSchema object looks fine -- no
> > > diagnostics.
> > >
> > > But I think the schema should contain the import: this is my understanding
> > > of the XSD Schema spec and Xerces (2.1.) schema validation rejects the
> > > schema without import.
> > >
> > > As far as I understand the code, there's a bug in
> > > XSDSchemaImpl.resolveSchema:
> > > If the method is invoked with a "normal" namespace, it resolves all import
> > > statements for this namespace by calling XSDImport.importSchema - fine.
> > > However, when call with the "special" namespace, it doesn't resolve
> > > imports. XSDImport.importSchema would probably fail because you need to
> > > reference to your builr-in schema. But shouldn't you add
> > > XSDSchema.imported() calls for all imports in the schema? This seems to
> > > fix the problem for me: if i call the method below before checking the
> > > diagnostics, everything looks fine.
> > >
> > > What's your understanding of the XSD Schema spec, does there have to be an
> > > import?
> > >
> > > Do you think my work-around is ok?
> > >
> > > Michael
> > >
> > > public static void fixImports(XSDSchema initialSchema) {
> > > XSDSchemaImpl xsdnsschema;
> > > List lst;
> > > int i;
> > > XSDSchema schema;
> > > XSDSchema imported;
> > > Iterator iter;
> > > Object obj;
> > > XSDImport import_;
> > >
> > > xsdnsschema = (XSDSchemaImpl)
> > > XSDSchemaImpl.getSchemaXML(XSDConstants.XML_NAMESPACE_URI_19 98);
> > > lst = new ArrayList();
> > > lst.add(initialSchema);
> > > for (i = 0; i < lst.size(); i++) { // lst grows!
> > > schema = (XSDSchema) lst.get(i);
> > > for (iter = schema.getContents().iterator(); iter.hasNext(); ) {
> > > obj = (XSDSchemaContent) iter.next();
> > > if (obj instanceof XSDImport) {
> > > import_ = (XSDImport)obj;
> > > imported = import_.getResolvedSchema();
> > > if (imported == null) {
> > > if
> > > (XSDConstants.XML_NAMESPACE_URI_1998.equals(import_.getNames pace())) {
> > > xsdnsschema.imported(import_);
> > > } else {
> > > // do nothing, this import has failed
> > > }
> > > } else {
> > > if (lst.indexOf(imported) == -1) {
> > > lst.add(imported);
> > > }
> > > }
> > > }
> > > }
> > > }
> > > }
Previous Topic:XSDWildcard.getNamespaceConstraint
Next Topic:"xmlns" in the <schema> element
Goto Forum:
  


Current Time: Fri Aug 01 04:07:33 EDT 2014

Powered by FUDForum. Page generated in 0.02354 seconds