W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2001

Re: How can I define PCDATA within a XSD schema

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Fri, 02 Nov 2001 14:24:04 +0100
Message-ID: <3BE29E74.80105@dyomedea.com>
To: www-xml-schema-comments@w3.org
Cc: eBeisswenger@iRIX.ch
> I am using schema definitions for my xml files, and I would like to place
> HTML code as data in a XML file so that it can't be interpreted by the XSLT
> parser, e.g. ...
> 
> <HTMLCONTENT>
> <b>Hello</b>
> </HTMLCONTENT>
> 
> ...should deliver "<b>Hello</b>" in the HTML code generated by XSLT. But of
> course, the <b> tag is not allowed within the xml element HTMLCODE.


What you need here, is to define an element with "mixed" content which 
allows any element. If you don't care about the namespace and don't 
want|need to validate the elements which enclosed in <HTMLCONTENT>, you 
can do this with the following definition:

<xs:element name="HTMLCONTENT" mixed="true">
  <xs:sequence>
  <xs:any namespace="##any"
	  processContents="skip" minOccurs="0"
	  maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

See also:

http://www.w3.org/TR/xmlschema-0/#any
http://www.xml.com/pub/a/2000/11/29/schemas/part1.html?page=8#namespaces

Hope this helps.

Eric
-- 
Rendez-vous  Paris pour le Forum XML.
                    http://www.technoforum.fr/Pages/forumXML01/index.html
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
Received on Friday, 2 November 2001 08:24:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:57 GMT