Please make sure you respond to the list, not to my personal address.
Since XalanDocument is an abstract base class, saying your "requirement is
to transform a document of type XalanDocument*" is not really meaningful.
If you have already parsed a document with the Xerces parser, and you want
to transform that, then following the link to the usage pattern I pointed
out, or look at the sample application I mentioned. Using the Xerces DOM
for transformations, if there is no need, is a waste of processing cycles,
as it's not terribly efficient.
The XalanNode* constructor for XSLTInputSource will be deprecated and
disappear in future release -- that's the reason for the wrapper class.
Dave
Ashay
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
.com> cc:
Subject: Re: problem with XSLT
tranformation using Xalan
04/22/2003 08:50
AM
Hi David,
I tried out the tranformation of an xml file the same way you've stated
below and it worked fine.
But my requirement is to transform a document of type XalanDocument* . An
XSLTInputSource object can be created with a XalanDocument object which can
then be passed to the transform() method. But this does not seem to be
working and gives me the error that I mentioned.
Any ideas what could be causing this error or what I might be missing in my
code.
[EMAIL PROTECTED] wrote:
Unless you really need to use the Xerces DOM, you should avoid it. Here's
a much simpler version without it:
XalanTranformer::intialize();
{
XalanTransformer theTransformer;
int theResult =
theTransformer.transform("foo.xml","foo.xsl","foo.out");
cout << "theResult is: " << theResult ;
}
XalanTransformer::terminate();
If you really need to use the Xerces DOM, see the ParsedSourceWrappers
sample, or this usage pattern:
http://xml.apache.org/xalan-c/usagepatterns.html#xercesdomwrapperparsedsource
Dave
Ashay
.com> cc: (bcc: David N Bertoni/Cambridge/IBM)
Subject: problem with XSLT tranformation using Xalan
04/22/2003 04:32
AM
Hi,
I am very new to Xerces and Xalan.
I am using Xerces 2.1.! 0 and Xalan 1.4.0.
Based on one of the examples given on the Apache site, I wrote the below
given simple code and got the following error message while transforming a
XalanDocument.
I am getting -2 as a result of XalanTransformer::tranform() method.
Error msg:
Fatal Error at (file , line 0, column 0): An exception occurred!
Type:RuntimeException, Message:The primary document entity could not be
opened. Id={null}
theResult = -2
Could someone give me pointers as to why this error is caused. A speedy
reply would be highly appreciated.
Thanks in advance.
The code:
**************************************************************************
// Use the Xerces DOM parser to create a DOM_Document.
#include
#include
DOMParser theParser;
// You MUST instruct the Xerces DOMParser NOT to create a DOM_XMLDecNode
// in the DOM to represent the XML declaration. See! "Limitations" below.
DOMParser::setToCreateXMLDeclTypeNode(false);
theParser.parse("foo.xml");
const DOM_Document theDOM = theParser.getDocument();
// Set up a XercesParserLiaison and use it to wrap the DOM_Document
// in a XalanDocument.
XercesDOMSupport theDOMSupport;
XercesParserLiaison theParserLiaison(theDOMSupport);
XalanDocument* theDoc = theParserLiaison.createDocument(theDOM);
// Use the XalanDocument to create an XSLTInputSource object, which
// you can then use in a transformation.
XSLTInputSource theInputSource(theDoc);
XSLTInputSource theXSLInput("foo.xsl");
XSLTResultTarget theOutput("foo.out");
XalanTranformer::intialize();
XalanTransformer theTransformer
int theResult =
theTransformer.transform(theInputSource,theXSLInput,theOutput);
cout << "theresult is: " << theResult ;
****************************************************************************
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.