Results 1 to 6 of 6

Thread: ASP/XML Question

  1. #1

    Thread Starter
    Lively Member Nator's Avatar
    Join Date
    Nov 1999
    Location
    East Larryville, GA
    Posts
    80

    ASP/XML Question

    I may be totally missing something here, but are there any real benefits to incorporating XML documents into ASP vs using standard database fields? MS is pushing XML as the next great thing. Granted, I am a newbie to XML, but I just don't see it from a web app performance standpoint. I'd like to see a tutorial taking you through a Hello World example of just how an XML based document is better than using striaght ASP. The examples I have seen require the ASP to fire off some document creation script to build the XML file, then pull data from that file and format it on the page. To me doing the old

    Set rs = Server.CreateObject("ADODB.recordset")
    rs.open "SELECT * FROM authors", sConn

    strField1= rs.fields("authorname")


    set rs = nothing

    response.write("The data is " & strField1)

    is easier than having to manage all the Microsoft.XMLdom objects.

    Another question. If an object on the server is creating an XML document, how it that document preserved in the event another client calls the same page and another XML document is created with different data? From what I am reading, I'm thinking the XML document is replacing the Database. Where are the dynamics of XML?

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Look at it from the standpoint of performance. It is much faster and uses less resources to access an xml document rather than constantly hitting your database. Just hit the database once to create an xml document of what the user needs then access the xml while they are logged on when the info is needed. Also it is much cleaner, neater, and faster turning your XML doc into HTML by using XSL to parse the XML rather than an ASP using tons of resources to run the ASP engine and hit the database

    Here are some resources to get you going

    http://www.vbxml.com
    http://www.xml101.com

    there really is to much for me to explain, but if you have any specific questions, feel free to ask me since I am the XML/XSL guru around here
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Another question. If an object on the server is creating an XML document, how it that document preserved in the event another client calls the same page and another XML document is created with different data? From what I am reading, I'm thinking the XML document is replacing the Database. Where are the dynamics of XML?
    And to answer this question. You can place the XML doc as a string of data into an Application variable in ASP if you want the same document accessed by everyone, or a Session variable if each document maybe different for each user.

    And no XML cannot replace a database on its. It can get very slow if it contains too many records. But it is handy for trasfering data from one database to another regardless of what platform or what database it is, as long as the database supports XML.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Okay, I have a question...

    My experience with XML has been limited to messaging. It was used by a client to communicate between several different parts of their ecommerce infrastructure, the web, the mainframe, the warehouses, the stores. It was great for that since it is self describing data. Order doesn't matter. (Atleast, order isn't supposed to matter. One of there partners insisted that the elements had to come in a certain order, not just with a certain parent/child relationship. I told them their XML parser was crap)

    Anyway... now I have a client that has a series of ASP pages for a systems monitoring application. One of these pages will generate a report telling you the up time for the applicatoins being monitored. When you ask for that report, it hits the database, pulls the log and creates a bunch of incident records that I have to save in an array in the ASP. It runs calculations (time up, time down, yadda yadda) and then builds the HTML. If you want to, you can change certain things and ask it to rebuild the report.

    It has to hit the DB again, to build the incidents again. I want the client to redesign the DB so it is incident oriented and not a log. But in the mean time... can I use XML to make this faster?

    I wondering if I can build an XML file for the incidents when the user first asks about the report, so everytime he wants to make a change I can just access the XML file and not the DB. Will this make it faster?
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    It has to hit the DB again, to build the incidents again. I want the client to redesign the DB so it is incident oriented and not a log. But in the mean time... can I use XML to make this faster?

    I wondering if I can build an XML file for the incidents when the user first asks about the report, so everytime he wants to make a change I can just access the XML file and not the DB. Will this make it faster?
    That is how I usually use it. I make all data changes to the XML, and only hit the database when absoultly needed like wshen they log off to dave the data permanently. Faster and uses alot less resources.Also one XML doc in a session variable uses alot less resources than a bunch of single session variables for each type of data
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6

    Thread Starter
    Lively Member Nator's Avatar
    Join Date
    Nov 1999
    Location
    East Larryville, GA
    Posts
    80
    When you say an XML doc in a Session variable, do you mean a string that could be an XML document (ie. string = "<?xml version='1.0' ?><message><item>Widget</item></message>") or is it an actual file? Is there any way you could post a code example? I'd really like to see how this works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width