Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Wednesday, January 23, 2008

XML Serialization

Classic Defintion:
The reversible process of encoding a data structure as a sequence of bytes

Marshall & Unmarshall:
Marshalling is the process of generating XML document from the instance of Java Class(or any other language in context) and as unmarshalling is interpreting java object from xml document.

Usage:
Wherever xml <--> java occurs heavily. For example, SOAP clients or any other XML intensive processing in java

Frameworks:
Breeze XML Binder, a tool produced by Breeze Factor
http://www.breezefactor.com/.
JAXB Reference Implementation, created by SUN
http://java.sun.com/xml/jaxb/.
Castor:an open source project under ExoLab
http://www.castor.org/spring-xml-intro.html
http://www.ibm.com/developerworks/xml/library/x-xjavacastor2/
XML Beans: Apache Open Source
http://www.onjava.com/pub/a/onjava/2004/07/28/XMLBeans.html

Comparision:
http://www.xml.com/pub/a/2003/09/03/binding.html
http://dev2dev.bea.com/pub/a/2004/05/ryan_xml.html


Known Issues:

1. The language of XML Schema is much richer than the object model of Java,
2. Not all XML names can be turned into Java identifiers, xsd:enumeration declarations cannot be nicely mapped into Java types (even since Java 5),
3. Some Java types are by nature explicitly unportable.
4. XML is a hierarchical data structure, and can only describe trees or lists of data, while Java classes almost invariably refer to other objects, oftencreating cyclic graphs of references.
5. Each node in an XML message can have a separate namespace, which cannot be expressed in Java.

O/X Mapping:
The upcoming improvements are to provide a way to map Object to XML document to overcome most of the known issues

Saturday, January 19, 2008

XML Schema Languages

1.DTD Data Type Definition

Basic.


2.XML Schemas (XSD)
Widely used

3.RELAX NG
RELAX NG is a schema language for XML. The key features of RELAX NG are that it:

is simple
is easy to learn
has both an XML syntax and a compact non-XML syntax
does not change the information set of an XML document
supports XML namespacezs
treats attributes uniformly with elements so far as possible
has unrestricted support for unordered content
has unrestricted support for mixed content
has a solid theoretical basis
can partner with a separate datatyping language (such W3C XML Schema Datatypes)


4.Schematron
The Schematron differs in basic concept from other schema languages in that it not based on grammars but on finding tree patterns in the parsed document. This approach allows many kinds of structures to be represented which are inconvenient and difficult in grammar-based schema languages. If you know XPath or the XSLT expression language, you can start to use The Schematron immediately.