You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Dan Diephouse <da...@envoisolutions.com> on 2007/02/05 16:29:17 UTC

Re: Question about imported element baseUri in XMLSchema

There isn't a very good way to get at *all* the schema documents as we
discussed in this issue:

https://issues.apache.org/jira/browse/CXF-363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Calling getDocumentElement() actually reserializes the schemas. There are a
couple possible solutions to this, and I would like to get feedback from
others on them.

1. Enhance XmlSchema to store the original Elements which were the backing
document. I'm not sure how much work or how feasible this is.
2. Switch to use XSOM and resolve all the schema Elements correctly
http://xsom.dev.java.net
3. Don't do anything. The realization here would be that we don't actually
need to resolve the schemas ourselves. In XFire we just gave JAXB the schema
Elements that were in the WSDL and it took care of finding the imports and
resolving them correctly. The original schema Elements can be found in
SchemaInfo.getElement() (as oppsed to
SchemaInfo.getSchema().getDocumentElement()].


Regards,
- Dan

On 2/4/07, Jim Ma <ji...@iona.com> wrote:
>
> Hi ,
>
> I use the following code to read the schemaA which import the schemaB and
> print the base uri
>
> for each schema element :
>
>
> schemaCol.setBaseUri(schemaBaseUri);
> schemaCol.setSchemaResolver (new XmlSchemaURIResolver());
> XmlSchema xmlSchema = schemaCol.read(schemaA);
>
> When I check the imported schema element base uri , I always get null.
>
> Document[] docs = xmlSchema.getAllSchemas();
> for (int i = 0; i < docs.length; i++) {
>          Element ele = docs[i].getDocumentElement();
>          System.out.println("--- getBaseUri---- " + ele.getBaseURI());
> }
>
> I always get null value .Is there anything I need to set for schemaCol ?
>
> Thanks
>
> Jim
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Re: Question about imported element baseUri in XMLSchema

Posted by Dan Diephouse <da...@envoisolutions.com>.
Sure thing, here it is:

http://fisheye.codehaus.org/browse/xfire/trunk/xfire/xfire-generator/src/main/org/codehaus/xfire/gen/jaxb/JAXBSchemaSupport.java?r=2061#l82

I will check into fixing XmlSchema and see if we can get that fixed as well.

- Dan

On 2/6/07, Jim Ma <ji...@iona.com> wrote:
>
> Thanks Dan ,
>
> I think XMlSchema is needed to enhance . Reserializing the schemas is not
> the good and ideal way
> to get schema elements .
>
> The solution [3] is simple and effective.   Can you point me the XFire
> source code that works around
> this problem ?
>
> Thanks
>
> Jim
>
>
> > -----Original Message-----
> > From: Dan Diephouse [mailto:dan@envoisolutions.com]
> > Sent: Monday, February 05, 2007 11:29 PM
> > To: cxf-dev@incubator.apache.org
> > Subject: Re: Question about imported element baseUri in XMLSchema
> >
> >
> > There isn't a very good way to get at *all* the schema documents as we
> > discussed in this issue:
> >
> > https://issues.apache.org/jira/browse/CXF-363?page=com.atlassian.j
> ira.plugin.system.issuetabpanels:all-tabpanel
> >
> > Calling getDocumentElement() actually reserializes the schemas.
> > There are a
> > couple possible solutions to this, and I would like to get feedback from
> > others on them.
> >
> > 1. Enhance XmlSchema to store the original Elements which were the
> backing
> > document. I'm not sure how much work or how feasible this is.
> > 2. Switch to use XSOM and resolve all the schema Elements correctly
> > http://xsom.dev.java.net
> > 3. Don't do anything. The realization here would be that we don't
> actually
> > need to resolve the schemas ourselves. In XFire we just gave JAXB
> > the schema
> > Elements that were in the WSDL and it took care of finding the imports
> and
> > resolving them correctly. The original schema Elements can be found in
> > SchemaInfo.getElement() (as oppsed to
> > SchemaInfo.getSchema().getDocumentElement()].
> >
> >
> > Regards,
> > - Dan
> >
> > On 2/4/07, Jim Ma <ji...@iona.com> wrote:
> > >
> > > Hi ,
> > >
> > > I use the following code to read the schemaA which import the
> > schemaB and
> > > print the base uri
> > >
> > > for each schema element :
> > >
> > >
> > > schemaCol.setBaseUri(schemaBaseUri);
> > > schemaCol.setSchemaResolver (new XmlSchemaURIResolver());
> > > XmlSchema xmlSchema = schemaCol.read(schemaA);
> > >
> > > When I check the imported schema element base uri , I always get null.
> > >
> > > Document[] docs = xmlSchema.getAllSchemas();
> > > for (int i = 0; i < docs.length; i++) {
> > >          Element ele = docs[i].getDocumentElement();
> > >          System.out.println("--- getBaseUri---- " + ele.getBaseURI());
> > > }
> > >
> > > I always get null value .Is there anything I need to set for schemaCol
> ?
> > >
> > > Thanks
> > >
> > > Jim
> > >
> > >
> >
> >
> > --
> > Dan Diephouse
> > Envoi Solutions
> > http://envoisolutions.com | http://netzooid.com/blog
> >
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

