So I created a temporary xml sheet just to test something:

<data>
        <data_id id="5310482"/>
</data>

501                 function initialize() {
    502                     if (GBrowserIsCompatible()) {
    503                         GDownloadUrl("../output/search/
temp.xml", function(data) {
    504                             var xml = GXml.parse(data);
    505                             var dataId =
xml.documentElement.getElementsByTagName("data_id");
    506                             alert(parseInt(dataId
[0].getAttribute("id")));

and that works - I get a value.

But it would be stupid for me to reformat my XML output from my
database...

this is my code for converting my db query in perl to xml.

394         my $out = XML::Handler::YAWriter->new (AsFile => "/web/
seabass/output/search/results.xml");
    395         my $gen = XML::Generator::DBI->new (
    396                                         Handler => $out,
    397                                         dbh=>$dbh,
    398                                         Indent=>1
    399                                     );
    400         $gen->execute($sth);
    401         $dbh->disconnect();



On Nov 14, 9:22 am, p00kie <[EMAIL PROTECTED]> 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>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to