Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » How to resolve a schema doc. location when importing?
How to resolve a schema doc. location when importing? [message #22280] Thu, 15 May 2003 09:45 Go to next message
Eclipse UserFriend
Originally posted by: dirk.schesmer.divos.de

Hi there,
can please someone explain to me why the code below gets validated producing
the warning "The location of 'file:///c:/X4CSchemaModeler/xsd/sd1.xsd' has
not been resolved"
PrimaryXComponent: org.eclipse.xsd.impl.XSDImportImpl@fcfa52 (element: null)
(schemaLocation: file:///c:/X4CSchemaModeler/xsd/sd1.xsd) (namespace:
http://www.ns1.de/) Severity: warning ?

The file sd1.xsd exists there and has the content:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.ns1.de/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.ns1.de/">
<xs:simpleType name="simpleType1">
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:schema>

XMLSpy validates it successfully!

Thanks for help,

Dirk V. Schesmer

public XSDSchema initializeSD2Schema() {
XSDSchema xsdSchema = XSDFactory.eINSTANCE.createXSDSchema();
xsdSchema.setSchemaForSchemaQNamePrefix("xsd");
xsdSchema.setTargetNamespace(http://ns2.de/sd2.xsd);
String tns1 = http://www.ns1.de/;
Map qNamePrefixToNamespaceMap = xsdSchema.getQNamePrefixToNamespaceMap();
qNamePrefixToNamespaceMap.put(xsdSchema.getSchemaForSchemaQN amePrefix(),XSDC
onstants.SCHEMA_FOR_SCHEMA_URI_2001);
qNamePrefixToNamespaceMap.put("ns1", tns1);
XSDImport someImport =
XSDSchemaBuildingTools.getXSDFactory().createXSDImport();
someImport.setNamespace(tns1);
someImport.setSchemaLocation(file:///c:/X4CSchemaModeler/xsd/sd1.xsd);
xsdSchema.getContents().add(someImport);
XSDFactory xsdFactory = XSDSchemaBuildingTools.getXSDFactory();
XSDComplexTypeDefinition complexType2
=xsdFactory.createXSDComplexTypeDefinition();
complexType2.setName("complexType2");
XSDModelGroup complexType2Sequence = xsdFactory.createXSDModelGroup();
complexType2Sequence.setCompositor(XSDCompositor.SEQUENCE_LI TERAL);
XSDParticle complexType2Particle = xsdFactory.createXSDParticle();
complexType2Particle.setContent(complexType2Sequence);
XSDElementDeclaration sType1 = xsdFactory.createXSDElementDeclaration();
sType1.setName("simpleType1");
XSDParticle sType1Particle = xsdFactory.createXSDParticle();
sType1Particle.setContent(sType1);
complexType2Sequence.getContents().add(sType1Particle);
complexType2.setContent(complexType2Particle);
xsdSchema.getContents().add(complexType2);
}
Re: How to resolve a schema doc. location when importing? [message #22339 is a reply to message #22280] Thu, 15 May 2003 15:39 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Dirk,

Imports are resolved on demand. Since there aren't references to things in that
namespace, the import doesn't get resolved and a warning is produced to indicate
that. Okay?


"Dirk V. Schesmer" wrote:

> Hi there,
> can please someone explain to me why the code below gets validated producing
> the warning "The location of 'file:///c:/X4CSchemaModeler/xsd/sd1.xsd' has
> not been resolved"
> PrimaryXComponent: org.eclipse.xsd.impl.XSDImportImpl@fcfa52 (element: null)
> (schemaLocation: file:///c:/X4CSchemaModeler/xsd/sd1.xsd) (namespace:
> http://www.ns1.de/) Severity: warning ?
>
> The file sd1.xsd exists there and has the content:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="http://www.ns1.de/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.ns1.de/">
> <xs:simpleType name="simpleType1">
> <xs:restriction base="xs:string"/>
> </xs:simpleType>
> </xs:schema>
>
> XMLSpy validates it successfully!
>
> Thanks for help,
>
> Dirk V. Schesmer
>
> public XSDSchema initializeSD2Schema() {
> XSDSchema xsdSchema = XSDFactory.eINSTANCE.createXSDSchema();
> xsdSchema.setSchemaForSchemaQNamePrefix("xsd");
> xsdSchema.setTargetNamespace(http://ns2.de/sd2.xsd);
> String tns1 = http://www.ns1.de/;
> Map qNamePrefixToNamespaceMap = xsdSchema.getQNamePrefixToNamespaceMap();
> qNamePrefixToNamespaceMap.put(xsdSchema.getSchemaForSchemaQN amePrefix(),XSDC
> onstants.SCHEMA_FOR_SCHEMA_URI_2001);
> qNamePrefixToNamespaceMap.put("ns1", tns1);
> XSDImport someImport =
> XSDSchemaBuildingTools.getXSDFactory().createXSDImport();
> someImport.setNamespace(tns1);
> someImport.setSchemaLocation(file:///c:/X4CSchemaModeler/xsd/sd1.xsd);
> xsdSchema.getContents().add(someImport);
> XSDFactory xsdFactory = XSDSchemaBuildingTools.getXSDFactory();
> XSDComplexTypeDefinition complexType2
> =xsdFactory.createXSDComplexTypeDefinition();
> complexType2.setName("complexType2");
> XSDModelGroup complexType2Sequence = xsdFactory.createXSDModelGroup();
> complexType2Sequence.setCompositor(XSDCompositor.SEQUENCE_LI TERAL);
> XSDParticle complexType2Particle = xsdFactory.createXSDParticle();
> complexType2Particle.setContent(complexType2Sequence);
> XSDElementDeclaration sType1 = xsdFactory.createXSDElementDeclaration();
> sType1.setName("simpleType1");
> XSDParticle sType1Particle = xsdFactory.createXSDParticle();
> sType1Particle.setContent(sType1);
> complexType2Sequence.getContents().add(sType1Particle);
> complexType2.setContent(complexType2Particle);
> xsdSchema.getContents().add(complexType2);
> }
Re: How to resolve a schema doc. location when importing? [message #571712 is a reply to message #22280] Thu, 15 May 2003 15:39 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33264
Registered: July 2009
Senior Member
Dirk,

Imports are resolved on demand. Since there aren't references to things in that
namespace, the import doesn't get resolved and a warning is produced to indicate
that. Okay?


"Dirk V. Schesmer" wrote:

> Hi there,
> can please someone explain to me why the code below gets validated producing
> the warning "The location of 'file:///c:/X4CSchemaModeler/xsd/sd1.xsd' has
> not been resolved"
> PrimaryXComponent: org.eclipse.xsd.impl.XSDImportImpl@fcfa52 (element: null)
> (schemaLocation: file:///c:/X4CSchemaModeler/xsd/sd1.xsd) (namespace:
> http://www.ns1.de/) Severity: warning ?
>
> The file sd1.xsd exists there and has the content:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="http://www.ns1.de/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.ns1.de/">
> <xs:simpleType name="simpleType1">
> <xs:restriction base="xs:string"/>
> </xs:simpleType>
> </xs:schema>
>
> XMLSpy validates it successfully!
>
> Thanks for help,
>
> Dirk V. Schesmer
>
> public XSDSchema initializeSD2Schema() {
> XSDSchema xsdSchema = XSDFactory.eINSTANCE.createXSDSchema();
> xsdSchema.setSchemaForSchemaQNamePrefix("xsd");
> xsdSchema.setTargetNamespace(http://ns2.de/sd2.xsd);
> String tns1 = http://www.ns1.de/;
> Map qNamePrefixToNamespaceMap = xsdSchema.getQNamePrefixToNamespaceMap();
> qNamePrefixToNamespaceMap.put(xsdSchema.getSchemaForSchemaQN amePrefix(),XSDC
> onstants.SCHEMA_FOR_SCHEMA_URI_2001);
> qNamePrefixToNamespaceMap.put("ns1", tns1);
> XSDImport someImport =
> XSDSchemaBuildingTools.getXSDFactory().createXSDImport();
> someImport.setNamespace(tns1);
> someImport.setSchemaLocation(file:///c:/X4CSchemaModeler/xsd/sd1.xsd);
> xsdSchema.getContents().add(someImport);
> XSDFactory xsdFactory = XSDSchemaBuildingTools.getXSDFactory();
> XSDComplexTypeDefinition complexType2
> =xsdFactory.createXSDComplexTypeDefinition();
> complexType2.setName("complexType2");
> XSDModelGroup complexType2Sequence = xsdFactory.createXSDModelGroup();
> complexType2Sequence.setCompositor(XSDCompositor.SEQUENCE_LI TERAL);
> XSDParticle complexType2Particle = xsdFactory.createXSDParticle();
> complexType2Particle.setContent(complexType2Sequence);
> XSDElementDeclaration sType1 = xsdFactory.createXSDElementDeclaration();
> sType1.setName("simpleType1");
> XSDParticle sType1Particle = xsdFactory.createXSDParticle();
> sType1Particle.setContent(sType1);
> complexType2Sequence.getContents().add(sType1Particle);
> complexType2.setContent(complexType2Particle);
> xsdSchema.getContents().add(complexType2);
> }


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to resolve a schema doc. location when importing?
Next Topic:[FYI] More Tests with Schemas defined in WSDL
Goto Forum:
  


Current Time: Fri Dec 27 00:51:51 GMT 2024

Powered by FUDForum. Page generated in 0.03255 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top