Посмотрите документы AS3 по классам XML и XMLNode . Вероятно, вы можете реализовать простой загрузчик (в зависимости от того, как выглядит ваша XML-схема, если она у вас еще есть), циклически обходя уровни дерева узлов вручную и загружая содержимое и атрибуты узлов по мере необходимости.
Редактировать: Обнаружен мой XML-код для анализа объекта:
public function xml2Object(baseNode:XMLNode):Object {
var xmlObject:Object = new Object;
// attributes
var attribs:Object;
for (var attribName:String in baseNode.attributes) {
if (attribs == null)
attribs = new Object;
attribs[attribName] = parseXMLValue(baseNode.attributes[attribName]);
}
if (attribs != null)
xmlObject["_attrib"] = attribs;
// children
for (var childNode:XMLNode = baseNode.firstChild; childNode != null; childNode = childNode.nextSibling) {
// if its a text node, store it and skip element parsing
if (childNode.nodeType == 3) {
xmlObject["_text"] = parseXMLValue(childNode.nodeValue);
continue;
}
// only care about elements from here on
if (childNode.nodeType != 1)
continue;
// parse child element
var childObject:Object = xml2Object(childNode);
// no child exists with node's name yet
if (xmlObject[childNode.nodeName] == null)
xmlObject[childNode.nodeName] = childObject;
else {
// child with same name already exists, lets convert it to an array or push on the back if it already is one
if (!(xmlObject[childNode.nodeName] instanceof Array)) {
var existingObject:Object = xmlObject[childNode.nodeName];
xmlObject[childNode.nodeName] = new Array();
xmlObject[childNode.nodeName].push(existingObject);
}
xmlObject[childNode.nodeName].push(childObject);
}
}
return xmlObject;
}
public function parseXMLValue(value:String):Object {
if (parseFloat(value).toString() == value)
return parseFloat(value);
else if (value == "false")
return false;
else if (value == "true")
return true;
return value;
}
xml2Object превратится:
<some_object>
<sub_object someAttrib="example" />
<sub_object anotherAttrib="1">
<another_tag />
<tag_with_text>hello world</tag_with_text>
</sub_object>
<foo>bar</bar>
</some_object>
в:
{
some_object:
{
sub_object:
[
{
_attrib:
{
someAttrib: "example"
}
},
{
tag_with_text:
{
_text: "hello world"
},
another_tag:
{
},
_attrib:
{
anotherAttrib: 1
}
}
],
foo:
{
_text: "bar"
}
}
}