# XML plugin 1.0b1 released

**URL:** <https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952>\
**Category:** Classic Servoy\
**Created:** [May 21, 2006, 2:49pm UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952 "2006-05-21T14:49:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 21, 2006, 2:49pm UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/1 "2006-05-21T14:49:29Z")

</div>

Today we released the first public beta of our XML plugin.

The XML plugin allows you to do things like:

- Create an XML document (object) from an XML file, a URL or from a Servoy record or foundset. You can also start with an empty XML document and add elements yourself.
- Parse XML content inside Servoy
- Support for namespaces, comments and attributes
- Includes a recordFormatter class that will properly encode a Servoy record for XML use (formats dates, numbers and media content). The recordFormatter can also re-create an array from XML data, where the correct data type will be returned (so for example a base64 encoded media content inside the XML will be returned as a byte array)
- Support for xsl transformation that allows you to format XML content using a style sheet and properly output the XML in HTML  
Besides the possibility to create and parse any XML document, the plugin can also create XML from Servoy records and foundsets including related data if needed. A simple call like

```auto
var vRelations = new Array('relation1', 'relation2');
var vFoundsetXml = plugins.XML.XMLDocument(foundset, vRelations);

```

can create an XML document like this:

```auto
<?xml version="1.0" encoding="ISO-8859-1"?>
<table name="data">
  <formatting>
    <DATE>dd.MM.yyyy</DATE>
    <DATETIME>dd.MM.yyyy HH:mm</DATETIME>
    <DATETIMESECONDS>dd.MM.yyyy HH:mm:ss</DATETIMESECONDS>
    <NUMBER>#,##0.##</NUMBER>
    <INTEGER>#,###</INTEGER>
    <MEDIA>Base64</MEDIA>
  </formatting>
  <data>
    <record dataid="62">
      <data>
        <text_field type="TEXT">This is just plain text.</text_field>
        <number_field type="NUMBER">23,45</number_field>
        <dataid type="INTEGER">62</dataid>
        <date_field type="DATE">20.05.2006</date_field>
        <integer_field type="INTEGER">1</integer_field>
      </data>
      <relation name="relation1" table="related_data">
        <record related_dataid="1">
          <data>
            <text_field type="TEXT">some text</text_field>
            <number_field type="NUMBER">24,4</number_field>
            <dataid type="INTEGER">62</dataid>
            <related_dataid type="INTEGER">1</related_dataid>
            <date_field type="DATE">20.05.2006</date_field>
          </data>
        </record>
        <record related_dataid="2">
          <data>
            <text_field type="TEXT">some more text</text_field>
            <number_field type="NUMBER">19,8</number_field>
            <dataid type="INTEGER">62</dataid>
            <related_dataid type="INTEGER">2</related_dataid>
            <date_field type="DATE">11.05.2006</date_field>
          </data>
        </record>
      </relation>
    </record>
  </data>
</table>

```

We use this for example to archive deleted records. When those records have to be recreated, the plugin offers a functionality that allows you the provide the above XML and get an Array with all included data transformed to the data type the field has. This can be done as easy as

```auto
// Create an XML document from XML data
var vXml = plugins.XML.XMLDocument(xml_data);
// Get the record element(s)
var vRecords = vXml.getRecordElements();
for ( var i = 0 ; i < vRecords.length ; i++ )
{
	// Get the i-th record element
	var vSingleRecord = vRecords[i];
	// Let the RecordFormatter re-create an object array, where the single fields are returned according to their type
	var vRecordObject = vRecordFormatter.getRecordObject(vSingleRecord, vFormatter);
}

```

the vRecordObject is a two-dimensional array that contains colum name and the field content either as Text, Integer, Number, Date or Byte Array.

As long as the plugin is in beta testing, please contact me by email if you want to test it.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 21, 2006, 3:14pm UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/2 "2006-05-21T15:14:36Z")

</div>

I forgot to mention: of course you can easily parse RSS feeds with the plugin…

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [May 22, 2006, 7:10am UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/3 "2006-05-22T07:10:12Z")

</div>

Hi Patrick,

Very nice work, this plugin. Very handy!

Paul

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 22, 2006, 11:52am UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/4 "2006-05-22T11:52:47Z")

</div>

Did I mention that XPath expressions are also supported? ![:wink:]( "Wink")

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [May 22, 2006, 11:55am UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/5 "2006-05-22T11:55:18Z")

</div>

No, please explain… ![:D]( "Very Happy") ![:D]( "Very Happy") ![:D]( "Very Happy") ![:D]( "Very Happy")

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 22, 2006, 1:24pm UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/6 "2006-05-22T13:24:29Z")

</div>

Paul is doing crazy stuff as

```auto
var vXPath = '//parameter[@name=\'P_COMPANYCODE\']'
var vElements = vXml.getElementByXPath(vXPath)

```

and in 1.0b3 that actually works (so in case you need XPath, send me a mail for the latest version…)!

---

<div class="post-metadata">

**Author:** ![faheemhameed](https://avatars.discourse-cdn.com/v4/letter/f/7ea924/32.png) [@faheemhameed](https://forum.servoy.com/u/faheemhameed)\
**Post date:** [September 12, 2006, 8:57am UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/7 "2006-09-12T08:57:37Z")

</div>

Hi Patrick,

Where can I download a trial version of this plugin?

Thanks,  
Hameed

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [September 12, 2006, 9:05am UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/8 "2006-09-12T09:05:55Z")

</div>

Hello Hameed,

please send a message to [plugins@maison-partner.de](mailto:plugins@maison-partner.de).

I will send you a demo then.

BTW: the plugin is not beta anymore…

---

<div class="post-metadata">

**Author:** ![faheemhameed](https://avatars.discourse-cdn.com/v4/letter/f/7ea924/32.png) [@faheemhameed](https://forum.servoy.com/u/faheemhameed)\
**Post date:** [September 12, 2006, 11:09am UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/9 "2006-09-12T11:09:34Z")

</div>

Hi Patrick,

Thanks for sending me the plugin.

I am trying the following code

```auto
//var fileNamePath = "D:/DATA/SERVOY/CLA/Migration/contact.xml";
//var xmlDoc = plugins.XML.XMLDocument(fileNamePath);
var xmlDoc = plugins.XML.XMLDocument(forms.contact$detail.foundset);

application.output(xmlDoc.docType)

```

the xmlDoc is alway null either I use fileNamePath or a foundset. Any idea?

Thanks

Servoy Developer  
Version 3.0rc4-build 368  
Java version 1.5.0\_06-b05 (Windows XP)

---

<div class="post-metadata">

**Author:** ![faheemhameed](https://avatars.discourse-cdn.com/v4/letter/f/7ea924/32.png) [@faheemhameed](https://forum.servoy.com/u/faheemhameed)\
**Post date:** [September 12, 2006, 1:57pm UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/10 "2006-09-12T13:57:04Z")

</div>

Hi Patrick,

Do you have any idea on that issue? Is that because I am using the latest version of Servoy?

I am eager to get it to work. I need your help.

Thanks a lot,

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [September 12, 2006, 2:18pm UTC](https://forum.servoy.com/t/xml-plugin-1-0b1-released/5952/11 "2006-09-12T14:18:02Z")

</div>

Hello Hameed,

I think it is best to not use the forum for plugin questions. If you have a problem/question please contact me via [plugins@maison-partner.de](mailto:plugins@maison-partner.de).

Anyway, your problem seems to be either

- the plugin is not registered
- the 30 minutes demo period is over (restart Servoy)

Have a look a the log. Registration issues are written to the log.

Patrick
