You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robby Pelssers <ro...@ciber.com> on 2011/04/14 13:43:52 UTC
validating xml
Hi all,
i've got an interesting use case where my starting point is XML data (could be 1 single file, aggregated xml data, xquery results, ...)
>From this input I have to generate a DITA map and topics for which I have a map.dtd and topic.dtd which I can use for validation purposes.
At some point in time during all transformation steps I have something like below simplified snippet immediately before I want to use the source-writing transformer. I need to validate the map and topics before writing the files to disc.
<Root>
<map>... </map>
<topic>...</topic>
<topic>...</topic>
...
</Root>
I can't simply use the approach below
<map:transform src="schemas/topic.xsd" type="validate"/> (similar for map) since I still have an aggregated situation.
Did anyone ever have a similar situation and a solution for this?
Ideally the org.apache.cocoon.transformation.ValidatingTransformer could handle an optional xpath expression to specify which nodes to treat as rootnodes for validation.
Would this approach work?
Kind regards,
Robby Pelssers
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: validating xml
Posted by Robby Pelssers <ro...@ciber.com>.
Hi Andreas,
your suggestion would of course work and i did consider it as a non-preferred solution. To answer your question:
I don't have to generate the input myself. The original xml input comes from filesystem or an xml database so it's just fetching the file but in my case i would have to fetch the file up to 10 times in some cases (map with lots of topics).
I did not yet try how this will affect performance but I could give it a try.
Thx for thinking along.
Robby
-----Oorspronkelijk bericht-----
Van: Andreas Hartmann [mailto:andreas@apache.org]
Verzonden: ma 9-5-2011 15:37
Aan: users@cocoon.apache.org
Onderwerp: Re: validating xml
Hi Robby,
Am 14.04.11 13:43, schrieb Robby Pelssers:
> Hi all,
>
> i've got an interesting use case where my starting point is XML data (could be 1 single file, aggregated xml data, xquery results, ...)
>
> From this input I have to generate a DITA map and topics for which I have a map.dtd and topic.dtd which I can use for validation purposes.
>
>
> At some point in time during all transformation steps I have something like below simplified snippet immediately before I want to use the source-writing transformer. I need to validate the map and topics before writing the files to disc.
> <Root>
> <map>...</map>
> <topic>...</topic>
> <topic>...</topic>
> ...
> </Root>
>
>
> I can't simply use the approach below
> <map:transform src="schemas/topic.xsd" type="validate"/> (similar for map) since I still have an aggregated situation.
>
> Did anyone ever have a similar situation and a solution for this?
>
> Ideally the org.apache.cocoon.transformation.ValidatingTransformer could handle an optional xpath expression to specify which nodes to treat as rootnodes for validation.
>
> Would this approach work?
yes, I assume that this approach would work.
A relatively simple alternative would be to modularize the page
generation. The drawback is probably a decreased performance, especially
when generating the initial XML is expensive.
1. Transform the initial XML data into an XML structure containing
include tags for the single fragments which need to be validated (map,
topic etc.)
2. The include transformation calls a separate pipeline for each
fragment type; these pipelines contain the validation transformation
step. Unfortunately, the initial XML needs to be re-generated in each of
these calls.
Maybe this works for you?
Best regards,
Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: validating xml
Posted by Andreas Hartmann <an...@apache.org>.
Hi Robby,
Am 14.04.11 13:43, schrieb Robby Pelssers:
> Hi all,
>
> i've got an interesting use case where my starting point is XML data (could be 1 single file, aggregated xml data, xquery results, ...)
>
> From this input I have to generate a DITA map and topics for which I have a map.dtd and topic.dtd which I can use for validation purposes.
>
>
> At some point in time during all transformation steps I have something like below simplified snippet immediately before I want to use the source-writing transformer. I need to validate the map and topics before writing the files to disc.
> <Root>
> <map>...</map>
> <topic>...</topic>
> <topic>...</topic>
> ...
> </Root>
>
>
> I can't simply use the approach below
> <map:transform src="schemas/topic.xsd" type="validate"/> (similar for map) since I still have an aggregated situation.
>
> Did anyone ever have a similar situation and a solution for this?
>
> Ideally the org.apache.cocoon.transformation.ValidatingTransformer could handle an optional xpath expression to specify which nodes to treat as rootnodes for validation.
>
> Would this approach work?
yes, I assume that this approach would work.
A relatively simple alternative would be to modularize the page
generation. The drawback is probably a decreased performance, especially
when generating the initial XML is expensive.
1. Transform the initial XML data into an XML structure containing
include tags for the single fragments which need to be validated (map,
topic etc.)
2. The include transformation calls a separate pipeline for each
fragment type; these pipelines contain the validation transformation
step. Unfortunately, the initial XML needs to be re-generated in each of
these calls.
Maybe this works for you?
Best regards,
Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org