0

Well, I want to store information in an XML file and send it to be processed on a server. The structure of the XML file is simple:

<name></name>
<age></age>
<sex></sex>
<info></info>

The problem is that the information will be saved in the XML, are information that will be inserted by the users through text fields.

Assuming the User inserted a XML tag, and the final file becomes this:

<name> <age></name></age> </name>

There is a possibility of xml reader encounters a problem and not able to read the file?

jscs
  • 63,694
  • 13
  • 151
  • 195
LettersBa
  • 747
  • 1
  • 8
  • 27

2 Answers2

0

Yes. It is even very likely. This is why you should always be performing input sanitization:

For examples see here: santization done in PHP

bimmlerd
  • 153
  • 1
  • 6
0

If the XML is created properly, the value should be encoded:

<name> &lt;age&gt;&lt;/name&gt;&lt;/age&gt; </name>

That makes the value harmless for the XML, and there is no problem reading it.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005