fn convert_to_xml(v: &Value) -> Option<String> {
    let mut begin_open_element = String::new();
    let attributes;
    let mut begin_close_element = String::new();
    let mut text = String::new();
    let child_nodes;
    let mut end_element = String::new();
    match &*v {
        Value::Hash(vm) => {
            let key_opt = vm.get("key");
            match key_opt {
                Some(value_rr) => {
                    let value_rrb = value_rr.borrow();
                    match &*value_rrb {
                        Value::String(s, _) => {
                            if s != "" {
                                begin_open_element = format!("<{}", s);
                                begin_close_element = ">".to_string();
                                end_element = format!("</{}>", s);
                            }
                        }
                        _ => {}
                    }
                }
                None => {}
            }

            let attributes_opt = vm.get("attributes");
            let attributes_str = match attributes_opt {
                Some(attributes_rr) => {
                    let attributes_rrb = attributes_rr.borrow();
                    match &*attributes_rrb {
                        Value::Hash(map) => {
                            let mut has_none = false;
                            let attributes_str_lst = map
                                .iter()
                                .map(|(key, value_rr)| {
                                    let value_rrb = value_rr.borrow();
                                    let value_str_pre =
                                        value_rrb.to_string();
                                    let value_str_opt =
                                        to_string_2(&value_str_pre);
                                    match value_str_opt {
                                        Some(s) => {
                                            format!("{}=\"{}\"", key, s)
                                        }
                                        None => {
                                            has_none = true;
                                            "".to_string()
                                        }
                                    }
                                })
                                .collect::<Vec<_>>();
                            if has_none {
                                return None;
                            } else {
                                attributes_str_lst.join(" ")
                            }
                        }
                        _ => "".to_string(),
                    }
                }
                _ => "".to_string(),
            };
            attributes = if attributes_str != "" {
                format!(" {}", attributes_str)
            } else {
                "".to_owned()
            };

            let value_opt = vm.get("value");
            let mut has_none = false;
            child_nodes = match value_opt {
                Some(value_rr) => {
                    let value_rrb = value_rr.borrow();
                    match &*value_rrb {
                        Value::List(lst) => lst
                            .iter()
                            .map(|lst_value_rr| {
                                let lst_value_rrb = convert_to_xml(&lst_value_rr.borrow());
                                if lst_value_rrb.is_none() {
                                    has_none = true;
                                    "".to_string()
                                } else {
                                    lst_value_rrb.unwrap()
                                }
                            })
                            .collect::<Vec<_>>()
                            .join(""),
                        _ => "".to_string(),
                    }
                }
                _ => "".to_string(),
            };
            if has_none {
                return None;
            }

            let text_opt = vm.get("text");
            match text_opt {
                Some(value_rr) => {
                    let value_rrb = value_rr.borrow();
                    match &*value_rrb {
                        Value::String(s, _) => {
                            text = s.to_string();
                        }
                        _ => {}
                    }
                }
                _ => {}
            };
            return Some(format!("{}{}{}{}{}{}", begin_open_element, attributes, begin_close_element, text, child_nodes, end_element));
        }
        _ => Some("".to_string()),
    }
}
/// Converts a value into an XML string.
Converts a value into an XML string.
Converts a value into an XML string .
fn convert_to_xml(v: &Value) -> Option<String> {
    let mut begin_open_element = String::new();
    let attributes;
    let mut begin_close_element = String::new();
    let mut text = String::new();
    let child_nodes;
    let mut end_element = String::new();
    match &*v {
        Value::Hash(vm) => {
            let key_opt = vm.get("key");
            match key_opt {
                Some(value_rr) => {
                    let value_rrb = value_rr.borrow();
                    match &*value_rrb {
                        Value::String(s, _) => {
                            if s != "" {
                                begin_open_element = format!("<{}", s);
                                begin_close_element = ">".to_string();
                                end_element = format!("</{}>", s);
                            }
                        }
                        _ => {}
                    }
                }
                None => {}
            }
            let attributes_opt = vm.get("attributes");
            let attributes_str = match attributes_opt {
                Some(attributes_rr) => {
                    let attributes_rrb = attributes_rr.borrow();
                    match &*attributes_rrb {
                        Value::Hash(map) => {
                            let mut has_none = false;
                            let attributes_str_lst = map
                                .iter()
                                .map(|(key, value_rr)| {
                                    let value_rrb = value_rr.borrow();
                                    let value_str_pre =
                                        value_rrb.to_string();
                                    let value_str_opt =
                                        to_string_2(&value_str_pre);
                                    match value_str_opt {
                                        Some(s) => {
                                            format!("{}=\"{}\"", key, s)
                                        }
                                        None => {
                                            has_none = true;
                                            "".to_string()
                                        }
                                    }
                                })
                                .collect::<Vec<_>>();
                            if has_none {
                                return None;
                            } else {
                                attributes_str_lst.join(" ")
                            }
                        }
                        _ => "".to_string(),
                    }
                }
                _ => "".to_string(),
            };
            attributes = if attributes_str != "" {
                format!(" {}", attributes_str)
            } else {
                "".to_owned()
            };
            let value_opt = vm.get("value");
            let mut has_none = false;
            child_nodes = match value_opt {
                Some(value_rr) => {
                    let value_rrb = value_rr.borrow();
                    match &*value_rrb {
                        Value::List(lst) => lst
                            .iter()
                            .map(|lst_value_rr| {
                                let lst_value_rrb = convert_to_xml(&lst_value_rr.borrow());
                                if lst_value_rrb.is_none() {
                                    has_none = true;
                                    "".to_string()
                                } else {
                                    lst_value_rrb.unwrap()
                                }
                            })
                            .collect::<Vec<_>>()
                            .join(""),
                        _ => "".to_string(),
                    }
                }
                _ => "".to_string(),
            };
            if has_none {
                return None;
            }
            let text_opt = vm.get("text");
            match text_opt {
                Some(value_rr) => {
                    let value_rrb = value_rr.borrow();
                    match &*value_rrb {
                        Value::String(s, _) => {
                            text = s.to_string();
                        }
                        _ => {}
                    }
                }
                _ => {}
            };
            return Some(format!("{}{}{}{}{}{}", begin_open_element, attributes, begin_close_element, text, child_nodes, end_element));
        }
        _ => Some("".to_string()),
    }
}
fn convert_to_xml ( v : & Value ) -> Option < String > { let mut begin_open_element = String :: new ( ) ; let attributes ; let mut begin_close_element = String :: new ( ) ; let mut text = String :: new ( ) ; let child_nodes ; let mut end_element = String :: new ( ) ; match & * v { Value :: Hash ( vm ) => { let key_opt = vm . get ( " " ) ; match key_opt { Some ( value_rr ) => { let value_rrb = value_rr . borrow ( ) ; match & * value_rrb { Value :: String ( s , _ ) => { if s != " " { begin_open_element = format ! ( " " s ) ; begin_close_element = " " . to_string ( ) ; end_element = format ! ( " " s ) ; } } _ => { } } } None => { } } let attributes_opt = vm . get ( " " ) ; let attributes_str = match attributes_opt { Some ( attributes_rr ) => { let attributes_rrb = attributes_rr . borrow ( ) ; match & * attributes_rrb { Value :: Hash ( map ) => { let mut has_none = false ; let attributes_str_lst = map . iter ( ) . map ( | ( key , value_rr ) | { let value_rrb = value_rr . borrow ( ) ; let value_str_pre = value_rrb . to_string ( ) ; let value_str_opt = to_string_2 ( & value_str_pre ) ; match value_str_opt { Some ( s ) => { format ! ( " \" \" " key s ) } None => { has_none = true ; " " . to_string ( ) } } } ) . collect :: < Vec < _ > > ( ) ; if has_none { return None ; } else { attributes_str_lst . join ( " " ) } } _ => " " . to_string ( ) , } } _ => " " . to_string ( ) , } ; attributes = if attributes_str != " " { format ! ( " " attributes_str ) } else { " " . to_owned ( ) } ; let value_opt = vm . get ( " " ) ; let mut has_none = false ; child_nodes = match value_opt { Some ( value_rr ) => { let value_rrb = value_rr . borrow ( ) ; match & * value_rrb { Value :: List ( lst ) => lst . iter ( ) . map ( | lst_value_rr | { let lst_value_rrb = convert_to_xml ( & lst_value_rr . borrow ( ) ) ; if lst_value_rrb . is_none ( ) { has_none = true ; " " . to_string ( ) } else { lst_value_rrb . unwrap ( ) } } ) . collect :: < Vec < _ > > ( ) . join ( " " ) , _ => " " . to_string ( ) , } } _ => " " . to_string ( ) , } ; if has_none { return None ; } let text_opt = vm . get ( " " ) ; match text_opt { Some ( value_rr ) => { let value_rrb = value_rr . borrow ( ) ; match & * value_rrb { Value :: String ( s , _ ) => { text = s . to_string ( ) ; } _ => { } } } _ => { } } ; return Some ( format ! ( " " begin_open_element attributes begin_close_element text child_nodes end_element ) ) ; } _ => Some ( " " . to_string ( ) ) , } }
Converts a value into an XML string.
Converts a value into an XML string .
v
&Value