Development

Software development issues

GWT – java.lang.NoClassDefFoundError when using .jars with eclipse

10.12.2009 19:19:19 com.google.apphosting.utils.jetty.JettyLogger warn
WARNUNG: Nested in javax.servlet.ServletException: init:
java.lang.NoClassDefFoundError: org/jibble/pircbot/PircBot
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)

project_right_clickThis exception can occure, when you try to use an .jar with GWT on the server side. The error message tells you, that the included path to your .jar (in this case org.jibble.pircbot.PircBot) can not be found. This normally happens, when you have forgotten to put the .jar into your build-path. When running GWT, the normal include into the build-path is not everything you need to do:

The normal way to include the .jar to your build-path is to edit the properties of your project, by right-clicking your project. In the Project Propertiesappearing window, you select “Java Build Path”. There you normally add your external .jars.

When using the GWT-Plugin in eclipse, this isn’t the only thing you have to do. Additionally, you need to copy the .jar into the WAR-directory of your project. The exact path is: YouProject/war/WEB-INF/lib/.

After putting the .jar into this directory, your local GWT-Runtime will work and not throw this error again. The reason is, that the GWT-Runtime of eclipse does not use the eclipse environment. It uses only the files of your “war”, which will be deployed to your application-server later.

Repair eclipse workbench – corrupted eclipse workspace

My workbench often gets corrupted, and all good advice on the net does not work, since the hints there are based on the fact, that eclipse starts up. But what happens, if eclipse refuses to start due to the corrupted workbench (the usual situation I have)?

First of all, check the log message. You’ll find your eclispe-log in your workbench-folder. It’s named “.metadata”. In this folder you’ll find a file called “.log”. Open this file and see if you can get some usefull information from there. Here is the file I just got today:

!ENTRY org.eclipse.osgi 4 0 2009-06-25 18:56:21.330
!MESSAGE Application error
!STACK 1
org.apache.commons.lang.exception.NestableError: Java Model Exception: Java Model Status [src/net/project/windows [in project] does not exist]
	at com.instantiations.designer.core.utils.execution.ExecutionUtils.runRethrow(ExecutionUtils.java:66)
	at com.instantiations.designer.core.editor.DesignPage.initialize(DesignPage.java:96)
	at com.instantiations.designer.core.editor.multi.MultiMode.create(MultiMode.java:74)
	at com.instantiations.designer.core.editor.multi.MultiPagesMode.create(MultiPagesMode.java:63)
	at com.instantiations.designer.core.editor.multi.MultiPageEditor.createPartControl(MultiPageEditor.java:57)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:661)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:428)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:594)
	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:306)
	at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
	at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
	at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
	at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
	at org.eclipse.ui.internal.PartStack.handleDeferredEvents(PartStack.java:1224)
	at org.eclipse.ui.internal.LayoutPart.deferUpdates(LayoutPart.java:400)
	at org.eclipse.ui.internal.PartSashContainer.handleDeferredEvents(PartSashContainer.java:1401)
	at org.eclipse.ui.internal.LayoutPart.deferUpdates(LayoutPart.java:400)
	at org.eclipse.ui.internal.WorkbenchPage.handleDeferredEvents(WorkbenchPage.java:1383)
	at org.eclipse.ui.internal.WorkbenchPage.deferUpdates(WorkbenchPage.java:1373)
	at org.eclipse.ui.internal.WorkbenchPage.access$14(WorkbenchPage.java:1364)
	at org.eclipse.ui.internal.WorkbenchPage$15.runWithException(WorkbenchPage.java:3261)
	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3342)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3071)
	at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
	at org.eclipse.ui.internal.Workbench$27.runWithException(Workbench.java:1363)
	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3342)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3071)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2295)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
Caused by: Java Model Exception: Java Model Status [src/net/siteduke/windows [in SiteDuke] does not exist]
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:491)
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.getUnderlyingResource(PackageFragmentRoot.java:678)
	at org.eclipse.jdt.internal.core.PackageFragment.getUnderlyingResource(PackageFragment.java:337)
	at org.eclipse.jdt.internal.core.Openable.getUnderlyingResource(Openable.java:333)
	at org.eclipse.jdt.internal.core.CompilationUnit.getUnderlyingResource(CompilationUnit.java:916)
	at com.instantiations.designer.core.editor.UndoManager.<init>(UndoManager.java:62)
	at com.instantiations.designer.core.editor.DesignPage$2.run(DesignPage.java:99)
	at com.instantiations.designer.core.utils.execution.ExecutionUtils.runRethrow(ExecutionUtils.java:64)
	... 52 more
 
