473,598 Members | 3,244 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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><tit le/>
<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 2043
In article <pa************ *************** *@gmx.de>,
Thomas Sommer <ma****@gmx.d e> 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.d e> 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.d e> 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
5105
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 the days before PHP got object-oriented features. For instance we currently have:
0
1770
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 of XML Schema.
0
1243
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
2255
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, but might contain some XML char entities. Thanks, Jim
7
4868
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 one file: MainDocument.xml <Document>
1
8626
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 viewer's gui button. I have a Windows XP sp2 Client machine used for development, it has Visual Studio 2005 sp1 and CR XI R2 Developer Version. My webserver is running Windows Server 2003 sp1, IIS 6.0, has CR XI R2 developer. I have a working...
0
1434
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 in the first. Here's an example of what I'm trying to say: FooList.xsd: ================ <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xi="http://www.w3.org/2001/XInclude"
3
8177
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 know about ".innerText", but that's not portable; some browsers convert escapes when reading from innerText and some don't. John Nagle
2
9160
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 file i have created with store procedure in Sql Server 2005. The code is as below:::: _______________________________________________________ 1. SimplePreviewReport.asp <%@ LANGUAGE="VBSCRIPT" %>
0
7992
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8400
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8051
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6725
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5850
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5438
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3898
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3940
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1505
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.