Include Files in XML?

Discussion in 'XML' started by Michael, Aug 19, 2004.

  1. Michael

    Michael Guest

    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?
     
    Michael, Aug 19, 2004
    #1
    1. Advertising

  2. Michael

    Evan Webb Guest

    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" <> wrote in message
    news:...
    > 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, Aug 19, 2004
    #2
    1. Advertising

  3. (Michael) wrote in message news:<>...
    > 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
     
    Finnbarr P. Murphy, Aug 20, 2004
    #3
  4. Michael

    Michael Guest

    > 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?
     
    Michael, Aug 20, 2004
    #4
  5. <?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
     
    David Carlisle, Aug 20, 2004
    #5
  6. In <>, on 08/20/2004
    at 04:31 AM, (Michael) said:

    >Any ideas as to what I did incorrectly?


    Your res.xml file is not in the expected directory. Try specifying a
    relative path or a full path.

    --
    Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

    Unsolicited bulk E-mail subject to legal action. I reserve the
    right to publicly post or ridicule any abusive E-mail. Reply to
    domain Patriot dot net user shmuel+news to contact me. Do not
    reply to
     
    Shmuel (Seymour J.) Metz, Aug 20, 2004
    #6
  7. Michael

    Michael Guest

    > <?xml version="1.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?
     
    Michael, Aug 20, 2004
    #7
  8. Michael

    Nomad Guest

    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
    -----------------------------------------------------------------------
    Posted via http://www.forum4designers.co
    -----------------------------------------------------------------------
    View this thread: http://www.forum4designers.com/message111865.htm
     
    Nomad, Sep 8, 2004
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Danny Anderson
    Replies:
    5
    Views:
    507
    Victor Bazarov
    Aug 15, 2003
  2. Rolf Magnus
    Replies:
    2
    Views:
    604
    Karl Heinz Buchegger
    Nov 28, 2003
  3. Elie Nader
    Replies:
    1
    Views:
    640
  4. Aguilar, James
    Replies:
    2
    Views:
    691
    Aguilar, James
    Jul 16, 2004
  5. Andreas Bogenberger
    Replies:
    3
    Views:
    926
    Andreas Bogenberger
    Feb 22, 2008
Loading...

Share This Page