jdom

Default XML namespace, JDOM, and XPath

I want to use JDOM to read in an XML file, then use XPath to extract data from the JDOM Document. It creates the Document object fine, but when I use XPath to query the Document for a List of elements, I get nothing. My XML document has a default namespace defined in the root element. The funny thing is, when I remove the default name...

Problems with XML/DOM tree rewriting using JDOM (ConcurrentModificationException)

I need to walk a JDOM tree and make changes as I go along; at this point, changes are mostly adding new elements right now but could also include reordering elements or removing elements. All work is done on the same thread so there are no concurrency issues. This turns out to be difficult because JDOM iterators can throw a ConcurrentM...

Does JDOM have any support for ID and IDREF?

<!DOCTYPE inventory [ <!ELEMENT book (title,author)> <!ELEMENT title (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ATTLIST book year CDATA #IMPLIED> <!ATTLIST book myId ID #REQUIRED> <!ATTLIST book myIdRef IDREF #IMPLIED> ]> <inventory> <book year="2000" myId="1"> <title>Snow Crash</title> <author>Neal Stephenson</author> ...

How to insert XHTML into XML

Hi all, I'm working with JDOM at the moment. I can't think of a solution which what should essentially be an easy problem. I have a valid XHTML string: <b>M&amp;A</b> &euro; How do I insert this into the XML DOM as follows? <parentNode>   <b>M&amp;A</b>    </parentNode> (this XML then goes off to an XSL transformer, which then ren...

Known xpath 2.0 processor with jdom support

Which xpath 2.0 processors with jdom support are known? ...

Programmatically creating an XML Document using an XSD

Hi I need to create XML documents using built-in java org.w3c.dom or jdom packages conforming to a set of XSD files. The XSD files are similar but not the same. In essence, I need to create the XML file as per the XSD given to me dynamically. What is the best way to do it. I have checked the Validator package, it does not have any fea...

Get Text Content of xml element

Hola! ;) So, i have some question about xml Documents in Java. Can i get all text(only text) content of some element and all descendant's elements of this element, without to iterate through all this elements and using Element.getText()? By another words, it must be some analogous function to JavaScript textContent. Or i must to iterate ...

Java I/O over an NFS mount

I have a bit of Java code that outputs an XML file to a NFS mounted filesystem. On another server that has the filesytem mounted as a Samba share, there is a process running that polls for new XML files every 30 seconds. If a new file is found, it is processed and then renamed as a backup file. 99% of the time, the files are written wi...

Java out of memory Exception

Hi, I am running a Java Web Application in Tomcat. The application uses Quartz framework to schedule the cron job at regular intervals. This cron job involves parsing a 4+ MB xml file, which I am doing using JDOM API. The xml file contains around 3600 nodes to be parsed and consequently data to be updated in DB which I am doing it sequ...

Converting a List of pojo Class to a Jdom Tree ?

Hi, i have a POJO class call LEVEL & his class diagramm like this: 0,1 ------------| | | | | \|/ | level-<>------- In other words this: public class Level { private int id; private int label; private Set labels; private Level parent; ... } I have a method who retrieve fr...

Problem loading remote html source code using JDOM

I am trying to use JDOM to load the source code of a remote HTML file (a Blogger's profile). I have this code: public Document getDoc(URL url) throws JDOMException, IOException{ SAXBuilder saxBuilder = new SAXBuilder(); saxBuilder.setFeature("http://xml.org/sax/features/validation", false); saxBuilder.setFeature("http://apac...

How do I select something with a blank namespace with Jaxen?

I have the following xml: <config xmlns="http://www.someurl.com"&gt; <product> <brand> <content /> </brand> </product> </config> I'm reading it nicely into JDOM. However, when I try to use Jaxen to grab the contents, I can't seem to get anything. Here's an example of what doesn't seem to work: XPath xpath = new JD...

org.jdom.input.SAXBuilder not found

Hey, I encoutered following error: ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception java.lang.ClassNotFoundException: org.jdom.input.SAXBuilder Its enterprise project. Im using eclipse. I have jdom-1.0.jar on project 'Properties -> Java Build Path -> Libraries' and in next tab 'Order and Export' its ...

Possible causes for "schema feature not recognized for SAX driver"

I am trying to execute a program developed elsewhere, and I see the following exception: org.jdom.RuntimeException: http://apache.org/xml/features/validation/schema feature not recognized for SAX driver org.apache.cimson.parser.XMLReaderImpl This program ran successfully a few months ago, but my development platform was rebuilt (appa...

Accessing children with a given name via jdom

I want to access the children with skos:Concept. getChildren("skos:Concept") and getChildren("Concept") both give me an empty list what should I use instead?. My example Data: <owl:AnnotationProperty rdf:about="&dc;identifier"/> <owl:ObjectProperty rdf:about="&skos;narrower"/> <skos:Concept rdf:about="#concept:0_acetylpantolactone:425...

Is it possible to search jdom for attributes?

Is it possible in jdom to get the children of a node that share a certain attribute without having to look at all children in bruteforce? Is search in logarithmic time possible? ...

How can I get JDOM/XPath to ignore namespaces?

I need to process an XML DOM, preferably with JDOM, where I can do XPath search on nodes. I know the node names or paths, but I want to ignore namespaces completely because sometimes the document comes with namespaces, sometimes without, and I can't rely on specific values. Is that possible? How? ...

JDOM 1.1: hyphen is not a valid comment character

I'm using tagsoup to clean some HTML I'm scraping from the internet, and I'm getting the following error when parsing through pages with comments: The data "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " is not legal for a JDOM com...

How to get a non-XML output using JDOM XSLTransformer?

Hello, I have an XML file which I'd like to parse into a non-XML (text) file based on a XLST file. The code in both seem correct, and it works when testing manually, but I'm having a problem doing this programatically. I'm using JDOM's XSLTransformer class to apply the XSLT to the XML and it returns it in the format of a JDOM Docume...

Remove an element from an xml File using jdom

I have a 300 KB xml file with 70 elements in it. I need to be efficient upon removing one of the root's elements. What is the best approach? Should I detach the element in memory, save it and overwrite it by moving it? Is there a better option? I like org.jdom but any improvement is welcome ...