20. newElementContent

<newElementContent
  addRequiredAttributes = boolean : true
  emptyAttributes = boolean : false
  generateIds = boolean : false
  addChildElements = (noChoice|
                      firstChoice|
                      simplestChoice|
                      elementOnlyContentNotEmpty) : simplestChoice
/>

Parametrizes the content of a newly inserted element automatically generated by XXE (has no effect on element templates):

addRequiredAttributes, emptyAttributes, generateIds

Example:

<!ELEMENT anchor EMPTY>
<!ATTLIST anchor id ID #REQUIRED>

addRequiredAttributes="false" creates <anchor/> (emptyAttributes and generateIds are ignored in such case) .

addRequiredAttributes="true", emptyAttributes="false", generateIds="false" creates <anchor id="???"/>.

addRequiredAttributes="true", emptyAttributes="true", generateIds="false" creates <anchor id=""/>.

addRequiredAttributes="true", generateIds="true", creates <anchor id="__f34a62b09.b"/> (whatever is the value of emptyAttributes).

addChildElements

Example:

<!ELEMENT section (title,(table|para)+)>
<!ELEMENT para #PCDATA>
<!ELEMENT table (header?,row*)>

addChildElements="noChoice" creates <section><title></title></section> (which is invalid) because it will not choose between a para and a table.

addChildElements="firstChoice" creates <section><title></title><table></table></section>. This option is useful for authors who write small schema for use in XXE and don't want to worry about elementTemplates.

addChildElements="simplestChoice" creates <section><title></title><para></para></section> because the content of a para is simpler than the content of a table.

addChildElements="elementOnlyContentNotEmpty" is a variant of simplestChoice for elements having an element-only content. In the case of this kind of elements, this variant will not create empty elements, even if this is allowed by the schema. For example, using this option creates this table: <table><row><cell></cell></row></table>, where using simplestChoice would have created an empty table: <table></table>.

Example:

  <newElementContent generateIds="true" addChildElements="firstChoice" />