Watch at Ease세상을 읽고, 일상의 답을 찾다.

기술 · 실용 가이드

ElementTree의 “unbound prefix”? XML을 고치기 전에 namespace를 증명하세요

원본 byte를 보존하고 손상된 전체 문서와 조상 scope에서 분리된 fragment를 구분합니다. 권위 있는 URI가 있을 때만 binding을 주입하세요.

Original diagram distinguishing a malformed full XML document from a fragment detached from an ancestor namespace declaration.
원본 일러스트: 전체 문서와 detached fragment의 scope loss 구분. Watch at Ease

ElementTree는 qualified name의 prefix에 scope 내 선언이 없으면 unbound prefix를 냅니다. 같은 오류는 잘못된 전체 문서와 조상 xmlns를 잃은 유효 fragment에서 모두 생깁니다.

URI를 추측하거나 register_namespace()를 parse 수리로 쓰지 마세요. 전체 문서, schema, producer contract, 조상에서 binding을 증명하고 memory wrapper에만 넣은 뒤 expanded name, attribute, text, tail, manifest를 확인합니다.

수리 전 증거 보존

원본 byte hash, parser, Python version, line/column, prefix를 기록합니다.

fragment boundary를 남겨 invalid full document와 구분합니다.

scope loss 분류

전체 문서와 ancestor xmlns를 확인하고 권위 있는 URI만 복원합니다.

같은 prefix spelling은 같은 URI의 증거가 아닙니다.

parse·query·serialization 분리

register_namespace()는 출력, find() map은 query용이며 malformed input을 고치지 않습니다.

URI가 증명되면 memory wrapper에 선언 하나만 추가합니다.

broad recovery 격리

tolerant parser는 tag를 닫거나 token을 버릴 수 있어 forensic extraction으로 제한합니다.

증명된 binding 외 변경이 있으면 acceptance를 실패시킵니다.

semantic identity로 승인

{URI}local, attribute, node count, text, tail, identifier를 검사합니다.

source digest, URI source, transform, diagnostics, result를 저장합니다.

Original acceptance diagram that verifies expanded names, attributes, text, tail content, and a bounded repair manifest.
원본 일러스트: parse 후 expanded name과 내용을 검증. Watch at Ease