!ENTRY org.eclipse.osgi 2 0 2009-06-25 18:56:21.409
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2009-06-25 18:56:21.409
!MESSAGE Bundle reference:file:plugins/org.eclipse.jdt.apt.pluggable.core_1.0.101.R34x_v20081108-1950.jar [216] was not resolved.
!SUBENTRY 2 org.eclipse.jdt.apt.pluggable.core 2 0 2009-06-25 18:56:21.410
!MESSAGE Missing imported package org.eclipse.jdt.internal.compiler.tool_0.0.0.
!SUBENTRY 2 org.eclipse.jdt.apt.pluggable.core 2 0 2009-06-25 18:56:21.410
!MESSAGE Missing imported package org.eclipse.jdt.internal.compiler.apt.dispatch_0.0.0.
!SUBENTRY 2 org.eclipse.jdt.apt.pluggable.core 2 0 2009-06-25 18:56:21.410
!MESSAGE Missing imported package org.eclipse.jdt.internal.compiler.apt.model_0.0.0.
!SUBENTRY 2 org.eclipse.jdt.apt.pluggable.core 2 0 2009-06-25 18:56:21.411
!MESSAGE Missing imported package org.eclipse.jdt.internal.compiler.apt.util_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2009-06-25 18:56:21.411
!MESSAGE Bundle reference:file:plugins/org.eclipse.jdt.compiler.apt_1.0.101.R34x_v20090114-1205.jar [218] was not resolved.
!SUBENTRY 2 org.eclipse.jdt.compiler.apt 2 0 2009-06-25 18:56:21.412
!MESSAGE Missing imported package org.eclipse.jdt.internal.compiler.tool_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2009-06-25 18:56:21.412
!MESSAGE Bundle reference:file:plugins/org.eclipse.jdt.compiler.tool_1.0.100.v_894_R34x.jar [219] was not resolved.
!SUBENTRY 1 org.eclipse.osgi 2 0 2009-06-25 18:56:21.412
!MESSAGE Bundle reference:file:plugins/com.instantiations.designer.swing.java6_7.0.0.200905010653.jar [417] was not resolved.

The usefull information in this special case is: org.apache.commons.lang.exception.NestableError: Java Model Exception: Java Model Status [src/net/project/windows [in project] does not exist] for any reason, eclipse can not open a special file on the workbench. After several tries I found a way to solve this problem:

  • Make a backup of your “.metadata“-folder (very important!!)
  • navigate into the “.plugins“-folder located inside “.metadata
  • delete the folder “org.eclipse.ui.workbench
  • startup eclipse again and check if there is still everything you need

Hint: BackUp your complete workbench often!

Please keep in mind: You use this advice at your very own risk ;)

Convert String into InputStream

In the last days I was asked several times: “How do I convert a string into an InputStream, so that I can parse my XML-String with the SAX parser?” (note: or any other XML-Parser like DOM, JAXP, JDOM, …).

Being tired of explaining the same thing again and again – here is the answer:

1
2
3
4
5
6
7
String myString = 'content of your very own string';
ByteArrayInputStream in = new ByteArrayInputStream(myString.getBytes());
InputSource is = new InputSource();
is.setByteStream(in);
 
Parser myParser = new Parser();
myParser.parse(is);

Quick & Easy :)

GWT and XML – First steps with com.google.gwt.xml

Developing web applications and portals using eclipse, GWT (google web toolkit) and apache tomcat is one of the most effective ways to get your work done: The result will always be a very high-performance AJAX application. To exchange data from the AJAX surface to the tomcat-server, I decided to use the GWT RPC, exchanging XML data structures.

Therefor GWT provides a nice package: com.google.gwt.xml.client.*

com.google.gwt.xml.client.* is a complete toolkit to deal with xml data-structures on the JavaScript clientside in a high perfomant way.

After having importing the needed packages as usual, I wrote some code to create a new XMLDom stucture. But when running the new code, the following error occured:

