Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Data Islands - choose item

I have a long xml document, with 50 "elements" and Im using "data Islands"
on a page to display them.. but I want to pull 1 item out of the xml document
and display that on another page...

Instead of creating more than 1 xml document, I want to have 1 document,
and grap various info out of that, how can I choose the info I want?
[351 byte] By [Thorir] at [2007-11-9 16:16:41]
# 1 Re: Data Islands - choose item
In IE, each data island exposes a XMLDocument object which lets you use DOM
methods and XPath queries to retrieve and manipulate the contents. Here's a
very short example. Save it as an htm file and then browse to the file.

<html><head><title>Test DI</title></head>
<body>
<xml id="data">
<root>
<item>Item1</item>
<item>Item2</item>
<item>Item3</item>
<item>Item4</item>
<item>Item5</item>
</root>
</xml>
Data Island test<br>
</body></html>
<script type="text/javascript">
var xml = document.all("data");
alert("All the xml in the data island\n\n" + xml.xml);
alert("Contents of third item\n\n" +
xml.selectSingleNode("root/item[2]").text);

</script>

"Thorir" <toti_k@hotmail.com> wrote in message
news:3e4111eb$1@tnews.web.dev-archive.com...
>
> I have a long xml document, with 50 "elements" and Im using "data Islands"
> on a page to display them.. but I want to pull 1 item out of the xml
document
> and display that on another page...
>
> Instead of creating more than 1 xml document, I want to have 1 document,
> and grap various info out of that, how can I choose the info I want?
Russell Jones at 2007-11-11 23:36:16 >