Can XML been imported/transformed with API

Fernand Vanrie sos at pmgroup.be
Fri Feb 21 06:02:55 PST 2014


Hallo,

In the past there was he "com.sun.star.comp.JAXTHelper" to make a 
translation of a XML this stuff is now removed from LO

SaxtHelper is replaced by 
com.sun.star.comp.documentconversion./LibXSLTTransformer/

In the past there was some code (below originated from the Hanja 
Hermione website) to work with this JAXThelper i tried  the same code 
but now using com.sun.star.comp.documentconversion./LibXSLTTransformer/


No errors but i end up with a empty "out.txt" file

can someone explain how to work with the new stuff or is it simply not 
possible to make XML transformations using the API.

(the SaxParser is working but to slow for big files)

Greetz

And thanks for any advice

Fernand

Sub Main
   bStarted = True
   oSFA = CreateUnoService( _
     "com.sun.star.ucb.SimpleFileAccess" )
   
   oIn = oSFA.openFileRead("file:///C:/usr/content.xml")
   oOut = oSFA.openFileWrite("file:///C:/usr/out.txt")
   
   Dim aNamed(6) As New com.sun.star.beans.NamedValue
   aNamed(0).Name = "StylesheetURL"
   aNamed(0).Value ="file:///C:/yourXSLT.xsl"
   aNamed(1).Name = "SourceURL"
   aNamed(1).Value ="file:///C:/usr/yourcontent.xml"
   aNamed(2).Name = "TargetURL"
   aNamed(2).Value ="file:///C:/out.txt"
   aNamed(3).Name = "SourceBaseURL"
   aNamed(3).Value ="file:///C:/"
   aNamed(4).Name = "TargetBaseURL"
   aNamed(4).Value ="file:///C:/"
   aNamed(5).Name = "SystemType"
   aNamed(5).Value = ""
   aNamed(6).Name = "PublicType"
   aNamed(6).Value = ""
   
   oStreamListener = CreateUnoListener( "Stream_", _
     "com.sun.star.io.XStreamListener" )
   
   oJAXHelper = CreateUnoService( _
       "om.sun.star.comp.documentconversion./LibXSLTTransformer/  " )
   oJAXHelper.initialize(aNamed)
   oJAXHelper.addListener(oStreamListener)
   oJAXHelper.setInputStream(oIn)
   oJAXHelper.setOutputStream(oOut)
   
   ' start translation
   oJAXHelper.start()
   
   ' needs to wait the end of translation
   While bStarted
     wait 100
   WEnd
   
   oJAXHelper.removeListener(oStreamListener)
   oIn.closeInput()
   oOut.closeOutput()
End Sub


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20140221/800c44a8/attachment.html>


More information about the LibreOffice mailing list