B4i Library iXmlBuilder

Status
Not open for further replies.
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:
B4X:
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:
B4X:
<?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
    37.5 KB · Views: 115

Daniele Zanoni

Member
Licensed User
Longtime User
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:
Status
Not open for further replies.
Top