Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > How to access element names with dots and spaces?

Reply
Thread Tools

How to access element names with dots and spaces?

 
 
Ragnar Heil
Guest
Posts: n/a
 
      10-25-2004
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
 
Reply With Quote
 
 
 
 
Johannes Koch
Guest
Posts: n/a
 
      10-25-2004
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.)
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      10-25-2004
In article <(E-Mail Removed)> ,
Ragnar Heil <(E-Mail Removed)> 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



 
Reply With Quote
 
Ragnar Heil
Guest
Posts: n/a
 
      10-25-2004
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!
 
Reply With Quote
 
Ragnar Heil
Guest
Posts: n/a
 
      10-25-2004
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Module Names with . (dots)? activescott Python 5 04-05-2009 10:50 PM
Generating new element names from old element names UpgradeMyBrain@gmail.com XML 2 10-20-2006 08:24 AM
web.config does not allow section names with dots Vagif Abilov ASP .Net 4 02-11-2005 04:09 PM
Possible to traverse the children of an element without specifying child element names? Matt XML 2 10-12-2004 08:23 AM
Matching attribute names to element names in a different path Carl XML 0 04-01-2004 01:15 PM



Advertisments