Error: Element type "xi:include" must be declared

Questions about XML that are not covered by the other forums should go here.
dleal
Posts: 41
Joined: Fri Dec 15, 2006 8:09 pm
Location: Madrid
Contact:

Error: Element type "xi:include" must be declared

Post by dleal »

Dear members,

Following the instruction on the Docbook Complete Reference, I have configurated the master and included document. It works, i.e. I ge the generated files, but on Problem view from Eclipse, I get the following message:

Code: Select all

Element type "xi:include" must be declared.
I have activated the Xinlcude options on Windows->Preference->Oxygen->XML->XML Parser

On master document I have:

Code: Select all

<?xml version="1.0"  encoding="iso-8859-1"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<book lang="es">
...
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduccion.xml"/>
</book>
and on introduccion.xml:

Code: Select all

<?xml version="1.0"  encoding="iso-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<chapter id="introduccion">
...
</chapter>
Do you have any idea about this problem?

Thanks in advance,

David

P.D.: I am using Oxygen 7.0
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

You have to declare the xi:include element in the DTD, for example look at [oXygen-install-folder]/samples/docbook/sampleXInclude.xml:

Code: Select all

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.docbook.org/xml/4.4/docbookx.dtd" [
<!ENTITY % xinclude SYSTEM "../../frameworks/docbook/dtd/xinclude.mod" >
%xinclude;
<!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED" >
]>
Regards,
Sorin
dleal
Posts: 41
Joined: Fri Dec 15, 2006 8:09 pm
Location: Madrid
Contact:

Post by dleal »

Dear Sorin,

thanks again, now I have less error, but I have still problems, my master file now look like this:

Code: Select all

<?xml version="1.0"  encoding="iso-8859-1"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.docbook.org/xml/4.3/docbookx.dtd" [
<!ENTITY % xinclude SYSTEM "/C:/Archivos de programa/Java/ECLIPSE/extPlugins/eclipse/plugins/com.oxygenxml.editor_7.0.0/frameworks/docbook/dtd/xinclude.mod">
%xinclude;
<!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED" >
]>
<book lang="es">
...
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduccion.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensiones.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="idioma.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="documentacion.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="pruebas.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="colofon.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bibliografia.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apendice.xml "/>
</book>
because I includeS also on file extensiones.xml, I repeat the process you have mentioned on your last e-mail, but changing book with chapter:

Code: Select all

<?xml version="1.0"  encoding="iso-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.docbook.org/xml/4.3/docbookx.dtd" [
<!ENTITY % xinclude SYSTEM "/C:/Archivos de programa/Java/ECLIPSE/extPlugins/eclipse/plugins/com.oxygenxml.editor_7.0.0/frameworks/docbook/dtd/xinclude.mod">
%xinclude;
<!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED" >
]>
<chapter id="extensiones">
...
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesAmbler.xml"/> <!--LINE 27-->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesGeotecnica.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesExpertOneOnOne.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesAdicionales.xml"/>
</chapter> <!--LINE 31-->
Now on th Problem view I get the following problems:

Code: Select all


The content of element type "chapter" must match ...	normasCodificacionJava	extensiones.xml	line 31
Unexpected element "xi:include". The content of the parent element type must match "..". normasCodificacionJava extensiones.xml line 27
If I comment the line 27, then I get the same error on line 28.

Please let me know any input,

Thanks,

David
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

dleal wrote:Now on th Problem view I get the following problems:

Code: Select all


The content of element type "chapter" must match ...	normasCodificacionJava	extensiones.xml	line 31
Unexpected element "xi:include". The content of the parent element type must match "..". normasCodificacionJava extensiones.xml line 27
Please post the full error messages. What is normasCodificacionJava? Is it an element name? extensiones.xml is the name of the validated file but I am not sure what is normasCodificacionJava. I think it cannot be a required child element of chapter.


Regards,
Sorin
dleal
Posts: 41
Joined: Fri Dec 15, 2006 8:09 pm
Location: Madrid
Contact:

Post by dleal »

Dear Sorin,

normasCodificacionJava is the directory and extensiones.xml is the file that include under <chapter></chapter> the include statements:

Code: Select all

<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesAmbler.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesGeotecnica.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesExpertOneOnOne.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesAdicionales.xml"/>
My directory structure is:

Code: Select all

normasCodificacionJava
index.xml -> master file
extensiones.xml -> includes particular extensions files, such as:
extensionesAmbler.xml, etc.
extensionesAmbler.xml
extensionesExpertOneOnOne.xml
extensionesGeotecnica.xml
...
The information on the error output is just to localize the error on a given file and directory.

The error stack trace is:

Code: Select all

