Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support xi:include #175

Closed
ebramirez opened this issue Jul 25, 2019 · 6 comments · Fixed by eclipse/lemminx#1387 or #829
Closed

Support xi:include #175

ebramirez opened this issue Jul 25, 2019 · 6 comments · Fixed by eclipse/lemminx#1387 or #829
Assignees
Milestone

Comments

@ebramirez
Copy link

First, it looks like inline namespaces definition does not work.

In a docbook documento, the tag <xi:include xmlns:xi="http://www.w3.org/2001/XInclude">, the xi:include element is defined in the XInclude.xsd but is not recogniced:

Screenshot from 2019-07-25 11-58-46

Optionally, it would be great that the plugin took into account the include directive and parsed and the included document.

@fbricon
Copy link
Collaborator

fbricon commented Jul 25, 2019

Can you please attach a sample document reproducing this issue?

@ebramirez
Copy link
Author

Here are the two files, and also as an attachment:

include.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="chapter_id">
  <title>Sample title</title>

  <para>Sample content</para>

  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="reference.xml"/>
</chapter>

reference.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<section id="section_id">
  <title>Sample title</title>

  <para>Sample content</para>
</section>

For the second part of my request, I have realized that it only makes sense when building the docbook, because the local references which do not have to make sense before the building; so this is only about the <xi:include> tag not being recognized as valid.

@Oobiewan
Copy link

Oobiewan commented Feb 9, 2022

Hi,
I am also missing support for xi:include. Especially to parse the xml that is included with xi:include and resolve references to it. E.g., the following should not give a validation error if devd_building_artifacts_windows.xml contains an element with id="sectionWindowsArtifactBuild".

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.docbook.org/xml/4.4/docbookx.dtd" [
    <!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
    %xinclude; ]>

<section id="chapterInstallingSystem">
    <title>Installing system</title>
    <xi:include href="devd_building_artifacts_windows.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
    <section><title>Section title</title>
    <para>Build the artifacts as described in <xref linkend="sectionWindowsArtifactBuild" /> </para>
</section>

@Oobiewan
Copy link

Oobiewan commented Feb 15, 2022

@angelozerr I think this issue describes the xi:include functionality that I have mentioned in the issue related to parameter entities. I think even the second part of @ebramirez 's comment would be important: if the xml inserted with xi:includes exists and can be found at the time of validation, the plugin should be able to parse and validate the complete information set against a DTD.
Is there a chance that this functionality will be implemented?

@angelozerr
Copy link
Contributor

Is there a chance that this functionality will be implemented?

I don't know if it's easy to support xi:include.

@angelozerr
Copy link
Contributor

@ebramirez if you define xinclude.mod like this:

<!ELEMENT xi:include (xi:fallback?) >
<!ATTLIST xi:include
    xmlns:xi   CDATA       #FIXED    "http://www.w3.org/2001/XInclude"
    href       CDATA       #REQUIRED
    parse      (xml|text)  "xml"
    encoding   CDATA       #IMPLIED >

<!ELEMENT xi:fallback ANY>
<!ATTLIST xi:fallback
    xmlns:xi   CDATA   #FIXED   "http://www.w3.org/2001/XInclude" >

<!ENTITY % local.chapter.class "| xi:include">

<!-- inside chapter or section elements -->
<!ENTITY % local.divcomponent.mix "| xi:include">
<!-- inside para, programlisting, literallayout, etc. -->
<!ENTITY % local.para.char.mix "| xi:include">
<!-- inside bookinfo, chapterinfo, etc. -->
<!ENTITY % local.info.class "| xi:include">

And you reference this file like this:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"  [
<!ENTITY % xinclude SYSTEM "xinclude.mod">
%xinclude;
]>
<chapter id="chapter_id">
	<title>Sample title</title>

	<para>Sample content</para>

	<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="referencem.xml" />
</chapter>

it should work better, no.

It seems Oxygen suggest to do like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants