XML

Ken Ray kray at sonsothunder.com
Wed Sep 4 10:31:00 EDT 2002


Doug, the ID is actually assigned to the XML *container* (data read from a
file, or from a block of XML in a variable, etc. There has to be some
"handle" to get a hold of the XML data, assuming and environment that can
hold multiple "documents" (XML containers) in memory at the same time

Since you're using 1.5, you might want to take a look at a scripted XML
alternative for Rev and MC at
http://www.sonsothunder.com/products/metacard/xmllib.htm. Once a document is
read, each node is given a unique ID number, and you can just refer to the
node by number. So here's an example of getting the name (tag) of all the
child nodes from the root node of a bunch of XML that you have in a global
(without error checking code for simplicity):

on mouseUp
  global gMyXMLData  -- holds the XML data you want to examine
  put XMLLoadData(gMyXMLData) into tDocNum
  put XMLGetRoot(tDocNum) into tRootNode
  put XMLGetChildren(tRootNode) into tKidNodeList
  put "" into tKids
  repeat for each line tKidNode in tKidLNodeList
    put XMLGetNodeName(tKidNode) & cr after tKids
  end repeat
  answer "The child nodes are: " & cr & tKids
end mouseUp

Just FYI,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



----- Original Message -----
From: "Ivers, Doug E" <Doug_Ivers at lord.com>
To: <use-revolution at lists.runrev.com>
Sent: Wednesday, September 04, 2002 8:05 AM
Subject: RE: XML


> Looks like most of the functions require a docID as the first parameter.
This seems a bit onerous if my stack never loads an external XML doc.
>
> To what extent is the loaded XML doc acting like a built-in Rev object --
on par with cards, fields, buttons, etc.?  Is this the intent of the
Rev/MetaCard programmers?
>
>
> -- D
>
>
> > -----Original Message-----
> > From: Sarah [mailto:sarahr at genesearch.com.au]
> > Sent: Tuesday, September 03, 2002 6:03 PM
> > To: use-revolution at lists.runrev.com
> > Subject: Re: XML
> >
> >
> > The docID is just a label that gets assigned to your XML
> > document once
> > it is read. You can have more than one document open at a
> > time, so this
> > docID tells the command which document to use for each operation.
> >
> > Sarah
> >
> > On Tuesday, September 3, 2002, at 10:32  pm, Ivers, Doug E wrote:
> >
> > > I've been trying to figure out how the xmltree-view.rev
> > works (the XML
> > > demo that comes with 1.5A7).  I don't understand the docID
> > thing.  The
> > > docID number seems arbitrary once the file is loaded.  (I'm
> > a beginner
> > > with XML, so I might be showing my ignorance -- I'm not
> > sure what is
> > > Rev specific versus standard XML.)
> > >
> > > One thing I'd like to do is extract (or create from
> > scratch) a field
> > > that displays an xml tree in outline form -- independent of
> > anything
> > > else, as would be appropriate for a library object.
> > >
> > > Any suggestions, tips, insight?
> > >
> > >
> > > -- D
> > >
> > >
> > > _______________________________________________
> > > use-revolution mailing list
> > > use-revolution at lists.runrev.com
> > > http://lists.runrev.com/mailman/listinfo/use-revolution
> > >
> >
> >
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list