[unknown type] Errors When Parsing Valid XML

2008 February 05
tags: ColdFusion · Code
by Nick

There's nothing more aggravating than the ambiguous java.lang.NullPointerException when debugging CF (and Java) apps.

I've had this particular parsing issue for several weeks. The logic ran perfectly fine on my development server, however, in production it would continuously fail. Trying to debug the code, the xmlSearch() function would throw a java.lang.NullPointerException... the problem didn't seem to start there, rather with the xmlParse() function just before it. XmlParse() would only return [unknown type]. IsXmlDoc() also failed.

After troubleshooting everything I could possibly think of, I unsuccessfully tried converting the XML source encoding, checked the CF and JVM version, and anything else I could think of to make sure the server specs matched. It turned out to be a firewall issue when trying to validate the custom XML doctype against the dtd file... somehow, this never occurred to me as being a potential issue, but after the outbound rule to the dtd was created, everything worked as expected.

Hopefully this will save someone else a lot of time and frustration.

2 Responses leave one →
  1. Nick
    Apr 17, 2009 at 3:39 PM

    testing comment moderation

  1. usul356
    usul356 PERMALINK
    Jan 7, 2010 at 4:07 PM

    I just wanted to say thank you Nick for your help. This isn't for this particular blog, but in reference to a comment you left on another blog about XML characters.
    http://www.coldfusionjedi.com/index.cfm/2008/8/29/CFFEED--You-have-failed-me-for-the-last-time

    Your regex trick of"rssXml = reReplace(rssXml,"[^(!\x20-\x7F|\xA|\xD)]","","all");" to get rid of all invalid XML characters has finally pulled a very nasty thorn from my paw. I still dream for the day when people only type their notes in the text box provided and not paste from Word.

    A thousand thank yous.

Leave a Reply