simplexml_load_file() errors.
Posted: Thu Jun 07, 2012 2:43 am
I wrote a script the uses simplexml_load_file() to parse a file; when parsing a specific file i receive these error messages
Warning: simplexml_load_file() [function.simplexml-load-file]: files/07 Jun/(12) doors_locks_2012_06_06_17_01.xml:8359: parser error : Opening and ending tag mismatch: Question line 8353 and ParentSubjectID
The element in question looks like this
My thinking is telling me the problem is happening because of the whitespace inside the <Text> element. Is there any way to deal with this? One answer i found suggests using DOMDocument to load the document first and then using simplexml to parse the document.
Warning: simplexml_load_file() [function.simplexml-load-file]: files/07 Jun/(12) doors_locks_2012_06_06_17_01.xml:8359: parser error : Opening and ending tag mismatch: Question line 8353 and ParentSubjectID
The element in question looks like this
Code: Select all
<Question>
<Text>Panic Door devices (Weekly):
3. Are all fixings secure, check for wear, are there any visible worn components</Text>
<QuestionID>qu_011</QuestionID>
<Index>12</Index>
<Variable>Q_12</Variable>
<QType>eqtAmerican</QType>
<QuestionAnswer>N/A</QuestionAnswer>
<Answers>
<Answer>
<IsOtherSpec>False</IsOtherSpec>
<Text>N/A</Text>
<Index>3</Index>
<AnswerID>5</AnswerID>
<Code>3</Code>
<AnswerShortID>an_011_006</AnswerShortID>
<AnswerVariable>A_qu_011_3</AnswerVariable>
</Answer>
</Answers>
</Question>