![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Parse XML returns the CDATA actual tag as string Hi, I have an XML like the one below received as POST parameter. <set_info> <pages save_set="new"> <page url="http://www.fueleconomy.gov/feg/bestworstEPAtrucks.htm"> <title>![CDATA[Most and Least Fuel Efficient Trucks]]</title> <description>![CDATA[Most and Least Fuel Efficient Trucks]]</ description> </page> </pages> </set_info> When I try to parse it (see code below), the title and descriptions values are returned with the word ![CDATA[...]]. Should the DOM parser ignore it?? Set oPageNodes = xmlDoc.SelectNodes("set_info//pages//page") for each oPage in oPageNodes set oTitle = oPage.SelectSingleNode("title") page_title = HTMLDecode(oTitle.firstchild.data) set oDesc = oPage.SelectSingleNode("description") page_desc = HTMLDecode(oDesc.firstchild.data) next Printing page_title returns ![CDATA[Most and Least Fuel Efficient Trucks]] instead of Most and Least Fuel Efficient Trucks What am I doing wrong? Thanks, Gabi! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Parse XML returns the CDATA actual tag as string Gabriela schrieb: Quote: > Hi, > I have an XML like the one below received as POST parameter. > > <set_info> > <pages save_set="new"> > <page url="http://www.fueleconomy.gov/feg/bestworstEPAtrucks.htm"> > <title>![CDATA[Most and Least Fuel Efficient Trucks]]</title> <title><![CDATA[Most and Least Fuel Efficient Trucks]]></title> [...] |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Parse XML returns the CDATA actual tag as string On Dec 9, 10:11 am, "ekkehard.horner" <ekkehard.hor...@xxxxxx> wrote: Quote: > Gabriela schrieb:> Hi, Quote: > > I have an XML like the one below received as POST parameter. Quote: > > <set_info> > > <pages save_set="new"> > > <page url="http://www.fueleconomy.gov/feg/bestworstEPAtrucks.htm"> > > <title>![CDATA[Most and Least Fuel Efficient Trucks]]</title> > CDATA is a node/element - so > <title><![CDATA[Most and Least Fuel Efficient Trucks]]></title> > > [...] <set_info> <pages save_set="new"> <page url="http://www.fueleconomy.gov/feg/ bestworstEPAtrucks.htm"> <title>![CDATA[Most and Least Fuel Efficient Trucks]]</title> <description>![CDATA[Most and Least Fuel Efficient Trucks]]</ description> </page> </pages> </set_info> Thanks, Gabi. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Parse XML returns the CDATA actual tag as string Gabriela schrieb: Quote: > On Dec 9, 10:11 am, "ekkehard.horner" <ekkehard.hor...@xxxxxx> > wrote: Quote: >> Gabriela schrieb:> Hi, Quote: > Isn't it just the schema I've written above? compare Quote: Quote: >> <title><![CDATA[Most and Least Fuel Efficient Trucks]]></title> Quote: > <title>![CDATA[Most and Least Fuel Efficient Trucks]]</title> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Find a string within a variable string | PowerShell | |||
| problems with $var | select-string -pattern $string -q | PowerShell | |||
| How export-csv deals with string versus string[] | PowerShell | |||
| String PRODUCT_NAME was not found in string table | Vista General | |||
| cdata-secstion question | PowerShell | |||