0

I have some bigger XMLs to process and based on the root node I will get the type of content XML contains. Accordingly I will redirect XML files to their specific processor.

Right now I am using DOM parser but trying to avoid unnecessary memory and time overhead.

Node node=doc.getDocumentElement();
if (node.getNodeName().equals("Settings"))
    submitFileToSettingsProcessor(file);
else if (node.getNodeName().equals("Data"))
    submitFileToDataProcessor(file);
// and so on . . .

Any other best way to read just the root element and avoid hefty code of DocumentBuilderFactory or SAXParserFactory.

pankaj_ar
  • 757
  • 2
  • 10
  • 33

0 Answers0