XML issues
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=14616
Printed Date: 01 April 2026 at 1:12am Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: XML issues
Posted By: theSCIENTIST
Subject: XML issues
Date Posted: 08 April 2005 at 2:53pm
Hi guys,
I'm having some issues using XML to store data in my application, I'm using ASP and XML to store user input such as comments and things like that.
Here are the questions to which I couldn't find the answers
1. What is the limit of the data I can store per node? ( <node>data</node> )
2. What about the limit of attributes in nodes? ( <node attr="data"></node> )
3. What would make more sence or be quicker to process using n.1 or n.2 above to store data?
4. When I create my elements in the XML file, they get all in the same line ( <node1><node2>data</node2></node1> ) for readability in dubugging mainly I would like it like:
<node1>
<node2>data</node2>
</node1>
How to do this? In VB.NET they are created the proper way but not in ASP.
5. Paging, how to with XML?
6. Is XML viable to store large ammounts of information?
Thanks guys.
------------- :: http://www.mylittlehost.com/ - www.mylittlehost.com
|
Replies:
Posted By: Mart
Date Posted: 08 April 2005 at 3:53pm
I'm not sure about all of those questions but I'll answer some
3) doesn't make a difference, but something like
<add key="x" value="y"/>
is more maintainable than
<add>
<key>x</key>
<value>y</value>
</add>
IMHO
5) What language? ASP or ASP.NET?
9) Not really, everytime you parse the xml document it is loaded into
the servers memory and then unloaded (like an access db) that has
performance disadvantages if the file is large
|
Posted By: theSCIENTIST
Date Posted: 08 April 2005 at 4:57pm
Thanks Mart.
3. I will now try to use attributes on one node only per post to store it's data, I also figured that by using attributes you save a great deal in file size, but I don't know how much data I can store, I haven't found anything on this.
5. Do paging with XML data in ASP.
6. Yes, I know the file is loaded in memory, but I will use one file per days worth of input, so the files will be named like (posts_08-apr-2005.xml) to get small files, thanks for reminding me of this issue.
-----------------------------------------------------
Anyone to help with points 1, 2, 4, and 5 above?
Thanks.
------------- :: http://www.mylittlehost.com/ - www.mylittlehost.com
|
Posted By: Mart
Date Posted: 08 April 2005 at 5:14pm
1. I don't think there is any limit of data stored per node in the
spec. (from what I can see) but parsers may limit it (I bet it will be
a high limit if there is one). I think the only limit is because of
NTFS which limits files to 16 terabytes.
2. Can't see anything in the spec either
5. Haven't used ASP in years, don't know how sorry
|
Posted By: theSCIENTIST
Date Posted: 08 April 2005 at 8:03pm
Thanks,
Questions from old bunch:
4. Does anyone knows how to break lines in XML files creating from ASP pages? All my elements going sideways one next to the other, I would rather have them going down.
5. How do do paging from XML data with ASP?
New question: How to do sorting, search, edit, update, delete, I can do inserts :) but the other operations are proving tricky, anyway has experience in this? I can't use SQL to query it can I? I heard of a COM for it, but I rather use native methods, anyone?
Almost there, but not quite :|
------------- :: http://www.mylittlehost.com/ - www.mylittlehost.com
|
Posted By: Phat
Date Posted: 09 April 2005 at 2:15am
|
4. from memory Use vbCrlf or Chr(10) or Char(10) & Chr(9)
|
Posted By: Mart
Date Posted: 09 April 2005 at 5:37am
You can't use SQL to select data but you can use http://www.w3schools.com/xpath/default.asp - XPath
theSCIENTIST wrote:
Thanks,
Questions from old bunch:
4. Does anyone knows how to break lines in XML files creating from
ASP pages? All my elements going sideways one next to the other, I
would rather have them going down.
5. How do do paging from XML data with ASP?
New question: How to do sorting, search, edit, update, delete, I
can do inserts :) but the other operations are proving tricky, anyway
has experience in this? I can't use SQL to query it can I? I heard of a
COM for it, but I rather use native methods, anyone?
Almost there, but not quite :| |
|
Posted By: theSCIENTIST
Date Posted: 09 April 2005 at 1:27pm
Phat wrote:
4. from memory Use vbCrlf or Chr(10) or Char(10) & Chr(9) |
Sorry, tried all that before, don't work, I'm beginning to wonder whether there is a method to do this, or is just simply a XMLDOM design feature. [How to create XML elements that will auto indent and the nodes are put one on top of the other as opposed to next of each other?] (ASP and XMLDOM) Anyone for the taking?
Mart wrote:
You can't use SQL to select data but you can use XPath |
Yep, I'm already researching XPath, was able to delete a node based on it's ID attribute :) I assume at this stage that the edit op will also be easy, not so sure for the sorting, paging and searching :Z
------------- :: http://www.mylittlehost.com/ - www.mylittlehost.com
|
Posted By: Mart
Date Posted: 09 April 2005 at 1:37pm
|
TBH It's a lot easier in .net as the DataSet object can read xml and
also supports paging, sorting etc. it is possible in ASP but you will
need quite a bit of code to achieve it
|
Posted By: theSCIENTIST
Date Posted: 09 April 2005 at 11:12pm
On my XPath research, I found XQuery, just what I need I thought, great, I will be able to query my xmlBank and get my results filtered with ease, digging a bit deeper, the examples shown everywhere look promising, so sleeves up, lets try it... (seconds later) ...humm, right, hummm, where do I put the XQuery code? What sort of file? Right... It seams everyone out there shows you XQuery code like:
for $x in doc("books.xml")/bookstore/book
where $x/price>30
order by $x/title
return $x/title |
But no one tells you where to put it, or, on which file type; asp, xhtml or what?
Help please.
------------- :: http://www.mylittlehost.com/ - www.mylittlehost.com
|
Posted By: Mart
Date Posted: 10 April 2005 at 3:27am
Looks like it's client side xhtml:
<ul> { for $x in doc("books.xml")/bookstore/book/title order by $x return <li>{data($x)}</li> } </ul>
|
Posted By: theSCIENTIST
Date Posted: 11 April 2005 at 2:37am
Client side xhtml?
I'm new to that, how do I run the code then?
Thanks.
------------- :: http://www.mylittlehost.com/ - www.mylittlehost.com
|
Posted By: Mart
Date Posted: 11 April 2005 at 2:55am
Like that I think
<ul> { for $x in doc("books.xml")/bookstore/book/title order by $x return <li>{data($x)}</li> } </ul>
I've never used it before either
|
Posted By: Phat
Date Posted: 11 April 2005 at 5:27am
|
try Response.Write(chr(13)) for a new line
|
Posted By: Mart
Date Posted: 11 April 2005 at 11:33am
|
He has already explained that he is using MS's XML DOM to create the document so he can't use Response.Write(chr(13))
|
Posted By: theSCIENTIST
Date Posted: 11 April 2005 at 7:41pm
Mart, yes, I tried using that code on a .xhtml, .shtml and all the rest of it, no avail, must be missing something, will look futher.
----------------------------------
Phat, thanks, but it won't work, to create a new node I use:
Set PostElement = xmlData.createElement("Post")
PostElement.setAttribute "Title", "Some title"
PostElement.setAttribute "Author", "Ruan"
PostElement.setAttribute "Message", "Oh yeah baby."
Call xmlData.documentElement.insertBefore(PostElement, xmlData.documentElement.childNodes.item(0))
This creates an XML node like:
<Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/>
The problem is that, as I add more nodes, they will get all like this:
<Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/><Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/><Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/>
As opposed to:
<Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/>
<Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/>
<Post Title="Some title" Author="Ruan" Message="Oh yeah baby."/>
What could it be?
------------- :: http://www.mylittlehost.com/ - www.mylittlehost.com
|
|