Setting value of XSL parameter xsl:param in Saxon Java API

In one of my previous posts I showed you how to generate HTML from XML data using XSLT. At times you would need to pass certain parameters to the XSLT and use the value of that parameter in generating your content. In this post we will exactly do that. This will be our sample XML … Read more

Parsing XML in Groovy using XmlSlurper

In my previous post I showed different ways in which we can parse XML document in Java. You must have noticed the code being too much verbose. Other JVM languages like Groovy, Scala provide much better support for parsing XML documents. In this post I give you the code to parse the XML document in … Read more

Using JAXB to generate Java Objects from XML document

Quite sometime back I had written about Using JAXB to generate XML from the Java, XSD. And now I am writing how to do the reverse of it i.e generating Java objects from the XML document. There was one comment mentioning that JAXB reference implementation and hence in this article I am making use of the reference implementation that is shipped with the JDK.

Read more

Parsing XML is fun again- thanks to Groovy

I happened to work on Groovy while I was developing using Gaelyk and I found Groovy lot easier to write- I never thought of the types and this really helped me to make my codeGroov simpler and easier to write. And when you are dealing with RESTful APIs- you ought to be parsing XML,JSON and what not. As a Java programmer- I never enjoyed it. But Groovy really made parsing xml fun again.

Read more

Using JAXB to generate XML from the Java, XSD

We can use JAXB to marshal the Java objects into XML using the given Schema and vice versa- unmarshal XML into Java objects. The xml schema can be specified in DTD, XSD or other format. The tool “xjc” is used to generate the annotated Java classes from the XSD schema. One can download the Java WSDP from here, it includes the JAXB implementation tools required. Here I will throw light on how to generate XML dynamically. Even I havent gone in depth with JAXB, but I found this really useful and thought of sharing it in the blog.

Read more

JSON- JavaScript Object Notation

JSON- JavaScript Object NotationJSON

JSON (JavaScript Object Notation) is a lightweight data-interchange format based on the object notation of the JavaScript language. It does not require JavaScript to read or write; it is easy to parse by any language and libraries and tools exist in many languages to handle JSON.

It is:

  • easy for humans to read and write
  • easy for machines to parse and generate
  • based on a subset of the JavaScript Programming Language
  • text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages

Read more