- 浏览: 85301 次
最近访客 更多访客>>
最新评论
-
ww20042005:
这两步就完成了数据库初始化,也太简单了吧!
mysql初始化数据库 -
biaoming:
我也是debian 64的,也想安装qmail,有什么问题希望 ...
在Debian 64bit Sarge版本上安装QMAIL的痛苦之行
首先要明白,Validating Parser是用什么来验证的。
You need to understand about two things about the validating parser at the outset:
- A schema or document type definition (DTD) is required.
- Because the schema or DTD is present, the
ignorableWhitespace
method is invoked whenever possible.
To be notified of validation errors in an XML document, the parser factory must be configured to create a validating parser, as shown in the preceding section. In addition, the following must be true:
- The appropriate properties must be set on the SAX parser.
- The appropriate error handler must be set.
- The document must be associated with a schema.
注意这三点。
Setting the SAX Parser Properties
It's helpful to start by defining the constants you'll use when setting the properties:
static final StringJAXP_SCHEMA_LANGUAGE
= "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final StringW3C_XML_SCHEMA
= "http://www.w3.org/2001/XMLSchema";SAXParserFactory factory = SAXParserFactory.newInstance();factory.setNamespaceAware(true);
factory.setValidating(true);
You'll learn more about namespaces in Validating with XML Schema. For now, understand that schema
validation is a namespace-oriented process. Because JAXP-compliant parsers are not namespace-awareby default, it is necessary to set the property for schema validation to work.saxParser.setProperty(JAXP_SCHEMA_LANGUAGE
,W3C_XML_SCHEMA
);
setProperty没有完全明白作用,文档上写的和例子上表现的是有所出入的。Experimenting with Validation Errors
Validating Parsing主要处理下面的错误
1、XML文档中没有一个有效的验证文档,比如说没有一个有效的dtd文件,DOCTYPE标签的缺失。
3、PCDATA的问题,或者是说元素当中可不可以含有元素和字符的混合体。
DTD Warnings
# Providing additional declarations for entities, attributes, or notations. (Such declarations are ignored. Only the first is used. Also, note that duplicate definitions of elements always produce a fatal error when validating, as you saw earlier.) # Referencing an undeclared element type. (A validity error occurs only if the undeclared type is actually used in the XML document. A warning results when the undeclared element is referenced in the DTD.)
# Declaring attributes for undeclared element types.
# References to an undefined parameter entity when not validating. #Certain cases where the character-encoding declaration does not look right.
注意:Validating Error和DtD Warnings中的区别和联系。
1、如果XML没有根据dtd的限制进行编写,比如多个dtd中没有声明的元素,是errors(),反过来如果是dtd中定义的元素或者是属性没有在xml中有所体现,那么就会有warning。
2、warning大部分是发生在dtd本身。除了上述错误,经常是一些重复定义,或者是给未定义的元素定义属性等等这样的错误。
发表评论
-
XML的学习笔记(一)
2007-04-02 12:23 1002记得在大学的时候,花了几天的时间看看了XML,可现在再拾起来的 ... -
学习问题[XML学习]
2007-04-02 14:04 8811、一个XML文档可以含有多个dtd文档吗? 答:当然可以完全 ... -
XML的学习笔记(二)
2007-04-02 14:07 738reference to some binary data ... -
Java API for XML Processing
2007-04-05 01:44 1093The Java API for XML Processing ... -
Simple API for XML
2007-04-09 13:27 1065SAX是Simple API for XML的简称。 什么是S ... -
Echoing an XML File with the SAX Parser
2007-04-15 08:34 1020首先要继承ContentHandler类,然后复写几个函数。 ... -
SAX的异常处理。
2007-04-20 14:12 871SAXParseException SAXException ... -
Handling Lexical Events
2007-04-25 01:08 791How the LexicalHandler Works ... -
DTDHandler And EntityResolver
2007-04-25 13:43 1097The DTDHandler API In Choosing ... -
Document Object Model
2007-05-01 04:42 931When to Use DOM On the other h ... -
Portal的简单介绍
2007-05-18 03:35 1526什么是Portal? A server to ag ... -
Portal的架构
2007-05-18 07:16 1918Portal的起源 WebSphere Portal find ... -
了解Portlet
2007-05-21 02:38 1069The base building blocks of a P ... -
Portlet的API编程
2007-05-28 09:43 1111Abstract portlet与concrete portl ... -
Portlet Life Circle
2007-05-29 14:51 1271Portlet life circle diagram in ... -
Porlet的类和接口
2007-06-05 09:41 1761Portlet->PortletAdapter Port ... -
servlet-api的基本类和其接口的介绍
2007-07-16 15:37 1619基本类和接口 一、javax.servlet.Servle ...
相关推荐
A shared library is provided for parsing, generating, manipulating, and validating XML documents using the DOM, SAX, and SAX2 APIs. For an introduction to programming with Xerces-C++ refer to the ...
C#中的 Validating 和 Validated 事件 在 C# 中,Validating 和 Validated 事件是两个重要的事件,它们在控件的数据验证过程中扮演着关键角色。这些事件通常用于验证用户输入的数据,以确保输入的数据符合要求。 ...
Validating the design using the UML model is crucial for ensuring that the system meets its requirements and performs as expected. Techniques such as simulation and formal verification can be employed...
Validating the User H G CONTENTS http://docs.rinet.ru:8080/Using_Perl5_in_Web/ (5 of 24) [2/17/2007 1:22:34 PM] Logging Out H Managing Session Data Storing Session Data H Retrieving Session Data H...
Integrating your application with Bootstrap, validating user input, interacting with databases, and deploying your application are some of the things that you will be able to execute with this fast-...
The xml.parsers.expat module is a Python interface to the Expat non-validating XML parser. The module provides a single extension type, xmlparser, that represents the current state of an XML parser. ...
美食该如何制作?食品安全以什么为标准?...这么一份validating the safty of cooki...该文档为validating the safty of cooking procedures,是一份很不错的参考资料,具有较高参考价值,感兴趣的可以下载看看
xerces-c-3.0.0.zip Xerces-C++ is a validating XML parser written in a... A shared library is provided for parsing, generating, manipulating, and validating XML documents using the DOM, SAX, and SAX2 APIs
The fuzzy logic control based battery management system has been designed for effective power ... Finally, simulation results are uated and validating the effectiveness of the proposed controller.
6. **Validating Frequently**: Regular validation checks are performed throughout the development cycle, ensuring that the software remains aligned with the specified requirements. 7. **Evolving a ...
- **Implementing the Rules**: Coding the rules for validating swaps, detecting chains, and refilling the grid after a move. - **Swapping Jewels**: Implementing the functionality for swapping jewels on...
Experimental studies are initially conducted on the parallel active power filter, validating the effectiveness of the proposed methodologies. In conclusion, the research presented in "人工智能-深度...
You will learn the three steps to build an effective machine learning solution, which are exploring the data, building the solution, and validating the results. The book will demonstrate each step, ...
Using the Facade pattern 27 Using private packages 29 Chapter 3: Routing 33 Introduction 33 Building an API / JSON based route for searching 33 Testing your route in PHPUnit 37 Building a view based ...
# Validating that the code that was reviewed is indeed the code being # checked in (using the bug-id number or a seperate review # number to identify this particular code set.). # # If any of the ...
formed rules (using the Object Constraint Language and precise text) and precise text. The formalization of UML is still an open problem. Many works have been done to formalize parts of the language ...
identify multiple ways to define an Excel table using buttons on the HOME and INSERT tabs, the Quick Analysis feature, a keyboard shortcut and by formatting a data range as a table, and recognize ways...
`validating`是一个流行的第三方包,它为Laravel提供了模型数据的自动验证功能,极大地简化了模型验证的流程。这个包通常通过引入一个trait(特性)来实现,使得在保存数据到数据库之前,模型能够自动进行验证。 ...
After grouping data, you can further filter the results using the HAVING clause, which filters the results of a GROUP BY operation. For example: ```sql SELECT column1, COUNT(*) FROM table_name GROUP ...