you need to get the text node that is a child of data_id then get its value
you prob need to try something like:
dataId[0].firstChild.nodeValue
p00kie wrote:
> Anyways. I'm not sure what the problem is.
>
> 501 function initialize() {
> 502 if (GBrowserIsCompatible()) {
> 503 GDownloadUrl("../output/search/
> results.xml", function(data) {
> 504 var xml = GXml.parse(data);
> 505 var dataId =
> xml.documentElement.getElementsByTagName("data_id");
> 506 alert(dataId[0].getAttribute());
>
> I believe that line 506 should work and print out the data that I
> want. I know there's nothing wrong with line 503 and 504. Either
> something is wrong in 505 or 506.
>
> getting the attribute of dataId[0] should not be printing out null...
>
>
>
> On Nov 14, 8:44 am, p00kie <[EMAIL PROTECTED]> wrote:
>
>> Hi VizGuy,
>>
>> Actually what I am doing totally has to do with the Google
>> Visualization API.
>>
>> 1. I am using GXml in place of XMLHttpRequest as per Google's sample
>> code:http://code.google.com/apis/maps/documentation/services.html
>> 2. Don't look at it as something for the Google Maps API (although
>> essentially the maps portion is a gadget of the google visualization
>> api).
>> 3. This is a read in of an xml file (a.k.a. reading in a file source).
>>
>> I'm sure many others are doing the same sort of thing if not similar.
>> I would like to figure out this method without PHP.
>>
>> On Nov 13, 6:25 pm, VizGuy <[EMAIL PROTECTED]> wrote:
>>
>>
>>> I am not sure what you are trying to do, but I am quite sure this is not the
>>> right group to post this question to, as it has nothing to do with the
>>> Google Visualization API. Does it...?
>>>
>>> VizGuy
>>>
>>> On Thu, Nov 13, 2008 at 10:20 PM, p00kie <[EMAIL PROTECTED]> wrote:
>>>
>>>> Attempting to parse this info:
>>>>
>>>> if (GBrowserIsCompatible()) {
>>>> 503 GDownloadUrl("../output/search/
>>>> results.xml", function(data) {
>>>> 504 var xml = GXml.parse(data);
>>>> 505 var dataId =
>>>> xml.documentElement.getElementsByTagName("data_id");
>>>> 506 alert(dataId[0].getAttribute());
>>>>
>>>> Trying to get the first element of this - on:
>>>>
>>>> 1. alert(dataId[0].getAttribute()) - i get alert that says "null"
>>>> 2. alert(dataId[0]) - i get "[object element]"
>>>> 3. alert(dataId) - i get "[object nodelist]
>>>>
>>>> how do i get the actual value?
>>>>
>>>> once again:
>>>>
>>>> this is my xml:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?><database>
>>>> <select>
>>>> <row>
>>>> <data_id>5310482</data_id>
>>>> </row
>>>> </select>
>>>> </database>
>>>>
>>>> On Nov 13, 12:42 pm, p00kie <[EMAIL PROTECTED]> wrote:
>>>>
>>>>> Hi:
>>>>>
>>>>> GDownloadUrl("../output/search/results.xml", function
>>>>> (data) {
>>>>> 503 var xml = GXml.parse(data);
>>>>> 504 var dataId =
>>>>> xml.documentElement.getElementsByTagName("data_id");
>>>>> 505 for (var i = 0; i < dataId.length; i++) {
>>>>> 506 var di = dataId[i];
>>>>> 507 document.write(di);
>>>>> 508 // alert(di);
>>>>> 509 }
>>>>> 510 // alert(dataId);
>>>>> 511 // print(dataId);
>>>>> 512 }
>>>>>
>>>>> trying to parse this xml document and print out to html / alert /
>>>>> whatever - no success
>>>>>
>>>>> this is the format of the xml:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?><database>
>>>>> <select>
>>>>> <row>
>>>>> <data_id>5310482</data_id>
>>>>> </row
>>>>> </select>
>>>>> </database>
>>>>>
> >
>
--
MINDsweep
25 albany street
edinburgh - UK - eh1 3qn
m: 07786984428
MINDsweep www.mindsweep.net is a division of c2sky services limited
www.c2sky.net
This e-mail may contain confidential information. It is intended solely
for the attention of the designated recipient(s). If you are not the
intended recipient, you must not make any use of the information
contained in the e-mail or cause or allow anyone to do so. Please
contact the sender immediately and delete the message.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en
-~----------~----~----~----~------~----~------~--~---