简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM