|
-
Apr 15th, 2002, 03:23 PM
#1
Error in implementing IXMLDOMNode Interface?
I am trying to implement IXMLDOMNode Interface by using
Implements IXMLDOMNode.
That interface has one of its property definitions as given below, which
differs in data type. As in Let Property definition it has String data type
where in Get Property it has Variant.
Private Property Let IXMLDOMNode_dataType(ByVal RHS As String)
End Property
Private Property Get IXMLDOMNode_dataType() As Variant
End Property
Because of that type mismatch in property definition I am getting following
error:
Compile Error:
Definitions of property procedures for the same property are inconsistent,
or a property procedure has an optional parameter, a ParamArray or an Invalid
set final parameter.
I would appreciate any help to solve the above problem.
Thanks,
Satish
-
Apr 16th, 2002, 01:46 AM
#2
I could be way off on this but I'm pretty sure you can't do what you're trying to do. I guess it doesn't really make sense why you would want to code the implementation to that interface and i'm thinking that as far as vb is concerned, perhaps all languages, that you can't do that and that's probably by design. To use the interface you could do the following:
VB Code:
Private Sub Command1_Click()
Dim xmlDom As MSXML2.DOMDocument
Dim xmlDomNode As IXMLDOMNode
Set xmlDom = New MSXML2.DOMDocument
xmlDom.async = False
If xmlDom.loadXML("<xml><MyNode>234</MyNode></xml>") Then
Set xmlDomNode = xmlDom.documentElement.selectSingleNode("/xml/MyNode")
xmlDomNode.dataType = "int"
Debug.Print xmlDomNode.xml
End If
Debug.Print xmlDom.xml
Set xmlDomNode = Nothing
Set xmlDom = Nothing
End Sub
The immediate window output looks like this:
Code:
<MyNode xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="int">234</MyNode>
<xml><MyNode xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="int">234</MyNode></xml>
-
Apr 16th, 2002, 08:10 AM
#3
Thanks...
Thank you,
what I am doing here is trying to use the MSXML and implement this in my own object say myxml. This myxml I wnat to implement MSXML interfaces.
in my declaration I have
Implements IXMLDOMNode
For Implements I need to implement every interface for MSXML. However, the datatype property has mismatch for get and set, which gives an error, as I mentioned in my previous message. I am trying to get way around for the implementation of datatype property.
Hope this will clear it little bit.
any answer, suggestion is welcome.
Satish
-
Apr 16th, 2002, 11:01 PM
#4
So, now I'm curious. I understood what you wanted to do in the first place, now I want to know why you want to implement the IXMLDOMNode interface yourself in vb. There's no way you're going to improve anything in the existing implementation with VB. Surely they(MS) used some pretty low level code, C++ most likely, that would smoke any vb code. Let me know, sounds interesting.
-
Apr 19th, 2002, 02:01 PM
#5
New Member
have you tried just changing the string type to a variant type and compiling the app? That would be my first approach.
-
Apr 19th, 2002, 08:04 PM
#6
With the concept of implementing interfaces you don't get to change the interface you're implementing, just doesn't work that way for good reasons.
-
Apr 22nd, 2002, 02:44 PM
#7
New Member
I am more curious than belligerent. How could it be set up correctly in the interface with two different variable types when it can not be done with any other properties created?
i.e. -
public property get x() as integer
must have
public property let x(vData as integer)
as it's counter form, it will not pass the compiler in the form of
public property let x(vdata as variant)
If I am missing something I would like to know.
Thanks,
Jeff
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
|