Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. XML / XSL
  4. Nesting Invalid HTML in XML Docs

Nesting Invalid HTML in XML Docs

Scheduled Pinned Locked Moved XML / XSL
phpquestioncsharphtmldesign
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    callingshotgun
    wrote on last edited by
    #1

    I'm attempting to put together an XML format for posting/migrating blog data, and while I'm in the design phase, I came across an interesting question. What's the best way to take HTML that may or may not be valid, and nest it in an XML document, while still keeping the XML valid? I'm trying to make it so that the data can be migrated between all manner of blogging apps (LJ, diaryland, self-hosted ones like Wordpress, Pivot, B2Evolution), and most of them have their own unique quirks that break valid XML (some, for instance, use

    instead of

    ) if just dropped in there. Is there some "comment" element, or other way of flagging chunks of data that shouldn't be explicitly validated? Should I just leave it up to the software processing the data to replace all "keyword" type characters (<> etc) with their HTML equivalents? < &rt; etc... The problem with this approach, is that there are a ton of these, and I don't want to place undo stress on those writing the software to deal with this format. Any ideas on valid ways to tell an XML parser "this is valid, just ignore it", or simpler ways to store unvalidated HTML in a valid XML doc, or in general just ideas as to what approach I should take? Oh, if you want to follow the progress of the format, http://www.callingshotgun.net/drupal Much appreciated. -Alex

    J 1 Reply Last reply
    0
    • C callingshotgun

      I'm attempting to put together an XML format for posting/migrating blog data, and while I'm in the design phase, I came across an interesting question. What's the best way to take HTML that may or may not be valid, and nest it in an XML document, while still keeping the XML valid? I'm trying to make it so that the data can be migrated between all manner of blogging apps (LJ, diaryland, self-hosted ones like Wordpress, Pivot, B2Evolution), and most of them have their own unique quirks that break valid XML (some, for instance, use

      instead of

      ) if just dropped in there. Is there some "comment" element, or other way of flagging chunks of data that shouldn't be explicitly validated? Should I just leave it up to the software processing the data to replace all "keyword" type characters (<> etc) with their HTML equivalents? < &rt; etc... The problem with this approach, is that there are a ton of these, and I don't want to place undo stress on those writing the software to deal with this format. Any ideas on valid ways to tell an XML parser "this is valid, just ignore it", or simpler ways to store unvalidated HTML in a valid XML doc, or in general just ideas as to what approach I should take? Oh, if you want to follow the progress of the format, http://www.callingshotgun.net/drupal Much appreciated. -Alex

      J Offline
      J Offline
      jkersch
      wrote on last edited by
      #2

      tried ?

      C 1 Reply Last reply
      0
      • J jkersch

        tried ?

        C Offline
        C Offline
        callingshotgun
        wrote on last edited by
        #3

        (Apparently Greener in XML than I thought... never used CDATA) Looked it up... Yeah, that's absolutely perfect, thanks! Damn you, online references, for making me feel leeter than I was! -Alex

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups