Content model of section is not determinist

View: New views
3 Messages — Rating Filter:   Alert me  

Content model of section is not determinist

by Nobble :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there.

I am having what I believe to be a problem with my DTD which is
causing my documents to fail validation with xmllint.

I am using a DTD that is customised to allow the inclusion of
xi:includes and mathml at certain places within the document. This is
what the customisation (UG.dtd) looks like:

----------------------------------------------------------------------------------------------
<!-- xinclude entities -->
<!ELEMENT xi:include (xi:fallback?) >
<!ATTLIST xi:include
    xmlns:xi   CDATA       #FIXED    "http://www.w3.org/2001/XInclude"
    href       CDATA       #IMPLIED
    parse      (xml|text)  "xml"
    xpointer   CDATA       #IMPLIED
    encoding   CDATA       #IMPLIED
    accept     CDATA       #IMPLIED
    accept-language CDATA  #IMPLIED >

<!ELEMENT xi:fallback ANY>
<!ATTLIST xi:fallback
    xmlns:xi   CDATA   #FIXED   "http://www.w3.org/2001/XInclude" >

<!-- can replace a chapter by an xinclude pointing to a chapter -->
<!ENTITY % local.chapter.class "| xi:include">
<!-- can replace a section by an xinclude pointing to a section -->
<!ENTITY % local.section.class "| xi:include">
<!-- can replace a refentry by an xinclude pointing to a refentry -->
<!ENTITY % local.refentry.class "| xi:include">
<!-- inside chapter or section elements -->
<!--<!ENTITY % local.divcomponent.mix "| xi:include">-->
<!-- inside para, programlisting, literallayout, etc. -->
<!ENTITY % local.para.char.mix "| xi:include">
<!-- inside bookinfo, chapterinfo, etc. -->
<!ENTITY % local.info.class "| xi:include">
<!-- inside equations
<!ENTITY % equation.math "| xi:include">
<!ENTITY % inlineequation.math "| xi:include">
<!ENTITY % informalequation.math "| xi:include">
 -->

 <!-- MathML entities -->
<!ENTITY % MATHML.prefixed "INCLUDE">
<!ENTITY % MATHML.prefix "mml">
<!ENTITY % equation.content "(alt?,
(graphic+|mediaobject+|xi:include+|mathphrase+|mml:math))">
<!ENTITY % inlineequation.content "(alt?,
(graphic+|inlinemediaobject+|xi:include+|mathphrase+|mml:math))">
<!ENTITY % informalequation.content "(alt?,
(graphic+|informalequation+|xi:include+|mathphrase+|mml:math))">
<!ENTITY % mathml PUBLIC "-//W3C//DTD MathML 2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/mathml2.dtd">
%mathml;
----------------------------------------------------------------------------------------------

However, when I try to validate a simple document:

----------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
    "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
    <!ENTITY % UG SYSTEM "../UG.dtd">
    %UG;
]>
<section >
  <title>Title</title>
  <para>
    This is a para.
  </para>
</section>
----------------------------------------------------------------------------------------------

using

xmllint --noout --valid --postvalid test.xml

I get the error

----------------------------------------------------------------------------------------------
test.xml:0: validity error : Content model of section is not de
terminist: (sectioninfo? , (title , subtitle? , titleabbrev?) , (toc | lot | ind
ex | glossary | bibliography)* , (((calloutlist | glosslist | bibliolist | itemi
zedlist | orderedlist | segmentedlist | simplelist | variablelist | caution | im
portant | note | tip | warning | literallayout | programlisting | programlisting
co | screen | screenco | screenshot | synopsis | cmdsynopsis | funcsynopsis | cl
asssynopsis | fieldsynopsis | constructorsynopsis | destructorsynopsis | methods
ynopsis | formalpara | para | simpara | address | blockquote | graphic | graphic
co | mediaobject | mediaobjectco | informalequation | informalexample | informal
figure | informaltable | equation | example | figure | table | msgset | procedur
e | sidebar | qandaset | task | anchor | bridgehead | remark | highlights | abst
ract | authorblurb | epigraph | indexterm | beginpage)+ , ((refentry | xi:includ
e)* | (section | xi:include)* | simplesect*)) | (refentry | xi:include)+ | (sect
ion | xi:include)+ | simplesect+) , (toc | lot | index | glossary | bibliography
)*)
----------------------------------------------------------------------------------------------

Does anyone know what's going wrong here? I suspect that I have
incorrectly defined my xi:include within the DTD or something like
that, but I am not sure.

Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: Content model of section is not determinist

