Small XML Feed
Small XML Feed is a Extensible Markup Language sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.
feed.xmlData
タグと属性で構造を表すテキスト形式。XML宣言またはルート要素から始まります。
3C 3F 78 6D 6C <?xml3C <SIGNATURE = bytes.fromhex("3c3f786d6c")
OFFSET = 0
def is_xml(path: str) -> bool:
with open(path, "rb") as f:
f.seek(OFFSET)
head = f.read(len(SIGNATURE))
return head == SIGNATUREconst SIGNATURE = [0x3c, 0x3f, 0x78, 0x6d, 0x6c];
const OFFSET = 0;
// bytes: a Uint8Array / Buffer holding the start of the file
export function isXml(bytes) {
return SIGNATURE.every((byte, i) => bytes[OFFSET + i] === byte);
}package fileid
import "bytes"
var isxmlSignature = []byte{0x3c, 0x3f, 0x78, 0x6d, 0x6c}
const isxmlOffset = 0
func IsXml(b []byte) bool {
end := isxmlOffset + len(isxmlSignature)
if len(b) < end {
return false
}
return bytes.Equal(b[isxmlOffset:end], isxmlSignature)
}const SIGNATURE: &[u8] = &[0x3c, 0x3f, 0x78, 0x6d, 0x6c];
const OFFSET: usize = 0;
fn is_xml(bytes: &[u8]) -> bool {
bytes.get(OFFSET..OFFSET + SIGNATURE.len()) == Some(SIGNATURE)
}<?php
$signature = "\x3c\x3f\x78\x6d\x6c";
$offset = 0;
function is_xml(string $bytes): bool {
global $signature, $offset;
return substr($bytes, $offset, strlen($signature)) === $signature;
}Extensible Markup Language はデータ交換、インポート/エクスポート、パーサのテスト、検証ワークフローで使われます。エンコーディング・区切り文字・バージョン・コンテナ構造が実装の挙動を変えることがあります。
形式が判定できたからといって、信頼できない入力が安全とは限りません。パーサ例外・巨大ファイル・想定外のエンコーディング・外部参照を考慮してください。
11 個のサンプルで、先頭バイト判定・パーサのエラー・アップロード上限・ダウンロード挙動をテストできます。
Small XML Feed is a Extensible Markup Language sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.
feed.xmlBlue Sky XML is a Extensible Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
01-blue-sky.xmlbc5c4b587279c801b5ca1a82bf7a0b36af8920ef41262d3f059f1717b63bbe02Flower Garden XML is a Extensible Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
02-flower-garden.xmlbd78ce2cfb0e58645ffacbf1d524c83d63ca990fdb3822f97bacd3b510ecaf30Navy Blue Sky XML is a Extensible Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
03-navy-blue-sky.xml3c6ccde88f123d6bcf4c02063c0da0c324632061ba674fdc387a0b5a5cc97184Nature of the Sky XML is a Extensible Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
04-nature-sky.xml91b6cba624788fe4d84a48b09826b770f42ecd2d9127314853beb884bb5777b8Sky Landscape XML is a Extensible Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
05-sky-landscape.xmlcb040898b20920931b8b089ace0ce4fa01e1389e8777620ccddd56b431d3889cStarry Sky XML is a Extensible Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
06-starry-sky.xmla4fe70ed3ad95894b2f66924883195c4e0b8b0d0571618d5cbedcb656e1c2dccBlue Night Sky XML is a Extensible Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
07-blue-night-sky.xml47bd294b1478afbdb31ba970ab3939a6ed074ad71160fc27133c52297be8dacdHibiscus Flower XML is a Extensible Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
08-hibiscus-flower.xml4ae71ebe9f0bec672d08cc49a8a916fe7561ac93c03d9d3bf51e9b543e44cac0Arctic Sky XML is a Extensible Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
09-arctic-sky.xml90c29e633d5e9ffbb71402c5727649a582944ba51a9a3d4ff296963a7df49a35NASA Blue Marble XML is a Extensible Markup Language sample based on NASA Image and Video Library. It can be used to test downloads, parsers, previews, and file type detection.
nasa-blue-marble-2012-east.xml39372c25c4ead10c9953ef1e90ebd6b147ae9f1ef481a563eb5d02b9114940adExtensible Markup Language ファイルはバイトシグネチャ 3C 3F 78 6D 6C ("<?xml") または 3C ("<") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。
Extensible Markup Language のMIMEタイプは application/xml, text/xml です。
Extensible Markup Language ファイルは .xml 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。