core: Implement XML.toString for comments and processing instructions
This commit is contained in:
parent
af1cb4ebd9
commit
db7c6dec00
|
@ -649,7 +649,9 @@ impl<'gc> E4XNode<'gc> {
|
|||
|
||||
return Ok(to_xml_string(E4XOrXml::E4X(*self), activation));
|
||||
}
|
||||
other => Err(format!("XML.toString(): Not yet implemented for {other:?}").into()),
|
||||
E4XNodeKind::Comment(_) | E4XNodeKind::ProcessingInstruction(_) => {
|
||||
return Ok(to_xml_string(E4XOrXml::E4X(*self), activation));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package {
|
||||
package {
|
||||
import flash.display.Sprite;
|
||||
public class Test extends Sprite { }
|
||||
}
|
||||
|
||||
// FIXME: Implement indentation.
|
||||
XML.prettyPrinting = false;
|
||||
XML.ignoreComments = false;
|
||||
XML.ignoreProcessingInstructions = false;
|
||||
|
||||
var xml = <animal id="1">Cow</animal>
|
||||
trace("xml.toString(): " + xml.toString());
|
||||
|
@ -20,3 +22,9 @@ trace("xml.toString(): " + xml.toString());
|
|||
|
||||
xml = <foo><bar x="a"b">>&<</bar></foo>;
|
||||
trace("xml.toString(): " + xml.toString());
|
||||
|
||||
xml = <!-- some comment -->;
|
||||
trace("xml.toString(): " + xml.toString());
|
||||
|
||||
xml = <? processing instruction! ?>;
|
||||
trace("xml.toString(): " + xml.toString());
|
||||
|
|
|
@ -2,3 +2,5 @@ xml.toString(): Cow
|
|||
xml.toString(): <animals><animal id="1">Cow</animal><animal id="2">Pig</animal></animals>
|
||||
xml.toString(): <foo><bar a="x" b="y" c="z"/></foo>
|
||||
xml.toString(): <foo><bar x="a"b">>&<</bar></foo>
|
||||
xml.toString(): <!-- some comment -->
|
||||
xml.toString(): <? processing instruction! ?>
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue