Encapsulation in Java with Example

Encapsulation is a basic principle of Java. Let me explain you encapsulation with a simple example.After reading the concept completely, I’m pretty sure you will never need to look back again to learn encapsulation concept. Encapsulation ensures to hide the implementation details of a class to the other classes. Basic elements in a class are instance variables and member functions. Let us assume...

Introduction: Basic understanding of XPath and its related concepts

Introduction to XPath: Full form of XPath is XML Path. It is a query language designed to traverse through an xml document and select the required nodes using XPath Expressions and XPath functions, which I will discuss in the next chapters. XPath is a World Wide Web consortium (w3c) recommendation and the latest specification is Xpath 2.0. This specification is designed to be referenced...

How to convert a XML file into a csv file using java?

We Used a property file to get xpath expressions of the corresponding mapped elements in XML file. If you got an doubt regarding property file, you can go throw my tutorial about how to read a property file. Here I converted an XML file into a Document Object and I have used the configured Xpath Expressions in the property file to retrieve the values from XML document. XMLToCSVMappings.java...

How to Read a Property File into Hash Map in Java

Property file is a typical plain java file with key and value pairs. It will have an extension of .properties.  Usually system level configurations or server level configuration. Each line typically refers to a configurable parameter. Format looks like key=value . Key being the Property name and value being the key’s Value. This is the simple Properties file  used in our sample program....

How to Create XML Document or String Object in Java Dynamically

Explanation: This sample example will construct a XML / DOM / Document Object in java. We will create new instance of DocumentBuilderFactory using DocumentBuilderFactory.newInstance() method. The newDocumentBuilder will create new instance of DocumentBuilder with configured parameters. The newDocument() method will create new instance of Document Object to Build a DOM Tree.Element is an...

How to Convert a Document DOM Object to XML String Object

Explanation: Document is an interface in org.w3c.dom package which extends Node Interface. This example is all about converting a document object to String Object which will be a valid XML. The method getXMLFromDOM() will take Document object as argument. So, we have created a document object using the method createDocument(). This createDocument() method is inturn clearly explained in my post...

How to Convert a XML String to Document Object

Explanation: Document is an interface in org.w3c.dom package. It extents Node interface.  The domFactory.setNameSpaceAware()  method will have argument “true” as our parser produced will support XML namespace. In this example, we will give getDocFromXMLString() Method a String Argument. Please Note that this String Argument must be a  valid XML. The newDocumentBuilder will create new...
Two Way Communication Using Digital Signature

Two Way Communication Using Digital Signature

Today is the world of computers. Everyone is dependent on computers for communication. So communication threats are increasing day by day. Traditional means of communication without security has become vulnerable. So, a secured communication is necessary. In our system, we have included many security mechanisms which can guard our transmitting data from all the security attacks. By using Digital...