Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ASP with XML - The whole truth
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASP with XML - The whole truth

 Post Reply Post Reply
Author
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Topic: ASP with XML - The whole truth
    Posted: 14 October 2004 at 3:29pm
Guys, I need your expert guidance on this matter, as it is the first time, beleive it or not, that I'm using ASP with XML, I used XML before, bot not with ASP.

The project I'm working on, relies on XML files to supply language values for all ASP files, so a user can easily change the language of the whole web site.

I'm using this code to read XML:

Dim dXML, txtTitle, txtSelect


Set dXML = Server.CreateObject("Microsoft.XMLDOM")

dXML.Async = False

If Request.Cookies("Cook")("Language") = "" Then dXML.Load(Server.MapPath("languages/English/news_lang.xml"))
If Request.Cookies("Cook")("Language") = "English" Then dXML.Load(Server.MapPath("languages/English/news_lang.xml"))
If Request.Cookies("Cook")("Language") = "Portuguese" Then dXML.Load(Server.MapPath("languages/Portuguese/news_lang.xml "))

If dXML.parseError.ErrorCode <> 0 Then
  Response.Write = "God damn another xmlErr!"
Else
  txtTitle = dXML.documentElement.childNodes(txtTitle).Text
  txtSelect = dXML.selectSingleNode("Language/txtSelect").nodeTypedValue
End If

Set dXML = Nothing

And here's the XML file:

<?xml version="1.0" encoding="UTF-8" ?>

<Language>
  <txtTitle>MyApp Name</txtTitle>
  <txtSelect>Select:</txtSelect>
</Language>

My questions are mainly towards the ASP XML processing, in particular, where this line is concerned (dXML.Async = False) it appears it locks the XML file before the reading, what are the implications of this when there are dozens of users all requesting and changing language info?

Also, note that to retrive XML values I'm using 2 different methods:

1. txtTitle = dXML.documentElement.childNodes(txtTitle).Text
2. txtSelect = dXML.selectSingleNode("Language/txtSelect").nodeTypedValue

Which is the most efficient to use? On the first one you say you want to retrive a child, give it's name and that's it, however the second method allows you to specify which parent also, are there any preformance or any other problem with any one of them?

Also, I would like to have a common file that will do all this XML extraction, but all and every ASP page will have it's own XML language file with all variables used in it, so my approach to have a common file to process so many different XML files may not work well, so I thought to include the code above on top of every ASP page and change it to reflect the variables used.

Is my whole approach viable at all?
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 14 October 2004 at 4:23pm
Well I do not have too much knowledge of XML in ASP but generally when I want to populate variables from a XML file, at least in .net I just open the file once and go something like
While myxml.Read()
var1=...
var2=...

That way I do not have to make multiple connections to the xml file which will slow it down a bit. Using that method you should not have to worry about how to talk to the node as it quickly reads all nodes and you just place them.....Hope I make sense here. Let me know if you need more detail..
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 15 October 2004 at 2:36pm
I guess there's no way to simulate the results of such approach, the little stress caused is not significative, so I'll run all tests when app goes live with beta testing, but if it is wrong it will be hell to correct.

Thx.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.