<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/XMLParser/ErrorCode",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@E@NSXMLParserError"
  },
  "title" : "XMLParser.ErrorCode"
}
-->

# XMLParser.ErrorCode

The following error codes are defined by `NSXMLParser`. For error codes not listed here, see the `<libxml/xmlerror.h>` header file.

```
enum ErrorCode
```

## Topics

### Constants

[`XMLParser.ErrorCode.internalError`](/documentation/Foundation/XMLParser/ErrorCode/internalError)

The parser object encountered an internal error.

[`XMLParser.ErrorCode.outOfMemoryError`](/documentation/Foundation/XMLParser/ErrorCode/outOfMemoryError)

The parser object ran out of memory.

[`XMLParser.ErrorCode.documentStartError`](/documentation/Foundation/XMLParser/ErrorCode/documentStartError)

The parser object is unable to start parsing.

[`XMLParser.ErrorCode.emptyDocumentError`](/documentation/Foundation/XMLParser/ErrorCode/emptyDocumentError)

The document is empty.

[`XMLParser.ErrorCode.prematureDocumentEndError`](/documentation/Foundation/XMLParser/ErrorCode/prematureDocumentEndError)

The document ended unexpectedly.

[`XMLParser.ErrorCode.invalidHexCharacterRefError`](/documentation/Foundation/XMLParser/ErrorCode/invalidHexCharacterRefError)

Invalid hexadecimal character reference encountered.

[`XMLParser.ErrorCode.invalidDecimalCharacterRefError`](/documentation/Foundation/XMLParser/ErrorCode/invalidDecimalCharacterRefError)

Invalid decimal character reference encountered.

[`XMLParser.ErrorCode.invalidCharacterRefError`](/documentation/Foundation/XMLParser/ErrorCode/invalidCharacterRefError)

Invalid character reference encountered.

[`XMLParser.ErrorCode.invalidCharacterError`](/documentation/Foundation/XMLParser/ErrorCode/invalidCharacterError)

Invalid character encountered.

[`XMLParser.ErrorCode.characterRefAtEOFError`](/documentation/Foundation/XMLParser/ErrorCode/characterRefAtEOFError)

Target of character reference cannot be found.

[`XMLParser.ErrorCode.characterRefInPrologError`](/documentation/Foundation/XMLParser/ErrorCode/characterRefInPrologError)

Invalid character found in the prolog.

[`XMLParser.ErrorCode.characterRefInEpilogError`](/documentation/Foundation/XMLParser/ErrorCode/characterRefInEpilogError)

Invalid character found in the epilog.

[`XMLParser.ErrorCode.characterRefInDTDError`](/documentation/Foundation/XMLParser/ErrorCode/characterRefInDTDError)

Invalid character encountered in the DTD.

[`XMLParser.ErrorCode.entityRefAtEOFError`](/documentation/Foundation/XMLParser/ErrorCode/entityRefAtEOFError)

Target of entity reference is not found.

[`XMLParser.ErrorCode.entityRefInPrologError`](/documentation/Foundation/XMLParser/ErrorCode/entityRefInPrologError)

Invalid entity reference found in the prolog.

[`XMLParser.ErrorCode.entityRefInEpilogError`](/documentation/Foundation/XMLParser/ErrorCode/entityRefInEpilogError)

Invalid entity reference found in the epilog.

[`XMLParser.ErrorCode.entityRefInDTDError`](/documentation/Foundation/XMLParser/ErrorCode/entityRefInDTDError)

Invalid entity reference found in the DTD.

[`XMLParser.ErrorCode.parsedEntityRefAtEOFError`](/documentation/Foundation/XMLParser/ErrorCode/parsedEntityRefAtEOFError)

Target of parsed entity reference is not found.

[`XMLParser.ErrorCode.parsedEntityRefInPrologError`](/documentation/Foundation/XMLParser/ErrorCode/parsedEntityRefInPrologError)

Target of parsed entity reference is not found in prolog.

[`XMLParser.ErrorCode.parsedEntityRefInEpilogError`](/documentation/Foundation/XMLParser/ErrorCode/parsedEntityRefInEpilogError)

Target of parsed entity reference is not found in epilog.

[`XMLParser.ErrorCode.parsedEntityRefInInternalSubsetError`](/documentation/Foundation/XMLParser/ErrorCode/parsedEntityRefInInternalSubsetError)

Target of parsed entity reference is not found in internal subset.

[`XMLParser.ErrorCode.entityReferenceWithoutNameError`](/documentation/Foundation/XMLParser/ErrorCode/entityReferenceWithoutNameError)

Entity reference is without name.

[`XMLParser.ErrorCode.entityReferenceMissingSemiError`](/documentation/Foundation/XMLParser/ErrorCode/entityReferenceMissingSemiError)

Entity reference is missing semicolon.

[`XMLParser.ErrorCode.parsedEntityRefNoNameError`](/documentation/Foundation/XMLParser/ErrorCode/parsedEntityRefNoNameError)

Parsed entity reference is without an entity name.

[`XMLParser.ErrorCode.parsedEntityRefMissingSemiError`](/documentation/Foundation/XMLParser/ErrorCode/parsedEntityRefMissingSemiError)

Parsed entity reference is missing semicolon.

[`XMLParser.ErrorCode.undeclaredEntityError`](/documentation/Foundation/XMLParser/ErrorCode/undeclaredEntityError)

Entity is not declared.

[`XMLParser.ErrorCode.unparsedEntityError`](/documentation/Foundation/XMLParser/ErrorCode/unparsedEntityError)

Cannot parse entity.

[`XMLParser.ErrorCode.entityIsExternalError`](/documentation/Foundation/XMLParser/ErrorCode/entityIsExternalError)

Cannot parse external entity.

[`XMLParser.ErrorCode.entityIsParameterError`](/documentation/Foundation/XMLParser/ErrorCode/entityIsParameterError)

Entity is a parameter.

[`XMLParser.ErrorCode.unknownEncodingError`](/documentation/Foundation/XMLParser/ErrorCode/unknownEncodingError)

Document encoding is unknown.

[`XMLParser.ErrorCode.encodingNotSupportedError`](/documentation/Foundation/XMLParser/ErrorCode/encodingNotSupportedError)

Document encoding is not supported.

[`XMLParser.ErrorCode.stringNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/stringNotStartedError)

String is not started.

[`XMLParser.ErrorCode.stringNotClosedError`](/documentation/Foundation/XMLParser/ErrorCode/stringNotClosedError)

String is not closed.

[`XMLParser.ErrorCode.namespaceDeclarationError`](/documentation/Foundation/XMLParser/ErrorCode/namespaceDeclarationError)

Invalid namespace declaration encountered.

[`XMLParser.ErrorCode.entityNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/entityNotStartedError)

Entity is not started.

[`XMLParser.ErrorCode.entityNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/entityNotFinishedError)

Entity is not finished.

[`XMLParser.ErrorCode.lessThanSymbolInAttributeError`](/documentation/Foundation/XMLParser/ErrorCode/lessThanSymbolInAttributeError)

Angle bracket is used in attribute.

[`XMLParser.ErrorCode.attributeNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/attributeNotStartedError)

Attribute is not started.

[`XMLParser.ErrorCode.attributeNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/attributeNotFinishedError)

Attribute is not finished.

[`XMLParser.ErrorCode.attributeHasNoValueError`](/documentation/Foundation/XMLParser/ErrorCode/attributeHasNoValueError)

Attribute doesn’t contain a value.

[`XMLParser.ErrorCode.attributeRedefinedError`](/documentation/Foundation/XMLParser/ErrorCode/attributeRedefinedError)

Attribute is redefined.

[`XMLParser.ErrorCode.literalNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/literalNotStartedError)

Literal is not started.

[`XMLParser.ErrorCode.literalNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/literalNotFinishedError)

Literal is not finished.

[`XMLParser.ErrorCode.commentNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/commentNotFinishedError)

Comment is not finished.

[`XMLParser.ErrorCode.processingInstructionNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/processingInstructionNotStartedError)

Processing instruction is not started.

[`XMLParser.ErrorCode.processingInstructionNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/processingInstructionNotFinishedError)

Processing instruction is not finished.

[`XMLParser.ErrorCode.notationNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/notationNotStartedError)

Notation is not started.

[`XMLParser.ErrorCode.notationNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/notationNotFinishedError)

Notation is not finished.

[`XMLParser.ErrorCode.attributeListNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/attributeListNotStartedError)

Attribute list is not started.

[`XMLParser.ErrorCode.attributeListNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/attributeListNotFinishedError)

Attribute list is not finished.

[`XMLParser.ErrorCode.mixedContentDeclNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/mixedContentDeclNotStartedError)

Mixed content declaration is not started.

[`XMLParser.ErrorCode.mixedContentDeclNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/mixedContentDeclNotFinishedError)

Mixed content declaration is not finished.

[`XMLParser.ErrorCode.elementContentDeclNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/elementContentDeclNotStartedError)

Element content declaration is not started.

[`XMLParser.ErrorCode.elementContentDeclNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/elementContentDeclNotFinishedError)

Element content declaration is not finished.

[`XMLParser.ErrorCode.xmlDeclNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/xmlDeclNotStartedError)

XML declaration is not started.

[`XMLParser.ErrorCode.xmlDeclNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/xmlDeclNotFinishedError)

XML declaration is not finished.

[`XMLParser.ErrorCode.conditionalSectionNotStartedError`](/documentation/Foundation/XMLParser/ErrorCode/conditionalSectionNotStartedError)

Conditional section is not started.

[`XMLParser.ErrorCode.conditionalSectionNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/conditionalSectionNotFinishedError)

Conditional section is not finished.

[`XMLParser.ErrorCode.externalSubsetNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/externalSubsetNotFinishedError)

External subset is not finished.

