You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Michael Glavassevich <mr...@ca.ibm.com> on 2006/05/17 06:40:18 UTC

Re: Unable to read Complex Types from Schema

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: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Venkatesh <ve...@oracle.com> 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: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org