Category: XML
Query XML Document with XPath and JDOM
We can use XPath to query an XML Document, searching for specific nodes using a query syntax. This tutorial shows how to Query an XML Document with XPath and JDOM. Maven Dependencies You need...
Validate XML against XSD Schema using JDOM
An XSD Schema is used to validate an XML document, it describes what elements, attributes, types are allowed and in which order. In the following tutorial we explain how you can validate an XML...
Validate XML against DTD using JDom
A Document Type Definition (DTD) defines which elements and attributes you can use inside an XML document. Typically this DTD document is specified inside the XML document. In this example we explain haw you...
Write XML File in Java using JDom XMLOutputter
JDom has an intuitive API and is therefore easy to use. In this example we explain how you can create a XML file using JDom. First we load the entire Document into memory. When...
Read XML in Java using JDom Parser
JDom is an open source library for manipulating XML documents. It has an easier API then the standard Java JDK libraries. In the following tutorial we explain how you can read an XML file...
Generate XSD from Java Classes
In this tutorial we show you how to generate XSD from Java Classes using java binding annotations. Java Classes can be converted into XSD schema and vice versa using the jaxb2-maven-plugin. We can specify...
Generate Java Classes From XSD
This example shows you how to generate Java Classes from XSD using jaxb2-maven-plugin. This plugin uses the XJC which is a JAXB Binding compiler tool that can generate Java Classes from XSD. Maven Project...
Custom Error Handler while Validating XML against XSD Schema
In this example we create a Custom Error Handler while Validating XML against XSD. We use the javax.xml.validation.Validator to check the XML document against the XSD schema. We can create a custom error handler...
Get Line Number from XML Validation against XSD Schema
In this example we will grab the Line and column number from the validation exception while validate XML against XSD Schema. We use the javax.xml.validation.Validator to check the XML document against the XSD schema....