java - How to get error line number when validation xml -
i have xml this:
<a> <b>some content</b> <c>some content</c> <d> <d1>some content</d1> <d2>some content</d2> </d> </a>
i want validate xml file, must conform xml format above, say: element "b", "c", "d" can child of element "a", , element "d1" , "d2" can child of element "d", , content of "b" can characters. if xml file failed conform these rules, program report error lines numbers, not first error line number. , jdk 5. how validate this?
use xml schema define rules , use validator in javax.xml.validation validate it.have here.
Comments
Post a Comment