xom

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. ...

Using XOM with NetBeans

I am attempting to install XOM so I can use it in my Java apps. The only problem is, I don't know where I can place it so NetBeans can find it. It would make sense to put it where the other .classes files are, but I can't seem to find them either. The README file for XOM says to install it to the Classpath variable, but I don't know wha...

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: <?xml version="1.0" encoding="UTF-8"?> <resultset> <result> [child elements and data] </result> ... ... [1000s of result elements more] </resultset> Because the...

DTD download error while parsing XHTML document in XOM

Hello, I am trying to parse an HTML document with the doctype declared to use the transitional dtd as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; When I do Builder.build on the document, I get the following exception: java.io.IOException: Serv...

XOM v/s javax.xml.parsers

i want to do read simple XML file .i found http://stackoverflow.com/questions/528664/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? ...

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. Irritatingly, the XOM API does have a XOMResult implementation, but it's package protected, and on...

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: <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...

Tagsoup and XOM on android

Can i use Tagsoup and XOM on android 1.6 without any performance problems ? ...

How to parse (non well-formed) HTML in android ?

How to parse non well-formed HTML in android ? I tried to use XOM and TagSoup, but i get the following error when creating the Builder: 11-26 20:42:39.294: ERROR/dalvikvm(1298): Could not find method org.apache.xerces.impl.Version.getVersion, referenced from method nu.xom.Builder. Must i install Xerces to use XOM or can i use tagsoup ...

XOM get Document to String

Suppose I have a String like this String from = "<time><day type="tt">ok</day><time> Now what I would like to do is, create a XOM document and then retrun back something like String to = documentToString(document) this string should have only <day type="tt">ok parsed</day>, not with <time>..</time>root element. I have already crea...

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("//*"); <html xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml"&gt; <head> <title>Patient Information</title> <...

XOM getting attribute from Node?

Shouldn't something like this work? Assuming a document formatted as such: <root> <element id = "a"></element> </root> Node node = doc.query("/root/element").get(0); String id = node.getDocument().getRootElement().getAttribute("id"); When I print the value of the root element, it looks as if this should work. What's failing, here...

Setting a custom XOM EntityResolver

I need to not validate against a doctype, so I'd like to set a custom EntityResolver that accepts everything. I'm getting data back from tagsoup, so I know my data is well-formed and correct. Furthermore, I need to rapidly hit a number of documents, so when I do this with the default EntityResolver, I get 503 from w3.org. How, then, ca...

Grails XOM linkageerror - SAXParserException

Possibly related: http://stackoverflow.com/questions/2762439/grails-attempting-to-include-htppbuilder-linkage-error I'm trying to include XOM in my grails project. How do I know which dependency library I need to exclude? I'm lost here. dependencies { build('xom:xom:1.1') { excludes "xml-apis" } } Error: java.lang.Li...

convert nu.XOM.Element to org.w3c.dom.Element

Is it possible to convert nu.XOM.Element to org.w3c.dom.Element? Am trying to construct XML using XOM APIs. But few of my legacy APIs expects org.w3c.dom.Element. So, I just want to know if I can convert. Thank You :) ...

Easy way to convert an org.apache.xmlbeansXmlObject to nu.xom.Element

I have used the scomp tool from XMLBeans to generate java classes and then populated the fields in an XmlObject (I wrote this code some time ago). I now need to convert this object into the Element class used by the XOM library. Is there an easier way than by traversing the XmlObject using an XmlCursor and then adding child nodes to the...

How to set namespace only on first tag with XOM?

I am using XOM to build XML documents in Java. I have created a simple XML document, and I want an XML namespace. But when I set the namespace on the first tag, an empty namespace is set on the childs like xmlns="", how can I get rid of this behaviour? I only want xmlns on the first tag. I want this XML: <request xmlns="http://my-name...

Where I can find a detailed comparison of Java XML frameworks?

I'm trying to choose an XML-processing framework for my Java projects, and I'm lost in names.. XOM, JDOM, etc. Where I can find a detailed comparison of all popular Java XML frameworks? ...