Home » Core Java » xml » Page 4

xml

XPath String functions example

In the previous examples, we talked about how we can query for a particular node(s) and extract the attribute value from a node in an XML Document. In this example, we shall see what other String operations on XPath are supported by the Java programming language. The String operations are a range of functions that may be used to search/query. ...

Read More »

XPath starts-with example

In this example we will learn how to use starts-with function of XPath. We will start with the introduction of XPath – what it is and how to use it, then we will see the working model of ‘starts-with’ function. Tools and technologies used in this example are Java 1.7, Maven, Intellij. 1. Overview XPath expression specifies a pattern that ...

Read More »

XPath get attribute value example

Continuing on our previous example on how to search for a text using XPath, we shall demonstrate how to get an attribute value from an XPath Node. As we already know, the @ attribute is used to denote an attribute in the XPathExpression. So we shall use extract the attribute value by specifying the node selector in the expression. In ...

Read More »

XPath contains text example

In this example, we shall study how to search for a particular text using XPath in Java. What is XPath? XPath is a query language used to define/select parts of an XML Document using variety of criteria. Java provides all the utility classes for using XPath in the javax.xml.xpath package. XPath uses pattern to filter out the matching nodes. The ...

Read More »

JAXB JSON Example

In this example we shall show you how to make use of JAXB-JSON. JAXB is a java architecture for XML binding is an efficient technology to convert XML to and from Java Object. EclipseLink JAXB (MOXy) is one of JAXB implementation which is mostly used to create java classes from XML or JSON. In Java JAXB provides two general purpose ...

Read More »

JAXB unmarshal example

In my last article, I’ve explained how to marshall java objects to xml using JAXB. In this one, we are going to see how to do the complementary operation: unmarshal xml files into java objects and what should be taken into consideration while doing this operation. For this purpose we are going to use the same example as in the ...

Read More »

JAXB marshal example

In this example we are going to show how to use the JAXB marshal functionalities. JAXB offers the possibility to convert Java objects into XML structures and vice versa, it comes with the JRE bundle since the first versions of the JRE 1.6. As example, we are going to create a list of museums and store it in a specific ...

Read More »

Java XML parser Tutorial

In this tutorial, we will discuss the Java XML parser or how to read XML files. XML is a markup language that defines a set of rules for encoding documents. Java offers a number of libraries in order to parse and process XML documents. Java xml parser examples provides the required functionality to read and modify an XML file. The ...

Read More »

JAXB Hello World example

With this example we shall show you how to work with the JAXB framework in Java. JAXB stands for Java Architecture for XML Binding. You can use JAXB to convert an object to XML format and write it to an XML File as well as read an XML File and construct a Java object out of it. These to operations ...

Read More »

Create XML File in Java using JDOM parser example

In this tutorial we are going to see how to create an XML File in Java using JDOM parser. If you’ve read the previous tutorial on JDOM parser about modifying an XML File you might have a very clear aspect on what this tutorial is all about. Basically we are going to create a root Element and some new child ...

Read More »