XML And Windows CE 3.0

zhaozj2021-02-16  53

XML And Windows CE 3.0

Michael Reevesmicrosoft Corporation

NOVEMBER 2000

Summary:. Windows CE 3.0 operating system extends the range of options available to developers by providing a subset of Extensible Markup Language (XML) functionality This document describes the features of XML that have been incorporated into Windows CE and the differences between using XML on a Windows Ce-Based Platform and ON A Windows-Based Desktop Computer. (9 Printed Pages)

Content

IntroductionExtensible Markup Language Web Services and XMLXML for Windows CE Validating Data Document Management Formatting Complex Data for Presentation Xmlhttp Instantization of Com Objects Through XSL

Introduction

The Microsoft® Windows® CE 3.0 operating system extends the range of options available to developers by providing a subset of Extensible Markup Language (XML) functionality. This document describes the features of XML that have been incorporated into Windows CE and the differences between using XML on a Windows CE-based platform and on a Windows-based desktop computer. For general information about XML, see the documentation available in the MSDN Online Library. (Note that throughout this article, MSXML refers to the XML parser available from Microsoft, and XML Refers to the markup language.)

EXTENSIBLE MARKUP LANGUAGE

XML is a meta-markup language that provides a format for describing structured data and allows developers to easily describe and deliver rich, structured data from any application in a standard, consistent way. XML facilitates more precise declarations of content and provides more meaningful search results across multiple platforms. In addition, XML is enabling a new generation of Web-based applications for viewing and manipulating data.The power and beauty of XML comes from its maintaining the separation of the user interface from the structured data. While Hypertext Markup Language ( HTML) tags can display a word in bold face or italics, XML provides a framework for tagging structured data. An XML tag can indicate that the data associated with the tag is a retail price, a sales tax, a book title, an amount of Precipitation, or any other desired data. as xml tags area adopted by Organizations for the Internet, and by tasess the Internet, the Ability to search for and manipulat e data, regardless of the applications within which the data resides, will increase. Once an application locates XML data, the application can deliver the data over the network and present the data in a Web browser (such as Microsoft® Internet Explorer) in any Number of Ways, or the application can hand off the data to other applications for further processing and viewing.

XML, Which Province A Data Standard That Can Encode The Content, Semantics, and Schemata For A Wide Variety of Cases Ranging from Simple To Complex, Can Be Used To Mark Up The Following:

An ORDINARY Document

A Structured Record, Such As An Appointment Record or Purchase Order

An Object With Data And Methods, Such As The Persistent Form of A Java Object Or ActiveX® Controla Data Record, Such as The Result Set of a Query

Metacontent About A Web Site, Such As Channel Definition Format (CDF)

A Graphical Presentation, Such as an Application's User Interface

Standard Schema Entities and Types

All Links Between Information and People on The Web

Once the data is on the client desktop, it can be manipulated, edited, and presented in multiple views without return trips to the server. Servers can now become more scalable, due to lower computational and bandwidth loads. Also, because data is exchanged in The XML Format, IT Can Be Easily Merged from Different Sources.

Web services and xml

Unlike current component technologies, Web services do not use object-model-specific protocols such as Distributed Component Object Model (DCOM), Remote Method Invocation (RMI), or Internet Inter-ORB Protocol (IIOP) that require specific, homogeneous infrastructures on both the client and service machines. While implementations tightly coupled to specific component technologies are perfectly acceptable in a controlled environment, they become impractical on the Web. As the set of participants in an integrated business process changes, and as technology changes over time, it becomes very difficult to guarantee a single, unified infrastructure among all participants Web services take a different approach:.. They communicate using ubiquitous Web protocols and data formats such as Hypertext Transfer Protocol (HTTP) and XML Any system supporting these Web standards will be able to Support Web Services.

Furthermore, a Web service contract describes the services provided in terms of the messages the Web service accepts and generates rather than how the service is implemented. By focusing solely on messages, the Web services model is completely independent of the language, platform, and object model used. A Web service can be implemented using the full feature set of any programming language, object model, and platform.XML is the obvious choice for defining a standard yet extensible language to represent commands and typed data. While rules for representing commands and TYPED DATA USING OTHER TECHNIQUES (Such As Encoding As a Query String) Could Be Defined, XML IS Specifically Designed As A Standard Metalanguage for Describing Data.

XML is also the enabling technology for Web service contracts. The Service Contract Language (SCL) is an XML grammar for documenting Web service contracts. Because SCL is XML-based, contracts are easy for both developers and developer tools to create and interpret.

For More Information About Microsoft Web Services, See The ProgramMable Web: Web Services Provides Building Blocks for the Microsoft .NET Framework.

XML for Windows CE

Microsoft Windows CE 3.0 Supports A Subset of MSXML 2.0 FunctionAlity. Specification, Windows CE Does Not Support The Following Features:

Simple Data Types on Attributes

Addition of an "id" data type for elements

Assignment of Data Types Through Element Names

Data islands

Data binding

MIME TYPE VIEWER

Backward Compatibility with the Microsoft XML Document Object Model (DOM) Supported by Microsoft Internet Explorer 4.0

Also, Windows CE Provides Only Limited XML Security.

Some of the msxml 2.0 Features That Are Supported in Windows CE Are:

XML Validation Through Schema, Namespace, And Data Type Support.The Ability To Build and Management The Documents and Data THROUGH Document Object Model (DOM) Support.

Web Browser Formatting THROUGH EXTENSIBLE STYLESHEET LANGUAGE (XSL) Support.

Automated Document Requests and Parsing Functions Through The Use of Xmlhttp Features.

Windows CE Also Supports The Ability To Instantiate Component Object Model (COM) Objects Wteml 2.5.

Validating data

MSXML for Windows CE supports a technical preview release of XML schemata. The XML schema support is a subset of the Worldwide Web Consortium (W3C) XML data submission and is functionally very close to the W3C Document Content Description (DCD) submission.

Consider The Following XML File:

Stephanie Smith

1971-07-01

ssmith@abcdef.com

(425) 111-111

Bill Williams

1968-09-17

Billw@abcdef.com

(425) 111-111

Christopher Jones

1999-09-08

cjones@abcdef.com

(425) 111-111

The New XML Schema Support in Msxml for Windows CE, The Above Data Can Be Validated Against A Schema by Decilating The Following Namespace on The Root Element:

This sets the schema contactSchema.xml as the default namespace for the document. Other namespaces can be declared throughout the document if desired, but, where no namespace is specified, the default will apply.The complete schema for the above XML document is as follows :

XMLns: DT = "URN: Schemas-Microsoft-COM: DataTypes">

Content = "Textonly"

DT: type = "date" />

Content = "eltonly"

ORDER = "Many">

The attribute:

XMLns = 'URN: Schemas-Microsoft-COM: XML-DATA'

Sets the default namespace for the xml document as the schema namespace. This Means That The Schema Must Conform To The Syntax for XML Schemata. Similarly, The Attribute:

XMLns: DT = 'URN: Schemas-Microsoft-COM: Datatypes'

Data Type Namespace. This Means That Data Types Can Now Be DTT PREFIX ON The TYPE Attribute Is Used to Type The BirthDate Value.)

Document Management MANAGEMENT

The DOM is a platform-neutral and language-neutral interface that permits scripts to access and update the content, structure, and style of a document. The DOM includes a model for how a standard set of objects representing HTML and XML documents are combined and an interface for accessing and manipulating them. The Microsoft XML Parser on Windows CE has full DOM support in compliance with the W3C DOM recommendation. in addition, it also has the Microsoft extensions that allow access to typed data and namespace information, creation of nodes by . node type, and so on The following is a script that loads an XML document containing the contact information and uses XSL pattern matching to display the phone number of the contact with the name of "Bill Williams": function showPhone ()

{

Var root = contacts.documentelement;

Var classelems = root.selectnodes ("Contact [name = 'bill willileiams");

VAR BILLELEM = SELECTEDELEMS.ITEM (0);

Var phone = billelem.childNodes.Item (3) .NodeTypedValue;

Alert ("Bill Williams Phone Number IS" Phone);

}

The selectNodes method uses XSL pattern-matching to retrieve a node list. In this case, the script looks for all CONTACT elements that have a NAME element with the value of "Bill Williams." Because there is only one element that matches this pattern, Selectnodes Returns a node list of what.

Formatting Complex Data for Presentation

. MSXML on Windows CE also provides support for XSL, which allows for more complex display of XML data For instance, the previous contact information can be displayed in a simple table format The first task would be to create an XSL style sheet.:

Contacts

Name

phone

email

This particular style sheet creates a table and uses the values ​​of selected XML elements to fill the table with information The style sheet also sorts the information by e-mail name. (Using the order-by attribute on the xsl: for-each element) ................ ..

This style sheet can be applied to the XML document through the XML Object Model, which is a set of application programming interfaces (APIs) that allow interaction with the elements of the XML structured tree. The transformNode method on IXMLDOMNode passes in an XSL tree and Uses THAT TREE to TRANSFORM An output string. in the following case

Function showcontacts ()

{

Document.write (Contacts.documenTelement);

The Above Script Displays The Following in The Browser:

XMLHTTP

Using the Xmlhttp Object, The XML Tree Itself Can Be Posted AS An Object. In The Following Script, An Xmlhttp Object Is Created and Posts An Xml Tree named "Template" to the server location:

Var httpob = new activXObject ("Microsoft.xmlhttp");

Httpob.Open ("post", "http://myserver/postcontact.asp", false);

Var Contact = Template.xmldocument.documentelement;

Contact.childNodes.Item (0) .Text = ContactName.Value;

Contact.childNodes.Item (1) .Text = ContactPhone.Value;

Contact.childNodes.Item (2) .text = contactemail.value;

Httpob.send (template.xmldocument);

THE XMLHTTP Object and ITS Properties Are Outlined in The IXmlhttpRequest Interface Documentation In The Msdn Online Library.

Instantiation of com Objects through xsl

Windows CE Supports Instantiation of Com Objects, Such As ActiveX Controls, Through The XSL Script Interface. The Following Script Demonstrates Instantization of a FictiStitution COM Object, "Mycorp":

Function Testcomobject ()

{

Var obj1 = new activXObject ("mycorp.mycomponent");

VAR Y = Obj1.Process (); // Create a new com object and use it to handle

// additional processing.

Return Y;

}

转载请注明原文地址:https://www.9cbs.com/read-24061.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.047, SQL: 9