Hello there,

I don't know how to word this correctly, but i have a couple XML files that i need to extract certain information from.
The files are already on my computer, so i won't be fetching it off the web anymore if that helps any.

I mainly want to extract the information within the nodes, or everything within/under a parent-node.

Here is an example of what's within the XML file:

<?xml version ="1.0" encoding="uscii"?>

<context id="TwelveMonthEnd">
   <entity>
       <number>152360</number>
    </entity>
    <Frame>
        <Start>1985-01-01</Start>
        <End>1986-01-02</End>
    </Frame>
</context>

Then it repeats this for an X amount of times then stops.

The outcome i would like to achieve looks like this:

TwelveMonthEnd | 152360 | 1985-01-01 | 1986-01-02

The pipes don't need to be that wide from the information.

I'm new to XML i've been trying to self teach.
I was able to do some of this, but then after awhile the numbers within the "<Frame>" region started to repeat and thats why i need help.

Thank you.

>>I was able to do some of this
Using what exactly VBSCRIPT, PHP, XSL? Post what you have thus far.

So far i've been using HTML and JS.
I found tutorials at W3 schools, and i just went off that.

here's an example of the code:

<html>
<head>
<script type="text/javascript" src="loadxmldoc.js">
</script>
</head>
<body>
 
<script type="text/javascript">
xmlDoc=loadXMLDoc("file:///E:/TEST/testrun/test_1.xml");
 
w=xmlDoc.getElementsByTagName("context");
y=xmlDoc.getElementsByTagName('start');
x=xmlDoc.getElementsByTagName('end');

for (i=10;i<w.length;i++)
{
att=w.item(i).attributes.getNamedItem("id");
document.write(att.value);
document.write(" | ");
document.write(y[i].childNodes[0].nodeValue);
document.write(" | ");
document.write(x[i].childNodes[0].nodeValue);
document.write("<br />");
}
</script>
</body>
</html>

My output looks something like this:

TwelveMonthEnd | 1985-01-01 | 1986-01-02.

It starts repeating dates after a short period though, that's the problem.

I was not able to locate loadxmldoc.js, but try:

<script type="text/javascript">
xmlDoc=loadXMLDoc("file:///E:/TEST/testrun/test_1.xml");
 
w=xmlDoc.getElementsByTagName("context");
//y=xmlDoc.getElementsByTagName('start');
//x=xmlDoc.getElementsByTagName('end');

for (var i=10;i<w.length;i++)
{
	var y=w[i].getElementsByTagName('start')[0];
	var x=w[i].getElementsByTagName('end')[0];
	var att=w.item(i).attributes.getNamedItem("id");
	document.write(att.value);
	document.write(" | ");
	//document.write(y[i].childNodes[0].nodeValue);
	document.write(y.childNodes[0].nodeValue);
	document.write(" | ");
	//document.write(x[i].childNodes[0].nodeValue);
	document.write(x.childNodes[0].nodeValue);
	document.write("<br />");
}
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.