You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Nick Ardlie <Ni...@immi.gov.au> on 2009/05/28 06:24:13 UTC

Applying honour-all-schemaLocations semantics to XMLGrammarLoader

Is there a way to set the
"http://apache.org/xml/features/honour-all-schemaLocations" feature on the
underlying parser used by an XMLGrammarLoader (or another way to achieve an
equivalent outcome)?

I'm using the XMLGrammarLoader for programmatic validation of XML schemas
but its failing to pick up cases where multiple import statements are
included and a later import statement has an incorrect path (but a former
import has already bound components to that namespace via a nested import -
with a correct path).

Or is there a better way to programmatically validate schemas (in the
absence of an instance document) in Xerces-J (and still assert the
honour-all-schemaLocations feature behaviour)?

Regards,
Nick.
-- 
View this message in context: http://www.nabble.com/Applying-honour-all-schemaLocations-semantics-to-XMLGrammarLoader-tp23755010p23755010.html
Sent from the Xerces - J - Dev mailing list archive at Nabble.com.


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


Re: Applying honour-all-schemaLocations semantics to XMLGrammarLoader [SEC=UNCLASSIFIED]

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Nick,

Nicholas.Ardlie@immi.gov.au wrote on 05/28/2009 01:38:59 AM:

> Hi Michael,
>
> My indication of the JDK was misleading as I am using the Apache release
> but only version 2.6.2.

Sure, but Xerces-J 2.6.2 pre-dates JAXP 1.3 so it's impossible to use its
JAXP SchemaFactory / Schema implementation. It doesn't exist in that
release.

> A test using 2.9.1 reveals that the "honour-all-schemaLocations" feature
is
> available for the XMLGrammarLoader in that release (but wasn't available
in
> 2.6.2).

As documented [1] it only came into existence in Xerces-J 2.7.0.

> And it results in a call to the XMLErrorHandler warning() method, which
is
> great.

Yep. A failed import is merely a warning.

> The JAXP newSchema() instantiation doesn't pick it up in either version,
> perhaps because its a warning and not an error (?)
> Thanks for your help.

I think in both cases you probably got the implementation from the JDK.
Some versions of Java have a bug in SchemaFactory (the abstract base class)
which cause it to load the JDK internal implementation instead of the one
(e.g. Xerces) which should be found on the classpath.

> Regards,
> Nick.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/features.html#honour-all-schemaLocations

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Re: Applying honour-all-schemaLocations semantics to XMLGrammarLoader [SEC=UNCLASSIFIED]

Posted by Ni...@immi.gov.au.
Hi Michael,

My indication of the JDK was misleading as I am using the Apache release
but only version 2.6.2.
A test using 2.9.1 reveals that the "honour-all-schemaLocations" feature is
available for the XMLGrammarLoader in that release (but wasn't available in
2.6.2).
And it results in a call to the XMLErrorHandler warning() method, which is
great.
The JAXP newSchema() instantiation doesn't pick it up in either version,
perhaps because its a warning and not an error (?)
Thanks for your help.

Regards,
Nick.



                                                                           
             Michael                                                       
             Glavassevich                                                  
             <mrglavas@ca.ibm.                                          To 
             com>                           j-users@xerces.apache.org      
                                                                        cc 
             28/05/2009 03:10                                              
             PM                                                    Subject 
                                            Re: Applying                   
                                            honour-all-schemaLocations     
             Please respond to              semantics to XMLGrammarLoader  
             j-users@xerces.ap              [SEC=UNCLASSIFIED]             
                 ache.org                                  Protective Mark 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           



Hi Nick,

If you're relying on something in Java 6 then you're not using Xerces. Sun
forked the codebase they ship in the JDK long ago, made all sorts of
private changes and apparently aren't keeping in synch with activity here.
I couldn't tell you what it's doing. I'd suggest that you download a recent
Apache release (i.e. Xerces-J 2.9.1) and try that.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Nicholas.Ardlie@immi.gov.au wrote on 05/28/2009 12:52:34 AM:

> Hi Michael,
>
> Unfortunately the "honour-all-schemaLocations" feature is not supported
on
> the XMLGrammarLoader (JDK 1.6).
> It throws an XMLConfigurationException and is not listed in results of
> getRecognizedFeatures().
> I did also try the JAXP Validation API but the call to newSchema()
doesn't
> pick up the error in this case.
> Should it ?
>
> Thanks,
> Nick
>
>
>
>
>

>              Michael

>              Glavassevich

>              <mrglavas@ca.ibm.
To
>              com>                           j-dev@xerces.apache.org

>
cc
>              28/05/2009 02:38               j-users@xerces.apache.org

>              PM
Subject
>                                             Re: Applying

>                                             honour-all-schemaLocations

>              Please respond to              semantics to XMLGrammarLoader

>              j-users@xerces.ap                             Protective
Mark
>                  ache.org

>

>

>

>

>

>

>
>
>
> Hi Nick,
>
> While I'm not sure about the challenge you're having with setting
features
> on an XMLGrammarLoader (as it does have a setFeature() method) I'd
> recommend that you use the JAXP Validation API [1]. In particular take a
> look at SchemaFactory. A call to newSchema() will check all of the
> constraints on the schema documents being processed.
>
> Thanks.
>
> [1]
> http://xerces.apache.org/xerces2-
> j/javadocs/api/javax/xml/validation/package-summary.html
>
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> Nick Ardlie <Ni...@immi.gov.au> wrote on 05/28/2009 12:24:13
AM:
>
> >
> > Is there a way to set the
> > "http://apache.org/xml/features/honour-all-schemaLocations" feature on
> the
> > underlying parser used by an XMLGrammarLoader (or another way to
achieve
> an
> > equivalent outcome)?
> >
> > I'm using the XMLGrammarLoader for programmatic validation of XML
schemas
> > but its failing to pick up cases where multiple import statements are
> > included and a later import statement has an incorrect path (but a
former
> > import has already bound components to that namespace via a nested
import
> -
> > with a correct path).
> >
> > Or is there a better way to programmatically validate schemas (in the
> > absence of an instance document) in Xerces-J (and still assert the
> > honour-all-schemaLocations feature behaviour)?
> >
> > Regards,
> > Nick.
> > --
> > View this message in context: http://www.nabble.com/Applying-honour-
> >
>
all-schemaLocations-semantics-to-XMLGrammarLoader-tp23755010p23755010.html
> > Sent from the Xerces - J - Dev mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: j-dev-help@xerces.apache.org
>
>
>
> --------------------------------------------------------------------
> Important Notice: If you have received this email by mistake, please
advise
> the sender and delete the message and attachments immediately.  This
email,
> including attachments, may contain confidential, sensitive, legally
privileged
> and/or copyright information.  Any review, retransmission, dissemination
> or other use of this information by persons or entities other than the
> intended recipient is prohibited.  DIAC respects your privacy and has
> obligations under the Privacy Act 1988.  The official departmental
privacy
> policy can be viewed on the department's website at www.immi.gov.au.
See:
> http://www.immi.gov.au/functional/privacy.htm
>
>
> ---------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> 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


Re: Applying honour-all-schemaLocations semantics to XMLGrammarLoader [SEC=UNCLASSIFIED]

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Nick,

If you're relying on something in Java 6 then you're not using Xerces. Sun
forked the codebase they ship in the JDK long ago, made all sorts of
private changes and apparently aren't keeping in synch with activity here.
I couldn't tell you what it's doing. I'd suggest that you download a recent
Apache release (i.e. Xerces-J 2.9.1) and try that.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Nicholas.Ardlie@immi.gov.au wrote on 05/28/2009 12:52:34 AM:

> Hi Michael,
>
> Unfortunately the "honour-all-schemaLocations" feature is not supported
on
> the XMLGrammarLoader (JDK 1.6).
> It throws an XMLConfigurationException and is not listed in results of
> getRecognizedFeatures().
> I did also try the JAXP Validation API but the call to newSchema()
doesn't
> pick up the error in this case.
> Should it ?
>
> Thanks,
> Nick
>
>
>
>
>

>              Michael

>              Glavassevich

>              <mrglavas@ca.ibm.
To
>              com>                           j-dev@xerces.apache.org

>
cc
>              28/05/2009 02:38               j-users@xerces.apache.org

