Skip to content

Fix invalid XML declaration in getConfigXML() (#71)#74

Open
fjallemark wants to merge 1 commit into
newHeiko:masterfrom
fjallemark:fix/xml-declaration
Open

Fix invalid XML declaration in getConfigXML() (#71)#74
fjallemark wants to merge 1 commit into
newHeiko:masterfrom
fjallemark:fix/xml-declaration

Conversation

@fjallemark

Copy link
Copy Markdown

Fixes the malformed XML declaration emitted by getConfigXML() in
software/esp-firmware/wifiHandling.cpp, reported in #71.

The current declaration has two problems:

String resp = String("<?XML version=\"1.0\" encoding=\"UTF?8\"?>\r\n")
  1. <?XML (uppercase) is not a valid XML declaration. Per W3C XML 1.0
    §2.8 the literal is lowercase <?xml, and §2.6 explicitly reserves any
    case variation of "xml" as a processing-instruction target — so the
    output is neither a valid declaration nor a valid PI, and strict parsers
    (e.g. .NET XDocument.Parse) reject it.
  2. encoding="UTF?8" is not a valid encoding name — the - appears to have
    been corrupted into a ?. It should be UTF-8.

This changes only that one string literal to a spec-compliant declaration:

String resp = String("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n")

No other behavior changes; the element/attribute structure is untouched.

I understand from #71 that you don't maintain the XML config feature — this
is offered purely as a minimal correctness fix so the output parses with
standards-compliant XML parsers without a client-side workaround. Feel free
to take or leave it.

The XML config declaration used uppercase `<?XML` (not a valid XML
declaration per W3C XML 1.0, and a reserved PI target) and a corrupted
encoding name `UTF?8`. Correct both to a spec-compliant
`<?xml version="1.0" encoding="UTF-8"?>` so the output parses with
standards-compliant XML parsers without a client-side workaround.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pischky

pischky commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

I would prefer that the XMLDecl would be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants