@ Override public void endElement ( CMLStack xpath , String uri , String name , String raw ) { if ( name . equals ( "molecule" ) ) { // System.out.println("Ending element mdmolecule"); // add chargeGroup, and then delete them if ( currentChargeGroup != null ) { if ( currentMolecule instanceof MDMolecule ) { ( ( MDMolecule ) currentMolecule ) . addChargeGroup ( currentChargeGroup ) ; } else { logger . error ( "Need to store a charge group, but the current molecule is not a MDMolecule!" ) ; } currentChargeGroup = null ; } else // add chargeGroup, and then delete them if ( currentResidue != null ) { if ( currentMolecule instanceof MDMolecule ) { ( ( MDMolecule ) currentMolecule ) . addResidue ( currentResidue ) ; } else { logger . error ( "Need to store a residue group, but the current molecule is not a MDMolecule!" ) ; } currentResidue = null ; } else { // System.out.println("OK, that was the last end mdmolecule"); super . endElement ( xpath , uri , name , raw ) ; } } else if ( "atomArray" . equals ( name ) ) { if ( xpath . length ( ) == 2 && xpath . endsWith ( "molecule" , "atomArray" ) ) { storeAtomData ( ) ; newAtomData ( ) ; } else if ( xpath . length ( ) > 2 && xpath . endsWith ( "cml" , "molecule" , "atomArray" ) ) { storeAtomData ( ) ; newAtomData ( ) ; } } else if ( "bondArray" . equals ( name ) ) { if ( xpath . length ( ) == 2 && xpath . endsWith ( "molecule" , "bondArray" ) ) { storeBondData ( ) ; newBondData ( ) ; } else if ( xpath . length ( ) > 2 && xpath . endsWith ( "cml" , "molecule" , "bondArray" ) ) { storeBondData ( ) ; newBondData ( ) ; } } else if ( "scalar" . equals ( name ) ) { //Residue number if ( "md:resNumber" . equals ( DICTREF ) ) { int myInt = Integer . parseInt ( currentChars ) ; currentResidue . setNumber ( myInt ) ; } //ChargeGroup number else if ( "md:cgNumber" . equals ( DICTREF ) ) { int myInt = Integer . parseInt ( currentChars ) ; currentChargeGroup . setNumber ( myInt ) ; } } else { super . endElement ( xpath , uri , name , raw ) ; } }
Finish up parsing of elements in mdmolecule .