Validation error when including file

Questions about XML that are not covered by the other forums should go here.
sarcanon
Posts: 25

Validation error when including file

Wed Apr 17, 2013 6:41 pm

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: 196

Re: Validation error when including file

Wed Apr 17, 2013 10:10 pm

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: 25

Re: Validation error when including file

Thu Apr 18, 2013 2:22 am

Per your invitation, I have done as you requested.

Thank you.
adrian
Posts: 2443

Re: Validation error when including file

Thu Apr 18, 2013 5:15 pm

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: 25

Re: Validation error when including file

Thu Apr 18, 2013 9:31 pm

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

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 2 guests