Results 1 to 5 of 5

Thread: How to load HTML as XML?

  1. #1
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default How to load HTML as XML?

    Hi all,

    I'm looking for a way to load an HTML file as XML. I have a almost-empty HTML file with a little PHP that generates the XML from a database.

    Flash is able to read this file as XML just fine, but not JS. I'm using the Sarissa wrapper, and the code just stops when it tries to load said file. If I save the output as an XML file, Sarissa has no trouble. Does anyone know of another library or something that would enable me to do this?

    Any tips greatly appreciated!
    Last edited by jlizarraga; 11-20-2008 at 06:56 PM. Reason: resolved

  2. #2
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    I don't think that this is possible, but you can use XHTML. Extensible Hypertext Markup Language (I think). This treats the HTML file as XML. You have to know XHTML syntax to do this, though, and also you have to include a <!DOCTYPE> tag stating your HTML file is XHTML. This should do.

    -magicyte

  3. #3
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    So I need something like this, right?

    <!DOCTYPE rootElement PUBLIC "PublicIdentifier" "URIreference">

    What do I use for a PublicIndentifier and URIreference? I'm having no luck with Google.

  4. #4
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    Yes.

    Good site: http://www.w3schools.com/tags/tag_DOCTYPE.asp

    If you don't want to go there, use this:

    Strict XHTML:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    Transitional XHTML:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    Frameset XHTML:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
    I'm pretty sure you can load XHTML files with AJAX/PHP/ASP etc. Look it up if you want.

    -magicyte
    Last edited by magicyte; 11-19-2008 at 11:13 PM.

  5. #5
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    I read more into this, and you need to define your own doctypes for XML. There is a great article on it here:

    http://xmlfiles.com/dtd/

    Thanks for your input!

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
  •