[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
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|