XML and Windows CE 3.0 (轉)
and CE 3.0microsoft-com::office" />
Michael Reeves
Microsoft 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 platfoand on a Windows-based desktop computer. (9 printed pages)
Content
" target=_self>Web Services and XML
Document Management
s Through
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 provs 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 in bold face or italics, XML provides a 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 are adopted by organizations for their intrs, and by others across the Internet, the ability to search for and manipulate 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 provides 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 object or ® control
- A 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 d in the XML format, it can be easily merged from different s.
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 (), 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 Traner 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 Framework.
XML for Windows CE
Microsoft Windows CE 3.0 supports a subset of MSXML 2.0 functionality. Specifically, 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 () 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 manage complex 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 within blocks of an XSL script, which is a feature of MSXML 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 () XML data submission and is functionally very close to the W3C Document Content Description (DCD) submission.
Consider the following XML file:
With the new XML schema support in MSXML for Windows CE, the above data can be validated against a schema by declaring the following namespace on the 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' declares the data type namespace. This means that data types can now be declared throughout the schema. (Note that the dt prefix on the type attribute is used to type the BIRTHDATE value.) 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 edElems = root.selectNodes("CONTACT[NAME='Bill Williams']"); 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 length one. 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:
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 name (using the order-by attribute on the xsl:for-each element). Note that the order in which the contact information is displayed differs from the original XML document. This style sheet can be applied to the XML document through the XML Object Model, which is a set of application programming interfaces (s) 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 XML node into an output string. In the following case, that string will be an HTML string that gets inserted into the current document: function showContacts() { document.write(Contacts.transformNode(ContactsSS.documentElement); } The above script displays the following in the browser: 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 ActiveXObject("Microsoft.XMLHTTP"); httpOb.Open("POST","", 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 I Interface documentation in the . Windows CE supports instantiation of COM objects, such as ActiveX controls, through the XSL script interface. The following script demonstrates instantiation of a fictitious COM object, “MyCorp”: { var Obj1 = new ActiveXObject("MyCorp.MyComponent"); var y = Obj1.Process(); // Create a new COM object and use it to handle // additional processing. return y; }Document Management
Formatting Complex Data for Presentation
Contacts
Name
Phone
Email
XMLHTTP
Instantiation of COM Objects Through XSL
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752019/viewspace-956754/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Windows CE記憶體管理 (轉)Windows記憶體
- Windows Embedded CEWindows
- WINDOWS CE 資料庫程式設計 (轉)Windows資料庫程式設計
- 安裝 Windows PowerShell 3.0【轉】Windows
- 嵌入式系統設計和Windows CE (轉)Windows
- Windows CE/Pocket PC安裝盤的製作 (轉)Windows
- Windows CE 系統易受手機病毒攻擊(轉)Windows
- 移植到Windows CE 的經驗Windows
- 基於PPP協議的linux與Windows CE網路(轉)協議LinuxWindows
- Windows Embedded CE 6.0開發初體驗(五)構建CE平臺Windows
- Windows Embedded CE 主要商業優勢Windows
- CE與歐盟指令(轉載)
- Windows CE 程式設計 第四版Windows程式設計
- CE認證相關指令(轉載)
- 淺談eMbedded Visual C++4.0對於Windows CE.net 的開發 (轉)C++Windows
- 安裝 F# 3.0(Windows)Windows
- PHP xml 轉陣列 陣列轉 xml 操作PHPXML陣列
- 工具介紹 - 捕獲Windows CE的記憶體洩露Windows記憶體洩露
- XML資料島(XML Data Island) (轉)XML
- XML入門指南(4)XML元素(轉)XML
- 加密的XML (轉)加密XML
- CE認證需準備的資料(轉載)
- Windows Embedded CE 6.0開發初體驗(六)平臺定製Windows
- XML入門指南(18)XML行為(轉)XML
- XML入門指南(15)XML編碼(轉)XML
- XML入門指南(6)XML確認(轉)XML
- XML入門指南(3)XML語法(轉)XML
- XML入門指南(1)XML簡介(轉)XML
- XML 程式設計思想:XML語義(轉)XML程式設計
- OpenNI devices and USB 3.0 uvc windows 編譯devWindows編譯
- XML入門指南(17)XML HTTP 請求(轉)XMLHTTP
- XML入門指南(7)XML瀏覽器(轉)XML瀏覽器
- XML 程式設計思想:XML和語義(轉)XML程式設計
- XML 程式設計思想: 研讀XML Hacks(轉)XML程式設計
- XML 程式設計思想: XML 語義錨(轉)XML程式設計
- 從HTML到XML (轉)HTMLXML
- C# 操作xml(轉)C#XML
- XML簡明教程(1)什麼是XML元素(轉)XML