2 Replies Latest reply on Jan 4, 2008 11:12 AM by Newsgroup_User

    automate create xml with HTML blocks

    Level 7
      Hi,

      I have to base on certain trigger, database query result create an XML file.
      In the XML file I'm passing an HTML page. I have the HTML page saved on the
      local server.. page1.html, page2.html etcs..

      Any suggestions on how I can do this would be greatly appreciated. This will
      need to be an automate process... which I can do.. but the actual creating
      the XML file, I'm not sure about.

      Thanks in advance!



        • 1. automate create xml with HTML blocks
          coffeedrinker56 Level 1
          I'm not certain that I understand what you're asking. Creating an XML file from a database is pretty easy stuff so I'm undoubtedly misunderstanding the question(?):
          <cfquery name="abcdef" ...>
          Exec myStoredProcedure #myparam1#, '#myparam2#'
          </cfquery>
          <cfxml var="abc">
          <page>
          <html>
          <head>
          <title>abc example</title>
          <link rel="stylesheet" type="text/css" href="css/default.css" />
          <script language="javascript" type="text/javascript" src="abc.js" />
          </head>
          <body>
          <form name="pageForm" method="post" action="javascript:checkForm();">
          <table>
          <cfloop query="abcdef" startrow="1">
          <cfoutput><tr><td>#abcdef.field1#</td><td>#abcdef.field2#</td></tr>
          </cfloop>
          </table>
          </form>
          </body>
          </html>
          </page>
          </cfxml>

          If you choose to do so, you can display the XML like:
          <cfoutput>#abc#</cfoutput>

          ... or you can save the XML on your server as a file using CFFILE.

          If your intention is solely to display the XML, you can also use ...
          <cfcontent type="text/xml"><?xml version="1.0" encoding="UTF-8" ?><abc> ... </abc>

          ... instead of the <cfxml> and </cfxml> tags.

          [I use the latter form when passing data back and forth between the server and the client.]
          • 2. Re: automate create xml with HTML blocks
            Level 7
            Thanks for your reply... the XML that i need to create will be like this?

            <emailMessage>
            <messagetype>Welcome</MessageTpye>
            <Subject>Welcome</Subject>
            <MessageContent>
            <![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns=" http://www.w3.org/1999/xhtml">
            <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <title>test</title>
            </head>
            <body>
            welcome to our site<br /> you are blah blah<br /><br />
            <p>blah blah</p>
            <table><tr><td>whatever</td></tr></table>
            </body>
            </html>
            ]]>
            </MessageContent>
            </emailMessage>

            The part thats in the CDATA are now indivual html files so i want to take
            the content of that html file and put it in the CDATA. i'm not sure if
            that's the best way to do it though... might be better to store the HTML in
            the DB and then write it out from there???

            SUggestions?






            "coffeedrinker56" <webforumsuser@macromedia.com> wrote in message
            news:flkopq$fhh$1@forums.macromedia.com...
            > I'm not certain that I understand what you're asking. Creating an XML file
            from
            > a database is pretty easy stuff so I'm undoubtedly misunderstanding the
            > question(?):
            > <cfquery name="abc" ...>
            > Exec myStoredProcedure #myparam1#, '#myparam2#'
            > </cfquery>
            > <cfxml var="abc">
            > <page>
            > <html>
            > <head>
            > <title>abc example</title>
            > <link rel="stylesheet" type="text/css" href="css/default.css" />
            > <script language="javascript" type="text/javascript"
            src="abc.js" />
            > </head>
            > <body>
            > <form name="pageForm" method="post"
            action="javascript:checkForm();">
            > <table ...>
            > </table>
            > </form>
            > </body>
            > </html>
            > </page>
            > </cfxml>
            >
            > If you choose to do so, you can display the XML like:
            > <cfoutput>#abc#</cfoutput>
            >
            > ... or you can save the XML on your server as a file using CFFILE.
            >
            > If your intention is solely to display the XML, you can also use ...
            > <cfcontent type="text/xml"><?xml version="1.0" encoding="UTF-8" ?><abc>
            ...
            > </abc>
            >
            > ... instead of the <cfxml> and </cfxml> tags.
            >
            > [I use the latter form when passing data back and forth between the
            server and
            > the client.]
            >
            >