[`XMLParser.ErrorCode.doctypeDeclNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/doctypeDeclNotFinishedError)

Document type declaration is not finished.

[`XMLParser.ErrorCode.misplacedCDATAEndStringError`](/documentation/Foundation/XMLParser/ErrorCode/misplacedCDATAEndStringError)

Misplaced CDATA end string.

[`XMLParser.ErrorCode.cdataNotFinishedError`](/documentation/Foundation/XMLParser/ErrorCode/cdataNotFinishedError)

CDATA block is not finished.

[`XMLParser.ErrorCode.misplacedXMLDeclarationError`](/documentation/Foundation/XMLParser/ErrorCode/misplacedXMLDeclarationError)

Misplaced XML declaration.

[`XMLParser.ErrorCode.spaceRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/spaceRequiredError)

Space is required.

[`XMLParser.ErrorCode.separatorRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/separatorRequiredError)

Separator is required.

[`XMLParser.ErrorCode.nmtokenRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/nmtokenRequiredError)

Name token is required.

[`XMLParser.ErrorCode.nameRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/nameRequiredError)

Name is required.

[`XMLParser.ErrorCode.pcdataRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/pcdataRequiredError)

CDATA is required.

[`XMLParser.ErrorCode.uriRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/uriRequiredError)

URI is required.

[`XMLParser.ErrorCode.publicIdentifierRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/publicIdentifierRequiredError)

Public identifier is required.

[`XMLParser.ErrorCode.ltRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/ltRequiredError)

Left angle bracket is required.

[`XMLParser.ErrorCode.gtRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/gtRequiredError)

Right angle bracket is required.

[`XMLParser.ErrorCode.ltSlashRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/ltSlashRequiredError)

Left angle bracket slash is required.

[`XMLParser.ErrorCode.equalExpectedError`](/documentation/Foundation/XMLParser/ErrorCode/equalExpectedError)

Equal sign expected.

[`XMLParser.ErrorCode.tagNameMismatchError`](/documentation/Foundation/XMLParser/ErrorCode/tagNameMismatchError)

Tag name mismatch.

[`XMLParser.ErrorCode.unfinishedTagError`](/documentation/Foundation/XMLParser/ErrorCode/unfinishedTagError)

Unfinished tag found.

[`XMLParser.ErrorCode.standaloneValueError`](/documentation/Foundation/XMLParser/ErrorCode/standaloneValueError)

Standalone value found.

[`XMLParser.ErrorCode.invalidEncodingNameError`](/documentation/Foundation/XMLParser/ErrorCode/invalidEncodingNameError)

Invalid encoding name found.

[`XMLParser.ErrorCode.commentContainsDoubleHyphenError`](/documentation/Foundation/XMLParser/ErrorCode/commentContainsDoubleHyphenError)

Comment contains double hyphen.

[`XMLParser.ErrorCode.invalidEncodingError`](/documentation/Foundation/XMLParser/ErrorCode/invalidEncodingError)

Invalid encoding.

[`XMLParser.ErrorCode.externalStandaloneEntityError`](/documentation/Foundation/XMLParser/ErrorCode/externalStandaloneEntityError)

External standalone entity.

[`XMLParser.ErrorCode.invalidConditionalSectionError`](/documentation/Foundation/XMLParser/ErrorCode/invalidConditionalSectionError)

Invalid conditional section.

[`XMLParser.ErrorCode.entityValueRequiredError`](/documentation/Foundation/XMLParser/ErrorCode/entityValueRequiredError)

Entity value is required.

[`XMLParser.ErrorCode.notWellBalancedError`](/documentation/Foundation/XMLParser/ErrorCode/notWellBalancedError)

Document is not well balanced.

[`XMLParser.ErrorCode.extraContentError`](/documentation/Foundation/XMLParser/ErrorCode/extraContentError)

Error in content found.

[`XMLParser.ErrorCode.invalidCharacterInEntityError`](/documentation/Foundation/XMLParser/ErrorCode/invalidCharacterInEntityError)

Invalid character in entity found.

[`XMLParser.ErrorCode.parsedEntityRefInInternalError`](/documentation/Foundation/XMLParser/ErrorCode/parsedEntityRefInInternalError)

Internal error in parsed entity reference found.

[`XMLParser.ErrorCode.entityRefLoopError`](/documentation/Foundation/XMLParser/ErrorCode/entityRefLoopError)

Entity reference loop encountered.

[`XMLParser.ErrorCode.entityBoundaryError`](/documentation/Foundation/XMLParser/ErrorCode/entityBoundaryError)

Entity boundary error.

[`XMLParser.ErrorCode.invalidURIError`](/documentation/Foundation/XMLParser/ErrorCode/invalidURIError)

Invalid URI specified.

[`XMLParser.ErrorCode.uriFragmentError`](/documentation/Foundation/XMLParser/ErrorCode/uriFragmentError)

URI fragment.

[`XMLParser.ErrorCode.noDTDError`](/documentation/Foundation/XMLParser/ErrorCode/noDTDError)

Missing DTD.

[`XMLParser.ErrorCode.delegateAbortedParseError`](/documentation/Foundation/XMLParser/ErrorCode/delegateAbortedParseError)

Delegate aborted parse.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)
