I am trying to get value of ‘title’ attribute from the following xml:
<?xml version="1.0"?>
<smil xmlns="http://www.w3.org/2001/SMIL20/Language" xmlns:rn="http://features.real.com/2001/SMIL20/Extensions">
<head>
<meta name="base" content="../01_Uvod_01/" />
</head>
<body>
<par title="Uvod u otvoreno racunarstvo">
</par>
</body>
</smil>
using the E4X sintax with the following AS 3.0 code:
var myXML:XML = new XML();
var XML_URL: String = "example.exl"
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded (eventObj:Event):void{
myXML = new XML(myLoader.data);
trace ("XML Loaded");
trace(body.par.@title);
}
but that works only if my input ‘example.xml’ file is without namespace attribute in it like this:
<smil>
<head>
<meta name="base" content="../01_Uvod_01/" />
</head>
<body>
<par title="Uvod u otvoreno racunarstvo">
</par>
</body>
</smil>
The problem is that i have to parse the input file the way it is (with namespace attribute in it) but i don’t know what’s the problem and why can’t i parse it this way? Can someone please help?
thank you