I have multiple XMLs just varies tag names like this
sample1.xml
<Customer>
<ns1:Account>
</Customer>
sample2.xml
<Customer>
<ns3:Account>
</Customer>
sample3.xml
<Customer>
<ns5:Account>
</Customer>
Account tag is constant but ns value is changing is each xml file. I want to give a regular expression inside doc.getElementsByTagName
method like ".*child" to write a generic xml function using java xml parser but it is not working. Please help.
File inputFile = new File("input.txt");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(inputFile);
NodeList nList = doc.getElementsByTagName(".*Account"); // giving me null