Apologies if this is a FAQ - but I couldn't find anything that exactly
addressed my problem in the archives or docs.
I want to take a DOM document from DOMParser and transform it with Xalan.
The Xalan basic usage patterns describe how to do this - but I couldn't get
that code to compile. With some minor changes, I ended up with this:
1 XMLPlatformUtils::Initialize();
2
3 XalanTransformer::initialize();
4
5 DOMParser theParser;
6 theParser.setToCreateXMLDeclTypeNode(false);
7 theParser.parse(argv[1]);
8 DOM_Document theDOM = theParser.getDocument();
9
10 XercesDOMSupport theDOMSupport;
11 XercesParserLiaison theParserLiaison(theDOMSupport);
12 XalanDocument* theDoc =
theParserLiaison.createDocument(theDOM);
13
14 XSLTInputSource theInputSource(theDoc);
15
16 XalanTransformer theXalanTransformer;
17
18 theResult = theXalanTransformer.transform(theInputSource,
"stylesheet.xsl", cout);
But I get the error:
error C2664: '__thiscall XSLTInputSource::XSLTInputSource(const unsigned
short *)' : cannot convert parameter 1 from 'class XalanDocument *' to
'const unsigned short *'
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
Looking in the apidocs I don't see 'const unsigned short *' as a possible
constructor, so I don't know what's going on. I tried casting like this:
14 XSLTInputSource theInputSource((XalanNode*)theDoc);
which compiled, but it fails at runtime with
Fatal Error at (file , line 0, column 0): An exception occured!
Type:RuntimeExce
ption, Message:The primary document entity could not be opened. Id={null}
Error:
An exception occured! Type:RuntimeException, Message:The primary document
entity
could not be opened. Id={null}
Can anyone spot my error, or point me to the right place in the
documentation/faq?
Thanks,
David.
---------------------------------------
The information contained in this e-mail message, and any attachment thereto,
is confidential and may not be disclosed without our express permission. If
you are not the intended recipient or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified that
you have received this message in error and that any review, dissemination,
distribution or copying of this message, or any attachment thereto, in whole or
in part, is strictly prohibited. If you have received this message in error,
please immediately notify us by telephone, fax or e-mail and delete the message
and all of its attachments. Thank you.
Every effort is made to keep our network free from viruses. You should,
however, review this e-mail message, as well as any attachment thereto, for
viruses. We take no responsibility and have no liability for any computer
virus which may be transferred via this e-mail message.