Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display page using multiple XML

Status
Not open for further replies.

bont

Programmer
Sep 7, 2000
200
US
I am hoping to display a music library. I can construct multiple XML, one for:
- Artist
- Albums
- Album Details

Each Unique detail will have its own file, such that individual artists have their own file, individual albums have their own file, etc. I guess my only real question is that I would like to do something such as this:

List the albums, and their songs...

Album 1
- Song 1
- Song 2
- ...
Album 2
- Song 1
- Song 2
- ...

The important part is that I don't want to display the song listing unless someone clicks on a link for the album details. I have done this in the past by using CSS to hide the listing; however, this require ALL song information to be loaded. I would like to load all the album information only, and then only load a particular album's song listing, when requested and then place it in the proper area on the page. Is there a way to do this without having to load the entire page? If I must use javascript for this, how may I do this and guarentee a client can view the page?
 
Hi,

iam not answering you.
I do not know if the XML files is the right way to do this you want.

If you do it with XML then I would:
- Create an XML file that will have have 2 elements. One the album info, and the other element should be an XML file path. So once you have selected the album you want, you can load the XML file (other element) to an XML document and read it.

But I think it would be better if you used a database . :)
 
Yes, it would be extremely easy to do this with DB; however, I am looking for efficiency, and would like to limit server time. Static HTML from fragmented XML data should do this the best. The question is how can I make the XML the most fragmented when it come from the primary indices (the first letter of the artist, for example)?

 
If you are looking for efficiency, a database will be more suited. Try having a look at free ones such as SQL Server Express.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Actually, when using a web host system, SQL Server is not possible. Also, efficiency, in this case would be most efficient as the XML is static and only updated periodically. XSLT could be done via ASP (preferred) or using Javascript (most efficient as it uses client's resources). In addition SQL Server is a massive memory hog compared to most simple functions possible in XML.
 
hi guys, my quick thoughts on this, If you dont want to use a relational database, just create XML files and use XSLT to retrieve just the information you need from the XML. You can find plenty of samples on how to render XML with XSLT on the web.
 
Actually, when using a web host system, SQL Server is not possible
It depends on who your sost is. Most hosts will offer a database for you to use.

Also, efficiency, in this case would be most efficient as the XML is static and only updated periodically
It entirely depends on the amount of data you have and how often it will be updated. In most cases a database is more equipped to handle this type of scenario than flat files.

In addition SQL Server is a massive memory hog compared to most simple functions possible in XML.
I wouldn't worry about memory usage. This is cheap nowadays, your host will already have taken care of this and for what you have described doing, it won't use many resources anyway.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I am not quite sure what purpose quoting and disecting obvious reasons for the nature of a project has to do with solving the initial question?

1) Yes, it is possible to have SQL server supplied by your host system, but if you haven't guessed it.. It is NOT an option here to use SQL on my ISP.

2) The XML is already prepared ahead of time, and rolled out on a time schedule. The HTML to display from the XML is basically a single pass scan of the specified files, when required. There is no comparison to any database as there is no simpler algorithm then top to bottom when parsing the XML verses the internal algorithm needed to parse SQL tables/views, nor and the overhead associated with them.

3) Yes SQL is a memory hog as all query would occur on the server side; therefor, if the XML version could be done on the client side, the server would be bogged down less. Yes, memory is not that expensive, but servers must still allocate mutliple threads. Less is ALWAYS better, as it prevents delay of other processes. If you don't understand this concept, you apparently haven't dealt with much volume. Remember, there are other users then your single app on a professional server.

I am guessing by now that no one knows of a way to display headers of XML data on an web page, and then reference/populate the subcontent of the headers (which reside in secondary XML files) in a way such that the page does not need to be entirely loaded, or pre-loaded in memory. Basically, be able to load the secondary XML when needed. I will keep this question open for a short time longer, thank you for any aid.
 
I am not quite sure what purpose quoting and disecting obvious reasons for the nature of a project has to do with solving the initial question?
The reason for offering a solution to you is because I can only offer my experiences in these situations. If you choose to ignore this advice then this is entirely up to you. I can only say what I think is the best solution for this problem.

1) Yes, it is possible to have SQL server supplied by your host system, but if you haven't guessed it.. It is NOT an option here to use SQL on my ISP.
Fair enough but I couldn't have known this. If you give all the information in you initial post then we can rule opions out. If not, we can only make assumptions.

2) The XML is already prepared ahead of time, and rolled out on a time schedule. The HTML to display from the XML is basically a single pass scan of the specified files, when required. There is no comparison to any database as there is no simpler algorithm then top to bottom when parsing the XML verses the internal algorithm needed to parse SQL tables/views, nor and the overhead associated with them.
Agsin, see my previous point. We couldn't have known this is what you did so I assumed you could solve the problem by other means.

3) Yes SQL is a memory hog as all query would occur on the server side; therefor, if the XML version could be done on the client side, the server would be bogged down less. Yes, memory is not that expensive, but servers must still allocate mutliple threads. Less is ALWAYS better, as it prevents delay of other processes.
Just because the client processes the information, it doesn't mean it's quicker. You may find that in a lot of situations it's much more practical and quicker to perform to the processes on the database server (or web server) rather than let the client do it (as these servers will either be built for this purpose or can out perform any of your clients).

If you don't understand this concept, you apparently haven't dealt with much volume. Remember, there are other users then your single app on a professional server.
I do understand the concept of large applications and if you think by trying to demean people who are trying to help you that you will get any more help you are much mistaken. Also, although you have asked a few questions on the forums here, you haven't marked any of the answers as valuable, and I can only see one or two acknowledgements of other peoples responses. If you are not getting the answers that you need read FAQ222-2244 to see how to ask better questions. If you are getting the answers you need see FAQ222-2244 to see how to acknowledge the answers given (paragraph 15).

Paragraph 16 of the FAQ explains about this being a two-way forum, to give guidance on answering other peoples questions, as I also notice that you haven't yet made any posts in other peoples threads and Tek-Tips is not designed to be a help desk for you.

I am guessing by now that no one knows of a way to display headers of XML data on an web page, and then reference/populate the subcontent of the headers (which reside in secondary XML files) in a way such that the page does not need to be entirely loaded, or pre-loaded in memory
Yes, there are methods to do this (for example, have a look at using XPATH queries on your XML file).

I will keep this question open for a short time longer, thank you for any aid.
That's very kind of you, but remember that no-one is obligated to provide any response.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
bont you kind of remind me of a situation I recently had to go through. See this VP which is basically my boss decided to watch some web cast on a companies dashboard presentations and offerings. *sigh* so of course a project was put together. So in our case a fully suited dashboard wasn't what we needed at this stage in our consolidated reporting solutions. In that analysis I put together a very well rounded slim dashboard of the major reports that executives at our company uses. basically the fine numbers in the totals row that they only look at in pretty pictures and graphs ;)

Well, they had to put that full featured design with a front portal and thousands of graphs and grids of a world wide company hooked into each other (meaning sister companies etc...) Well I'll be damned if he just wouldn't accept anything less than what he saw. Didn't matter what the more experienced IT folks he pays all that money to say or showed in gaps in the WAN. He wanted it his way. Hmmm...I updated my resume a few days ago. Not sure I want to work with ignorance to that level.

Meaning of the story. You need to listen to knowledge and experience. Sounds like you heard this cool thing or read some brief article that may or (probably) was not very well supported by documentation and proof of concept. XML is the wonder of the world. right?!? buzz word! It has its place but for what you stated in your initial question you received the correct responses and I second, third them all.

And again. TT is for advice on an IT professional level of a proposed project, problem and or concept. If you wanted a direct answer to XML methods I bet MSDN references and a bit of reading would have been more helpful.

and besides all that...
If I must use javascript for this, how may I do this and guarentee a client can view the page?

