So I tried a more direct approach to this problem:

function stateChanged()
{
if (xmlHttp.readyState==4)
{
if (xmlHttp.responseXML==null)alert("Null");
var xmlDoc=xmlHttp.responseXML.documentElement;
document.getElementById("companyname").innerHTML=
xmlDoc.getElementsByTagName("compname")[0].childNodes[0].nodeValue;
document.getElementById("contactname").innerHTML=
xmlDoc.getElementsByTagName("contname")[0].childNodes[0].nodeValue;
document.getElementById("address").innerHTML=
xmlDoc.getElementsByTagName("address")[0].childNodes[0].nodeValue;
document.getElementById("city").innerHTML=
xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue;
document.getElementById("country").innerHTML=
xmlDoc.getElementsByTagName("country")[0].childNodes[0].nodeValue;
}
}

The responseXML is always null so the line after the alert box always
crashes.

Here is the response handler I'm using:

class getANote(webapp.RequestHandler):
    def get(self):
        #query=Models.NoteModel.all()
        #fnote=query.get()

        self.response.out.write('''<?xml version='1.0'
encoding='ISO-8859-1'?>
<company>
<compname>Foo</compname>
<contname>bar</contname>
<address>ball</address>
<city>bwal</city>
<country>XD</country>
</company>
''')

The xml is said well formatted using w3c validator. Now what I'm doing
wrong, is this a app engine error? Help please!


On Mar 20, 9:53 pm, Marcelo Sena <[email protected]> wrote:
> Here is my model:
> class NoteModel(db.Model):
>     title = db.StringProperty(multiline=False)
>     content = db.ListProperty(type('string'))
> And the values are:
> title:'Foo'
> content: ['bar']
>
> And the result of:
>
> class getANote(webapp.RequestHandler):
>     def get(self):
>         query=Models.NoteModel.all()
>         fnote=query.get()
>         xmlrep=fnote.to_xml()
>
>         self.response.out.write(xmlrep)
>
> called from:
>
> function stateChanged()
> {
>         if (xmlHttp.readyState==4)
>         {
>                 var xmlDoc=xmlHttp.responseXML;
>                 document.getElementById("txtHint").innerHTML=xmlDoc;
>
>         }
>
> }
>
> But the result is:
>
> Exactly, nothing. What am I doing wrong?
>
> On Mar 20, 4:25 pm, Marcelo Sena <[email protected]> wrote:
>
> > I know what the docs say, but what kind of xml is that, is a string or
> > a object and what is the type of that object? I tried  using type() on
> > it and it returned nothing.
> > I need to turn my model into a XML to use it in a javascript.
> > Regards,
> > Marcelo Sena.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to