How to access element names with dots and spaces?

Discussion in 'XML' started by Ragnar Heil, Oct 25, 2004.

  1. Ragnar Heil

    Ragnar Heil Guest

    This line works fine for me:
    Set objDOMnode = objDom.selectSingleNode("//headline")
    strHeadline = objDOMnode.Text

    Now I want to get the value from this node:

    <nitf>
    - <head>
    - <docdata>
    - <date.issue norm="20020308T153751+0100" />

    Why does these line not give the correct results?
    Set objDOMnode = objDom.selectSingleNode("//date.issue norm")
    strDate= objDOMnode.Text
     
    Ragnar Heil, Oct 25, 2004
    #1
    1. Advertising

  2. Ragnar Heil wrote:
    > Now I want to get the value from this node:
    >
    > <nitf>
    > - <head>
    > - <docdata>
    > - <date.issue norm="20020308T153751+0100" />
    >
    > Why does these line not give the correct results?
    > Set objDOMnode = objDom.selectSingleNode("//date.issue norm")
    > strDate= objDOMnode.Text


    1. get the element node for "date.issue"
    2. get the attribute value for "norm"
    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)
     
    Johannes Koch, Oct 25, 2004
    #2
    1. Advertising

  3. In article <>,
    Ragnar Heil <> wrote:

    > - <date.issue norm="20020308T153751+0100" />
    >
    >Why does these line not give the correct results?
    > Set objDOMnode = objDom.selectSingleNode("//date.issue norm")


    You saeem to be treating this as if it were an element called
    "date.issue norm". It isn't, it's an element called "date.issue"
    with an attribute called "norm".

    Element names can't have spaces in.

    -- Richard
     
    Richard Tobin, Oct 25, 2004
    #3
  4. Ragnar Heil

    Ragnar Heil Guest

    Thank you both for your replies!

    I tried two ways to get the value

    1) Set objDateNode = objDom.selectSingleNode("//date.issue")
    Set DateNodeAttr = objDateNode.Attributes
    norm = DateNodeAttr.getNamedItem("norm")
    strDate = norm.xml

    2) DateNodeAttrLength = DateNodeAttr.length
    For i = 1 To DateNodeAttrLength
    strDate = DateNodeAttr(i).Value
    Next

    what is the prefered way?


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Ragnar Heil, Oct 25, 2004
    #4
  5. Ragnar Heil

    Ragnar Heil Guest

    Thank you both for your replies!

    Now I tried two ways to get the value of the attribute:

    1) Set objDateNode = objDom.selectSingleNode("//date.issue")
    Set DateNodeAttr = objDateNode.Attributes
    norm = DateNodeAttr.getNamedItem("norm")
    strDate = norm.xml

    2) DateNodeAttrLength = DateNodeAttr.length
    For i = 1 To DateNodeAttrLength
    strDate = DateNodeAttr(i).Value
    Next

    Both ways dont work :-(


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Ragnar Heil, Oct 25, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vagif Abilov
    Replies:
    4
    Views:
    383
    Vagif Abilov
    Feb 11, 2005
  2. Carl
    Replies:
    0
    Views:
    540
  3. Replies:
    2
    Views:
    529
  4. activescott

    Module Names with . (dots)?

    activescott, Apr 5, 2009, in forum: Python
    Replies:
    5
    Views:
    311
  5. PeteC
    Replies:
    6
    Views:
    147
    David Dorward
    Jul 13, 2005
Loading...

Share This Page