Validation error when including file

Questions about XML that are not covered by the other forums should go here.
sarcanon
Posts: 39
Joined: Mon Aug 24, 2009 11:42 pm

Validation error when including file

Post by sarcanon »

I am attempting to include an external (local) XML file in my main document, but this is causing a rather perplexing validation error:

Code: Select all

System ID: C:\Users\scott\Documents\project\include\include-taxonomies.xml
Main validation file: C:\Users\scott\Documents\project\inscriptions\rib01322.xml
Schema: C:\Program Files\Oxygen XML Editor 14\frameworks\tei\xml\tei\custom\schema\relaxng\tei_all.rng
Engine name: Jing
Severity: error
Description: element "classDecl" not allowed here; expected element "ab", "appInfo", "charDecl", "classDecl", "editorialDecl", "fsdDecl", "geoDecl", "listPrefixDef", "metDecl", "p", "projectDesc", "refsDecl", "samplingDecl", "schemaSpec", "styleDefDecl", "tagsDecl" or "variantEncoding"
Start location: 3:2
End location: 3:11
My include directive looks like this:

Code: Select all

<xi:include href="../include/include-taxonomies.xml"/>
The file I am attempting to include is essentially this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<classDecl>
<taxonomy xml:id="RIB-genre">
<category xml:id="slab">
<catDesc>Slab</catDesc>
</category>
...
</taxonomy>
</classDecl>
The error indicates the <classDecl> is not legal at this point, in the file, but if I paste the entire <classDecl> element from the include file directly in the main document at the location where the <xinclude> directive is, the file validates just fine.

This makes absolutely no sense. Can someone kindly point out where I am in error?

Many thanks in advance.
ionela
Posts: 400
Joined: Mon Dec 05, 2011 6:08 pm

Re: Validation error when including file

Post by ionela »

Hello,

In order to reproduce this issue on our side, could you please specify the context where you are using the xi:include element?
If possible, could you please send us a sample file of the TEI document? You can send it to our support email address: support AT oxygenxml DOT com

Regards,
Ionela
Ionela Istodor
oXygen XML Editor and Author Support
sarcanon
Posts: 39
Joined: Mon Aug 24, 2009 11:42 pm

Re: Validation error when including file

Post by sarcanon »

Per your invitation, I have done as you requested.

Thank you.
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: Validation error when including file

Post by adrian »

Hi,

Thank you for the sample file.
The problem is that the included file does not have the root element in the required namespace.
The Jing validator mentions only the local name in the error, but it omits the difference in namespace.

It seems xml:lang is also required, so the included file has to be modified like this:

Code: Select all

<classDecl xmlns="http://www.tei-c.org/ns/1.0" xml:lang="en">
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
sarcanon
Posts: 39
Joined: Mon Aug 24, 2009 11:42 pm

Re: Validation error when including file

Post by sarcanon »

Excellent. I knew I was doing something wrong. I just didn't know what, and the error message was not particularly helpful. Thank you!
Post Reply