a0c1ca6a6a66c6f597433778c1193a80.ppt
- Количество слайдов: 45
Кратък курс в XML (Extensible Markup Language ) Основни цели - XML 1. 0 Recommendation (http: //www. w 3. org/TR/2000/REC-xml-20001006#sec-origin-goals): 1. XML shall be straightforwardly usable over the Internet. 2. XML shall support a wide variety of applications. 3. XML shall be compatible with HTML. 4. It shall be easy to write programs which process XML documents. 5. The number of optional features in XML is to be kept to the absolute minimum, ideally zero. 6. The XML design should be prepared quickly. 7. The design of XML shall be formal and concise. 8. XML documents shall be easy to create. 1. 2. 3. 4. 5. 6. Няма семантика, нито набор тагове; метаезик; има 1 основен елемент - корен; всеки отворен таг следва да се затвори; част от осн. елемент не може да е включена в друг елемент на документа; всеки елемент може да има атрибути, които се явяват само веднаж; за всеки ел. отварящият и затварящ таг са на едно ниво. tag се дефинира в DTD чрез елемент: <!ELEMENT name type>
Кратък курс в XML (Extensible Markup Language ) Пример: customer. dtd: The XML definition of the customer data model. <? xml version='1. 0' encoding='UTF-8' ? > <!ELEMENT customer (name , contact)> <!ELEMENT name (first , middle , last)> <!ELEMENT contact (address , phone)> <!ELEMENT address (street , city , state , zip)> <!ELEMENT phone (home , work , mobile)> <!ELEMENT first (#PCDATA)> <!ELEMENT middle (#PCDATA)> <!ELEMENT last (#PCDATA)> <!ELEMENT street (#PCDATA)> <!ELEMENT city (#PCDATA)> <!ELEMENT state (#PCDATA)> <!ELEMENT zip (#PCDATA)> <!ELEMENT home (#PCDATA)> <!ELEMENT work (#PCDATA)> <!ELEMENT mobile (#PCDATA)> johndoe. xml: An instance of the customer. dtd document <? xml version = "1. 0"? > <!DOCTYPE customer SYSTEM "customer. dtd"> <customer> <!--(name , contact)--> <name> <!--(first , middle , last)--> <first>John</first> <middle>Smithy</middle> <last>Doe</last></name> <contact> <!--(address , phone)--> <address> <street>123 Some Str</street> <city>town</city> <state>NC</state> <zip>25555</zip> </address> <phone> <home>919. 555. 1212</home> <work>919. 555. 1213</work> <mobile>919. 555. 1214</mobile> </phone> </contact> </customer>
Кратък курс в XML (Extensible Markup Language ) Базови единици Entites: XML се състои от entities и parsed или unparsed data. Entities представляват конструкции, реферирани в документа (в текущата схема (internal entity) или външни файлове)
Кратък курс в XML (Extensible Markup Language ) <? xml version='1. 0' encoding='UTF-8' ? > <!ENTITY %attr-basic "type CDATA #REQUIRED id CDATA #IMPLIED"> <!ENTITY % cus-basic "name , contact"> <!ELEMENT customer ((internal | external) , author)> <!ATTLIST customer %attr-basic; > <!ELEMENT name (first , middle* , last)> <!ELEMENT contact (address , phone)> <!ELEMENT address (street , city , state , zip)> <!ELEMENT phone (home? , work , mobile? )> <!ELEMENT first (#PCDATA)> <!ELEMENT middle (#PCDATA)> <!ELEMENT last (#PCDATA)> <!ELEMENT street (#PCDATA)> <!ELEMENT city (#PCDATA)> <!ELEMENT state (#PCDATA)> <!ELEMENT zip (#PCDATA)> <!ELEMENT home (#PCDATA)> <!ELEMENT work (#PCDATA)> <!ELEMENT mobile (#PCDATA)> <!ATTLIST mobile type CDATA #IMPLIED > <!ENTITY dtd-author "R. Allen Wyke"> <!ELEMENT internal (%cus-basic; )> <!ATTLIST internal %attr-basic; > <!ELEMENT external (%cus-basic; )> <!ATTLIST external %attr-basic; > <!ELEMENT author (#PCDATA)>
Кратък курс в XML (Extensible Markup Language ) johndoe_v 4. xml: A sample document using the new schema <? xml version = "1. 0"? > <!DOCTYPE customer SYSTEM "customer_v 4. dtd"> <customer type = "current" id = "xyz"> <internal type = "current" id = "xyz"> <name> <first>John</first> <middle>Smithy</middle> <last>Doe</last> </name> <contact> <address> <street>123 Some Street</street> <city>Anytown</city> <state>NC</state> <zip>25555</zip> </address> <phone> <work>919. 555. 1213</work> </phone> </contact> </internal> <author>&dtd-author; </author> </customer>
Кратък курс в XML (Extensible Markup Language ) Обекти на IE за показване данни описани с XML Doc. Object Model (DOM )- XMLDOM Ето. xml документ: <? xml version="1. 0" ? > //задължително указание към parser на IE <EMAIL> // root елемент <TO>nakov@vmei. acad. bg</TO> // дъщерен елемент <FROM>Penev@hotmail. com</FROM> <CC>DHTML_in_Action@hotmail. com</CC> <SUBJECT>XML example</SUBJECT> <BODY>This is an XML-based email. </BODY> </EMAIL>
Кратък курс в XML (Extensible Markup Language ) Ето и кода за извличане на данните: <HTML> <HEAD> <TITLE>Пример с XML</TITLE> <SCRIPT LANGUAGE="Java. Script" FOR="window" EVENT="onload"> start() </SCRIPT> <SCRIPT LANGUAGE="Java. Script"> var xml. Doc=new Active. XObject("Microsoft. XMLDOM") xml. Doc. async=false xml. Doc. load("email. xml") function start(){ var root=xml. Doc. document. Element todata. inner. Text=root. child. Nodes. item(0). text fromdata. inner. Text=root. child. Nodes. item(1). text ccdata. inner. Text=root. child. Nodes. item(2). text subjectdata. inner. Text=root. child. Nodes. item(3). text bodydata. inner. Text=root. child. Nodes. item(4). text </SCRIPT> </HEAD> <BODY> <B>To: </B> <SPAN ID="todata"></SPAN><BR> <B>From: </B> <SPAN ID="fromdata"></SPAN><BR> <B>CC: </B> <SPAN ID="ccdata"></SPAN><BR> <B>Subject: </B> <SPAN ID="subjectdata"></SPAN><BR> <B>Body: </B> <SPAN ID="bodydata"></SPAN><BR> </BODY> </HTML> }
Кратък курс в XML (Extensible Markup Language ) Ето пример за форматиране на бизнес писмо с помощта на XML : <? xml version = "1. 0"? > <!DOCTYPE letter SYSTEM "letter. dtd"> <letter> <contact type = "from“> <name>John Doe</name> <address 1>123 Main St. </address 1> <address 2></address 2> <city>Anytown</city> <state>Anystate</state> <zip>12345</zip> <phone>555 -1234</phone> <flag id = "P"/> </contact> <paragraph>Dear Sir, </paragraph> <paragraph>It is our privilege to inform you about our new database managed with XML. This new system will allow you to reduce the load of your inventory list server by having the client machine perform the work of sorting and filtering the data. </paragraph> <paragraph>Sincerely, Mr. Doe</paragraph> </letter>
Кратък курс в XML (Extensible Markup Language ) Ето Document Type Definition ( DTD ) за горното писмо (набора от правила). Същото и с XML схеми (XSD): <!ELEMENT letter (contact+, paragraph+)> <!ELEMENT contact (name, address 1, address 2, city, state, zip, phone, flag)> <!ATTLIST contact type CDATA #IMPLIED> <!ELEMENT name (#PCDATA)> <!ELEMENT address 1 (#PCDATA)> <!ELEMENT address 2 (#PCDATA)> <!ELEMENT city (#PCDATA)> <!ELEMENT state (#PCDATA)> <!ELEMENT zip (#PCDATA)> <!ELEMENT phone (#PCDATA)> <!ELEMENT flag (EMPTY)> <!ATTLIST flag id CDATA #IMPLIED> <!ELEMENT paragraph (#PCDATA)>
Кратък курс в XML (Extensible Markup Language ) БД и XML Resultset-Based Mapping SELECT Employee_ID, First_Name, Last_Name, Dept_No FROM Employee sample_query 1. xml: A sample XML representation of the Employee table <? xml version="1. 0"? > <ROOT> <row Employee_ID="1" <row Employee_ID="2" <row Employee_ID="3" <row Employee_ID="4" <row Employee_ID="5" <row Employee_ID="6" </ROOT> First_Name="Adam" Last_Name="Barr" Dept_No="3"/> First_Name="Katie" Last_Name="Jor. " Dept_No="2"/> First_Name="Scott" Last_Name="Mac. " Dept_No="1"/> First_Name="Tim" Last_Name="O'Brien" Dept_No="2"/> First_Name="Sunil" Last_Name="Kod" Dept_No="3"/> First_Name="Laura" Last_Name="Norman" Dept_No="2"/>
Кратък курс в XML (Extensible Markup Language ) Същият XML, но вместо атрибути – елементи <? xml version="1. 0"? > <ROOT> <row> <Employee_ID>1</Employee_ID> <First_Name>Adam</First_Name> <Last_Name>Barr</Last_Name> <Dept_No>3</Dept_No> </row>. . . </ROOT> Schema-Based Mapping Описание на XSD в "XML Schema Primer 0, " http: //www. w 3. org/TR/xmlschema-0/. Генериране на XSD схема на основа описание на БД: CREATE TABLE Dept ( Dept. ID INT PRIMARY KEY NOT NULL, Dept. Name VARCHAR( 20 ) NOT NULL ) CREATE TABLE Employee ( Employee. ID INT PRIMARY KEY NOT NULL, First. Name VARCHAR( 20 ), Last. Name VARCHAR( 20 ) NOT NULL, Dept. ID NUMBER REFERENCES Dept( Dept_ID ) NOT NULL )
Кратък курс в XML (Extensible Markup Language ) <? xml version="1. 0"? > <xsd: element name="ROOT"> <xsd: complex. Type> <xsd: sequence> <xsd: element ref="Employee" min. Occurs="0"max. Occurs="unbounded"/> <xsd: element ref="Dept" min. Occurs="0" max. Occurs="unbounded"/> </xsd: sequence> </xsd: complex. Type> </xsd: element> <xsd: simple. Type name="varchar 20"> <xsd: restriction base="xsd: string"> <xsd: max. Length value="20"/> </xsd: restriction> </xsd: simple. Type> <xsd: element name="Employee"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="Employee. ID" use="required" type="xsd: int"> <xsd: unique name="Employee. Unique"> <xsd: selector xpath="my: Employee"/> <xsd: field xpath="Employee. ID"/> <xsd: annotation> <xsd: appinfo> primary-key </xsd: appinfo> </xsd: annotation> </xsd: unique> </xsd: element>
Кратък курс в XML (Extensible Markup Language ) <xsd: element name="First. Name" type="varchar 20"/> <xsd: element name="Last. Name" use="required" type="varchar 20"/> <xsd: element name="Dept. ID" use="required" type="xsd: int"> <xsd: keyref name="Dept. Key. Ref" refer="Dept. Key"> <xsd: selector xpath="my: Employee"/> <xsd: field xpath="Dept. ID"/> </xsd: unique> </xsd: element> </xsd: sequence> </xsd: complex. Type> </xsd: element> <xsd: element name="Dept"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="Dept. ID" use="required" type="xsd: int"/> <xsd: unique name="Dept. Unique"> <xsd: selector xpath="my: Dept"/> <xsd: field xpath="Dept. ID"/> <xsd: annotation> <xsd: appinfo> primary-key </xsd: appinfo> </xsd: annotation> </xsd: unique> <xsd: key name="Dept. Key"> <xsd: selector xpath="my: Dept"/> <xsd: field xpath="Dept. ID"/> </xsd: key> </xsd: element> <xsd: element name="Dept. Name" type="varchar 20"/> </xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: schema>
Кратък курс в XML (Extensible Markup Language ) Генериране нa Database Schema на основа на XSD става по обратен път XML и комерсиалните СУБД 1. Microsoft SQL server 2000: БД XML документ; XML данни БД; XML templates със заместване; средство OPENXML doc. като параметър на SQL заявка с указание към коя таблица да се насочат данните от него; модифициран SELECTза извлечение към XML: SELECT Employee. ID, First. Name, Last. Name FROM Employees FOR XML RAW или: <row Employee. ID="1" Employee. ID="2" Employee. ID="3" Employee. ID="4" First. Name="Nancy" Last. Name="Davolio"/> First. Name="Andrew" Last. Name="Fuller"/> First. Name="Janet" Last. Name="Leverling"/> First. Name="Margaret" Last. Name="Peacock"/> SELECT Customers. Customer. ID, Customers. Company. Name, Orders. Order. ID, Orders. Order. Date, [Order Details]. Product. ID, [Order Details]. Quantity, [Order Details]. Unit. Price FROM Customers, Orders, [Order Details] WHERE Customers. Customer. ID = Orders. Customer. ID AND Orders. Order. ID = [Order Details]. Order. ID AND Customers. Customer. ID = 'BOLID' ORDER BY Customers. Customer. ID, Orders. Order. ID FOR XML AUTO
Кратък курс в XML (Extensible Markup Language ) auto. xml: XML generated using the query in AUTO. sql. <Customers Customer. ID="BOLID" Company. Name="Bolido Comidas preparadas"> <Orders Order. ID="10326" Order. Date="1996 -10 -10 T 00: 00"> <Order_Details Product. ID="4"Quantity="24" Unit. Price="17. 6"/> <Order_Details Product. ID="57"Quantity="16"Unit. Price="15. 6"/> <Order_Details Product. ID="75" Quantity="50" Unit. Price="6. 2"/> </Orders>. . </Customers> 2. ORACLE 9 I: XML parser; XML from SQL заявка или JDBC Resultset object; XML данни DB; SOX; XSD. (стандартизирани от W 3 C). Пример: home_computer. sox: A schema describing our home computer. <? xml version = "1. 0" encoding = "UTF-8"? > <!DOCTYPE schema SYSTEM "urn: x-commerceone: document: commerceone: xdk: xml: schema. dtd$1. 0"> <schema uri ="file: ///S: /home_computer. sox" soxlang-version = "V 0. 2. 2"> <elementtype name = "home_computer">
Кратък курс в XML (Extensible Markup Language ) <model> <sequence> <element type = "monitor"/> <element type = "housing"/> <element type = "speakers"/> <element type = "keyboard"/> <element type = "mouse"/> </sequence> </model> </elementtype> <elementtype name = "monitor"> <model> <string/> </model> </elementtype> <elementtype name = "housing"> <model> <sequence> <element type = "cpu"/> <element type = "ram"/> <element type = "disk_space"/> <element type = "modem"/> </sequence> </model></elementtype> <elementtype name = "keyboard"> <model><string/> </model> </elementtype> ………. . </schema>
Кратък курс в XML (Extensible Markup Language )
Кратък курс в XML (Extensible Markup Language ) work_computer. sox: A new schema extending our home_computer. sox schema. <? xml version = "1. 0" encoding = "UTF-8"? > <!DOCTYPE schema SYSTEM "urn: x-commerceone: document: commerceone: xdk: xml: schema. dtd$1. 0"> <schema uri ="file: ///S: /home_computer. sox" soxlang-version = "V 0. 2. 2"> <join system = "file: ///S: /home_computer. sox"/> <elementtype name = "work_computer"> <extends type = "home_computer"> <append> <sequence> <element type = "scanner"/> <element type = "zip_drive"/> <element type = "printer"/> </sequence> </append> </extends> </elementtype> <elementtype name = "scanner"> <model> <string/> </model> </elementtype>. . . </schema>
Кратък курс в XML (Extensible Markup Language )
Кратък курс в XML (Extensible Markup Language ) first_work_computer. xml: An instance of our work_computer. sox schema <? xml version = "1. 0" encoding = "UTF-8"? > <? soxtype file: ///S: /work_computer. sox? > <work_computer> <monitor>15 inch</monitor> <housing> <cpu>1 GHz</cpu> <ram>256 MB</ram> <disk_space>60 GB</disk_space> <modem>56 k</modem> </housing> <speakers>JBL</speakers> <keyboard>Microsoft</keyboard> <mouse>Microsoft</mouse> <scanner>Microtek</scanner> <zip_drive>100 MB</zip_drive> <printer>HP</printer> </work_computer>
Кратък курс в XML (Extensible Markup Language ) Създаване на насочени към определена област markup езици на основа на XML Math. ML (Mathematical Markup Language), Chemical ML, Extensible Reporting ML, Speech ML Math. ML се създава от editor Amaya (http: //www. w 3. org/Amaya/) Всички дефинирани в Math. ML елементи могат да се видят в http: //www. w 3. org. /Math/ XML Parsers: XML Doc. XML DTD optional XML парсер XML Application (напр. Amaya) XML parser в IE 5 msxml (позволява да се интегр. XML инф. в WEB документ) validating parser can use a DTD or schema to verify that a document is properly constructed A non-validating parser only requires that the document be wellformed. В tree-based parsing с DOM, документът се проверява за well-formed и валиден. parser го преобразува в дърво с 1 root node ( document object instance). След като document object tree е създадено, с използване интерфейси в API на DOM можете да модифицирате, изтривате и създавате клони и листа.
Кратък курс в XML (Extensible Markup Language ) Интерфейси на DOM
Кратък курс в XML (Extensible Markup Language ) Други DOM интерфейси са: Attr; Comment; Document; Node. List; Element; Document. Type; Entity; Text и др.
Кратък курс в XML (Extensible Markup Language ) Stream-Based Parsing with SAX (Simple API for XML) Недостатък на DOM е обработката на големи файлове – целият файл в паметта. SAX parsers четат последователно и генерират events. The Behavior of a SAX Parser За разлика от DOM и дърветата, SAX няма default object model. Рarsers чете XML document и “ fire events” когато: • отваря нов елемент • затваря елемент • #PCDATA и CDATA секции • обработва декларации на instructions, comments и entity
Кратък курс в XML (Extensible Markup Language ) Предимства на DOM Предимства на SAX Произволен достъп до document. Complex searche е лесна. The DTD or schema is available. The DOM is read/write. Parse files of any size. Собствена data structure. Достъп до част от инф. Бързина Примерни сценарии: 1. голяма компания, данни в XML, нужна обработка над всички; 2. малка компания; нужно прил. за скролиране из записите; Налични парсъри: • MSXML • Xerces (Apache) • други DOM and SAX Parsers Written in Java Parser URL Standards Supported IBM's XML for Java http: //www. alphaworks. ibm. com/for mula/xml DOM Level 1, DOM Level 2, SAX 1, SAX 2 Microstar's lfred http: //www. opentext. com/services/co ntent_management_services/xmlsgml _solutions. html#aelfred_and_sax DOM Level 1, DOM Level 2, SAX 1, and SAX 2 Sun's Java API for XML http: //java. sun. com/products/xml DOM Level 1, SAX 1 Oracle's XML Parser for Java http: //technet. oracle. com/ DOM 1; SAX 1;
Кратък курс в XML (Extensible Markup Language ) Използване на XML в HTML XML таг article Title date author fname lname summary content
Кратък курс в XML (Extensible Markup Language ) <HTML> <BODY> <XML ID = "xml. Doc"> <contacts> <contact> <Last. Name>Deitel</Last. Name> <First. Name>Harvey</First. Name> </contact> <Last. Name>Deitel</Last. Name> <First. Name>Paul</First. Name> </contact> <Last. Name>Nieto</Last. Name> <First. Name>Tem</First. Name> </contacts> </XML> <TABLE BORDER = "1" DATASRC = "#xml. Doc"> <THEAD> <TR> <TH>Last Name</TH> <TH>First Name</TH> </TR> </THEAD> <TR> <TD><SPAN DATAFLD = "Last. Name"></SPAN></TD> <TD><SPAN DATAFLD = "First. Name"></SPAN></T> </TR> </TABLE> </BODY></HTML>
Кратък курс в XML (Extensible Markup Language ) Extensible Style Language (XSL) Необходимост: Navigation. xml: An XML model of a simple navigation tree. <? xml version="1. 0"? > <navigation type="tree"> <description>XML (Extensible Markup Language)</description> <open. Image>/xmlbook/images/general/open. gif</open. Image> <closed. Image>/xmlbook/images/general/closed. gif</closed. Image> <href target="detail">item 2. htm</href> <navitem> <description>What's New</description> <image>/xmlbook/images/general/item. gif</image> <href target="detail">item 2. htm</href> </navitem> <description>XML Developer's Guide</description> <open. Image>/xmlbook/images/general/open. gif</open. Image> <closed. Image>/xmlbook/images/general/closed. gif</closed. Image> <href target="detail">item 1. html</href> <children> <navitem> <description>Introduction to XML</description> <open. Image>/xmlbook/images/general/open. gif</open. Image> <closed. Image>/xmlbook/images/general/closed. gif</closed. Image> <href target="detail">item 1. htm</href>
Кратък курс в XML (Extensible Markup Language ) Подразбираща се трансформация:
Кратък курс в XML (Extensible Markup Language ) А ето и вида след подходяща XSL трансформация:
Кратък курс в XML (Extensible Markup Language ) Използване на CSS към XML за трансформации и форматиране на XML документ: 1. Вмъкване на: <? xml-stylesheet type="text/css" href="navigation_simple. css"? > ред преди <navigation> element 2. Описание на CSS трансформацията: navigation { font-family: verdana; color: black; font-size: 14; font-weight: 800; padding: 1 em; display: block; } navitem { font-family: verdana; color: black; font-size: 11; font-weight: 400; padding: 1 em; display: block; } Description { display: block; } Href { display: none; } open. Image { display: none; } closed. Image { display: none; }
Кратък курс в XML (Extensible Markup Language ) 3. Окончателен вид:
Кратък курс в XML (Extensible Markup Language ) Extensible Stylesheet Language Transformation Задачи на примерен ASP server controller, работещ с XML: 1. controller анализира user's request arguments. 2. controller парсва browser's request string, касаещ заявената страница. 3. controller активира ASP код, изграждащ XML model на заявено изображение. 4. controller избира user-interface "skin" за управление на трансформацията към view XML. 5. controller генерира или краен HTML document, съобразно версия на browser и user settings, или изпраща трансформирания XML код за интерпретация локално в клиента.
Кратък курс в XML (Extensible Markup Language ) Следователно за приложение – site с БД, много страници и търсене по критерии – имаме: 1. XML БД; 2. XML схема, описваща всички възможни за Web страниците елементи и атрибути. 3. asp код, реализиращ задачите на контролера. Той качва XML и XSLT за обработка, използвайки контрола MSXML 2. DOMDocument; 4. ASP страница, работеща с БД и генерираща (на основа XML ) навигационно дърво според заявката. Изходът е XML дърво; 5. XSLT за обработка на дървото, съобразно браузъра (skin). Продуцира крайния вид на дърветата (страниците в сайта); 6. ASP код, работещ с БД. MSXML. DOMDocument контролът работи лесно с XML (дървовидно) представени данни
Кратък курс в XML (Extensible Markup Language ) Пример:
Кратък курс в XML (Extensible Markup Language ) Ето HTML файла, реализиращ обръщение към данните, който ги обработва и ги изобразява: <!DOCTYPE HTML PUBLIC "-//W 3 C//DTD HTML 4. 0 Transitional//EN"> <HTML> <BODY> <XML ID = "xml. Data" src = "d. xml"></XML> <XML ID = "xml. Sort. Last. Name"> <contacts> <xsl: for-each order-by = "+Last. Name; +First. Name" select = "contact" xmlns: xsl = "http: //www. w 3. org/TR/WD-xsl"> <contact> <Last. Name><xsl: value-of select = "Last. Name"/></Last. Name> <First. Name><xsl: value-of select = "First. Name"/></First. Name> </contact> </xsl: for-each> </contacts> </XML> <XML ID = "xml. Sort. First. Name"> <contacts> <xsl: for-each order-by = "+First. Name; +Last. Name" select = "contact" xmlns: xsl = "http: //www. w 3. org/TR/WD-xsl"> <contact> <Last. Name><xsl: value-of select = "Last. Name"/></Last. Name> <First. Name><xsl: value-of select = "First. Name"/></First. Name> </contact>
Кратък курс в XML (Extensible Markup Language ) </xsl: for-each> </contacts> </XML> <XML ID = "xml. Revert. Order"> <contacts> <xsl: for-each select = "contact" xmlns: xsl = "http: //www. w 3. org/TR/WD-xsl"> <contact> <Last. Name><xsl: value-of select = "last. Name"/></Last. Name> <First. Name><xsl: value-of select = "first. Name"/></First. Name> </contact> </xsl: for-each> </contacts> </XML> <XML ID = "xml. Filter. Last. Name"> <contacts> <xsl: for-each select = "contact[Last. Name='Nieto']" xmlns: xsl = "http: //www. w 3. org/TR/WD-xsl"> <contact> <Last. Name><xsl: value-of select = "Last. Name"/></Last. Name> <First. Name><xsl: value-of select = "First. Name"/></First. Name> </contact> </xsl: for-each> </contacts> </XML>
Кратък курс в XML (Extensible Markup Language ) <SCRIPT LANGUAGE = "Javascript"> var xmldoc = xml. Data. clone. Node( true ); function sort( xsldoc ) { xmldoc. document. Element. transform. Node. To. Object( xsldoc. document. Element, xml. Data. XMLDocument ); } </SCRIPT> <TABLE BORDER ="1" DATASRC ="#xml. Data" DATAPAGESIZE ="2" ID="tbl"> <THEAD> <TR> <TH>Фамилия</TH> <TH>Име</TH> </TR> </THEAD> <TR> <TD><SPAN DATAFLD = "Last. Name"></SPAN></TD> <TD><SPAN DATAFLD = "First. Name"></SPAN></TD> </TR> </TABLE> <INPUT TYPE = "button" VALUE = "Сортировка по фамилия" ONCLICK = "sort(xml. Sort. Last. Name. XMLDocument); "> <INPUT TYPE = "button" VALUE = "Сортировка по име" ONCLICK = "sort(xml. Sort. First. Name. XMLDocument); ">
Кратък курс в XML (Extensible Markup Language ) <INPUT TYPE="button"VALUE="Възстанови" ONCLICK ="sort(xml. Revert. Order. XMLDocument); "><BR> <INPUT TYPE = "button" VALUE = "Филтрирай за Наков" ONCLICK = "sort(xml. Filter. Last. Name. XMLDocument); "> <BR> <INPUT TYPE = "button" VALUE = "|<" ONCLICK="tbl. first. Page(); "> <INPUT TYPE = "button" VALUE="<" ONCLICK="tbl. previous. Page(); "> <INPUT TYPE = "button" VALUE = ">" ONCLICK = "tbl. next. Page(); "> <INPUT TYPE = "button" VALUE = ">|" ONCLICK = "tbl. last. Page(); "> </BODY> </HTML> Ето файл с xml данните, използвани по-горе <? xml version = "1. 0"? > <contacts> <contact> <Last. Name>Petrova</Last. Name> <First. Name>Desislava</First. Name> </contact> <Last. Name>Nakov</Last. Name> <First. Name>Ognian</First. Name> </contacts>
Кратък курс в XML (Extensible Markup Language ) XML Software Development Tools Schema and DTD Tools : XML Authority
Кратък курс в XML (Extensible Markup Language) Import Data Sources за XML Authority Type Description COBOL Copybook Импортира COBOL data declarations XML елементи. COM Импортира COM objects. Java class и съхранява properties като ел. или атрибути. LDAP (Lightweight Directory Access Protocol) directory struct. ODBC Позволява свързване с БД през ODBC и импорт на таблица. Text Импорт на полета в tab-delimited текстов файл. Създава XML документ от стойностите и заглавията на колони. XML Document Well-formed XML document. XML Spy XML development tool (http: //www. xmlspy. com). Генерира и валидизира XML documents и схеми.
Кратък курс в XML (Extensible Markup Language) Document Editors След създаване на схема създаване на съобразени документи XML Notepad: Microsoft XML Notepad (http: //msdn. microsoft. com/xml/notepad). Позволява редакция и създаване на well-formed XML documents. с Microsoft Biz. Talk Server се използва Microsoft Biz. Talk Editor.
Кратък курс в XML (Extensible Markup Language) XML Instance: TIBCO Extensibility's XML document instance редактор. Servers and Document Management: За инициализация и управление на данни. За промени в организацията на схемите и бърз достъп. За публикуване на схемите, с цел те да се използват за валидизиране на данни в парсъри. Microsoft Biz. Talk и Microsoft SQL Server 2000 servers са част от Microsoft's. NET servers. За XML даннов обмен и ф-ии при работа в XML environment. Biz. Talk Server Множество tools за работа с различни източници на данни. Включва XML editor (споменат), tools използвани за mapping на една data structure към друга, обработка на документи и др.
Кратък курс в XML (Extensible Markup Language)
Кратък курс в XML (Extensible Markup Language) The SQL Server Богат набор tools за XML developers: поддръжка на заявки към БД през XML statement, средства за insert и update XML данни през SQL Server (. NET-enabled Web Services); генерира XML view на основа relational data, вгражда XML data в подходящи таблици; изобразява XML data при получаване и след transaction; генерира и изпълнява нужните за определена задача SQL queries Software Development Kits (SDKs) SDK URL Description Biz. Talk Framework 2 http: //www. microsoft. com/biz talk/techinfo/framwork 20. asp Biz. Talk документи. MSXML 4 http: //msdn. microsoft. com/x ml/general/newinaprilre. asp Последният Microsoft XML Parser, поддържа XSD. . NET Framework http: //msdn. microsoft. com/do wnloads/default. asp? URL=/c ode/sample. asp? url=/msdnfiles/027/001/580/msdncompo sitedoc. xml Съдържа всичко, необходимо за създаване и тест на. NET приложение. Xalan http: //xml. apache. org XSLT processor за трансформация на XML документи към HTML, text или друг тип XML document. (C++ и Java версии). Xerces http: //xml. apache. org XML parser, поддържащ XML 1. 0, DOM Level 1 и 2, SAX 1 и 2, XML Schema. (C++, Java, Perl версии).
a0c1ca6a6a66c6f597433778c1193a80.ppt