Line 52: No source code is available for type
com.google.gwt.xml.client.Document; did you forget to inherit a
required module?

Up to this point I was used to the fact, that eclipse did everything for me; so I had absolutly no idea what to do, since google returned no hints to this problem. I started to study the documentation and the project in detail and found the solution:

To “inherit” the XML module in GWT, you have to add the following line to the gwt.xml:

<inherits name="com.google.gwt.xml.XML" />

The gwt.xml file can be found under your project in the path: <project>/src/<your domain>/<project>.gwt.xml

After adding this line, dealing with XMLs  is really simple. I’ll post an article here with examples, as soon as I can get a little time for my blog again.

Best XML module for perl? XML::LibXML vs. XML::Mini::Document

In my last post, I took a look on XML::Simple, a (as called) simple and easy to understand module for perl to deal with XML structures. Today we’ll take a look on the module XML::Mini::Document.

Short information:
3 of 5 stars rating on cpan
Last modification date: 05 Feb. 2008

XML::Mini::Document is a module, that has more the “look and feel” of a XML-parser, but also offers to parse XML to and from Hash-structures. The documentation and the examples are well written, so you will get along with this module quite easy and fast.

We will use the same test-xml, we used for XML::Simple:

<?xml version="1.0" encoding="iso-8859-1"?>
<test debug="0" attr1="1" attr2="2" another="&lt;&gt;">
	<info attr1="perl" attr2="xml module" />
	<info attr1="perl" attr2="xml module" />
	<info attr1="perl" attr2="xml module" />
	<info attr1="perl" attr2="xml module"><deepinfo>last text here</deepinfo></info>
</test>

We’ll do the same operations as with XML::Simple before. The syntax is slightly different. The sourcecode of the new testcase looks therefor like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/perl
# Simple XML module test unit
###
# We are strict, cauz we are Elitecoderz!
use strict;
use XML::Mini::Document;
use XML::Mini;
 
################
# Get / Check Parameter (here we get the xml file we wanna deal with)
if ($#ARGV+1 != 1) {
	print "Error: Wrong number of parameters.\n";
	exit(1);
}
my $input = $ARGV[0];
chomp($input);
 
################
# Read Inputfile / check content / validate XML structure
# Some modules are able to read directly from a file; for easy going, we use this method here.
 
# Direct, dirty, but simple reading of a file
open(FILE, "<$input") || die "Error: File not readable.\n";
my @lines = <FILE>;
close(FILE);
 
# Put the lines into one string for this parser
my $XMLString = join(' ',@lines);
 
 
####################################################################
# XML::Mini
my $xmlDoc = XML::Mini::Document->new();
eval {
	$xmlDoc->parse($XMLString);
};
if ($@) {
	print "Error: XML parsing error: $@\n";
	exit(1);
}
 
my $xmlHash = $xmlDoc->toHash();
 
# Adding an attribute and a text to the first node
$xmlHash->{'test'}->{'info'}->[0]->{'addon'} = 'valid text';
$xmlHash->{'test'}->{'info'}->[0]->{'content'} = "Here is an valid xml text\nusing linebreaks";
 
# Adding an attribute and an unescaped text to the second node
$xmlHash->{'test'}->{'info'}->[1]->{'addon'} = 'invalid unescaped text';
$xmlHash->{'test'}->{'info'}->[1]->{'content'} = "Here is an valid xml text\nusing linebreaks\nand unescaped characters like < and >\ndo you see the and?";
 
# Adding a third node unescaped text to the second node
$xmlHash->{'test'}->{'info'}->[2]->{'addon'} = 'valid unescaped text in cdata';
$xmlHash->{'test'}->{'info'}->[2]->{'content'} = "<![CDATA[Here is an valid xml text\nusing linebreaks\nand unescaped characters like < and >\ndo you see the and?]]>";
 
# my $newDoc = XML::Mini::Document->new();
$xmlDoc->fromHash($xmlHash);
open(DATEI, ">output_XMLMini") || die "Datei nicht gefunden";
print DATEI $xmlDoc->toString();
close(DATEI);

After running the test, the resulting XML looks like this:

<test>
	<info>
		<attr2>
			xml module
		</attr2>
		<addon>
			valid text
		</addon>
		<attr1>
			perl
		</attr1>
		<content>
			Here is an valid xml text using linebreaks
		</content>
	</info>
	<info>
		<attr2>
			xml module
		</attr2>
		<addon>
			invalid unescaped text
		</addon>
		<attr1>
			perl
		</attr1>
		<content>
			Here is an valid xml text using linebreaks and unescaped characters like &lt; and &gt; do you see the and?
		</content>
	</info>
	<info>
		<attr2>
			xml module
		</attr2>
		<addon>
			valid unescaped text in cdata
		</addon>
		<attr1>
			perl
		</attr1>
		<content>
			&lt;![CDATA[Here is an valid xml text using linebreaks and unescaped characters like &lt; and &gt; do you see the and?]]&gt;
		</content>
	</info>
	<info>
		<attr2>
			xml module
		</attr2>
		<attr1>
			perl
		</attr1>
		<deepinfo>
			last text here
		</deepinfo>
	</info>
	<attr2>
		2
	</attr2>
	<attr1>
		1
	</attr1>
	<another>
		&amp;lt;&amp;gt;
	</another>
	<debug>
		0
	</debug>
</test>
<xml>
	<version>
		1.0
	</version>
	<encoding>
		iso-8859-1
	</encoding>
</xml>

*Outch* – what the heck did happen to our XML?! After the first shock, we see, that the attributes are all put into a new generated node. This is a valid syntax, and all information is still kept in the file (the good point is, that unlike XML::Simple the “deepinfo”-node holds its correct position in XML::Mini::Document). But the problem, that attributes and nodes are mixed up by the module remains the same.

Another big problem is dealing with CDATAs. XML::Mini::Document escapes the CDATA-node and so is not able to write correct CDATA nodes.

And the most evil problem is the treatment of the “xml information node”. It is moved to the bottom and handled like it was a normal XML-node.

First result:

The “fromHash” and “toHash” method in XML::Mini::Document is technical crap, that can only be used on small xmls without attributes and CDATA nodes.

But there is a second way to use XML::Mini::Document

Unlike XML::Simple, dealing with the XML-structure by parsing it from and to a hash isn’t the only way in XML::Mini::Document. It also gives a toolbox to deal with the structure directly. This we want to test next and therefor rewrite our little testcase:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/perl
# Simple XML module test unit
###
# We are strict, cauz we are Elitecoderz!
use strict;
use XML::Mini::Document;
use XML::Mini;
 
################
# Get / Check Parameter (here we get the xml file we wanna deal with)
if ($#ARGV+1 != 1) {
	print "Error: Wrong number of parameters.\n";
	exit(1);
}
my $input = $ARGV[0];
chomp($input);
 
################
# Read Inputfile / check content / validate XML structure
# Some modules are able to read directly from a file; for easy going, we use this method here.
 
# Direct, dirty, but simple reading of a file
open(FILE, "<$input") || die "Error: File not readable.\n";
my @lines = <FILE>;
close(FILE);
 
# Put the lines into one string for this parser
my $XMLString = join(' ',@lines);
 
####################################################################
# XML::Mini
my $xmlDoc = XML::Mini::Document->new();
eval {
	$xmlDoc->parse($XMLString);
};
if ($@) {
	print "Error: XML parsing error: $@\n";
	exit(1);
}
my $xmlRoot = $xmlDoc->getRoot();
 
my $firstnode = $xmlDoc->getElementByPath('test/info');
$firstnode->attribute('addon', "Here is an valid xml text\nusing linebreaks");
 
my $secondnode = $xmlDoc->getElementByPath('test/info',1,2);
$secondnode->attribute('addon','invalid unescaped text');
$secondnode->text("Here is an valid xml text\nusing linebreaks\nand unescaped characters like < and >\ndo you see the and?");
 
my $testnode = $xmlDoc->getElementByPath('test');
my $newchild = $testnode->createChild("info");
$newchild->attribute('addon', "unescaped text for a CDATA");
$newchild->cdata("Here is an valid xml text\nusing linebreaks\nand unescaped characters like < and >\ndo you see the and?");
 
open(DATEI, ">output_XMLMini3") || die "Datei nicht gefunden";
print DATEI $xmlDoc->toString();
close(DATEI);

