Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML as a Data Description and Distribution Language Software Development Conference 2000 San Jose, California March 23, 2000 Copyright 2000 © Faison Computing.

Similar presentations


Presentation on theme: "XML as a Data Description and Distribution Language Software Development Conference 2000 San Jose, California March 23, 2000 Copyright 2000 © Faison Computing."— Presentation transcript:

1 XML as a Data Description and Distribution Language Software Development Conference 2000 San Jose, California March 23, 2000 Copyright 2000 © Faison Computing Inc. Ted Faison ted.faison@computer.org

2 XML as a document description language SGML originated back in 1974 XML was first published in 1998, as a replacement for SGML. Both use DTDs. Purpose of a DTD.

3 Problems with DTDs Use their own language, grammar and syntax Limited attribute options Very week element typing –Basically just CDATA and PCDATA No inheritance for extending types

4 Managing data with XML XML as a data definition language –XML schemas with datatypes –scalar types and composites –extensible types XML DOM Programming –The W3C Document Object Model Example 1 in Java –Using the Open Source Xerces-J XML Parser.

5 Managing data with XML Querying XML data –Locating elements in an XML DOM Example 2 in Delphi –MSXML search patterns can be found at http://msdn.microsoft.com/xml/reference/xsl/Examples.asp

6 XML Schemas Several proposals under development SchemaProposer –XML SchemaW3C –RDF SchemaW3C –XML-DataMicrosoft –DCDIBM, Microsoft –SOXVeo Systems –DDML (ex Xschema)XML-dev group

7 Benefits of XML Schemas Standard XML –easier to understand –can use XML tools for editing –more expressive than DTDs –support for namespaces Powerful datatypes that are familiar to programmers –reusable types: archetypes

8 XML Schema Datatypes scalar, structured and derived types Document-oriented types –string Data-oriented types –int, boolean, date, float, etc. Derived Types

9 XML-Data Schema Layout The current Microsoft standard –May merge with DCD Top-Level Schema Element …….. Standard Namespaces <Schema xmlns ="urn:schemas-microsoft-com:xml-data” xmlns:dt ="urn:schemas-microsoft-com:datatypes"> …..

10 XML Schema Range Checking –The XML Schema WG has proposed the use of facets to define range constraints and other attributes of datatypes. –The DCD WG is considering min and max attributes to define ranges. –The XML-Data spec (1998-01-05) defines min and max elements for ranges. –MSXML currently implements a subset of XML-Data.

11 XML-Data Characters char String, one character long (Unicode). string sequence of chars (any length). string.ansi sequence of ASCII characters {0..0xFF} not supported by msxml yet. Example 3 in XML

12 XML-Data Booleans boolean –holds the values ‘0’ and ‘1’. Schema <Schema xmlns ="urn:schemas-microsoft-com:xml-data” xmlns:dt ="urn:schemas-microsoft-com:datatypes"> Code 1 Example 4 in XML

13 XML-Data Binary Numbers bin.base64 MIME-style Base64 encoded binary BLOB. bin.hex Hexadecimal digits representing octets. uuid Hexadecimal digits representing octets, with optional embedded hyphens. For example: "333C7BC4-460F-11D0-BC04-0080C7055A83"

14 XML-Data Integer Numbers int –Potentially any number of digits. Msxml supports 32 bit signed number. No fractions, and no exponent. i1, i2, i4 –Integer represented in 1, 2 or 4 bytes. For example: "1”, “127”, “-15828”, “44443333".

15 XML-Data Integer Numbers ui1, ui2, ui4 –Unsigned integer represented in 1, 2 or 4 bytes. A number, unsigned, no fractions, no exponent. For example: "10”, “255”, “1000000".

16 XML-Data Floating Point Numbers float, number –Real number, with no limit on digits; can have a leading sign, fractional digits, and optionally an exponent. Punctuation as in U.S. English. Msxml encodes the numbers as 64-bit values. For example “-102233.0044”.

17 XML-Data Numbers fixed.14.4 Same as "number" but up to 14 digits to the left of the decimal point, and 4 to the right. r4, r8 Real number, encoded as 32 or 64 bit value. r4 has 7 digit precision, r8 has 15 digit precision. Can have a leading sign, fractional digits and optional exponent. Values for r4 are ~ {1E-38.. 1E+38}. Values for r8 are ~ {1E-308.. 1E308}. Example 5 in XML

18 XML-Data Date & Time date –Date in ISO 8601 format, without the time data. For example: "1994-11-25". time –Time in ISO 8601 format, with no date and no time zone. For example: ”21:15:57".

19 XML-Data Date & Time dateTime –Date in ISO 8601 format, with optional time, but no time zone. Fractional seconds can be as precise as nanoseconds. For example: "1988-12-16T18:39:09.4056". Example 6 in XML

