public override void EndElement(XElement element) { Debug.WriteLine($"end element: {element.ToString()}"); switch (element.Name.LocalName) { case "identifier": if (tautomer != null) { // ok, add tautomer setOfMolecules.Add(tautomer); chemModel.MoleculeSet = setOfMolecules; chemSequence.Add(chemModel); } break; case "formula": if (tautomer != null) { Trace.TraceInformation("Parsing <formula> chars: ", element.Value); tautomer = CDK.Builder.NewAtomContainer(InChIContentProcessorTool.ProcessFormula( setOfMolecules.Builder.NewAtomContainer(), element.Value)); } else { Trace.TraceWarning("Cannot set atom info for empty tautomer"); } break; case "connections": if (tautomer != null) { Trace.TraceInformation("Parsing <connections> chars: ", element.Value); InChIContentProcessorTool.ProcessConnections(element.Value, tautomer, -1); } else { Trace.TraceWarning("Cannot set dbond info for empty tautomer"); } break; default: // skip all other elements break; } }
public override void EndElement(XElement element) { Debug.WriteLine($"end element: {element.ToString()}"); if (string.Equals("identifier", element.Name.LocalName, StringComparison.Ordinal)) { if (tautomer != null) { // ok, add tautomer setOfMolecules.Add(tautomer); chemModel.MoleculeSet = setOfMolecules; chemSequence.Add(chemModel); } } else if (string.Equals("formula", element.Name.LocalName, StringComparison.Ordinal)) { if (tautomer != null) { Trace.TraceInformation("Parsing <formula> chars: ", element.Value); tautomer = new AtomContainer(InChIContentProcessorTool.ProcessFormula( setOfMolecules.Builder.NewAtomContainer(), element.Value)); } else { Trace.TraceWarning("Cannot set atom info for empty tautomer"); } } else if (string.Equals("connections", element.Name.LocalName, StringComparison.Ordinal)) { if (tautomer != null) { Trace.TraceInformation("Parsing <connections> chars: ", element.Value); InChIContentProcessorTool.ProcessConnections(element.Value, tautomer, -1); } else { Trace.TraceWarning("Cannot set dbond info for empty tautomer"); } } else { // skip all other elements } }