- From: Pete Cordell <petexmldev@tech-know-ware.com>
- Date: Wed, 9 Jan 2008 21:56:29 -0000
- To: "dave" <ceek63@yahoo.com>, <xmlschema-dev@w3.org>
----- Original Message From: "dave" ----- > Am using W3C XML Schema. > I need to store some pattern values such as > "[/<*ab^&[[1" (excluding quotes) in XML. What would > be the data type for an element which would store such > values as is? There's no XSD schema type that allows you to store things like < and & in an XML instance in their raw form. For example, the following would be an illegal document: <MyElement><&</MyElement> All you can do is define your type as xs:string (or some restriction thereof) and the XML tool or library that you use to interface to your XML instance should hopefully do the conversion for you from something like: <& to <& and vice versa. Alternatively your tool (or you if you're rolling your own) may choose to store the data in what's called a CDATA Section [1]. This wraps text between the tokens <![CDATA[ and ]]>, for example: <![CDATA[&]]> Obviously if your data includes the sequence ]]>, you have to be careful to do something like: <![CDATA[&]]>]]><![CDATA[&]]> for &]]>& (see [2]). These escaping methods are issues of XML instance well-formedness however, which is something a schema can not have no direct impact on. HTH, Pete Cordell Codalogic Visit http://www.codalogic.com/lmx/ for XML C++ data binding [1] http://www.w3.org/TR/2006/REC-xml-20060816/#sec-cdata-sect [2] http://www.w3.org/TR/2006/REC-xml-20060816/#syntax
Received on Wednesday, 9 January 2008 21:57:28 UTC