CCRxXMLGenerator

An XML generator that takes XPath-like input and generates XML document.

Summary
CCRxXMLGeneratorAn XML generator that takes XPath-like input and generates XML document.
Preference DialogNone.
CommentsBelow is a sample usage of xml generator.
Functions
addNode
addAttribute
clear
generate

Preference Dialog

None.

Comments

Below is a sample usage of xml generator.

var x = this.xmlMolecule.generator;
x.clear();
x.addNode('/Test', '');
x.addNode('Subject', 'Book');
x.addNode('/Test/Subject', 'new year');
x.addAttribute('/Test/Subject[0]', 'Controvertial', 'Yes');
x.addNode('/Test/Date/Value', '56789');
x.addAttribute('/Test/Date', 'UTC', 'true');
x.addAttribute('/Test/Date', 'Daylight', '2');
var output = x.generate();

And the output looks like below.

<Test>
  <Subject Controvertial="Yes" >Book</Subject>
  <Subject>new year</Subject>
  <Date UTC="true" Daylight="2" >
      <Value>56789</Value>
  </Date>
</Test>

Functions

addNode

addNode(path, value);

Add a node to the internal XML tree.

Parameters

path(string)
value(string)

Returns

N/A

addAttribute

addAttribute(path, key, value)

Add an attribute to an existing node.

Parameters

path(string)
key(string)
value(string)

Returns

N/A

clear

clear();

Clear internal XML tree.

Parameters

N/A

Returns

N/A

generate

generate();

Generate XML from the internal XML tree.

Parameters

N/A

Returns

(string) an XML document.

Close