/// Reads an XML file until an XML element with a given name is found.
/// Returns its attributes.
Reads an XML file until an XML element with a given name is found.
Returns its attributes.
Reads an XML file until an XML element with a given name is found . Returns its attributes .
fn read_until(&mut self, search: &str) -> GgbResult<Vec<OwnedAttribute>> {
        for xml_result in self.as_mut() {
            match xml_result {
                // The next XML event to process:
                Ok(xml_event) => {
                    // If we have an element and it has the correct name, we return
                    // this XML event.
                    if let XmlEvent::StartElement {
                        ref name,
                        attributes,
                        ..
                    } = xml_event
                    {
                        if name.local_name == search {
                            return Ok(attributes);
                        }
                    } else {
                        todo!()
                    }
                }
                // Something went wrong while fetching the next XML event.
                Err(_) => return Err(GgbError::InvalidXml),
            }
        }
        // We didn't find the element we were looking for.
        Err(GgbError::MissingElement)
    }
fn read_until ( & mut self , search : & str ) -> GgbResult < Vec < OwnedAttribute > > { for xml_result in self . as_mut ( ) { match xml_result { // The next XML event to process: Ok ( xml_event ) => { // If we have an element and it has the correct name, we return // this XML event. if let XmlEvent :: StartElement { ref name , attributes , .. } = xml_event { if name . local_name == search { return Ok ( attributes ) ; } } else { todo ! ( ) } } // Something went wrong while fetching the next XML event. Err ( _ ) => return Err ( GgbError :: InvalidXml ) , } } // We didn't find the element we were looking for. Err ( GgbError :: MissingElement ) }
Reads an XML file until an XML element with a given name is found.
Reads an XML file until an XML element with a given name is found .
&mut self
search
&str