Powered by SmartDoc

html option

The html option enables Relaxer to generate a HTML page with a FORM element from a resource specified by the parameter.

parameter

The html option takes no parameters. Specifying the html option indicates that you want to use the HTML generator.

Artifacts

The html generates an HTML page from a resource specified by a parameter.

Example

The artifact of from the HTML generator is shown in List 31.2.3.1[html.rng].

html.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="account"/>
  </start>
  <define name="account">
    <element name="account">
      <attribute name="accountNo">
        <data type="token"/>
      </attribute>
      <element name="balance">
        <data type="int"/>
      </element>
      <element name="owner">
        <data type="token"/>
      </element>
      <ref name="address"/>
      <zeroOrMore>
        <ref name="phone"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="address">
    <element name="address">
      <attribute name="zip">
        <data type="token"/>
      </attribute>
      <text/>
    </element>
  </define>
  <define name="phone">
    <element name="phone">
      <attribute name="area">
        <data type="token"/>
      </attribute>
      <data type="token"/>
    </element>
  </define>
</grammar>

Relaxer generates following HTML pages with FORM elements:

account.html
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>account</title>
  </head>
  <body>
    <form action="?" method="post">
      <label for="accountNo">accountNo</label>
      <input id="accountNo" name="/account/@accountNo" type="text"/>
      <label for="balance">balance</label>
      <input id="balance" name="/account/balance" type="text"/>
      <label for="owner">owner</label>
      <input id="owner" name="/account/owner" type="text"/>
      <input type="submit" value="submit"/>
      <input type="reset" value="reset"/>
    </form>
  </body>
</html>
address.html
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>address</title>
  </head>
  <body>
    <form action="?" method="post">
      <label for="zip">zip</label>
      <input id="zip" name="/address/@zip" type="text"/>
      <input type="submit" value="submit"/>
      <input type="reset" value="reset"/>
    </form>
  </body>
</html>
phone.html
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>phone</title>
  </head>
  <body>
    <form action="?" method="post">
      <label for="area">area</label>
      <input id="area" name="/phone/@area" type="text"/>
      <input type="submit" value="submit"/>
      <input type="reset" value="reset"/>
    </form>
  </body>
</html>