XML is incredibly diverse and includes a host of othertechnologies including XPointer, XLink, and Resource Description Framework (RDF).
we are defining Web Services to be built onXML, SOAP, WSDL, and UDDI over a transport protocol such as HTTP. Thisdefinition will become clearer as our discussions progressXML Parsers
Processing an XML document requires the use of an XML parser, a program that can decompose the XML document into its individual elements. There are two major categories of XML parsers:Document Object Model (DOM) and Simple API for XML (SAX).
DOM解析主要有两个缺点:
1:xml需要全部一次性加载到内存中,如果xml足够大,将导致很大的性能开销,性能会很低。
2:因为xml是跨语言独立的,应用非常普遍,因此许多常用的编程语言需要更多的步骤去处理xml,因为不是语言特定的。例如java采用 JDOM解析。
SAX解析:
sax解析是基于事件的解析,sax解析依赖于事件注册,每一个事件句柄是一个处理特定任务的代码块,SAX解析的主要优点就是不需要一次性的把xml的dom文档加载到内存中。 调用事件句柄xml作为一种数据流处理,sax解析比dom更容易工作。
也有两个缺点
1:一旦xml被读后,内存中就不在有xml的内容了,如果需要额外的处理需要再进行解析。
2:SAX解析不能修改xml文档的内容。
XML需要特定的格式:所以 一个格式良好的xml才能进行解析,否则DOM和SAX拒绝解析格式不完整的xml:
怎样才能保证xml格式正确呢!
DTDs and Schemas是两个约束xml的定义。
XML Namespaces
An enterprise system consists of dozens if not hundreds of XML documents. As these XML documents are merged from other sources, inevitably there will be duplicate element names. This can cause problems because each element must have a unique name. XML resolves this name collision issue through the use of namespaces (Java provides a similar feature through packages). Each element is prefixed with a namespace and therefore has to be unique only for that given namespace rather than globally. In practice, the prefix is usually the name of the company, although any Uniform Resource Locator (URL) will do.2 Thus, an element name is composed of two parts: the namespace and the name of the element. By qualifying the name of each element with a qualifier, the likelihood of a name collision is greatly reduced. Consider the file system, for example. For a given directory, a filename must be unique. However, there can be multiple identical filenames as long as each exists in a different directory. In a sense, the directory provides the namespace and qualifies the filename to resolve filename conflicts.
以上是对xml命名空间的解释,简单的来说就是防止元素命名冲突,就想java的 包名,防止类名冲突一样。
Service-Oriented Access Protocol (SOAP)
