Home » Tag Archives: XML (page 5)

Tag Archives: XML

Approaches to XML – Part 1 – XML is not a String…

XML has been around a long time: from memory, I’d guess that it’s about 12-14 years old by now; it’s a mature product with, in computing terms, a long history. So, is there anything new that I could possibly add to this subject? How you approach XML is really down to you and your situation, with the emphasis being on ...

Read More »

Scala Basic XML processing

Introduction Pretty much everybody knows what XML is: it is a structured, machine-readable text format for representing information that can be easily checked for the “grammaticality” of the tags, attributes, and their relationship to each other (e.g. using DTD’s). This contrasts with HTML, which can have elements that don’t close (e.g. <p>foo<p>bar rather than <p>foo</p><p>bar</p>) and still be processed. XML ...

Read More »

JAXB and Unmapped Properties


JAXB (JSR-222) is configuration by exception, meaning that there is a default mapping applied to domain objects. This means that sometimes you need to explicitly exclude a field/property. In this post I’ll discuss how this can be done using @XmlTransient or @XmlAccessorType(XmlAccessType.NONE) and when each option is appropriate. @XmlTransient When you mark a field/property with @XmlTransient you are explicitly telling ...

Read More »

XML parsing using SaxParser with complete code

SAX parser use callback function (org.xml.sax.helpers.DefaultHandler) to informs clients of the XML document structure. You should extend DefaultHandler and override few methods to achieve xml parsing. The methods to override are startDocument() and endDocument() – Method called at the start and end of an XML document.  startElement() and endElement() – Method called at the start and end of a document ...

Read More »

JAXB, SAX, DOM Performance

This post investigates the performance of unmarshalling an XML document to Java objects using a number of different approaches. The XML document is very simple. It contains a collection of Person entities.  <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <persons> <person> <id>person0</id> <name>name0</name> </person> <person> <id>person1</id> <name>name1</name> </person> ... There is a corresponding Person Java object for the Person entity in the XML ...

Read More »

Develop Restful web services using Spring MVC

REST INTRODUCTION From Wikipedia: REST-style architectures consist of clients and servers. Clients initiate requests to servers; servers process requests and return appropriate responses. Requests and responses are built around the transfer of representations of resources. A resource can be essentially any coherent and meaningful concept that may be addressed. As you have read the most important thing in Rest architecture ...

Read More »

Reusing Generated JAXB Classes

In this post I will demonstrate how to leverage the –episode XJC extension to reuse classes previously generated from.an XML schema. This is useful when an XML schema is imported by other XML schemas and you do not want the same classes generated each time. Imported Schema (Product.xsd) The following XML schema represents basic information about a product. Product is ...

Read More »

Mapping Objects to Multiple XML Schemas – Weather Example

I have written previous posts on EclipseLink JAXB (MOXy)‘s @XmlPath and external binding file extensions. In this post I will demonstrate how powerful these extensions are by mapping a single object model to two different XML schemas. To make the example more “real”, the XML data will come from two different services that provide weather information: Google and Yahoo. Java ...

Read More »

Using JAXB to generate XML from XSD

This is a post originally published by Mohamed Sanaulla from Experiences Unlimited, our latest JCG partner. Mohamed explains how to use JAXB to generate XML from a given XSD. (NOTE: The original post has been slightly edited to improve readability) We can use JAXB to marshal the Java objects into XML using the given Schema and vice versa- unmarshal XML ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns