# XML

## Introduction

The XML Storage Action allows users to perform structured data transformations between systems using XML. It supports both parsing existing XML files and composing new XML documents based on user-defined templates and data streams.  This action allows users to define a structured schema for reading from or writing to external systems (like Salesforce, FTP servers, or CRMs). This ensures accurate parsing and mapping of data during transfer processes.

## Configure the XML Action

#### Step 1: Configure XML

1. In the Flow Builder tab, drag and drop the XML storage action into your workflow.
2. Click **Configure** to open the XML Storage configuration tab.&#x20;

   <figure><img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2FG5aTW1JYMTmX59FhmTi6%2Funknown.jpeg?alt=media&#x26;token=99234f12-b051-45d7-b31d-96300ba31ce2" alt=""><figcaption></figcaption></figure>

#### Step 2: Select Operation

3. In the Operations dropdown, select whether the action is to:
   1. Compose: To write from XML to a destination&#x20;

      <figure><img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2FruyNJ341gqzJDntkx8TQ%2Funknown.png?alt=media&#x26;token=cb136b8b-cbea-47a7-9080-0d9cc475cf53" alt=""><figcaption></figcaption></figure>

#### Step 3: Define File Structure

4. In **Compose to**, use dynamic values. For example, you can use values like a DateTime field in the file name.
5. Proceed to Configure XML.&#x20;

   <figure><img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2FpUwybbGijGUs9GS3KoJU%2Funknown.jpeg?alt=media&#x26;token=18029542-873f-43f3-a4d1-066994db101d" alt=""><figcaption></figcaption></figure>

#### Step 4: Generate XML Structure

6. Use a sample file from your source data and convert it into a XML structure.
7. Ensure the XML includes field names and nested tags as per the source (for example, Salesforce fields).

**Example:**

| <p>\<Opportunity></p><p>    \<Name>Acme Inc\</Name></p><p>    \<Stage>Prospecting\</Stage></p><p>    \<Amount>5000\</Amount></p><p>    \<CloseDate>2025-06-09\</CloseDate></p><p>\</Opportunity></p> |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

#### Step 5: Test the XML Configuration

8. Click **Test** to validate the schema.
9. The output preview will show how the data appears.

#### Step 6: Enter the Enclosing Tag

10. Provide the Enclosing Tag. Wrap your XML output with custom root tags with comma separation (for example, root, invoice)

#### Step 7: Save to FTP

11. Drag and drop the **FTP** storage action from the left panel below **XML** action and set the destination FTP file path.
12. The system will now write the Salesforce data as an XML file to FTP.

#### XML Parsing and Mapping

Reading from FTP

**Step 1: Configure XML**

1. Navigate to the **Configure** tab.

**Step 2: Select Operation**

2. In the **Operation** dropdown, select:
   1. **Parse:** To read from a source and convert to XML
3. Upload or define the XML schema in the **Sample Document** field. This structure tells the system how to parse the incoming XML.&#x20;

   <figure><img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2FfRigxjyj9OpdkMBAkxum%2Funknown.jpeg?alt=media&#x26;token=d7c16984-ab8a-44b7-8292-4dd308906b30" alt=""><figcaption></figcaption></figure>

#### Mapping to CRM

* After parsing drag and drop the **Transform and Write** action, choose **Operation**, **Target Connector** and **Object** accordingly.&#x20;
  * Click **Map**.
  * In the right side schema, all the Fields that are defined above, will appear here.
  * Drag and drop fields from the XML to the CRM fields.

## Key Concepts

<table data-header-hidden><thead><tr><th width="169.85711669921875"></th><th></th></tr></thead><tbody><tr><td><strong>Term</strong></td><td><strong>Description</strong></td></tr><tr><td>XML Structure</td><td>Blueprint of how data is formatted in XML</td></tr><tr><td>Schema</td><td>Field definitions used for mapping and parsing</td></tr><tr><td>Compose</td><td>Interface where users define filename structure</td></tr><tr><td>Test Output</td><td>Sample result to validate XML correctness</td></tr><tr><td>Mapping</td><td>Field-to-field connection between source and destination</td></tr></tbody></table>

## Best Practices

* Always use a sample file to derive the XML schema.
* Validate the structure using the Test function before finalizing.
* Use ChatGPT or similar tools for fast conversion of sample data (like JSON or tables) into XML to use in the Compose or Parse operations.
* Ensure that XML field names match Salesforce API field names or source system labels.<br>

## Operation Examples

#### Common Scenarios to use the XML Action

* **Salesforce to FTP:** Read Salesforce Opportunity data, compose XML with dynamic fields (like DateTime), configure schema, test, and write to an FTP path as XML.
* **FTP to CRM:** Read XML from FTP, parse using the defined schema, and write to a CRM by mapping XML fields to CRM fields.

## FAQs

| <p>1. Can I automate XML integrations on a schedule?</p><p>Yes, DBSync supports flexible scheduling for XML integration jobs - hourly, daily, or custom intervals.</p><p>2. What if my XML structure changes?</p><p>Update your sample file and schema in the XML Storage Action, then revalidate using the <strong>Test</strong> function.</p><p>3. Which systems are supported?</p><p>You can integrate with popular CRMs (Salesforce, HubSpot, Microsoft Dynamics 365), ERPs (QuickBooks, NetSuite), cloud storage (AWS S3, Google Drive, FTP/SFTP), and more.</p> |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mydbsync.com/cloud-workflow/2026_create-your-workflow/action/storage-actions/xml.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
