XML in XHTML

I

interfaced

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?
 
L

Lars Kellogg-Stedman

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>
 
A

Andy Dingley

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>
 
J

Johannes Koch

Andy said:
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."
 
A

Andy Dingley

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
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.
 
M

Martin Honnen

Johannes said:
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.
 
P

Peter Flynn

Andy said:
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 :)
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 :)
 
I

interfaced

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top