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: [docbook-apps] Alternative to entities?



Bringing up a thread from last week...


I've introduced the XInclude mechanism as a way of replacing entities among my collueages. I have collected a number of phrases in a file constant_strings.xml and references them with

<xi:include
       href="../common_chapters/constant_strings.xml"
	xpointer="def_product_name"
       xmlns:xi="http://www.w3.org/2001/XInclude";
/>

Now the documents do not validate anymore;
../common_chapters/constant_strings.xml:29: element phrase: validity error : ID def_product_name already defined


The text above is from xmllint which we run as a step in the daily builds of .pdf. The message will break the build. A similar message is written in XMLMind which has a validation tab in the GUI.
According to the XMLMind tutorial already mentioned in this thread the warning:
"You can safely ignore this warning. It is reported when a reference to an external element has been pasted several times in the same modular document."


The daily build problem can possibly be avoided by some wrapper between the gnumake and xmllint, filtering the message (although I am NOT found of such solution) but the interactive part of the problem still remains; having 200 messages that always should be ignored will inevitablely make people stop looking at the warning messages, and real problems will pass through.

Anybody having any ideas on this? At the moment I think we'll have to back on the XInclude way of solving my root problem and use the sed solution outside of the DocBook knowledge, but thtere might be something else to do?

/Gurra





From: "Peter Ring" <PRI@magnus.dk>
To: "Jirka Kosek" <jirka@kosek.cz>,<davep@dpawson.co.uk>
CC: "Gurra Green" <gurra_green@hotmail.com>,"Docbook-Apps" <docbook-apps@lists.oasis-open.org>
Subject: RE: [docbook-apps] Alternative to entities?
Date: Tue, 18 Jan 2005 14:32:51 +0100


Give it a try. In my experience, XInclude is well integrated in XXE.

First, on the Options | Edit tab, you'd have selected Type of document reference: 'XInclude' or 'Entity when possible, XInclude otherwise'.

Then you could go along like this:
1) open both entities.xml and the document that you are authoring
2) select the element in entities.xml that you want to reference
3) select Edit | Document Reference | Copy as Reference or type Ctrl+Shift+C
4a) to insert an inline element, set the insertion point in your document and type Ctrl+V
4b) to insert a block element, set the insertion point in your document and type Ctrl+U (paste before) or Ctrl+W (paste after).


There's a tutorial [1].

The reference could look like this

<xi:include href="entties.xml" xmlns:xi="http://www.w3.org/2001/XInclude";
xpointer="productname" />


or

<xi:include href="entties.xml" xmlns:xi="http://www.w3.org/2001/XInclude";
xpointer="element(productname)" />


or

<xi:include href="entties.xml" xmlns:xi="http://www.w3.org/2001/XInclude";
xpointer="xpointer(id('productname'))" />


or

<xi:include href="entties.xml" xmlns:xi="http://www.w3.org/2001/XInclude";
xpointer="element(/1/2/3)" />


AFAIK, there's a couple of limitations. Not all off the XPointer scheme is supported; the XPointer expression must yield a result infoset with one node; and one particular feature that I miss

<xi:include href="some-source-code-or-xml-file" xmlns:xi="http://www.w3.org/2001/XInclude";
parse="text">


XXE will quote the included file as it is supposed to, but the reference will be gone, replaced by the quoted content of the included file.

[1] http://www.xmlmind.com/xmleditor/tutorial.html#id.s2

kind regards
Peter Ring

> -----Original Message-----
> From: Jirka Kosek [mailto:jirka@kosek.cz]
> Sent: 17. januar 2005 19:52
> To: davep@dpawson.co.uk
> Cc: Gurra Green; Docbook-Apps
> Subject: Re: [docbook-apps] Alternative to entities?
>
>
> Dave Pawson wrote:
>
> > Not speaking from experience.
> >
> > If an xinclude aware processor is used,
> > could that stand in for XML entities Jirka?
>
> Yep, you can use something like
>
> <xi:include href="entities.xml#productname"/>
>
> to pull element from external file entities.xml:
>
> <root>
>    <phrase xml:id="productname">SuperSoft v3.5</phrase>
>    ...
> </root>
>
> But as you can see XInclude is quite verbose in this case and I'm not
> sure whether XXE can deal with such XIncludes.
>
> --
> ------------------------------------------------------------------
>    Jirka Kosek     e-mail: jirka@kosek.cz     http://www.kosek.cz
> ------------------------------------------------------------------
>    Profesionální ¹kolení a poradenství v oblasti technologií XML.
>       Podívejte se na ná¹ novì spu¹tìný web http://DocBook.cz
>         Podrobný pøehled ¹kolení http://xmlguru.cz/skoleni/
> ------------------------------------------------------------------
>
>

_________________________________________________________________
Want to block unwanted pop-ups? Download the free MSN Toolbar now! http://toolbar.msn.co.uk/



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