[Gambas-user] xml-bug
Mike Keehan
Mike at ...680...
Wed Jan 16 14:17:26 CET 2008
Hi Jaap.
This is a routine, slightly cut down, from a project that I am using.
It works well for me :)
PRIVATE SUB TransformXML2HTML(pFname AS String)
DIM lDoc AS XmlDocument
DIM lDocXsl AS XmlDocument
DIM lXslt AS XmlDocument
lDoc = NEW XmlDocument
lDoc.Open("path-to-an XML file.xml")
lXslt = NEW XmlDocument
lXslt.Open("path to an XSL file.xsl")
IF NOT ERROR THEN
lDocXsl = Xslt.Transform(lDoc, lXslt)
lDocXsl.Write("path to output HTML file.html")
ENDIF
END
Hope this helps.
Mike.
Jaap Cramer wrote:
> Hi again
>
> I want to report some other bug.
> I'm using the XML-modules and after exiting a sub-routine Gambas gives an error, exeption #11
> I don't know how to use the GB.XML and GB.XML.XSTL since documentation is very poor. Is there someone who can make this?
>
> I discovered at some fora 2 ways of reading an XML file.
>
> the First is using class XMLDocument. With this way I get this error 11. Maybe because there is no xmldocument.close() ???
> The second way is by using XMLReader. I find this a awkward method, because y have to read every single node, and you cant use XSLT, because XSLT.Transform() needs two xmldocuments as arguments...
>
> How can I use XSLT and XML files?
>
> greetings
> Jaap
>
> _______________________________
>
> code:
> PUBLIC s AS string
>
> PUBLIC SUB XML_Query(f AS String)
> DIM x_Doc AS NEW XmlDocument
> DIM x_Xslt AS NEW XmlDocument
> DIM x_Q AS NEW XmlDocument
> DIM x_slt AS NEW Xslt
>
> x_Doc.Open(f)
> x_xslt.Open("xslt.xml")
> x_Q = x_slt.Transform(x_Doc, x_xslt)
>
> s = x_Q.ToString("UTF-8")
> END
> _______________________________
>
> Info:
> Ubuntu 7:10
> Gambas 2.0.0
>
>
> _________________________________________________________________
More information about the User
mailing list