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 Wulf Berschin <be...@dosco.de> on 2010/02/04 11:39:17 UTC

Expand Fragments represented as PIs

Hello,

our (xml-dumb) DMS stores fragmented XML documents where the fragments 
are represented as PIs. (This is due to the fact that the DMS doesn't 
know about file names).

We used to expand these fragments while parsing with SAX (setting up an 
own parser at the processing-instruction handler for each fragment), but 
this approach has the drawback that the validator reports ID/IDREF 
errors for links from one fragment to another which are none at document 
level.

It seems to me that I'will have to handle the fragment resolution at XNI 
level...

Could someone please to light me the way?

Thank you,

Wulf


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


Re: Expand Fragments represented as PIs

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

Wulf Berschin <be...@dosco.de> wrote on 02/04/2010 10:48:19 AM:

> Hi Michael,
>
> xes, we want to parse with validation switched on. Not only for
> retrieving XML errors but for getting attribute default values as well.
> And our documents are based on old-fashioned DTDs... Did not unsderstand
> if the mentioned Validation API supports validation against DTDs too.

There's no technical reason it can't, however Xerces only provides an
implementation of the Validation API for XML Schema.

If you would like to use this capability I'd suggest converting your DTDs
to XSDs. You can do it on the fly with the NekoDTD converter [1] and the
stylesheets [2] provided with it.

> In our project we use JAXP transformer and pipe different
> transformations together. It would be nice to have a Validator as
> TransformerHandler there since sometimes instances need a "cleaning"
> before they can be parsed....

You should be able to hook a ValidatorHandler [3] into your pipeline.

> Thank you for your help.
>
> Wulf

Thanks.

[1] http://people.apache.org/~andyc/neko/doc/dtd/index.html
[2] http://people.apache.org/~andyc/neko/doc/dtd/conversions.html
[3]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/ValidatorHandler.html

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

Re: Expand Fragments represented as PIs

Posted by Wulf Berschin <be...@dosco.de>.
Hi Michael,

xes, we want to parse with validation switched on. Not only for 
retrieving XML errors but for getting attribute default values as well. 
And our documents are based on old-fashioned DTDs... Did not unsderstand 
if the mentioned Validation API supports validation against DTDs too.

In our project we use JAXP transformer and pipe different 
transformations together. It would be nice to have a Validator as 
TransformerHandler there since sometimes instances need a "cleaning" 
before they can be parsed....

Thank you for your help.

Wulf

Michael Glavassevich schrieb:
> Hi Wulf,
> 
> It sounds like you want validation to occur after you've resolved the 
> fragments. Have you taken a look at the JAXP Validation API [1]? It's 
> decoupled from the parser which means you can validate after doing 
> whatever processing you require before that.
> 
> 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
> 
> Wulf Berschin <be...@dosco.de> wrote on 02/04/2010 05:39:17 AM:
> 
>  > Hello,
>  >
>  > our (xml-dumb) DMS stores fragmented XML documents where the fragments
>  > are represented as PIs. (This is due to the fact that the DMS doesn't
>  > know about file names).
>  >
>  > We used to expand these fragments while parsing with SAX (setting up an
>  > own parser at the processing-instruction handler for each fragment), but
>  > this approach has the drawback that the validator reports ID/IDREF
>  > errors for links from one fragment to another which are none at document
>  > level.
>  >
>  > It seems to me that I'will have to handle the fragment resolution at XNI
>  > level...
>  >
>  > Could someone please to light me the way?
>  >
>  > Thank you,
>  >
>  > Wulf
>  >
>  > ---------------------------------------------------------------------
>  > 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: Expand Fragments represented as PIs

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

It sounds like you want validation to occur after you've resolved the
fragments. Have you taken a look at the JAXP Validation API [1]? It's
decoupled from the parser which means you can validate after doing whatever
processing you require before that.

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

Wulf Berschin <be...@dosco.de> wrote on 02/04/2010 05:39:17 AM:

> Hello,
>
> our (xml-dumb) DMS stores fragmented XML documents where the fragments
> are represented as PIs. (This is due to the fact that the DMS doesn't
> know about file names).
>
> We used to expand these fragments while parsing with SAX (setting up an
> own parser at the processing-instruction handler for each fragment), but
> this approach has the drawback that the validator reports ID/IDREF
> errors for links from one fragment to another which are none at document
> level.
>
> It seems to me that I'will have to handle the fragment resolution at XNI
> level...
>
> Could someone please to light me the way?
>
> Thank you,
>
> Wulf
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org