Download presentation
Presentation is loading. Please wait.
1
Copyright © 2002 Sean C. Sullivan XML case study: SyncML Sean C. Sullivan at
2
Copyright © 2002 Sean C. Sullivan Agenda l XML and SyncML l Sync4j project l Q & A
3
Copyright © 2002 Sean C. Sullivan XML basics l “well-formed” documents l DTD –Document Type Definition l “valid” documents
4
Copyright © 2002 Sean C. Sullivan Simple XML document Portland, Oregon Rainy 47
5
Copyright © 2002 Sean C. Sullivan How are XML and SyncML related? l XML is a language for defining application-specific markup languages l SyncML is an XML-based markup language
6
Copyright © 2002 Sean C. Sullivan Simple SyncML document 1.0 SyncML/1.0 … …
7
Copyright © 2002 Sean C. Sullivan SyncML defined… “SyncML is a new industry initiative to develop and promote a single, common data synchronization protocol that can be used industry-wide.” (syncml.org) “SyncML is a specification for a common data synchronization framework and XML-based format […] for synchronizing data on networked devices.” (syncml.org) “SyncML is a […] protocol for conveying data synchronization operations.” (syncml.org)
8
Copyright © 2002 Sean C. Sullivan SyncML sponsors
9
Copyright © 2002 Sean C. Sullivan What is data synchronization? Data synchronization “is the process of making two sets of data look identical” (syncml.org whitepaper)
10
Copyright © 2002 Sean C. Sullivan Data Synchronization l Resolve conflicts Datastore1 l Exchange data modifications Datastore2 ACBCABACB
11
Copyright © 2002 Sean C. Sullivan What is a “data synchronization protocol”? l Method of communication for a data synchronization session l Protocol includes: –naming and identification of records –common protocol commands –identification and resolution of synchronization conflicts
12
Copyright © 2002 Sean C. Sullivan SyncML features l Synchronize any type of data l Multiple transport protocol bindings –HTTP, WSP, OBEX l Security l Interoperability
13
Copyright © 2002 Sean C. Sullivan SyncML: clients & servers SyncML server server modifications client modifications
14
Copyright © 2002 Sean C. Sullivan SyncML & XML l Abbreviated naming convention –Ex: ”protocol version” is l XML prolog is not required l WBXML – WAP Binary XML
15
Copyright © 2002 Sean C. Sullivan SyncML documents l DTD l Meta info DTD l Device info DTD
16
Copyright © 2002 Sean C. Sullivan document … … l “A SyncML Message is a well-formed, but not necessarily valid, XML document.” (syncml.org) l Contains data synchronization commands (operations)
17
Copyright © 2002 Sean C. Sullivan element 1.0 SyncML/1.0 session41 msg80386 …
18
Copyright © 2002 Sean C. Sullivan element cmd80486 …
19
Copyright © 2002 Sean C. Sullivan SyncML commands l
20
Copyright © 2002 Sean C. Sullivan Meta Info document l Contains sync session parameters … 586 …
21
Copyright © 2002 Sean C. Sullivan Device Info document l Describes device capabilities l For both client and server … 0.99 3.14 … pda …
22
Copyright © 2002 Sean C. Sullivan Sync4j project l Java implementation of SyncML protocol l sync4j client & sync4j server l open source l http://sync4j.sourceforge.net/
23
Copyright © 2002 Sean C. Sullivan XML parsing l SAX –“Simple API for XML” l DOM –document object model
24
Copyright © 2002 Sean C. Sullivan Choosing an XML parser l support for SAX 1.0? SAX 2.0? l support for DOM? l support for XML Namespaces? l validating or non-validating parser? l validation with DTD’s? l validation with XML Schema?
25
Copyright © 2002 Sean C. Sullivan XML parsers for Java l Apache Xerces-J l Apache Crimson l Sun JAXP –“Java API for XML Parsing” l JDOM l Also: –DOM4J, Oracle XML Parser for Java, ElectricXML, kxml, …
26
Copyright © 2002 Sean C. Sullivan sync4j key classes l Message l DeviceInfo l MetaInfo l Command classes: –AddCommand –DeleteCommand –ReplaceCommand
27
Copyright © 2002 Sean C. Sullivan Sync4j Message example 1 String strXML = “ … ”; Message msg; try { msg = new Message(strXML); } catch (InvalidMarkupException ex) { } catch (XMLSyntaxException ex) { }
28
Copyright © 2002 Sean C. Sullivan Sync4j Message example 2 SyncHeader header = new SyncHeader(...); SyncBody body = new SyncBody(...); Message msg; msg = new Message(header, body); String strXML = msg.toXML();
29
Copyright © 2002 Sean C. Sullivan XML data binding tools l Castor –http://www.castor.org/ l Zeus –http://zeus.enhydra.org/ l Sun JAXB –http://java.sun.com/xml/
30
Copyright © 2002 Sean C. Sullivan Summary l SyncML is an XML-based data synchronization protocol l Choose your XML parser carefully l Consider using an XML data-binding tool l http://www.syncml.org/ l http://sync4j.sourceforge.net/
31
Copyright © 2002 Sean C. Sullivan XML case study: SyncML Sean C. Sullivan at
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.