8077332: tidy warnings from javax/xml

Some HTML markup fix (jaxp part)

Reviewed-by: joehw, lancea
This commit is contained in:
Alexander Stepanov 2015-04-21 20:01:21 +04:00
parent 7cbdcf978d
commit b27f042010
30 changed files with 1381 additions and 1412 deletions

View file

@ -70,7 +70,6 @@ public abstract class XMLEventFactory {
* This static method creates a new factory instance.
* This method uses the following ordered lookup procedure to determine
* the XMLEventFactory implementation class to load:
* <p>
* <ul>
* <li>
* Use the javax.xml.stream.XMLEventFactory system property.
@ -158,7 +157,6 @@ public abstract class XMLEventFactory {
* <p>
* This method uses the following ordered lookup procedure to determine
* the XMLEventFactory implementation class to load:
* <p>
* <ul>
* <li>
* Use the value of the system property identified by {@code factoryId}.

View file

@ -160,7 +160,7 @@ public abstract class XMLInputFactory {
* This static method creates a new factory instance.
* This method uses the following ordered lookup procedure to determine
* the XMLInputFactory implementation class to load:
* </p>
*
* <ul>
* <li>
* <p>Use the javax.xml.stream.XMLInputFactory system property.
@ -201,12 +201,11 @@ public abstract class XMLInputFactory {
* <p>
* Once an application has obtained a reference to a XMLInputFactory it
* can use the factory to configure and obtain stream instances.
* </p>
* <p>
* Note that this is a new method that replaces the deprecated newInstance() method.
* No changes in behavior are defined by this replacement method relative to
* the deprecated method.
* </p>
*
* @throws FactoryConfigurationError in case of {@linkplain
* java.util.ServiceConfigurationError service configuration error} or if
* the implementation is not available or cannot be instantiated.
@ -245,7 +244,6 @@ public abstract class XMLInputFactory {
* <p>
* This method uses the following ordered lookup procedure to determine
* the XMLInputFactory implementation class to load:
* <p>
* <ul>
* <li>
* <p>
@ -488,7 +486,6 @@ public abstract class XMLInputFactory {
* <p>
* All implementations that implement JAXP 1.5 or newer are required to
* support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property.
* </p>
* <ul>
* <li>
* <p>
@ -497,7 +494,7 @@ public abstract class XMLInputFactory {
* due to the restriction of this property, {@link javax.xml.stream.XMLStreamException}
* will be thrown by the {@link javax.xml.stream.XMLStreamReader#next()} or
* {@link javax.xml.stream.XMLEventReader#nextEvent()} method.
* </p>
*
* </li>
* </ul>
* @param name The name of the property (may not be null)

View file

@ -54,17 +54,18 @@ import javax.xml.transform.Result;
* <th>Default Value</th>
* <th>Required</th>
* </tr>
* <tr><td>javax.xml.stream.isRepairingNamespaces</td><td>defaults prefixes on the output side</td><td>Boolean</td><td>False</td><td>Yes</td></tr>
* <tr><td>javax.xml.stream.isRepairingNamespaces</td><td>defaults prefixes
* on the output side</td><td>Boolean</td><td>False</td><td>Yes</td></tr>
* </tbody>
* </table>
*
* <p>The following paragraphs describe the namespace and prefix repair algorithm:</p>
* <p>The following paragraphs describe the namespace and prefix repair algorithm:
*
* <p>The property can be set with the following code line:
* <code>setProperty("javax.xml.stream.isRepairingNamespaces",new Boolean(true|false));</code></p>
* {@code setProperty("javax.xml.stream.isRepairingNamespaces", new Boolean(true|false));}
*
* <p>This property specifies that the writer default namespace prefix declarations.
* The default value is false. </p>
* The default value is false.
*
* <p>If a writer isRepairingNamespaces it will create a namespace declaration
* on the current StartElement for
@ -74,11 +75,11 @@ import javax.xml.transform.Result;
* has not been declared in a parent of the current StartElement it will be declared
* on the current StartElement. If the defaultNamespace is bound and in scope
* and the default namespace matches the URI of the attribute or StartElement
* QName no prefix will be assigned.</p>
* QName no prefix will be assigned.
*
* <p>If an element or attribute name has a prefix, but is not
* bound to any namespace URI, then the prefix will be removed
* during serialization.</p>
* during serialization.
*
* <p>If element and/or attribute names in the same start or
* empty-element tag are bound to different namespace URIs and
@ -86,20 +87,20 @@ import javax.xml.transform.Result;
* occurring attribute retains the original prefix and the
* following attributes have their prefixes replaced with a
* new prefix that is bound to the namespace URIs of those
* attributes. </p>
* attributes.
*
* <p>If an element or attribute name uses a prefix that is
* bound to a different URI than that inherited from the
* namespace context of the parent of that element and there
* is no namespace declaration in the context of the current
* element then such a namespace declaration is added. </p>
* element then such a namespace declaration is added.
*
* <p>If an element or attribute name is bound to a prefix and
* there is a namespace declaration that binds that prefix
* to a different URI then that namespace declaration is
* either removed if the correct mapping is inherited from
* the parent context of that element, or changed to the
* namespace URI of the element or attribute using that prefix.</p>
* namespace URI of the element or attribute using that prefix.
*
* @version 1.2
* @author Copyright (c) 2009, 2015 by Oracle Corporation. All Rights Reserved.
@ -136,7 +137,6 @@ public abstract class XMLOutputFactory {
* This static method creates a new factory instance. This method uses the
* following ordered lookup procedure to determine the XMLOutputFactory
* implementation class to load:
* <p>
* <ul>
* <li>
* Use the javax.xml.stream.XMLOutputFactory system property.
@ -177,6 +177,7 @@ public abstract class XMLOutputFactory {
* <p>
* Otherwise, the system-default implementation is returned.
* </li>
* </ul>
* <p>
* Once an application has obtained a reference to a XMLOutputFactory it
* can use the factory to configure and obtain stream instances.
@ -222,7 +223,6 @@ public abstract class XMLOutputFactory {
* <p>
* This method uses the following ordered lookup procedure to determine
* the XMLOutputFactory implementation class to load:
* <p>
* <ul>
* <li>
* Use the value of the system property identified by {@code factoryId}.

View file

@ -57,9 +57,9 @@ import javax.xml.namespace.QName;
* javax.xml.stream.notations and javax.xml.stream.entities.
* When the current event is a DTD the following call will return a
* list of Notations
* <code>List l = (List) getProperty("javax.xml.stream.notations");</code>
* {@code List l = (List) getProperty("javax.xml.stream.notations");}
* The following call will return a list of entity declarations:
* <code>List l = (List) getProperty("javax.xml.stream.entities");</code>
* {@code List l = (List) getProperty("javax.xml.stream.entities");}
* These properties can only be accessed during a DTD event and
* are defined to return null if the information is not available.
*
@ -97,12 +97,13 @@ import javax.xml.namespace.QName;
* getElementText(), nextTag()
* </td>
* </tr>
* <tr>
* <td> ATTRIBUTE </td>
* <td> next(), nextTag()
* getAttributeXXX(), isAttributeSpecified(),
* </td>
* </tr>
* </tr>
* <tr>
* <td> NAMESPACE </td>
* <td> next(), nextTag()
* getNamespaceXXX()
@ -184,7 +185,7 @@ public interface XMLStreamReader extends XMLStreamConstants {
* If element content is empty (i.e. content is "") then no CHARACTERS event will be reported.
*
* <p>Given the following XML:<br>
* &lt;foo>&lt;!--description-->content text&lt;![CDATA[&lt;greeting>Hello&lt;/greeting>]]>other content&lt;/foo><br>
* {@code <foo><!--description-->content text<![CDATA[<greeting>Hello>/greeting>]]>other content>/foo>}<br>
* The behavior of calling next() when being on foo will be:<br>
* 1- the comment (COMMENT)<br>
* 2- then the characters section (CHARACTERS)<br>
@ -192,14 +193,14 @@ public interface XMLStreamReader extends XMLStreamConstants {
* 4- then the next characters section (another CHARACTERS)<br>
* 5- then the END_ELEMENT<br>
*
* <p><b>NOTE:</b> empty element (such as &lt;tag/>) will be reported
* <p><b>NOTE:</b> empty element (such as {@code <tag/>}) will be reported
* with two separate events: START_ELEMENT, END_ELEMENT - This preserves
* parsing equivalency of empty element to &lt;tag>&lt;/tag>.
* parsing equivalency of empty element to {@code <tag></tag>}.
*
* This method will throw an IllegalStateException if it is called after hasNext() returns false.
* @see javax.xml.stream.events.XMLEvent
* @return the integer code corresponding to the current parse event
* @throws NoSuchElementException if this is called when hasNext() returns false
* @throws java.util.NoSuchElementException if this is called when hasNext() returns false
* @throws XMLStreamException if there is an error processing the underlying XML source
*/
public int next() throws XMLStreamException;
@ -219,38 +220,39 @@ public interface XMLStreamReader extends XMLStreamConstants {
* Reads the content of a text-only element, an exception is thrown if this is
* not a text-only element.
* Regardless of value of javax.xml.stream.isCoalescing this method always returns coalesced content.
* <br /> Precondition: the current event is START_ELEMENT.
* <br /> Postcondition: the current event is the corresponding END_ELEMENT.
* <br> Precondition: the current event is START_ELEMENT.
* <br> Postcondition: the current event is the corresponding END_ELEMENT.
*
* <br />The method does the following (implementations are free to optimized
* <br>The method does the following (implementations are free to optimized
* but must do equivalent processing):
* <pre>
* if(getEventType() != XMLStreamConstants.START_ELEMENT) {
* throw new XMLStreamException(
* "parser must be on START_ELEMENT to read next text", getLocation());
* throw new XMLStreamException(
* "parser must be on START_ELEMENT to read next text", getLocation());
* }
*
* int eventType = next();
* StringBuffer content = new StringBuffer();
* while(eventType != XMLStreamConstants.END_ELEMENT ) {
* if(eventType == XMLStreamConstants.CHARACTERS
* || eventType == XMLStreamConstants.CDATA
* || eventType == XMLStreamConstants.SPACE
* || eventType == XMLStreamConstants.ENTITY_REFERENCE) {
* buf.append(getText());
* } else if(eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
* || eventType == XMLStreamConstants.COMMENT) {
* // skipping
* } else if(eventType == XMLStreamConstants.END_DOCUMENT) {
* throw new XMLStreamException(
* "unexpected end of document when reading element text content", this);
* } else if(eventType == XMLStreamConstants.START_ELEMENT) {
* throw new XMLStreamException(
* "element text content may not contain START_ELEMENT", getLocation());
* } else {
* throw new XMLStreamException(
* "Unexpected event type "+eventType, getLocation());
* }
* eventType = next();
* while(eventType != XMLStreamConstants.END_ELEMENT) {
* if(eventType == XMLStreamConstants.CHARACTERS
* || eventType == XMLStreamConstants.CDATA
* || eventType == XMLStreamConstants.SPACE
* || eventType == XMLStreamConstants.ENTITY_REFERENCE) {
* buf.append(getText());
* } else if(eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
* || eventType == XMLStreamConstants.COMMENT) {
* // skipping
* } else if(eventType == XMLStreamConstants.END_DOCUMENT) {
* throw new XMLStreamException(
* "unexpected end of document when reading element text content", this);
* } else if(eventType == XMLStreamConstants.START_ELEMENT) {
* throw new XMLStreamException(
* "element text content may not contain START_ELEMENT", getLocation());
* } else {
* throw new XMLStreamException(
* "Unexpected event type "+eventType, getLocation());
* }
* eventType = next();
* }
* return buf.toString();
* </pre>
@ -268,33 +270,33 @@ public interface XMLStreamReader extends XMLStreamConstants {
* are encountered, an exception is thrown. This method should
* be used when processing element-only content seperated by white space.
*
* <br /> Precondition: none
* <br /> Postcondition: the current event is START_ELEMENT or END_ELEMENT
* <br> Precondition: none
* <br> Postcondition: the current event is START_ELEMENT or END_ELEMENT
* and cursor may have moved over any whitespace event.
*
* <br />Essentially it does the following (implementations are free to optimized
* <br>Essentially it does the following (implementations are free to optimized
* but must do equivalent processing):
* <pre>
* <pre> {@code
* int eventType = next();
* while((eventType == XMLStreamConstants.CHARACTERS &amp;&amp; isWhiteSpace()) // skip whitespace
* || (eventType == XMLStreamConstants.CDATA &amp;&amp; isWhiteSpace())
* while((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace
* || (eventType == XMLStreamConstants.CDATA && isWhiteSpace())
* // skip whitespace
* || eventType == XMLStreamConstants.SPACE
* || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
* || eventType == XMLStreamConstants.COMMENT
* ) {
* eventType = next();
* eventType = next();
* }
* if (eventType != XMLStreamConstants.START_ELEMENT &amp;&amp; eventType != XMLStreamConstants.END_ELEMENT) {
* throw new String XMLStreamException("expected start or end tag", getLocation());
* if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {
* throw new String XMLStreamException("expected start or end tag", getLocation());
* }
* return eventType;
* return eventType; }
* </pre>
*
* @return the event type of the element read (START_ELEMENT or END_ELEMENT)
* @throws XMLStreamException if the current event is not white space, PROCESSING_INSTRUCTION,
* START_ELEMENT or END_ELEMENT
* @throws NoSuchElementException if this is called when hasNext() returns false
* @throws java.util.NoSuchElementException if this is called when hasNext() returns false
*/
public int nextTag() throws XMLStreamException;
@ -309,7 +311,7 @@ public interface XMLStreamReader extends XMLStreamConstants {
public boolean hasNext() throws XMLStreamException;
/**
* Frees any resources associated with this Reader. This method does not close the
* Frees any resources associated with this Reader. This method does not close the
* underlying input source.
* @throws XMLStreamException if there are errors freeing associated resources
*/
@ -542,7 +544,7 @@ public interface XMLStreamReader extends XMLStreamConstants {
* If the number of characters actually copied is less than the "length", then there is no more text.
* Otherwise, subsequent calls need to be made until all text has been retrieved. For example:
*
*<code>
* <pre>{@code
* int length = 1024;
* char[] myBuffer = new char[ length ];
*
@ -553,7 +555,7 @@ public interface XMLStreamReader extends XMLStreamConstants {
* if (nCopied < length)
* break;
* }
* </code>
* } </pre>
* XMLStreamException may be thrown if there are any XML errors in the underlying source.
* The "targetStart" argument must be greater than or equal to 0 and less than the length of "target",
* Length must be greater than 0 and "targetStart + length" must be less than or equal to length of "target".
@ -564,8 +566,8 @@ public interface XMLStreamReader extends XMLStreamConstants {
* @param length the number of characters to copy
* @return the number of characters actually copied
* @throws XMLStreamException if the underlying XML source is not well-formed
* @throws IndexOutOfBoundsException if targetStart < 0 or > than the length of target
* @throws IndexOutOfBoundsException if length < 0 or targetStart + length > length of target
* @throws IndexOutOfBoundsException if targetStart {@literal <} 0 or {@literal >} than the length of target
* @throws IndexOutOfBoundsException if length {@literal <} 0 or targetStart + length {@literal >} length of target
* @throws UnsupportedOperationException if this method is not supported
* @throws NullPointerException is if target is null
*/

View file

@ -33,9 +33,9 @@ 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 &amp; , &lt; and &gt;
* the writeCharacters method is required to escape {@literal &, < and >}
* For attribute values the writeAttribute method will escape the
* above characters plus &quot; to ensure that all character content
* above characters plus {@literal "} to ensure that all character content
* and attribute values are well formed.
*
* Each NAMESPACE
@ -44,12 +44,12 @@ import javax.xml.namespace.NamespaceContext;
* <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>
* <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</code> == true</th>
* <th colspan="2"><code>isRepairingNamespaces</code> == false</th>
* <th colspan="2">{@code isRepairingNamespaces} == true</th>
* <th colspan="2">{@code isRepairingNamespaces} == false</th>
* </tr>
* <tr>
* <th></th> <!-- method -->
@ -62,7 +62,7 @@ import javax.xml.namespace.NamespaceContext;
*
* <tbody>
* <tr>
* <th><code>writeAttribute(namespaceURI, localName, value)</code></th>
* <th>{@code writeAttribute(namespaceURI, localName, value)}</th>
* <!-- isRepairingNamespaces == true -->
* <td>
* <!-- namespaceURI bound -->
@ -79,19 +79,19 @@ import javax.xml.namespace.NamespaceContext;
* </td>
* <td>
* <!-- namespaceURI unbound -->
* <code>XMLStreamException</code>
* {@code XMLStreamException}
* </td>
* </tr>
*
* <tr>
* <th><code>writeAttribute(prefix, namespaceURI, localName, value)</code></th>
* <th>{@code writeAttribute(prefix, namespaceURI, localName, value)}</th>
* <!-- isRepairingNamespaces == true -->
* <td>
* <!-- namespaceURI bound -->
* bound to same prefix:<br />
* prefix:localName="value"&nbsp;<sup>[1]</sup><br />
* <br />
* bound to different prefix:<br />
* bound to same prefix:<br>
* prefix:localName="value"&nbsp;<sup>[1]</sup><br>
* <br>
* bound to different prefix:<br>
* xmlns:{generated}="namespaceURI" {generated}:localName="value"
* </td>
* <td>
@ -101,11 +101,11 @@ import javax.xml.namespace.NamespaceContext;
* <!-- isRepairingNamespaces == false -->
* <td>
* <!-- namespaceURI bound -->
* bound to same prefix:<br />
* prefix:localName="value"&nbsp;<sup>[1][2]</sup><br />
* <br />
* bound to different prefix:<br />
* <code>XMLStreamException</code><sup>[2]</sup>
* bound to same prefix:<br>
* prefix:localName="value"&nbsp;<sup>[1][2]</sup><br>
* <br>
* bound to different prefix:<br>
* {@code XMLStreamException}<sup>[2]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
@ -114,58 +114,58 @@ import javax.xml.namespace.NamespaceContext;
* </tr>
*
* <tr>
* <th><code>writeStartElement(namespaceURI, localName)</code><br />
* <br />
* <code>writeEmptyElement(namespaceURI, localName)</code></th>
* <th>{@code writeStartElement(namespaceURI, localName)}<br>
* <br>
* {@code writeEmptyElement(namespaceURI, localName)}</th>
* <!-- isRepairingNamespaces == true -->
* <td >
* <!-- namespaceURI bound -->
* &lt;prefix:localName&gt;&nbsp;<sup>[1]</sup>
* {@code <prefix:localName>}&nbsp;<sup>[1]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
* &lt;{generated}:localName xmlns:{generated}="namespaceURI"&gt;
* {@code <{generated}:localName xmlns:{generated}="namespaceURI">}
* </td>
* <!-- isRepairingNamespaces == false -->
* <td>
* <!-- namespaceURI bound -->
* &lt;prefix:localName&gt;&nbsp;<sup>[1]</sup>
* {@code prefix:localName>}&nbsp;<sup>[1]</sup>
* </td>
* <td>
* <!-- namespaceURI unbound -->
* <code>XMLStreamException</code>
* {@code XMLStreamException}
* </td>
* </tr>
*
* <tr>
* <th><code>writeStartElement(prefix, localName, namespaceURI)</code><br />
* <br />
* <code>writeEmptyElement(prefix, localName, namespaceURI)</code></th>
* <th>{@code writeStartElement(prefix, localName, namespaceURI)}<br>
* <br>
* {@code writeEmptyElement(prefix, localName, namespaceURI)}</th>
* <!-- isRepairingNamespaces == true -->
* <td>
* <!-- namespaceURI bound -->
* bound to same prefix:<br />
* &lt;prefix:localName&gt;&nbsp;<sup>[1]</sup><br />
* <br />
* bound to different prefix:<br />
* &lt;{generated}:localName xmlns:{generated}="namespaceURI"&gt;
* bound to same prefix:<br>
* {@code <prefix:localName>}&nbsp;<sup>[1]</sup><br>
* <br>
* bound to different prefix:<br>
* {@code <{generated}:localName xmlns:{generated}="namespaceURI">}
* </td>
* <td>
* <!-- namespaceURI unbound -->
* &lt;prefix:localName xmlns:prefix="namespaceURI"&gt;&nbsp;<sup>[4]</sup>
* {@code <prefix:localName xmlns:prefix="namespaceURI">}&nbsp;<sup>[4]</sup>
* </td>
* <!-- isRepairingNamespaces == false -->
* <td>
* <!-- namespaceURI bound -->
* bound to same prefix:<br />
* &lt;prefix:localName&gt;&nbsp;<sup>[1]</sup><br />
* <br />
* bound to different prefix:<br />
* <code>XMLStreamException</code>
* bound to same prefix:<br>
* {@code <prefix:localName>}&nbsp;<sup>[1]</sup><br>
* <br>
* bound to different prefix:<br>
* {@code XMLStreamException}
* </td>
* <td>
* <!-- namespaceURI unbound -->
* &lt;prefix:localName&gt;&nbsp;
* {@code <prefix:localName>}&nbsp;
* </td>
* </tr>
* </tbody>
@ -175,10 +175,14 @@ import javax.xml.namespace.NamespaceContext;
* 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>[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>
* <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>