Returning XML from CF for xmlHttpRequest

Greetings,
Not sure what I'm doing wrong here, but I can't seem to get
a .cfm page to return the necessary xml for use in my
xmlHttpRequest javascript code. I know the problem doesn't exist
within my javascript code......if I build the URL to connect to and
point it at an actual XML document, all is well.....I get a proper
XML DOM document back and I can do what I want. However, if I point
it at a .cfm page that is generating XML, it doesn't work.
I've tried a few different ways (<cfcontent> etc)of
trying to get CF to return the results of the .cfm page as XML, but
it's not working.
Suggestions?

Well, there you go. Turns out there's some slightly
contradictory info in the help for <cfxml>. In the main help
for the <cfxml> tag, there's no mention of the fact that you
should not use the standard <?xml version="1.0" etc> xml
processing directive when you're using that tag. It is, however,
mentioned on one of the associated help pages. So, now that I've
removed the directive, all is well.

Similar Messages

  • Return XML from Ajax

    Hi,
    I need to provide the XML tags and dynamic content from the APEX Ajax routine - to be used for the Fusioncharts. How can I return XML from the Ajax routine.
    Thanks.
    Andy

    Andy,
    Seeing how you are doing everything on load, there is really only a few changes you need to make in order for this to happen via ajax.
    1. Create an ondemand process which generates only XML named GET_CHART_XML. Something like ...
    declare
      l_xml             VARCHAR2 (32767);
      p_region_width    VARCHAR2 (10)    := '700';--------------------------------------
      p_region_height   VARCHAR2 (10)    := '300';-- not sure what these are here for --
      p_chart_debug     VARCHAR2 (10)    := '0';  --------------------------------------
    begin
      l_xml := '<graph showNames=''1'' decimalPrecision=''0''  >' ;
      for d in (select b.proj_phase, count(*) total
                  from it_proj_srvc_req a, it_proj_phase b
                 where a.it_proj_phase_pk = b.it_proj_phase_pk
                   and a.it_proj_phase_pk not in (10,99)
                   and exists (select 'x' from it_proj_srvc_req_pers d,
                                               it_proj_srvc_group e
                                         where d.dph_pers_pk = e.mem_pers_pk
                                           and e.adm_pers_pk = :F120_DPH_PERS_PK
                                           and a.it_proj_srvc_req_pk = d.it_proj_srvc_req_pk)
                                         group by b.proj_phase)
      loop
        if d.proj_phase = 'Current' then
          l_xml := l_xml || '<set name=''' || d.proj_phase || ''' value=''' || d.total || ''' isSliced=''1''/>';
        else
          l_xml := l_xml || '<set name=''' || d.proj_phase || ''' value=''' || d.total || ''' />';
        end if;
      end loop;
      l_xml := l_xml || '</graph>';
      htp.p(l_xml);
    end;2. Put this JavaScript in the HTMLHeader section of your page.
    <script language="JavaScript" src="/i/themes/custom/FusionCharts/FusionChartsFree/JSClass/FusionCharts.js"></script>
    <script type="text/javascript">
      function renderChart(){
        var myChart = new FusionCharts("/i/themes/custom/FusionCharts/FusionChartsFree/Charts/FCF_Pie2D.swf", "ChartId", "250", "100");
        var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=GET_CHART_XML',$v('pFlowStepId'));
        get.GetAsync(function(){
          if(p.readyState == 1){
            $x('chartdiv').innerHTML = '<p>Loading Chart...</p>';
          }else if(p.readyState == 4){
            if(!p.responseText){return false;};
            myChart.setDataXML(p.responseText);
            myChart.render("chartdiv");
        get = null;
    </script>3. Lastly create a button with a url target which points to "javascript: renderChart()".
    I was not able to actually test this as I do not have access to the java script dependencies for the flash chart. so I apologize if the JS has a typo in there.
    Hope this gets you started in the right direction.
    Tyson Jouglet

  • I didn't receive my return box from Apple for the iPod Nano replacement as promised within 2 working days, did anyone else?

    I didn't receive my return box from Apple for the iPod Nano replacement as promised within 2 working days, did anyone else?

    UPDATE. Just spoke with an AppleCare representative, Apple has been inundated with requests for these iPod Nano replacements.  They have fallen behind with sending out the return boxes in the 2 days they promised.  I was told to wait an additional 2 days.  She also said they were very surprised so many people still have their 1st generation nanos...
    We have been an Apple family for years and trust they will do the right thing, they have always surprised us with their professional customer service and expect this situation to be the same.

  • Return XML from REF CURSOR

    It appears to be fairly straight-forward to get XML from a SQL query using the XML SQL Utility.
    Is it possible to use this utility (or another) to get XML from a cursor variable as well? I would like to generate overloaded get_xml functions in a PL/SQL package that will accept either SQL or a weak type REF CURSOR and return XML.

    Thanks for the help. Actually, I just bought your book and was getting ready to do some research. This should get me pointed in the right direction.
    Does the PL/SQL API lack this functionality? I wasn't sure whether to implement this in PL/SQL or Java, but the decision may be made for me...

  • Return XML from MVC WebAPI Web Service

    The tutorials to create a web service using MVC WebAPI (frmaework4.5) in VS 2013  is touted as being "very simple" to return JSON or XML.
    But then, all you get is JSON. When you want to return a plain ole' string of XML ... there is no clear documentation. I see a bunch of posts where people are referencing the ActionResult method ... which is not in the APIController class... so that implies
    to me that I need to roll my own from the Controller class. That doesn't seem right to me.
    So ... how does one return an XML string from an MVC WebApi application?
    * the list of "questions similar to yours" that this forum presents me either:  a) are for ASMX in VS 2008 or b) do not work.
    Any direction to some documentation is appreciated.
    Thanks

    Hi,
    If this issue is related to MVC, you could ask this question in the ASP.NET forum:
    http://forums.asp.net. If then, you could get an answer more quickly and professional. Maybe the
    WCF, ASMX and other Web Services forum will be better for this issue. Thanks for your cooperation.
    Have a nice day,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Generating XML from RPD for a particular SUbject Area

    Hello All,
    I have one requirement to generate the .xml file from the RPD for a particular subject area.
    Uisng biserverxmlgen we can generate the .xml file for the entire rpd. But can it be specific to a subject area and its related BMM and Physical objects.
    Any help is appreciated.
    Regards,
    Ambika

    Hi,
    Just open the rpd offline,
    Go to Tools -> Utilities -> Generate Metadata Dictionary  -> Execute
    and then you will be asked to to select the target folder to save that. It might take some time if the repository is very big (but max 5mins)
    once execution was successful, you will have a folder with the same name of repository. Select 'SubjectArea' in these folder where you will have all you presentation catalog folder and take only the folder which you want. Presentation catalog would be in extension 'PRCAT_SubjectAreaName0000'. You will have all the xml files.
    Hope it helps!

  • Returning xml from a struts action to be used by a ajax client

    Hello,
    I'm having issues with my ajax call on a WAS server. It functions correctly when run locally on tomcat and WSAD servers.
    It looks like the response isnt comming back when the ajax call is made.
    My java struts action does the following:
            String xml = .....
            aResponse.setContentType("text/xml");            
            aResponse.getWriter().write(xml);
            aResponse.getWriter().flush();
           return null;Is this the correct way to pass back a response?
    do I have to set the header? if so, what should it be?
    Thanks,
    Con.

    A JSP is usually easier to construct the XML since you have looping etc. - otherwise OK.

  • Xport OMF or XML from Fcp5 for 5.1 mix?(Pro Tools better?)

    Is anyone using Logic to do there fcp project sweetening or is everyone a die hard Pro Tools user? I figured Logic Pro 7 would be the better way to go since I have apples tools. I also found out that PT LE does not support surround mixing. Well fact is I can't afford the PT/TDM gear. So can I get audio from my timeline in fcp to logic and still retain audio attributes and accomplish a surround mix well with Logic Pro 7 or is this left to the big boys with the PT tools? Any direction/workflow? My goal is to recut some real old school short I made and redo it all with fcp studio and freshening up the audio and finally surround mix it. Am I crazy or is someone doing this type of stuff...for fun?
    Peace. Thanks any info would be supa fly.
    Ryanb.
    aka:downtownbrown
    ps: I also have the Tascam fw-1884 surface to get the mix in and out and m-audio studiphile monitors.

    I never use the keyframes for audio.
    Because indeed the audio-guy will not receive that info from the omf.
    What I always do is add transitions to the audio. sometimes need to scirror the audio. adjust the level on the second part and the ad a transition.
    This way your audio-guy will know he needs to do 'something' on that point in the mix. he will not get the level information, but he'll see you made a transition there. together with your scratch mix (see danny boy's post) he'll figure out...
    Rienk

  • Return data from Checkbox for a newbie

    Here is my input tag:
    <cfinput type="checkbox" name="checkbox1" id="box1" value="datafrom1" />
    <cfinput type="checkbox" name="checkbox2" id="box2" value="datafrom2"/>
    <cfinput type="checkbox" name="checkbox3" id="box3" value="datafrom3" />
    Action page:
    Is checkbox1 checked #IsDefined("form.checkbox1")#
    Is checkbox2 checked #IsDefined("form.checkbox2")#
    Is checkbox3 checked #IsDefined("form.checkbox3")#
    But all says yes whether the checkbox is checked or not.
    I know the answer is simple, but I am very new.

    Thanks Dan.
    I am not a developer, so I'm struggling here:
    I simply want to display what checkboxes were checked, sent to me in an email.
    This is what I have so far:  I receive the information I want except whether any of the various checkboxes were checked.
    What do I use to display the checkbox info
    <cfmail
            from="xxx@dotcom"
            to="xxx@dotcom"
            subject="Subject Application "
            server="">
        Name: #Trim(FORM.Name)#
        Phone: #Trim(FORM.Phone)#
        Email: #Trim(FORM.Email)#
      </cfmail>

  • Trouble accessing dynamic XML from API with a CFC

    Please see my example at
    http://67.199.18.39/test.html
    and view source (to big to post here). I am returning XML from a
    dynamic call to an API through a ColdFusion CFC.
    Search for something generic like Dog. Click Go. I display
    the XML for you to view. I have tried many different XMLList
    dataproviders but can't get anything to work.
    Can someone point out the "errors" of my ways?
    Thanks.

    Turns out it was a namespace issue. I found the answer from a
    Bruce Phillips tutorial at
    http://www.brucephillips.name/blog/index.cfm/2006/12/5/Processing-XML-in-Flex-20-Using-The -For-Each-Statement-And-The-Descendent-Accessor--Operator
    I had to add:
    private namespace yahooNS = "urn:yahoo:prods";
    use namespace yahooNS;

  • Calling StroreProcedure contain XML as Input and store proce return XML as out-BizTalk

    I have a requirement in BizTalk that
    - I will receive XML from Source and i need to submit this XML data in  SQL storeprocedure  as a parameters and submit data
    Ex: My_SP(myXML xml Input,myXML1 xml OUT)
    Could you please help me how to call storeprocedure and submit XML and how to retrieve XML from SP.

    One of the way is to return xml from stored procedure instead of getting a typed schema
    You can have xml auto defined at stored procedure something like below stored procedure.
    SELECT [Employee_ID] ,[Name] ,[DOJ] ,[Designation] ,[Job_Description] ,cast([Rating] as varchar(100)) as Rating ,[Salary] ,[Last_Modified] ,[Status] ,[Address]
    FROM [Adapt_Doc].[dbo].[Employee] for xml auto, xmlschema
    After that you can directly assign the message to the typed schema something like below
    MessageTypedSQL=MessageUntypedSQl;
    For reference you can look into below MSDN articles
    SQL and XML: Use XML to Invoke and Return Stored Procedures
    Executing Stored Procedures Having a FOR XML Clause
    Thanks
    Abhishek

  • JDeveloper and PL/SQL queries which return XML

    Hi,
    I need to deploy WS with JDeveloper. I have an Oracle9i database which I query with PL/SQL. How can I return XML from my PL/SQL queries? I know I can use SQLX to return XML datatypes, but JDeveloper doesn't seem to be compatible. There is also XSQL, but I don't think JDeveloper allows you to publish this as a web service.
    Any help would be greatly appreciated!!! Thanks!!!!

    The following function should work for what you are trying to do.
    htp.p(htf.escape_sc(:P1_ITEM));To escape columns from the database just include it in your select statement:
    SELECT htf.escape_sc(COLUMN_NAME) alias
      FROM TABLETo escape items on your apex page:
    INSERT INTO table
               (COLUMN_NAME)
         VALUES(htf.escape_sc(:P1_ITEM))Good Luck,
    Tyson
    Edited by: Tyson Jouglet on Nov 25, 2008 4:12 PM

  • Returning XML String From Servlet

              Is there a simple way to disable the HTML character escaping when returning
              a string from a servlet. The returned string contains well formed XML, and
              I don't want the tags converted to > and < meta characters in the
              HTTP reply.
              The code is basically "hello world", version 7.0 SP2.
              Thanks
              > package xxx.servlet;
              >
              > import weblogic.jws.control.JwsContext;
              >
              >
              > /**
              > * @jws:protocol http-xml="true" form-get="false" form-post="false"
              > */
              > public class HelloWorld
              > {
              > /** @jws:context */
              > JwsContext context;
              >
              > /**
              > * @jws:operation
              > * @jws:protocol http-xml="false" form-post="true" form-get="false" soap-s
              tyle="document"
              > * @jws:return-xml xml-map::
              > * <HelloWorldResponse xmlns="http://www.xxx.com/">
              > * {return}
              > * </HelloWorldResponse>
              >
              > * ::
              > * @jws:parameter-xml xml-map::
              > * <HelloWorld xmlns="http://www.xxx.com/">
              > * <ix>{ix}</ix>
              > * <contents>{contents}</contents>
              > * </HelloWorld>
              >
              > * ::
              > */
              > public String HelloWorld(String s)
              > {
              > return "<a> xyz </a>";
              > }
              > }
              

              Radha,
              We have a client/server package which speaks SOAP over a
              streaming HTTP channel for which we are writing a WebLogic
              servlet. For reasons of efficiency, we want to deserialize
              only the very top-level tags of the messages as they pass
              through the servlet. Yes, in theory, we should probably
              deserialize and validate the entire message contents...
              When we add support for other clients, we will fully
              deserialize inside those servlets.
              I have not looked any further into how to stop the inner
              tags from being escaped yet -- it is an annoyance more than
              a disaster, since the client handle meta escapes.
              My current guess is to use ECMAScript mapping...
              -Tony
              "S.Radha" <[email protected]> wrote:
              >
              >"Tony Hawkins" <[email protected]> wrote:
              >>
              >>Is there a simple way to disable the HTML character escaping when returning
              >>a string from a servlet. The returned string contains well formed XML,
              >>and
              >>I don't want the tags converted to > and < meta characters in the
              >>HTTP reply.
              >>
              >>The code is basically "hello world", version 7.0 SP2.
              >
              >>
              >>Thanks
              >>
              >>> package xxx.servlet;
              >>>
              >>> import weblogic.jws.control.JwsContext;
              >>>
              >>>
              >>> /**
              >>> * @jws:protocol http-xml="true" form-get="false" form-post="false"
              >>> */
              >>> public class HelloWorld
              >>> {
              >>> /** @jws:context */
              >>> JwsContext context;
              >>>
              >>> /**
              >>> * @jws:operation
              >>> * @jws:protocol http-xml="false" form-post="true" form-get="false"
              >>soap-s
              >>tyle="document"
              >>> * @jws:return-xml xml-map::
              >>> * <HelloWorldResponse xmlns="http://www.xxx.com/">
              >>> * {return}
              >>> * </HelloWorldResponse>
              >>>
              >>> * ::
              >>> * @jws:parameter-xml xml-map::
              >>> * <HelloWorld xmlns="http://www.xxx.com/">
              >>> * <ix>{ix}</ix>
              >>> * <contents>{contents}</contents>
              >>> * </HelloWorld>
              >>>
              >>> * ::
              >>> */
              >>> public String HelloWorld(String s)
              >>> {
              >>> return "<a> xyz </a>";
              >>> }
              >>> }
              >>
              >>
              >Hi Tony,
              >
              > Can you let me know for what purpose you want to disable the
              >HTML character
              >escaping.In case if you
              >
              >have tried this using someway,pl. let me know.
              >
              >rgds
              >Radha
              >
              >
              

  • Returning XML Data from a database

    Ok, just got the new DW CS3 and really want to begin using
    the built in Spry capabilitites. All of the examples I've seen for
    populating the datasets with XML data are based on referencing a
    static XML file. I want to query my database and return XML data to
    a Spry Table. How do I accomplish this? I know how to perform the
    query and retrun the data in an XML format (ColdFusion) but I can't
    tell the spry dataset to use this. HELP!!

    Well, that's the trick... I can't point to a testing server
    (i.e. Application interface) because we aren't permitted to have
    the RDS login where I work. (They haven't bothered to configure the
    CF server for restricting access) I have to manually create all
    connections and queries. I'm currenlty using the exact format in
    the example page you provided to return the data in an XML format
    but when I point to that file as my datasource I get nothing
    displayed on the page. The file that performs the query and returns
    the data is in a separate file from the one I'm trying to use the
    Spry table in. When I use this same query file for an Ajax call to,
    say, populate a listbox or pulldown menu it works fine, but I can't
    get it to work with the Spry dataset.

  • XmlHttpRequest AJAX not returning message from COMET server

    I have the following COMET client javascript code:
    function getResponse() {
    document.getElementById("_receivedMsgLabel").innerHTML += "getResponse() called.<br/>";
    if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
    receiveReq.open("GET", "http://L45723:1802?callback=testcallback", true); //must use this URL at work.
    receiveReq.onreadystatechange = handleReceiveMessage;
    alert("handleReceiveMessage assigned to onreadystatechange event.");
    receiveReq.overrideMimeType("text/x-json");
    receiveReq.timeout = 100000;
    var currentDate = new Date();
    var sendMessage = JSON.stringify({
    SendTimestamp: currentDate,
    Message: "Message 1",
    Browser: navigator.appName,
    OriginUrl: document.URL
    var sendMessage = "SendTimestamp=" + currentDate + "&Message=Message1&Browser=" + navigator.userAgent;
    alert("JSON message created. About to send...");
    receiveReq.send(sendMessage);
    alert("Message sent.");
    //function for handling the return message from Comet
    function handleReceiveMessage() {
    document.getElementById("_receivedMsgLabel").innerHTML += "Status=" + receiveReq.status;
    document.getElementById("_receivedMsgLabel").innerHTML += "responseText=" + receiveReq.responseText;
    if (receiveReq.readyState == 4 && receiveReq.status == 200) {
    document.getElementById("_receivedMsgLabel").innerHTML += "Message received!<br/>";
    var status = receiveReq.status;
    var txt = receiveReq.responseText;
    document.getElementById("_receivedMsgLabel").innerHTML += txt + "<br/>";
    mTimer = setTimeout("getResponse();", 0);
    getResponse();
    The GET request is sent and received by the COMET server, which sends the response back when I choose to. The handleReceiveMessage() function is called, but the message the server sent is not in the xmlHttpRequest.responseText property.
    Why?

    I suggest continuing the discussion in your thread on mozillaZine, since this site focuses more on end-user support.
    [http://forums.mozillazine.org/viewtopic.php?f=25&t=2480435 xmlHttpRequest object - mozillaZine Forums]

Maybe you are looking for

  • How to get column values on item added event receiver

    Hi, I have two columns in a document library and one is people or group column and the other one is choice column with check boxes. I want to know how to read column values on Item Added event receiver, so that I can create if statements based on tho

  • My itunes has stoped working it says some files are missing

    My Itunes has resently stopped working it says that some fiiles are missing i cannot access it and i do not know what to do

  • Accessing element in a nested arraylist

    Hi, I have a LinkedHashMap that contains ArrayLists. Something like this: {color:#3366ff} ArrayList list = new ArrayList(); ArrayList list2 = new ArrayList(); LinkedHashMap<Integer, ArrayList> map = new LinkedHashMap<Integer, ArrayList>(); list.add(0

  • Passing field values from View Controller to Custom Controller

    Hi Experts, I am working on a customer requirment in which customer want to see the values of field from one view in another view. The Context node & Context node attribute are the same in both the views. I am aware that we need to pass the field val

  • Trouble connecting Jboss 3.2.4 with Oracle 11g.

    We are facing some trouble connecting 4 JBoss servers to an Oracle 11g server. Oracle server is working as a RAC with two nodes. We have two HP server every one of those have two JBoss application servers version 3.2.4. Each one of those application