That's exacly what I did, with the addition of adding a parameter to the
constructors of XalanDefaultParsedSource and XercesDOMParsedSource to
determine the validation state. The XalanTransformer instance then passes
in its m_useValidation flag to the constructors.
I can probably commit these changes, then later enhance things to support
an ErrorListener. Is there anyone else out there who has an opinion on
this?
Dave
Paul Emberson
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
uk> cc: (bcc: David N Bertoni/CAM/Lotus)
Subject: Re: Validation and
XalanTransformer.
09/05/2001
04:42 AM
Please
respond to
xalan-dev
Dave,
This isn't what I would consider a proper well implemented patch. I
removed the const specifier for m_parsedSource in the .hpp
file so m_parsedSource could be initialised in the main body of the
constructor. Before initialising it, I told the parser
to validate No way of turning it off. Code below.
XalanDefaultParsedSource::XalanDefaultParsedSource(const
XSLTInputSource& theInputSource):
XalanParsedSource(),
m_domSupport(),
m_parserLiaison(m_domSupport)
{
m_parserLiaison.setUseValidation(true);
m_parsedSource =
m_parserLiaison.mapDocument(m_parserLiaison.parseXMLStream(theInputSource));
assert(m_parsedSource != 0);
m_domSupport.setParserLiaison(&m_parserLiaison);
}
In my opinion, the XalanTransformer transform() methods should not be
clogged up with parameters to do with the parsing. Instead you could add
set methods to XalanTransformer, which would call other set methods for
lower level classes. It would be nice if it had all the functionality of
testXSLT. Something along the lines of
XalanTransformer theXalanTransformer;
theXalanTransformer.setUseValidation(true);
... set any other parameters
theXalanTransformer.transform(....
As to ErrorHandler and exceptions, I'm not sure. I guess if a stylesheet
was not relying on the validation (mine does) but only using it as a check
then the program may wish to recover and continue the transformation.
Just my opinions,
Paul
At 13:12 04/09/01 -0400, you wrote:
>Paul,
>
>Can you post your patches for XalanDefaultParsedSource to see if we can
>jump-start a discussion about how this should be implemented and behave?
>
>For example, would allowing the user to install a custom ErrorHandler be a
>useful feature? Should validation failure by default throw an exception?
>
>Dave
>
>
>
>
|---------+--------------------------------------------------------------->
>| |
xalan-dev-return-15932-David_N_Bertoni=lotus.com@xml|
>| | .apache.org
|
>| |
|
>| | 09/04/2001 11:39 AM
|
>| | Please respond to xalan-dev
|
>| |
|
>
|---------+--------------------------------------------------------------->
>
> >
--------------------------------------------------------------------------------------|
> |
> |
> | To: [EMAIL PROTECTED]
> |
> | cc: (bcc: David N
> Bertoni/CAM/Lotus) |
> | Subject: Re: Validation and
> XalanTransformer. |
>
> >
--------------------------------------------------------------------------------------|
>
>
>
>
>There's no current validation call for XalanTransformer, although I'll be
>adding one in the next couple of days.
>
>Dave
>
>
>
>
> Paul Emberson
>
> <[EMAIL PROTECTED]> To:
>[EMAIL PROTECTED]
> cc: (bcc: David N
>Bertoni/CAM/Lotus)
> 09/03/2001 10:27 Subject: Validation and
>XalanTransformer.
> AM
>
> Please respond
>
> to xalan-dev
>
>
>
>
>
>
>What is the simplest code needed to perform a xsl transformation while
>validating the XML. (I want default attributes in the DTD)
>
>There does not appear to be a way using the XalanTransformer
>interface. Currently I have hacked XalanDefaultParsedSource so
>XalanTransformer always validates.
>
>Looking for a neater method.
>
>Paul Emberson