|
-
Apr 3rd, 2001, 05:17 AM
#1
Thread Starter
Addicted Member
HI,
I have a simple VB dll, which tries to delete a node from an XML file. When I execute the code from a simple VB test it deletes no problem. But when I try to do the same action by referencing the dll method reference from ASP it fails.
Can someone look at the code and see if there appear to be any issues?
I also tried debugging the ASP code but this failed with a permission denied trying to create object error.
When not debugging the object is definitely created.
source below:
Thanks in advanced
Lenin.
ASP:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<P> </P>
<%
'---------------------- Variables ------------------------------
dim action
dim myXML
dim LinkID
dim Description
dim url
dim lb_loadOutcome '-- Return from Loading XML
dim lb_EditOutcome '-- Return from Edit function
dim ls_error_String '-- Generic Error String
'---------------------------------------------------------------
action = Request.QueryString("wants_to")
LinkID = Request.QueryString("LinkID")
url = Request.QueryString("URL")
Description = Request.QueryString("Description")
set myXML = Server.CreateObject("myXML.AddNewNodes")
lb_loadOutcome = myXML.LoadXML("c:\xml\search_engine\useful_links.xml", ls_error_String)
if lb_loadOutcome = True then
Response.Write "XXXXXXXXXXXX"
select case action
case "Update"
lb_EditOutcome = myXML.Edit_Element(LinkID, url, Description, ls_error_String)
case "Delete"
lb_EditOutcome = myXML.delete_useful_links(LinkID, ls_error_String)
end select
Response.Write action & " " & lb_EditOutcome & ls_error_String
end if
VB:
Public Function delete_useful_links(ByVal ls_NodeId As String, _
Optional ByRef error_string As Variant) As Boolean
'================================================================================
'================================================================================
'
' Purpose: Deletes the select node, as
' well as the item from the DOM Document
'
'================================================================================
'================================================================================
On Error GoTo err_delete
Dim objLinkElement As IXMLDOMNode
' Set objLinkElement = m_objDOMLinks.selectSingleNode("LINKS/*[@LINKID='" & ls_NodeID & "']")
'-- Set the objLinkElement to the LINKID attribute passed into the
'-- function
Set objLinkElement = m_objDOMLinks.selectSingleNode("//LINK[@LINKID='" & ls_NodeId & "']")
If objLinkElement Is Nothing Then
error_string = m_objDOMLinks.parseError.reason
' return function outcome
delete_useful_links = False
Exit Function
Else
'remove the found DOMDocument node
m_objDOMLinks.documentElement.removeChild objLinkElement
m_objDOMLinks.save m_strXmlPath
' return function outcome
delete_useful_links = True
End If
Exit Function
'-- Simple Log error module
err_delete:
error_string = err_log.Log_Error(Err, "delete_useful_error")
' error_string = m_objDOMLinks.parseError.reason
delete_useful_links = False
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|