XML Structure and Node Types

XML (Extensible Markup Language) is a tree structure, where every element (node) is nested within a parent element. The entire document starts with a root element, and within it, there can be multiple branches and sub-elements.

When working with XML in Iguana, understanding its structure and node types allows you to efficiently manipulate and process XML documents.

<patient> <id>12345</id> <name> <firstname>Bruce</firstname> <lastname>Wayne</lastname> </name> <age>35</age> <status>active</status> <contactInfo type="email">bruce.wayne@example.com</contactInfo> <notes><![CDATA[Some special <characters> inside this note.]]></notes> </patient>

In this structure:

  • <patient> is the root element.

  • <id>, <name>, <age>, <status>, <contactInfo> and <notes> are child elements of <patient>.

  • <firstname> and <lastname> are children of the <name> element.

  • The text data within elements, such as 12345 and Bruce, are known as text nodes.

Iguana classifies a parsed XML using different node types:

In the above example XML, <patient>, <id>, and <name> are all xml.ELEMENT nodes. Elements can have attributes, child elements, or text inside of them.

Attributes are name-value pairs within an element and provide additional information about the element.

For example, the <contactInfo> element has an attribute type="email". type is the xml.ATTRIBUTE.

<contactInfo type="email">bruce.wayne@example.com</contactInfo>

Text nodes represent the actual text inside an element. In the example <firstname>Bruce</firstname>, the text node is Bruce.

CDATA (Character Data) sections are used when text data should not be parsed by the XML parser (e.g., containing special characters like &, <, >).

CDATA sections are treated as raw text and are often used to embed data like HL7 messages.

<notes><![CDATA[Some special <characters> inside this note.]]></notes>

With the XML API, you can use these node types to generate XML messages.

Â