---
id: post/aardvarklabs-blog/2866
type: post
title: Importing XML into Business Central with AL
summary: The post demonstrates how to parse cXML (commerce eXtensible Markup Language) files in Business Central using AL code without specialized XML codeunits. It walks through a practical example of extracting purchase order data from an XML file and populating custom tables, highlighting the hierarchical node-based navigation required for XML parsing.
tier: community
language: en
tags:
  - xml parsing
  - data exchange
  - cxml format
  - al coding
  - file import
  - vendor data
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-10-08T01:57:59.812Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-post: 1
  input_hash: 521dc5563d48cd7d7574204cd1f1af9b300aaf03dfb089cd400642e90286bb5a
evidence:
  - kind: blog
    url: https://aardvarklabs.blog/2025/12/12/importing-xml-into-business-central-with-al/
    title: Importing XML into Business Central with AL
    date: "2025-12-12"
    commit: null
    t: null
    quote: null
  - kind: blog
    url: https://aardvarklabs.blog/2025/12/12/importing-xml-into-business-central-with-al/
    title: Importing XML into Business Central with AL
    date: "2025-12-12"
    commit: null
    t: null
    quote: XML files differ from many others in that the XML file should be paired with a definition file.
  - kind: blog
    url: https://aardvarklabs.blog/2025/12/12/importing-xml-into-business-central-with-al/
    title: Importing XML into Business Central with AL
    date: "2025-12-12"
    commit: null
    t: null
    quote: Because of this strict format we can ask for data within a given node and expect it to be there.
links:
  learn: []
  objects:
    - object/table/23
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
post_id: "2866"
source_id: aardvarklabs-blog
source_name: Aardvark Labs
url: https://aardvarklabs.blog/2025/12/12/importing-xml-into-business-central-with-al/
published_at: "2025-12-12T13:00:00.000Z"
author: Marcel Chabot
full_text: false
words: 1134
quotes:
  - text: XML files differ from many others in that the XML file should be paired with a definition file.
    why_it_matters: Understanding that XML relies on schema definitions explains why validation against XSD is important for reliable parsing
  - text: Because of this strict format we can ask for data within a given node and expect it to be there.
    why_it_matters: Justifies why XML parsing uses static node paths rather than the flexible navigation required for JSON
code_objects_mentioned:
  - table ARD_cXMLPOHeader
  - table ARD_cXMLPOLine
  - table Vendor
systems:
  - integration
  - purchasing
  - development
versions_mentioned: []
preview:
  embeddable: true
  frame_url: https://aardvarklabs.blog/2025/12/12/importing-xml-into-business-central-with-al/embed/
  image: https://aardvarklabs.blog/wp-content/uploads/2025/12/e805f908-67da-4479-915b-2876ee18d6b3.jpg
  image_alt: null
  image_w: 1024
  image_h: 1024
  site_name: Aardvark Labs
  favicon: https://aardvarklabs.blog/wp-content/uploads/2024/04/design-1.png?w=32
  probed_at: "2026-10-07T11:51:15.050Z"
---

# Importing XML into Business Central with AL

[Read the post](https://aardvarklabs.blog/2025/12/12/importing-xml-into-business-central-with-al/) · Aardvark Labs (Marcel Chabot) · 2025-12-12 · 1134 words · tier community · reviewed (checked by Opus)

> The post demonstrates how to parse cXML (commerce eXtensible Markup Language) files in Business Central using AL code without specialized XML codeunits. It walks through a practical example of extracting purchase order data from an XML file and populating custom tables, highlighting the hierarchical node-based navigation required for XML parsing.

## Key points

- XML is meant to follow a schema (XSD), so code can select fixed node paths and expect the data to be there, unlike typical JSON handling
- The example uses only the built-in XmlDocument, XmlNodeList, XmlNode, XmlElement and attribute types, with nested loops over child elements and no helper codeunits
- cXML dates from 1999, but in practice sources often ignore the definitions, so each one needs its own exception handling
- ParseXML reads the vendor ID, order date and ID, and line quantity, part ID, description, price, currency and unit of measure into custom header and line tables
- The author found the manual approach painful and asks whether readers use XMLports instead

## Quotes

- "XML files differ from many others in that the XML file should be paired with a definition file." (Understanding that XML relies on schema definitions explains why validation against XSD is important for reliable parsing)
- "Because of this strict format we can ask for data within a given node and expect it to be there." (Justifies why XML parsing uses static node paths rather than the flexible navigation required for JSON)

## AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

- table "ARD_cXMLPOHeader"
- table "ARD_cXMLPOLine"
- [table 23 "Vendor"](../../objects/table/23.md)

Not found in BC28-30: table "ARD_cXMLPOHeader", table "ARD_cXMLPOLine".

## Context

- Features: XML document parsing, XmlDocument object handling, Node selection and navigation, Attribute extraction, cXML purchase order import, Hierarchical data drilling

Source: Aardvark Labs, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.
