@file-type/xml
Version:
XML detection plugin for file-type
21 lines (20 loc) • 663 B
TypeScript
type DoctypeKind = 'PUBLIC' | 'SYSTEM' | 'UNKNOWN';
export interface ParsedDoctype {
raw: string;
name: string | undefined;
kind: DoctypeKind;
publicId?: string;
systemId?: string;
internalSubset?: string;
}
/**
* Parse the string provided by `sax`'s `ondoctype` callback.
*
* Examples of input:
* - "article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN' 'http://.../docbookx.dtd'"
* - "svg SYSTEM 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'"
* - "plist SYSTEM \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\""
* - "root [ <!ENTITY ...> ]"
*/
export declare function parseDoctype(raw: string): ParsedDoctype;
export {};