How to use parseXML method - class XML

How can I create and parse an xml file in Actionscript 2 using parsexml method?



The following example creates and parses an XML packet: 
  //The following example creates and parses an XML packet:

var xml_str =
"<state name="California">
<city>San Francisco</city></state>"

// Defining the XML source within the XML constructor:
var my1_xml = new XML(xml_str);
trace(my1_xml.firstChild.attributes.name); // output: California

// Defining the XML source using the XML.parseXML method:
var my2_xml = new XML();
my2_xml.parseXML(xml_str);
trace(my2_xml.firstChild.attributes.name); 
// output: California




The error I receive:

How can I modify my code in order to suppress errors?

Thanks in advance for your support!