20 XML-Data Date & Time dateTime.tz –Same as dateTime, but with a timezone offset. For example: "1988-04-06T18:39:09.500-08:00" time.tz –Same as time, but with a timezone offset. For example: "08:15:27-05:00"

21 XML-Data Identifiers uri –Uniform Resource Identifier. For example: "urn:schemas-microsoft-com:xyz".

22 XML-Data Testing Datatype Validation IE5 doesn’t validate datatypes automatically. Must use msxml explicitly. Set msxmldom.validateOnParse = true. XML document must reference a schema.

23 Sample HTML Test Script var parser = new ActiveXObject("Microsoft.XMLDOM"); parser.async = false; parser.validateOnParse = true; parser.load(”My_XML_File.xml"); if (parser.parseError != 0) alert(parser.parseError.reason);

24 XML-Data Example Summary Strings Example 3 Booleans Example 4 Numbers Example 5 Dates/Times Example 6

25 Accessing XML Datatypes Programming language examples in: –JavaScript (Example 7) –Visual Basic (Example 8) –C++ (Example 9)

26 Aggregate Data Structures Arrays Linked Lists Trees Example 10 in Delphi

27 Structured Types - Objects –Encoding fields and properties Use RDF Roll your own format, using attributes and elements –Example 11 in JavaScript –Method Calls: Can employ the new Simple Object Access Protocol

28 Structured Types - Database Result Sets –ADO Record Sets –Generating XML data –Example 12 in Delphi

29 Structured Types - Database Result Sets IE5 Record Set Features –Data Source Objects support data-binding for GUI controls fetch XML data from a URL using http –DSOs as XML Islands support the direct embedding of xml data in an html document

30 RDF - Resource Description Framework Developed to encode semantics Uses an XML schema Uses standard directed graphs –Objects with properties –Collections of properties –Hierarchies of objects Uses namespaces

31 RDF - Resources as Objects with properties Support for inheritance of classes Vehicle CarTruck

32 RDF Inheritance - Superclass <rdf:Class xmlns rdf: ”http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns rdfs:”http://www.w3.org/TR/1999/PR-rdf-schema-19990303#” rdf:ID=“Vehicle”> Superclass for cars, boats and trucks

33 RDF Inheritance - Subclass <rdf:Class xmlns rdf: ”http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns rdfs:”http://www.w3.org/TR/1999/PR-rdf-schema-19990303#” rdf:ID=“Car”>

34 RDF Graphs MyCar CarVehicle subClassOf DoorsPrice 420000 Engine engine Size 2.2 liter Color red

35 RDF Issues Namespaces not stable Datatyping mechanism not defined pending XML Schema publication RDF Schema not stable yet. See http://www.w3.org/1999/02/22-rdf-syntax-ns http://www.w3.org/TR/xml-infoset Appendix B Graphs are unwieldy for complex cases Could use UML

36 Linking Systems with XML The simple way: Using GET or POST Command and parameters are embedded in a single XML argument in a URI: http://www.fci.com/myscript.asp?command=xmlstring where xmlstring might be: Chris Lake –Caller receives data returned from command as an HTML page

37 Linking Systems with XML: SOAP –Simple Object Access Protocol as a standard RPC mechanism –Uses standard XML over HTTP HTTP Content Type is text/xml-SOAP Easy to learn Independent of component architectures and computing platforms –Can easily penetrate firewalls –complete spec can be found at msdn.microsoft.com/xml/general.soapspec-v1.asp

38 SOAP - Basic XML Elements –defines the standard soap namespace urn:schemas-xmlsoap-org:soap.v1 –optional

39 SOAP - Sample Request Chris Johnson

40 SOAP - Sample Response with a Single Value 50000

41 SOAP - Sample Response with Multiple Values Joe William Smith

42 SOAP - Exception Handling Uses predefined elements Fault, faultcode, faultstring, detail and runcode <soap:Envelope xmlns:soap='urn:schemas-xmlsoap-org:soap.v1'> 400 Application Faulted Invalid Employee Name -8

43 Conclusion XML is well-suited to describe type-rich data. DTDs are inadequate. XML Schemas do a much better job. But those schemas are still evolving. XML can encode not only data, but method calls and responses. XML technology is still in its infancy. XML is the basis for numerous emerging standards, e.g VML, WML and others.

44 For More Information All examples for this presentation can be found at: www.faisoncomputing.com/ publications/PublicationsbyTedFaison.html XML Schema spec www.w3.org/TR/xmlschema-2/ XML-Data spec www.w3.org/TR/1998/NOTE-XML-data-0105/ RDF spec www.w3.org/TR/PR-rdf-schema/


Download ppt "XML as a Data Description and Distribution Language Software Development Conference 2000 San Jose, California March 23, 2000 Copyright 2000 © Faison Computing."

Similar presentations


Ads by Google