xmlWriter

xmlWriter.py – Simple XML authoring class

class fontTools.misc.xmlWriter.XMLWriter(fileOrPath, indentwhite=' ', idlefunc=None, encoding='utf_8', newlinestr=None)[source]
begintag(_TAG_, *args, **kwargs)[source]
close()[source]
comment(data)[source]
dedent()[source]
dumphex(data)[source]
endtag(_TAG_)[source]
indent()[source]
newline()[source]
simpletag(_TAG_, *args, **kwargs)[source]
stringifyattrs(*args, **kwargs)[source]
write(string, indent=True)[source]

Writes text.

write8bit(data, strip=False)[source]

Writes a bytes() sequence into the XML, escaping non-ASCII bytes. When this is read in xmlReader, the original bytes can be recovered by encoding to ‘latin-1’.

write_noindent(string)[source]

Writes text without indentation.

writecdata(string)[source]

Writes text in a CDATA section.

fontTools.misc.xmlWriter.escape(data)[source]
fontTools.misc.xmlWriter.escape8bit(data)[source]

Input is Unicode string.

fontTools.misc.xmlWriter.escapeattr(data)[source]
fontTools.misc.xmlWriter.hexStr(s)[source]