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 Fr...@filinks.com on 2003/07/29 15:38:35 UTC

RE: registering schema locations

Hi,

I looked at the documentation from Sun.
I tried the "http://java.sun.com/xml/jaxp/properties/schemaSource" 
property and it works fine. I can register schema locations by reading the 
schema files.

sample code : 

saxFactory = SAXParserFactory.newInstance();
saxFactory.setNamespaceAware(true);
FileFilter xsdFileFilter = new FileFilter() {
        public boolean accept(File pPathName) {
                if (pPathName.getName().endsWith(".xsd")) {
                        return true;
                }
                return false;
        }
};
File[] xsdFiles = xsdDir.listFiles(xsdFileFilter);
saxFactory.setProperty(
"http://java.sun.com/xml/jaxp/properties/schemaSource", xsdFiles);

The problem is that I must do this job each time I need a SAXParser. Is 
there any means to use the 
"http://java.sun.com/xml/jaxp/properties/schemaSource" property at the 
SAXParserFactory level ?
I cannot use always the same SAXParser because I am in a multi-thread 
environment and the SAXParser is not required to be thread safe.

Thanks for any help

Francois Banel
tel : 01 53 34 30 64
mailto:Francois.Banel@filinks.com




Francois.Banel@filinks.com
23/06/2003 10:24
Please respond to xerces-j-user
 
        To:     xerces-j-user@xml.apache.org
        cc: 
        Subject:        RE: registering schema locations



Thank you, this seems to be a good and simple solution to my problem. 
I will try this.

Francois Banel
tel : 01 53 34 30 64
mailto:Francois.Banel@filinks.com 



"O'Keeffe, Michael" <mi...@dot.state.wi.us> 
19/06/2003 18:15 
Please respond to xerces-j-user 
        
        To:        "'xerces-j-user@xml.apache.org'" 
<xe...@xml.apache.org> 
        cc:         
        Subject:        RE: registering schema locations



Here is some good documentation from Sun illustrating how to configure it 
with JAXP (with Xerces as the parser). 
  
http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXPDOM9.html#63997 
-----Original Message-----
From: Francois.Banel@filinks.com [mailto:Francois.Banel@filinks.com]
Sent: Thursday, June 19, 2003 10:32 AM
To: xerces-j-user@xml.apache.org
Subject: Re: registering schema locations


Thank you for the response. 

The XML documents I use are generated by JAXB (Sun Java XML Binding 
Framework), and JAXB is aware of namespaces, but not aware of schema 
locations. 
So the XML documents generated do not contain any schema location 
information. 

If there is no standard way to register schema locations, does Xerces 
provide this facility in a proprietary way ? 


Francois Banel
tel : 01 53 34 30 64
mailto:Francois.Banel@filinks.com 


Joseph Kesselman <ke...@us.ibm.com> 
19/06/2003 14:52 
Please respond to xerces-j-user 
        
       To:        xerces-j-user@xml.apache.org 
       cc:         
       Subject:        Re: registering schema locations








The W3C's Semantic Web folks are investigating what metadata, if any, is
implied by a namespace and how it should be retrieved and used.  Until 
they
report out, the official answer is that a namespace URI is only a magic
string in URI syntax. It does not imply a specific schema, and indeed may
be referenced by many schema documents. So for now, even if you can make
this work, it's going to be a unique solution for your own application and
won't work for anyone else.

What's wrong with having the document explicitly declare which schemas it
needs? It has to declare the namespaces, and if anyone knows the mapping
from one to the other it should be no harder to build that into the
document than to try to imply it afterward... and if it's in the document
you avoid having to blaze a path into uncharted and (at least for now)
nonportable terratory.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


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





RE: registering schema locations

Posted by Fr...@filinks.com.
Sorry, my previous message contains sample code that is exposing what I 
would like to do with SAXParserFactory.
What I can do until now is : 

SAXParser parser = INSTANCE.saxFactory.newSAXParser();
// register namespaces of all xml schema files
File xsdDir = new File(Proprietes.getXSDPath());
FileFilter xsdFileFilter = new FileFilter() {
        public boolean accept(File pPathName) {
                if (pPathName.getName().endsWith(".xsd")) {
                        return true;
                }
                return false;
        }
};
File[] xsdFiles = xsdDir.listFiles(xsdFileFilter);
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", 
xsdFiles);

