Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML in XHTML

Reply
Thread Tools

XML in XHTML

 
 
interfaced@gmail.com
Guest
Posts: n/a
 
      11-30-2005
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?

 
Reply With Quote
 
 
 
 
Lars Kellogg-Stedman
Guest
Posts: n/a
 
      11-30-2005
> 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>
 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      12-01-2005
On 30 Nov 2005 13:21:58 -0800, 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>

 
Reply With Quote
 
Johannes Koch
Guest
Posts: n/a
 
      12-01-2005
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)
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      12-01-2005
On Thu, 01 Dec 2005 11:44:48 +0100, 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.


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.
 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      12-01-2005


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/
 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      12-01-2005
Andy Dingley wrote:

> On Thu, 01 Dec 2005 11:44:48 +0100, 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.

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

 
Reply With Quote
 
interfaced@gmail.com
Guest
Posts: n/a
 
      12-03-2005
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

 
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
PSD to XHTML Conversion, PSD to HTML, Joomla, Drupal, WordpressConversion, PSD to XHTML CSS xhtml champs XML 0 08-02-2011 05:40 AM
PSD to XHTML Conversion, PSD to HTML, Joomla, Drupal, WordpressConversion, PSD to XHTML CSS xhtml champs C Programming 0 08-01-2011 06:29 AM
convert xhtml to another xhtml using xslt Usha2009 XML 0 12-20-2009 01:13 PM
Should I Convert Site To XHTML or XHTML mobile? chronos3d HTML 9 12-05-2006 04:46 PM
parse URL (href) from xhtml, xhtml -> text, for data hawat.thufir@gmail.com XML 7 02-08-2006 07:39 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