XML and JSON Processing

Слайд 2

XML XML (eXtensible Markup Language) has been used in the Java

XML

XML (eXtensible Markup Language) has been used in the Java EE

platform since the beginning of deployment descriptors and metadata information.
Слайд 3

j.rorri@me.com +44 1234 1234 23.5 34.99




j.rorri@me.com
+44 1234 1234


quantity="1">
23.5


34.99




Слайд 4

XSD XML Schema Definition (XSD) is an XML-based grammar declaration used

XSD

XML Schema Definition (XSD) is an XML-based grammar declaration used to

describe the structure and content of an XML document
Слайд 5







name="expiry_date" type="xs:string"/>






Слайд 6

Parsing with SAX and DOM The Document Object Model (DOM) API

Parsing with SAX and DOM

The Document Object Model (DOM) API requires

reading the entire XML structure and holding the object tree in memory.
The Simple API for XML (SAX) is an event-driven, serial-access mechanism that does element-by-element processing
Слайд 7

Querying in XML XPath //content/order_line[unit_price>=20]/unit_price/text() XQuery for $orderLine in doc("order.xml")//content/order_line[@quantity>1] where $orderLine/unit_price return $orderLine/unit_price/text()

Querying in XML

XPath
//content/order_line[unit_price>=20]/unit_price/text()
XQuery
for $orderLine in doc("order.xml")//content/order_line[@quantity>1]
where $orderLine/unit_price < 50
return $orderLine/unit_price/text()

Слайд 8

XSLT eXtensible Stylesheet Language Transformations (XSLT ) allows to transform an

XSLT

eXtensible Stylesheet Language Transformations (XSLT ) allows to transform an XML

document from one vocabulary to another, in a generic manner

#

http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog

Слайд 9

JAXB Java Architecture for XML Binding (JAXB) allows developers to work

JAXB

Java Architecture for XML Binding (JAXB) allows developers to work with

Java objects that represent XML documents
@XmlRootElement annotation
marshaller.marshal(person, writer);
Generate XSD from Java class
jaxbContext.generateSchema(sor);

#

Слайд 10

JSON JSON (JavaScript Object Notation) originated with JavaScript for representing simple data structures

JSON

JSON (JavaScript Object Notation) originated with JavaScript for representing simple data

structures
Слайд 11

{ "order": { "id": "1234", "date": "05/06/2013", "customer": { "first_name": "James",

{
"order": {
"id": "1234",
"date": "05/06/2013",
"customer": {
"first_name": "James",
"last_name": "Rorrison",
"email": "j.rorri@me.com",
"phoneNumber": "+44 1234 1234"
}
}
}

Слайд 12

JSON Processing javax.json.JsonObject javax.json.JsonArray javax.json.Json OR org.json.JSONObject org.json.JSONArray #

JSON Processing

javax.json.JsonObject
javax.json.JsonArray
javax.json.Json
OR
org.json.JSONObject
org.json.JSONArray

#

Слайд 13

To read Beginning Java EE 7. Chapter 12 (http://www.goodreads.com/book/show/18979704-beginning-java-ee-7)

To read

Beginning Java EE 7. Chapter 12 (http://www.goodreads.com/book/show/18979704-beginning-java-ee-7)