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 Tevoi Andrea <te...@cad.it> on 2011/01/05 10:43:48 UTC

R: How to instantiate a ValidatorHandler that sends element default value via characters()?

Hi,

 

I’ve seen that the jira has been solved since version 2.10.

Here my problem: in my application a SOAP message is being parsed by a SAXParser and I use a ValidatorHandler to validate each part (header and body entries) against its own Schema. Because I need that element default values being sent via characters, as workaround, I’ve applied a patch by myself to 2.9.1 Xerces version. The patch modifies the org.apache.xerces.jaxp.validation. XMLSchemaValidatorComponentManager class by returning true when the feature SCHEMA_ELEMENT_DEFAULT is requested via getFeature(String featureId).

Now, I’d like to use the latest Xerces version to have the element default values sent via character. I’ve set the features http://apache.org/xml/features/validation, http://apache.org/xml/features/validation/schema and http://apache.org/xml/features/validation/schema/element-default on the SAXParserFactory, but it doesn’t work.

 

Could you help me, please?

Many thanks in advance,

Andrea Tevoi

______________________

 

Andrea Tevoi

Ufficio Sistemi Software

Gruppo CAD IT

Tel. +39.045.82.11.111

Fax +39.045.82.11.110

tevoi@cad.it <ma...@cad.it> 

www.cadit.it <http://www.cadit.it> 

 

CAD S.r.l.

Società soggetta all’attività di direzione e coordinamento di CAD IT S.p.A.

Sede legale: Via Torricelli, 37 - 37136 Verona

Sede amm.iva ed operativa: Via Torricelli, 44/A - 37136 Verona

C.S. € 130.000,00 i.v.

C.F./P.IVA e n. iscr. R.I. di VR 00724020235

R.E.A. di VR n. 153955 

______________________

 

Questo messaggio, con gli eventuali allegati, contiene informazioni riservate o confidenziali. Chiunque lo ricevesse pur non essendone il destinatario è pregato di segnalarlo immediatamente al mittente, di cancellarlo dal proprio sistema e di non copiarlo, diffonderne il contenuto o utilizzarlo in alcun modo.

 

This e-mail and any files transmitted with it are confidential or privileged. If you are not the intended recipient of this e-mail, please notify the sender and delete it from your system immediately: you should not copy, disclose or use either it or its attachments in any way whatsoever.

Da: Michael Glavassevich [mailto:mrglavas@ca.ibm.com] 
Inviato: martedì 27 ottobre 2009 13.59
A: j-users@xerces.apache.org
Oggetto: Re: How to instantiate a ValidatorHandler that sends element default value via characters()?

 

Hi Andrea,

At the moment it's not possible. A feature [1] exists but the ValidatorHandler / Validator doesn't currently recognize it. There is a JIRA issue [2] open for this which I'm hoping we'll get to at some point.

Thanks.

[1] http://xerces.apache.org/xerces2-j/features.html#validation.schema.element-default
[2] https://issues.apache.org/jira/browse/XERCESJ-1142

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

"Tevoi Andrea" <te...@cad.it> wrote on 10/27/2009 06:34:34 AM:

> Hi all,
>  
> Is it possibile to set a feature to SchemaFactory to instantiate 
> (via Schema) a ValidatorHandler that sends element default value via
> characters()?
>  
> Thanks in advance,
> Andrea Tevoi


Re: R: How to instantiate a ValidatorHandler that sends element default value via characters()?

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

You said that you're using ValidatorHandlers to validate the document, so
you need to set the 'element-default' feature on the ValidatorHandler not
the SAXParserFactory.

Thanks.

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

"Tevoi Andrea" <te...@cad.it> wrote on 01/05/2011 04:43:48 AM:

> Hi,
>
> I?ve seen that the jira has been solved since version 2.10.
> Here my problem: in my application a SOAP message is being parsed by
> a SAXParser and I use a ValidatorHandler to validate each part
> (header and body entries) against its own Schema. Because I need
> that element default values being sent via characters, as
> workaround, I?ve applied a patch by myself to 2.9.1 Xerces version.
> The patch modifies the org.apache.xerces.jaxp.validation.
> XMLSchemaValidatorComponentManager class by returning true when the
> feature SCHEMA_ELEMENT_DEFAULT is requested via getFeature(String
featureId).
> Now, I?d like to use the latest Xerces version to have the element
> default values sent via character. I?ve set the features http://
> apache.org/xml/features/validation, http://apache.org/xml/features/
> validation/schema and http://apache.org/xml/features/validation/
> schema/element-default on the SAXParserFactory, but it doesn?t work.
>
> Could you help me, please?
> Many thanks in advance,
> Andrea Tevoi
> ______________________
>
> Andrea Tevoi
> Ufficio Sistemi Software
> Gruppo CAD IT
> Tel. +39.045.82.11.111
> Fax +39.045.82.11.110
> tevoi@cad.it
> www.cadit.it
>
> CAD S.r.l.
> Società soggetta all?attività di direzione e coordinamento di CAD IT
S.p.A.
> Sede legale: Via Torricelli, 37 - 37136 Verona
> Sede amm.iva ed operativa: Via Torricelli, 44/A - 37136 Verona
> C.S. ? 130.000,00 i.v.
> C.F./P.IVA e n. iscr. R.I. di VR 00724020235
> R.E.A. di VR n. 153955
> ______________________
>
> Questo messaggio, con gli eventuali allegati, contiene informazioni
> riservate o confidenziali. Chiunque lo ricevesse pur non essendone
> il destinatario è pregato di segnalarlo immediatamente al mittente,
> di cancellarlo dal proprio sistema e di non copiarlo, diffonderne il
> contenuto o utilizzarlo in alcun modo.
>
> This e-mail and any files transmitted with it are confidential or
> privileged. If you are not the intended recipient of this e-mail,
> please notify the sender and delete it from your system immediately:
> you should not copy, disclose or use either it or its attachments in
> any way whatsoever.
> Da: Michael Glavassevich [mailto:mrglavas@ca.ibm.com]
> Inviato: martedì 27 ottobre 2009 13.59
> A: j-users@xerces.apache.org
> Oggetto: Re: How to instantiate a ValidatorHandler that sends
> element default value via characters()?
>
> Hi Andrea,
>
> At the moment it's not possible. A feature [1] exists but the
> ValidatorHandler / Validator doesn't currently recognize it. There
> is a JIRA issue [2] open for this which I'm hoping we'll get to at some
point.
>
> Thanks.
>
> [1] http://xerces.apache.org/xerces2-j/
> features.html#validation.schema.element-default
> [2] https://issues.apache.org/jira/browse/XERCESJ-1142
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> "Tevoi Andrea" <te...@cad.it> wrote on 10/27/2009 06:34:34 AM:
>
> > Hi all,
> >
> > Is it possibile to set a feature to SchemaFactory to instantiate
> > (via Schema) a ValidatorHandler that sends element default value via
> > characters()?
> >
> > Thanks in advance,
> > Andrea Tevoi