J joneden Active Member Licensed User Longtime User Sep 17, 2012 #1 Hi, I'm using XMLBuilder to build an XML file (to send upto a webservice). I need to insert a set of prebuilt XML snippets into the file. How do I insert precreated XML into the file retaining it's structure? My code at the moment is as below: The issue lies on the line that at the moment has .text(obj.... The XML data is stored in a db. Code: For i = 0 To objCursor.RowCount - 1 objCursor.Position = i objXMLBuilder.element("UploadEntry") _ .attribute("ID",objCursor.GetString("ID")) _ .element("ActionXML") _ .text(objCursor.GetString("XMLString")) Next Regards, Jon
Hi, I'm using XMLBuilder to build an XML file (to send upto a webservice). I need to insert a set of prebuilt XML snippets into the file. How do I insert precreated XML into the file retaining it's structure? My code at the moment is as below: The issue lies on the line that at the moment has .text(obj.... The XML data is stored in a db. Code: For i = 0 To objCursor.RowCount - 1 objCursor.Position = i objXMLBuilder.element("UploadEntry") _ .attribute("ID",objCursor.GetString("ID")) _ .element("ActionXML") _ .text(objCursor.GetString("XMLString")) Next Regards, Jon
Erel B4X founder Staff member Licensed User Longtime User Sep 18, 2012 #2 Can you post the result vs. the wanted result? Upvote 0
J joneden Active Member Licensed User Longtime User Sep 18, 2012 #3 Hi Erel, Sure, below is a sample of what I want <UploadEntry ID="43"> <ActionXML> <ReactiveTask ID="8700"> <Notes>Here are some notes that need to be saved against the task </Notes> </ReactiveTask> </ActionXML> </UploadEntry> <UploadEntry ID="44"> <ActionXML> <PostTask ID="875846795"> <Delivered>17 Sep 2012 09:21:02</Delivered> <DeliveredBy>Roger Smith</Delivered> </ReactiveTask> </ActionXML> </UploadEntry> The UploadEntry tag allows the server to confirm that it has managed to utilise the XML in the ActionXML tag. Then once all are processed some XML will come back from the server with a list of all the UploadEntries that can be deleted from the database on the device. Any that for some reason can't be uploaded will then be visible on the device. The ReactiveTask and PostTask XML in the example are generated when someone closes the tasks on the device, then come upload time I want their XML to be inserted into this the rest of it. Obviously I can create this using standard strings but I wanted to generate in a more concise and elegant way using the toolkit that's already there... Cheers, Jon Upvote 0
Hi Erel, Sure, below is a sample of what I want <UploadEntry ID="43"> <ActionXML> <ReactiveTask ID="8700"> <Notes>Here are some notes that need to be saved against the task </Notes> </ReactiveTask> </ActionXML> </UploadEntry> <UploadEntry ID="44"> <ActionXML> <PostTask ID="875846795"> <Delivered>17 Sep 2012 09:21:02</Delivered> <DeliveredBy>Roger Smith</Delivered> </ReactiveTask> </ActionXML> </UploadEntry> The UploadEntry tag allows the server to confirm that it has managed to utilise the XML in the ActionXML tag. Then once all are processed some XML will come back from the server with a list of all the UploadEntries that can be deleted from the database on the device. Any that for some reason can't be uploaded will then be visible on the device. The ReactiveTask and PostTask XML in the example are generated when someone closes the tasks on the device, then come upload time I want their XML to be inserted into this the rest of it. Obviously I can create this using standard strings but I wanted to generate in a more concise and elegant way using the toolkit that's already there... Cheers, Jon
Erel B4X founder Staff member Licensed User Longtime User Sep 19, 2012 #4 You will need to recreate the complete XML. It is not possible to insert any string in the middle. Upvote 0
J joneden Active Member Licensed User Longtime User Sep 19, 2012 #5 Hi Erel, That's what I thought. I'm still using my snippet of XML for the middle and just using stringbuilder around it. I did see a java lib somewhere that extended the XMLBuilder functionality. Maybe I'll see if I can convert that as an experiment Regards, Jon Upvote 0
Hi Erel, That's what I thought. I'm still using my snippet of XML for the middle and just using stringbuilder around it. I did see a java lib somewhere that extended the XMLBuilder functionality. Maybe I'll see if I can convert that as an experiment Regards, Jon