XML : How to remove elements from XML Document that are already processed?

I need to check for certain elements in a XML document if they were already processed earlier. If yes, I want to remove them to not processed them again. Here is an Example: I have the following (simplified) XML:

  <ParentElement>       <SubElement1>somestuff</SubElement1>      <SubElement2>morestuff</SubElement2>  </ParentElement>    

Now, I want to check if one of the SubElements are already send. Probably with some kind of hash? Something like this:

  foreach(ParentElement){       foreach(SubElement){          Compute hash value          lookup in hash table           if hash is there           remove SubElement          else            place hash in DB  }} return modified XML    

Is there a way to do this in Java?

No comments:

Post a Comment