lxml.html.builder module — lxml documentation

# lxml.html.builder module

A set of HTML generator tags for building HTML documents.

Usage:

    >>> from lxml.html.builder import *
    >>> html = HTML(
    ...            HEAD( TITLE("Hello World") ),
    ...            BODY( CLASS("main"),
    ...                  H1("Hello World !")
    ...            )
    ...        )

    >>> import lxml.etree
    >>> print lxml.etree.tostring(html, pretty_print=True)
    <html>
      <head>
        <title>Hello World</title>
      </head>
      <body class="main">
        <h1>Hello World !</h1>
      </body>
    </html>

`lxml.html.builder.` `CLASS`(v)

`lxml.html.builder.` `FOR`(v)

`lxml.html.builder.` `A` = functools.partial(<lxml.builder.ElementMaker object>, 'a')

  anchor

`lxml.html.builder.` `ABBR` = functools.partial(<lxml.builder.ElementMaker object>, 'abbr')

  abbreviated form (e.g., WWW, HTTP, etc.)

`lxml.html.builder.` `ACRONYM` = functools.partial(<lxml.builder.ElementMaker object>, 'acronym')

`lxml.html.builder.` `ADDRESS` = functools.partial(<lxml.builder.ElementMaker object>, 'address')

  information on author

`lxml.html.builder.` `APPLET` = functools.partial(<lxml.builder.ElementMaker object>, 'applet')

  Java applet (DEPRECATED)

`lxml.html.builder.` `AREA` = functools.partial(<lxml.builder.ElementMaker object>, 'area')

  client-side image map area

`lxml.html.builder.` `B` = functools.partial(<lxml.builder.ElementMaker object>, 'b')

  bold text style

`lxml.html.builder.` `BASE` = functools.partial(<lxml.builder.ElementMaker object>, 'base')

  document base URI

`lxml.html.builder.` `BASEFONT` = functools.partial(<lxml.builder.ElementMaker object>, 'basefont')

  base font size (DEPRECATED)

`lxml.html.builder.` `BDO` = functools.partial(<lxml.builder.ElementMaker object>, 'bdo')

  I18N BiDi over-ride

`lxml.html.builder.` `BIG` = functools.partial(<lxml.builder.ElementMaker object>, 'big')

  large text style

`lxml.html.builder.` `BLOCKQUOTE` = functools.partial(<lxml.builder.ElementMaker object>, 'blockquote')

  long quotation

`lxml.html.builder.` `BODY` = functools.partial(<lxml.builder.ElementMaker object>, 'body')

  document body

`lxml.html.builder.` `BR` = functools.partial(<lxml.builder.ElementMaker object>, 'br')

  forced line break

`lxml.html.builder.` `BUTTON` = functools.partial(<lxml.builder.ElementMaker object>, 'button')

  push button

`lxml.html.builder.` `CAPTION` = functools.partial(<lxml.builder.ElementMaker object>, 'caption')

  table caption

`lxml.html.builder.` `CENTER` = functools.partial(<lxml.builder.ElementMaker object>, 'center')

  shorthand for DIV align=center (DEPRECATED)

`lxml.html.builder.` `CITE` = functools.partial(<lxml.builder.ElementMaker object>, 'cite')

  citation

`lxml.html.builder.` `CODE` = functools.partial(<lxml.builder.ElementMaker object>, 'code')

  computer code fragment

`lxml.html.builder.` `COL` = functools.partial(<lxml.builder.ElementMaker object>, 'col')

  table column

`lxml.html.builder.` `COLGROUP` = functools.partial(<lxml.builder.ElementMaker object>, 'colgroup')

  table column group

`lxml.html.builder.` `DD` = functools.partial(<lxml.builder.ElementMaker object>, 'dd')

  definition description

`lxml.html.builder.` `DEL` = functools.partial(<lxml.builder.ElementMaker object>, 'del')

  deleted text

`lxml.html.builder.` `DFN` = functools.partial(<lxml.builder.ElementMaker object>, 'dfn')

  instance definition

`lxml.html.builder.` `DIR` = functools.partial(<lxml.builder.ElementMaker object>, 'dir')

  directory list (DEPRECATED)

`lxml.html.builder.` `DIV` = functools.partial(<lxml.builder.ElementMaker object>, 'div')

  generic language/style container

