2010年1月1日 星期五

[xml encode]xml的編碼


在製作xml menu發現有的網址有包含&導致不能 有效果

查了一下xml encode的說明

2.5. Language and character encoding

XML provides an xml:lang attribute that can be used on any element. This provides a way to describe the language used for the content of the element. The DCMES provides aLanguage element which is used to describe the language of the resource.

The values of the elements and attributes will need to be encoded using the rules of XML when there are special characters in the value. The special characters that need to be encoded, and when they need to be are summarised here for reference:

Plain text XML Encoding Required in
&&Element and attribute values
<<Element and attribute values
>>Element and attribute values
' (apostrophe / single quote)'Attribute values
" (double quote)"Attribute values

Note that the ' and " only need to be used for those character inside attribute values, which are only needed for the rdf:resource attribute (see Section 2.4) and thexml:lang attribute (see Section 2.5).

All other characters outside the core US-ASCII range of 32-126 should not be encoded with the HTML entities such as é since these are not defined in XML. Numeric entities for the characters should be used which are written as &#ddd; in decimal or ઼ in hexadecimal. Alternatively they can be encoded as Unicode in one of the formats such as UTF-8 which is widely supported.

http://dublincore.org/documents/2001/04/11/dcmes-xml/

 

沒有留言:

張貼留言