Possible spurious error messages about xref's
Posted: Fri Apr 09, 2004 9:40 pm
It looks like I'm getting spurious error messages when I use xref's to id's in xinclude's. Or I'm doing something wrong. Any help welcome. No ultimate problem, the documents transform OK and the links work, it's just that I wasted time chasing errors that weren't there.
(Latest Oxygen, MacOS 10.2.8 on a G4 Server)
Ron
The files I tested it on follow
-------------------------------------------
file: Book.xml
-------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<book id="Book" lang="EN">
<title>
Book
</title>
<!--
In this book I first include a 'part' which then includes 'chapters'. The 'part' also includes 'xref's to the chapters. When this 'book' file or the 'part' file are validated, I get error messages saying the id's in the 'xref's can't be found. Despite these error messages it all transforms OK and the links work - I believe that the 'book' is actually valid, and the error messages are spurious. But when I get error messages on validation like:
'E An element with the identifier "Link3" must appear in the document.'
I tend to spend time looking for them - and in this case there aren't any.
The errors are generated by the 'part' file' - the 'book' file is not really needed.
local_adds.dtd includes the bits to make 'xinclude's work.
<!ENTITY % xinclude SYSTEM "_DocBook42/xinclude.mod" >
%xinclude;
The _DocBook42/xinclude.mod file holds:
<!ELEMENT xi:include (xi:fallback?) >
<!ATTLIST xi:include
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
href CDATA #REQUIRED
parse (xml|text) "xml"
xpointer CDATA #IMPLIED
encoding CDATA #IMPLIED
accept CDATA #IMPLIED
accept-charset CDATA #IMPLIED
accept-language CDATA #IMPLIED >
<!ELEMENT xi:fallback ANY >
<!ATTLIST xi:fallback
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude" >
<!ENTITY % local.preface.class "| xi:include" >
<!ENTITY % local.part.class "| xi:include" >
<!ENTITY % local.chapter.class "| xi:include" >
<!ENTITY % local.divcomponent.mix "| xi:include" >
<!ENTITY % local.para.char.mix "| xi:include" >
<!ENTITY % local.info.class "| xi:include" >
<!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'" >
-->
<xi:include
href="Part.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" >
</xi:include>
</book>
-------------------------------------------
file: Part.xml
-------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<part id="Part" lang="EN">
<title>
Part
</title>
<partintro>
<para>
In <xref linkend="Link1" /> we do this, in <xref linkend="Link2" /> we do that, and in <xref linkend="Link3" /> we do the other.
</para>
</partintro>
<xi:include
href="Link1.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" >
</xi:include>
<xi:include
href="Link2.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" >
</xi:include>
<xi:include
href="Link3.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" >
</xi:include>
</part>
-------------------------------------------
file: Link1.xml
-------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<chapter id="Link1" lang="EN">
<title>
Link1
</title>
<para>
In this chaper we do this.
</para>
</chapter>
-------------------------------------------
file: Link2.xml
-------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<chapter id="Link2" lang="EN">
<title>
Link2
</title>
<para>
In this chaper we do that.
</para>
</chapter>
-------------------------------------------
file: Link3.xml
-------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<chapter id="Link3" lang="EN">
<title>
Link3
</title>
<para>
In this chaper we do the other.
</para>
</chapter>
-------------------------------------------
(Latest Oxygen, MacOS 10.2.8 on a G4 Server)
Ron
The files I tested it on follow
-------------------------------------------
file: Book.xml
-------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<book id="Book" lang="EN">
<title>
Book
</title>
<!--
In this book I first include a 'part' which then includes 'chapters'. The 'part' also includes 'xref's to the chapters. When this 'book' file or the 'part' file are validated, I get error messages saying the id's in the 'xref's can't be found. Despite these error messages it all transforms OK and the links work - I believe that the 'book' is actually valid, and the error messages are spurious. But when I get error messages on validation like:
'E An element with the identifier "Link3" must appear in the document.'
I tend to spend time looking for them - and in this case there aren't any.
The errors are generated by the 'part' file' - the 'book' file is not really needed.
local_adds.dtd includes the bits to make 'xinclude's work.
<!ENTITY % xinclude SYSTEM "_DocBook42/xinclude.mod" >
%xinclude;
The _DocBook42/xinclude.mod file holds:
<!ELEMENT xi:include (xi:fallback?) >
<!ATTLIST xi:include
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
href CDATA #REQUIRED
parse (xml|text) "xml"
xpointer CDATA #IMPLIED
encoding CDATA #IMPLIED
accept CDATA #IMPLIED
accept-charset CDATA #IMPLIED
accept-language CDATA #IMPLIED >
<!ELEMENT xi:fallback ANY >
<!ATTLIST xi:fallback
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude" >
<!ENTITY % local.preface.class "| xi:include" >
<!ENTITY % local.part.class "| xi:include" >
<!ENTITY % local.chapter.class "| xi:include" >
<!ENTITY % local.divcomponent.mix "| xi:include" >
<!ENTITY % local.para.char.mix "| xi:include" >
<!ENTITY % local.info.class "| xi:include" >
<!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'" >
-->
<xi:include
href="Part.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" >
</xi:include>
</book>
-------------------------------------------
file: Part.xml
-------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<part id="Part" lang="EN">
<title>
Part
</title>
<partintro>
<para>
In <xref linkend="Link1" /> we do this, in <xref linkend="Link2" /> we do that, and in <xref linkend="Link3" /> we do the other.
</para>
</partintro>
<xi:include
href="Link1.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" >
</xi:include>
<xi:include
href="Link2.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" >
</xi:include>
<xi:include
href="Link3.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" >
</xi:include>
</part>
-------------------------------------------
file: Link1.xml
-------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<chapter id="Link1" lang="EN">
<title>
Link1
</title>
<para>
In this chaper we do this.
</para>
</chapter>
-------------------------------------------
file: Link2.xml
-------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<chapter id="Link2" lang="EN">
<title>
Link2
</title>
<para>
In this chaper we do that.
</para>
</chapter>
-------------------------------------------
file: Link3.xml
-------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<chapter id="Link3" lang="EN">
<title>
Link3
</title>
<para>
In this chaper we do the other.
</para>
</chapter>
-------------------------------------------