Questions tagged [jdom-2]

JDOM 2 is the Second version of the JDOM XML API See the [Migration Guide][1] for differences over JDOM 1

JDOM 2 is the Second version of the JDOM XML API

See the Migration Guide for differences over JDOM 1

165 questions
0
votes
1 answer

How to add a Processing Instruction [jdom2]

When having a Processing Instruction How can it be added by jdom2 to an existing XML like
Verhagen
  • 3,885
  • 26
  • 36
0
votes
1 answer

delete the previous node in java using jdom

Here is my code: SAXBuilder builder = new SAXBuilder(); File xmlFile = new File( "fichadas.xml" ); try { Document fichero = (Document) builder.build( xmlFile ); Element rootNode = fichero.getRootElement(); for (Element tabla :…
marcss
  • 253
  • 2
  • 14
0
votes
1 answer

read a variable from txt in java

Here is my code: try{ if(fichadaHecha==false) { Element fichada = new Element("fichada"); //Nº TERMINAL fichada.addContent(new Element("N_Terminal").setText("XX")); …
marcss
  • 253
  • 2
  • 14
0
votes
0 answers

add content to a created xml document

Here is my code: import java.io.FileWriter; import java.io.IOException; import org.jdom2.Attribute; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.output.Format; import org.jdom2.output.XMLOutputter; try { Element…
marcss
  • 253
  • 2
  • 14
0
votes
1 answer

How can i create a different xml tag using a counter?

Here is my code: Element FICHADAS = new Element("FICHADAS"); Document doc = new Document(FICHADAS); try { if (fichadaHecha == false) { Element fichada = new Element("fichada"); fichada.setAttribute(newAttribute("id",…
marcss
  • 253
  • 2
  • 14
0
votes
1 answer

how to check the validity of an XML file against a DTD file in java?

I am working with Java and I want to check if an XML file is valid against a DTD. Assuming that we do have a DTD file "myDtdFile.dtd", I want to check if certain XML file "myXmlFile.xml" is valid against the same definitions proposed in the DTD…
steevn
  • 242
  • 2
  • 8
0
votes
0 answers

Want to create XML file from Java property file

I'm trying to create XML file from Java property file. Wherein tag names are dot separated key part of Property file and the Tag value is value part of property file. Here is my property…
Enix
  • 138
  • 1
  • 7
0
votes
0 answers

a strange FactoryConfigurationError in Bonita

I've coded a Java class in Eclipse in which i've a method who reads a xml file and return an ArrayList of Element. I've exported this class as a Jar and i've added in my studio this jar with Jdom2 (to parse xml). I call this method in a groovy…
0
votes
1 answer

Handling special characters while parsing with JDOM

I have a xml below that I'm parsing with JDOM 2.0.5 trueMetro_C&C Now while trying to get the value of the tag using node.getValue() where node is of type…
user1356042
  • 395
  • 2
  • 6
  • 23
0
votes
2 answers

Search XML using XPath with JDOM/JAXEN/SAXON

I do have an XML document that I'm parsing using JDOM-2.0.5. The following code works fine and bookNodes list contains all book nodes from my XML file: SAXBuilder builder = new SAXBuilder(); // @see…
Enissay
  • 4,969
  • 3
  • 29
  • 56
0
votes
2 answers

Prevent JDOM2 from creating xmlns=""

I try to add new elements to a persistence.xml file with JDOM2. persistenceUnitEl.add(new Element("class").addContent(className)); The problem is that jdom2 always adds xmlns="" to the elements. How can i prevent…
user4007301
  • 67
  • 2
  • 9
0
votes
1 answer

org.jdom2.xpath doesn't return results on queries from html head element

I am using org.jdom2.xpath to evaluate XPath queries on html documents. Attempting to retreive a script text from the head element, I tried this query: /html/head/script[contains(text(), 'expression1') and contains(text(),…
eladidan
  • 2,634
  • 2
  • 26
  • 39
0
votes
1 answer

Prevent test errors in 'mvn site' goal with ROME dependency and cobertura-maven-plugin

In a Maven based project some of the JUnit tests fail, but only during a Maven site build. When executing mvn clean package all tests pass. But when executing: mvn clean site some of the tests generate the message: Could not initialize class…
Kwebble
  • 2,065
  • 14
  • 23
0
votes
2 answers

Remove whitespaces in end tags jdom

I am using JDom 2.0.5 to modify an xml. Also I have a Junit test case which check if it was correctly modified. It has an input xml, a method for testing (transformation xml) and a new xml (result). Later it compares output with a file which should…
Fran b
  • 3,016
  • 6
  • 38
  • 65
0
votes
1 answer

Modifying XML using JDOM

I'm trying to modify an XML document with JDOM, the problem is that does not change anything in the file. I've been searching the internet to modify the file and in any site explains how to save the file. I would like you to tell me what I do wrong…
Cence
  • 33
  • 3