Guy,

Part 1 of your question really has nothing to do with Xalan, per se. You're asking how to validate an XML instance document, as a DOM tree, against its schema. This depends entirely on your DOM implementation. But, assuming you're using JAXP and Xerces, without using Xerces-specific classes there aren't very many really graceful or efficient ways to do it. One way that I've done it is to serialize the DOM document into a stream buffer, then read/parse/validate the stream buffer into another DOM tree in the same way you might process an instance document from a disk file or another URL.

If you want to validate using the Xerces-specific classes, you might post this question to the Xerces-J list. I think that might also be a more appropriate place to get an answer to part 2 of your question.

Mike

At 04:56 AM 11/10/2003 -0500, Guy Sharon wrote:
Hi,

(Two part question)

How do I make sure the DOM tree held by the DOMResult object after transformation complies to an XML Schema? (e.g. to the eg.xsd schema below)

I have the following in xsl
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   version="1.0"
   xmlns:xalan="http://xml.apache.org/xslt";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        exclude-result-prefixes="xmlns">

        <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
               <root xmlns="http://example";
                    xmlns:eg="http://example";
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                    xsi:schemaLocation="http://example file:eg.xsd">
                 ...
               </root>
               ...
</xsl:transform>

Second part:
How do I use a grammar pool (preparsed schema) to have the DOMResult comply to.


Thanks,
Guy

_________________________________________________________________
Frustrated with dial-up? Get high-speed for as low as $26.95.
https://broadband.msn.com (Prices may vary by service area.)

--------------------------------------------------------------- Michael C. Rawlins, Rawlins EC Consulting www.rawlinsecconsulting.com Using XML with Legacy Business Applications (Addison-Wesley, 2003) www.awprofessional.com/titles/0321154940



Reply via email to