Skip to content

Interaction between XInclude and <?xml-model> PI #1021

@koh6uawi

Description

@koh6uawi

I am using the VSCode XML extension for a project using XInclude and a RelaxNG schema.

I faced the same problem as in the 2nd question of #845, so I ended up using the following structure:

common.rnc

namespace xml = "http://www.w3.org/XML/1998/namespace"

base = attribute xml:base { text }

chapter = element chapter {
  element title { text }
  & base?
}

document = element document {
  chapter+
}

document.rnc

include "common.rnc"

start = document

chapter.rnc

include "common.rnc"

start = chapter

document.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="document.rnc"?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="chapter1.xml"/>
  <xi:include href="chapter2.xml"/>
</document>

chapter{1,2}.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="chapter.rnc"?>
<chapter>
  <title>Chapter</title>
</chapter>

It works well when I only include one chapter XML file, but when I try to include both, the extension raises the following error:

document.xml: 1 of 1 problem
There is '1' error in 'chapter2.xml'.xml
chapter2.xml(3, 2): element "chapter" not allowed here

It also starts working again as soon as I remove the <?xml-model> processing instruction from one of the files.

Is it the expected behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions