Page 1 of 1 1
Topic Options
#135975 - 2005-03-19 07:57 PM XML Discussion
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Was just trying to hand-job a convert of one of my scripts, from using INI files to XML files ... not using the UDF's we developed right now, will be - but not right now ... basically I am saving the properties of an object.

Based on my read so far, this is how one would go about doing this (the object in this case is a GridView) ...

Code:

$xml = CreateObject("Microsoft.XMLDOM")

If Not $xml
Return
Endif

$grid = $xml.AppendChild($xml.CreateElement("grid"))

$grid.AppendChild($xml.CreateElement("AllowSorting")).Text = $GridView.AllowSorting
$grid.AppendChild($xml.CreateElement("RowCount")).Text = $GridView.RowCount
$grid.AppendChild($xml.CreateElement("ColumnCount")).Text = $GridView.ColumnCount

$= $xml.Save($SaveFileDialog.Filename)

Return



Its this stuff here I am scratching my head over:

$grid.AppendChild($xml.CreateElement("RowCount")).Text = $GridView.RowCount

Does one really need to create an element at the document level ($xml), then explicitly APPEND it to a child node, is this really the proper way of building the XML file, or am I missing a more simpler way.

-Shawn



Top
#135976 - 2005-03-19 08:02 PM Re: XML Discussion
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
One would think (intuitively) that one could just create a child element right from the parent, like this:

$parent = $xml.CreateElement("parent")

$child = $root.CreateElement("child")

Doesn't seem to work like that though ...

Top
#135977 - 2005-03-19 08:17 PM Re: XML Discussion
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
I have have been casually following all this XML stuff since I can't thik of a reason for me to use it yet, so I may be off.

But, shouldn't it be...

$parent = $xml.CreateElement("parent")

$child = $parent.CreateElement("child")
_________________________
Kelly

Top
#135978 - 2005-03-19 08:37 PM Re: XML Discussion
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
woops, ja - i changed it last minute to show the parent child names (had it coded as root / child before).


Top
#135979 - 2005-03-23 12:44 AM Re: XML Discussion
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Hey Shawn hoy did you get along with that XML gridView?

Edited by Jose (2005-03-23 12:45 AM)
_________________________
Life is fine.

Top
#190521 - 2008-11-06 03:29 PM Re: XML Discussion [Re: Jose]
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
Shawn,

Did you get any further with XML? I'm struggling with it to (i'm getting a dispatch error when trying to add an Child node)?
_________________________
Kind regards,

Top
#190529 - 2008-11-07 01:24 AM Re: XML Discussion [Re: Schuliebug]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hey Schulie whats up. Haven't played much with XML since I did some scripting of a skinned RSS reader in KF while back. Couple of questions:

1) You using UDF wrappers ?

2) You using 4.60 ?

I gave up using the wrappers, found it was just easier, less frustrating and more flexible to use the COM object directly. And 4.60 has some nasty com issues.

-Shawn

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (mole) and 529 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.057 seconds in which 0.025 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org