Native XFA XML Comments and Processing Instructions

Native exData loadXML and saveXML preserve in-element XML comments and processing instructions with their order, literal payloads and instruction targets

Native representation

The node keeps Name=#text so existing element, SOM, packet and property binding scans continue to skip non-element content; XMLContentKind distinguishes text, comment and instruction nodes

Ordinary text and CDATA continue to contribute to the parent's aggregate Value; comments and instructions do not become scalar field values or visible rich-text runs

Comment := Node.AddComment('retained metadata');
Instruction := Node.AddProcessingInstruction('audit', 'reviewed');

SetText replaces ordinary text and CDATA while retaining comment and instruction children; removing nontext children leaves text aggregation unchanged

Persistence and transactions

The native XDP parser, writer and packet fingerprints retain in-element comments and instructions through save and reload; payload or target changes mark their packet modified

Immediate script serialization observes imported nontext content, and both engine failure and native publication budgets restore the original content byte exactly

Comment and instruction nodes consume XML import and serialization node budgets; their payloads consume byte budgets and native packet text limits

Actual PDF consumption

The saved producer reopens its XDP before THotPDF.ApplyXFAAsAcroForm; independent XML, pypdf and MuPDF checks confirm actual native payloads remain saved while their marker text is absent from page text

Existing rich text, font, size and color remain visible, and cloned and cleared occurrences retain their documented behavior

Remaining XML targets

This support covers markup inside document elements; document-level comments and instructions outside the root element, complete lexical whitespace preservation, other node-class XML methods, Data DOM structural import and DTD entity catalogs remain separate implementation targets

External references and complete foreign media consumers remain separate implementation targets

Native exData XML and XFA Packet DOM

TXFANode and Native XML Content