Common Coding Problems

How to minify and pretty print XML in JavaScript

6 months ago codedestine 0
How to minify and pretty print XML in JavaScript In this tutorial, we will learn how to minify and pretty print XML in JavaScript. We will use vkbeautify java script plugin, it is a small and simple java script plugin to beautify XML, JSON or CSS text. Sample :- XML for book type :- <Book> <id>01</id> <language>Java</language> Read More

How to minify and pretty print JSON in JavaScript

6 months ago codedestine 0
How to minify and pretty print JSON in JavaScript :-  In this tutorial, we will learn how to minify and pretty print JSON in JavaScript. Java Script provide us a method JSON.stringify(), which can convert Java Script value or object to JSON string. Method :-    JSON.stringify ( value])  This method takes three Read More

How to parse JSON in JavaScript

6 months ago codedestine 0
How to parse JSON in JavaScript :-  If you had worked on angularJS or any other modern java script framework, then you would have noticed that, now days restful web services are used to communicate ( Getting data or Posting data ) with the server. In restful web services, JSON format is used ( mostly Read More

Download file from Internet in Java using apache commons-io

6 months ago codedestine 0
Download file from Internet in Java :- In this tutorial, we will learn to download file from Internet in java using apache’s commons-io library. Let’s see an implementation using commons-io library with the help of an example :- Apache Commons-IO :-  In case of commons-io library, we will call copyURLToFile() method of FileUtils class by passing URL Read More

Download file from URL in Java using java.io & java.nio

6 months ago codedestine 0
Download file from URL in Java :- In this tutorial, we will learn to download file from URL in java. There are two different API’s in Java, which can be used for this purpose, java.io & java.nio. Let’s see an implementation using both API’s with the help of an example  :- Java IO :-  In Read More

Convert XMLGregorianCalendar to Date Object

6 months ago codedestine 0
XMLGregorianCalendar to Date Object :- In this tutorial, we will learn to convert XMLGregorianCalendar to Date Object. If you had worked on a project which consume or publish SOAP web services, then you would had faced a problem in converting XMLGregorianCalendar to Date Object and vice versa. Let’s see an implementation with the help of Read More

Convert Date to XMLGregorianCalendar Object

6 months ago codedestine 0
Date to XMLGregorianCalendar Object :- In this tutorial, we will learn to convert Date to XMLGregorianCalendar Object. If you had worked on consuming or publishing SOAP web services, then you would had faced the problem in converting Date to XMLGregorianCalendar Object and vice versa. Let’s see an implementation with the help of an example  :- Example Read More

How to read and write JSON in Java using org.json

9 months ago codedestine 0
How to read and write JSON in Java :- If you had worked on restful web services, then you would have faced a problem of reading and writing JSON in java. JSON stands for JavaScript Object Notation, it is language independent, easy to understand, lightweight data-interchange format.  Let’s see how to read and write JSON in java Read More

How to parse JSON in Java using fasterXML / jackson-databind lib

10 months ago codedestine 0
How to parse JSON in Java :- If you had worked on restful web services, then you would have faced a problem of parsing JSON in java. JSON stands for JavaScript Object Notation, it is language independent, easy to understand, lightweight data-interchange format. JSON is a text only format, So to use it in Java, we Read More

Removing Timezone from XMLGregorianCalendar

10 months ago codedestine 3
If you had worked on a project which consume or publish web services, then you would have faced a problem with date (XMLGregorianCalendar) object, where you would like to send only date string as yyyy-MM-dd but complete yyyy-MM-dd’T’HH:mm:ss’Z’ has been sent. This date string contains date, time and timezone information, if you like to send Read More