bernard.deschamp at sonovision-itep.fr wrote:
> Thanks for your quick answer for attribute in uppercase in CSS.
>
> I have another question, related to Xinclude.
>
> 1) I have tried your example (Xhtml: Copyright.html) : it runs very weel.
>
> 2) what I need is to do the same but with a schema. And I have not been able
> to
> do that.
>
> For the test, I use a very simple schema ( ):
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema . . . . . .>
> <xs:element name="ROOT" >
> <xs:complexType mixed="true">
> <xs:sequence>
> <xs:element name="para" type="xs:string" maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> And I have prepared a small file to test the inclusion:
> <?xml version="1.0" encoding="UTF-8"?>
> <para>Texte coming from included file.</para>
>
> If I tried the "Insert Reference after" command (Edition/R?f?rence de
> document/ins?rer r?f?rence apr?s), assumed that a "para" is the current
> element,
> I always get the error message : command on reference is not allowed in this
> context
> (exact message:"la commande portant sur la r?f?rence de document n'est pas
> autoris?e dans ce contexte").
>
> And if I prepare manually (with emacs or notepad) the main file, such as :
> <?xml version="1.0" encoding="UTF-8"?>
> <ROOT . . .
> xmlns:xi="http://www.w3.org/2001/XInclude"
> ><para>First para (proper)</para><xi:include href="include.xml"/></ROOT>
>
> then it seems to be OK when I open it (XXE open a windows, to inform me than I
> am opening a file with included data) ; the opened document (tree) is exactly
> the same that when I create a "normal" file (included para is shown, and I
> can't
> update it, but the command "Edit referenced doc." is OK). The tree looks like:
> ROOT
> para
> first para (proper)
> para
> text coming from included file
>
> But the document is declared as not valid (error points to the ROOT element,
> saying that sub-sequence is not allowed, because of para):
> [1]la s?quence des ?l?ments fils est incorrecte [cvc-complex-type.2.4]
> [2]l'?l?ment ne peut contenir d'?l?ment "para" [cvc-complex-type]
>
> What is wrong? Is XInclude feature reserved for Xhtml ?
No. XInclude can be used for any XML document with or without a DTD or a
XML Schema.
You forgot to the specify the namespace in the file to be included.
Therefore trying to insert a {}para was rejected by XXE because inside a
{http://www.xmlmind.com/xmleditor/schema/sch2}ROOT element, only
{http://www.xmlmind.com/xmleditor/schema/sch2}para elements are accepted.
Just change:
---
<?xml version="1.0" encoding="UTF-8"?>
<para>Texte coming from included file.</para>
---
to:
---
<?xml version="1.0" encoding="UTF-8"?>
<para xmlns="http://www.xmlmind.com/xmleditor/schema/sch2">Texte
coming from included file.</para>
---
and it will work fine.