Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between mapping,binding and parsing?

I am starting to learn web-services in java EE6.

I did web development before, but never nothing related to web services.

All is new to me and the books and the tutorials i find in the web are to technical.

I started learning about .xsd schemas and also .xml.

In that topic i feel confident, i understand what are the schemas used for and what validation means.

Now my next step is learning about JAX-B(Java Api for XML Binding). I rode some about it and i did also some practice in my IDE. But i have lots of basic doubts, that make me stuck and cannot feel confident to continue to the next topic.

Ill appreciate a lot if someone could explain me well my doubts:

  1. What does it mean mapping and what is a mapping tool?
  2. What does it mean binding and what is a binding tool?
  3. What does it mean parsing and what is a parsing tool?
  4. How is JAX-B related to mapping,binding and parsing?

I am seeking for a good answer built by you, not just a copy paste from google(Ive already been online a few hours and only got confused).

like image 986
javing Avatar asked Mar 23 '12 16:03

javing


People also ask

What is the difference between mapping and binding?

mapping is about transformation of a data structure into another (for instance: mapping a DTD to some object model). binding is about giving access to some actual data through some kind of data structure (for instance binding some XML file to DOM). This implies binding is one way, while mapping usually works both ways.

What is the difference between binding and parsing?

Binding is the process of in-memory (as the application is running) conversion of XML document to object represantation. Binding is achieved through unmarshalling. What does it mean parsing and what is a parsing tool? Parsing is reading an input stream of data and checking whether if the stream of data coforms to certain grammar.

What is mapping and binding tool in Java?

In case of Java/XML, mapping is nothing but representing a Java object model in to an XML document representation ( and vice versa. ) A mapping tool will allow you to convert from one format to another. This is just the definition step. What does it mean binding and what is a binding tool?

What are the two types of data binding?

Data binding can be categorized into 2 types, ie., One-way Binding & Two-way Binding. In one-way binding, the data flow is one-directional. This means that the flow of code is from typescript file to Html file. In order to achieve a one-way binding, we used the property binding concept in Angular.


1 Answers

Based on what I understand..

What does it mean mapping and what is a mapping tool?

In case of Java/XML, mapping is nothing but representing a Java object model in to an XML document representation ( and vice versa. ) A mapping tool will allow you to convert from one format to another. This is just the definition step.

What does it mean binding and what is a binding tool?

Binding is the process of in-memory(as the application is running) conversion of XML document to object represantation. Binding is achieved through unmarshalling.

What does it mean parsing and what is a parsing tool?

Parsing is reading an input stream of data and checking whether if the stream of data coforms to certain grammar. Parsing tools consume stream of data and generate errors when the data fails to conforms to grammar that the tool is checking. It would also generate events to indicate that it has received certain "tokens" from the stream. In java/xml scenario, there are multiple types of parsers such as DOM, StAx, SAX...

How is JAX-B related to mapping,binding and parsing?

JAXB mapping:

is when you use xjc to generate java class hierachy based on an XSD The mapping occurs when classes are generated with JAXB annotations Mapping tool in the scenario is xjc

JAXB Binding :

Occurs when an application unmarshalls an XML document to Object represanation (JAXBElement) unmarshaller.unmarshal( new File("some.xml"));

Parsing :

in order to convert XML document to object represantation, the JAXB engine has to first "parse" the xml document to ensure correctness and then tokenize to instatiate java objects. This happens internally and you do not control ito ensure correctness and then tokenize to instatiate java objects.

like image 102
ring bearer Avatar answered Oct 28 '22 18:10

ring bearer