Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > is this standard way of including xml into xml?

Reply
Thread Tools

is this standard way of including xml into xml?

 
 
hilz
Guest
Posts: n/a
 
      10-28-2005
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"
xmlnssl="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>
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      10-28-2005


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/
 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      10-29-2005
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

 
Reply With Quote
 
hilz
Guest
Posts: n/a
 
      10-29-2005

> 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
 
Reply With Quote
 
hilz
Guest
Posts: n/a
 
      10-29-2005
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
 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      10-31-2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the standard way to put a standard set of asserts into acalled subroutine in test/unit? Xeno Campanoli / Eskimo North and Gmail Ruby 2 05-05-2010 10:44 PM
including one XML file in another XML file Johan XML 20 02-27-2007 04:29 PM
Newbie. xml "dynamically" including another xml document Clive XML 1 08-21-2005 08:26 PM
Including XML or text file into DLL sergeil ASP .Net 0 01-13-2004 08:17 AM
Help on including one XML document within another XML document using XML Schemas Tony Prichard XML 0 12-12-2003 03:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57