Forum Moderators: open

Message Too Old, No Replies

Asp Generated XML

Ado ASP issue

         

Krapulator

1:55 am on Oct 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Peoples,

You'll have to forgive my ignorance. I am new new new to xml and only have a few months experience in ADO and ASP. I wish to create a dynamically dirven XML document - which seems to work fine except for the f#@%@$#$% ampersand character.

Is it possible to conduct a search and replace on the entire recordset once I open it. (vbscript)

Any help would be muchly appreciated

Thanks,

James

DaveAtIFG

4:25 pm on Oct 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey Krapulator, you've chosen a colorful nick, welcome to WebmasterWorld! Frankly, I don't know an ADO from an elbow but I'll try to round up a little help for you by posting in the Mods forum. We've got a very talented crew. Many of our regulars are pretty sharp on XML questions too. Any of you have any suggestions for this gentleman?

korkus2000

4:54 pm on Oct 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld Krapulator,

What database are you using?
What xml parser are you using?

You can use the replace() function in a loop with an array built from the getrows command. I am not going to say it will be fast.

Dreamquick

5:23 pm on Oct 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you were using the MSXML parser/DOM then that's smart/irritating enough to translate a raw & into & before it stores it, but from the sound of it I guess you aren't.

Obvious solutions;

1) Assuming you are pulling data from a SQL capable db, use a query to extract the data, include a REPLACE function on each field you want returned.

*or*

2) Create a simple wrapper function to be used in between getting the data from the db and actually storing / writing it.

*or*

3) Use something which can pull data from the native format into plain XML on your behalf, hopefully this should be smart enough to translate problem characters for you.

Also have you considered that if you are writing out not just elements but attributes then a rogue quote inside attribute text could also break your XML, this is why I favour 2) when 1) isn't available.

- Tony

Krapulator

6:43 am on Oct 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you all.

The search & replace loop on each field worked.

I just thought it would be nice if you could do a comprehensive search and replace on a whole recordset with one line of code.