by Bob Stayton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I can tell you what is generating that error, but I'm not sure how to fix
it.  When the DTD resolves with your additional parameter entities, you get
this:

((refentry | xi:include)* | (section | xi:include)* | simplesect*))

and

(refentry | xi:include)+ | (section | xi:include)+ | simplesect+)

The XML standard http://www.w3.org/TR/REC-xml/#sec-element-content says:

"it is an error if the content model allows an element to match more than
one occurrence of an element type in the content model"

An xi:include element can match in either of two places in both of these
parts of the content model, so that generates the deterministic error.  So
it looks like you can extend refentry, or section, but not both.

Or manually rewrite the content model for section, but I'm not clear on what
it should be.  The section content model is kind of convoluted because it is
designed to prevent mixing of refentry, section, and simplesect children
within the same section.

Bob Stayton
Sagehill Enterprises
bobs@...


----- Original Message -----
From: "Paul Suckling" <paul.suckling@...>
To: "apps docbook" <docbook-apps@...>
Sent: Wednesday, July 01, 2009 4:39 PM
Subject: [docbook-apps] Content model of section is not determinist


> Hi there.
>
> I am having what I believe to be a problem with my DTD which is
> causing my documents to fail validation with xmllint.
>
> I am using a DTD that is customised to allow the inclusion of
> xi:includes and mathml at certain places within the document. This is
> what the customisation (UG.dtd) looks like:
>
> ----------------------------------------------------------------------------------------------
> <!-- xinclude entities -->
> <!ELEMENT xi:include (xi:fallback?) >
> <!ATTLIST xi:include
>    xmlns:xi   CDATA       #FIXED    "http://www.w3.org/2001/XInclude"
>    href       CDATA       #IMPLIED
>    parse      (xml|text)  "xml"
>    xpointer   CDATA       #IMPLIED
>    encoding   CDATA       #IMPLIED
>    accept     CDATA       #IMPLIED
>    accept-language CDATA  #IMPLIED >
>
> <!ELEMENT xi:fallback ANY>
> <!ATTLIST xi:fallback
>    xmlns:xi   CDATA   #FIXED   "http://www.w3.org/2001/XInclude" >
>
> <!-- can replace a chapter by an xinclude pointing to a chapter -->
> <!ENTITY % local.chapter.class "| xi:include">
> <!-- can replace a section by an xinclude pointing to a section -->
> <!ENTITY % local.section.class "| xi:include">
> <!-- can replace a refentry by an xinclude pointing to a refentry -->
> <!ENTITY % local.refentry.class "| xi:include">
> <!-- inside chapter or section elements -->
> <!--<!ENTITY % local.divcomponent.mix "| xi:include">-->
> <!-- inside para, programlisting, literallayout, etc. -->
> <!ENTITY % local.para.char.mix "| xi:include">
> <!-- inside bookinfo, chapterinfo, etc. -->
> <!ENTITY % local.info.class "| xi:include">
> <!-- inside equations
> <!ENTITY % equation.math "| xi:include">
> <!ENTITY % inlineequation.math "| xi:include">
> <!ENTITY % informalequation.math "| xi:include">
> -->
>
> <!-- MathML entities -->
> <!ENTITY % MATHML.prefixed "INCLUDE">
> <!ENTITY % MATHML.prefix "mml">
> <!ENTITY % equation.content "(alt?,
> (graphic+|mediaobject+|xi:include+|mathphrase+|mml:math))">
> <!ENTITY % inlineequation.content "(alt?,
> (graphic+|inlinemediaobject+|xi:include+|mathphrase+|mml:math))">
> <!ENTITY % informalequation.content "(alt?,
> (graphic+|informalequation+|xi:include+|mathphrase+|mml:math))">
> <!ENTITY % mathml PUBLIC "-//W3C//DTD MathML 2.0//EN"
> "http://www.w3.org/TR/MathML2/dtd/mathml2.dtd">
> %mathml;
> ----------------------------------------------------------------------------------------------
>
> However, when I try to validate a simple document:
>
> ----------------------------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
>    "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
>    <!ENTITY % UG SYSTEM "../UG.dtd">
>    %UG;
> ]>
> <section >
>  <title>Title</title>
>  <para>
>    This is a para.
>  </para>
> </section>
> ----------------------------------------------------------------------------------------------
>
> using
>
> xmllint --noout --valid --postvalid test.xml
>
> I get the error
>
> ----------------------------------------------------------------------------------------------
> test.xml:0: validity error : Content model of section is not de
> terminist: (sectioninfo? , (title , subtitle? , titleabbrev?) , (toc | lot
> | ind
> ex | glossary | bibliography)* , (((calloutlist | glosslist | bibliolist |
> itemi
> zedlist | orderedlist | segmentedlist | simplelist | variablelist |
> caution | im
> portant | note | tip | warning | literallayout | programlisting |
> programlisting
> co | screen | screenco | screenshot | synopsis | cmdsynopsis |
> funcsynopsis | cl
> asssynopsis | fieldsynopsis | constructorsynopsis | destructorsynopsis |
> methods
> ynopsis | formalpara | para | simpara | address | blockquote | graphic |
> graphic
> co | mediaobject | mediaobjectco | informalequation | informalexample |
> informal
> figure | informaltable | equation | example | figure | table | msgset |
> procedur
> e | sidebar | qandaset | task | anchor | bridgehead | remark | highlights
> | abst
> ract | authorblurb | epigraph | indexterm | beginpage)+ , ((refentry |
> xi:includ
> e)* | (section | xi:include)* | simplesect*)) | (refentry | xi:include)+ |
> (sect
> ion | xi:include)+ | simplesect+) , (toc | lot | index | glossary |
> bibliography
> )*)
> ----------------------------------------------------------------------------------------------
>
> Does anyone know what's going wrong here? I suspect that I have
> incorrectly defined my xi:include within the DTD or something like
> that, but I am not sure.
>
> Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@...
> For additional commands, e-mail: docbook-apps-help@...
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: Content model of section is not determinist

