This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: file path peculiarity with xinclude


On Thu, Jan 16, 2003 at 04:41:28PM +0000, Lisa Carey wrote:
> Hi,
> 
> Investigation has continued! I tried validating the document with xmllint
> and got the same problems (looking for the file a level above its actual
> location), so the issue isn't with Elliotte's XIncluder app.
> 
> What does seem to be causing trouble is where the entities are declared.
> 
> Currently, for some of the documents, the external entities used are
> declared in a separate .ent file (they're used in a few documents in the
> same directory, so the relative paths to the external files are the same for
> all the documents), really just to save declaring an identical set of
> entities in each doc.  The .ent file is then used as a parameter entity in
> each of the documents.
> 
> So, for instance, the .ent file has
> 
> <!ENTITY foo SYSTEM "../../common/foo.xml">
> <!ENTITY bar SYSTEM "../../common/bar.xml">
> <!ENTITY tip SYSTEM "../../common/fooBarTip.xml">
> 
> The .ent file is saved in the common directory as well.
> 
> Then in the various documents that use it, the ent file is referenced thusly
> 
> <!ENTITY % myents SYSTEM "../../common/foobarents.ent">
> %myents;
> 
> This works fine for just generating HTML or PDF output from the individual
> documents. If I try to combine them in a master document with xincludes,
> though, the xinclude app finds the .ent file but then can't find any of the
> files it references.  The error I get back from xmllint, for instance, is
> 
> warning: failed to load external entity "../../../common/foo.xml"
> 
> even though the file is at
> 
> "../../common/foo.xml"
> 
> relative to both the subdocuments and the document with the xincludes.
> 
> 
> I've discovered if I declare the entities in the documents themselves,
> everything works fine, so I suppose I can do that.  It's just odd.  Any
> explanations from the more XML-savvy gratefully received!  Hope this makes
> sense.

You didn't show your xinclude element,
But I think the problem is that you are trying to use a
reference to a system entity in your xinclude href
attribute value.  If it looks like this:

  href="&foo;"

it won't work.  An xinclude href needs a URI, not a system
entity reference.  A SYSTEM entity reference tries to load
the contents of the referenced file.  Think of it as trying
to load the contents of foo.xml into the attribute value.

If you define ordinary text entities instead, it will
work:

<!ENTITY foo "../../common/foo.xml">
<!ENTITY bar "../../common/bar.xml">
<!ENTITY tip "../../common/fooBarTip.xml">

If you still need system entities, you'll have to define
two sets of entity names and use different ones in 
different contexts.
-- 

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
The SCO Group                               fax:   (831) 429-1887
                                            email: bobs@sco.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]