Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6783007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:48:46+00:00 2026-05-26T16:48:46+00:00

I have a dilemma that goes like this. I have a string that represents

  • 0

I have a dilemma that goes like this.

I have a string that represents XML. I want to manipulate that XML adding and updating nodes, and then I want the xml back as a string.

I have been working with javascript and jQuery and I have looked at several methods

WITH JQuery

var x_raw = "<?xml version='1.0'?><Q id ='23'><SQ id='201'><GP id='0'></GP></SQ></Q>"
var j_xml = $(x_raw)
.... Code for XML manipulation goes here ....
var x_string = (new XMLSerializer()).serializeToString(j_xml);

this produces a security exception in firebug

WITH Straight javascript

var x_raw = "<?xml version='1.0'?><Q id ='23'><SQ id='201'><GP id='0'></GP></SQ></Q>"
var xml = $.parseXML(x_raw);

newNode = xml.createElement("VALUE")
newText = xml.createTextNode("<![CDATA[Whooppeee]]>");

var insert = xml.getElementsByTagName('GP')[0].appendChild(newNode)
insert = insert.appendChild(newText)

var x_string = (new XMLSerializer()).serializeToString(xml);

This works but the CDATA code comes back as

&lt;![CDATA[Whoooppeee]] &gt;

I have tried the javascript escape trick

newText = xml.createTextNode("\<![CDATA[Whooppeee]]\>")

doesn’t work either

WITH jQuery traversal function on an XML Document…

var x_raw = "<?xml version='1.0'?><Q id ='23'><SQ id='201'><GP id='0'></GP></SQ></Q>"
var xml = $.parseXML(x_raw);
var collection = xml.filter("SQ")

produces a firebug error “xml.filter is not a function”
Any jQuery DOM traversal function produces the same error.

I am ready to resort to string manipulation functions which would be ugly!
So any help or hints that get me some logical outcome would very much appreciated.

Regards
with much gratitude and appreciation of the collective wisdom of the overflow crew !

Gus

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:48:47+00:00Added an answer on May 26, 2026 at 4:48 pm

    Try createCDATASection()

    newText = xml.createCDATASection("Whooppeee");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, my dilemma is this. I have an admin page that I use to
I have a dilemma that I've encountered before. What's the best in terms of
I have a little dilemma that maybe you can help me sort out. I've
I ran into an interesting dilemma today. I have a function that handles information
We have a dilemma; developing desktop application using Matisse or Jigloo.. Matisse has this
I have a dilemma with this one. With the following code I am able
I'm having a dilemma. I have a field hashedX that is a hashed/salted value
I have a pretty interesting dilemma that is giving me a hurricane of a
I am developing app that has multiple skins and I have a dilemma on
The problem I'm running into the typical virtual-directory dilemma in that you have some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.