Skip to content

Getting errors trying the examples #3

Description

@rickhg12hs

I wanted to see an example of xpointer and Google brought me here.

I get some errors running xmllint --xinclude article.xml. Is there anything else I need to do to run without errors?

Here's what happens:

$ xmllint --version
xmllint: using libxml version 20910
   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Schemas Schematron Modules Debug Zlib Lzma 
$ xmllint --xinclude article.xml
XPath error : Invalid expression
article.xml:21: element include: XInclude error : XPointer evaluation failed: #xpointer(element(/1)/*)
article.xml:21: element include: XInclude error : could not load author.xml, and no fallback was found
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.1/rng/docbookxi.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.1/sch/docbook.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.1" xml:lang="en">
 <title>Article with XIncludes and XPointer</title>
 <info>
  <authorgroup>
   <?xml-model href="http://docbook.org/xml/5.1/rng/docbookxi.rng" schematypens="http://relaxng.org/ns/structure/1.0"?><?xml-model href="http://docbook.org/xml/5.1/sch/docbook.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?><author xmlns="http://docbook.org/ns/docbook" version="5.1" xml:id="author">
   <personname>
    <firstname>Tux</firstname>
    <surname>Penguin</surname>
   </personname>
</author>
   <editor xml:id="editor">
    <personname>
     <firstname>Wilber</firstname>
     <surname>Gimp</surname>
    </personname>
   </editor>
  </authorgroup>
 </info>
 <para>
  (1) Hello, this is the author: <xi:include href="author.xml" xpointer="xpointer(element(/1)/*)"/>
 </para>
 <para>
  (2) This is the author: <personname xmlns="http://docbook.org/ns/docbook">
    <firstname>Tux</firstname>
    <surname>Penguin</surname>
   </personname>
 </para>
 <para>
  (3) This is the editor: <personname xmlns="http://docbook.org/ns/docbook">
     <firstname>Wilber</firstname>
     <surname>Gimp</surname>
    </personname>
 </para>

 <!-- (4) -->
 <note>
   <title xmlns="http://docbook.org/ns/docbook">Ignored Files in <filename>/etc/sudoers.d</filename></title><para xmlns="http://docbook.org/ns/docbook"> The <literal>#includedir</literal> command in
    <filename>/etc/sudoers</filename>, used for
    <filename>/etc/sudoers.d</filename>, ignores files that end in
    <literal>~</literal> (tilde) or contain a <literal>.</literal> (dot).
  </para>
 </note>

 <!-- (5) -->
 <sect1 xml:id="sec.intro-with-other-id">
   <title xmlns="http://docbook.org/ns/docbook">Introduction</title><para xmlns="http://docbook.org/ns/docbook">The quick brown fox jumps over the lazy dog.</para>
    <!-- (6) reuse the note again, but set your own ID: -->
    <note xml:id="note.sudoers.again">
     <title xmlns="http://docbook.org/ns/docbook">Ignored Files in <filename>/etc/sudoers.d</filename></title><para xmlns="http://docbook.org/ns/docbook"> The <literal>#includedir</literal> command in
    <filename>/etc/sudoers</filename>, used for
    <filename>/etc/sudoers.d</filename>, ignores files that end in
    <literal>~</literal> (tilde) or contain a <literal>.</literal> (dot).
  </para>
    </note>
 </sect1>

 <!-- (7) -->
 <sect1 xml:id="sec.intro-with-other-title">
   <title>Hello World</title>
   <!-- For the real XML nerd. It works, but better avoid it.
       With this notation, you can add a different title.
   -->
   <para xmlns="http://docbook.org/ns/docbook">The quick brown fox jumps over the lazy dog.</para>
 </sect1>

 <!-- (8) -->
 <sect1 xml:id="sec.intro-with-element-scheme">
   <title>Hello World with element()</title>
   <!-- Same as sec.intro-with-other-title, but a bit simpler.
   -->
   <para xmlns="http://docbook.org/ns/docbook">The quick brown fox jumps over the lazy dog.</para>
 </sect1>

</article>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions