[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Antw: Schemas and mixed content with Relax NG and W3CXML S

  • From: Philippe Poulard <philippe.poulard@s...>
  • To: Wolfgang Schindler <w.schindler@p...>, XML DEV <xml-dev@l...>
  • Date: Wed, 16 Jul 2008 16:51:48 +0200

Re: Antw:  Schemas and mixed content with Relax NG and	W3CXML S
Wolfgang Schindler a écrit :
> Hi Philippe,
> 
> it's quite easy to do with XML Schema:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

	<xs:element name="persons">
  	    <xs:complexType>
  	    <xs:sequence minOccurs="1" maxOccurs="unbounded">
  	        <xs:element  ref="person"/>
  	    </xs:sequence>
      	    </xs:complexType>
  	</xs:element>


> 	<xs:element name="person">
> 		<xs:complexType mixed="true">
> 			<xs:sequence>
> 				<xs:element name="firstname" type="xs:string"/>
> 				<xs:element name="lastname" type="xs:string"/>
> 			</xs:sequence>
> 		</xs:complexType>
> 	</xs:element>
> </xs:schema>

Hi Wolfgang,

unfortunately, this document is valid :
<?xml version="1.0" encoding="ISO-8859-1"?>
<persons xsi:noNamespaceSchemaLocation="person.xsd" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <person>Mr 
<firstname>John</firstname><lastname>Doe</lastname></person>
      <person>Mr <firstname>Jane</firstname><lastname>Doe</lastname>, 
her sister</person>
  </persons>

...whereas it shouldn't : the 2nd person ends with a text that I don't want


> 
> Have a nice day
> Wolfgang
> 
>>>> Philippe Poulard <philippe.poulard@s...> 16.07.2008 16:11 >>>
> hi,
> 
> this is a question about schemas
> 
> I know that with DTDs, when a text is allowed with elements, the best we 
> can do is to allow it everywhere between other elements that can be 
> repeated at any place in the text :
> 
> <!ELEMENT p (#PCDATA|a|ul|b|i|em)*>
> 
> unfortunately, we can't enforce the text to be at a given place :
> 
> <person>Mr <firstname>John</firstname><lastname>Doe</lastname></person>
> 
> the following DTD is invalid, but explain what we'd like to have :
> <!ELEMENT person (#PCDATA,firstname,lastname)>
> 
> I wonder if there are also similar limitations with Relax NG and W3C XML 
> Schema and why ?
> 


-- 
Cordialement,

               ///
              (. .)
  --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
  -----------------------------
  http://reflex.gforge.inria.fr/
        Have the RefleX !


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.