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
0
votes
1 answer

dom4j makeElement with @ xpath, but asXML result can not be parsed by Oracle extractvalue function

I'm working on an XML message process program using dom4j, and encounter a problem with XML node attribute parsing. The business requirement is: parse and validate input XML, if a field or an attribute is invalid, return an XML which structure…
peihan
  • 592
  • 1
  • 8
  • 13
0
votes
3 answers

dom4j converting text to special characters

I'm using dom4j to parse my xml. Let's say I have something like this: ƒ When looking at the value of the "bar" node, it gives me back the special character as represented by…
digiarnie
  • 22,305
  • 31
  • 78
  • 126
0
votes
1 answer

Dom4 1.6.1j: XPath that returns non-node type value possible?

e.g. I want to return the name of a node, i.e. a string, thus /MxML/trades/trade/tradeBody/*[1]/local-name() However when I try to evaluate it with doc.valueOf or doc.selectSingleNode, or whatever else I try I get this…
Dino Fancellu
  • 1,974
  • 24
  • 33
0
votes
0 answers

Stuck with connection timed out on trying to get and parse stock price

Am trying to get the latest stock price of a stock. The URL am using as an example is String stockURL=http://www.google.com/ig/api?stock=ADSL. Am able to open this link in my browser. I have written the following code in order to parse the document…
Anuj Balan
  • 7,629
  • 23
  • 58
  • 92
0
votes
1 answer

Exception in thread "main" java.lang.NoClassDefFoundError: org/dom4j/io/SAXReader

I am trying to compile and run the following class: import org.dom4j.io.SAXReader; import org.dom4j.Document; import org.dom4j.Element; import java.net.URL; import java.net.Authenticator; import java.net.PasswordAuthentication; import…
kamal
  • 9,637
  • 30
  • 101
  • 168
0
votes
1 answer

Dom4j: sax parsing a loaded document

I am trying to accomplish the following: load a document (done) go trough the document depth first and use a DefaultHandler from JDK to do some work The reason I want to do this is that I already have my handler, and now I am using it with a SAX…
Jonny5
  • 1,390
  • 1
  • 15
  • 41
0
votes
3 answers

dom4j-java- how to get all elements (parent or children) within root that have specific element name

I want to get the number of elements in an xml, which have specific name eg. name="while") The problem is that if I use the following code- I only get top level elements that have this name-- for ( Iterator i = root.elementIterator( "while"…
Arvind
  • 6,404
  • 20
  • 94
  • 143
0
votes
1 answer

dom4j HTMLWriter missing XML declaration

The dom4j 1.6.1 HTMLWriter is missing an XML declaration even if set to XHTML mode. It is fixed by changing back to XMLWriter but then I'm missing all the HTML features. import org.dom4j.Document; import org.dom4j.DocumentHelper; import…
Brian Johnson
  • 1,629
  • 5
  • 21
  • 26
0
votes
1 answer

Create xpath with key using dom4j

Does anybody know how to automagically get xpath with keys when using dom4j elements? Let me explain: Given the following xml I have created a dom4j document. 0001 0000
Jonas Söderström
  • 4,856
  • 2
  • 36
  • 45
0
votes
1 answer

dom4j SAXReader - stop parsing

I am parsing an XML file with SAXReader and would like to stop after a certain amount of time (timeout) in case the file is too large. At a high level, I would like to throw a SAXException in the ContentHandler (in, say, startElement). The idea is…
None
-1
votes
1 answer

DOM4J sorting node elements numerically

I am using DocumentHelper to sort a node list using code similar to below, but it looks like it is sorting alphanumerically. The xPath points to an Integer based attribute. How do I adapt this code to do an Integer based sort? private void…
-1
votes
1 answer

How to append data to an XML document instead of overwrting existing data using dom4j?

How to open an existing XML document in write mode and append new nodes to the root element? I'm using dom4j library but confused the way to do it. I want to incrementally add the data to XML file but lost myself in choas. A brief program structure…
user896456
  • 59
  • 3
  • 8
-1
votes
1 answer

Appending a new node or a child node using Dom4j

I am stuck at updating an existing XML document. I have to add another element to the root node. I need to append it, but using XMLWriter, it is overriding the object and all the old data is lost. How can I add another node to the exisitng…
user896456
  • 59
  • 3
  • 8
-1
votes
1 answer

how to add new node under a specific node in dom4j JAVA

I want to generate flexiField tags and add it to current xml file. Here is My xmlFile. BL BL
Cihad
  • 13
  • 1
  • 6
-1
votes
1 answer

I want to search and the specific Nodes or elements in xml and create new xml from the select nodes

I want to create new Xml file from the select nodes only i am using dom4j to parse and create new xml file. Example lets assume Nodes Customer name = Joseph is the child of root element TRX i want to show the whole elements that contain joseph…
1 2 3
21
22