avm2+tests: Support CData in XML.toXMLString; add test
This commit is contained in:
parent
f24aabf74e
commit
2d02886f5a
|
@ -681,10 +681,15 @@ fn to_xml_string_inner<'gc>(xml: E4XOrXml<'gc>, buf: &mut WString) -> Result<(),
|
|||
}
|
||||
E4XNodeKind::Attribute(_)
|
||||
| E4XNodeKind::Comment(_)
|
||||
| E4XNodeKind::ProcessingInstruction(_)
|
||||
| E4XNodeKind::CData(_) => {
|
||||
| E4XNodeKind::ProcessingInstruction(_) => {
|
||||
return Err(format!("ToXMLString: Not yet implemented node {:?}", node_kind).into())
|
||||
}
|
||||
E4XNodeKind::CData(data) => {
|
||||
buf.push_utf8("<![CDATA[");
|
||||
buf.push_str(data);
|
||||
buf.push_utf8("]]>");
|
||||
return Ok(());
|
||||
}
|
||||
E4XNodeKind::Element {
|
||||
children,
|
||||
attributes,
|
||||
|
|
|
@ -61,6 +61,7 @@ CDATA
|
|||
]]>;
|
||||
|
||||
trace(cdata);
|
||||
trace(cdata.toXMLString());
|
||||
|
||||
var declaration_doctype = new XML("<?xml version = \"1.0\" encoding = \"UTF-8\" standalone = \"yes\" ?> <!DOCTYPE person [<!ELEMENT name (#PCDATA)> ]> <p>Skipped everything else</p>");
|
||||
trace(declaration_doctype.toString());
|
||||
|
|
|
@ -22,6 +22,10 @@ My
|
|||
Multiline
|
||||
CDATA
|
||||
|
||||
<![CDATA[My
|
||||
Multiline
|
||||
CDATA
|
||||
]]>
|
||||
Skipped everything else
|
||||
Text after comments and PI
|
||||
Empty lists: 0 0
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue