asgrim / ofxparser

:moneybag: OFX File Parser
MIT License
108 stars 102 forks source link

Replace "&" sign in XML tag value by its html code #51

Closed nicolasrabier closed 5 years ago

nicolasrabier commented 5 years ago

In OFX files, some tag values like in MEMO tag contains special characters such as the '&' sign which generate an issue with simplexml_load_string function.

LibXMLError::__set_state(array( 'level' => 3, 'code' => 68, 'column' => 30, 'message' => 'xmlParseEntityRef: no name ', 'file' => '', 'line' => 27, )),

This code simply converts the '&' sign to its html code (&) which is tolerated by simplexml_load_string.

Fixes #53

asgrim commented 5 years ago

@nicolasrabier for this test, it's probably going to make sense to add another test case into the convertSgmlToXmlProvivder():

https://github.com/asgrim/ofxparser/blob/93ddca0acc2bf0a688f1f98a5f122048e6cbd832/tests/OfxParser/ParserTest.php#L85-L129

The alignment is really wonky there I noticed too :laughing:

asgrim commented 5 years ago

May also make sense to add a fixture with a functional test too

https://github.com/asgrim/ofxparser/blob/93ddca0acc2bf0a688f1f98a5f122048e6cbd832/tests/OfxParser/ParserTest.php#L159-L170

asgrim commented 5 years ago

Thanks @nicolasrabier !

nicolasrabier commented 5 years ago

Thanks @nicolasrabier !

No worries!