< prev index next >
src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java
Print this page
*** 31,57 ****
import javax.xml.namespace.NamespaceContext;
/**
* The XMLStreamWriter interface specifies how to write XML. The XMLStreamWriter does
* not perform well formedness checking on its input. However
! * the writeCharacters method is required to escape & , < and >
* For attribute values the writeAttribute method will escape the
! * above characters plus " to ensure that all character content
* and attribute values are well formed.
*
* Each NAMESPACE
* and ATTRIBUTE must be individually written.
*
* <table border="1" cellpadding="2" cellspacing="0">
* <thead>
* <tr>
! * <th colspan="5">XML Namespaces, <code>javax.xml.stream.isRepairingNamespaces</code> and write method behaviour</th>
* </tr>
* <tr>
* <th>Method</th> <!-- method -->
! * <th colspan="2"><code>isRepairingNamespaces</code> == true</th>
! * <th colspan="2"><code>isRepairingNamespaces</code> == false</th>
* </tr>
* <tr>
* <th></th> <!-- method -->
* <th>namespaceURI bound</th>
* <th>namespaceURI unbound</th>
--- 31,57 ----
import javax.xml.namespace.NamespaceContext;
/**
* The XMLStreamWriter interface specifies how to write XML. The XMLStreamWriter does
* not perform well formedness checking on its input. However
! * the writeCharacters method is required to escape {@literal &, < and >}
* For attribute values the writeAttribute method will escape the
! * above characters plus {@literal "} to ensure that all character content
* and attribute values are well formed.
*
* Each NAMESPACE
* and ATTRIBUTE must be individually written.
*
* <table border="1" cellpadding="2" cellspacing="0">
* <thead>
* <tr>
! * <th colspan="5">XML Namespaces, {@code javax.xml.stream.isRepairingNamespaces} and write method behaviour</th>
* </tr>
* <tr>
* <th>Method</th> <!-- method -->
! * <th colspan="2">{@code isRepairingNamespaces} == true</th>
! * <th colspan="2">{@code isRepairingNamespaces} == false</th>
* </tr>
* <tr>
* <th></th> <!-- method -->
* <th>namespaceURI bound</th>
* <th>namespaceURI unbound</th>
*** 60,70 ****
* </tr>
* </thead>
*
* <tbody>
* <tr>
! * <th><code>writeAttribute(namespaceURI, localName, value)</code></th>
* <!-- isRepairingNamespaces == true -->
* <td>
* <!-- namespaceURI bound -->
* prefix:localName="value" <sup>[1]</sup>
* </td>
--- 60,70 ----
* </tr>
* </thead>
*
* <tbody>
* <tr>
! * <th>{@code writeAttribute(namespaceURI, localName, value)}</th>
* <!-- isRepairingNamespaces == true -->
* <td>
* <!-- namespaceURI bound -->
* prefix:localName="value" <sup>[1]</sup>
* </td>
*** 77,186 ****
* <!-- namespaceURI bound -->
* prefix:localName="value" <sup>[1]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
! * <code>XMLStreamException</code>
* </td>
* </tr>
*
* <tr>
! * <th><code>writeAttribute(prefix, namespaceURI, localName, value)</code></th>
* <!-- isRepairingNamespaces == true -->
* <td>
* <!-- namespaceURI bound -->
! * bound to same prefix:<br />
! * prefix:localName="value" <sup>[1]</sup><br />
! * <br />
! * bound to different prefix:<br />
* xmlns:{generated}="namespaceURI" {generated}:localName="value"
* </td>
* <td>
* <!-- namespaceURI unbound -->
* xmlns:prefix="namespaceURI" prefix:localName="value" <sup>[3]</sup>
* </td>
* <!-- isRepairingNamespaces == false -->
* <td>
* <!-- namespaceURI bound -->
! * bound to same prefix:<br />
! * prefix:localName="value" <sup>[1][2]</sup><br />
! * <br />
! * bound to different prefix:<br />
! * <code>XMLStreamException</code><sup>[2]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
* xmlns:prefix="namespaceURI" prefix:localName="value" <sup>[2][5]</sup>
* </td>
* </tr>
*
* <tr>
! * <th><code>writeStartElement(namespaceURI, localName)</code><br />
! * <br />
! * <code>writeEmptyElement(namespaceURI, localName)</code></th>
* <!-- isRepairingNamespaces == true -->
* <td >
* <!-- namespaceURI bound -->
! * <prefix:localName> <sup>[1]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
! * <{generated}:localName xmlns:{generated}="namespaceURI">
* </td>
* <!-- isRepairingNamespaces == false -->
* <td>
* <!-- namespaceURI bound -->
! * <prefix:localName> <sup>[1]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
! * <code>XMLStreamException</code>
* </td>
* </tr>
*
* <tr>
! * <th><code>writeStartElement(prefix, localName, namespaceURI)</code><br />
! * <br />
! * <code>writeEmptyElement(prefix, localName, namespaceURI)</code></th>
* <!-- isRepairingNamespaces == true -->
* <td>
* <!-- namespaceURI bound -->
! * bound to same prefix:<br />
! * <prefix:localName> <sup>[1]</sup><br />
! * <br />
! * bound to different prefix:<br />
! * <{generated}:localName xmlns:{generated}="namespaceURI">
* </td>
* <td>
* <!-- namespaceURI unbound -->
! * <prefix:localName xmlns:prefix="namespaceURI"> <sup>[4]</sup>
* </td>
* <!-- isRepairingNamespaces == false -->
* <td>
* <!-- namespaceURI bound -->
! * bound to same prefix:<br />
! * <prefix:localName> <sup>[1]</sup><br />
! * <br />
! * bound to different prefix:<br />
! * <code>XMLStreamException</code>
* </td>
* <td>
* <!-- namespaceURI unbound -->
! * <prefix:localName>
* </td>
* </tr>
* </tbody>
* <tfoot>
* <tr>
* <td colspan="5">
* Notes:
* <ul>
* <li>[1] if namespaceURI == default Namespace URI, then no prefix is written</li>
! * <li>[2] if prefix == "" || null && namespaceURI == "", then no prefix or Namespace declaration is generated or written</li>
* <li>[3] if prefix == "" || null, then a prefix is randomly generated</li>
! * <li>[4] if prefix == "" || null, then it is treated as the default Namespace and no prefix is generated or written, an xmlns declaration is generated and written if the namespaceURI is unbound</li>
! * <li>[5] if prefix == "" || null, then it is treated as an invalid attempt to define the default Namespace and an XMLStreamException is thrown</li>
* </ul>
* </td>
* </tr>
* </tfoot>
* </table>
--- 77,190 ----
* <!-- namespaceURI bound -->
* prefix:localName="value" <sup>[1]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
! * {@code XMLStreamException}
* </td>
* </tr>
*
* <tr>
! * <th>{@code writeAttribute(prefix, namespaceURI, localName, value)}</th>
* <!-- isRepairingNamespaces == true -->
* <td>
* <!-- namespaceURI bound -->
! * bound to same prefix:<br>
! * prefix:localName="value" <sup>[1]</sup><br>
! * <br>
! * bound to different prefix:<br>
* xmlns:{generated}="namespaceURI" {generated}:localName="value"
* </td>
* <td>
* <!-- namespaceURI unbound -->
* xmlns:prefix="namespaceURI" prefix:localName="value" <sup>[3]</sup>
* </td>
* <!-- isRepairingNamespaces == false -->
* <td>
* <!-- namespaceURI bound -->
! * bound to same prefix:<br>
! * prefix:localName="value" <sup>[1][2]</sup><br>
! * <br>
! * bound to different prefix:<br>
! * {@code XMLStreamException}<sup>[2]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
* xmlns:prefix="namespaceURI" prefix:localName="value" <sup>[2][5]</sup>
* </td>
* </tr>
*
* <tr>
! * <th>{@code writeStartElement(namespaceURI, localName)}<br>
! * <br>
! * {@code writeEmptyElement(namespaceURI, localName)}</th>
* <!-- isRepairingNamespaces == true -->
* <td >
* <!-- namespaceURI bound -->
! * {@code <prefix:localName>} <sup>[1]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
! * {@code <{generated}:localName xmlns:{generated}="namespaceURI">}
* </td>
* <!-- isRepairingNamespaces == false -->
* <td>
* <!-- namespaceURI bound -->
! * {@code prefix:localName>} <sup>[1]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
! * {@code XMLStreamException}
* </td>
* </tr>
*
* <tr>
! * <th>{@code writeStartElement(prefix, localName, namespaceURI)}<br>
! * <br>
! * {@code writeEmptyElement(prefix, localName, namespaceURI)}</th>
* <!-- isRepairingNamespaces == true -->
* <td>
* <!-- namespaceURI bound -->
! * bound to same prefix:<br>
! * {@code <prefix:localName>} <sup>[1]</sup><br>
! * <br>
! * bound to different prefix:<br>
! * {@code <{generated}:localName xmlns:{generated}="namespaceURI">}
* </td>
* <td>
* <!-- namespaceURI unbound -->
! * {@code <prefix:localName xmlns:prefix="namespaceURI">} <sup>[4]</sup>
* </td>
* <!-- isRepairingNamespaces == false -->
* <td>
* <!-- namespaceURI bound -->
! * bound to same prefix:<br>
! * {@code <prefix:localName>} <sup>[1]</sup><br>
! * <br>
! * bound to different prefix:<br>
! * {@code XMLStreamException}
* </td>
* <td>
* <!-- namespaceURI unbound -->
! * {@code <prefix:localName>}
* </td>
* </tr>
* </tbody>
* <tfoot>
* <tr>
* <td colspan="5">
* Notes:
* <ul>
* <li>[1] if namespaceURI == default Namespace URI, then no prefix is written</li>
! * <li>[2] if prefix == "" || null {@literal &&} namespaceURI == "", then
! no prefix or Namespace declaration is generated or written</li>
* <li>[3] if prefix == "" || null, then a prefix is randomly generated</li>
! * <li>[4] if prefix == "" || null, then it is treated as the default Namespace and
! no prefix is generated or written, an xmlns declaration is generated
! and written if the namespaceURI is unbound</li>
! * <li>[5] if prefix == "" || null, then it is treated as an invalid attempt to
! define the default Namespace and an XMLStreamException is thrown</li>
* </ul>
* </td>
* </tr>
* </tfoot>
* </table>
< prev index next >