Hi Balaji

There's an entry in the FAQ that explains how to use XSLT and dom4j:-

http://dom4j.org/faq.html

The exact entry is here:- (sorry for the nastly looking URL)

http://dom4j.org/faq.html#How%20can%20I%20use%20XSLT%20with%20dom4j?

The quick start guide:-

http://dom4j.org/guide.html

Has an entry showing how to use XSLT:-

http://dom4j.org/guide.html#Styling%20a%20Document%20with%20XSLT

Finally there's a sample program in src/samples/XSLTDemo.java that shows how
to perform XSLT on a dom4j Document.


Using JAXP 1.1 you can take any XML source (stream, dom4j, DOM or SAX) and
style it into any result (stream, dom4j, DOM or SAX).

http://java.sun.com/xml/jaxp-1.1/docs/api/

Hopefully you can pipe the resulting SAX events into Castor to create some
Castor generated objects. Though that would be a question for the Castor
people ;-)

James
----- Original Message -----
From: "Balaji Iyer" <[EMAIL PROTECTED]>
To: "James Strachan" <[EMAIL PROTECTED]>
Cc: "Dom4j-User (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, June 12, 2001 12:42 PM
Subject: Dom4j for XSL Transform with Castor .9


Sir,
 Can you point to some working example which uses DOM4J to apply an XSLT
generating html to an input XML Document.
 Actually Castor doesnt support the use of XSLT further after the java
object is converted to xml string...
 So I am planning to use both DOM4J and Castor at relative stages in
development. But for that I want to see some pilot code. I went through
the org.dom4j.rule packages, but the documentation (description) of the
classes and how to use them is missing.

Hence would need this piece of help

-----Original Message-----
From: James Strachan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 12, 2001 4:25 PM
To: Balaji Iyer; [EMAIL PROTECTED]
Subject: Castor v dom4j (was: Re: [dom4j-user] Thread safety)


Hi Balaji

They are both valid approaches to a similar problem and both have their
own
strengths and weaknesses.

Binding XML documents to Java objects is a bit more complex and may
result
in a more complex build process as you may need to code generate Java
classes. You also must maintain some 'mapping schema' of some kind.
Though
on the plus side, the xml-java binding approach can lead to faster
parsing.

The dom4j approach allows you to work with any XML document easily and
allows you full and powerful navigation through that document using
XPath
expressions along with easy integration with SAX and XSLT. The downside
of
the dom4j approach is that it is a generic XML object model, rather than
a
custom Java bean model and so it may be a bit slower to parse.

So I'd say it depends on what you're doing. If you're working with
arbitrary
XML documents and find easy navigation with XPath or styling with XSLT
useful, then dom4j is a good approach. If you are using a single, fairly
static XML document schema and are happy to write all the Java code to
navigate your model and you don't mind spending some extra development
time
to gain some increased performance then the xml-java binding approach
may be
worth considering.

I tend to recommend people start with dom4j as its easier to get going
and
XPath and XSLT are really cool and powerful. Then consider moving to
Castor,
JAXB, Quick or whatever else if they think XML parsing is becoming a
performance bottleneck.

James

From: "Balaji Iyer" <[EMAIL PROTECTED]>
To: "James Strachan" <[EMAIL PROTECTED]>; "Bill la Forge"
<[EMAIL PROTECTED]>; "Dane Foster" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, June 12, 2001 11:45 AM
Subject: RE: [dom4j-user] Thread safety


Hi All,
 I am planning to use Castor apis for xml-java translation. Kindly let
me know if there is any disadvantage compared to use with DOM4J.
 For the past few days I have been testing with Castor and its  mapping
facilities etc for converting my serializable objects to xml and so and
so forth...Looks good to me.

Thanks,
rgds,
Balaji



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to