Forums > Javascript

XML error

March 25, 2007 | 1:48 am

Hi,
Anyone know why its returning the jsobject bit and not the attribute?

I’m using the library and the wc3dom library.

http://xmljs.sourceforge.net/

This is from the max window:
print: jsobject 22669296

Here is the code:

function loadFile(filePath)
{
file = new File(filePath);
xml = file.readstring(9999999);

//instantiate the W3C DOM Parser
parser = new DOMImplementation();

//load the XML into the parser and get the DOMDocument
domDoc = parser.loadXML(xml);

//get the root node (in this case, it is SAMPLES)
docRoot = domDoc.getDocumentElement();

//get the first "Key" element
firstTag1 = docRoot.getChildNodes().item(0);

//display the data
alert = firstTag1.getAttributes().item(0).getNodeValue();

outlet(0,alert);
}

Thanks,
Casey


March 26, 2007 | 7:22 pm

On Mar 24, 2007, at 6:48 PM, casey basichis wrote:

> Anyone know why its returning the jsobject bit and not the attribute?
> This is from the max window:
> print: jsobject 22669296
>
> //display the data
> alert = firstTag1.getAttributes().item(0).getNodeValue();
> outlet(0,alert);

It would mean that the alert object is something other than a String,
Array, or Number object. These are the only entities which are
automatically converted. You’ll want to investigate further the xmljs
library to determine what methods you’ll want to call to convert the
object to one of these classes. Perhapt there’s a toString() method
or something similar.

-Joshua


Viewing 2 posts - 1 through 2 (of 2 total)