Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2008, 12:53 AM
Authorized User
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Michael,

Thanks for your reply. So is there any way to specify CDATA datatype in schema. ie. I want to know is there any datatype to specify the particular element is CDATA (as like xsd:string etc.,). If its there then probably I can do change in the schema for that particular element.

 
Old July 28th, 2008, 12:55 AM
Authorized User
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi. Thx for your reply.

 
Old July 28th, 2008, 03:56 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

CDATA can be used anywhere, around any text in your document. The schema doesn't have to permit it. It's not a datatype, it's just an alternative way of escaping special characters: instead of

<a>x &amp; y</a>

you can write

<a><![CDATA[x & y]]></a>

As far as the schema is concerned, and as far as the receiving application is concerned, these should be 100% equivalent.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old July 28th, 2008, 05:03 AM
Authorized User
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok..So there is no way to specify in xsd, whether a particular xml element can have '&','<' characters..Is it right?

 
Old July 28th, 2008, 05:21 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

XSD constrains the logical content of the element, not its escaped lexical form. You can ban "<" by writing a pattern facet in the schema, and this will ban all forms of expressing "<" in the input, for example

&lt;
<![CDATA<]]>
#x003C;
#60;

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
parsing xml kri_hegde XML 5 July 24th, 2007 11:37 AM
XML parsing denzil_cactus Perl 0 June 11th, 2007 02:34 AM
XML Parsing SCADA_Monkey XML 2 March 11th, 2007 03:20 PM
XML Parsing tgopal Javascript 2 July 27th, 2004 08:54 AM
XML Parsing tgopal .NET Web Services 1 June 15th, 2004 03:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.