Questions tagged [xom]

XOM™ is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with Java that strives for correctness, simplicity, and performance.

XOM™ is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with Java that strives for correctness, simplicity, and performance.

XOM is designed to be easy to learn and easy to use. It works very straight-forwardly, and has a very shallow learning curve. Assuming you're already familiar with XML, you should be able to get up and running with XOM very quickly.

References:

91 questions
18
votes
2 answers

Creating an XML document using namespaces in Java

I am looking for example Java code that can construct an XML document that uses namespaces. I cannot seem to find anything using my normal favourite tool so was hoping someone may be able to help me out.
adam
  • 22,404
  • 20
  • 87
  • 119
13
votes
3 answers

Ignoring DTD when parsing XML

How can I ignore the DTD declaration when parsing file with XOM xml library. My file has the following line : //rest of stuff here And when…
LordDoskias
  • 3,121
  • 3
  • 30
  • 44
6
votes
2 answers

DTD download error while parsing XHTML document in XOM

I am trying to parse an HTML document with the doctype declared to use the transitional dtd as follows: When I do Builder.build…
Bala
  • 979
  • 1
  • 10
  • 21
5
votes
2 answers

Java How to extract a complete XML block

Using this XML example: 0 1 I want a simple method to extract the XML block of node B, returning the XML String: 1 To retrieve this node i should use some Java XPath…
rhodan
  • 309
  • 1
  • 5
  • 8
5
votes
6 answers

Java - Difference between for loop terminating expression

I'm just curious: Is there a difference on speed and performance between this two loops implementation? Assume that size() method returns the length of the array,collection, or object that handles a group of elements (actually it's from XOM…
John Bautista
  • 1,480
  • 3
  • 29
  • 60
5
votes
3 answers

XOM v/s javax.xml.parsers

i want to do read simple XML file .i found Simple way to do Xml in Java There are also several parsers available just wanted to make sure that what are the advantages of using XOM parser over suns parser Any suggestions?
anish
  • 1,035
  • 4
  • 13
  • 27
4
votes
2 answers

How to stream XML data using XOM?

Say I want to output a huge set of search results, as XML, into a PrintWriter or an OutputStream, using XOM. The resulting XML would look like this: [child elements and data] …
Jonik
  • 80,077
  • 70
  • 264
  • 372
4
votes
1 answer

XPath Expression returns nothing for //element, but //* returns a count

I'm using XOM with the following sample data: Element root = cleanDoc.getRootElement(); //find all the bold elements, as those mark institution and clinic. Nodes nodes = root.query("//*");
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
4
votes
1 answer

Ignore DTD element in a XOM Parser to avoid no File found exception

I need to ignore this DTD file path in the below XML to avoid file not found exception.
mowienay
  • 1,264
  • 4
  • 19
  • 32
4
votes
1 answer

Applying xpath on xml with default namespace with XOM

I have below XML which contains a default namespace Stoat Future come and get me Sufjan…
Samiron
  • 5,169
  • 2
  • 28
  • 55
3
votes
2 answers

Both XPath/getChildElements failed to get XML child in XOM

I've to parse an OAI-PMH XML file, which looks like the following. I would like to iterate over all nodes in ListRecord.
Brian Hsu
  • 8,781
  • 3
  • 47
  • 59
3
votes
1 answer

Writing GraphML with XOM?

I'm trying to write out a graphML document with XOM in java, but I can't figure out how to get all of the namespace declarations correct. To have valid graphML, I need to have a root element that looks like the following:
Paul Wicks
  • 62,960
  • 55
  • 119
  • 146
3
votes
2 answers

How do I marshal a JAXB object to XOM?

I'm trying to figure out what bits I need to plug together to marshal a JAXB POJO to a XOM document, and vice versa. The JAXB Marshaller interface's marshal methods take various targets, such as Result, but none of them have a XOM adapter.…
skaffman
  • 398,947
  • 96
  • 818
  • 769
2
votes
2 answers

Using XPath to extract XOM elements from documents with unnecessary namespaces

I'm trying to parse some HTML returned by an external system with XOM. The HTML looks like this:
David Moles
  • 48,006
  • 27
  • 136
  • 235
2
votes
3 answers

How to get elements from XPath in Java

I want to get data from an XPath query: Element location = (Element) doc.query("//location[location_name='"+ locationName +"']/*").get(0).getDocument().getRootElement(); System.out.println(location.toXML()); Element loc =…
kskaradzinski
  • 4,954
  • 10
  • 48
  • 70
1
2 3 4 5 6 7