Re: creating xml document by Dave
Dave
Mon Nov 13 06:07:09 CST 2006
It works!!!! Thank you very much Anthony, you have got me out of a BIG hole
there!
Could you please just explain what you have done differently, and why
server.urlencode was the wrong way to go, and why response.write does not
work in this case? That would be much appreciated as I'm still learning in
this area!
What does DelegateList.Save Response actually do? Is this similar to
response.write?
Thanks
Dave
"Anthony Jones" <Ant@yadayadayada.com> wrote in message
news:eDLpnoxBHHA.4892@TK2MSFTNGP04.phx.gbl...
>
> "Dave" <david@nospam.co.uk> wrote in message
> news:byX5h.4972$371.4886@newsfe5-win.ntli.net...
>> Thanks for the reply Anthony
>>
>> I'll explain a little more, this is indeed an asp page that I use as
>> middleware between the database and flash.
>>
>> This is a list of names that is in the database that I need to get into
>> flash.
>>
>> So I use response.write to send the values back to flash.
>>
>> If I take out the server.urlencode statement then the asp page has an
> error
>> immediately saying "An invalid character was found in text content"
>>
>> Do you have any suggestions?
>>
>
> Ok it's getting muddier.
>
> Let me make guess.
>
> Flash is expecting XML.
> You build XML via a DOM.
> You then use Response.Write DelegateList.XML to send the content to the
> client.
>
> Have I guessed correctly? If so do this instead:-
>
> Response.ContentType = "text/xml"
> Response.CharSet = "UTF-8"
> DelegateList.Save Response
>
>
>
>
>> Many thanks
>>
>> Dave
>>
>> "Anthony Jones" <Ant@yadayadayada.com> wrote in message
>> news:ui2BdVRBHHA.4568@TK2MSFTNGP04.phx.gbl...
>> >
>> > "Dave" <david@nospam.co.uk> wrote in message
>> > news:jb15h.11951$hK2.3552@newsfe3-win.ntli.net...
>> >> I'm trying to create an xml document with values from a database, but
>> >> have
>> >> the following problem.
>> >>
>> >> Many of the items in the database contain characters from the extended
>> >> charcter set (I think that is the correct phrase!) and when i try to
>> > create
>> >> my xml it throws an error unless i have the server.urlencode statement
>> >>
>> >> dim DelegateList,dqt,dtd,DelegateListElement
>> >> dqt = chr(34)
>> >> Set DelegateList = Server.Createobject("MSXML.DOMDocument")
>> >> Set dtd = DelegateList.createProcessingInstruction("xml", "version="
> &
>> > dqt
>> >> & "1.0" & dqt )
>> >> DelegateList.appendChild dtd
>> >> Set DelegateListElement =
>> >> DelegateList.createElement("delegate_details")
>> >> DelegateList.appendChild DelegateListElement
>> >>
>> >> 'some database stuff
>> >>
>> >> Do Until adoRS.EOF
>> >> vCOUNT=vCOUNT+1
>> >> set recElement = DelegateList.createElement("delegate")
>> >> for i = 0 to adoRS.Fields.Count - 1
>> >> recElement.setAttribute adoRS(i).name,
>> > server.urlencode(adoRS(i).value)
>> >> DelegateList.lastChild.appendChild recElement
>> >> next
>> >> adoRS.MoveNext
>> >> Loop
>> >>
>> >> If I don't have server.urlencode then it immediately doesn't work, but
>> > when
>> >> I do have server.urlencode it seems to translate some of the
>> >> characters
>> >> incorrectly. For example "Ö" becomes %D6 but it should become %C3%96
>> >>
>> >> Could anyone please steer me in the correct direction.
>> >
>> > Firstly thing stop using urlencode. The XML will encode characters
>> > correctly.
>> >
>> > Other than that we need to see what you do with the DOM once you've
> built
>> > it?
>> > Is this in ASP?
>> >
>> >
>> >>
>> >> Many thanks
>> >>
>> >> Dave
>> >>
>> >>
>> >
>> >
>>
>>
>
>