Ovanes Markarian wrote:
Hello,
I am using a Xalan to transform XML and afterwards would like to retrieve
infromation from the
transformed document using the XPathEvaluator. I have an instance of
XalanDocument and do not use
ParserLiasons (I know that Xalan uses them internally) etc. How can I
retrieve/create the
DOMSupport. I would like to use Xalan interface only, without additionally
introducing Xerces
classes and interfaces.
The easy way to do this would be to generate XML from your transformation,
then re-parse it for use with XPathEvaluator. However, if you know your
transformation will generate a well-formed XML document, you can generate a
XalanSourceTreeDocument instance directly from the transformation.
Take a look at the TransformToXercesDOM sample, which is close to what you
need. It does the additional step of serializing the resulting document,
but you won't want to do that. In addition, you'll want to use the class
FormatterToSourceTree, along with a XalanSourceTreeParserLiason and
XalanSourceTreeDOMSupport instance. It will look something like this:
XalanSourceTreeParserLiaison theLiason;
XalanSourceTreeDOMSupport theSupport(theLiaison);
FormatterToSourceTree theFormatter(theLiaison->createDocument());
// Do the transformation...
int theResult =
theTransformer.transform(
theParsedSource,
&theStylesheet,
theFormatter);
That should at least point you in the right direction.
Dave