/** * Reads a node from the document and parses into metadata. */ bool SystemTranslator::OnRead( Context & ctxt, const XMLElement & elem, AccessorAdaptorBase* pAdaptor ) { const XMLElement* pchild; if( pAdaptor == NULL) return false; System system; bool bRetVal = true; //Parse the AttributedObject Elements. if( !ReadAttributedObject( system, ctxt, elem)) return false; //Done processing element, if no children, meaning this is //an element referencing another element. if( elem.NoChildren()) system.IsReference(true); else { //Parse freqbase [0..1] pchild = elem.FirstChildElement("freqbase"); AccessorAdaptor<System, Frequency> adpt( &system, &System::BaseFrequency); bRetVal = ReadElement( system, ctxt, *pchild, &adpt); //Parse Equipment [0..1] system.Equipment(ReadFirstElement( "equipment", elem, false, "")); //Parse Type Attribute. [0..1] System::SystemType stype = ToSystemType( ReadFirstElement("types", elem, false, "")); system.Type( stype); //Read source elements [1..*] bRetVal &= ReadList<Source>(system.Sources(), "source", ctxt, elem); //Read cluster elements [0..*] bRetVal &= ReadList<Cluster>(system.Clusters(), "cluster", ctxt, elem); } //Lastly set the channel on the specified object. pAdaptor->set( &system); return bRetVal; }