Results 1 to 7 of 7

Thread: Error in implementing IXMLDOMNode Interface?

  1. #1
    satishjk
    Guest

    Question 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

  2. #2
    pvb
    Guest
    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:
    1. Private Sub Command1_Click()
    2.     Dim xmlDom As MSXML2.DOMDocument
    3.     Dim xmlDomNode As IXMLDOMNode
    4.     Set xmlDom = New MSXML2.DOMDocument
    5.     xmlDom.async = False
    6.     If xmlDom.loadXML("<xml><MyNode>234</MyNode></xml>") Then
    7.         Set xmlDomNode = xmlDom.documentElement.selectSingleNode("/xml/MyNode")
    8.         xmlDomNode.dataType = "int"
    9.         Debug.Print xmlDomNode.xml
    10.     End If
    11.     Debug.Print xmlDom.xml
    12.     Set xmlDomNode = Nothing
    13.     Set xmlDom = Nothing
    14. 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>

  3. #3
    satishjk
    Guest

    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

  4. #4
    pvb
    Guest
    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.

  5. #5
    New Member
    Join Date
    Apr 2002
    Posts
    4
    have you tried just changing the string type to a variant type and compiling the app? That would be my first approach.

  6. #6
    pvb
    Guest
    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.

  7. #7
    New Member
    Join Date
    Apr 2002
    Posts
    4
    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
  •  



Click Here to Expand Forum to Full Width