Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Can I embed XML in HTML??

  1. #1
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can I embed XML in HTML??

    Can anyone tell me if one can embed xml in (x)*html ?

    Thanks.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    "Embed" how? What do you expect this XML to do? XML is just a data format, it can't do anything without a parser.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, thanks. I just wanted to know if I could or not. Thanks again.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Certainly you can display XML in HTML, and you can even use profiles of it for various things (VML in IE, or MathML in an XHTML-supporting browser).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    Certainly you can display XML in HTML ...
    Yes, though it's not valid to include an XML document fragment as markup within a HTML document.

    Mike

  6. #6
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Twey: So how can I do that?

    mwinter: Isn't there any way we can make it valid?

  7. #7
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by shachi View Post
    Isn't there any way we can make it valid?
    A HTML document can only contain HTML and character data (text in elements, including embedded style sheets and scripts).

    An XML document can be used by parts of a HTML document, such as frames, object elements, and within scripts, but the former cannot be directly contained within the latter. It may be possible to transform the XML document into a HTML fragment, but then it isn't XML any more.

    Mike

  8. #8
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    mwinter: Thanks you for explaining. How can scripts embed them?

  9. #9
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by shachi View Post
    How can scripts embed them?
    A script can't, but with support for objects like XMLHttpRequest and DOMDocument, an XML document can loaded and queried using DOM methods.

    Mike

  10. #10
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh, sorry, I misunderstood.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •