[newbie] Installing Xalan under Windows

View: New views
9 Messages — Rating Filter:   Alert me  

[newbie] Installing Xalan under Windows

by Sarko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody!

I hope I'm in the right forum. I've searched, I've read but still I didn't manage to run the Xalan examples under Windows (use Linux you will say, but you can't change enterprises policies). I think I set the CLASSPATH properly: C:\Programmi\xalan;C:\Programmi\xalan\xalansamples.jar;C:\Programmi\xalan\xalanservlet.jar;C:\Programmi\xalan\xalan.jar;C:\Programmi\xalan\serializer.jar;C:\Programmi\xalan\xml-apis.jar;C:\Programmi\xalan\xercesImpl.jar

If I execute this command

C:\> java SimpleTransform

the output is:
------------------------------------------------
exception in thread "main" java.lang.NoClassDefFounderror: SimpleTransform
Caused by: java.lang.ClassNotFoundException: SimpleTransform
...
...
Could not find the main class: SimpleTransform. Program will exit.
-----------------------------------------
Unfortunately I'm new in the magic world of Apache and I don't even understand where the problem lies... Do you have any idea about how to solve this issue?

Thank you so much!

Re: [newbie] Installing Xalan under Windows

by David Bertoni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sarko wrote:
> Hi everybody!
>
> I hope I'm in the right forum. I've searched, I've read but still I didn't
> manage to run the Xalan examples under Windows (use Linux you will say, but
> you can't change enterprises policies). I think I set the CLASSPATH
> properly:
> C:\Programmi\xalan;C:\Programmi\xalan\xalansamples.jar;C:\Programmi\xalan\xalanservlet.jar;C:\Programmi\xalan\xalan.jar;C:\Programmi\xalan\serializer.jar;C:\Programmi\xalan\xml-apis.jar;C:\Programmi\xalan\xercesImpl.jar
You need to ask this question on the Xalan-J user list, not the Xalan-C
user list.

>
> If I execute this command
>
> C:\> java SimpleTransform
>
> the output is:
> ------------------------------------------------
> exception in thread "main" java.lang.NoClassDefFounderror: SimpleTransform
> Caused by: java.lang.ClassNotFoundException: SimpleTransform
> ...
> ...
> Could not find the main class: SimpleTransform. Program will exit.
> -----------------------------------------
> Unfortunately I'm new in the magic world of Apache and I don't even
> understand where the problem lies... Do you have any idea about how to solve
> this issue?
You might try the -cp command line option, rather than the CLASSPATH
environment variable. There are also some hints in the documentation:

http://xml.apache.org/xalan-j/samples.html

Dave

Xalan performance issue on large files...

by Rob.Conde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey David,
        I'm seeing some really bad performance while attempting to transform
a 30 megabyte xml file. As a benchmark, I tried running just the identity
transformation against my file in both .NET 2.0 and in Xalan. .NET took ~3
seconds...I killed the Xalan after 25 minutes. I didn't try digging into the
Xalan code at all, but obviously some algorithm isn't scaling very nicely.

Rob Conde



Re: Xalan performance issue on large files...

by David Bertoni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Rob.Conde wrote:
> Hey David,
> I'm seeing some really bad performance while attempting to transform
> a 30 megabyte xml file. As a benchmark, I tried running just the identity
> transformation against my file in both .NET 2.0 and in Xalan. .NET took ~3
> seconds...I killed the Xalan after 25 minutes. I didn't try digging into the
> Xalan code at all, but obviously some algorithm isn't scaling very nicely.
That seems strange, since the identity transformation isn't really
taxing the processor.  Can you provide the XML file, or an obfuscated
version of it, if it contains sensitive information?

Dave

Parent Message unknown Re: Xalan performance issue on large files...

by Rob.Conde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey David,
   Here's an example file...~30mb unzipped...nicely zipped to 98kb. To make sure I'm not messing up on the code side here's basically what i'm doing:

   XMLPlatformUtils::Initialize();

   XalanTransformer::initialize();
   XalanTransformer XSLTransformer;

   std::string indentityXslPath = "D:\\Identity.xsl";

   XSLTInputSource xslIn(indentityXslPath.c_str());

   const XalanCompiledStylesheet * compiled_xslIn;

   XSLTransformer.compileStylesheet(xslIn, compiled_xslIn);

   XalanDOMString domStr;
   DOMStringPrintWriter domSPW(domStr);
   XSLTResultTarget objectOut(&domSPW);

   XSLTInputSource xmlIn("D:\\bigXml.txt");
   XSLTransformer.transform(xmlIn, compiled_xslIn, objectOut);

   XalanTransformer::terminate();

   XMLPlatformUtils::Terminate();


It gets to the transform and goes into never never land.

Thanks for the help,
Rob



bigXml.zip (133K) Download Attachment

RE: Xalan performance issue on large files...

by Rob.Conde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey David,
        I understand if you haven't gotten to it yet, but I wanted to make
sure you got my example file and perhaps confirmed or were unable to confirm
the performance issue with it...

Thanks,
Rob Conde



Re: Xalan performance issue on large files...

by David Bertoni-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 17, 2009 at 6:39 AM, Rob.Conde <Rob.Conde@...> wrote:
Hey David,
       I understand if you haven't gotten to it yet, but I wanted to make
sure you got my example file and perhaps confirmed or were unable to confirm
the performance issue with it...
Hi Rob,

I just took an initial look at this.

I built Xalan-C on an Ubuntu 9.10 VMware virtual machine on my laptop, which is a Lenovo T60p with a Core Duo 2600 (2.16GHz) with 2GB of memory.

I then created a stylesheet that does an identity transformation and ran the Xalan command line application to transform to a file, reporting the timings:

dbertoni@ubuntu-vmware:~/apache/test$ Xalan -t -o copy.xml bigXml.txt identity.xsl
Source tree parsing time: 1900 milliseconds.
Stylesheet compilation time: 0 milliseconds.
Transformation time: 3620 milliseconds.

So you can see the transformation time is trivial. I plan now to build your sample code as an application and test it. It may be there is some inefficiency in transforming to a XalanDOMString through PrintWriter interface.

Can you please verify that an identity transform in your environment through the Xalan command  line executable exhibits similar performance to my Ubuntu virtual machine?

Thanks!

Dave


RE: Xalan performance issue on large files...

by Rob.Conde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi David,

            I built the XalanTransformer sample and indeed the performance seems fine there. Also I tried passing a stringstream instead of the DOMStringPrintWriter and it seems to work fine…though I’m not sure if this will handle encoding correctly.

 

So I think you’re probably on the right track. Note that the code I posted crashes at the end since terminate is called before the XSLTInputSource goes out of scope – but this is unrelated to the original problem.

 

Rob

 


From: David Bertoni [mailto:dbertoni.apache@...]
Sent: Tuesday, November 17, 2009 9:47 PM
To: xalan-c-users@...
Subject: Re: Xalan performance issue on large files...

 

On Tue, Nov 17, 2009 at 6:39 AM, Rob.Conde <Rob.Conde@...> wrote:

Hey David,
       I understand if you haven't gotten to it yet, but I wanted to make
sure you got my example file and perhaps confirmed or were unable to confirm
the performance issue with it...

Hi Rob,

I just took an initial look at this.

I built Xalan-C on an Ubuntu 9.10 VMware virtual machine on my laptop, which is a Lenovo T60p with a Core Duo 2600 (2.16GHz) with 2GB of memory.

I then created a stylesheet that does an identity transformation and ran the Xalan command line application to transform to a file, reporting the timings:

dbertoni@ubuntu-vmware:~/apache/test$ Xalan -t -o copy.xml bigXml.txt identity.xsl
Source tree parsing time: 1900 milliseconds.
Stylesheet compilation time: 0 milliseconds.
Transformation time: 3620 milliseconds.

So you can see the transformation time is trivial. I plan now to build your sample code as an application and test it. It may be there is some inefficiency in transforming to a XalanDOMString through PrintWriter interface.

Can you please verify that an identity transform in your environment through the Xalan command  line executable exhibits similar performance to my Ubuntu virtual machine?

Thanks!

Dave



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


Re: Xalan performance issue on large files...

by David Bertoni-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Nov 19, 2009 at 2:09 AM, Rob.Conde <Rob.Conde@...> wrote:

Hi David,

            I built the XalanTransformer sample and indeed the performance seems fine there. Also I tried passing a stringstream instead of the DOMStringPrintWriter and it seems to work fine…though I’m not sure if this will handle encoding correctly.

As long as you treat the string as a sequence of binary bytes, you won't have any issues.

The interesting thing about transforming to a XalanDOMString is that you override the output transcoding mechanism, since XalanDOMString can only contain UTF-16 code points. This can be problematic if your stylesheet doesn't specify UTF-16 as the output encoding. To parse the resulting document, you would need to explicitly force the encoding on the InputStream by calling InputStream::setEncoding() and passing in "UTF-16".
 

So I think you’re probably on the right track. Note that the code I posted crashes at the end since terminate is called before the XSLTInputSource goes out of scope – but this is unrelated to the original problem.

I will investigate the performance issues, but I suspect it has to do with re-sizing the XalanDOMString instance as it grows. You might try running your test application and adding a call to XalanDOMString::reserve() before you transform:

domStr.reserve(35000000);

This would reserve enough space in the instance so resizing would not occur.

Dave