Is it possible to do this at the SAXParserFacotry level ?

thanks for any help

Francois Banel
tel : 01 53 34 30 64
mailto:Francois.Banel@filinks.com




Francois.Banel@filinks.com
29/07/2003 15:38
Please respond to xerces-j-user
 
        To:     xerces-j-user@xml.apache.org
        cc: 
        Subject:        RE: registering schema locations



Hi, 

I looked at the documentation from Sun. 
I tried the "http://java.sun.com/xml/jaxp/properties/schemaSource" 
property and it works fine. I can register schema locations by reading the 
schema files. 

sample code : 

saxFactory = SAXParserFactory.newInstance(); 
saxFactory.setNamespaceAware(true); 
FileFilter xsdFileFilter = new FileFilter() { 
        public boolean accept(File pPathName) { 
                if (pPathName.getName().endsWith(".xsd")) { 
                        return true; 
                } 
                return false; 
        } 
}; 
File[] xsdFiles = xsdDir.listFiles(xsdFileFilter); 
saxFactory.setProperty("
http://java.sun.com/xml/jaxp/properties/schemaSource", xsdFiles); 

The problem is that I must do this job each time I need a SAXParser. Is 
there any means to use the "
http://java.sun.com/xml/jaxp/properties/schemaSource" property at the 
SAXParserFactory level ? 
I cannot use always the same SAXParser because I am in a multi-thread 
environment and the SAXParser is not required to be thread safe. 

Thanks for any help 

Francois Banel
tel : 01 53 34 30 64
mailto:Francois.Banel@filinks.com 



Francois.Banel@filinks.com 
23/06/2003 10:24 
Please respond to xerces-j-user 
        
        To:        xerces-j-user@xml.apache.org 
        cc:         
        Subject:        RE: registering schema locations




Thank you, this seems to be a good and simple solution to my problem. 
I will try this.

Francois Banel
tel : 01 53 34 30 64
mailto:Francois.Banel@filinks.com 


"O'Keeffe, Michael" <mi...@dot.state.wi.us> 
19/06/2003 18:15 
Please respond to xerces-j-user 
        
       To:        "'xerces-j-user@xml.apache.org'" 
<xe...@xml.apache.org> 
       cc:         
       Subject:        RE: registering schema locations




Here is some good documentation from Sun illustrating how to configure it 
with JAXP (with Xerces as the parser). 
 
http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXPDOM9.html#63997 
-----Original Message-----
From: Francois.Banel@filinks.com [mailto:Francois.Banel@filinks.com]
Sent: Thursday, June 19, 2003 10:32 AM
To: xerces-j-user@xml.apache.org
Subject: Re: registering schema locations


Thank you for the response. 

The XML documents I use are generated by JAXB (Sun Java XML Binding 
Framework), and JAXB is aware of namespaces, but not aware of schema 
locations. 
So the XML documents generated do not contain any schema location 
information. 

If there is no standard way to register schema locations, does Xerces 
provide this facility in a proprietary way ? 


Francois Banel
tel : 01 53 34 30 64
mailto:Francois.Banel@filinks.com 

Joseph Kesselman <ke...@us.ibm.com> 
19/06/2003 14:52 
Please respond to xerces-j-user 
        
      To:        xerces-j-user@xml.apache.org 
      cc:         
      Subject:        Re: registering schema locations









The W3C's Semantic Web folks are investigating what metadata, if any, is
implied by a namespace and how it should be retrieved and used.  Until 
they
report out, the official answer is that a namespace URI is only a magic
string in URI syntax. It does not imply a specific schema, and indeed may
be referenced by many schema documents. So for now, even if you can make
this work, it's going to be a unique solution for your own application and
won't work for anyone else.

What's wrong with having the document explicitly declare which schemas it
needs? It has to declare the namespaces, and if anyone knows the mapping
from one to the other it should be no harder to build that into the
document than to try to imply it afterward... and if it's in the document
you avoid having to blaze a path into uncharted and (at least for now)
nonportable terratory.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


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