xml serializer exceptions (towards XmlPull 1.1)
Aleksander Slominski <[email protected]>
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <[email protected]> |
hi,
i have checked in updated XmlSerializer interface that should be
now ready (more or less) for XmlPull 1.1 API ("developement" version
before we reach stable new XmlPull 1.2 API).
added motivation for use of IllegalArgument/State exceptions to XmlSerializer
* <p>Exceptions that may be thrown are: IOException or runtime exception
* (more runtime exceptions can be thrown but are not declared and as such
* have no semantics defined for this interface):
* <ul>
* <li><em>IllegalArgumentException</em> - for almost all methods to signal that
* argument is illegal
* <li><em>IllegalStateException</em> - to signal that call has good arguments but
* is not expected here (violation of contract) and for features/properties
* when requesting setting unimplemented feature/property
* (UnsupportedOperationException would be better but it is not in MIDP)
* </ul>
added this comment to XmlSerializer class doc:
* <p><b>NOTE:</b> writing CDSECT, ENTITY_REF, IGNORABLE_WHITESPACE,
* PROCESSING_INSTRUCTION, COMMENT, and DOCDECL in some implementations
* may not be supported (for example when serializing to WBXML).
* In such case IllegalStateException will be thrown and it is recommened
* to use an optional feature to signal that implementation is not
* supporting this kind of output.
also clarified use of null and emoty string for namespace prefix - main changes:
public void setPrefix (String prefix, String namespace)
* <p><b>NOTE:</b> to set default namespace use as prefix empty string.
*
* @argument prefix must be not null (or IllegalArgumentException is thrown)
* @argument namespace must be not null
public XmlSerializer startTag (String namespace, String name)
* If namespace is null no namespace prefix is printed but just name.
* If namespace is empty string then serialzier will make sure that
* default empty namespace is declared (in XML 1.0 xmlns='').
public XmlSerializer attribute (String namespace, String name, String value)
* If namespace is null or empty string no namespace prefix is printed but just name.
public XmlSerializer endTag (String namespace, String name)
* If namespace is null no namespace prefix is printed but just name.
* If namespace is empty string then serialzier will make sure that
* default empty namespace is declared (in XML 1.0 xmlns='').