`lxml.html.builder.` `DL` = functools.partial(<lxml.builder.ElementMaker object>, 'dl')

  definition list

`lxml.html.builder.` `DT` = functools.partial(<lxml.builder.ElementMaker object>, 'dt')

  definition term

`lxml.html.builder.` `EM` = functools.partial(<lxml.builder.ElementMaker object>, 'em')

  emphasis

`lxml.html.builder.` `FIELDSET` = functools.partial(<lxml.builder.ElementMaker object>, 'fieldset')

  form control group

`lxml.html.builder.` `FONT` = functools.partial(<lxml.builder.ElementMaker object>, 'font')

  local change to font (DEPRECATED)

`lxml.html.builder.` `FORM` = functools.partial(<lxml.builder.ElementMaker object>, 'form')

  interactive form

`lxml.html.builder.` `FRAME` = functools.partial(<lxml.builder.ElementMaker object>, 'frame')

  subwindow

`lxml.html.builder.` `FRAMESET` = functools.partial(<lxml.builder.ElementMaker object>, 'frameset')

  window subdivision

`lxml.html.builder.` `H1` = functools.partial(<lxml.builder.ElementMaker object>, 'h1')

  heading

`lxml.html.builder.` `H2` = functools.partial(<lxml.builder.ElementMaker object>, 'h2')

  heading

`lxml.html.builder.` `H3` = functools.partial(<lxml.builder.ElementMaker object>, 'h3')

  heading

`lxml.html.builder.` `H4` = functools.partial(<lxml.builder.ElementMaker object>, 'h4')

  heading

`lxml.html.builder.` `H5` = functools.partial(<lxml.builder.ElementMaker object>, 'h5')

  heading

`lxml.html.builder.` `H6` = functools.partial(<lxml.builder.ElementMaker object>, 'h6')

  heading

`lxml.html.builder.` `HEAD` = functools.partial(<lxml.builder.ElementMaker object>, 'head')

  document head

`lxml.html.builder.` `HR` = functools.partial(<lxml.builder.ElementMaker object>, 'hr')

  horizontal rule

`lxml.html.builder.` `HTML` = functools.partial(<lxml.builder.ElementMaker object>, 'html')

  document root element

`lxml.html.builder.` `I` = functools.partial(<lxml.builder.ElementMaker object>, 'i')

  italic text style

`lxml.html.builder.` `IFRAME` = functools.partial(<lxml.builder.ElementMaker object>, 'iframe')

  inline subwindow

`lxml.html.builder.` `IMG` = functools.partial(<lxml.builder.ElementMaker object>, 'img')

  Embedded image

`lxml.html.builder.` `INPUT` = functools.partial(<lxml.builder.ElementMaker object>, 'input')

  form control

`lxml.html.builder.` `INS` = functools.partial(<lxml.builder.ElementMaker object>, 'ins')

  inserted text

`lxml.html.builder.` `ISINDEX` = functools.partial(<lxml.builder.ElementMaker object>, 'isindex')

  single line prompt (DEPRECATED)

`lxml.html.builder.` `KBD` = functools.partial(<lxml.builder.ElementMaker object>, 'kbd')

  text to be entered by the user

`lxml.html.builder.` `LABEL` = functools.partial(<lxml.builder.ElementMaker object>, 'label')

  form field label text

`lxml.html.builder.` `LEGEND` = functools.partial(<lxml.builder.ElementMaker object>, 'legend')

  fieldset legend

`lxml.html.builder.` `LI` = functools.partial(<lxml.builder.ElementMaker object>, 'li')

  list item

`lxml.html.builder.` `LINK` = functools.partial(<lxml.builder.ElementMaker object>, 'link')

  a media-independent link

`lxml.html.builder.` `MAP` = functools.partial(<lxml.builder.ElementMaker object>, 'map')

  client-side image map

`lxml.html.builder.` `MENU` = functools.partial(<lxml.builder.ElementMaker object>, 'menu')

  menu list (DEPRECATED)

`lxml.html.builder.` `META` = functools.partial(<lxml.builder.ElementMaker object>, 'meta')

  generic metainformation

`lxml.html.builder.` `NOFRAMES` = functools.partial(<lxml.builder.ElementMaker object>, 'noframes')

  alternate content container for non frame-based rendering

`lxml.html.builder.` `NOSCRIPT` = functools.partial(<lxml.builder.ElementMaker object>, 'noscript')

  alternate content container for non script-based rendering

