Search null values on a XML file
I have created a patient form in Java and I save the data of each patient in a XML file. When I list in a table the process number of each form, I would like to know if the form is entirely complete or not. To know that, I have to look in the XML files if it have empty tag. Can someone tell me how to read a file and see if there are tag with null values?
Thank you.
Best regards.开发者_Python百科
Daniel
Read an XML file in a Java program with the DOM or SAX or STAX.
If you read it with the DOM, you can write an XPath expression that matches all the elements with no child text (your 'null nodes').
If you read it with Stax or SAX, you can write code to notice the lack of content between a particular startElement and corresponding endElement.
精彩评论