by Nobble :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Bob.

I understand what you are saying. It is useful for us to compile
individual sections of the document, so I'll keep using xi:include for
sections. However, I decided to remove the modification of the DTD
that allows xi:include in place of refentry. Instead I will use use an
ENTITY based approach for including the refentry files. I wont be able
to include the XML and DTD declarations in the refentry files, but
that doesn't matter. I am not interested in compiling refentrys as
documents in their own right. If I want to validate them individually,
I'll just have to manually specify the DTD for validation tool I am
using (via the command line or whatever mechanism it provides for
doing so).

Thanks once again for your help.

Paul

2009/7/2 Bob Stayton <bobs@...>:

> I can tell you what is generating that error, but I'm not sure how to fix
> it.  When the DTD resolves with your additional parameter entities, you get
> this:
>
> ((refentry | xi:include)* | (section | xi:include)* | simplesect*))
>
> and
>
> (refentry | xi:include)+ | (section | xi:include)+ | simplesect+)
>
> The XML standard http://www.w3.org/TR/REC-xml/#sec-element-content says:
>
> "it is an error if the content model allows an element to match more than
> one occurrence of an element type in the content model"
>
> An xi:include element can match in either of two places in both of these
> parts of the content model, so that generates the deterministic error.  So
> it looks like you can extend refentry, or section, but not both.
>
> Or manually rewrite the content model for section, but I'm not clear on what
> it should be.  The section content model is kind of convoluted because it is
> designed to prevent mixing of refentry, section, and simplesect children
> within the same section.
>
> Bob Stayton
> Sagehill Enterprises
> bobs@...
>
>
> ----- Original Message ----- From: "Paul Suckling" <paul.suckling@...>
> To: "apps docbook" <docbook-apps@...>
> Sent: Wednesday, July 01, 2009 4:39 PM
> Subject: [docbook-apps] Content model of section is not determinist
>
>
>> Hi there.
>>
>> I am having what I believe to be a problem with my DTD which is
>> causing my documents to fail validation with xmllint.
>>
>> I am using a DTD that is customised to allow the inclusion of
>> xi:includes and mathml at certain places within the document. This is
>> what the customisation (UG.dtd) looks like:
>>
>>
>> ----------------------------------------------------------------------------------------------
>> <!-- xinclude entities -->
>> <!ELEMENT xi:include (xi:fallback?) >
>> <!ATTLIST xi:include
>>   xmlns:xi   CDATA       #FIXED    "http://www.w3.org/2001/XInclude"
>>   href       CDATA       #IMPLIED
>>   parse      (xml|text)  "xml"
>>   xpointer   CDATA       #IMPLIED
>>   encoding   CDATA       #IMPLIED
>>   accept     CDATA       #IMPLIED
>>   accept-language CDATA  #IMPLIED >
>>
>> <!ELEMENT xi:fallback ANY>
>> <!ATTLIST xi:fallback
>>   xmlns:xi   CDATA   #FIXED   "http://www.w3.org/2001/XInclude" >
>>
>> <!-- can replace a chapter by an xinclude pointing to a chapter -->
>> <!ENTITY % local.chapter.class "| xi:include">
>> <!-- can replace a section by an xinclude pointing to a section -->
>> <!ENTITY % local.section.class "| xi:include">
>> <!-- can replace a refentry by an xinclude pointing to a refentry -->
>> <!ENTITY % local.refentry.class "| xi:include">
>> <!-- inside chapter or section elements -->
>> <!--<!ENTITY % local.divcomponent.mix "| xi:include">-->
>> <!-- inside para, programlisting, literallayout, etc. -->
>> <!ENTITY % local.para.char.mix "| xi:include">
>> <!-- inside bookinfo, chapterinfo, etc. -->
>> <!ENTITY % local.info.class "| xi:include">
>> <!-- inside equations
>> <!ENTITY % equation.math "| xi:include">
>> <!ENTITY % inlineequation.math "| xi:include">
>> <!ENTITY % informalequation.math "| xi:include">
>> -->
>>
>> <!-- MathML entities -->
>> <!ENTITY % MATHML.prefixed "INCLUDE">
>> <!ENTITY % MATHML.prefix "mml">
>> <!ENTITY % equation.content "(alt?,
>> (graphic+|mediaobject+|xi:include+|mathphrase+|mml:math))">
>> <!ENTITY % inlineequation.content "(alt?,
>> (graphic+|inlinemediaobject+|xi:include+|mathphrase+|mml:math))">
>> <!ENTITY % informalequation.content "(alt?,
>> (graphic+|informalequation+|xi:include+|mathphrase+|mml:math))">
>> <!ENTITY % mathml PUBLIC "-//W3C//DTD MathML 2.0//EN"
>> "http://www.w3.org/TR/MathML2/dtd/mathml2.dtd">
>> %mathml;
>>
>> ----------------------------------------------------------------------------------------------
>>
>> However, when I try to validate a simple document:
>>
>>
>> ----------------------------------------------------------------------------------------------
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
>>   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
>>   <!ENTITY % UG SYSTEM "../UG.dtd">
>>   %UG;
>> ]>
>> <section >
>>  <title>Title</title>
>>  <para>
>>   This is a para.
>>  </para>
>> </section>
>>
>> ----------------------------------------------------------------------------------------------
>>
>> using
>>
>> xmllint --noout --valid --postvalid test.xml
>>
>> I get the error
>>
>>
>> ----------------------------------------------------------------------------------------------
>> test.xml:0: validity error : Content model of section is not de
>> terminist: (sectioninfo? , (title , subtitle? , titleabbrev?) , (toc | lot
>> | ind
>> ex | glossary | bibliography)* , (((calloutlist | glosslist | bibliolist |
>> itemi
>> zedlist | orderedlist | segmentedlist | simplelist | variablelist |
>> caution | im
>> portant | note | tip | warning | literallayout | programlisting |
>> programlisting
>> co | screen | screenco | screenshot | synopsis | cmdsynopsis |
>> funcsynopsis | cl
>> asssynopsis | fieldsynopsis | constructorsynopsis | destructorsynopsis |
>> methods
>> ynopsis | formalpara | para | simpara | address | blockquote | graphic |
>> graphic
>> co | mediaobject | mediaobjectco | informalequation | informalexample |
>> informal
>> figure | informaltable | equation | example | figure | table | msgset |
>> procedur
>> e | sidebar | qandaset | task | anchor | bridgehead | remark | highlights
>> | abst
>> ract | authorblurb | epigraph | indexterm | beginpage)+ , ((refentry |
>> xi:includ
>> e)* | (section | xi:include)* | simplesect*)) | (refentry | xi:include)+ |
>> (sect
>> ion | xi:include)+ | simplesect+) , (toc | lot | index | glossary |
>> bibliography
>> )*)
>>
>> ----------------------------------------------------------------------------------------------
>>
>> Does anyone know what's going wrong here? I suspect that I have
>> incorrectly defined my xi:include within the DTD or something like
>> that, but I am not sure.
>>
>> Thank you.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: docbook-apps-unsubscribe@...
>> For additional commands, e-mail: docbook-apps-help@...
>>
>>
>>
>
>



--
Nashi Power.
http://nashi.podzone.org/
Registered address: 7 Trescoe Gardens, Harrow, Middx., U.K.

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...