`lxml.html.builder.` `OBJECT` = functools.partial(<lxml.builder.ElementMaker object>, 'object')

  generic embedded object

`lxml.html.builder.` `OL` = functools.partial(<lxml.builder.ElementMaker object>, 'ol')

  ordered list

`lxml.html.builder.` `OPTGROUP` = functools.partial(<lxml.builder.ElementMaker object>, 'optgroup')

  option group

`lxml.html.builder.` `OPTION` = functools.partial(<lxml.builder.ElementMaker object>, 'option')

  selectable choice

`lxml.html.builder.` `P` = functools.partial(<lxml.builder.ElementMaker object>, 'p')

  paragraph

`lxml.html.builder.` `PARAM` = functools.partial(<lxml.builder.ElementMaker object>, 'param')

  named property value

`lxml.html.builder.` `PRE` = functools.partial(<lxml.builder.ElementMaker object>, 'pre')

  preformatted text

`lxml.html.builder.` `Q` = functools.partial(<lxml.builder.ElementMaker object>, 'q')

  short inline quotation

`lxml.html.builder.` `S` = functools.partial(<lxml.builder.ElementMaker object>, 's')

  strike-through text style (DEPRECATED)

`lxml.html.builder.` `SAMP` = functools.partial(<lxml.builder.ElementMaker object>, 'samp')

  sample program output, scripts, etc.

`lxml.html.builder.` `SCRIPT` = functools.partial(<lxml.builder.ElementMaker object>, 'script')

  script statements

`lxml.html.builder.` `SELECT` = functools.partial(<lxml.builder.ElementMaker object>, 'select')

  option selector

`lxml.html.builder.` `SMALL` = functools.partial(<lxml.builder.ElementMaker object>, 'small')

  small text style

`lxml.html.builder.` `SPAN` = functools.partial(<lxml.builder.ElementMaker object>, 'span')

  generic language/style container

`lxml.html.builder.` `STRIKE` = functools.partial(<lxml.builder.ElementMaker object>, 'strike')

  strike-through text (DEPRECATED)

`lxml.html.builder.` `STRONG` = functools.partial(<lxml.builder.ElementMaker object>, 'strong')

  strong emphasis

`lxml.html.builder.` `STYLE` = functools.partial(<lxml.builder.ElementMaker object>, 'style')

  style info

`lxml.html.builder.` `SUB` = functools.partial(<lxml.builder.ElementMaker object>, 'sub')

  subscript

`lxml.html.builder.` `SUP` = functools.partial(<lxml.builder.ElementMaker object>, 'sup')

  superscript

`lxml.html.builder.` `TABLE` = functools.partial(<lxml.builder.ElementMaker object>, 'table')

`lxml.html.builder.` `TBODY` = functools.partial(<lxml.builder.ElementMaker object>, 'tbody')

  table body

`lxml.html.builder.` `TD` = functools.partial(<lxml.builder.ElementMaker object>, 'td')

  table data cell

`lxml.html.builder.` `TEXTAREA` = functools.partial(<lxml.builder.ElementMaker object>, 'textarea')

  multi-line text field

`lxml.html.builder.` `TFOOT` = functools.partial(<lxml.builder.ElementMaker object>, 'tfoot')

  table footer

`lxml.html.builder.` `TH` = functools.partial(<lxml.builder.ElementMaker object>, 'th')

  table header cell

`lxml.html.builder.` `THEAD` = functools.partial(<lxml.builder.ElementMaker object>, 'thead')

  table header

`lxml.html.builder.` `TITLE` = functools.partial(<lxml.builder.ElementMaker object>, 'title')

  document title

`lxml.html.builder.` `TR` = functools.partial(<lxml.builder.ElementMaker object>, 'tr')

  table row

`lxml.html.builder.` `TT` = functools.partial(<lxml.builder.ElementMaker object>, 'tt')

  teletype or monospaced text style

`lxml.html.builder.` `U` = functools.partial(<lxml.builder.ElementMaker object>, 'u')

  underlined text style (DEPRECATED)

`lxml.html.builder.` `UL` = functools.partial(<lxml.builder.ElementMaker object>, 'ul')

  unordered list

`lxml.html.builder.` `VAR` = functools.partial(<lxml.builder.ElementMaker object>, 'var')

  instance of a variable or program argument