IT Process Automation

Expand all | Collapse all

convert HTML to XML

Jump to Best Answer
  • 1.  convert HTML to XML

    Posted 06-21-2016 09:40 AM

    Hi Guys,

     

    I have a process that gets triggered by email, I need to convert the HTML content of the email to XML.

    I'm not sure how to do this?

    Can anyone tell me how this can be done and if so any pointers on how it's done?

     

    Thanks

    Sivu



  • 2.  Re: convert HTML to XML
    Best Answer

    Posted 06-21-2016 10:15 AM

    Typically storing a document model within a document model is done either by escaping the document characters or storing it within a cdata section within the parent xml model. In PAM Escaping the DOM might be easier to do for you and so it might be possible to run it through a function like this:

     

    function escapeXml(unsafe) {
      
    return unsafe.replace(/[<>&'"]/g, function (c) {
      
    switch (c) {
      
    case '<': return '&lt;';
      
    case '>': return '&gt;';
      
    case '&': return '&amp;';
      
    case '\'': return '&apos;';
      
    case '"': return '&quot;';
      
    }
      
    });
    }