Convert XML Document To XML String, XML String to XML Document In Java

When you program in java, you go through situation where you need to convert the XML Document into Java String and vice versa. Below You can see an example.

Consider the following student.xml

<Details>
   <student>
          <name>Rockey</name>
    </student>
   <student>
        <name>Sony</name>
   </student>
</Details>

Parsing XML String Using DOM

Parsing XML String Using DOM Example describes about Parsing XML String Using DOM parser.

How To Parse / Read XML File In Java?

Consider the below example xml file, where you need to parse that xml and extract all the student names of that file,

Here we are using DocumentBuilderFactory, DocumentBuilder & Document  in order to create an instance of Dom object, so that we can easily parse that Dom object.

Package org.w3c.dom is a Java API for XML Processing, This package helps to manipulate the Document Object Model (DOM). The Dom element represents the entire XML or HTML document.

Create Sitemap Using Java

Create Sitemap Using Java Tutorial describes about creating sitemap using java

It will also support for google site map updations

Sitemap is an easy manner for a webmasters to notify search engine spiders about pages on their sites that are accessible for crawling and indexed.

Sitemap is a simple XML file that consists of list of Entries (URLs) of a website along with some other details about URL like URL last updated time, how often URL updated ( ie; change frequency of URL) and how vital it is ( ie; priority of URL)

so that by using these informations search engines spiders can able to crawl the site.