473,395 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XML in XHTML

I am trying to include and xml document inside my xhtml document. There
are a number of reasons for this including portability, multiple
interface generation, and scalability of information.
My problem is that javascript is understanding the nodes in my xml
document as html elements.

<xml>
<book>
<title>Lord of the Rings</title>
</book>
</xml>

If I parse this, the title element cannot be extracted and the page
title(in the browser) becomes "Lord of the Rings".
Is there a way to exclude this xml node from the xhtml rules?

Nov 30 '05 #1
7 1297
> My problem is that javascript is understanding the nodes in my xml
document as html elements.

<xml>
<book>
<title>Lord of the Rings</title>
</book>
</xml>

If I parse this, the title element cannot be extracted and the page
title(in the browser) becomes "Lord of the Rings".
Is there a way to exclude this xml node from the xhtml rules?


I'm not an expert in this area, but I think to make this work you're
going to have to make use of XML namespaces. Anything parsing your page
can't tell the difference between '<title>...</title>' in your document
<head> element and inside this xml fragment.

Something like:

<html xmlns:myns="http://myorg.com/namespaces/myns"
xmlns="http://www.w3.org/1999/xhtml">
<head>...</head>
<body>
Nov 30 '05 #2
On 30 Nov 2005 13:21:58 -0800, in********@gmail.com wrote:
I am trying to include and xml document inside my xhtml document.


It's not practical to do this. You might learn more by reading the
archives of ciwah (comp.infosystems.www.authoring.html). Briefly though,
XHTML is still only usable on the web if it's served with a media type
of text/html, not an XML media type. In that context, it's now SGML/HTML
rather than XML, the non-XHTML tags aren't recognised and namespacing is
inappropriate.

If you're either working in a purely XML context (and I can't really
imagine how you'd get this to work) or if you can live with it "sort of"
working on some browsers and failing totally on others, then look into
XML namespacing.

There's also the old IE-specific technique of "data islands" with the
non-standard HTML extension tag of <XML>

Dec 1 '05 #3
Andy Dingley wrote:
There's also the old IE-specific technique of "data islands" with the
non-standard HTML extension tag of <XML>


It's also non-standard from an XML point of view. See the XML spec
(<http://www.w3.org/TR/REC-xml>), 3 Logical Structures:

"This specification does not constrain the semantics, use, or (beyond
syntax) names of the element types and attributes, except that names
beginning with a match to (('X'|'x')('M'|'m')('L'|'l')) are reserved for
standardization in this or future versions of this specification."
--
Johannes Koch
Spem in alium nunquam habui praeter in te, Deus Israel.
(Thomas Tallis, 40-part motet)
Dec 1 '05 #4
On Thu, 01 Dec 2005 11:44:48 +0100, Johannes Koch
<ko**@w3development.de> wrote:
Andy Dingley wrote:
There's also the old IE-specific technique of "data islands" with the
non-standard HTML extension tag of <XML>
It's also non-standard from an XML point of view.


I don't see that as too much of a problem, as this is primarily a HTML
techinque. It's a little sad that M$oft can't even get _this_ right
though, especially as it was a 2nd attempt at the tag name (<XMP> at one
time)
Spem in alium nunquam habui praeter in te, Deus Israel.
(Thomas Tallis, 40-part motet)


Earlier this year I attended a wonderful performance of "Spem in alium"
by Bristol's Bach Choir, in the lovely old church of St Mary Redcliffe.
Thanks for reminding me.
Dec 1 '05 #5


Johannes Koch wrote:
Andy Dingley wrote:
There's also the old IE-specific technique of "data islands" with the
non-standard HTML extension tag of <XML>

It's also non-standard from an XML point of view.

"This specification does not constrain the semantics, use, or (beyond
syntax) names of the element types and attributes, except that names
beginning with a match to (('X'|'x')('M'|'m')('L'|'l')) are reserved


