XHTML2
application/xhtml+xml
Magic Bytes
Offset: 0
3C 68 74 6D 6C 20 78 6D 6C 6E 73 3D
XHTML2 is an extensible markup language format developed by the World Wide Web Consortium (W3C) as a major revision to previous XHTML standards. Intended for structured data and device independence, it was designed to improve document semantics and provide a clean break from legacy HTML features. The W3C officially halted development of this format in 2009 in favor of HTML5, making it an obsolete technology primarily found in historical web archives.
Validation Code
How to validate .xhtml2 files in Python
Python
def is_xhtml2(file_path: str) -> bool:
"""Check if file is a valid XHTML2 by magic bytes."""
signature = bytes([0x3C, 0x68, 0x74, 0x6D, 0x6C, 0x20, 0x78, 0x6D, 0x6C, 0x6E, 0x73, 0x3D])
with open(file_path, "rb") as f:
return f.read(12) == signature
How to validate .xhtml2 files in Node.js
Node.js
function isXHTML2(buffer: Buffer): boolean {
const signature = Buffer.from([0x3C, 0x68, 0x74, 0x6D, 0x6C, 0x20, 0x78, 0x6D, 0x6C, 0x6E, 0x73, 0x3D]);
return buffer.subarray(0, 12).equals(signature);
}
Go
func IsXHTML2(data []byte) bool {
signature := []byte{0x3C, 0x68, 0x74, 0x6D, 0x6C, 0x20, 0x78, 0x6D, 0x6C, 0x6E, 0x73, 0x3D}
if len(data) < 12 {
return false
}
return bytes.Equal(data[:12], signature)
}
API Endpoint
GET
/api/v1/xhtml2
curl https://filesignature.org/api/v1/xhtml2