The resulting XML looks like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<test another="&lt;&gt;" attr1="1" attr2="2" debug="0">
	<info addon="Here is an valid xml text
using linebreaks" attr1="perl" attr2="xml module" />
	<info addon="invalid unescaped text" attr1="perl" attr2="xml module">
		Here is an valid xml text using linebreaks and unescaped characters like &lt; and &gt; do you see the and?
	</info>
	<info attr1="perl" attr2="xml module" />
	<info attr1="perl" attr2="xml
                        module">
		<deepinfo>
			last text here
		</deepinfo>
	</info>
	<info addon="unescaped text for a CDATA">
<![CDATA[ Here is an valid xml text
using linebreaks
and unescaped characters like < and >
do you see the and? ]]> 
	</info>
</test>

*Wow* – the first and very bad image turns a lot better! The structure is complete, looks good, is escaped where it should be and not, where it shouldn’t. In short words: The XML looks quite fine! After this, it is definitifly worth to take a closer look on XML::Mini::Document. And this we will do in the next chapert.

What happens to more complex XML-structures, containing CDATAs and encoded text when parsing?

To test this, we modify our little test-case again,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl
# Simple XML module test unit
###
# We are strict, cauz we are Elitecoderz!
use strict;
use XML::Mini::Document;
use XML::Mini;
 
################
# Get / Check Parameter (here we get the xml file we wanna deal with)
if ($#ARGV+1 != 1) {
	print "Error: Wrong number of parameters.\n";
	exit(1);
}
my $input = $ARGV[0];
chomp($input);
 
################
# Read Inputfile / check content / validate XML structure
# Some modules are able to read directly from a file; for easy going, we use this method here.
 
# Direct, dirty, but simple reading of a file
open(FILE, "<$input") || die "Error: File not readable.\n";
my @lines = <FILE>;
close(FILE);
 
# Put the lines into one string for this parser
my $XMLString = join(' ',@lines);
 
####################################################################
# XML::Mini
my $xmlDoc = XML::Mini::Document->new();
eval {
	$xmlDoc->parse($XMLString);
};
if ($@) {
	print "Error: XML parsing error: $@\n";
	exit(1);
}
my $xmlRoot = $xmlDoc->getRoot();
 
my $firstnode = $xmlDoc->getElementByPath('test/info');
$firstnode->attribute('addon', "Here is an valid xml text\nusing linebreaks");
 
my $cdatanode = $xmlDoc->getElementByPath('test/info',1,5);
print "\n\n--\n".$cdatanode->getValue."\n--\n\n";
 
my $textnode = $xmlDoc->getElementByPath('test/info',1,2);
print "\n\n--\n".$textnode->getValue."\n--\n\n";
 
open(DATEI, ">output_XMLMini4") || die "Datei nicht gefunden";
print DATEI $xmlDoc->toString();
close(DATEI);

and read again from the previously generated xml-file and see the output:

--
 Here is an valid xml text
 using linebreaks
 and unescaped characters like < and > do you see the and?
--

--
Here is an valid xml text
 using linebreaks
 and unescaped characters like &lt; and &gt;
 do you see the and?
--

The result for the CDATA looks quite nice, but the text from our second node unfortunatly does not get unescaped. Well – it’s no big deal to do this your own, but it is also not really my part to do this for XML::Mini::Document.

Result:
Do not try to use the “fromHash()” method, unless you want to destroy your XML. The “toHash()” method can be used to gather quickly information from a XML-file, but that is really all you can use this method for.

The toolbox for directly manipulating XML-structures is really nice. Especially the syntax for getting elements by path is something I really found usefull! Nice idea – great implementation!

XML::Mini::Document deals with all kind of XML-structures and does the escaping automatically. Unescaping of text-nodes must be done manually. That is a bug, that prevent me from using this module.

XML::Mini::Document is the module of your choice, if you have to deal with more complex structures. Since unescaping is a problem I would not recommend to use this module on really huge and sensitive XML-structures. For everything else XML::Mini::Document is easy to use and quick to implement.

The next post will be about “Getting your life compfortable with XML::LibXML”.
In all the tests above XML::LibXML shows no weakness and I could not find any problems. But there are a few other “traps” in XML::LibXML you’ll have to deal with.

Get in contact:

Categories