Skip to content

Main content

XML Entity Reference Name Token Tool

Calculate xml entity reference name token from explicit caller-supplied inputs.

Loading tool…

Description

Return name and predefined for amp,lt,gt,apos,quot.

XML distinguishes element and attribute names, entity references, processing instructions, and document-level rules. Quoting, entity expansion, namespaces, and Unicode name characters are separate concerns. A restricted token recognizer does not automatically provide a complete or validating XML parser.

Return name and predefined for amp,lt,gt,apos,quot.

When to use this tool

Use XML Entity Reference Name Token when you need the stated restricted XML token decomposition without parsing or expanding a document.

How to use the tool and how it works

  1. Enter token. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read name, predefined. Inspect predefined before interpreting the associated values.

Accept &name; with an ASCII name beginning with a letter or underscore and continuing with letters, digits, underscore, period, colon, or hyphen. Return name and predefined for amp,lt,gt,apos,quot.1

XML predefines the entities amp, lt, gt, apos, and quot. Recognizing one of these names is distinct from expanding entities or validating a document.2

Input fieldMeaning and unitsAccepted input
tokenComplete literal token in the grammar stated above.Required. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
nameNameRequired. Text; maximum UTF-16 length 8192.
predefinedTrue for exactly amp, lt, gt, apos, and quot.Required. Boolean.
json
{
  "input": {
    "token": "&"
  },
  "output": {
    "name": "amp",
    "predefined": true
  }
}

Limitations and assumptions

  • Numeric character references and full Unicode XML names are unsupported. Nonpredefined names are not resolved or checked against a DTD, and the tool does not decode or expand entities.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use an XML parser with appropriate document, namespace, character, and entity policies for complete validation. A local name or wrapper match does not replace those checks.

References

  1. Calculation and input contract: parse/xml-entity-reference-name-token — tool.io

  2. XML 1.0 (Fifth Edition): Predefined Entities — World Wide Web Consortium (W3C)

Similar or alternative tools