RE: Question about imported element baseUri in XMLSchema

Posted by Jim Ma <ji...@iona.com>.
Thanks Dan ,

I think XMlSchema is needed to enhance . Reserializing the schemas is not
the good and ideal way
to get schema elements .

The solution [3] is simple and effective.   Can you point me the XFire
source code that works around
this problem ?

Thanks

Jim


> -----Original Message-----
> From: Dan Diephouse [mailto:dan@envoisolutions.com]
> Sent: Monday, February 05, 2007 11:29 PM
> To: cxf-dev@incubator.apache.org
> Subject: Re: Question about imported element baseUri in XMLSchema
>
>
> There isn't a very good way to get at *all* the schema documents as we
> discussed in this issue:
>
> https://issues.apache.org/jira/browse/CXF-363?page=com.atlassian.j
ira.plugin.system.issuetabpanels:all-tabpanel
>
> Calling getDocumentElement() actually reserializes the schemas.
> There are a
> couple possible solutions to this, and I would like to get feedback from
> others on them.
>
> 1. Enhance XmlSchema to store the original Elements which were the backing
> document. I'm not sure how much work or how feasible this is.
> 2. Switch to use XSOM and resolve all the schema Elements correctly
> http://xsom.dev.java.net
> 3. Don't do anything. The realization here would be that we don't actually
> need to resolve the schemas ourselves. In XFire we just gave JAXB
> the schema
> Elements that were in the WSDL and it took care of finding the imports and
> resolving them correctly. The original schema Elements can be found in
> SchemaInfo.getElement() (as oppsed to
> SchemaInfo.getSchema().getDocumentElement()].
>
>
> Regards,
> - Dan
>
> On 2/4/07, Jim Ma <ji...@iona.com> wrote:
> >
> > Hi ,
> >
> > I use the following code to read the schemaA which import the
> schemaB and
> > print the base uri
> >
> > for each schema element :
> >
> >
> > schemaCol.setBaseUri(schemaBaseUri);
> > schemaCol.setSchemaResolver (new XmlSchemaURIResolver());
> > XmlSchema xmlSchema = schemaCol.read(schemaA);
> >
> > When I check the imported schema element base uri , I always get null.
> >
> > Document[] docs = xmlSchema.getAllSchemas();
> > for (int i = 0; i < docs.length; i++) {
> >          Element ele = docs[i].getDocumentElement();
> >          System.out.println("--- getBaseUri---- " + ele.getBaseURI());
> > }
> >
> > I always get null value .Is there anything I need to set for schemaCol ?
> >
> > Thanks
> >
> > Jim
> >
> >
>
>
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
>