Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

 

and many more ....

 

Receive Java & Developer job alerts in your Area

I have read and agree to the terms & conditions

 

Find elements by content with XPath

Bipartite Graph

This is an example of how to find elements by content 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. Finding elements by content using XPath implies that you ...

Read More »

Find elements by attributes with XPath

Bipartite Graph

In this example we shall show you how to find elements by attributes using XPath. The XPath language provides a simple, concise syntax for selecting nodes from an XML document. To find elements by attributes using XPath one should perform the following steps: Obtain a new instance of a DocumentBuilderFactory, that is a factory API that enables applications to obtain ...

Read More »

Find elements by absolute location with XPath

Bipartite Graph

With this example we are going to demonstrate how to find elements by absolute location in XPath. The XPath language provides a simple, concise syntax for selecting nodes from an XML document. In short, to find elements by absolute location in XPath you should: Obtain a new instance of a DocumentBuilderFactory, that is a factory API that enables applications to ...

Read More »

Visit all elements in DOM document

Bipartite Graph

This is an example of how to visit all elements in a DOM Document. A DOM is a standard tree structure, where each node contains one of the components from an XML structure. The two most common types of nodes are element nodes and text nodes. Using DOM functions lets you create nodes, remove nodes, change their contents, and traverse the ...

Read More »

List all attributes of DOM element

Bipartite Graph

In this example we shall show you how to list all attributes of a DOM element in Java. We have implemented a method, void listAllAttributes(Element element), that lists all attributes that a specific Node contains. The steps to get a DOM object of a file and list all attributes of the DOM elements using the listAllAttributes(Element element) method is described below: Obtain ...

Read More »

Remove attribute from DOM element

Bipartite Graph

With this example we are going to demonstrate how to remove an attribute from a DOM Element. We have implemented a method, that is void prettyPrint(Document xml), in order to convert a DOM into a formatted XML String. In short, to remove an attribute from a DOM Element you should: Obtain a new instance of a DocumentBuilderFactory, that is a ...

Read More »

Add attribute in DOM element

Bipartite Graph

This is an example of how to add an attribute in a DOM element. We have implemented a method, that is void prettyPrint(Document xml), in order to convert a DOM into a formatted XML String. Adding an attribute in a DOM element implies that you should: Obtain a new instance of a DocumentBuilderFactory, that is a factory API that enables ...

Read More »

Remove nodes from DOM document recursively

Bipartite Graph

In this example we shall show you how to remove Nodes from a DOM Document recursively. We have implemented two methods, removeRecursively(Node node, short nodeType, String name), in order to remove recursively a Node from a DOM Document and void prettyPrint(Document xml), in order to convert a DOM into a formatted XML String. To remove Nodes from a DOM Document recursively ...

Read More »

Remove node from DOM document

Bipartite Graph

With this example we are going to demonstrate how to remove a Node from a DOM Document. We have implemented a method, that is void prettyPrint(Document xml), in order to convert a DOM into a formatted XML String. In short, to remove a Node from a DOM Document you should:  Obtain a new instance of a DocumentBuilderFactory, that is a factory API ...

Read More »

Create DOM document from scratch

Bipartite Graph

This is an example of how to create a DOM Document from Scratch. We have implemented a method, that is void prettyPrint(Document xml), in order to convert a DOM into a formatted XML String. Creating a DOM Document from Scratch implies that you should: Create an new Document, using newDocument() API method of DocumentBuilder. Create the root element node of the ...

Read More »