#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Location
    Virginia Beach Virginia
    Posts
    11
    Rep Power
    0

    Question Can't get DOCTYPE to validate


    I am trying to write an XML document, with an RSS feed, and an attached CSS file for formatting, but I keep getting an error that says, "The page has no DOCTYPE element defined".

    Here is my code:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
     <?xml-stylesheet type="text/css" href="cssfile1.css"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <channel>     
    <Title>Project Gutenberg</Title>     <link>http://www.gutenberg.org/</link>     
    <Description>online reading / free ebooks</Description> <item1>     
    <title>Self Publishing</title>     
    <description>rss feed to self-published works</description>     <link>http://self.gutenberg.org/rss/authors.aspx</link>     <pubdate>01 May 2013</pubdate>     
    <lastbuilddate>14 July 2013</lastbuilddate> 
    </item1> 
    <item2>     
    <title>Available Books</title>     
    <description>search books available to read online</description>     
    <link>http://www.gutenberg.org/ebooks/</link>     <pubdate>05 July 2013</pubdate>     
    <lastbuilddate>14 July 2013</lastbuilddate> 
    </item2> 
    <item3>     
    <title>Donate</title>     
    <description>link to simplify making donations</description>     <link>http://www.gutenberg.org/wiki/Gutenberg:Project_Gutenberg_Needs_Your_Donation</link>     <pubdate>03 July 2013</pubdate>     
    <lastbuilddate>14 July 2013</lastbuilddate> 
    </item3> 
    <item4>     
    <title>Reviews</title>     <
    description>Webmaster Reviews</description>     <link>http://www.gutenberg.org/wiki/Gutenberg:Kindle_Fire_Review</link>     
    <pubdate>03 July 2013</pubdate>     
    <lastbuilddate>14 July 2013</lastbuilddate> 
    </item4> 
    <item5>     
    <title>Gutenberg Wiki</title>     
    <description>provide useful information on Project Gutenberg</description>     
    <link>http://www.gutenberg.org/wiki/Gutenberg:The_Project_Gutenberg_Wiki</link>     <pubdate>03 July 2013</pubdate>     
    <lastbuilddate>14 July 2013</lastbuilddate> 
    </item5> 
    </channel>
    I cannot figure out what is wrong here, I mean I think I coded this correctly, but it is crying about the DOCTYPE nonetheless.
    If someone could point out my mistake, I would be eternally grateful!!
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,997
    Rep Power
    9397
    That is... just not right. You're creating some crazy hybrid of XML, HTML, CSS, and XSLT. The XML+XSLT has to be separate from the HTML+CSS.

    Your first step is to write valid RSS. Forget the HTML and the CSS for now.
    If you don't know how to write it then look at the spec. Tip: the root element is not <html/> and there are no <itemN/> elements.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Location
    Virginia Beach Virginia
    Posts
    11
    Rep Power
    0

    Question


    Originally Posted by requinix
    That is... just not right. You're creating some crazy hybrid of XML, HTML, CSS, and XSLT. The XML+XSLT has to be separate from the HTML+CSS.

    Your first step is to write valid RSS. Forget the HTML and the CSS for now.
    If you don't know how to write it then look at the spec. Tip: the root element is not <html/> and there are no <itemN/> elements.
    I am not clear what you mean that I am creating a hybrid??
    Yes,this is supposed to be an RSS feed, but it is to be contained within an XML document that is to be stylized using an external CSS file. I am fairly new to XML, having done most of my code in HTML up until now, but I thought this was coded correctly, and could not figure out the error message....
  6. #4
  7. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,997
    Rep Power
    9397
    CSS is not for styling XML. You could, but that's a hell of a lot of work since you'd have to explicitly implement most of the stuff you might take for granted in HTML: block and inline styles being the most noticeable. Even then there are some things you couldn't reproduce, like links, as they require cooperation from the browser.

    Here's how it's supposed to go:
    1. RSS as pure XML
    2. Use a <?xml-stylesheet?> to link in XSLT
    3. The XSLT transforms the RSS XML into HTML
    4. That HTML can include a <link> for the external CSS

IMN logo majestic logo threadwatch logo seochat tools logo