Severity and Description	Path	Resource	Location	Creation Time	Id
The content of element type "chapter" must match "(beginpage?,chapterinfo?,(title,subtitle?,titleabbrev?),
(toc|lot|index|glossary|bibliography)*,tocchap?,
(((calloutlist|glosslist|itemizedlist|orderedlist|segmentedlist|simplelist|
variablelist|caution|important|note|tip|warning|literallayout|programlisting|
programlistingco|screen|screenco|screenshot|synopsis|cmdsynopsis|
funcsynopsis|classsynopsis|fieldsynopsis|constructorsynopsis|destructorsynopsis|
methodsynopsis|formalpara|para|simpara|address|blockquote|graphic|graphicco|
mediaobject|mediaobjectco|informalequation|informalexample|informalfigure|informaltable|
equation|example|figure|table|msgset|procedure|sidebar|qandaset|task|anchor|bridgehead|
remark|highlights|abstract|authorblurb|epigraph|indexterm|beginpage|xi:include)+,
(sect1*|refentry*|simplesect*|section*))|
(sect1+|refentry+|simplesect+|section+)),(toc|lot|index|glossary|bibliography)*)". normasCodificacionJava extensiones.xml line 31 1172156551312 30940
and

Code: Select all

Severity and Description	Path	Resource	Location	Creation Time	Id
Unexpected element "xi:include". The content of the parent element type must match "(beginpage?,chapterinfo?,(title,subtitle?,titleabbrev?),
(toc|lot|index|glossary|bibliography)*,tocchap?,
(((calloutlist|glosslist|itemizedlist|orderedlist|segmentedlist|simplelist|variablelist|
caution|important|note|tip|warning|literallayout|programlisting|programlistingco|screen|
screenco|screenshot|synopsis|cmdsynopsis|funcsynopsis|classsynopsis|fieldsynopsis|
constructorsynopsis|destructorsynopsis|methodsynopsis|formalpara|para|simpara|
address|blockquote|graphic|graphicco|mediaobject|mediaobjectco|informalequation|
informalexample|informalfigure|informaltable|equation|example|figure|table|msgset|
procedure|sidebar|qandaset|task|anchor|bridgehead|remark|highlights|abstract|
authorblurb|epigraph|indexterm|beginpage|xi:include)+,
(sect1*|refentry*|simplesect*|section*))|(sect1+|refentry+|simplesect+|section+)),
(toc|lot|index|glossary|bibliography)*)". normasCodificacionJava extensiones.xml line 27 1172156875890 30965
Thanks,

David
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

It seems the root element of the included file extensionesAmbler.xml is not allowed as child of the chapter element. Please post the whole content of the extensiones.xml file as it contains only 31 lines and also post the beginning of the extensionesAmbler.xml file. Are the two errors that you posted the only validation errors that you get on the extensiones.xml file?


Regards,
Sorin
dleal
Posts: 41
Joined: Fri Dec 15, 2006 8:09 pm
Location: Madrid
Contact:

Post by dleal »

Sorin,

I am sending to you the extensiones.xml file:

Code: Select all


<?xml version="1.0"  encoding="iso-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.docbook.org/xml/4.3/docbookx.dtd" [
<!ENTITY % xinclude SYSTEM "/J:/ECLIPSE/extPlugins/eclipse/plugins/com.oxygenxml.editor_7.0.0/frameworks/docbook/dtd/xinclude.mod">
%xinclude;
<!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED" >
]>
<chapter id="extensiones">
<title>Extensiones</title>
<para><ulink url="http://java.sun.com/docs/codeconv/">Java Sun Code Convenction</ulink> se
centra, en su mayor parte, en normas acerca del formato del código y realiza poco énfasis
sobre buenas practicas de codificación. En esta sesión se incluyen otras normas o de otros
estándares o bien recomendaciones que se han recogido de libros citados en la <xref
linkend="referencias"/>.</para>
<para/>
<sect1>
<title>Organización</title>
<para>En este punto se asume que el lector se ha leído <ulink
url="http://java.sun.com/docs/codeconv/">Java Sun Code Convenction</ulink> , por lo
que este documento se limitará a añadir elementos que pudieran aportar de otros
estándares no siguiendo por tanto una estructura típica de un documento de
especificación de un estándar, de esta forma <emphasis role="bold">queda
claro</emphasis> que simplemente nos limitamos a hacer extensiones de <ulink
url="http://java.sun.com/docs/codeconv/">Java Sun Code Convenction</ulink> y no
rehacer la rueda.</para>
</sect1>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesAmbler.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesGeotecnica.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesExpertOneOnOne.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesAdicionales.xml"/>
</chapter>
and extensionesAmbler.xml starts like this:

