I could not remember if this was already done, but i would like to be able to access any page i am viewing as xml (rss). So when i go to the weblinks, I would like to be able to add /feed/ (or xml..) after it to see the rss page

Has this been done some time ago (please point me to the right place) or does this qualify as a valid feature request?



Brian@brianpuccio.net’s picture

Correct me if I'm wrong, but isn't XHTML just a subset of XML? Say I want a MathML page or ChemML page, I just include everything as one big XML document and just spit it out to you with the proper MIME type of application/xhtml+xml and any good browser (read: currently only Mozilla) will not treat it as HTML, but rather an XML document. Of course, there is an issue with that as gone over here. If a page is treated as XML and ran though the XML parser but someone has poasted a malformed comment, the entire page is shot and won't render. Drupal needs to decide to go with XHTML or just stick with plain HTML, it currently has a doctype of XHTML, but doesn't validate (the pushbutton theme fixes that) and is served with a MIME type that tells browsers to treat it as HTML, not as an XML document. See also here

Boris Mann’s picture

Yes, XHTML is specified as XML, although it inherits the entity definitions from HTML 4.01. You seem to be a bit confused about the uses of XHTML, though.

What the original question was asking for was feeds for any particular page, where a feed is a specific kind of XML using one of the syndication standards (RSS/RDF/Atom/etc.).

Sending with a MIME type of XML only makes sense for "pure" XML documents -- the pages in Drupal are meant to display formatted browser content, not code to be consumed by a machine or other application.

Brian@brianpuccio.net’s picture

But for a page to contain something like MathML and SVG, it must be served with a MIME of XML in order to be "seen" by either Mozilla or Internet Explorer with the MathML plug in. Serving it as any other MIME type will cause the browser to totally ignore the MathML markup. Lets look at Jacques Distler's Blog. One entry of his, say this one, that contains MathML would be totally ignored if he sent it with the html MIME. And that page is not code to be consumed by a machine or other application. It IS to display formatted browser content. XML is not just for or machines or applications. There is MathML, MusicML, ChemML, and the now developing LegalML. NONE of those are for other machines to read, but for people to read. SyncML would be an example of using XML for other machines to read the data.

See also:
Authoring MathML documents for Mozilla

Anyone who serves their pages as a html page is skipping the XML parser in the browser and may as well just write HTML 4 documents because that's how they get treated. Anyone who wants to write webpages that go beyond HTML MUST use a different MIME type. And no, it's not just to be consumed by a machine or other application, it's for people.

Please tell me what I'm so confused about and how to embed MathML and MusicML into a HTML 4 page.

Boris Mann’s picture

Brian -- your method is the correct way to go with other markup languages. Server-side, you could potentially do some transformations on the Math- and Music-ML code to get it to output as a graphic for non-XML capable browsers.

I was trying to answer the original question, where it looked like the person was trying to output any page as RSS (or XML, as he put it). I may have oversimplified in trying to answer the question -- I do understand what you are saying.

Brian@brianpuccio.net’s picture

He wants a MT like feature where he can view each page and it's comments as an RSS feed and subscribe to nodes that way. I understand now, I was way off base than.

bertboerland’s picture

Havent read this thread for sometime, but yes, that descibes what I want.



bert boerland

skip’s picture

I think Drumm's RSS module does this... Check the Contrib area in CVS

cmsproducer’s picture

Off the top of my head:
1) You can create Drupal theme and have it generate 'pages' with an XML mime-type and the data as a data tree based on a DTD you can determine (as long as the data is well-formed). This is ideal if you want to feed raw page data into a presentation layer applications such as Flash to display page content, or to write test from Drupal into an image etc

2) If you want to further manipulate the data from a Drupal node, you can use the above method (a little clunky though), or you can use the API to exchange data with the core

3) The third option is a little raw, and it is to write a PHP script to read the same MySQL DB tables used by Drupal and use the data to write XML that can be further manipulated server-side using XSL/XSLT to combine and mix the fields as you may see fit and come up with a final XML file that you can present as XHTML, pass into another application, write into a proprietary file format, or just be happy that you did it :)

NB: I am working on a project using option (1) and once it is released, I will write a review of the implementation for us all to extend and discuss.

iDonny Productions: Web CMS Design, Development & Web Standards

jrobinson’s picture

#1 is exactly what I need. Any chance you could share some more info on how you're going about it?


patrickmj’s picture

Don't know if you found what you needed, but I was working on similar things lately and found this thread helpful:


As mentioned there and elsewhere, though, sending application/xhtml+xml is dangerous unless you are absolutely certain that all your modules will produce good xml. If not, the site dies an unhappy death. That danger was enough for me to bail out on trying to send svg, even to only svg-happy browsers.

Good luck

cmsproducer’s picture

You may have found a solution, but here is my followup anyway:

1) Mime-type crashes in case your content is not valid
To respond to the issues raised about the site crashing and burning if modules or the content in a node is not valid, I can safely assume that you will not be processing the content of your node programatically and so the simple way out of the XML parser dying from malformed node content is to attach a basic DTD to your theme header and define the node guts as CDATA so that the parser can ignore the contents or the formatting of your text markup

2) Serving XML to everyone
My assumption is that you are not converting your site to XML and serving that to all anonymous users. In my situation, the site will server anonymous users XHTML pages, and for specialised users or if there is a certain key in the URL querystring, then I use that as a trigger to load the mode using the theme that generates XML.

For instance http://cmsproducer.com/xml-xslt-transformation will serve the node using plain old browser XHTML or HTML, and http://cmsproducer.com/xml-xslt-transformation?format=xml will trigger the same node to be pushed out using the theme that formats it as XML

Can browsers handle XHTML Strict in Drupal?
The answer is a big YES!! The server-side technology generating your pages should not affect what the client-side markup will be. it does not matter if it is a drupal page, static markup, sitecore, vignette etc. The theme layer of things gives you full control of what is served.

Visit and browse http://cmsproducer.com and as you move from page to page, click on the icon at the bottom of the page (the XHTML validity seal) and it will link to, and test the page with the W3C and tell you that the pages are valid XHTML Strict (which is an XML sub-set).

MathML, SVG, etc
So you should be free to generate markup in any XML format to be fed from drupal into your favourite application to consume the XML

iDonny Productions: Web CMS Design, Development & Web Standards

cmsproducer’s picture

I am doing a detailed review of the process to generate XML data from Drupal nodes.
Here is how to generate valid XML from Drupal CMS nodes

You can view that same page as XML by adding a querystring switch to the URL to trigger my application to format it as XML

iDonny Productions: Web CMS Design, Development & Web Standards

enginpost’s picture

I am fairly new at drupal and I don't understand what you have done to add querystring values that prompt drupal to use a different "theme?" I am assuming you have a TPL file that is generating the output in XML and so how are you doing that trick with the URL?