xml-xalan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven J. Hathaway (Closed) (JIRA)" <xalan-...@xml.apache.org>
Subject [jira] [Closed] (XALANC-191) Reuse parser and cache XML schema in XalanC
Date Mon, 31 Oct 2011 00:15:32 GMT

     [ https://issues.apache.org/jira/browse/XALANC-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Steven J. Hathaway closed XALANC-191.
-------------------------------------

    Resolution: Won't Fix

Reissue if this continues to be a problem with the current release or CurrentSVN
                
> Reuse parser and cache XML schema in XalanC
> -------------------------------------------
>
>                 Key: XALANC-191
>                 URL: https://issues.apache.org/jira/browse/XALANC-191
>             Project: XalanC
>          Issue Type: Bug
>          Components: XalanC
>    Affects Versions: 1.4.x
>         Environment: Operating System: All
> Platform: All
>            Reporter: Thomas Cherel
>
> It would be nice to expose in XalanC the latest Xerces features to cache 
> analyzed schema to be reused accross multiple parsing/validation.
> It would also mean the reuse of the same parser instance for multiple XSLT 
> processing in XalanC and even within specific XSLT function such as the 
> document() one.
> Here is a short version of an email exchange in the mailing list describing 
> the issue with more details as well as providing a "workaround" to do it.
> -----Original Message-----
> From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com] 
> Sent: Tuesday, October 22, 2002 4:35 PM
> To: xalan-c-users@xml.apache.org
> Subject: RE: Schema validation performance
> Hi Thomas,
> You can use Xerces to parse a document without switching to the internal
> interfaces.  Here's some pseudo-code, which I haven't tested, but which
> should give you an idea of what you need to do:
> void
> parse(
>       const InputSource&                 theInputSource,
>       XalanCompiledStylesheet*  theStylesheet,
>       const XSLTResultTarget&    theResultTarget)
> {
>    SAX2XMLReader* const   theReader =  XMLReaderFactory::createXMLReader();
>    XalanTransformer   theTransformer;
>    XalanDocumentBuilder* const   theBuilder =
>    theTransformer.createDocumentBuilder();
>    theReader->setContentHandler(theBuilder.getContentHandler());
>    theReader->setLexicalHandler(theBuilder.getLexicalHandler());
>    theReader->setDTDHandler(theBuilder.getDTDHandler());
>    const XalanDOMString
>    reuseGrammar("http://apache.org/xml/features/validation/reuse-grammar");
>    const XalanDOMString
>    namespacePrefixes("http://xml.org/sax/features/namespace-prefixes");
>    theReader->setFeature(reuseGrammar.c_str(), true);
>    theReader->setFeature(namespacePrefixes.c_str(), true);
>    theReader->parse(theInputSource)
>    delete theReader;
>    theTransformer.transform(*theBuilder, theStylesheet, theResultTarget); }
> Of course, since I'm not really re-using the parser, it doesn't used the
> cached grammar, but it gives you an idea of how you can do this.  The only
> drawback is that document brought into the transformation through the
> document() function will not use this parser instance, and so will not use
> the cached grammar.
> Dave
> -----Original Message-----
> From: Thomas Cherel
> Until it gets added to Xalan, is there any way I can use the Xerces
> interface directly? For example, today, I can provide to Xalan an already
> parsed document (a DOM tree). Can I use the new Xerces API to generate such
> a DOM tree (and reuse schema/grammar for the validation that will be done at
> that time), and then pass it to Xalan (that will take care of the XSLT
> processing only)?
> Thomas
> -----Original Message-----
> From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com]
> Sent: Tuesday, October 22, 2002 1:19 PM
> To: xalan-c-users@xml.apache.org
> Subject: Re: Schema validation performance
> Hi Thomas,
> With the latest Xerces, you can prime a parser instance with a particular
> schema, then have it re-use that schema over and over again.  You can also
> have it re-use a grammar for every document it parses.  However, these
> interfaces are new and still experimental, so I don't have much experience
> using them.
> We don't expose lots of the Xerces parser interfaces because it gets very
> burdensome to do so.  However, this one is probably worth doing, so you
> might want to enter a Bugzilla request for an enhancement.
> Dave
> -----Original Message-----
> From: Thomas Cherel
> When processing an XML document (applying a style sheet), I can turn on the
> validation of the XML document against its schema. Is there any way (or may
> be this is already done under the cover) to cache the XML schema for
> validation of other XML documents?
> What I mean is that if I process a bunch of XML documents in sequence, and
> all of them are using the same XML schema, it will be nice if the schema is
> downloaded and analyzed only once instead of for each document.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


Mime
View raw message