Skip to content

Martini XML Functions

The XML class in Martini provides a comprehensive set of functions designed for managing XML data within services. These functions enable developers to create and manipulate objects from XML strings or streams efficiently, with a focus on integration with service-specific data models.

Intended Usage

  • Target Audience: Developed for professional developers within service environments.
  • Compatibility: Optimized for use in services, these functions are not suitable for Groovy scripts.
  • Location: Accessible through the functions node in the navigator, under the XML folder.

Functionality

  • Implementation: Functions can be implemented in a service either by drag-and-drop or through the content assist feature, which is activated by pressing the 'full stop' key followed by “xml dot.”
  • Service and Package Naming: The appearance of function suggestions may vary based on the naming conventions of services and packages within your Martini instance. Directly using the function name helps in locating the specific function needed.
  • Comparison to JSON Functions: While similar in operational approach to JSON functions, XML functions are specifically tailored for XML data types.

Using XML Functions

  • XML String to Data Model Conversion:
  • Purpose: Convert XML strings to data models suitable for use in services.
  • Process: The function accepts an XML string as input and outputs a plain object, which can then be mapped to a predefined data model.
  • Data Model Mapping: Automatic mapping occurs when property names in the XML string match those in the data model.
  • Flexibility in Data Models: Developers can define and customize data models as needed, with options for including additional properties.

Advanced Usage

  • Custom Data Model Mapping: Advanced users can further tailor the mapping process by adjusting the data model, allowing for more complex data structures and additional property configurations.
  • Efficient Data Handling: The XML functions are designed to handle large and complex XML data efficiently, ensuring high performance even in demanding service environments.