Questions tagged [dom4j]

dom4j is an open source library for working with XML, XPath and XSLT on the Java platform using the Java Collections Framework and with full support for DOM, SAX and JAXP.

dom4j is an open source library for working with XML, XPath and XSLT on the Java platform using the Java Collections Framework and with full support for DOM, SAX and JAXP.

Features:

  • designed for the Java platform with full support for the Java Collections Framework (Java 2 Collections)
  • full support for JAXP, TrAX, SAX, DOM, and XSLT
  • fully integrated XPath support for easy navigation of XML documents
  • event based proccessing mode to support for massive documents or XML streams based on Java interfaces for flexible plug and play implementations
  • support for XML Schema Data Type support using Kohsuke Kawaguchi's excellent Multi Schema Validator library
323 questions
4
votes
2 answers

Extracting child nodes data from given node

I want to use DOM4j for parsing xml file in Java. I have this XML as an example:
Michael A
  • 5,770
  • 16
  • 75
  • 127
4
votes
4 answers

how to use dom4j SAXReader offline?

I would like to work with SAXReader offline, the problem is that SAXReader is verifying the xml accoerding to the DTD. I don't want to change the DTD or anything else in the XML. From searching on this website and other sources I found 2 answers…
Oded Regev
  • 4,065
  • 2
  • 38
  • 50
4
votes
2 answers

Dom4j xmlns attribute

I want to add xmlns attribute to the root node only, however when i add a namespace to the root element, all subsequent child elements also get the same xmlns attribute. How do I add xmlns attribute to a single node but not any of its children ?…
Phoenix
  • 8,695
  • 16
  • 55
  • 88
4
votes
1 answer

Dom4J preserve whitespace when writing file

I'm working on a program that is using Dom4J to write xml files. The database schema I am writing to has a handy xml validation and import schema. Dom4J is working great, but, I can't seem to figure out how to set the 'preserve' field in Dom4J's…
awfulHack
  • 857
  • 1
  • 10
  • 25
4
votes
3 answers

convert dom4j docment to W3c document

i'm need to convert an xml build with dom4j to w3c document and don't have any idea about how do it...
Jorge
  • 17,896
  • 19
  • 80
  • 126
4
votes
2 answers

Remove A Node From XML File (DOM4J, JAVA)

Since all other questions related to this topic refer to a specific programming problem (e.g. 'I get a NullPointerException when I try this and that') and the answers are fixing the programming errors, here is a simple solution to the following…
Maurice Müller
  • 1,312
  • 3
  • 16
  • 32
4
votes
2 answers

Caused by: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory

I've a gradle project which uses hibernate > 4 . If I run my war file in Apache tomcat, I don't get any error. But when I'm deploying it in Wildfly 8.2 , I get the following exception Caused by: org.hibernate.InvalidMappingException: Error while…
The Coder
  • 2,562
  • 5
  • 33
  • 62
3
votes
1 answer

get underlying node data on clicked node on JTree?

basically I am using dom4j library to render the DefaultTreeModel into JTree. DefaultTreeModel parses XML document. Each XML node contains information like attributes, name, id etc. Basically, I add a actionlistener to this Jtree. I would like to…
KJW
  • 15,035
  • 47
  • 137
  • 243
3
votes
3 answers

dom4j XML declaration in document

I need to remove XML declaration from dom4j document type I am creating document by doc = (Document) DocumentHelper.parseText(someXMLstringWithoutXMLDeclaration); String parsed to Document doc by DocumenHelper contains no XML declaration (it comes…
Marcin Wasiluk
  • 4,675
  • 3
  • 37
  • 45
3
votes
2 answers

expand Jtree at last modified area?

I am using dom4j to create a DocumentTreeModel from a dom4j document. I display this DocumentTreeModel inside JScrollPane. I have a button that adds a new node to the dom4j document, and recreates the DocumentTreeModel I am using getPathForRow but…
KJW
  • 15,035
  • 47
  • 137
  • 243
3
votes
1 answer

DOM4J utf-8 encoding Umlaute(Ä,ü,ß) incorrectly

I'm using DOM4j for parsing and writing an XML-Tree which is always in UTF-8. My XML file includes German Special-Characters. Parsing them is not a problem, but when I'm writing the tree to a file, the special characters are getting converted to �…
Jakob Sachs
  • 669
  • 4
  • 24
3
votes
2 answers

Specify XML path in dom4j

I want to parse a large xml file using dom4j. I'm using the dom4j's feature that you can register event handlers for path expressions for ignoring the elements I don't care about. The feature is explained here:…
ovdsrn
  • 793
  • 1
  • 7
  • 24
3
votes
1 answer

How does dom4j library implements Flyweight pattern?

I can see in dom4j library a number of classes with Flyweight prefix: FlyweightAttribute, FlyweightComment, FlyweightText etc. Here is what java doc is saying in the case of FlyweightText: FlyweightText is a Flyweight pattern implementation of a…
Dan
  • 11,077
  • 20
  • 84
  • 119
3
votes
1 answer

DOM4J Select Child Nodes

I have the tag book, then i read out 2 Nodes CCUSTBLS_KundennummerBLS CCOMP_MandantFIBU After this,i have the Nodes "Lieferadresse". Now i want that i have a loop that iterated through the Node "Lieferadresse". My Problem is that i see evertime all…
User1751
  • 150
  • 2
  • 10
3
votes
1 answer

dom4j attributeValue with qualified name

I'm using dom4j to parse AndroidManifestFile.xml. However I found that it treats "android:xxx" attribute strangely. For example:
Hongxu Chen
  • 5,240
  • 2
  • 45
  • 85
1
2
3
21 22