473,804 Members | 3,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

connecting to external xml file

Hi,
i am trying to write a script to parse an external xml file, but am having
problems... the problem i think has to do with me trying to do
Response.Write( xmlDoc.transfor mNode(xslDoc)) before the xml is fully loaded.
The link to the xml file is valid. my code is as follows...

xmlf =
"http://www.tcc-net.com/associates/xml/coursesopen.php ?fieldSet=sched ule&order=code"
stylef = "page1.xsl"
set xmlDoc = Server.CreateOb ject("Microsoft .XMLDOM")
set xslDoc = Server.CreateOb ject("Microsoft .XMLDOM")
xmlDoc.validate OnParse = false
xmlDoc.load(xml f)
xslDoc.load(Ser ver.Mappath(sty lef))
Response.Write( xmlDoc.transfor mNode(xslDoc))

any suggestions ? the page in question is
http://www.bestoutcomes.ie/tcclist.asp

thanks, Brian
May 28 '06 #1
4 2477
Have you put any debug in?

xmlDoc.load(xml f)
if isObject(xmlf) = true then
if xmlDoc.parseerr or.errorcode <> 0 then
response.write "Error Code : " & xmlDoc.parseerr or.errorcode &
"<BR>"
response.write "Reason : " & xmlDoc.parseerr or.reason & "<BR>"
response.write "Error Line : " & xmlDoc.parseErr or.line & "<BR>"
response.write "String : " & xmlDoc.parseErr or.srcText & "<BR>"
response.end
End If
else
response.write "Doc Failed to load"
response.end
end if

Earl
www.jhdesigninc.com

May 28 '06 #2
This works on my local machine using your xls. Its not pretty but it
works

<%
stylef = server.mapPath( "page1.xsl" )
URL="http://localhost/briantest/testPage.asp"
set xmlDoc = Server.CreateOb ject("MSXML2.Se rverXMLHTTP.4.0 ")
set xsl = Server.CreateOb ject("Microsoft .XMLDOM")
set aDoc=Server.Cre ateObject("Micr osoft.XMLDOM")
xmlDoc.open "Get", URL, False
xmlDoc.send
aDoc.Load(xmlDo c.responseText)
xsl.load(stylef )
Response.Write( aDoc.transformN ode(xsl)) 'this is the line
thats t
Set aDoc=Nothing
set xmlDoc = Nothing
set xsl=Nothing
%>

Earl
www.jhdesigninc.com

May 28 '06 #3

"Brian Quigley" <qu******@iol.i e> wrote in message
news:e5******** **@reader01.new s.esat.net...
Hi,
i am trying to write a script to parse an external xml file, but am having
problems... the problem i think has to do with me trying to do
Response.Write( xmlDoc.transfor mNode(xslDoc)) before the xml is fully loaded. The link to the xml file is valid. my code is as follows...

xmlf =
"http://www.tcc-net.com/associates/xml/coursesopen.php ?fieldSet=sched ule&ord
er=code" stylef = "page1.xsl"
set xmlDoc = Server.CreateOb ject("Microsoft .XMLDOM")
set xslDoc = Server.CreateOb ject("Microsoft .XMLDOM")
xmlDoc.validate OnParse = false
xmlDoc.load(xml f)
xslDoc.load(Ser ver.Mappath(sty lef))
Response.Write( xmlDoc.transfor mNode(xslDoc))

any suggestions ? the page in question is
http://www.bestoutcomes.ie/tcclist.asp

thanks, Brian


Try this:-
xmlf =
"http://www.tcc-net.com/associates/xml/coursesopen.php ?fieldSet=sched ule&ord
er=code"
stylef = "page1.xsl"
set xmlDoc = Server.CreateOb ject("Microsoft .XMLDOM")
set xslDoc = Server.CreateOb ject("Microsoft .XMLDOM")
xmlDoc.async = false
xslDoc.async = false
xmlDoc.validate OnParse = false
xmlDoc.load(xml f)
xslDoc.load(Ser ver.Mappath(sty lef))
Response.Write( xmlDoc.transfor mNode(xslDoc))
May 29 '06 #4

"Brian Quigley" <qu******@iol.i e> wrote in message
news:e5******** **@reader01.new s.esat.net...
Hi,
i am trying to write a script to parse an external xml file, but am having
problems... the problem i think has to do with me trying to do
Response.Write( xmlDoc.transfor mNode(xslDoc)) before the xml is fully loaded. The link to the xml file is valid. my code is as follows...

xmlf =
"http://www.tcc-net.com/associates/xml/coursesopen.php ?fieldSet=sched ule&ord
er=code" stylef = "page1.xsl"
set xmlDoc = Server.CreateOb ject("Microsoft .XMLDOM")
set xslDoc = Server.CreateOb ject("Microsoft .XMLDOM")
xmlDoc.validate OnParse = false
xmlDoc.load(xml f)
xslDoc.load(Ser ver.Mappath(sty lef))
Response.Write( xmlDoc.transfor mNode(xslDoc))

any suggestions ? the page in question is
http://www.bestoutcomes.ie/tcclist.asp

thanks, Brian

Brian,

