Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » adding an import to a schema and validating
adding an import to a schema and validating [message #598734] Fri, 08 September 2006 14:45
nero is currently offline neroFriend
Messages: 1
Registered: July 2009
Junior Member
I was wondering how I should add an import to a XSDSchema object and
validate the schema with the added import. I have looked up the newsgroup
but could not get much. The example code was not helpful in this regard
either. I have been trying to execute the following code without much
avail.

<code>
private void addImport(String nameSpace, String absolutePath,
XSDSchema resolvedSchema) {
XSDSchema schema = null;
XSDImport impDirective = XSDFactory.eINSTANCE.createXSDImport();
impDirective.setNamespace(nameSpace);
impDirective.setSchemaLocation(absolutePath);
impDirective.setResolvedSchema(resolvedSchema);

// schema.getReferencingDirectives().add(impDirective); //this does not
// work either
schema.getContents().add(impDirective); // this result in an error The
// sdDiagnostics say the import is not allowed by constraint
// expecting type......
schema.clearDiagnostics();
schema.validate();
}
}
<code/>
Thanks and regards,
Nero.
Previous Topic:Model to Meta-Model mapping?
Next Topic:adding an import to a schema and validating
Goto Forum:
  


Current Time: Thu Nov 27 21:22:14 GMT 2014

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

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