1. Why Local Browser Parsing Matters for Tax & Commercial E-Invoices
Mandatory B2B electronic invoicing regulations—from Saudi Arabia's ZATCA Fatoora Phase 2 and Europe's EN 16931 / Peppol BIS 3.0 to France's Factur-X and Germany's XRechnung / ZUGFeRD—have shifted commercial billing from human-readable PDFs to machine-readable XML. While ERP systems love XML, procurement officers, freelance contractors, and auditors still need to visually verify line items, VAT registration numbers, and totals before approving wire transfers.
Uploading raw commercial invoices to server-side XML-to-PDF converters exposes negotiated wholesale unit prices, customer VAT IDs, and supplier bank details to external infrastructure. Adawaty Pro parses every XML invoice strictly inside your browser's local RAM via the native W3C DOMParser API. Zero bytes leave your workstation, satisfying strict corporate NDA, GDPR, and tax-audit confidentiality policies while delivering an instant printable A4 invoice.
2. Deep Dive into UBL 2.1 & UN/CEFACT CII XML Architecture
Under the European EN 16931 semantic model and global tax authorities, two XML syntaxes dominate production e-invoicing:
OASIS UBL 2.1 (ZATCA, Peppol BIS, XRechnung)
A UBL 2.1 document opens with root element <Invoice> and splits fields across two primary XML namespaces: cbc: (Common Basic Components for leaf values like <cbc:ID>, <cbc:IssueDate>, <cbc:DocumentCurrencyCode>) and cac: (Common Aggregate Components for nested structures like <cac:AccountingSupplierParty>, <cac:AccountingCustomerParty>, <cac:TaxTotal>, <cac:LegalMonetaryTotal>, and repeating <cac:InvoiceLine> blocks). Each line item nests quantity (<cbc:InvoicedQuantity>), net line total (<cbc:LineExtensionAmount>), item description (<cac:Item><cbc:Name>), tax percentage (<cbc:Percent>), and unit price (<cac:Price><cbc:PriceAmount>).
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="EA">10</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="SAR">6500.00</cbc:LineExtensionAmount>
<cac:Item><cbc:Name>Enterprise ERP Annual Seat</cbc:Name></cac:Item>
<cac:Price><cbc:PriceAmount currencyID="SAR">650.00</cbc:PriceAmount></cac:Price>
</cac:InvoiceLine>
UN/CEFACT CII (Factur-X, ZUGFeRD, Chorus Pro)
Used extensively across France and Germany, CrossIndustryInvoice (CII) wraps header metadata in <rsm:ExchangedDocument> and puts commercial details inside <rsm:SupplyChainTradeTransaction>. Line items live in <ram:IncludedSupplyChainTradeLineItem>, seller/buyer identities live in <ram:SellerTradeParty> and <ram:BuyerTradeParty>, and totals live inside <ram:SpecifiedTradeSettlementHeaderMonetarySummation>. Because our DOM traversal inspects localName rather than hardcoded namespace prefixes, both schemas render cleanly in one tool.
3. Step-by-Step Viewing & PDF Printing Workflow
- Drop Your XML E-Invoice: Drag any UBL 2.1, ZATCA, Peppol, or Factur-X
.xmlfile into the blue dashed dropzone above (or click either Sample button to test immediately). - Verify Seller, Buyer & VAT IDs: Inspect the rendered formal invoice header to confirm tax registration numbers, currency code, and issue/due dates.
- Audit Line Items & Tax Totals: Confirm that every line item's quantity, unit price, VAT rate, and subtotal reconcile against the bottom Grand Total.
- Save Clean A4 PDF or Export CSV/JSON: Click Download / Print Clean PDF (select "Save as PDF" in the print dialog; disable browser headers/footers for a clean corporate invoice) or export structured line items to UTF-8 BOM CSV for Excel.
4. Technical Format Comparison Table
| Standard | Root XML Element | Primary Regions / Portals | Line Item Node |
|---|---|---|---|
| OASIS UBL 2.1 | <Invoice> | Peppol EU, Belgium, Netherlands, Nordics | cac:InvoiceLine |
| ZATCA Fatoora | <Invoice> (UBL 2.1) | Saudi Arabia (Phase 1 & Phase 2) | cac:InvoiceLine |
| Factur-X / ZUGFeRD | <CrossIndustryInvoice> | France (Chorus Pro), Germany | IncludedSupplyChainTradeLineItem |
| XRechnung | UBL 2.1 or CII | German public sector & B2B | Both supported |
5. Troubleshooting Common XML E-Invoice Parsing & Encoding Issues
- Unescaped Ampersands in Legal Names: Strict XML parsers reject
<cbc:Name>AT&T Services</cbc:Name>if the ampersand is not encoded as&. If an ERP emitted raw&, fix that character in a text editor before rendering. - Factur-X Embedded Inside PDF/A-3: Factur-X invoices often arrive as hybrid PDFs with
factur-x.xmlattached inside the PDF container. Extract the embedded XML attachment (or open standalone XML files directly here) for structured line-item CSV/JSON export. - Arabic & Bilingual Line Descriptions: ZATCA invoices frequently combine Arabic and English product descriptions inside
<cbc:Name>. Our UTF-8 decoder and UTF-8 BOM CSV export preserve right-to-left Arabic strings accurately in both print PDFs and Windows Excel. - Document-Level Allowances & Discounts: If an invoice applies a header-level
<cac:AllowanceCharge>discount, the sum of line items may differ slightly fromTaxExclusiveAmount—always verify the LegalMonetaryTotal summary block at the bottom of the rendered A4 sheet.
Validating Tax Categories, Rounding Rules & EN 16931 Business Terms
Automated tax portals enforce strict arithmetic validation rules defined under EN 16931 and ZATCA Phase 2 (such as Business Rules BR-CO-10 through BR-CO-15). Each line item's net total (BT-131, stored in <cbc:LineExtensionAmount>) must equal InvoicedQuantity × (PriceAmount / BaseQuantity) adjusted for line-level allowances or charges, rounded to two decimal places. At the document level, TaxExclusiveAmount (BT-109) must equal the sum of all line extension amounts minus document-level discounts plus document-level freight or handling surcharges. Finally, TaxInclusiveAmount (BT-112) must equal TaxExclusiveAmount + TaxAmount.
Inside UBL 2.1 and CII XML files, VAT categories are coded using UNCL5305 single-letter identifiers: S (Standard Rate, e.g., 15% in Saudi Arabia or 20% in France/Morocco), Z (Zero-Rated Goods), E (Exempt from Tax), AE (VAT Reverse Charge for cross-border EU B2B services), and O (Services Outside Scope of Tax). When an ERP system rejects an incoming supplier XML, opening it in this local viewer immediately exposes whether a missing CompanyID VAT registration number, mismatched currency attribute, or rounding discrepancy caused the rejection.
Extracting Factur-X XML from Hybrid PDF/A-3 Invoices via Command Line
In France and Germany, suppliers frequently deliver Factur-X / ZUGFeRD invoices as hybrid PDF/A-3 files containing an embedded factur-x.xml attachment. Accountants and developers can extract that embedded XML in one shell command using Poppler's pdfdetach before dropping it into this viewer for CSV/JSON line-item auditing:
# List and extract embedded factur-x.xml from a hybrid PDF/A-3 invoice:
pdfdetach -list invoice_hybrid.pdf
pdfdetach -saveall invoice_hybrid.pdf
Keeping both the original signed XML file (which carries legal tax validity under ZATCA and EU Peppol rules) and the rendered A4 PDF copy gives finance teams human readability for executive sign-off without sacrificing machine-audit compliance.
Frequently Asked Questions
How does this viewer support both UBL 2.1 (ZATCA / Peppol) and UN/CEFACT CII (Factur-X / ZUGFeRD) XML files?
It inspects the root element's localName via browser DOMParser: 'Invoice' routes through the OASIS UBL 2.1 extractor (
Why does namespace-agnostic localName matching matter for electronic tax invoices?
Different ERP vendors alias identical XML namespaces differently—some emit
How do I save the rendered A4 invoice as a clean PDF without browser headers or tool buttons?
Click 'Download / Print Clean PDF' and select 'Save as PDF' as the destination in your browser's print dialog. Dedicated @media print CSS hides the site header, upload box, navigation, and educational guide so only the formal A4 invoice sheet prints.
Does this tool read ZATCA Phase 2 Saudi e-invoices containing Base64 TLV QR codes and UBL extensions?
Yes. ZATCA Phase 2 XML files embed
Can I export invoice line items directly into Excel or accounting software?
Yes. Click Export Lines CSV to download a UTF-8 BOM comma-separated table of every line item (Description, Qty, Unit Price, VAT %, Line Total, Currency), or Export JSON for API ingestion.
What causes an 'Invalid XML syntax' error when opening a supplier's e-invoice?
Malformed XML usually stems from an unescaped ampersand (&) inside a supplier's legal name (e.g., 'Smith & Co' instead of 'Smith & Co') or a truncated download missing the closing tag.
Is my supplier pricing and tax ID data uploaded to Adawaty Pro servers?
No. XML DOM parsing, A4 layout rendering, and CSV/JSON generation run 100% inside local browser RAM with zero server transmission.