Hi Roger,
The clue is the attach action from:
<mode name="activity">
<namespace ns="http://www.work.org">
<validate schema="Work.rng"
useMode="distance"/>
<attach/>
</namespace>
</mode>
As there is no mode specified for that action the current mode will be
used, that is the activity mode. The distance section is not allowed in
the activity mode thus the error. Change that to
<mode name="activity">
<namespace ns="http://www.work.org">
<validate schema="Work.rng"
useMode="distance"/>
<attach useMode="distance"/>
</namespace>
</mode>
Best Regards,
George
-- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Costello, Roger L. wrote: > Hi Folks, > > I have a <Diary> section which has an <Activity> element that can > contain anything (open content). In the <Activity> element I placed a > <Work> section. And in the <Work> section I nested a <Distance> section: > > -------------------------------------------------------------------------------------- > Diary.xml > -------------------------------------------------------------------------------------- > <?xml version="1.0"?> > <Diary xmlns="http://www.diary.org"> > <Activity> > <Work xmlns="http://www.work.org"> > <StartTime>07:45:00</StartTime> > <EndTime>16:30:00</EndTime> > <Distance xmlns="http://www.distance.org">24 > <http://www.distance.org">24> miles</Distance> > </Work> > </Activity> > </Diary> > > Here is my NVDL script: > > -------------------------------------------------------------------------------------- > Diary.nvdl > -------------------------------------------------------------------------------------- > <?xml version="1.0"?> > <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0" > startMode="diary"> > > <mode name="diary"> > <namespace ns="http://www.diary.org"> > <validate schema="Diary.xsd" > useMode="activity" /> > </namespace> > </mode> > > <mode name="activity"> > <namespace ns="http://www.work.org"> > <validate schema="Work.rng" > useMode="distance"/> > <attach/> > </namespace> > </mode> > > <mode name="distance"> > <namespace ns="http://www.distance.org"> > <validate schema="Distance.xsd"/> > </namespace> > </mode> > > </rules> > When I run it, I get this error message from oNVDL: > > Diary.xml:7:55: error: elements from namespace "http://www.distance.org > <http://www.distance.org >" are not allowed. > > Would you tell me what I am doing wrong, please? Below is Diary.xsd, > Work.rng, and Distance.xsd. > > Thanks! /Roger > > -------------------------------------------------------------------------------------- > Diary.xsd > -------------------------------------------------------------------------------------- > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://www.diary.org" > xmlns="http://www.diary.org" > elementFormDefault="unqualified"> > > <xs:element name="Diary"> > <xs:complexType> > <xs:sequence> > <xs:element ref="Activity" maxOccurs="unbounded"/> > </xs:sequence> > </xs:complexType> > </xs:element> > > <xs:element name="Activity"> > <xs:complexType> > <xs:sequence> > <xs:any namespace="##other" processContents="lax" /> > </xs:sequence> > </xs:complexType> > </xs:element> > > </xs:schema> > > -------------------------------------------------------------------------------------- > Work.rng > -------------------------------------------------------------------------------------- > <?xml version="1.0" encoding="UTF-8"?> > <element name="Work" xmlns="http://relaxng.org/ns/structure/1.0" > datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" > ns="http://www.work.org"> > > <element name="StartTime"> > <data type="time"/> > </element> > > <element name="EndTime"> > <data type="time"/> > </element> > > </element> > > -------------------------------------------------------------------------------------- > Distance.xsd > -------------------------------------------------------------------------------------- > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://www.distance.org" > elementFormDefault="unqualified"> > > <xs:element name="Distance" type="xs:string" /> > > </xs:schema> -- DSDL comments To unsubscribe, please send a message with the command "unsubscribe" to dsdl-comment-request@dsdl.org (mailto:dsdl-comment-request@dsdl.org?Subject=unsubscribe)Received on Wed May 21 22:18:23 2008
This archive was generated by hypermail 2.1.8 : Wed May 21 2008 - 20:38:04 UTC