Include Files in XML?

Michael (47)

Usenet Archive
Joined
Aug 19, 2004
Messages
5
Reaction score
0
I've searched and searched and can't seem to find an answer.

With .shtml you would put <!--#include virtual="/top.shtml">

With .php you would put <?php require 'top.php'?>

But what would I use for XML pages? Is there a similar command and if so what is it?
 

Evan Webb

Usenet Archive
Joined
Jan 13, 2004
Messages
10
Reaction score
0
http://www.w3.org/TR/xinclude/

I believe is what you're looking for. Of course, whatever parser you're working with might not support this... Good luck

-Evan

Michael said:
I've searched and searched and can't seem to find an answer.

With .shtml you would put <!--#include virtual="/top.shtml">

With .php you would put <?php require 'top.php'?>

But what would I use for XML pages? Is there a similar command and if so
what is it?
 

Finnbarr P. Murphy

Usenet Archive
Joined
Nov 28, 2003
Messages
10
Reaction score
0
I've searched and searched and can't seem to find an answer.

With .shtml you would put <!--#include virtual="/top.shtml">

With .php you would put <?php require 'top.php'?>

But what would I use for XML pages? Is there a similar command and if so what is it?

One way is to use general entities. See the following article for an example:

www-106.ibm.com/developerworks/xml/library/x-tipgentity.html

- Finnbarr
 

Michael (47)

Usenet Archive
Joined
Aug 19, 2004
Messages
5
Reaction score
0
www-106.ibm.com/developerworks/xml/library/x-tipgentity.html

I tried what it said in there and put the following into a .xml file

<?xml version="1.0"?>
<!DOCTYPE letter [
<!ENTITY feed SYSTEM "/rss.xml">
]>

&feed;

This is the result I get.

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.

Invalid at the top level of the document. Error processing resource 'http://www.mydomain.com/rss.xml'. Line 6, Position 2

&feed

Any ideas as to what I did incorrectly?
 

David Carlisle

Usenet Archive
Joined
Jan 5, 2000
Messages
609
Reaction score
0
<?xml version="1.0"?>
<!DOCTYPE letter [
<!ENTITY feed SYSTEM "/rss.xml">
]>

&feed;

Any ideas as to what I did incorrectly?

you can't put the entire document into the entity: you have to have at least the top level element in your main file

Make that

<?xml version="1.0"?>
<!DOCTYPE letter [
<!ENTITY feed SYSTEM "/rss.xml">
]>
<letter>
&feed;
</letter>

and (probably) don't have <letter>i n your rss.xml file.

David
 

Michael (47)

Usenet Archive
Joined
Aug 19, 2004
Messages
5
Reaction score
0
<!DOCTYPE letter [
<!ENTITY feed SYSTEM "/rss.xml">
]>
<letter>
&feed;
</letter>

Ok that now seems to work fine thanks :)

However, now another problem persist. What my goal was is to take a very long url and turn it into rss.xml (its a RSS feed).

If I open up the rss.xml file in a browser with that code, it shows up fine, shows the rss file, and all is dandy.

However it won't validate in the rss validator, the validator shows the following:

<?xml version="1.0"?><!DOCTYPE letter [
<!ENTITY feed SYSTEM "/reallybiglongfile.xml">
]>
<letter>
&feed;
</letter>

As oppose to the actual xml file that shows in the browser with the RSS feed that I want it to display. Any ideas how to solve the problem?
 

nomad

Usenet Archive
Joined
Oct 10, 2001
Messages
29
Reaction score
0
Try Using
<include xlink:href="fileName.fileType">

This is a problem I had encountered in the passed and using the xlin worked for me

-
Noma
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top