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

Displaying Multiple XML Files on one page?

I have a directory filled with XML files. These are small files which
contain something like:

Code:
<date>6/10/2004</date>
<name>bbulzibar</name>
<computer>Dell</computer>

Is there anyway I can aggregate 100 of these files and display them on
ONE page?

I found this thing called XQEngine. It is
"a full-text search engine for XML documents. Utilizing XQuery as its
front-end query language, it lets you interrogate collections of XML
documents for boolean combinations of keywords, much as Google and
other search engines let you do for HTML."
Does anyone have experience with doing this in XML or have experience
with XQEngine? Do I even need XQEngine? Can I just use XQL?

Any help would be greatly appreciated!
Jul 20 '05 #1
3 3337
bbulzibar wrote:
I have a directory filled with XML files. These are small files which
contain something like:
<date>6/10/2004</date>
<name>bbulzibar</name>
<computer>Dell</computer>
Is there anyway I can aggregate 100 of these files and display them on
ONE page?


Several approaches are possible depending on what exactly you want.

This javascript will read your xml files and put them in an array for
your webpage (Obviously, your browser would need to understand xml for
this to work):

---------------------------

<html>
<body>
<script language="javascript">
// put your xml files here:
var xmlFiles = new Array("first.xml","second.xml","third.xml");
var all = new Array();
for(loop=0;loop<(xmlFiles.length);loop++)
{
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load(xmlFiles[loop]);
all[loop] = xmlDoc.documentElement.xml;
}
alert(all); // report
</script>
</body>
</html>

---------------------------

I would rather work with a server process. This is a cgi approach, it
will put your xml files in a perl array:

---------------------------

#!/usr/bin/perl
print "Content-Type: text/xml\n\n";
my $count=0;
# put your xml files here:
my @xmlfiles = ("first.xml","second.xml","third.xml");
for $file(@xmlfiles)
{
open (READ, $file)||die"$!";
flock(READ, 1) || die "Can't lock xml: $!";
while (<READ>)
{ $all[$count].=$_ }
close READ;
$count++;
}
print @all; # report

---------------------------

Once you have the array, you can display the xml content just as you
want.

Hope this helps
Bart
Jul 20 '05 #2
On 19 Jun 2004 11:01:50 -0700, Bart Van der Donck <ba**@nijlen.com> wrote:
bbulzibar wrote:
I have a directory filled with XML files. These are small files which
contain something like:
<date>6/10/2004</date>
<name>bbulzibar</name>
<computer>Dell</computer>
Is there anyway I can aggregate 100 of these files and display them on
ONE page?
Several approaches are possible depending on what exactly you want.

This javascript will read your xml files and put them in an array for
your webpage (Obviously, your browser would need to understand xml for
this to work):

[SNIP: Code]
I would rather work with a server process. This is a cgi approach, it
will put your xml files in a perl array:

[SNIP: Code]

In the latter case you should also take a look at the Cocoon project:
http://cocoon.apache.org

HTH,
Gerald
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jul 20 '05 #3
b y
I ended up using a solution like this, (not nearly as robust as yours).
It just goes line by line with php. As long as the files are formatted
the same, which they are. Thanks for all your help!

<html>
<body>
<?php
if ($handle = opendir('errors')) {
while ((false !== ($file = readdir($handle))) & ($i<100 )) {
$i++;
$filearray = file('errors/'.$file);
foreach ($filearray as $ind => $line) {
if ($ind == 0) {
$tmp = "<b>";
$tmp = $tmp.$line;
$tmp = $tmp."</b>";
}
elseif ($ind == 1) {
$tmp = "<font color=\"#0033FF\">";
$tmp = $tmp.$line;
$tmp = $tmp."</font>";
}
elseif ($ind == 2) {
$tmp = "";
$tmp = $tmp.$line;
}
$html = $html.$tmp."<br>";
}
}
closedir($handle);
echo $html;
}
?>
</body>
</html>

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Francisco | last post by:
I have this question: I have a simple search to a db, something like: "select description from games where year = '1990'" suppose I get 300 results, I would like to display this in pages of 30...
1
by: Mark ??;-\) | last post by:
I would like to display a listing of files on a web page as follows: If there is only one file: display the section name and then display the current file. If there is more than one file (for...
5
by: Tomaz Koritnik | last post by:
Hi I have many short HTML files stored in a binary stream storage to display descriptions for various items in application. HTML would be display inside application using some .NET control or...
9
by: Eric Lindsay | last post by:
I can't figure how to best display little snippets of shell script using <pre>. I just got around to organising to bulk validate some of my web pages, and one of the problems occurs with Bash...
3
by: CLEAR-RCIC | last post by:
I have several images i want to display in an ASP.Net application. The images are being passed to me in binary format from another application. Is there a good way to write them directly to an...
3
by: CD | last post by:
An application is logging faxes sent in SQL2000 image column type. I have found code on the net but what it is doing is prompting to save to local which is fine for single page image. Not good...
1
by: mridulmurari | last post by:
Hey. I need help with a certain problem I'm facing in VB6. I need to display the contents of multiple items in a listview. The situation is this : Everytime i double-click on an item in a...
38
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
43
by: bonneylake | last post by:
Hey Everyone, Well this is my first time asking a question on here so please forgive me if i post my question in the wrong section. What i am trying to do is upload multiple files like gmail...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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...
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...

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.