fn close_xml_element(
    args: &mut RequestField,
    stack: &mut Vec<(String, u64)>,
    close_name: Option<&str>,
) -> Result<(), String> {
    match stack.pop() {
        None => {
            return Err(format!("Invalid XML, extraneous element end: {:?}", close_name));
        }
        Some((openname, idx)) => {
            if let Some(local) = close_name {
                if openname != local {
                    return Err(format!(
                        "Invalid XML, wrong closing element. Expected: {}, got {}",
                        openname, local
                    ));
                }
            }
            if idx == 0 {
                // empty XML element, save it with an empty string
                let path = xml_path(stack) + openname.as_str() + "1";
                args.add(path, DataSource::FromBody, String::new());
            }
            Ok(())
        }
    }
}
/// pop the stack and checks for errors when closing an element
pop the stack and checks for errors when closing an element
pop the stack and checks for errors when closing an element
fn close_xml_element(
    args: &mut RequestField,
    stack: &mut Vec<(String, u64)>,
    close_name: Option<&str>,
) -> Result<(), String> {
    match stack.pop() {
        None => {
            return Err(format!("Invalid XML, extraneous element end: {:?}", close_name));
        }
        Some((openname, idx)) => {
            if let Some(local) = close_name {
                if openname != local {
                    return Err(format!(
                        "Invalid XML, wrong closing element. Expected: {}, got {}",
                        openname, local
                    ));
                }
            }
            if idx == 0 {
                // empty XML element, save it with an empty string
                let path = xml_path(stack) + openname.as_str() + "1";
                args.add(path, DataSource::FromBody, String::new());
            }
            Ok(())
        }
    }
}
fn close_xml_element ( args : & mut RequestField , stack : & mut Vec < ( String , u64 ) > , close_name : Option < & str > , ) -> Result < ( ) , String > { match stack . pop ( ) { None => { return Err ( format ! ( " " close_name ) ) ; } Some ( ( openname , idx ) ) => { if let Some ( local ) = close_name { if openname != local { return Err ( format ! ( " " openname local ) ) ; } } if idx == 0 { // empty XML element, save it with an empty string let path = xml_path ( stack ) + openname . as_str ( ) + " " ; args . add ( path , DataSource :: FromBody , String :: new ( ) ) ; } Ok ( ( ) ) } } }
pop the stack and checks for errors when closing an element
pop the stack and checks for errors when closing an element
args
&mut RequestField
stack
&mut Vec<(String, u64)>
close_name
Option<&str>