asp writing to xml with cdata

Results 1 to 2 of 2

Thread: asp writing to xml with cdata

  1. #1
    Join Date
    Dec 1969

    Default asp writing to xml with cdata

    I have an xml file that I created that has some CDATA values for some of the nodes. Using ASP I am trying to write to these XML files and I can successfully write to each of the nodes, however when I write to the nodes with CDATA, the CDATA tags get overwritten.<BR><BR>I am using this to write to the node:<BR>objPage.selectSingleNode("thisnode").text = "this text"<BR><BR>Any hep?

  2. #2
    Join Date
    Dec 1969

    Default RE: asp writing to xml with cdata

    Let&#039;s say this is your xml file:<BR><BR>&#060;root&#062;<BR> &#060;thisnode&#062;<BR> &#060;![CDATA[old text]]&#062;<BR> &#060;/thisnode&#062;<BR>&#060;/root&#062;<BR><BR>When you set the text property of thisnode you will overwrite *everything* inside that node, indeed also the cdata tags.<BR><BR>If you want to change the text of the cdata section, you can try something like this:<BR><BR>objPage.selectSingleNode("thisnode"). firstChild.text = "this text"<BR><BR>or<BR><BR>objPage.selectSingleNode("t hisnode/*").text = "this text"<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts