Skip to main content
Participant
June 3, 2008
Question

Passing XML Object to CFC Method

  • June 3, 2008
  • 1 reply
  • 344 views
I generated an XML Document Object using CFXML and it seems to work fine until I try to pass it to a CFC method with an argument type of "xml". The docs say that xml can refer to either an xml object or xml string; however, when I try to invoke my CFC, it seems that CF8 is assuming it is an XML string and attempting to parse it, which fails because it is already parsed! The error is:

An error occured while Parsing an XML document.
Content is not allowed in prolog.

If I do a toString() to start with, it seems to work - so are the docs incorrect? Must "xml" type be an XML string only?
    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    June 4, 2008
    CF8 is assuming it is an XML string and attempting to parse it, which fails because it is already parsed!

    I don't think that's the cause of the error. There must have been a space or some other character(s) before the XML declaration.

    I tested the following example -- successfully.