Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: suitable data type to store patterns..

From: "Pete Cordell" <petexmldev@--------------.--->
To: "dave" <ceek63@-----.--->, <xmlschema-dev@--.--->
Date: 1/9/2008 9:56:00 PM
----- 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 &lt;&amp; 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[&]]>]]&gt;<![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 



From krpelan_wj@y... Thu Jan 10 10:16:02 2008
Received: from aji.w3.org ([133.27.22


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent