473,396 Members | 1,757 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,396 software developers and data experts.

How can I accesss a value from a node?

108 100+
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <script type='text/javascript'>
  4.             var xml_modules;
  5.             xml_modules="<modules><module><code></code><tbl></tbl></module></modules>";
  6.             var xml_Doc_modules=loadString(xml_modules);
  7.             function loadString(txt)
  8.                     {
  9.                         var xml_Doc;
  10.                         try{
  11.                             xmlDoc=new ActiveXObject("Microsoft.XMLDOM")    ;
  12.                             xml_Doc.async="false";    
  13.                             xml_Doc.loadXML(txt);
  14.                             return xml_Doc;
  15.                             }
  16.                         catch(e)
  17.                             {
  18.                                 try{
  19.                                     parser=new DOMParser();
  20.                                     xml_Doc=parser.parseFromString(txt,"text/xml");    
  21.                                     xml_Doc.encoding='UTF-8';alert('sad');
  22.                                     return xml_Doc;
  23.  
  24.                                 }
  25.                                 catch(e){
  26.                                         alert(e.message);
  27.                                     }
  28.  
  29.                             }
  30.                         return (null);
  31.                     }
  32.  
  33.  
  34.                 function testxml(){
  35.                         root=xml_Doc_modules.childNodes[0];
  36.                         code_text1=document.createTextNode('codel');
  37.                         code_text=document.createTextNode('tbl');
  38.                         root.childNodes[0].childNodes[1].appendChild(code_text);alert(root.childNodes[0].childNodes[0].nodeValue);
  39.                         root.childNodes[0].childNodes[0].appendChild(code_text);alert(root.childNodes[0].childNodes[1].nodeValue);
  40.                         }
  41.         </script>
  42.     <body>
  43.         <button onclick='testxml()'>Preess me</button>
  44.     </body>
  45.     </html>
I jst implemented this script...I jst want o diaplay the values i jst appended to thsoe nodes...
I am getting a nulll value alll the time ....
Hw cn i solve this problem ???


Thanks in adv
With regards
Phpuser123
Apr 19 '10 #1
2 1624
Dormilich
8,658 Expert Mod 8TB
are you sure you didn’t mix up some indices?

Firebug can help you digging through your XML document.
Apr 19 '10 #2
jkmyoung
2,057 Expert 2GB
The node values of that entire structure will be the blank string, not null.
Are you looking for nodeValue or nodeName?
You've definitely messed up some indices otherwise.
Apr 19 '10 #3

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

Similar topics

15
by: Andy C | last post by:
I am new to python, so please bear with me if I am making some conceptual error. Basically I want to create a graph with an adjacency list representation, but I don't want any of the adjacency...
4
by: Tim:.. | last post by:
Hi Possibly a very simple question but how do I get a value out of an XML document so I can play with it in ASP E.G: <Name>Tom</Name How do I pull the work tom into asp Thanks
3
by: keepyourstupidspam | last post by:
Hi, I am using xerces dom C++, I want to change an element value, here is the code I am using but the element in the file is not getting updated. ... ... ... xercesc_2_4::DOMDocument*...
2
by: Urs Vogel | last post by:
Hi When using XmlDocument, I can create nodes and attributes as I like. What I didn't achieve is changing the Value of a node (created with createElement), it claims that it's the wrong node...
2
by: Rick | last post by:
I have an XML document that is generated from Infopath, I need to change the value of a namespace that is defined in a node in the form: <xsf:xDocumentClass "xmlns:my=valuehere">. when i navigate...
1
by: Dica | last post by:
hi all first off, i'm not trying to cross post, but couldn't find this newsgroup earlier (got here from a recommendation on microsoft.public.vb, where i originally posted this question). ...
0
by: XML newbie: Urgent pls help! | last post by:
ok, I changed "If node.Text = "Success" " to "If Not loginDom.InnerText Is Nothing ". Now, I don't get the NullReference error but the SessionID I see on screen is concatanated one. It looks...
0
by: XML newbie: Urgent pls help! | last post by:
HI, I am working on VB.Net.My program connects to the remote host, once the login values are verified, it sends the SessionID. My problem is Although in "Logindom" variable( in the Auto window),...
3
by: Goran Djuranovic | last post by:
Hi All, Does anyone know how to retreive deepest XPath value from XML document by using VB.NET? For example, if I had an XML file like this: <Root> <Customer> <Name>MyName</Name> </Customer>...
6
by: dtschoepe | last post by:
Hi all, Working on homework again... I've got a weird problem, I've been banging my head against the wall on what is causing it. I have a pointer to a typdef named Person. At one point in the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.