That's a strange problem, alright. I never went looking for this one
before, but I'm sure it can be done.
I spent a few minutes digging around the framework and no easy solution
popped out.
One idea: Create an XML Document using the reader that results from the XSL
Transform. Then write the document to a memory stream. Then read the
memory stream using an XMLValidatingReader.
Seems kinda round-about. If anyone has a better idea: please step up!
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"badbetty" <bc*@genie.co.uk> wrote in message
news:5d**************************@posting.google.c om...
Martin Honnen <ma*******@yahoo.de> wrote in message
news:<#L**************@tk2msftngp13.phx.gbl>... badbetty wrote:
> How does one typecast the XMLREADER returned from the XSLTRANSFORM
> method 'transform' into XMLTEXTREADER, so it can be passed in to an
> XMLVALIDATINGREADER?
>
> I am getting an invalid cast.
When I look at the API documentation then both allow an XmlReader so
simply use that, I am not sure where you need or want to cast:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxslxsltransformclasstransformtopic6. asp>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlXmlValidatingReaderClassctorTopic1.a sp>
If you still have problems, show us the relevant code snippets so what
we can see what exactly you are trying to cast to what.
Thank you for the reply.
Excuse the dirty VB code/syntax/spelling (just to keep it brief and
for example only)
dim xpd as xpathdocument
dim xr as xmlreader
dim xvr as xmlvalidatingreader
dim xsl as xsltransform
xpd = new xpathdocument("http://bla bla")
xsl = new xsltransform()
xsl.load("http://bla bla bla")
xr = xsl.transform(xpd, nothing)
xvr = new xmlvalidatingreader(xr) << this fails !
it seems that xmlvalidatingreader constructor expects xmlreader - but
only as a xmltextreader (in the current dotnet implementation).
so tried to typecast (i used all different ways - this is one) just as
a check, even though it should not be required i agree :
xvr = new xmlvalidatingreader(ctype(xr,xmltextreader)) << this
fails too
anyway, as i was wanting to validate the resultant transfored xml it
looks like i can not do it at present. or have i missed a trick.
thank you.