Hi Venkat,
I see you're setting DOMImplementationRegistry.PROPERTY to
com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl.
That's a Sun repackaged fork of the Xerces codebase and probably very old
now if it came from Java 5.0. Have you tried running this with an Apache
version of Xerces? Xerces 2.8.0 is the most recent one.
Thanks.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
Venkatesh <[EMAIL PROTECTED]> wrote on 05/16/2006 06:44:41 PM:
> 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]