XML
Enable an AI agent to recognise XML representations, assess their structural and interpretive state, and decide which inspection, validation, transformation or exchange operations are justified.
Research draft, second pass
A second pass drafted this model: the structure a model of this thing needs, and what is known about it in the world. The line under this one says how the second half was obtained - researched against sources, or recalled without web access, in which case nothing here was read anywhere and every claim is a lead to verify. Unreviewed either way.
Researched by: Codex + Grok
Purpose and description
Enable an AI agent to recognise XML representations, assess their structural and interpretive state, and decide which inspection, validation, transformation or exchange operations are justified.
XML (Extensible Markup Language) is a W3C-standardized, SGML-derived metalanguage that serializes hierarchical documents and data as Unicode text under a single well-formedness grammar of nested tagged elements, attributes, character data and optional validity constraints (DTD or schema).
It can be Parse a document or context-qualified fragment and report XML errors with locations.; Inspect ordered content and select nodes using explicit namespace bindings.; Validate against an identified, authorised DTD or schema and record diagnostics.; Resolve or refuse external dependencies under an explicit processing policy.; Transform or serialise XML while checking declared preservation requirements.; Compare versions using byte, lexical, tree or vocabulary-aware criteria chosen for the task..
Distinguishing features
Check whether the representation satisfies XML well-formedness rules, including case-sensitive names, properly nested elements and quoted attribute values; visual resemblance to markup is insufficient.
Distinguish a complete XML document, which has one document element, from a fragment containing multiple elements or text that requires a processing context.
Determine whether content is processed with XML or HTML parsing rules; an HTML-like vocabulary or an XHTML namespace alone does not establish the processing mode.
Check whether identity and order depend on expanded element names, attributes and mixed text content, rather than treating the representation as interchangeable with a JSON object.
Distinguish XML well-formedness from conformance to an identified DTD or schema; successful parsing alone does not establish vocabulary validity.
Scope
+ XML document or fragment boundaries, declared version, encoding and well-formedness
+ Elements, attributes, ordered content, text and namespace-qualified names
+ DOCTYPE declarations, entity references and external resource dependencies
+ Validation against identified DTDs or schemas and the limits of that validation
+ Parsing, querying, transformation, serialisation and XML-specific preservation requirements
+ Processing restrictions needed to handle untrusted or dependency-bearing XML
- Business meaning and operational rules of XML vocabularies such as invoice or scientific data formats
- The complete models of XML Schema, XPath, XSLT and other associated languages
- Parser software installation, implementation internals and service operations
- Transport protocols, storage systems and access-control infrastructure
- HTML parsing and recovery rules for documents processed as HTML
- General cryptographic signature and identity models
Characteristics
- Representation boundary
- complete document | fragment | unresolved Determines which parsing entry point and contextual assumptions are required.
- XML version
- 1.0 | 1.1 | unresolved, with declared and effective values distinguished Determines applicable syntax and character rules and processor compatibility.
- Encoding evidence
- relationships among byte encoding, byte-order mark, XML declaration and transport metadata Conflicting or incomplete evidence can prevent reliable decoding.
- Well-formedness assessment
- not assessed | well-formed | not well-formed | assessment incomplete Controls whether ordinary XML processing can proceed and records where inspection stopped.
- Namespace identity
- prefix bindings and expanded names expressed as namespace name plus local name Prevents prefix spelling from being mistaken for vocabulary identity.
- Content form
- empty | text-only | element-only | mixed, recorded per element Guides extraction and prevents transformations from discarding text or significant ordering.
- Validation assessment
- not assessed | valid | invalid | indeterminate, relative to an identified constraint set and processor configuration Makes validity a qualified result rather than an intrinsic, context-free label.
- External dependencies
- referenced DTDs, entities, schemas and processing resources, with resolution status Reveals requirements for reproducibility, offline processing and controlled resource access.
- Maximum element depth
- nested element levels, with the document element counted as level 1 Helps compare the document with configured processing limits.
- Preservation requirement
- exact bytes | specified lexical features | specified tree properties | vocabulary-defined meaning Determines whether reserialisation, formatting or transformation is acceptable.
Also called
Where this came from
wikidata · CC0 1.0
Drafted structure
Bundle to layer to finding to question, as the second pass will find it: 6 bundles · 11 layers · 18 findings · 31 questions.
Syntax and document boundary Records what constitutes the XML input and whether its characters form an admissible document or fragment.
An agent must establish a usable XML boundary and decoding before interpreting markup.
Input boundary and decoding
Identifies the input extent, representation form and evidence used to decode it.
Document or fragment context
Records whether the input stands alone or requires enclosing namespace, entity or structural context.
- Is the input a complete XML document or a fragment, and what establishes its boundaries? boundary
- What XML version and character encoding apply, and do the declaration, byte evidence and transport metadata agree? measurement
Well-formedness
Separates successful XML syntax assessment from incomplete processing and vocabulary validation.
Syntax assessment evidence
Records the parser outcome, configuration and locations of structural or character errors.
- Does the input satisfy the applicable XML well-formedness rules, including nesting, attribute uniqueness and reference syntax? measurement
- Which parser, configuration and input extent support that assessment, and did processing reach the end? provenance
Names and content structure Captures XML name identity and the ordered combination of markup and character content.
XML extraction and editing depend on namespace-aware names and preservation of content order.
Namespace bindings
Distinguishes local names, namespace names and scoped prefix aliases.
Expanded name identity
Records expanded names and the context needed to interpret prefixes in markup or vocabulary-defined values.
- What are the expanded names of relevant elements and attributes, accounting for the fact that a default namespace does not apply to unprefixed attribute names? definition
- Which attribute or text values represent qualified names under the vocabulary's rules, and which in-scope bindings interpret them? boundary
Ordered and mixed content
Records element nesting, attributes and text in the order needed for faithful interpretation.
Content and whitespace significance
Identifies where text, child order and whitespace must survive processing.
- Which elements contain mixed text and child elements, and what ordering must an extraction or edit preserve? measurement
- What evidence from xml:space, constraints or vocabulary rules permits whitespace to be preserved, normalised or removed? action
Constraints and vocabulary contract Connects the XML representation to identified structural constraints and vocabulary interpretation.
Well-formed XML can still violate its intended exchange contract or lack enough context for meaningful use.
Constraint authority
Identifies the governing constraint resources and distinguishes authority from document-supplied hints.
Governing DTD or schema
Records the selected constraint language, resource version and basis for selection.
- Which DTD, XML Schema, RELAX NG schema or other constraint set governs this use, and how was its authority established? provenance
- Are DOCTYPE identifiers or schema-location hints accepted, overridden or ignored by the consuming system? action
Validation and interpretation
Records validation results and the boundary between checked structure and application meaning.
Qualified conformance result
Associates diagnostics and processing effects with a specific constraint set and run.
- What validation result and diagnostics were obtained against the identified constraint versions? measurement
- Which defaults, normalisations or type annotations did processing contribute to the representation available to the agent? provenance
- Which vocabulary meanings or business rules remain unchecked even if validation succeeds? boundary
Dependencies and processing limits Records XML resource resolution, expansion behaviour and limits on parser work.
The same XML bytes can produce different outcomes depending on external resources and processor settings.
Resource resolution
Identifies resources that particular processing stages may request and how their locations are resolved.
External resource dependency map
Separates parser dependencies from optional inclusion, validation and transformation resources.
- Which external DTDs or entities are referenced, and which additional resources would enabled schema validation, XInclude or transformation stages request? measurement
- What base URI, applicable xml:base values, resolver rules or catalog mappings determine the effective resource locations? provenance
- Which resources may be accessed, and what result is required when a dependency is unavailable or refused? action
Expansion and resource budgets
Captures entity handling and processing budgets needed to assess whether an operation can complete acceptably.
Bounded parser execution
Records configured controls and distinguishes limit-triggered termination from a proven syntax failure.
- Are DOCTYPE processing, external entity resolution and entity expansion enabled for this operation? action
- What limits apply to nesting depth, expanded content size, input size and processing time, and were any reached? measurement
Operations and preservation Defines how XML may be selected, changed and serialised while retaining the properties required by its use.
An XML operation can preserve a parsed tree while changing bytes, lexical details or vocabulary-sensitive values.
Selection and transformation
Records the context and assumptions under which XML queries and edits target the intended content.
Namespace-aware operation contract
Specifies selection context, transformation dependencies and required postconditions.
- What query or transformation language version, context node and namespace bindings identify the intended nodes? definition
- Which content may be changed, and what well-formedness, validation and vocabulary-specific checks must pass afterward? action
Serialisation and equivalence
Distinguishes exact representation preservation from tree-level or application-defined equivalence.
Round-trip preservation contract
Records whether lexical choices, comments, processing instructions and signed content constrain output.
- Must a round trip preserve exact bytes, prefixes, CDATA boundaries, entity spelling, comments or processing instructions, or only specified tree properties? boundary
- If comparison or signature verification uses canonicalisation, which algorithm, options and selected content govern the result? definition
- Which serialisation or formatting changes are permitted, and how will the required equivalence be checked? action
Evidence and external alignment What the world already says about this thing, gathered so the model can be checked against it.
A model that cannot be lined up against existing standards, identifiers and practice cannot be adopted by anyone who already uses them.
Reported evidence
Findings from the breadth pass, kept separate from the structural claims.
Kinds and varieties
Reported by the breadth pass; each item needs checking against its source before it becomes normative.
- XML 1.0 instance documents (the edition almost universally deployed)
- XML 1.1 instance documents (rare; extra name characters and NEL line ending)
- Well-formed unvalidated documents
- DTD-valid documents
- Schema-validated documents (W3C XSD, RELAX NG, Schematron)
- Namespaced documents (Namespaces in XML)
- Canonical / exclusive-canonical XML (for digital signatures and comparison)
- Compact binary encodings of the XML Infoset (W3C EXI, ISO Fast Infoset)
- Which of these kinds and varieties hold for the sense of XML this model covers, and on what evidence? provenance
Identifiers and schemes
Reported by the breadth pass; each item needs checking against its source before it becomes normative.
- Wikidata - Q2115 - Item for Extensible Markup Language
- IANA media type - application/xml - Preferred XML media type under RFC 7303; +xml suffix used for derived types
- IANA media type - text/xml - Registered but discouraged because of charset-default pitfalls
- File extension - .xml - Common but not authoritative; many vocabularies use their own extensions (.svg, .xslt, .rss)
- W3C Technical Report shortname - xml / xml11 - The language itself is identified by the W3C Recommendation, not by an ISO numeric code
- Which of these identifiers and schemes hold for the sense of XML this model covers, and on what evidence? provenance
Standards and regulation
Reported by the breadth pass; each item needs checking against its source before it becomes normative.
- W3C Recommendation: Extensible Markup Language (XML) 1.0 (Fifth Edition)
- W3C Recommendation: Extensible Markup Language (XML) 1.1 (Second Edition)
- W3C Recommendation: Namespaces in XML 1.0
- W3C Recommendation: XML Information Set (Infoset)
- W3C XML Schema Definition Language (XSD) 1.0 and 1.1
- W3C Canonical XML and Exclusive XML Canonicalization (used with XML Signature)
- W3C Efficient XML Interchange (EXI) Format
- IETF RFC 7303, XML Media Types (IANA)
- ISO/IEC 19757 (Document Schema Definition Languages: RELAX NG, Schematron, NVDL)
- ISO/IEC 24824-1 Fast Infoset (binary Infoset encoding)
- OASIS RELAX NG (committee specification later aligned with ISO)
- Which of these standards and regulation hold for the sense of XML this model covers, and on what evidence? provenance
Real-world use
Reported by the breadth pass; each item needs checking against its source before it becomes normative.
- Document and graphics vocabularies shipped as XML applications: XHTML, SVG, MathML, DocBook, TEI
- Office and publishing packages whose internals are XML (ODF; Office Open XML in ISO/IEC 29500)
- Machine-to-machine payloads: SOAP envelopes, XML-RPC, SAML assertions, UBL invoices, HL7 CDA clinical documents
- Syndication and metadata: RSS, Atom, Dublin Core in XML, MPEG-7, ONIX
- Build and configuration artefacts: Maven POM, MSBuild/csproj, Android layout XML, Spring beans, many Java EE descriptors
- Digital signatures and encryption wrapping XML (XML Signature / XML Encryption) around business documents
- Which of these real-world use hold for the sense of XML this model covers, and on what evidence? provenance
Typical measurements
Reported by the breadth pass; each item needs checking against its source before it becomes normative.
- Serialized document size - hundreds of bytes (config snippets) to tens or hundreds of megabytes (bulk export, office packages) - byte
- Element nesting depth - about 3-20 in ordinary business documents; pathological or generated trees can exceed 100 - level
- Declared character encoding - UTF-8 (default and dominant); UTF-16 still seen; legacy 8-bit encodings in older regional feeds - IANA charset name
- Entity-expansion ratio under DTD processing - ~1 for documents without general entities; unbounded without parser caps (billion-laughs class) - expanded octets per input octet
- Which of these typical measurements hold for the sense of XML this model covers, and on what evidence? provenance
Failure modes and hazards
Reported by the breadth pass; each item needs checking against its source before it becomes normative.
- Not well-formed input (unclosed tags, illegal characters, encoding-declaration mismatch) causing hard parse failure
- XML External Entity (XXE) resolution: file disclosure, SSRF, or denial of service when parsers still process external DTDs
- Billion-laughs and quadratic entity expansion exhausting memory or CPU
- Schema or DTD validation failure that is treated as success because only well-formedness was checked
- Namespace errors: unbound prefixes, default-namespace surprises, or element identity that looks the same by local name but is not
- Canonicalization and whitespace/attribute-order differences breaking XML Signature verification
- Injection of markup when strings are concatenated into XML instead of being escaped or built via an API
- Oversized or deeply nested documents used as a denial-of-service against DOM-based parsers
- Which of these failure modes and hazards hold for the sense of XML this model covers, and on what evidence? provenance
Regional variation
Reported by the breadth pass; each item needs checking against its source before it becomes normative.
- XML 1.1 was motivated in part by IBM mainframe NEL line endings and by additional name-start characters needed for some scripts; it remains almost unused in open internet traffic, which is XML 1.0
- Legacy East Asian and other 8-bit encodings (Shift_JIS, GB2312/GB18030, EUC-JP, ISO-8859-*) still appear in older national feeds and EDI-adjacent XML; UTF-8 is the interoperable default
- Legal and legislative XML vocabularies differ by jurisdiction (for example US LegalXML/Akoma Ntoso profiles versus national XML schemas for gazettes and court documents) rather than by a different XML language
- Which of these regional variation hold for the sense of XML this model covers, and on what evidence? provenance
Neighbouring kinds and how to tell them apart
Reported by the breadth pass; each item needs checking against its source before it becomes normative.
- SGML (ISO 8879) - XML is a restricted, fully specified profile of SGML with a single grammar, mandatory end-tags (except the few XML empty-element forms), and no tag omission or SHORTTAG tricks; if the document relies on SGML minimization it is not XML
- HTML (HTML5) - HTML is parsed with a separate, error-recovering tokenization and tree-construction algorithm and a fixed vocabulary; it is XML only when served and parsed as XHTML (application/xhtml+xml) and it is well-formed
- XHTML - XHTML is an XML vocabulary (HTML elements in an XML serialization); the test is the media type and whether an XML parser, not an HTML parser, is used
- JSON - JSON is an object/array data model without mixed content, attributes, namespaces or a native schema layer in the same sense; mixed element/text content or namespaced vocabularies are the usual reason a payload is XML rather than JSON
- YAML - YAML is indentation-significant and not an XML serialization; it has no Infoset, DTD or xmlns mechanism
- Protocol Buffers / ASN.1 encodings - Schema-first binary encodings with no requirement of human-readable tagged text; they do not produce well-formed XML and are not interchangeable with an XML parser
- Which of these neighbouring kinds and how to tell them apart hold for the sense of XML this model covers, and on what evidence? provenance
Sources
- Extensible Markup Language (XML) 1.0 (Fifth Edition) - Normative grammar of well-formedness, DTDs, encodings, entities and the XML 1.0 document type
- Extensible Markup Language (XML) 1.1 (Second Edition) - The 1.1 edition, including additional name characters and NEL, and why it is a separate kind
- Namespaces in XML 1.0 (Third Edition) - Qualified names, xmlns declarations, and namespaced versus non-namespaced XML
- XML Media Types (RFC 7303) - IANA media types application/xml and text/xml, charset handling, and fragment identifiers
What the second pass must settle
- Does the registry intend XML to cover the format, individual XML artifacts and fragments together, or should artifact instances link to a separately registered document model?
- Which XML and Namespaces in XML editions must the catalogue support, including any requirement for XML 1.1?
- Which processing features and constraint languages are required in the intended agent environment, and which remain optional extensions?
- What default resource-resolution and processing-limit policy applies when XML arrives without a declared processing contract?
- Which neighbouring registered models own vocabulary semantics, XML canonicalisation and XML signatures, and how should this model link to them?