[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Arbitrary grouping
Look at <interleave> from RELAX NG [1]. You can also use Trang [2], a Java tool by XML wundermensch James Clark that infers RELAX NG and XSD schemas from XML and translates from RNG to XSD. Then validate against these schemas with Sun's Multi-schema Validator [3], a Java tool written by Kawaguchi Kohsuke that validates Relax, RELAX NG, XSD, and DTD. See full examples [4]. Trang generates suitable constructs, other than <interleave>, to construct schemas that work for both RNG and XSD. Mike [1] http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html#IDAN1YR [2] http://thaiopensource.com/relaxng/trang.html [3] http://wwws.sun.com/software/xml/developers/multischema/ [4] Examples: C:\XML\Rng\Examples>cat ex1.xml <ex> <a/> <b/> <c/> <d/> <e/> <f/> </ex> C:\XML\Rng\Examples>cat ex2.xml <ex> <grp> <a/> <b/> </grp> <c/> <grp> <d/> <e/> <f/> </grp> </ex> C:\XML\Rng\Examples>cat ex3.xml <ex> <a/> <grp> <b/> <c/> <d/> </grp> <e/> <f/> </ex> C:\XML\Rng\Examples>java -cp c:\lib\trang.jar;c:\lib\jing.jar -jar c:\lib\trang.jar e x1.xml ex2.xml ex3.xml ex.rng C:\XML\Rng\Examples>java -jar c:\lib\msv.jar ex.rng ex1.xml ex2.xml ex3.xml start parsing a grammar. validating ex1.xml the document is valid. -------------------------------------- validating ex2.xml the document is valid. -------------------------------------- validating ex3.xml the document is valid. C:\XML\Rng\Examples>java -jar c:\lib\msv.jar ex.xsd ex1.xml ex2.xml ex3.xml start parsing a grammar. validating ex1.xml the document is valid. -------------------------------------- validating ex2.xml the document is valid. -------------------------------------- validating ex3.xml the document is valid. C:\XML\Rng\Examples> > -----Original Message----- > From: Hunsberger, Peter [mailto:Peter.Hunsberger@s...] > Sent: Monday, March 10, 2003 8:36 AM > To: 'xml-dev@l...' > Subject: Arbitrary grouping > > > I'm new to XML schema and am confused on how I would create a schema that > introduces a set of arbitrary grouping for a set of elements. > For example: > > <x> > <a/> > <b/> > <c/> > <d/> > <e/> > <f/> > </x> > > or > > <x> > <group> > <a/> > <b/> > </group> > <c/> > <group> > <d/> > <e/> > <f/> > </group> > </x> > > or perhaps > > <x> > <a/> > <group> > <b/> > <c/> > <d/> > </group> > <e/> > <f/> > </x> > > would all be considered valid. Additional constraints are that any number > of groups can occur, but the elements a through f can each only occur a > maximum of once inside the x element whether they are children of > a group or > not. > > Peter Hunsberger > > > ----------------------------------------------------------------- > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > initiative of OASIS <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://lists.xml.org/ob/adm.pl> > >
|
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
|