Copyright © 2002 Sean C. Sullivan XML case study: SyncML Sean C. Sullivan at
Copyright © 2002 Sean C. Sullivan Agenda l XML and SyncML l Sync4j project l Q & A
Copyright © 2002 Sean C. Sullivan XML basics l “well-formed” documents l DTD –Document Type Definition l “valid” documents
Copyright © 2002 Sean C. Sullivan Simple XML document Portland, Oregon Rainy 47
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
Copyright © 2002 Sean C. Sullivan Simple SyncML document 1.0 SyncML/1.0 … …
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)
Copyright © 2002 Sean C. Sullivan SyncML sponsors
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)
Copyright © 2002 Sean C. Sullivan Data Synchronization l Resolve conflicts Datastore1 l Exchange data modifications Datastore2 ACBCABACB
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
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
Copyright © 2002 Sean C. Sullivan SyncML: clients & servers SyncML server server modifications client modifications
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
Copyright © 2002 Sean C. Sullivan SyncML documents l DTD l Meta info DTD l Device info DTD
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)
Copyright © 2002 Sean C. Sullivan element 1.0 SyncML/1.0 session41 msg80386 …
Copyright © 2002 Sean C. Sullivan element cmd80486 …
Copyright © 2002 Sean C. Sullivan SyncML commands l
Copyright © 2002 Sean C. Sullivan Meta Info document l Contains sync session parameters … 586 …
Copyright © 2002 Sean C. Sullivan Device Info document l Describes device capabilities l For both client and server … … pda …
Copyright © 2002 Sean C. Sullivan Sync4j project l Java implementation of SyncML protocol l sync4j client & sync4j server l open source l
Copyright © 2002 Sean C. Sullivan XML parsing l SAX –“Simple API for XML” l DOM –document object model
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?
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, …
Copyright © 2002 Sean C. Sullivan sync4j key classes l Message l DeviceInfo l MetaInfo l Command classes: –AddCommand –DeleteCommand –ReplaceCommand
Copyright © 2002 Sean C. Sullivan Sync4j Message example 1 String strXML = “ … ”; Message msg; try { msg = new Message(strXML); } catch (InvalidMarkupException ex) { } catch (XMLSyntaxException ex) { }
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();
Copyright © 2002 Sean C. Sullivan XML data binding tools l Castor – l Zeus – l Sun JAXB –
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 l
Copyright © 2002 Sean C. Sullivan XML case study: SyncML Sean C. Sullivan at