Dec 28, 2014 Replies: 2 This library is based on this open source project: https://code.google.com/p/xswi/ It provides a simple API to create valid XML documents. The API is similar to this B4A / B4J library: https://www.b4x.com/android/forum/threads/anyone-using-xmlbuilder-with-b4a.16277/#post-297511 Note that you must explicitly close all elements with the Up method. Example: Code: Dim x As XMLBuilder x = x.create("Projects") x = x.element("java-xmlbuilder") _ .attribute("language", "Java") _ .attribute("scm", "SVN") _ .element("Location") _ .up() _ .up() _ .element("JetS3t").Up.Up Log(x.AsString) Output: Code: <?xml version="1.0" encoding="utf-8" ?> <Projects> <java-xmlbuilder language="Java" scm="SVN"> <Location /> </java-xmlbuilder> <JetS3t /> </Projects> Installation instructions Each zip file contains three files with the following extensions: .xml, .a and .h. You need to copy the xml file to the internal libraries folder on the Windows computer. If you are using a local Mac builder then you need to copy the .a and .h files to the Mac Libs folder. Attachments iXmlBuilder.zip iXmlBuilder.zip 37.5 KB · Views: 119 Click to expand...
This library is based on this open source project: https://code.google.com/p/xswi/ It provides a simple API to create valid XML documents. The API is similar to this B4A / B4J library: https://www.b4x.com/android/forum/threads/anyone-using-xmlbuilder-with-b4a.16277/#post-297511 Note that you must explicitly close all elements with the Up method. Example: Code: Dim x As XMLBuilder x = x.create("Projects") x = x.element("java-xmlbuilder") _ .attribute("language", "Java") _ .attribute("scm", "SVN") _ .element("Location") _ .up() _ .up() _ .element("JetS3t").Up.Up Log(x.AsString) Output: Code: <?xml version="1.0" encoding="utf-8" ?> <Projects> <java-xmlbuilder language="Java" scm="SVN"> <Location /> </java-xmlbuilder> <JetS3t /> </Projects> Installation instructions Each zip file contains three files with the following extensions: .xml, .a and .h. You need to copy the xml file to the internal libraries folder on the Windows computer. If you are using a local Mac builder then you need to copy the .a and .h files to the Mac Libs folder.
D Daniele Zanoni Member Licensed User Longtime User Mar 5, 2020 #2 I'm converting B4A to B4i and now miss a property x.asString2(prop) : Dim x As XMLBuilder Dim ssXml As String Dim props As Map x = x.create("App") x = x.element("AppInfo") _ .element("IDM").text(IdMsgCounter).up() _ .elem ……….. .up() props.Initialize props.Put("{http://xml.apache.org/xslt}indent-amount", "4") props.Put("indent", "yes") ssXml = x.asString2(props) Dim jobxml1 As HttpJob jobxml1.Initialize("JOB111", Me) jobxml1.PostString("http://mobile.poppo.net/index.php", ssXml) jobxml1.GetRequest.SetContentEncoding("text/xml") How to solve it ? the instruction "x.asString2(props)" not works. Daniele Last edited: Mar 5, 2020
I'm converting B4A to B4i and now miss a property x.asString2(prop) : Dim x As XMLBuilder Dim ssXml As String Dim props As Map x = x.create("App") x = x.element("AppInfo") _ .element("IDM").text(IdMsgCounter).up() _ .elem ……….. .up() props.Initialize props.Put("{http://xml.apache.org/xslt}indent-amount", "4") props.Put("indent", "yes") ssXml = x.asString2(props) Dim jobxml1 As HttpJob jobxml1.Initialize("JOB111", Me) jobxml1.PostString("http://mobile.poppo.net/index.php", ssXml) jobxml1.GetRequest.SetContentEncoding("text/xml") How to solve it ? the instruction "x.asString2(props)" not works. Daniele
Erel B4X founder Staff member Licensed User Longtime User Mar 5, 2020 #3 1. Please use [code]code here...[/code] tags when posting code. 2. You should never post in old threads. Please start a new thread for your question.
1. Please use [code]code here...[/code] tags when posting code. 2. You should never post in old threads. Please start a new thread for your question.