`

什么时候使用属性或者元素(Designing XML document)

    博客分类:
  • java
 
阅读更多

Properties 是平面结构,想要表达结构复杂的信息有一定难度:

font.name = song 

font.size=3

 

 

属性只应该在修改值的解释时使用,而不应该在指定值时使用,

 

 

Html: 凡是不在页面上显示的都是属性

 

Parse:

 

DOM(Documnet Object Model)--- 树形结构解析器

 

 

SAX(Simple API for XML)--流机制解析器

 

Jaxp--- pluggability sun 公司的xml库实现了可以插入(apache, ibm and so on)的解析器

 

-----------------------------------------------

XML 文档验证 --- Schema or DTD  

 

Schema比较复杂,Relax NG(http://www/relaxng.org)也可以对XML进行验证。

 

Notes: 如过你使用的是DTD的相对URL(如config.dtd, 那么给解析器一个文件或URL对象,而不是InputStream。 如果必须从一个输入流来解析,那么必须提供一个实体解析器,  代码的架构如下:

 

import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class MyEntityResolver implements EntityResolver{

	@Override
	public InputSource resolveEntity(String publicId, String systemId)
			throws SAXException, IOException {
		
		
		if (publicId.equals("Known SystemId")) {
			// this inputSource is representative of data of DTD
			return new InputSource();
		} else {
			return null;
		}
	}
}
 

 

分享到:
评论

相关推荐

    Quickreport v5.05.1 for BC++ XE4 Full Source

    XML/XSLT export filter outputs the document (not the data) as a browser viewable XML/XSLT document. A stylesheet for browser viewing is supplied Transparent bands and background image property is a ...

    [Head.First.Ajax.2008].Rebecca.M.Riordan.文字版.pdf

    2 Designing Ajax Applications: Thinking Ajaxian 43 3 Javascript Events: Reacting to your users 93 4 Multiple Event Handlers: Two’s Company 139 5 Asynchronous Applications: It’s Like Renewing Your ...

    QuickReport V5.0.5

    Output modes - reports may be sent directly to a printer, saved in document format for later viewing, or saved as HTML, PDF, XML, CSV, XL, WMF or ASCII format. ...

    Professional C# 3rd Edition

    Using the XmlDocument Class 797 Using XPath and XSLT in .NET 802 The System.Xml.XPath Namespace 803 The System.Xml.Xsl Namespace 807 Contents XML and ADO.NET 812 Converting ADO.NET Data to XML 812 ...

    Writing WSDL Contracts

    Structure of a WSDL Document Designing a contract 2. Defining Logical Data Units Mapping Data into Logical Data Units Adding Data Units to a Contract XML Schema Simple Types Defining Complex ...

    Using the SOAP Binding

    Structure of a WSDL Document Designing a contract 2. Defining Logical Data Units Mapping Data into Logical Data Units Adding Data Units to a Contract XML Schema Simple Types Defining Complex ...

    Rapid GUI Programming with Python and Qt

    Saving and Loading XML Files 271 Summary 280 Exercise 281 Part III: Intermediate GUI Programming 282 Chapter 9. Layouts and Multiple Documents 284 Layout Policies 285 Tab Widgets and Stacked ...

    VB编程资源大全(英文源码 其它)

    It can be used for Web designing. Check it out! <END><br>77,MousePointer.zip 1 simple line of code to show the effects of how the Mouse Pointer changes with the click of a button. <END><br>78,...

    ORACLE OSB开发指南

    ORACLE OSB开发指南,英文版。 目录: Part I IDE Help for Oracle Service Bus 1 Introduction to Oracle Service Bus 2 Tasks Working with Projects, Folders, Resources, and Configurations .....................

Global site tag (gtag.js) - Google Analytics