473,387 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

xi:include and global entity

Hi,

I know doing something like this

<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY test PUBLIC "BLA" "http://localhost/dummy/test">]>

<section><title/>
<programlisting><xi:include href="&test;" parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude"/></programlisting>
</section>

Will not work but maybe someone knows a workaround.
Basically I want to insert my programlisting from a global entity.
It works if I put the CDATA in front and at the end
in the text file but I don't like that since it alters the file.

Does anyone have a bright idea how to solve this issue?

Thanks Thomas
Jul 20 '05 #1
6 2029
In article <pa****************************@gmx.de>,
Thomas Sommer <ma****@gmx.de> wrote:
Basically I want to insert my programlisting from a global entity.


Why do you need to put the contents of the file in an entity? Why
not just do

<xi:include href="http://localhost/dummy/test" parse="text"/>

?

An ugly trick is to do something like this:

<!ENTITY % test PUBLIC "BLA" "http://localhost/dummy/test">
<!-- NB test is a parameter entity! -->
<!ENTITY source "<![CDATA[%test;]]>">

This won't work if your source contains ]]> of course.

-- Richard
Jul 20 '05 #2
>
Why do you need to put the contents of the file in an entity? Why
not just do

<xi:include href="http://localhost/dummy/test" parse="text"/>
I know this works and would do the job if the catalog would remap this to
"file:///home/dummy/docbook/some more dirs/test"
I am about to set up my directory structure right now but I don't know if it
might change later on. Using some global entities will save me from editing
every single file (I hope). But maybe there is some better solution or this
is totally unnecessary.
An ugly trick is to do something like this:

<!ENTITY % test PUBLIC "BLA" "http://localhost/dummy/test">
<!-- NB test is a parameter entity! -->
<!ENTITY source "<![CDATA[%test;]]>">

I get:
PEReferences forbidden in internal subset
<!ENTITY source "<![CDATA[%test;]]>">

While in the file I only have:
Some Text

Jul 20 '05 #3
In article <pa****************************@gmx.de>,
Thomas Sommer <ma****@gmx.de> wrote:
<!ENTITY % test PUBLIC "BLA" "http://localhost/dummy/test">
<!-- NB test is a parameter entity! -->
<!ENTITY source "<![CDATA[%test;]]>">
PEReferences forbidden in internal subset


Yes you have to put it in an external DTD. You can't use parameter entities
like that in the internal subset.

-- Richard
Jul 20 '05 #4
> Yes you have to put it in an external DTD. You can't use parameter entities
like that in the internal subset.


Ok, now the error is gone but I don't get the stuff from the file.
It is loaded though. If I do
<!ENTITY % test PUBLIC "BLA" "http://localhost/dummy/test">
%test;

I get complains about wrong syntax (of course).
Ok I can use the source entity but there will be no text put into
the xml-file even without the CDATA.

Any further ideas

Thanks Thomas
Jul 20 '05 #5
In article <pa****************************@gmx.de>,
Thomas Sommer <ma****@gmx.de> wrote:
Ok, now the error is gone but I don't get the stuff from the file.


This works for me. It includes the contents of test.c:

foo.xml:

<!DOCTYPE foo SYSTEM "foo.dtd">
<foo>
&source;
</foo>

foo.dtd:

<!ENTITY % test PUBLIC "BLA" "test.c">
<!ENTITY source "<![CDATA[%test;]]>">

But an XInclude solution is better, because ampersands in test.c still
cause problems (I should have realised this before).

-- Richard
Jul 20 '05 #6
It validates but I still don't get any output. Here the debug info:

xmllint --debugent --valid foo.xml
new input from file: foo.xml
new input from file: foo.dtd
Pushing input 1 :
String decoding PE Reference: %test;]]>
<?xml version="1.0"?>
<!DOCTYPE foo SYSTEM "foo.dtd">
<foo>
&source;
</foo>
DOCUMENT
No entities in internal subset
Entities in external subset
source : INTERNAL GENERAL,
orig "<![CDATA[%test;]]>"
content "<![CDATA[]]>"
As you see the content is empty but maybe I am just too stupid to use
xmllint.

Thomas
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

88
by: Tim Tyler | last post by:
PHP puts most of its functions into a big flat global namespace. That leads to short function names - but creates a namespace minefield for programmers. Lots of the functions are legacies from...
0
by: BODIN | last post by:
I have an XML document, which is actually physically stored in 2 separated files. doc1.xml and doc2.xml I NEED a WAY FOR THIS SIMPLE NEED : XML file splitted into two physical files, and use...
0
by: Gerald Aichholzer | last post by:
Hi NG, I'm trying to process the following document using cocoon's XInclude-transformer: <demos> <demo> <dir>demo20040429</dir> <date>11.05.04 10:01</date> <xi:include parse="xml"
3
by: Jim Higson | last post by:
Does anyone know a technique in javascript to transform from (for example) &hearts; to the char '♥'? I'm doing this because I have to interpret some data I got over XHTMLHTTP that isn't XML,...
7
by: Wojtek | last post by:
Hello, how can I transparently insert one XML file into another? I am looking for a method simmilar to the #include <file> known from the C language. To be more precise, an example: I have...
1
by: Kbalz | last post by:
Having a really hard time finding solid examples on deploying a CR .NET applcation on my intranet. I'll explain what I've done so far, and toward the bottom is where I can't print using the report...
0
by: daldridge | last post by:
I don't know if what I want to do is possible or not, but I'd like to have an xs:key in my schema that constrains attributes directly in a document, as well as those in another document, included...
3
by: John Nagle | last post by:
I have XML replies in a DOM which contain entity escapes, like "&amp;". What's the proper way to replace them with the ordinary characters? Preferably something that will work in most browsers? I...
2
by: Thefire | last post by:
Hello All i am using Bisness object Crystal Report XI version and installed it on my server. I have checked to installed as server. I am using the following code to connect and display the Report...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.