ASP/XML/XSL any advantage?


We are into the maintenance of  web application. It is an intranet applciation. The details are as follows
Backend : SQL server 2000
Front end : ASP/ XML/ XSL

ASP pages initiates the execution of the SPs to get the data into a recordset. Then by running a 'While' loop, an XML file is created for that data from the recordset. The XML file is then presented using an XSL file. XML file contains tags for different properties of each component like 'on click even' , 'on mouse over', 'text' , visibility' , type of the compoentn - whether it is a text box/ button etc

The screeens are extremely slow. The databse is quite big and growing fast. But the indexes are properly defined, so I dont think the data retreival is taking much time. I tried to execute the SPs independantly and it is fast.

The screens are very heavy with a lot of controls - which includes lists, data entry compoennts, radio buttons, buttons etc. The server is in the local network.

Does any one know whether the XML creation and presentation using XSL is a time consuming process or not.

What is the best way of creating dynamic pages in asp?

Does the methodology of using the XML/XSL is of any benefit?



Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

XSL transformations with MSXML are very fast so long as you use the newer versions of the XML parser. Compared to XML parsers on any other platform MSXML is a rocketship.

You say that your data access is fast. So you can rule that out of the equation.

It's possible that, if you're rendering control-rich HTML pages, that the page rendering time is a bit of an issue. But I think that this is unlikely. Most half-decent modern computers can display web pages pretty quickley even if they are complex and feature lots of controls.

The most likely culprit in my opinion is the bit in the middle: looping thru your data and building up the XML document.

How do you this?
Do you build up a string and load this into the XML DOM (this would VERY slow, unless you used a string buffer - in which case it would slow-ish)?
Do you programmatically build an XML DOM (this could be OK performance wise - depends how you do it - but still not great)??

The absolute quickest way to dump recordset data into an XML DOM is to use the .Save method of the recordset and specify an XML DOM object as the target. This is VERY fast (because you're using native ADO functionality) but you end up with XML that has a very flat structure (although you do get a nice schema section that describes all the fields in your recordset). Code is very simple:

rsObj.Save xmlDOMObj, adPersistXML (adPersistXML is a constant with a value of 1)

This streams the recordset data from rsObj into and XML DOM xmlDOMObj in XML format (as specified in the second argument of .Save method).

But it's likely that you won't want re-write all your XSL templates to work of the new XML source data. So one thing you could think about doing is an initial transformation to change your recordset sourced XML into XML of the same format you're using now. This would still be alot quicker than other ways of building up your source XML.

But either way, it's a bit of work for you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
> What is the best way of creating dynamic pages in asp?

> Does the methodology of using the XML/XSL is of any benefit?

...and to answer this bit: XML/XSL is a perfectly viable way to generate dynamic pages in ASP. I built a few ASP web app's that use it and, with a bit of care and planning, the performance and functionality is good.

I love XSL. It's standards based and works well. I can my XSL knowledge with ASP, PHP, Java - whatever. So investing time in learning it is time well spent in my opinion.
You should use the "FOR XML EXPLICIT" syntax that SQL Server 2000 provides. Have a look here:

It's a bit confusing at first, but will output XML in the format you require. rather than asking ADO to automatically save the Recordset as XML (often a bit nasty XML!), or doing this via a Recordeset, just stream waht you want direct from SQL.

Assuming you go down this route, you'll need to get the XML streamed from sql, so you'll need an ADO command object:

Set ConnClass      = New DatabaseConnection      
Set objStream      = Server.CreateObject("ADODB.Stream")
Set objCmd      = Server.CreateObject("ADODB.Command")
Set objSQLXML      = Server.CreateObject("MSXML2.DOMDocument")

objStream.Charset = "iso-8859-1"
objStream.Type = adTypeText

With objCmd
      .ActiveConnection            = ConnClass.OpenConnection()
      .CommandType                  = adCmdStoredProc
      .CommandText                  = dbObject
      .NamedParameters            = True
      .Properties("Output Stream").Value = objStream
      For Each strParam In oParams
            .Parameters.Append .CreateParameter(strParam, adInteger, adParamInput, 4, oParams(strParam))
      .Execute, , adExecuteStream
End With
objStream.Position = 0
If 0 Then
      Response.Charset = "windows-1252"
      Response.ContentType = "text/xml"
End If
Set getXMLfromSQL = objSQLXML.documentElement
Set objParameter      = Nothing
Set objCmd      = Nothing
Set objStream      = Nothing
Set ConnClass      = Nothing

It's true that the FOR XML directive in SQL Server gives you a nicer XML output, and the performance is good too.

But I don't like it because it means that you can only use those SP's for outputting XML. It means duplicating your query logic if you need both XML'ised data and recordset objects from your database.

But depending on your exact requirements this is definitely another option.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.