How does revAppendXML work?

John Patten johnpatten at mac.com
Thu May 25 19:25:15 EDT 2006


Hello All!

I have multiple xml files that are identical in format...

<?xml version="1.0"?>
<StudentURL_table>
  <URL IDnum="1">
    <subject> Art</subject>
    <key_words> Fine Art</key_words>
    <Grade> 5</Grade>

...

They just have different <URL IDnum #> content. Such as...

 <URL IDnum="1">
    <subject> Art</subject>
    <key_words> Fine Art</key_words>
    <Grade> 5</Grade>
    <Standard> Creativity</Standard>
    <Title> SPARK Site</Title>
    <Description> This site is great for introducing students to the varied definitions of fine art and expression.</Description>
    <Submitted_by> John Art</Submitted_by>
    <emailAddress> art at mail.com</emailAddress>
    <school> Orchard School</school>
    <WebAddress> www.kqed.org/spark</WebAddress>
  </URL>
  <URL IDnum="2">
    <subject> Art</subject>
    <key_words> San Fracicso, Museum of Modern Art</key_words>
    <Grade> 5</Grade>
    <Standard> VAPA</Standard>

...

I want to take these multiple XML files and combine them into one large xml file with the same format.

I was thinking I could do something like this:

 answer folder "Select XML folder" as sheet
  if it = "" then exit mouseUp
  set the defaultFolder to it
  

  put the files  into tFiles
  put the number of lines of tFiles into tNumberofXMLFiles
  put line 1 of tFiles into theFileName
  put URL ("file:" & theFileName) into tData

get revCreateXMLTree(tData,true,true,true)

put the result into targetXMLFile


put 1 into x
repeat tNumberOfXMLFiles
  

  revAppendXML targetXMLFile,"/StudentURL_table/",URL "file:" & line x of tFiles 
  add 1 to x
  end repeat
--
Put revXMLText(targetXMLFile,,true)

end mouseUp

-----------------------------------------------

However, I appear to be misunderstanding what revAppendXML does, or how to use it correctly.

Can anyone offer advice?

Thank you!

John Patten
SUSD






More information about the use-livecode mailing list