is this standard way of including xml into xml?

Discussion in 'XML' started by hilz, Oct 28, 2005.

  1. hilz

    hilz Guest

    Hi,
    I am trying to style an rss feed. i created a stylesheet, and an xml
    file. i include the stylesheet and the rss feed file into my xml file.

    when i open my xml file in IE, everything works fine.
    when i open it in firefox, it doesn't work.

    does anybody know if there is antyhing i can do to make this work in
    firefox?

    here are my files:

    *********************
    del.icio.us.xml
    *********************
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE root [
    <!ENTITY foo1 SYSTEM "http://del.icio.us/rss/">
    ]>
    <?xml-stylesheet type="text/xsl" href="del.icio.us.xslt"?>
    <root>
    &foo1;
    </root>


    ********************
    del.icio.us.xslt
    ********************
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:foo="http://purl.org/rss/1.0/">
    <xsl:template match="/">
    <html>
    <head/>
    <body>
    <table border="1">
    <tr>
    <th>Title</th>
    <th>Link</th>
    </tr>
    <xsl:for-each select="//rdf:RDF/foo:item">
    <tr>
    <td>
    <xsl:value-of select="foo:title"/>
    </td>
    <td>
    <xsl:element name="a">
    <xsl:attribute name="href">
    <xsl:value-of select="foo:link"/>
    </xsl:attribute>
    <xsl:text> </xsl:text>
    <xsl:value-of select="foo:link"/>
    </xsl:element>
    </td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
     
    hilz, Oct 28, 2005
    #1
    1. Advertising

  2. hilz wrote:


    > when i open it in firefox, it doesn't work.
    >
    > does anybody know if there is antyhing i can do to make this work in
    > firefox?


    > <!DOCTYPE root [
    > <!ENTITY foo1 SYSTEM "http://del.icio.us/rss/">
    > ]>


    That is a problem with XML, the mechanism of such external entities is
    defined but it is not mandatory to be implemented, non validating
    parsers like the one Mozilla uses do not have to load such external
    entities and usually don't do that.

    Unless you know what kind of parsers processes the above construct
    respectively you can configure the parsers used to load such external
    entities you can't use it reliably.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Oct 28, 2005
    #2
    1. Advertising

  3. hilz

    Peter Flynn Guest

    hilz wrote:

    > Hi,
    > I am trying to style an rss feed. i created a stylesheet, and an xml
    > file. i include the stylesheet and the rss feed file into my xml file.


    To answer the question in your subject line, yes.
    See http://xml.silmaril.ie/authors/includes/

    > when i open my xml file in IE, everything works fine.
    > when i open it in firefox, it doesn't work.


    Martin already answered this. Browser support for XML is still poor.

    > does anybody know if there is antyhing i can do to make this work in
    > firefox?


    Do it server-side instead. Browser-side XML processing is not reliable
    enough yet.

    ///Peter
     
    Peter Flynn, Oct 29, 2005
    #3
  4. hilz

    hilz Guest


    > Do it server-side instead. Browser-side XML processing is not reliable
    > enough yet.
    >
    > ///Peter
    >


    But i am not the owner of the server, and thus do not have access to the
    server to do it server-side. I only have the url of the rss feel.

    In this link you provided, it is saying that i can add the <!ENTITY ...>
    defnition in the xml file without the <!DOCTYPE ...>
    so if i do it this way:

    <?xml version="1.0" encoding="iso-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="del.icio.us.XSLT"?>
    <!ENTITY foo1 SYSTEM "http://del.icio.us/rss">
    <root>
    &foo1;
    </root>

    if i do this, it doesn't work in either firefox or IE.
    i get the following error in firefox:

    XML Parsing Error: syntax error
    Location:
    file:///c:/...../del.icio.us.xml
    Line Number 3, Column 1:<!ENTITY foo1 SYSTEM
    "http://del.icio.us/rss/hsalameh">
    ^

    and the following error in IE:

    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the
    error and then click the Refresh button, or try again later.
    ---------------------------------------------------
    Cannot have a DTD declaration outside of a DTD. Error processing
    resource 'file:///C:/Documents and Settings/halim.salameh/...
    <!ENTITY foo1 SYSTEM "http://del.icio.us/rss/hsalameh">
    ---------^


    So how do i define the entity without a doctype ?

    thanks
     
    hilz, Oct 30, 2005
    #4
  5. hilz

    hilz Guest

    ok never mind...after reading your post and Martin's post again, i
    realized that it will not work with mozilla!

    thanks for your help
     
    hilz, Oct 30, 2005
    #5
  6. hilz

    Peter Flynn Guest

    hilz wrote:

    >
    >> Do it server-side instead. Browser-side XML processing is not
    >> reliable enough yet.
    >>
    >> ///Peter
    >>

    >
    > But i am not the owner of the server, and thus do not have access to
    > the server to do it server-side. I only have the url of the rss feel.
    >
    > In this link you provided, it is saying that i can add the <!ENTITY
    > ...> defnition in the xml file without the <!DOCTYPE ...>
    > so if i do it this way:
    >
    > <?xml version="1.0" encoding="iso-8859-1"?>
    > <?xml-stylesheet type="text/xsl" href="del.icio.us.XSLT"?>
    > <!ENTITY foo1 SYSTEM "http://del.icio.us/rss">


    I'm sorry, I can see that my example is misleading. I'll fix it.

    No, an ENTITY declaration must go in a DOCTYPE declaration.

    > So how do i define the entity without a doctype ?


    You can't. But you don't have to have a DTD to do this. Just do

    <?xml version="1.0" encoding="iso-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="del.icio.us.XSLT"?>
    <!DOCTYPE root [
    <!ENTITY foo1 SYSTEM "http://del.icio.us/rss">
    ]>
    <root>
    &foo1;
    </root>

    But don't expect it to work in browsers. I can only repeat what I and
    others said in case you didn't understand it: browser-side XML
    processing is not reliable enough yet.

    ///Peter
     
    Peter Flynn, Oct 31, 2005
    #6
    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. sergeil

    Including XML or text file into DLL

    sergeil, Jan 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    319
    sergeil
    Jan 13, 2004
  2. Tony Prichard
    Replies:
    0
    Views:
    746
    Tony Prichard
    Dec 12, 2003
  3. Clive
    Replies:
    1
    Views:
    377
    Peter Flynn
    Aug 21, 2005
  4. =?iso-8859-1?B?QW5kcuk=?=
    Replies:
    8
    Views:
    386
    =?iso-8859-1?B?QW5kcuk=?=
    May 1, 2007
  5. Xeno Campanoli / Eskimo North and Gmail
    Replies:
    2
    Views:
    181
    Phlip
    May 5, 2010
Loading...

Share This Page