So if i understood well you, adding a schema specification to xml file, should resolve the problem ?
Not really. The schema would just define whether the file or the application code is in error.
Essentially you have already resolved the problem by giving the file a structure the application can deal with.
In any case AFAIK the XMLDOMParser is not part of the problem.