Your complete thought process is a big No! Any which way around it. If you rely on the client you will be extremely Non-client friendly as there is no one client configuration.


____________ signature below ______________
General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
bont,

I think the guys have already said what needs to be said in regards to you listening to experience. Don't dismiss it.. being open to suggestions can make your job a lot easier. I would expect from the type of question you have stated and the environment you are working in (shared hosting) that the people that have responded already have far more experience in much more complex environments - listen to them, they are only trying to help.

1. Yes, a database server would likely be more effective for what you want on the server side if there is any volume in question. Otherwise you will be building a pseudo filesystem and XML file based data store solution. take away the XML bit and you have C/ISAM............ there is a reason RDBMS's became more prevelant.

2. Must have XML ? ok, even better.. use a Native XML Database, such as DB2, Oracle, SQL Server 2005, etc. Yes, these have express editions which are free and highly functional. You can then use both Xpath and Xquery to get your data in a very efficient manner.

3. Can't install on your ISP ? Use a db file and ADO.NET to access it, rather than installing the full db server.

4. If you want the client to do all the processing then you have to SEND all the data to the client to process - in this case you need to re-design your XML files - so that a single master file contains the top level links (as already mentioned), then you can selectively drill down to other supporting files - maybe pass an XML string in a hidden field when posting - or use XMLHttpRequest to dynamically retrieve content (preferred).

5. If you can't change the XML files you're given then write an import prog to scan the new files and create an index file (in XML or to a database) which fulfils this purpose. Maybe store this in Memory if it is what you use server side, to speed things up a bit more - if it is accessed a lot and rarely changes, it is better to be in memory, as it removes all the load/unload from memory each time you access the file... mind you, I think IIS / ASP.NET half does this anyway with frequently accessed text based files.

6. XSLT and XPath will enable you to present whatever information you want to the client.. just remember that the parser still has to read the entire file from the OS, and will have to navigate through the level of nodes you are searching for to return a result.. so try to keep the nodes you're after at the top level (below the root) of the XML document, otherwise the parser will need to iterate down each level to get the information it needs - and this is where the process becomes intensive. The entire will be "read" from the OS, but the amount of parsing depends a) on the parser (whether it supports streaming or not) and b) your XML design and the XPath you request.

7. The more files on the OS to read, the more IO required, thus the slower it will be.

8. ADO.NET supports XML files as a data source/provider - maybe this will help - I would expect that the ADO.NET team have made the process more efficient than you could in a short space of time.

9. To guarantee a a client can see the data, do the processing server side, and send ALL the data as XHTML. You cannot guarantee that a client will a) support Javascript or b) support CSS - so whatever you do, you will have issues for that small percentage.

10. If you want to load ALL sub nodes in a tree - then think about the fact that you would have to go to the server for every node you defined - e.g. if you create files at the artist level, and have 50 artists in the tree - the server will get hit with 50 requests for data... eek,.. may not sound like much, but for 100,000 users that's 5million requests... now that WILL eat up your memory to maintain the request queue.. and it only gets worse with more nodes.

11. You should make sure that you go through a single access point (e.g. page) to retrieve the server side content - even if it is based in XML - as this provides a level of abstraction that will help with any additional functionality needed and future changes to your architecture. The only reason not to do this is if you want to have an offline version, where all xml files can be downloaded and referenced relative to the html page.

So.... yes, you can do what you ask.. at the simplest, create an index file as mentioned by ca8msm, send that to the client and use AJAX to get the content of each sub entity (e.g. artist) upon request.

Even better if you are building the XHTML manually: use JSON, which is much more efficient than XML. However XML is obviously a better format for use with XSLT - which can be quite efficient.

Javascript, XPath and XSLT are your friends.. as is Google.

You can even get a framework to do most of the work for you, e.g. dojo: This has a prebuilt dynamically loading tree widget.

And listen to clever people like ca8msm and onpnt - they can help make your work a lot easier.


A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top