pub fn from_start_event<'a>(
        mc: MutationContext<'gc, '_>,
        bs: BytesStart<'a>,
        process_entity: bool,
    ) -> Result<Self, quick_xml::Error> {
        let tag_name = AvmString::new_utf8_bytes(mc, bs.name())?;
        let mut attributes = BTreeMap::new();

        for a in bs.attributes() {
            let attribute = a?;
            let value_bytes = if process_entity {
                attribute.unescaped_value()?
            } else {
                attribute.value
            };

            let value = AvmString::new_utf8_bytes(mc, value_bytes)?;
            let attr_key = AvmString::new_utf8_bytes(mc, attribute.key)?;
            attributes.insert(attr_key, value);
        }

        Ok(XmlNode(GcCell::allocate(
            mc,
            XmlNodeData::Element {
                script_object: None,
                parent: None,
                prev_sibling: None,
                next_sibling: None,
                tag_name,
                attributes,
                attributes_script_object: None,
                children: Vec::new(),
            },
        )))
    }
/// Construct an XML Element node from a `quick_xml` `BytesStart` event.
///
/// The returned node will always be an `Element`, and it must only contain
/// valid encoded UTF-8 data. (Other encoding support is planned later.)
Construct an XML Element node from a `quick_xml` `BytesStart` event.
The returned node will always be an `Element`, and it must only contain
valid encoded UTF-8 data. (Other encoding support is planned later.)
Construct an XML Element node from a ` quick_xml ` ` BytesStart ` event . The returned node will always be an ` Element ` and it must only contain valid encoded UTF - 8 data . ( Other encoding support is planned later . )
pub fn from_start_event<'a>(
        mc: MutationContext<'gc, '_>,
        bs: BytesStart<'a>,
        process_entity: bool,
    ) -> Result<Self, quick_xml::Error> {
        let tag_name = AvmString::new_utf8_bytes(mc, bs.name())?;
        let mut attributes = BTreeMap::new();
        for a in bs.attributes() {
            let attribute = a?;
            let value_bytes = if process_entity {
                attribute.unescaped_value()?
            } else {
                attribute.value
            };
            let value = AvmString::new_utf8_bytes(mc, value_bytes)?;
            let attr_key = AvmString::new_utf8_bytes(mc, attribute.key)?;
            attributes.insert(attr_key, value);
        }
        Ok(XmlNode(GcCell::allocate(
            mc,
            XmlNodeData::Element {
                script_object: None,
                parent: None,
                prev_sibling: None,
                next_sibling: None,
                tag_name,
                attributes,
                attributes_script_object: None,
                children: Vec::new(),
            },
        )))
    }
pub fn from_start_event < ' a > ( mc : MutationContext < ' gc , ' _ > , bs : BytesStart < ' a > , process_entity : bool , ) -> Result < Self , quick_xml :: Error > { let tag_name = AvmString :: new_utf8_bytes ( mc , bs . name ( ) ) ? ; let mut attributes = BTreeMap :: new ( ) ; for a in bs . attributes ( ) { let attribute = a ? ; let value_bytes = if process_entity { attribute . unescaped_value ( ) ? } else { attribute . value } ; let value = AvmString :: new_utf8_bytes ( mc , value_bytes ) ? ; let attr_key = AvmString :: new_utf8_bytes ( mc , attribute . key ) ? ; attributes . insert ( attr_key , value ) ; } Ok ( XmlNode ( GcCell :: allocate ( mc , XmlNodeData :: Element { script_object : None , parent : None , prev_sibling : None , next_sibling : None , tag_name , attributes , attributes_script_object : None , children : Vec :: new ( ) , } , ) ) ) }
Construct an XML Element node from a `quick_xml` `BytesStart` event.
Construct an XML Element node from a ` quick_xml ` ` BytesStart ` event .
mc
MutationContext<'gc, '_>
bs
BytesStart<'a>
process_entity
bool