Hi Dave,
The splitting of document into sections and how the sections are
combined into document fragments to form validation candidates does not
depend on the schemas used for validation.
As I said in my previous reply the first step the NVDL processing does
is to split the document into sections, each section containing elements
in the same namespace. Thus there is not possible to have the div
element from the XHTML namespace in the same section with an element
from the Atom namespace. You can create a validation candidate to
contain elements in multiple namespaces but the sections will contain
only components in a single namespace.
Now, I believe that your problem is to validate the XHTML content
against the XHTML schema because the Atom schema does not really
validate the XHTML code, it just allows it. In that case you can create
a validation candidate with the whole document (containing also the
XHTML parts that will be accepted by the Atom schema) and pass that to
the Atom schema and create also validation candidates with the XHTML
code and pass that through the XHTML schema.
The NVDL script will change as below. The initial section is expected to
be in the Atom namespace and a validate action will be performed with
the eventual XHTML sections inside the content element processed in the
xhtml mode. The xhtml mode will perform two actions
1. will attach the XHTML sections to the parent Atom sections that go
to the validate against the Atom schema action
2. will validate the XHTML sections themselves against the XHTML schema
<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
xmlns:a="http://www.w3.org/2005/Atom"
xmlns:x="http://www.w3.org/1999/xhtml"
startMode="doc"
>
<mode name="doc">
<namespace ns="http://www.w3.org/2005/Atom">
<validate schema="atom.rng">
<context path="feed/entry/content" useMode="xhtml"/>
</validate>
</namespace>
</mode>
<mode name="xhtml">
<namespace ns="http://www.w3.org/1999/xhtml">
<attach/>
<validate schema="xhtml.sbp.rng" />
</namespace>
</mode>
</rules>
Regarding wildcards: the default wildard character is * but you can
specify a different one with the wildCard attribute. For instance
instead a rule like
<namespace ns="http://www.w3.org/*">
<allow/>
</namespace>
will allow content from any namespace that starts with http://www.w3.org/
Best Regards,
George
-- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Dave Pawson wrote: > 2008/5/14 George Cristian Bina <george@oxygenxml.com>: >> Dave, >> >> The initial NVDL processing splits the document into sections. Each section >> contains elements (or attributes in case of attribute sections) all in the >> same namespace. > > So the sections will be (using xpath notation) > /a:feed down to /a:entry/x:div > Since the atom schema *includes* the xhtml 'div' element (which I don't like) > > then the x:p section (in the xhtml namespace) > > and the 'context' of the current rule will be the xhtml div element > from which the x:p element can trigger > > >>From which it makes sense to use local-name() rather than a full nsname > > > >> The context specifies a path inside a section, thus there is no need for >> qualified names as all the elements are in the same namespace. Plus you have >> the possibility to match the namespaces using wildcards so you may not even >> have a prefix defined for the matched namespace. > > Can you think of an example of using a wildcard please? > the definition > <define name="path"> > <data type="string"> > <param name="pattern">\s*(/\s*)?\i\c*(\s*/\s*\i\c*)*\s*(\|\s*(/\s*)?\i\c*(\s*/\s*\i\c*)*\s*)*</param> > </data> > </define> > doesn't seem to contain a * (as a wildcard?) > > > > >> Now, back to your sample... That is equivalent with an NVDL script without >> the context element. In order to allow XHTML content only inside the Atom >> content element then you need a script like > > No (this is the bit I don't like about atom?) > the xhtml 'div' element is part of the atom schema! > This from the atom schema > > <define name="xhtmlDiv"> > <element name="xhtml:div"> > <zeroOrMore> > <choice> > <attribute> > <anyName/> > </attribute> > <text/> > <ref name="anyXHTML"/> > </choice> > </zeroOrMore> > </element> > </define> > > I have changed that for the schema I'm using, such that the xhtml:div is empty. > > I note it is also part of the xhtml schema, which is where > I start to doubt it all :-) > > Which section will xhtml:div be in! the atom section > or the xhtml section? > > > > > >> >> <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0" >> xmlns:a="http://www.w3.org/2005/Atom" >> xmlns:x="http://www.w3.org/1999/xhtml" >> startMode="doc" >> > >> >> >> <mode name="doc"> >> <namespace ns="http://www.w3.org/2005/Atom"> >> <validate schema="atom.rng" useMode="doc"> >> <context path="/feed/entry/content" useMode="xhtml"/> >> </validate> >> </namespace> >> </mode> >> >> >> <mode name="xhtml"> >> <namespace ns="http://www.w3.org/1999/xhtml"> >> <validate schema="xhtml.sbp.rng" /> >> </namespace> >> </mode> >> </rules> >> >> That is, keep the doc mode as default for the first validate action and >> change it only in the context of content if a new section starts inside it. > > This is where the 'overlap' between atom and xhtml confuses me. > Which section will the 'div' element be in? > > > regards > > > > > > -- 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 14 12:14:41 2008
This archive was generated by hypermail 2.1.8 : Wed May 14 2008 - 11:03:03 UTC