Questions tagged [jdom]

JDOM is an open source library for working with a Java representation of an XML document. JDOM provides a way to represent that document for easy and efficient reading, manipulation, and writing. It has a straightforward API, is a lightweight and fast, and is optimized for the Java programmer.

JDOM is an open source library (hosted on gitub) for working with a Java representation of an XML document. JDOM provides a way to represent that document for easy and efficient reading, manipulation, and writing.

The major features of JDOM that make it easier to use are:

  • it has a straightforward API
  • it is lightweight and fast (relative to other in-memory models)
  • the in-memory model of the document is always well-formed.
  • it is optimized for the Java programmer.
    • It uses standard Java collection structures instead of some other form of containers
    • All Collections are correctly typed using Java Generics
    • It provides simple and high-performance access to XML Parsers and 'outputters'
    • it integrates well with data that is read from, or written to SAX, DOM, and StAX API's

While SAX (and sometimes DOM and StAX) can be used to build JDOM documents, the JDOM API is not like those. Still, JDOM is able to interface well with programs that expect SAX, StAX, or DOM input, or expect JDOM to provide such output.

JDOM is not a wrapper for the W3C's DOM, or another version of DOM. JDOM is a Java-based "document object model" for XML files. JDOM serves the same purpose as DOM, but is easier to use.

JDOM is not an XML parser (like Xerces). It is a document object model that uses XML parsers to build documents. JDOM's SAXBuilder class for example uses the SAX events generated by an XML parser to build a JDOM tree. The default XML parser used by JDOM is the JAXP-selected parser, but JDOM can use nearly any parser.

JDOM 2.0.0 was released in 2012 and introduced full support for Java Generics and an improved XPath interface as well as many other features.

JDOM 1.1.3 is still supported and even runs on Java 1.1.2

485 questions
0
votes
1 answer

How to start working with SAX, DOM, JAXP and JDOM

I am currently getting started with XML and Java. The author says that I will need DOM, SAX, JAXP and JDOM to work with the examples given. The book states that DOM and SAX come bundled with a parser of your choice, in my case Xerses-J. I have…
An SO User
  • 24,612
  • 35
  • 133
  • 221
0
votes
1 answer

Cannot figure out reason for JDOMException SAXBuilder

I am not able to figure out the reason for JDOMException being caught. I am passing an XML format string to the SAXBulider's build function for getting a Document, an exception is thrown here. XML String which is stored in String results:
Vizzard
  • 55
  • 4
0
votes
1 answer

Error: org/jdom/JDOMException while running map reduce job

Hi I am trying to parse an XML file using map reduce framework. I am using JDOM Parser for parsing of the XML file. but when I run my map reduce code on a pseudo-node cluster than it gives me following error. WARN mapred.JobClient: Use…
user1188611
  • 945
  • 2
  • 14
  • 38
0
votes
1 answer

IntelliJ IDEA plugin persistence state xml has duplicate lines

I have the following Component: @State( name = "SessionConfiguration", storages = { @Storage(id = "default", file = StoragePathMacros.PROJECT_FILE), @Storage(id = "dir", file = StoragePathMacros.PROJECT_CONFIG_DIR +…
Alp
  • 29,274
  • 27
  • 120
  • 198
0
votes
1 answer

Adding List to JDOM Element

I have a scenario where I need to get the sub pages inside a book (max 3) and move those pages to parent of book. Like: So, if number of pages under book1 are greater…
Tarun
  • 35
  • 1
  • 1
  • 6
0
votes
1 answer

Check If String Is Valid XML with Jdom2

What is the best way to check if a string is valid XML for Jdom2?
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
0
votes
1 answer

JDom getting content from one xml to another

I have two different XML's, both containing the same products but in another language. The problem is, I want to add the description of the French XML to the description of the Dutch one, but the French XML contains a lot more products. This is what…
Boyen
  • 1,429
  • 2
  • 15
  • 22
0
votes
2 answers

How could i display the Jdom's current state (i.e. contents) in TextEditor

I am implementing form based editor which has 1 tab as form page. This editor extends "FormEditor" and tab extends "FormPage" class. I am using Jdom for xml parsing. This editor is use to modify a xml file. let's say, i opened a file named…
User_86
  • 265
  • 1
  • 4
  • 13
0
votes
3 answers

Known xpath 2.0 processor with jdom support

Which xpath 2.0 processors with jdom support are known?
Mirko
0
votes
1 answer

JDOM getchildren() return only one element

XML: .... PD1 PD2 PD3 ... JAVA: FileInputStream fin; fin = new…
user2003559
  • 1
  • 1
  • 1
0
votes
1 answer

Jdom Saving and Loading Tiles

I have this code for saving and loading a map of tiles: public void load(File loadFile) { try { SAXBuilder builder = new SAXBuilder(); Document document = builder.build(loadFile); Element root =…
user1650305
0
votes
1 answer

Parsing SOAP response from file with JDOM

I'm trying to parse SOAP response from file. This is out.xml
miqbal
  • 2,213
  • 3
  • 27
  • 35
0
votes
1 answer

Reading XML with JDOMXpath

I have the follwing XML file - 123456789
Ctrl_Alt_Defeat
  • 3,933
  • 12
  • 66
  • 116
0
votes
1 answer

Printing multiple tags within CDATA section

I have a old xml file which was generated manually in java. Its tree structure is like this.
Sangram Anand
  • 10,526
  • 23
  • 70
  • 103
0
votes
1 answer

How to getChildText() of a node with a namespace, when there are multiple namespaces in the XML?

I want to use getChildText() to get text from a node that is a few levels deep. There are two namespaces in the file. The syntax below does not work and sets textToGet to null. String textToGet =…
Kirill Yunussov
  • 1,955
  • 1
  • 21
  • 24