Below is an alternative solution. If you page gets frequent hits it would
be better to cache the xsl transform in the application object and reuse it
on subsequent calls. MSXML has an XSLTemplate object which represents a
parsed, compiled and ready to run xsl transform. Being a Free threaded
object it's safe to store in ASPs application object. Hence the code below
creates on of these and stores it. Subsequent hits on the page can reuse
this object thereby cutting down significant CPU effort.

The CreateProcessor returns an object that will actually transform an XML
DOM to the output. Note that the response object is assigned to the output
property.

In your original code any output generated is converted to a unicode string.
The response.write would then convert the unicode string to the current
codepage for the response or session. In the code below the bytes generated
by the transform will be copied directly to the output buffer without any
code page conversion. This again is more effecient.

The Response.CharSe t is used to specify to the client what character
encoding it is being sent. The code below sets it to UTF-8 because that is
the default used by XSL output. However if your XSL has an encoding
attribute on the xsl:output node you should set the CharSet to the same
value.

Dim oTemplate
Dim oProc
Dim xmlDoc

Set xmlDoc =
GetDocument("ht tp://www.tcc-net.com/associates/xml/coursesopen.php ?fieldSet=
schedule&order= code")
Set oTemplate = GetTemplate("Pa ge1.xsl", "xslPage1")

Response.Conten tType = "text/html"
Response.CharSe t = "UTF-8"

Set oProc = oTemplate.creat eProcessor()
oProc.input = xmlDoc
oProc.output = Response
oProc.Transform

Function GetDocument(src )
Set GetDocument = Server.CreateOb ject("MSXML2.DO MDocument.3.0")
GetDocument.asy nc = False
GetDocument.val idateOnParse = False
GetDocument.loa d(src)
End Function

Function GetTemplate(src , name)
Dim domXSL

If Not IsEmpty(Applica tion(name)) Then

Set domXSL = Server.CreateOb ject("MSXML2.Fr eeThreadedDOMDo cument.3.0")
domXSL.async = False
domXSL.load(Ser ver.MapPath("sr c"))

Set GetTemplate = Server.CreateOb ject("MSXML2.XS LTemplate.3.0")
Set GetTemplate.sty lesheet = domXSL
Set Application(nam e) = GetTemplate
Else
Set GetTemplate = Application(nam e)
End If

End Function
May 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3341
by: Martin_Hurst | last post by:
Is it possible to establish a connection from within a postgres database to another external database on the network, i.e., not a java or scripting connection, BUT by some type of table definition within the postgres database of that external database table source - something similar to a proxy definition. Examples of external database could be MSAccess, Oracle, Sybase, MSQLServer, etc. The idea behind this would to be able to at least...
7
1778
by: Greg W via DotNetMonster.com | last post by:
hello all, I have site that I just moved to a new host. It is a dedicated server that sits behind a dedicated firewall. Most of the site uses classic ASP that are working fine but I have some parts that I am converting to .NET that can't seem to access the database. The server is windows 2k3 and I am using SQL Server 2k. In my web config file I have the following connection string:
3
2248
by: Jeremy Dillinger | last post by:
I am trying to design a program that will use data from a MySQL database. Currently all the data is being used with PHP scripts from a website. I am also trying to build a software solution that can use the same data. I have gone through all the data connectors in Visual Basic.net and none of them have the options for connecting to MySQL. Does anybody know how I would go about doing this? Thanks in advance! Jeremy
0
1271
by: Rico | last post by:
Hello, Does anyone have experience connecting to an Outlook PST file or Exchange Server database using a distributed database? I'm trying to access Contacts, Inbox and Sent Items information, but each client and client site has a different email set up. For instance, One client site up North operates in a stand alone environment using Outlook PST files and no network server. While others use a server based PST file, others use...
6
1455
by: mohsen_fakhari | last post by:
Hi I want to see data of a Btrieve database from access 2003. I have DDF files and the odbc driver and have made a data source. But to connect to this data source,from file menu,get external data,import, when I try to change the type of files to 'ODBC Databases' the import window is closed and nothing happens. What's on? Is this the only way of connecting to a data source?
3
3422
by: Big Charles | last post by:
Hi, We have developed an ASP.NET web application and are planning to host it in an external Server, which provides us a good bandwidht. We need to put he web application outside because the bandwidtht that we have in our local office won't be enough for the number of users that access to our web app. But for backup issues, the database server will be in our local office.
2
5338
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
8
3850
by: mouac01 | last post by:
I'm not sure if this is possible. I would like to have a PHP app on the Internet connect and write to a local database (Intranet). For example, users would go to a web site http://www.internet.com to run the app. The app requires an internet connection and is outside of the user's network. The app would have the option to either store data locally or on the Internet. I would like to give users the option to store data locally because...
1
4168
by: Deepath G | last post by:
This is deepath.. I am getting some linker error when i am trying to connect Websphere MQ using Borland C++ Builder 2006 using imqi.hpp on windows. Error Message ----------------------- Error: Unresolved external 'ImqMgr::~ImqMgr()' referenced from C:\DOCUMENTS AND SETTINGS\228753\MY DOCUMENTS\BORLAND STUDIO PROJECTS\DLLEXERCISE\DEBUG_BUILD\MANI.OBJ Error: Unresolved external 'ImqObj::~ImqObj()' referenced from C:\DOCUMENTS AND...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9150
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.