| Re: Another XML Question [message #43072 is a reply to message #43066] |
Tue, 22 March 2005 19:52   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Michael Wallace writes:
> So, when you say there's an "end of line string" or something in there,
> what exactly are you talking about? I'm just curious what kind of
> gremlin or banshee you're dealing with.
Well, here is my XML file:
<CONFIGDATA>
<CAMPAIGN_ID>
<TYPE>INT</TYPE>
<VALUE>00</VALUE>
</CAMPAIGN_ID>
<SPAM_WAIT>
<TYPE>INT</TYPE>
<VALUE>60</VALUE>
<UNITS>Seconds</UNITS>
</SPAM_WAIT>
</CONFIGDATA >
Here is my code:
doc = Obj_New('IDLffXMLDOMDocument')
doc -> Load, Filename=filename, /Exclude_Ignorable_Whitespace
tags = doc -> GetElementsByTagName('CONFIGDATA')
node = tags -> Item(0)
children = node -> GetChildNodes()
FOR j=0,children->GetLength()-1 DO BEGIN
child = children -> Item(j)
Help, child
ENDFOR
And here is the result:
CHILD OBJREF = <ObjHeapVar43440(IDLFFXMLDOMTEXT)>
CHILD OBJREF = <ObjHeapVar43443(IDLFFXMLDOMELEMENT)>
CHILD OBJREF = <ObjHeapVar43445(IDLFFXMLDOMTEXT)>
CHILD OBJREF = <ObjHeapVar43447(IDLFFXMLDOMELEMENT)>
CHILD OBJREF = <ObjHeapVar43449(IDLFFXMLDOMTEXT)>
Only child 2 and 4 are the elements I'm looking for: CAMPAIGN_ID
and SPAM_WAIT. The other three children are some kind of white
space thingy. If I get the value of the TEXT objects, I see a single
quote on one line and a single quote on the next line. No text.
If I get the children of the CAMPAIGN_ID element, there are 9 of
them, and only 3 I care about.
Go figure!
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
|