>              PM
Subject
>                                             Re: Applying

>                                             honour-all-schemaLocations

>              Please respond to              semantics to XMLGrammarLoader

>              j-users@xerces.ap                             Protective
Mark
>                  ache.org

>

>

>

>

>

>

>
>
>
> Hi Nick,
>
> While I'm not sure about the challenge you're having with setting
features
> on an XMLGrammarLoader (as it does have a setFeature() method) I'd
> recommend that you use the JAXP Validation API [1]. In particular take a
> look at SchemaFactory. A call to newSchema() will check all of the
> constraints on the schema documents being processed.
>
> Thanks.
>
> [1]
> http://xerces.apache.org/xerces2-
> j/javadocs/api/javax/xml/validation/package-summary.html
>
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> Nick Ardlie <Ni...@immi.gov.au> wrote on 05/28/2009 12:24:13
AM:
>
> >
> > Is there a way to set the
> > "http://apache.org/xml/features/honour-all-schemaLocations" feature on
> the
> > underlying parser used by an XMLGrammarLoader (or another way to
achieve
> an
> > equivalent outcome)?
> >
> > I'm using the XMLGrammarLoader for programmatic validation of XML
schemas
> > but its failing to pick up cases where multiple import statements are
> > included and a later import statement has an incorrect path (but a
former
> > import has already bound components to that namespace via a nested
import
> -
> > with a correct path).
> >
> > Or is there a better way to programmatically validate schemas (in the
> > absence of an instance document) in Xerces-J (and still assert the
> > honour-all-schemaLocations feature behaviour)?
> >
> > Regards,
> > Nick.
> > --
> > View this message in context: http://www.nabble.com/Applying-honour-
> >
>
all-schemaLocations-semantics-to-XMLGrammarLoader-tp23755010p23755010.html
> > Sent from the Xerces - J - Dev mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: j-dev-help@xerces.apache.org
>
>
>
> --------------------------------------------------------------------
> Important Notice: If you have received this email by mistake, please
advise
> the sender and delete the message and attachments immediately.  This
email,
> including attachments, may contain confidential, sensitive, legally
privileged
> and/or copyright information.  Any review, retransmission, dissemination
> or other use of this information by persons or entities other than the
> intended recipient is prohibited.  DIAC respects your privacy and has
> obligations under the Privacy Act 1988.  The official departmental
privacy
> policy can be viewed on the department's website at www.immi.gov.au.
See:
> http://www.immi.gov.au/functional/privacy.htm
>
>
> ---------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Re: Applying honour-all-schemaLocations semantics to XMLGrammarLoader [SEC=UNCLASSIFIED]

Posted by Ni...@immi.gov.au.
Hi Michael,

Unfortunately the "honour-all-schemaLocations" feature is not supported on
the XMLGrammarLoader (JDK 1.6).
It throws an XMLConfigurationException and is not listed in results of
getRecognizedFeatures().
I did also try the JAXP Validation API but the call to newSchema() doesn't
pick up the error in this case.
Should it ?

Thanks,
Nick




                                                                           
             Michael                                                       
             Glavassevich                                                  
             <mrglavas@ca.ibm.                                          To 
             com>                           j-dev@xerces.apache.org        
                                                                        cc 
             28/05/2009 02:38               j-users@xerces.apache.org      
             PM                                                    Subject 
                                            Re: Applying                   
                                            honour-all-schemaLocations     
             Please respond to              semantics to XMLGrammarLoader  
             j-users@xerces.ap                             Protective Mark 
                 ache.org                                                  
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           



Hi Nick,

While I'm not sure about the challenge you're having with setting features
on an XMLGrammarLoader (as it does have a setFeature() method) I'd
recommend that you use the JAXP Validation API [1]. In particular take a
look at SchemaFactory. A call to newSchema() will check all of the
constraints on the schema documents being processed.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/package-summary.html


Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Nick Ardlie <Ni...@immi.gov.au> wrote on 05/28/2009 12:24:13 AM:

>
> Is there a way to set the
> "http://apache.org/xml/features/honour-all-schemaLocations" feature on
the
> underlying parser used by an XMLGrammarLoader (or another way to achieve
an
> equivalent outcome)?
>
> I'm using the XMLGrammarLoader for programmatic validation of XML schemas
> but its failing to pick up cases where multiple import statements are
> included and a later import statement has an incorrect path (but a former
> import has already bound components to that namespace via a nested import
-
> with a correct path).
>
> Or is there a better way to programmatically validate schemas (in the
> absence of an instance document) in Xerces-J (and still assert the
> honour-all-schemaLocations feature behaviour)?
>
> Regards,
> Nick.
> --
> View this message in context: http://www.nabble.com/Applying-honour-
>
all-schemaLocations-semantics-to-XMLGrammarLoader-tp23755010p23755010.html
> Sent from the Xerces - J - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-dev-help@xerces.apache.org



--------------------------------------------------------------------
Important Notice: If you have received this email by mistake, please advise
the sender and delete the message and attachments immediately.  This email,
including attachments, may contain confidential, sensitive, legally privileged
and/or copyright information.  Any review, retransmission, dissemination
or other use of this information by persons or entities other than the
intended recipient is prohibited.  DIAC respects your privacy and has
obligations under the Privacy Act 1988.  The official departmental privacy
policy can be viewed on the department's website at www.immi.gov.au.  See:
http://www.immi.gov.au/functional/privacy.htm


---------------------------------------------------------------------


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


Re: Applying honour-all-schemaLocations semantics to XMLGrammarLoader

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Nick,

While I'm not sure about the challenge you're having with setting features
on an XMLGrammarLoader (as it does have a setFeature() method) I'd
recommend that you use the JAXP Validation API [1]. In particular take a
look at SchemaFactory. A call to newSchema() will check all of the
constraints on the schema documents being processed.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/package-summary.html

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Nick Ardlie <Ni...@immi.gov.au> wrote on 05/28/2009 12:24:13 AM:

>
> Is there a way to set the
> "http://apache.org/xml/features/honour-all-schemaLocations" feature on
the
> underlying parser used by an XMLGrammarLoader (or another way to achieve
an
> equivalent outcome)?
>
> I'm using the XMLGrammarLoader for programmatic validation of XML schemas
> but its failing to pick up cases where multiple import statements are
> included and a later import statement has an incorrect path (but a former
> import has already bound components to that namespace via a nested import
-
> with a correct path).
>
> Or is there a better way to programmatically validate schemas (in the
> absence of an instance document) in Xerces-J (and still assert the
> honour-all-schemaLocations feature behaviour)?
>
> Regards,
> Nick.
> --
> View this message in context: http://www.nabble.com/Applying-honour-
>
all-schemaLocations-semantics-to-XMLGrammarLoader-tp23755010p23755010.html
> Sent from the Xerces - J - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-dev-help@xerces.apache.org

Re: Applying honour-all-schemaLocations semantics to XMLGrammarLoader

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Nick,

While I'm not sure about the challenge you're having with setting features
on an XMLGrammarLoader (as it does have a setFeature() method) I'd
recommend that you use the JAXP Validation API [1]. In particular take a
look at SchemaFactory. A call to newSchema() will check all of the
constraints on the schema documents being processed.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/package-summary.html

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Nick Ardlie <Ni...@immi.gov.au> wrote on 05/28/2009 12:24:13 AM:

>
> Is there a way to set the
> "http://apache.org/xml/features/honour-all-schemaLocations" feature on
the
> underlying parser used by an XMLGrammarLoader (or another way to achieve
an
> equivalent outcome)?
>
> I'm using the XMLGrammarLoader for programmatic validation of XML schemas
> but its failing to pick up cases where multiple import statements are
> included and a later import statement has an incorrect path (but a former
> import has already bound components to that namespace via a nested import
-
> with a correct path).
>
> Or is there a better way to programmatically validate schemas (in the
> absence of an instance document) in Xerces-J (and still assert the
> honour-all-schemaLocations feature behaviour)?
>
> Regards,
> Nick.
> --
> View this message in context: http://www.nabble.com/Applying-honour-
>
all-schemaLocations-semantics-to-XMLGrammarLoader-tp23755010p23755010.html
> Sent from the Xerces - J - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-dev-help@xerces.apache.org