Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


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


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.