XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: Antw: [xml-dev] Schemas and mixed content with Relax NG and W3CXML Schema

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@sophia.inria.fr> 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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS