Preparing for Java Interview?

My books Grokking the Java Interview and Grokking the Spring Boot Interview can help

Download a FREE Sample PDF

Thursday, August 31, 2023

Top 10 XML Interview Questions and Answers for Beginners

XML Interview questions are very popular in various programming job interviews, including Java interviews for web developers. XML is a mature technology and is often used as a standard for transporting data from one platform to another. XML Interview questions contain questions from various XML technologies like XSLT which is used to transform XML files, XPATH, XQuery, and fundamentals of XML e.g. DTD or SchemaIn this article, we will see the top  10 frequently asked XML Interview questions and answers from the above topics. These questions are mostly asked in various Java interviews but they are equally useful in other programming interviews like C, C++, Scala, or any other programming language.

Tuesday, May 16, 2023

How to Read XML File as String in Java? 3 Examples

Suppose you have an XML file and you just want to read and display the whole file as String in Java, may be for debugging purposes. If you are wondering how to do that in Java, well there are many ways to read XML as String in Java. You can do it in one line if you are fine with using an open-source library or you can do it in a couple of lines of code in core Java as well. Since an XML file is also a file, you can use BufferedReader or FileInputStream to read the content of an XML file as String by using the techniques, I have discussed in my earlier post 3 ways to convert InputStream to String in Java

XPath Tutorial - How to select elements in XPATH based on attribute and element value example

In this XPATH tutorial we will see example of selecting elements based upon its value or attribute value. We will see how to select between two elements based upon value of its child elements or based upon value of its attribute. XPATH is an important concept to understand if you are working with XML files. Most of Back-office platform relies on XML files for transporting data from one system to other and if you are working on any back-office or middle office system in Java or .NET, its important to know about XPATH and be able to use XPATH to select data from XML. Some time back I have shared my XPATH notes for Java programmer and this example shows true power of XPATH as how convenient its to made selective decision.