c# - How to determine if XML has unclosed strings -
i have many xml files , of them might have unclosed strings this
<ns0:info infotyp="53" infoid="/>
those unclosed strings dont appear last part of tag
is there way in notepad++ or in c# detect when file has kind of strings ?
how can detect other kind of error in xml file make invalid xml ? need try parse detect ?
with c# can try load xml file xdocument (or xmldocument):
using system.xml.linq; // include in using directives try { var xdoc = xdocument.load(path_to_xml); } catch (xmlexception e) { // xml invalid }
xmlexception
contains information line number , position caused error. exception message pretty informative. e.g. xml say:
unexpected end of file has occurred. following elements not closed: line 1, position 35.
Comments
Post a Comment