Rule-based XML parser using SAX