java - Getting started with JAXB -


schema root

<xs:schema jxb:version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.w3.org/2001/xmlschema http://www.nubean.com/schemas/schema.xsd" > <xs:element name="usorcanadaaddress" > 

jaxb binding xml

<?xml version='1.0' encoding='utf-8' ?> <jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/xmlschema" > <jxb:bindings node="/xs:schema" schemalocation="address.xsd" > <jxb:schemabindings> <jxb:package name="com.apress.jaxb1.example" ></jxb:package> </jxb:schemabindings> </jxb:bindings> </jxb:bindings>   

i beginning jaxb , these 2 tags came across in books.
have few basic questions regarding various parts of 2 tags. here go:

question 1:

xmlns:jxb="http://java.sun.com/xml/ns/jaxb"   

does attribute has have exact same value ?

question 2:

xsi:schemalocation="http://www.w3.org/2001/xmlschema     http://www.nubean.com/schemas/schema.xsd"   

this attribute, in schema.. in schema ??? mean, can understand attribute in xml document pointing xml schema ? if not trigger schema-ception ?
also, namespace-location pair. in xml document point physical location. here, have point physical location ?

question 3:
word binding. in head understand settings can change in mobile or computer apps. have default values can change. in above binding document, have changed package setting. now, assuming not want keep document in no package, should leave ?
not need write binding xml document ?

question 4:
in jaxb binding document schemalocation="address.xsd" points schema location. physical location. if schema packed jar file ?

question 1 - attribute has have exact same value ?

a jaxb (jsr-222) implementation expects elements elements in binding file qualified "http://java.sun.com/xml/ns/jaxb" namespace. not depend on particular prefix being used.


question 2 - attribute, in schema.. in schema ???

since xml schema xml document guess doing ok, have never done in xml schema myself.


question 3 - word binding.

i have kind of love/hate relationship word "binding". has come assocated converting objects to/from data formats aren't persistent (i.e. xml, json, etc).


question 4 - in jaxb binding document schemalocation="address.xsd" points schema location.

i not believe schemalocation required in bindings file.


since getting started jaxb may not want hung on binding document. it's needed when need customize classes generated xml schema. below example not needed:

what find more interesting use case staring objects. below example may find useful:


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -