xmlParse(cfhttp.filecontent)

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default xmlParse(cfhttp.filecontent)

    I am using coldfusion to read rss feed. I was wondering why
    xmlParse(cfhttp.filecontent) works in one file residing in test server and
    fails to return valid xml document object when i put the same code in another
    server file. Can any one suggest if i need to check with server set up to use
    xmlParse() function. ( <cfdump cfhttp> returned the xml tree with no
    problem, it just fails at the point where i try to get the xml document object
    , which turns out to be null),

    Your prompt help would be highly appreciated as this is an urgent matter for
    my project .

    moeller

    mullerina Guest

  2. Similar Questions and Discussions

    1. XMLParse and XMLSearch
      I have the following code: a variable "x" that contains an XML string; if I do an XMLParse on this variable, it works (cfdump shows me the xml...
    2. XMLParse Error works in 6.1 but not 7
      I have a chunk of code that works on my 6.1 server, but not on my MX 7 server.... wtf? HELP! Thanks, Dave :+)
    3. XmlParse Problems
      Hello, I have searched everywhere and tried everything and cannot fix the problem. I continually get the following error when trying to use the...
    4. FILECONTENT error
      I have the following code that works in CF 5 but I'm getting an error when trying to run the same thing in MX. The error is...
    5. XmlParse Delay capabilities in 7
      I am trying to set a delay with the XMLParse function available only in 7.0. I set the XMLParse function as follows: <cfset xmlQuery =...
  3. #2

    Default Re: xmlParse(cfhttp.filecontent)

    You'll need to supply the URL of both feeds. It's probably a matter of differing server configs, but I'll need to be able to access them both to know for sure.
    rogben Guest

  4. #3

    Default Re: xmlParse(cfhttp.filecontent)

    here is an excerpt of my code:

    <cfset urlAddress="http://www.uc.edu/p/public/news/med-rss.xml">
    <cfhttp url="#urlAddress#" method="GET" throwonerror="yes" resolveurl="yes"/>
    <!---validation flag --->
    <cfset XMLVALIDATION = true>
    <cftry>
    <cfset fileCont= trim(cfhttp.FileContent)>
    <!---create the xml document object--->
    <cfset xmlDoc = xmlParse(fileCont, false)>
    ----
    why does this works in one file, say fil1.cmf and does not when i put
    same code in onother file, index.cmf ?

    Than you for your help and time.


    mullerina Guest

  5. #4

    Default Re: xmlParse(cfhttp.filecontent)

    > <cfset xmlDoc = xmlParse(fileCont, false)>
    > ----
    > why does this works in one file, say fil1.cmf and does not when i put
    > same code in onother file, index.cmf ?
    Is the content returned from requesting index.cmf valid XML?

    --

    Adam
    Adam Cameron Guest

  6. #5

    Default Re: xmlParse(cfhttp.filecontent)

    As a matter of fact, it is the same feed. i am using the same url in both, and xml is valid.

    Thank you,


    mullerina Guest

  7. #6

    Default Re: xmlParse(cfhttp.filecontent)

    OK.

    What's the actual error msg?

    --

    Adam
    Adam Cameron Guest

  8. #7

    Default Re: xmlParse(cfhttp.filecontent)

    Erro i get if i ignore the try...catch exception is ...... Element XMLROOT is
    undefined in XMLDOC. Also, <cfdump var="#xmlDoc#"> is null. But this same
    code saved in other cf project works fine.

    here is some more excrept of my code ....

    <cfset XMLVALIDATION = true>
    <cftry>
    <cfset fileCont= trim(cfhttp.FileContent)>
    <!---create the xml document object--->
    <cfset xmlDoc = xmlParse(fileCont, false)>
    <cfcatch type="any">
    <!---if the doc retrieved in cfhttp is not valid setvalidation flag to false
    --->
    <cfset XMLVALIDATION = true>
    </cfcatch>
    </cftry>
    <cfif XMLVALIDATION>
    <cfset XMLRoot=xmlDoc.xmlRoot>
    <!--- looping through the items collection --->
    <cfset numItems=arrayLen(XMLRoot.item)>
    <cfloop index="i" from="1" to = "#numItems#">

    mullerina Guest

  9. #8

    Default Re: xmlParse(cfhttp.filecontent)

    > Erro i get if i ignore the try...catch exception is ...... Element XMLROOT is
    > undefined in XMLDOC.
    OK, that's being caused by this line:
    <cfset XMLRoot=xmlDoc.xmlRoot>

    Get rid of the try/catch stuff. What error - if any - is being thrown by
    the xmlParse() call.
    > Also, <cfdump var="#xmlDoc#"> is null. But this same
    > code saved in other cf project works fine.
    >
    > <cfset fileCont= trim(cfhttp.FileContent)>
    > <cfset xmlDoc = xmlParse(fileCont, false)>
    Yet in the same failing code you can see a valid XML doc if you <cfdump
    var="#fileCont#">?

    It shouldn't matter, but what are the version and build numbers of the CF
    servers?

    --

    Adam
    Adam Cameron Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139