Unit 5
XML用来干什么的?
Well-formed XML Documents
XML Technology
- Content : XML Doc
- Structure : XSD (XML Schema Definition)(.xsd)
- Presentation : XSL (XML Style sheet Language)
Valid XML Documents
- 只有在Schema的基础上才谈得上valid
- 遵守了Schema的称为是valid 的
Parsers
- DOM Parser(Document Object Model)
XML文件放入memory(Entire File needs to be in memory)
形成层次的树结构(tree based)
对较大的xml文件不适用
很容易实现
。。。。。。
- SAX Parser(Simple API for XML)
基于事件的(event based)
从顶至下执行(像流一样的处理xml信息)
适用于大型xml文件
Processing 比DOM快
不创建内部文件(Entire File needs to be in memory)
。。。。。。
- MSXML Parser
HTML VS XML
Applications of XML
Unit 6 XML Schema
Introduction to XML Schema
- XML schema describes the structures of an xml document
- Support data types
- Support namespace
Element type
- Simple Type Element
No child elements
No attributes
Contains only text
Can contain sting,numbers,datas
- Complex Type Element
With other elements,attributes,mixed content
Element with or without attributes
Data types
- Built-in Simple Types
- Primitives data type
- Derived data types
- Atomic data types
- List data types
- Union data types
Occurrence of Elements
- minOccurs
- maxOccurs
- default value is 1
- min不能为无限的
- +,?,*
Namespace:
- 解决元素同名纷争
- 统一资源标示符
- xmlns关键字
- xmlns:prefix=“URI”

浙公网安备 33010602011771号