Code: Select all

<?xml version="1.0"  encoding="iso-8859-1"?>
<sect1 id="extensionesAmbler">
<title>Estándar de Java de AmbySoft, Inc</title>
....
Please let me know any suggestion,

Thanks in advance,

David Leal
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi David,

The validation of a document containing XInclude elements against a DTD is performed by oXygen by default using Xerces-J. You can use from the custom validation combo also other engines, like LIBXML for instance.
Now, Xerces-J performs the validation against the DTD with the content as it is, without expanding the xi:include elements, so, in order to have valid content the DTD should accept xi:include inside different element where it is used. This is why the DTD cusomization is needed with the xinclude.mod file that adds xi:include in various content models. However, that customization does not cover all the places you may want xi:include to appear, and in this case it does not cover your example, thus the validation error. Note that the transformation will probably work without problems.
Look at the error message you posted earlier, if you look for xi:include you can see that it appears, but before sect1, and sect1 is in a following group so once you add a sect1 you cannot use xi:include.
There are a couple of possibilities further. One is to modify the DTD customization to allow xi:include where you need it - but I'm not a DocBook expert so I cannot help you with that - the DocBook applications mailing list is a good place to ask I think . Another one is to switch to DocBook 5 which uses Relax NG for validation and in that case oXygen will validate the expanded content against the schema.

Best Regards,
George
George Cristian Bina
dleal
Posts: 41
Joined: Fri Dec 15, 2006 8:09 pm
Location: Madrid
Contact:

Post by dleal »

Thank you George,

So, my situation at section level is not covered. About your second solution, using DocBook 5.0, could you explain to me what to do in order to work under Oxygen Eclipse Plugins? Such version is not provided with Oxygen 7.0.0.

Thanks in advance,

David
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi David,

Checkout the DocBook 5 howto:
http://www.docbook.org/docs/howto/#editors-oxygen
The dialog for default schema association is available in Eclipse under Window->Preferences -- oXygen -- Editor -- Default Schema Association.
Information about the schemas and about how to convert from DocBook 4 is available in the same document.

Best Regards,
George
George Cristian Bina
dleal
Posts: 41
Joined: Fri Dec 15, 2006 8:09 pm
Location: Madrid
Contact:

Post by dleal »

Dear George,

I have followed your recomendation, and now my document is in Docbook 5.0, and it works. I am sendint to you the resulting main files. I have found that in order to avoid Oxygen errors I have to use <section> instead of <sec1> on file extensiones.xml. I use now on all documents the <section> (because the use of xi:include for sections).

Now the only problem I have is that I get on Oxygen IDREF errors between files. I use for example:
<xref linkend="referencias"/> for refering the section: "Referencias" on file: bibliografia.xml:

Code: Select all

<?xml version="1.0"  encoding="iso-8859-1"?>
<bibliography xml:id="referencias" xmlns="http://docbook.org/ns/docbook"
xmlns:xl="http://www.w3.org/1999/xlink" version="5.0">
<title>Referencias</title>
...
</bibliography>
it occurs for bibliography but also for chapters. The references are properly linked on the generated HTML document, it is an Oxygen problem only.

index.xml:

Code: Select all

  <?xml version="1.0"  encoding="iso-8859-1"?>
<book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en"
xmlns:xl="http://www.w3.org/1999/xlink">
<info>
<title>Estándar de Codificación de <inlinemediaobject>
<imageobject>
<imagedata fileref="images/logoJava.gif"/>
</imageobject>
<textobject>
<phrase>Java</phrase>
</textobject>
</inlinemediaobject>
</title>
<subtitle>Normas y recomendaciones para desarrollar aplicaciones mantenibles</subtitle>
<releaseinfo>Versión 1.0</releaseinfo>
<pubdate>Febrero 2007</pubdate>
<authorgroup>
<author>
<personname>David Leal</personname>
<affiliation>
<orgname>Comercio Electronico B2B 2000</orgname>
</affiliation>
<email>d.leal@ceb2b2000.com</email>
</author>
</authorgroup>
<collab>
<personname>Juan Sánchez</personname>
<affiliation>
<orgname>Comercio Electronico B2B 2000</orgname>
<address>j.sanchez@ceb2b2000.com</address>
</affiliation>
</collab>
<copyright>
<year>2007</year>
<holder>
<link xmlns:ns1="http://www.w3.org/1999/xlink" ns1:href="http://www.uniovi.es"
>Universidad de Oviedo</link>
</holder>
</copyright>
<legalnotice>
<para> El contenido de este documento es propiedad de la Universidad de Oviedo. Su uso
no puede ser distribuido, copiado, modificado sin la autorización de la Universidad
de Oviedo.</para>
</legalnotice>
<revhistory>
<revision>
<revnumber>1.0</revnumber>
<date>Enero 2007</date>
<authorinitials>DLV</authorinitials>
<revremark>Creación del documento</revremark>
</revision>
</revhistory>
</info>
<toc/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduccion.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensiones.xml"/> <!--line 63-->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="idioma.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="documentacion.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="pruebas.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="colofon.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bibliografia.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apendice.xml "/>
</book>
and the extensiones.xml file:

