Yes. This was somewhat similar to one of my couple of options but had some worries. Since I am new to the technology ... I was unsure of it.
Option1.. YOUR METHOD.
My XML doc is validated against a schema. So
I got the method of appending the error mesg string to output to the user but the parseError object does not help in locating the node that has an error. So if one of the child elements has an error.. I need to locate the child and remove the complete set of child element and the corresponding parent node so that it conforms with the schema.
Could you show me a code snippet of how this is possible?
By complete set, I mean from <Info> to </Info>(all child elements included>:
<data>
<Info>
<name> XXX </name>
<age> 21 </age>
<gender> Male </gender>
</Info>
<Info>
<name> XXX </name>
<age> 21 </age>
<gender> Male </gender>
</Info>
...
...
...
</data>
Option2...
I had this idea of reading the xml document for every one complete set of nodes along with parent node, load into the DOM using loadXML() (in a schema cache) and validate it.
If this has errors, I append a error string else get the next set and go on.
But, I understand DOM uses more memory...would this create memory issues?
moreover, how this idea looks like for 1000 sets of <Info> ... </Info>?
the validation has to be in a loop doing 1000 times.
This is just an idea... I dont have a working proof.
Could you please give me your opinion on this