Not sure if this is a BOX thing or not... I have j...
# box-products
g
Not sure if this is a BOX thing or not... I have just formatted / reinstalled my windows machine. I was using IIS - but now am JUST using Lucee via box. When I attempt to use xmlParse() on a file - I get an error. Or rather I dont get an error at THAT, at all - I get an error message from further on, saying that the variable that the xmlParse() is supposed to create doesn't exist. I have placed writeLogs around the xmlParse() - and everything works upto the xmlParse() line. (Apart from the new writeLog()s) I have NOT changed anything in the code. The path is different, and I am not using IIS. I feel I have missed something obvious - but just can't see it.
z
sounds like it's returning a null, which doesn't exist in traditional cfml, got a repo?
g
Hi Zac, But the code / nor the file has changed. Which is what is weird. And unhelpfully it is slightly obscured by being in an Application.cfc method. Thus the line number for the error is not "quite right".
j
If you do a
fileRead
on that file, can Lucee open it?
g
Hi @jclausen - fileRead works fine.
I have worked it out. The XML file that I am reading has a leading comment before the XML declaration. (The fix is to remove the declaration - or place it at line 1 - as per the requirements of XML v1.0) Though I am not sure why it is throwing an error now - but not before. Especially since I have not changed the version of Lucee or the extensions. There might be a difference in Lucee settings - but I am not sure what would affect Lucee to (previosuly) ignore the incorrectly position XML declaration node.
j
It might be due to some of the Jackson library updates in the latest version of Lucee. The comment before the opening “xml” declaration is, technically, invalid. I’ve run in to something similar before on Adobe 2021+
z
can you share a trycf example?
g
Hi @zackster, I have tried with different versions of Lucee and cannot duplicate it, working with a comment prior to the XML declaration. So I have no idea what was happening, when it wasn;t working. It may well be a Lucee setting - but I have been through them all and cannot see anything that would alter the behaviour. I even tried - with different settings and it still did / did not work - correctly. This works always :
Copy code
<?xml version="1.0"?>
<!-- This is a comment -->
This doesn't - and is expected not to:
Copy code
<!-- This is a comment -->
<?xml version="1.0"?>
(But didn't throw an error, previously, for me). In light of not being able to replicate on any of the versions released in the last two years - let's move on, I suppose.