Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 4th, 2003, 03:28 PM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with Ch. 18 example

I have not been able to get the DomExample1.asp script to work. Downloaded the code off of the web site and tried it as well.

All I get is "An error occurred on the server when processing the URL. Please contact the system administrator."

All other asp files work ....

Any ideas?
Thanks.....
  #2 (permalink)  
Old November 4th, 2003, 04:18 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Can you post the code for the example? Not everyone has the book so it's a bit hard to guess what the problem is.

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #3 (permalink)  
Old November 5th, 2003, 08:47 AM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the asp code:

<%
'create an instance of MSXML to retreive the book details
set objXML = Server.CreateObject("microsoft.XMLDOM")

'load the XML document that we want to add to the database
objXML.load("c:\BegASP3Files\Ch18\XMLFiles\books.x ml")

'see if it loaded OK, i.e. is a well-formed XML file
If objXML.parseError.errorCode = 0 Then
  strTitle = objXML.documentElement.firstChild.firstChild.text
  strISBN = objXML.documentElement.firstChild.childNodes(1).te xt
  strDescription = objXML.documentElement.firstChild.childNodes(3).te xt

  Response.Write (strTitle & "<BR>")
  Response.Write (strISBN & "<BR>")
  Response.Write (strDescription & "<BR>")

'write out if an error occured
Else

  Response.Write ("Sorry, an error occurred retreiving information.")

End If

Set objXML = nothing
%>

Here is the books.xml:

<?xml version="1.0"?>
<books>
<book>
   <title>Beginning ASP 3.0</title>
   <ISBN>1-861003-38-2</ISBN>
   <authors>
      <author_name>Brian Francis</author_name>
      <author_name>Chris Ullman</author_name>
      <author_name>Dave Sussman</author_name>
      <author_name>John Kauffman</author_name>
      <author_name>Jon Duckett</author_name>
      <author_name>Juan Llibre</author_name>
   </authors>
   <description> ASP is a powerful technology for dynamically creating web site content. Learn how to create exciting pages that are tailored to your audience. Enhance your web/intranet presence with powerful web applications.</description>
   <price US="$49.99"/>
</book>
</books>

-----

I have tried:
set objXML = Server.CreateObject("Msxml2.DomDocument.3.0")

as other posts have suggested that microsoft.XMLDOM is very outdated.

The script fails on:
strTitle = objXML.documentElement.firstChild.firstChild.text

Thanks....
  #4 (permalink)  
Old November 5th, 2003, 03:24 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

What OS are you running? This sample code ran fine on my machine after I made a small modification:

objXML.load(Server.MapPath("books.xml"))

Instead of using a hard coded path, I used Server.MapPath to convert the virtual location of the XML to a physical location on disk. However, if the file is located at the location you had in your code, it should run.

Did you install one of the latest version of XML from Microsoft? You may need to install a recent version of the XML parser from this location: http://msdn.microsoft.com/library/de...xmlgeneral.asp

Once you install the latest version, you should be able to instantiate a DOM Object with this progid: Msxml2.DOMDocument.4.0

HtH,

Imar




---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #5 (permalink)  
Old November 5th, 2003, 03:25 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

In addition to this, check out this MSDN page:

http://msdn.microsoft.com/library/de...asp?frame=true

In the navigation tree on the left you'll find the full XML reference with lots of examples and explanations.

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #6 (permalink)  
Old November 6th, 2003, 08:25 AM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Huh .... that did it!

I thought that I'd tried that before, but I guess not.

So simple now!

Thanks for your help.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 18 - Deserialisation problem using dll classes Dan6 BOOK: Ivor Horton's Beginning Visual C++ 2005 1 February 20th, 2007 02:05 PM
Ch. 18-4 IE7 solution?? ccreed50 BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 January 9th, 2007 08:35 PM
can't get messagebox example in ch 18 to work itlotl VB.NET 2002/2003 Basics 3 January 13th, 2006 04:39 PM
Ch. 18 Exercise 1, is there a change? horseatingweeds BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 4 November 29th, 2005 05:33 PM
Ch. 18, page 636 Vera BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 0 March 18th, 2005 06:09 PM



All times are GMT -4. The time now is 07:39 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.