


Use javascript to read xml files and read node data_javascript skills
The following code is to read node data, and in another case, it is to read node attribute data.
<head> <title></title> <script type="text/javascript"> var objLength = null; var xmlHttp; var strurl = ""; function ajaxrequst() { if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else { xmlHttp = new XMLHttpRequest(); } try { strurl = "/data/rdzz.xml"; xmlHttp.onreadystatechange = LoadXmlFile; xmlHttp.open("GET", strurl + "?time=" + (new Date()).getTime(), true); xmlHttp.send(null); } catch (e) { } } function LoadXmlFile() { var content = ""; if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { var xmlDOM = xmlHttp.responseXML; var xmlRoot = xmlDOM.documentElement; try { var objLength = xmlRoot.getElementsByTagName("Item"); for (var i = 0; i < objLength.length; i++) { var elementtitle = objLength[i].getElementsByTagName('NewsTitle')[0]; var elementtime = objLength[i].getElementsByTagName('NewsTime')[0]; var elementurl= objLength[i].getElementsByTagName('NewsUrl')[0]; // LastValue = objLength[i].getAttribute( "LastValue" ) // Prediction = objLength[i].getAttribute( "Prediction" ) // Actual = objLength[i].getAttribute( "Actual" ) // importance = objLength[i].getAttribute( "importance" ) // newstime = objLength[i].getAttribute( "NewsTime" ) var title = elementtitle.textContent || elementtitle.text; var time = elementtime.textContent || elementtime.text; var url = elementurl.textContent || elementurl.text; content += "<li><dl><dd>" + time + "</dd><dd><a href='" + url + "' target='blank'>" + title + "</a></dd></dl></li>"; } document.getElementById("newsInfo").innerHTML = content; } catch (e) { } } } } </script> </head> <body> <input id="Button1" type="button" value="read" onclick="ajaxrequst()" /> <div id="newsInfo"></div> </body>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Common XML file opening methods: 1. Text editor; 2. Browser; 3. XML editor; 4. Integrated development environment; 5. Microsoft Excel, etc.

XML files are a markup language used to describe and transmit data. It is known for its scalability, readability, and flexibility and is widely used in web applications, data exchange, and web services. The format and structure of XML make the organization and interpretation of data simple and clear, thereby improving the efficiency of data exchange and sharing.

When doing computer programming, sometimes it is necessary to find the minimum weight of a subtree originating from a specific node, provided that the subtree cannot contain nodes that are more than D units away from the specified node. This problem arises in various fields and applications, including graph theory, tree-based algorithms, and network optimization. A subtree is a subset of a larger tree structure, with the specified node serving as the root node of the subtree. A subtree contains all descendants of the root node and their connecting edges. A node's weight refers to a specific value assigned to that node, which can represent its importance, significance, or other relevant metrics. In this problem, the goal is to find the minimum weight among all nodes in a subtree while limiting the subtree to nodes that are at most D units away from the root node. In the following article, we will delve into the complexity of mining minimum weights from subtrees

XML files generally refer to files with extensible markup language written in them. XML is extensible markup language, a subset of standard universal markup language. It is a markup language used to mark electronic documents to make them structural.

How to implement the node copy and cut functions of mind maps through Vue and jsmind? Mind map is a common thinking tool that can help us organize our thoughts and sort out our thinking logic. The node copy and cut functions are commonly used operations in mind maps, which allow us to reuse existing nodes more conveniently and improve the efficiency of thinking organization. In this article, we will use the two tools Vue and jsmind to implement the node copy and cut functions of the mind map. First, we need to install Vue and jsmind and create

The methods for deleting nodes in js are: 1. The removeChild() method is used to remove the specified child node from the parent node. It requires two parameters. The first parameter is the child node to be deleted, and the second parameter is the parent node. Node; 2. The parentNode.removeChild() method can be called directly through the parent node to delete the child node; 3. The remove() method can directly delete the node without specifying the parent node; 4. The innerHTML attribute is used to delete the node. content.

The method to open an XML Extensible Markup Language file is: 1. Install a text editing software on your computer; 2. Open the text editing software, and then select "File" -> "Open" in the menu; 3. In the pop-up file In the browser window, find the XML file you want to open, select it and click "Open"; 4. The system will use the text editing software of your choice to open the XML file and display its content.

C++ has a macro, which is defined as a piece of code or an expected value, and it will be reused whenever the user needs it. The Floyd-Walshall algorithm is the process of finding the shortest path between all pairs of vertices in a given weighted graph. The algorithm follows a dynamic programming approach to find the minimum weight graph. Let us understand the meaning of Floyd-Walshall algorithm through a diagram - take vertex 1 as the source and vertex 4 as the destination and find the shortest path between them. We have seen that there are two paths that can be connected to the target vertex 4. 1->4 – the edge has a weight of 51->8->3->4 – the edge weight (1+2+1) is 4. In the given graph I, we see the smallest edge connecting two vertices. So here the vertex
