Hi ,
I am trying to read ComplexTypes from schema . I am able to read
typDefintiions from XSModel , but unable to drill complexType from
typeDefinitions .
Also i am not able to read elementDeclaration. The namespace is correct.
The code i have used is follows -
System.setProperty(DOMImplementationRegistry.PROPERTY,
"com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl");
// get an instance of DOMImplementationRegistry
DOMImplementationRegistry registry =
DOMImplementationRegistry.newInstance();
XSImplementation impl = (XSImplementation)
registry.getDOMImplementation("XS-Loader");
// create XSLoader
XSLoader schemaLoader = impl.createXSLoader(null);
XSModel model = schemaLoader.loadURI("employee.xsd");
XSNamedMap map = model.getComponents(XSConstants.TYPE_DEFINITION);
for (int j=0; j<map.getLength(); j++) {
XSObject o = map.item(j);
System.out.println("{"+o.getNamespace()+"}"+o.getName());
XSNamespaceItem nameSpaceItem = o.getNamespaceItem();
System.out.println("namespace item is " + nameSpaceItem);
if(nameSpaceItem != null)
{
XSNamedMap complexMap =
nameSpaceItem.getComponents(XSTypeDefinition.COMPLEX_TYPE);
for (int k=0; k<complexMap.getLength(); k++) {
XSObject o1 = complexMap.item(k);
System.out.println("{"+o1.getNamespace()+"}"+o1.getName());
}
}
}
// element declaration is coming null
XSElementDeclaration element =
model.getElementDeclaration("EMPLOYEE","http://www.test.com/emp");
System.out.println("Displaying element declarations...." + element);
Thanks
Venkat
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]