I am new to XML parsing using Java and SAX parser. I have a really big XML file and because of its size I have been advised to use SAX parser. I have finished parsing part of my tasks and it works as expected. Now, there is one task left with XML job: deleting/updating some nodes upon user's request.
I am able to find all tags by their names, change their data attributes, etc. If I am able to do these with SAX, deleting also may be possible.
Sample XML describes some functionality under some case's. User's inputs are the "case"s names (case1, case2).
<ruleset>
<rule id="1">
<condition>
<case1>somefunctionality</case1>
<allow>true</allow>
</condition>
</rule>
<rule id="2">
<condition>
<case2>somefunctionality</case2>
<allow>false</allow>
</condition>
</rule>
</ruleset>
If user wants to delete one of these cases (for example case1) not just case1 tag, the complete rule tag must be deleted. If case1 is to be deleted, XML will become:
<ruleset>
<rule id="2">
<condition>
<case2>somefunctionality</case2>
<allow>false</allow>
</condition>
</rule>
</ruleset>
My question is, can this be done using SAX? I can't use DOM or any other parser at this point. Only other option is even worse: string search. How can it be done using SaxParser?