Home » xml

Tag Archives: xml

Log4j Enable/Disable Logging Example

Let’s say developers want to disable or enable the Log4j framework by simply clicking some checkboxes. The advantage of this is that when developers use the Log4j framework in the production environment and want to enable logging at any time, they just don’t need to change the XML or the properties file from the local machine and then upload it. ...

Read More »

Java XPath Using SAX Example

1. Introduction XPath is used to retrieve and interpret information represented in XML files using either a DOM or SAX parser. * DOM – Document Object Model – This popular class of parsers read the entire XML file and construct the DOM in memory. Since the DOM is memory resident, evaluation of the XPath expressions is faster. * SAX – ...

Read More »

Java XPath Performance Tips

1. Introduction This is the third article in a series dealing with using XPath within a Java application. This article focuses attention on tips for improving XPath performance. The first two articles were: A Java XPath Best Practices Tutorial https://examples.javacodegeeks.com/core-java/xpath-best-practices-tutorial/ Which showed how to setup and evaluate XPath expressions using Java. Java XPath Examples https://examples.javacodegeeks.com/core-java/xml/xpath/java-xpath-examples/ Which explored XPath syntax and ...

Read More »

XPath Best Practices Tutorial

XPath is used to retrieve and interpret information represented in XML files. This tutorial assumes that the reader has a working knowledge of XPath, does not attempt to teach XPath. This tutorial instead shows you, the reader, how to create a simple Java SE application that uses XPath expressions to get information about a computer inventory stored in an XML ...

Read More »

JAXB Binding Example

JAXB stands for Java Architecture for XML Binding. JAXB provides convenient way to bind XML schemas and Java representations, making it easy for developers to work with XML data and its processing in Java based applications. To help with this, JAXB provides methods for unmarshalling XML instance documents into Java content trees, and then marshalling Java content trees back into ...

Read More »

Eclipse Oxygen XML Editor plugin tutorial

In this example we are going to see how you can install and use an XML editor for your Eclipse IDE. XML is a mark-up language that has its own unique characteristics, and it’s used in a vast number of applications, mostly web based, but in recent years it plays a crucial role generally in universal, platform independent information exchanging ...

Read More »

Convert XML File into Properties object

In the previous tutorial we saw how to convert Properties object to XML Format and write it to XML File. In this tutorial we are going to show you how to the opposite, that is convert an XML File into a Properties object in Java.                   Here is the XML File that ...

Read More »

Convert Properties into XML File

With this example we shall show you how to convert a java.util.Properties object to XML format and write it to a File. The Properties class is a very popular Java utility and it can be used in numerous occasions in a Java application. And because of that it is quite useful to store these properties to an XML File and ...

Read More »

Read XML File in Java using JDOM parser example

In this example we are going to see how to parse an XML File using JDOM. JDOM is a Java representation of an XML. It’s a very easy to use tool and it has a straightforward API. It’s an alternative to DOM and SAX and it integrates equally well with both of them. JDOM is an external library and you ...

Read More »

Find elements by id with XPath

With this example we are going to demonstrate how to find elements by Id using XPath. The XPath language provides a simple, concise syntax for selecting nodes from an XML document. XPath also provides rules for converting a node in an XML document object model (DOM) tree to a boolean, double, or string value. In short, to find elements by ...

Read More »