473,387 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

String to XML

RamananKalirajan
608 512MB
I am currently working on a Typical Project, in which I have a requirement such that i have to fetch a data which is in CLOB format that holds XML Element. I am passing that value as a String to Javascript through AJAX. My need is I have to convert that String to XML or use that String and print the XML data in a Table dynamically Please can any one help me in doing so

Thank You,
Ramanan
Mar 7 '08 #1
5 1544
acoder
16,027 Expert Mod 8TB
If you're using Ajax, make sure the XML is valid and use responseXML.

If you have problems, post your code.
Mar 7 '08 #2
RamananKalirajan
608 512MB
If you're using Ajax, make sure the XML is valid and use responseXML.

If you have problems, post your code.

Thank you very much sir, I had did this by using the following code

Expand|Select|Wrap|Line Numbers
  1. var temp=http.getAttribute("empxml");
  2. if (window.ActiveXObject)
  3.   {
  4.   var doc=new ActiveXObject("Microsoft.XMLDOM");
  5.   doc.async="false";
  6.   doc.loadXML(temp);
  7.  alert("converted");
  8.   }
  9. // code for Mozilla, Firefox, Opera, etc.
  10. else
  11.   {
  12.   var parser=new DOMParser();
  13.   var doc=parser.parseFromString(temp,"text/xml");
  14.   }
  15.  
  16.  
  17. var _root = doc.getElementsByTagName("emp").item(0);
  18. var rows = _root.getElementsByTagName("pname");
  19. var projName=rows[0].firstChild.nodeValue;
  20. alert(projName);
  21. document.getElementById("pname").innerHTML=projName;
  22. var release=_root.getElementsByTagName("r");
  23.  
  24.     var _dhtml="<select name='relsel' id='relsel'>";    
  25.             for(var _n=0;_n<release.length;_n++)
  26.             {
  27.                 alert( release[_n].firstChild.nodeValue);
  28.                 _dhtml+="<option val='"+_n+"'>"+ release[_n].firstChild.nodeValue+"</option>";
  29.  
  30.             }
  31.     _dhtml+="</select>"
  32.  
  33.     document.getElementById("reldiv").innerHTML=_dhtml;
  34. }

Thank you
Mar 10 '08 #3
acoder
16,027 Expert Mod 8TB
OK, so what happens with that code? How much of it is working as you want? What's not working? What errors have you got if any?
Mar 10 '08 #4
RamananKalirajan
608 512MB
OK, so what happens with that code? How much of it is working as you want? What's not working? What errors have you got if any?

It's working good I am not having any error on it. Thank You Sir
Mar 11 '08 #5
acoder
16,027 Expert Mod 8TB
It's working good I am not having any error on it. Thank You Sir
Oh right. I misunderstood your post. Glad to see that it's working.
Mar 11 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Krakatioison | last post by:
My sites navigation is like this: http://www.newsbackup.com/index.php?n=000000000040900000 , depending on the variable "n" (which is always a number), it will take me anywhere on the site......
5
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it...
9
by: John F Dutcher | last post by:
I use code like the following to retrieve fields from a form: recd = recd.append(string.ljust(form.getfirst("lname",' '),15)) recd.append(string.ljust(form.getfirst("fname",' '),15)) etc.,...
10
by: Angus Leeming | last post by:
Hello, Could someone explain to me why the Standard conveners chose to typedef std::string rather than derive it from std::basic_string<char, ...>? The result of course is that it is...
2
by: Andrew | last post by:
I have written two classes : a String Class based on the book " C++ in 21 days " and a GenericIpClass listed below : file GenericStringClass.h // Generic String class
29
by: zoro | last post by:
Hi, I am new to C#, coming from Delphi. In Delphi, I am using a 3rd party string handling library that includes some very useful string functions, in particular I'm interested in BEFORE (return...
2
by: Badass Scotsman | last post by:
Hello, Using VB and ASP,NET I would like to be able to search a STRING for a smaller STRING within, based on the characters which appear before and after. For example: String1 = " That was...
15
by: morleyc | last post by:
Hi, i would like to remove a number of characters from my string (\t \r \n which are throughout the string), i know regex can do this but i have no idea how. Any pointers much appreciated. Chris
11
by: ramu | last post by:
Hi, Suppose I have a string like this: "I have a string \"and a inner string\\\" I want to remove space in this string but not in the inner string" In the above string I have to remove...
8
by: drjay1627 | last post by:
hello, This is my 1st post here! *welcome drjay* Thanks! I look answering questions and getting answers to other! Now that we got that out of the way. I'm trying to read in a string and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.