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 #571626] Thu, 15 May 2003 09:45
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);
}
Previous Topic:Discussion Archive
Next Topic:How to resolve a schema doc. location when importing?
Goto Forum:
  


Current Time: Fri Apr 26 16:36:23 GMT 2024

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

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

Back to the top