But that does not really matter as the XML element is an extension IE
does to HTML and that element respectively its tags are parsed by the
HTML parser of IE. Only the contents of the XML element is then treated
as XML and parsed with MSXML, an XML parser.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 1 '05 #6
Andy Dingley wrote:
On Thu, 01 Dec 2005 11:44:48 +0100, Johannes Koch
<ko**@w3development.de> wrote:
Andy Dingley wrote:
There's also the old IE-specific technique of "data islands" with
the non-standard HTML extension tag of <XML>


It's also non-standard from an XML point of view.


I don't see that as too much of a problem, as this is primarily a HTML
techinque. It's a little sad that M$oft can't even get _this_ right
though, especially as it was a 2nd attempt at the tag name (<XMP> at
one time)


RTFM doesn't resolve to anything in Redmond :-)
Spem in alium nunquam habui praeter in te, Deus Israel.
(Thomas Tallis, 40-part motet)


Earlier this year I attended a wonderful performance of "Spem in
alium" by Bristol's Bach Choir, in the lovely old church of St Mary
Redcliffe. Thanks for reminding me.


Somewhere there is a wonderful video recording of a performance of this
by 40 voices in the round, under the dome of the Four Courts in Dublin.
I saw it broadcast some years ago but failed to note the name of the
choir (it *might* have been the Culwick Consort as they were then). The
Latin Choir of the Church of Our Lady, St John's Wood, also sang it at
their 1,000th choral Latin Mass a few years ago, Claude Crozet inviting
back some of their past members for the occasion.

///Peter, OT, but WTF, it's nearly Friday :-)

Dec 1 '05 #7
Just so you know, my solution was to read in the xml document using
xmlhttprequest, then to parse it from there. This is not totally ideal
since the user cannot view source but it is a lot easier.
Thanks for your help

Dec 3 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Peter Rohleder | last post by:
Hi, I have a few simple questions in order to use modularized xhtml and getting it to work. A simple example may make this obviouse: Lets say we want to create a simple xml-file to reflect...
59
by: Philipp Lenssen | last post by:
I've tested some of the new Nokia 6600 functionality. It ships with WAP2 and XHTML Support (it says). What it does is check the Doctype -- if it's not the XHTML Mobile Profile Doctype, but a...
32
by: jp29 | last post by:
My take on problems composing, serving and rendering XHTML documents/web pages: 1. Typical conscientious web authors are producing XHTML documents (Web pages) that feature valid Markup and with...
16
by: Mcginkel | last post by:
I am trying to find a way to load XHTML content in an Iframe. I use to do this in html by using the following code : var iframeObject = document.createElement("iframe");...
82
by: Buford Early | last post by:
I read this in http://annevankesteren.nl/2004/12/xhtml-notes "A common misconception is that XHTML 1.1 is the latest version of the XHTML series. And although it was released a bit more than a...
2
by: Joris Janssens | last post by:
I'm trying to write a program for validating XHTML 1.1-documents against the XHTML 1.1 DTD (which is actually the same as validating an XML-file) but I always get a "(404) Not found" error. This...
12
by: Alex D. | last post by:
How can I stop asp.net from rendering XHTML istead of HTML? My javascripts are rendering wrong because of that. It is rendering &amp; to clients instead of &. Any help? Thanks, Alejandro.
11
by: Tomek Toczyski | last post by:
What is the best way to attach a caption to an image in xhtml? I can attach a caption to a table by a "<caption>" tag but I would like to do sth similar to an image. How to do it in a natural...
11
by: Michael Powe | last post by:
How can I make an XHTML-compliant form of an expression in this format: document.write("<scr"+"ipt type='text/javascript' src='path/to/file.js'>"+"</scr"+"ipt>"); this turns out to be a...
10
by: Robert Huff | last post by:
Can someone offer suggestions why, on the same server (Apache 2.2.8), this works <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en-US"> <head> <link rel=stylesheet...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.