You are here:  » trailing ASCII byte 0A at ends of XML data items


trailing ASCII byte 0A at ends of XML data items

Submitted by BayesianLogic on Fri, 2006-11-10 18:10 in

Hi.

Love MagicParser.

But I discovered that when it parses an XML and loads information into the array, each value appears terminated by an ASCII 0A byte. That's cool to use it as a string terminator in case the value field is empty.

But I was not able to find any documentation of this fact.

I have samples and such. I'm just

substr( <item>, 0, (strlen(<item>) - 1) )

for now.

Submitted by support on Fri, 2006-11-10 21:09

Hi,

Thanks for your comments!

The ASCII 0A byte (new line/line feed) byte that you are seeing must be in the actual XML file that you are parsing - it is not added by Magic Parser.

This is not uncommon, and means that the source from which the XML file has been generated contains new line data that has not been stripped - either intentionally or otherwise.

An alternative method of handling this is to use PHP's trim() function will remove any white space (including new line characters) from the beginning or end of a string.

Cheers!
David.