473,791 Members | 3,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Which do I use, JAX, DOM, JDOM?

hello,

I am having to read an XML document and grab some elements and attributes
and then convert that to anther XML document.

Which should I use? JAX, DOM, JDOM?

I don't really understand the difference and when to use the above.

Thanks so much.
Jul 20 '05 #1
2 1556
hi,
I am having to read an XML document and grab some elements and attributes
and then convert that to anther XML document.

Which should I use? JAX, DOM, JDOM?

I don't really understand the difference and when to use the above.


DOM: language-independent API for accessing XML

JAXP: API in Java for DOM, SAX, XSLT; part of the J2SE-specification

JDOM: API in Java with some more features than DOM; not part of J2SE and
only supported by some parsers

If you just want to transform one XML-document into another you should
use XSLT ( http://w3.org/TR/xslt ). If you want to embed this process
into your own Java-application, you should use JAXP for the Java-part.

regards
frank
Jul 20 '05 #2


john smith wrote:
I am having to read an XML document and grab some elements and attributes
and then convert that to anther XML document.

Which should I use? JAX, DOM, JDOM?

I don't really understand the difference and when to use the above.


DOM usually means the W3C DOM specification which is meant to be
language independent by using some IDL (interface description language)
to define a tree based API for manipulating XML (and HTML) documents.
The W3C DOM specification then goes on to define two language bindings,
one for Java, one for ECMAScript. As the specification should be
implementable on top of existing implementations and as the API has to
work with scripting languages with loose typing as well as with
languages like Java with strong typing the Java binding the W3C suggests
for the DOM doesn't define any classes but only interfaces to be
implemented. Where overloading in Java would be possible it is not done
as overloading in ECMAScript is not possible and the API is meant to be
consistent in different languages.
As a result of this many pure or main Java programmers dislike the W3C
DOM and have implemented Java specific and Java natural DOM APIs, one of
which is JDOM. But there are others like XOM.
JAXP is Sun's term for the different XML related Java APIs in the Sun
Java development kit/JDK, it is mainly an abstraction layer (or even
several ones) to allow you to use different parsers or DOM
implementations or XSLT implementations or XPath implementations that
are around under a common way to create parsers.

What you should or want to use depends on many criteria, Sun Java 1.4
and Sun Java 1.5 have W3C DOM support thus if you want to only rely on
the classes installed by the Sun JDK/JRE then you do not have JDOM for
instance or XOM. You would need an additional download for that and
anyone using your software too.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6122
by: Praveen Chhangani | last post by:
Folks, I was wondering if it were possible to convert an org.jdom.doc to an org.w3c.doc document. Essentially what I have is an already parsed document using jdom and I would like to use the document object in another application that is expecting a DOM (w3c) document. If someone could perhaps, show me an example that would be very much
3
3023
by: Michael | last post by:
hello, I'm a java programmer, and my program will require to parse XML documents and extract data from it, then built a new XML document. Should JDOM or Xerces be the best for me? Please help. Thank you very much, Michael
3
15208
by: Bernd Oninger | last post by:
When I run the successfully compiled java source shown at the end I got a runtime error: Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom/Content Where is the missing class ? I copied the newest jdom.jar from newest JDOM release b10 to the folder jdk\jre\lib\endorsed
0
1068
by: idorjee | last post by:
Hi Can anyone please help me why my java program says the following when I try to build it in NetBeans: Compiling 1 source file to /Users/Desktop/Jproject/jdom/build/classes /Users/Desktop/Jproject/jdom/src/jdom/JDOMDemo.java:49: package org.jdom does not exist I did install the jdom in my home directory and set the env (JAVA_HOME=/usr/java; export JAVA_HOME) Please help. Thanks a lot!
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9517
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10156
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9997
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5435
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.