Code: Select all

<?xml version="1.0"  encoding="iso-8859-1"?>
<chapter xmlns="http://docbook.org/ns/docbook" xml:id="extensiones"
xmlns:xl="http://www.w3.org/1999/xlink" version="5.0">
<title>Extensiones</title>
<para><link xl:href="http://java.sun.com/docs/codeconv/">Java Sun Code Convenction</link> se
centra, en su mayor parte, en normas acerca del formato del código y realiza poco énfasis
sobre buenas practicas de codificación. En esta sesión se incluyen otras normas o de otros
estándares o bien recomendaciones que se han recogido de libros citados en la <xref
linkend="referencias"/>.</para>
<section>
<title>Organización</title>
<para>En este punto se asume que el lector se ha leído <link
xl:href="http://java.sun.com/docs/codeconv/">Java Sun Code Convenction</link> , por lo
que este documento se limitará a añadir elementos que pudieran aportar de otros
estándares no siguiendo por tanto una estructura típica de un documento de
especificación de un estándar, de esta forma <emphasis role="bold">queda
claro</emphasis> que simplemente nos limitamos a hacer extensiones de <link
xl:href="http://java.sun.com/docs/codeconv/">Java Sun Code Convenction</link> y no
rehacer la rueda.</para>
</section>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesAmbler.xml"/> <!--line 21-->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesGeotecnica.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesExpertOneOnOne.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensionesAdicionales.xml"/>
</chapter>
and the inlcude section files have the following structure:

Code: Select all


<?xml version="1.0"  encoding="iso-8859-1"?>
<section xmlns="http://docbook.org/ns/docbook" xml:id="extensionesAmbler"
xmlns:xl="http://www.w3.org/1999/xlink" version="5.0">
...
</section>
On problem eclipse view I get the following problems:

Code: Select all


Severity and Description	Path	Resource	Location	Creation Time	Id
IDREF "messageFormatExamples" without matching ID normasCodificacionJava extensionesExpertOneOnOne.xml line 270 1173284692359 15998
Making portrait pages on A4 paper (210mmx297mm) normasCodificacionJava mydocbook.xsl Unknown 1173285408375 16190
IDREF "metodoDeUnaPantalla" without matching ID normasCodificacionJava extensionesExpertOneOnOne.xml line 124 1173284692359 15999
IDREF "referencias" without matching ID normasCodificacionJava documentacion.xml line 7 1173281060859 6470
IDREF "referencias" without matching ID normasCodificacionJava documentacion.xml line 15 1173281060859 6471
IDREF "referencias" without matching ID normasCodificacionJava extensiones.xml line 9 1173289386578 16293
Additional comments about upgrade into Docbook 5.0:
  • I need to use <para></para> or <simpara></simpara> when using:
    <listitem></listitem> and <footnote></footnote>, but when using 4.x that was not necesary.
  • In order to use Docbook 5.0 with Oxygen 7.0.0, I just copy the doocbook framework from Oxygen 8.x in to the same location.
Thanks in advance for any suggestion,

David
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,
dleal wrote:Now the only problem I have is that I get on Oxygen IDREF errors between files.

...

Code: Select all

<book>
...
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extensiones.xml"/> <!--line 63-->
...
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="documentacion.xml"/>
...
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bibliografia.xml"/>
...
</book>

Code: Select all

IDREF "referencias" without matching ID   normasCodificacionJava   documentacion.xml   line 7   1173281060859   6470
IDREF "referencias" without matching ID normasCodificacionJava documentacion.xml line 15 1173281060859 6471
IDREF "referencias" without matching ID normasCodificacionJava extensiones.xml line 9 1173289386578 16293

When you validate an included file, for example a file chapter1.xml containing a Docbook chapter, only the ID values defined in that file and files included in it are available. The ID values defined in the master file, for example master.xml or in other files that are not included in that file, for example chapter2.xml are not available because when you validate chapter1.xml there is no connection between chapter1.xml and chapter2.xml defined in chapter1.xml. In the next version of oXygen you will have the option to set master.xml as a master document for the current file that is validated, that is chapter1.xml so the validation operation for chapter1.xml will not report errors for ID values defined in chapter2.xml.


Regards,
Sorin
Post Reply