XML in XHTML

Discussion in 'XML' started by interfaced@gmail.com, Nov 30, 2005.

  1. Guest

    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, 2005
    #1
    1. Advertising

  2. > 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>
    Lars Kellogg-Stedman, Nov 30, 2005
    #2
    1. Advertising

  3. Andy Dingley Guest

    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>
    Andy Dingley, Dec 1, 2005
    #3
  4. 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)
    Johannes Koch, Dec 1, 2005
    #4
  5. Andy Dingley Guest

    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.
    Andy Dingley, Dec 1, 2005
    #5
  6. 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/
    Martin Honnen, Dec 1, 2005
    #6
  7. Peter Flynn Guest

    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 :)
    Peter Flynn, Dec 1, 2005
    #7
  8. Guest

    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, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    7
    Views:
    866
  2. chronos3d
    Replies:
    9
    Views:
    761
    Andy Dingley
    Dec 5, 2006
  3. Usha2009
    Replies:
    0
    Views:
    1,117
    Usha2009
    Dec 20, 2009
  4. xhtml champs
    Replies:
    0
    Views:
    442
    xhtml champs
    Aug 1, 2011
  5. xhtml champs
    Replies:
    0
    Views:
    1,013
    xhtml champs
    Aug 2, 2011
Loading...

Share This Page