Re: Re: [xsl] Does XSLT support schema validation

Subject: Re: Re: [xsl] Does XSLT support schema validation
From: santony@xxxxxxxxxxxxx
Date: Thu, 20 Nov 2003 22:29:18 -0500
Thanks a real lot Mike:
Thanks a lot for the detailed reply John:

After looking around enough, I think this is the best solution.

1. Parse the input XML as a DOM tree, using a validating parser.
2. Read or change the values as needed at this stage, on the resulting DOM tree.
3. Do the XSLT transformation and get the result as a DOM tree.
4. Read or change the values as needed at this stage, on the output DOM tree.
5. Serialize the tree into XML

Now my only concern is efficiency.

Another technique that occured to me is using JAXB..
1. Compile the input and output schemas into java object trees using JAXB.
2. Unmarshal the input XML to form the input side object tree.
3. Once input object tree is formed, change/read the values as required
4. Manually copy ( this step is equivalent to XSLT ) the values from the input tree to form the output object tree.
5. Marshal the output tree to output XML.

Can anybody share their thoughts on this solution.

Thanks again
--sony









> 
> From: Mike Rawlins <mcr@xxxxxxxxxxxxxxxxxxxxxxx>
> Date: 2003/11/20 Thu PM 08:36:03 EST
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Does XSLT support schema validation
> 
> At 08:16 PM 11/20/2003 -0500, you wrote:
> >1. I have a java application that will be using XSLT, through the Java JAXP
> >classes.
> >We would like to make sure that both the input and output XMLs are in
> >aggreement to 2 respective schemas. Is it possible to do this using XSLT.
> >If possible are there any JAXP interfaces for this mechanism.
> 
> No, you don't do this using XSLT.  You do it on the source document before 
> it is processed by XSLT, and on the result document after.  You can use 
> JAXP, but how you use it will depend on the rest of your code.
> 
> 
> >2. While doing the above conversion, we would like to extract some
> >values from the input XML to a Java string variable. Similarly we would 
> >like to
> >insert some values contained within the Java variables to the produced
> >XML. Is this possible at all.
> 
> Yes, certainly.  However, this again sounds like a JAXP issue that is 
> independent of XSLT.  You can use DOM, SAX, or whatever to retrieve values 
> from the source document and insert values into the result document.
> 
> 
> 
> ---------------------------------------------------------------
> Michael C. Rawlins, Rawlins EC Consulting
> www.rawlinsecconsulting.com
> Using XML with Legacy Business Applications (Addison-Wesley, 2003)
> www.awprofessional.com/titles/0321154940
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread