Re: automatically create fields from xml tree

2005-01-06 Thread Bob Hartley
At 23:28 05/01/2005, you wrote:
Bob,
It depends on what your XML structure looks like: For instance if your XML 
looks like:

Hi Chipp.
Well I gave this a try and made sure the text.xml file was in the same 
directory.

It originally looked like this
Database Version=6.0
Rec ID=217089 Arc=1 Dirty=1 Delete=1
Field ID=GENRComedy/Field
Field ID=TITLBig Fishies/Field
Field ID=RATGPG-13/Field
Field ID=YEAR2003/Field
Field ID=SEEN Type=11/Field
/Rec
Rec ID=217090
Field ID=GENRComedy/Field
Field ID=TITLTwo Weeks Notice/Field
Field ID=RATGPG-13/Field
Field ID=YEAR2002/Field
Field ID=SEEN Type=10/Field
/Rec
Rec ID=217091
Field ID=GENRDrama/Field
Field ID=TITLRoad to Perdition/Field
Field ID=RATGR/Field
Field ID=YEAR2002/Field
Field ID=SEEN Type=11/Field
/Rec
/Database
 and I eddited it to look like this
FieldComedy/Field
FieldBig Fishies/Field
FieldPG-13/Field
Field2003/Field
Field1/Field
Then tried the script in button but it did not do anything


fieldName/field
fieldAddress 1/field
fieldAddress 2/field
fieldCity/field
fieldState/field
buttonCancel/button
Then have the script of a btn
on mouseUp
  put URL(file:text.xml) into tXML
  repeat for each line L in tXML
put getTag(L) into tTagName
switch tTagName
case field
  create field getTagData(L,field)
  break
case button
  create button getTagData(L,button)
  break
end switch
  end repeat
end mouseUp
function getTagData pTagData,pTagName
  filter pTagData with   pTagName  *
  replace   pTagName   with  in pTagData
  replace /  pTagName   with  in pTagData
  return pTagData
end getTagData
function getTag pStr
  put offset(,pStr) into tStart
  put offset(,pStr) into tEnd
  return char tStart+1 to tEnd-1 of pStr
end getTag

I then changed the script to
function getTagData pTagData,pTagName
filter pTagData with   pTagName  *
replace   pTagName   with  in pTagData
replace /  pTagName   with  in pTagData
return pTagData
end getTagData
function getTag pStr
  put offset(,pStr) into tStart
  put offset(,pStr) into tEnd
  return char tStart+1 to tEnd-1 of pStr
end getTag
on mouseUp
  put URL(file:text.xml) into tXML
  repeat for each line L in tXML
put getTag(L) into tTagName
switch tTagName
case field
  create field getTagData(L,field)
  break
case button
  create button getTagData(L,button)
  break
end switch
  end repeat
end mouseUp
Just in case it needed the function before the on mouseup handler.
Still no luck.
I'll have a go later in the weekend.
cheers
bob

This will create a field for each field element and a button for each 
button element.

Hope that helps,
Chipp
Bob Hartley wrote:
Hi all.
Is it possible to automatically create fields from an xml tree using the 
runrev xml commands or do I need to know the names of the xml items?

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.7 - Release Date: 12/30/2004
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.8 - Release Date: 03/01/2005

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.8 - Release Date: 03/01/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


automatically create fields from xml tree

2005-01-05 Thread Bob Hartley
Hi all.
Is it possible to automatically create fields from an xml tree using the 
runrev xml commands or do I need to know the names of the xml items?

IE
Read xml tree
take item1 and create  field with the name of item1
etc etc
Cheers
Bob
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.8 - Release Date: 03/01/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: automatically create fields from xml tree

2005-01-05 Thread Chipp Walters
Bob,
It depends on what your XML structure looks like: For instance if your 
XML looks like:

fieldName/field
fieldAddress 1/field
fieldAddress 2/field
fieldCity/field
fieldState/field
buttonCancel/button
Then have the script of a btn
on mouseUp
  put URL(file:text.xml) into tXML
  repeat for each line L in tXML
put getTag(L) into tTagName
switch tTagName
case field
  create field getTagData(L,field)
  break
case button
  create button getTagData(L,button)
  break
end switch
  end repeat
end mouseUp
function getTagData pTagData,pTagName
  filter pTagData with   pTagName  *
  replace   pTagName   with  in pTagData
  replace /  pTagName   with  in pTagData
  return pTagData
end getTagData
function getTag pStr
  put offset(,pStr) into tStart
  put offset(,pStr) into tEnd
  return char tStart+1 to tEnd-1 of pStr
end getTag
This will create a field for each field element and a button for each 
button element.

Hope that helps,
Chipp
Bob Hartley wrote:
Hi all.
Is it possible to automatically create fields from an xml tree using the 
runrev xml commands or do I need to know the names of the xml items?

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.7 - Release Date: 12/30/2004
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution