More XML Confusion?

Dave dave at looktowindward.com
Tue May 29 08:34:13 EDT 2007


Hi,

Here are the two functions (adapted from Sarah's stack), sorry, I  
should have copied them before. When I run my code I get a "failure"  
node that's ok and a "failure" more that's empty - the second call  
overwrites the data of the first.

Any idea's?

Thanks a lot for your time
All the Best
Dave

------------------------------------------------------------------------ 
-----
--
--  UtilXMLNewElement
--
------------------------------------------------------------------------ 
-----
function UtilXMLNewElement theDocumentID,theParent,theTag,theData
   local mySubNode
   local myTag

   put UtilXMLCheckTag(theTag) into myTag
   revAddXMLNode theDocumentID,theParent,myTag,theData
   put the result into mySubNode
   if word 1 of mySubNode contains "xmlErr" then return false

   return true
end UtilXMLNewElement



------------------------------------------------------------------------ 
-----
--
--  UtilXMLNewAttribute
--
------------------------------------------------------------------------ 
-----
function UtilXMLNewAttribute theDocumentID,theParent,theTag,theData
   local mySubNode
   local myTag

   put UtilXMLCheckTag(theTag) into myTag
   revSetXMLAttribute theDocumentID,theParent,myTag,theData
   put the result into mySubNode
   if word 1 of mySubNode contains "xmlErr" then return false

   return true
end UtilXMLNewAttribute



On 29 May 2007, at 13:16, Ian Wood wrote:

>
> On 29 May 2007, at 13:04, Dave wrote:
>
>> I've been playing around and got to the point where I can add  
>> nodes etc. However I need to generate lots of "Failure" nodes.  
>> When I run the following code, only the second node gets added.  
>> How can I add multiple nodes?
>
> What is "UtilXMLNewElement"? I'm assuming that it's some function  
> of your own, as it's not a Rev function.
>
> I've successfully used the following inside a repeat structure,  
> where treeID is the ID of the XML tree:
>
> ====================================
>
> revAddXMLNode treeID,  tAssetsNode, "asset", ""
> put the result into tItemNode
> checkforerror tItemNode
> revSetXMLAttribute treeID, tItemNode, "id_number", char 2 to 4 of  
> numAssets
> revSetXMLAttribute treeID, tItemNode, "main_title", the main_title  
> of tControl
> revSetXMLAttribute treeID, tItemNode, "asset_path", the asset_path  
> of tControl
> revSetXMLAttribute treeID, tItemNode, "artist_name", the  
> artist_name of tControl
> revSetXMLAttribute treeID, tItemNode, "x", text of fld "x" of stack  
> "position"
> revSetXMLAttribute treeID, tItemNode, "y", text of fld "y" of stack  
> "position"
> revSetXMLAttribute treeID, tItemNode, "wall", text of fld "wall" of  
> stack "position"
> revSetXMLAttribute treeID, tItemNode, "pan", text of fld "pan" of  
> stack "position"
> revSetXMLAttribute treeID, tItemNode, "hFOV", text of fld "hFOV" of  
> stack "position"
> revSetXMLAttribute treeID, tItemNode, "hOffset", text of fld  
> "hOffset" of stack "position"
> revSetXMLAttribute treeID, tItemNode, "vOffset", text of fld  
> "vOffset" of stack "position"
>
> ====================================
>
> Ian
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list