XmlPull v1 API Properties

The property mechanism allows to pass information to XmlPull parser implementation that is not part of API.

Please note: the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Standard properties

Currently there is no standard properties defined.

 


Optional properties

They MAY be supported but are not part of XmlPull API.

Please report suggestions for other useful properties to XmlPull discussion group so they can be added here and made easier to discover.

 

NOTE: to detect if optional property is supported try to call getProperty() and only if it returns non-null value it can be assumed that the property is supported. Implementations are required to return null for all unknown properties names as null is assumed to be default value for all properties.

 

Optional property: LOCATION

This property is identified by http://xmlpull.org/v1/doc/properties.html#location

This property takes String as value. If supported this property can be set after setInput() to indicate location of input (for parser) or output (for serializer). The value of this property will be then used in getPositionDescription() and in exception messages to provide better diagnostic messages.

 

Optional property: XMLDECL VERSION

This property is identified by http://xmlpull.org/v1/doc/properties.html#xmldecl-version

If PROCESS DOCDECL feature is enabled it is REQUIRED property with String otherwise it is optional.

If supported and there was VersionInfo version in XMLDecl then it returns its content if standalone='no' otherwise if there was no standalone declaration or this property is not supported it returns null.

For example if input XML stream contained <?xml  version='1.0' standalone='true'?> then this property will contain "1.0".

 

Optional property: XMLDECL STANDALONE

This feature is identified by http://xmlpull.org/v1/doc/properties.html#xmldecl-standalone

If PROCESS DOCDECL feature is enabled it is REQUIRED property with Boolean otherwise it is optional.

If supported and there was SDDecl standalone in XMLDecl then it returns Boolean(true) if standalone='yes' or Boolean(false) if standalone='no' otherwise if there was no standalone declaration or this property is not supported it returns null.

 

Optional property: XMLDECL CONTENT

This feature is identified by http://xmlpull.org/v1/doc/properties.html#xmldecl-content

If XML ROUNDTRIP feature is enabled it is REQUIRED property with String otherwise it is optional.

If XML ROUNDTRIP feature is true then this property MUST contain everything after '<?xml' and before final '?>' if XML input contained XMLDecl (see section 2.8 Prolog and Document Type Declaration in XML 1.0 ). For example if input XML stream contained <?xml  version='1.0' standalone='true'?> then this property will contain " version='1.0' standalone='true'".

 

Optional property: SERIALIZER INDENTATION

This property is identified by http://xmlpull.org/v1/doc/properties.html#serializer-indentation

OPTIONAL property with String value

If passed string is not empty that it is used to indent output by one level.

If passed string is empty only line separator (depending on LINE SEPARATOR property) will be written for indentation (if any).

Otherwise if string is null no indentation is not done

For example use TAB ("\t") or few spaces ("    ") as string value.

 

Optional property: SERIALIZER LINE SEPARATOR

This property is identified by http://xmlpull.org/v1/doc/properties.html#serializer-line-separator

OPTIONAL property with String value

If indentation is enabled passed string will be used as line separator.

If supported by default this property should be initialized just new line character ("\n").

If value of property is null or it is String of length() == 0 no line separator will be written.

 

 


Aleksander Slominski
Last Modified: $Id: properties.html,v 1.10 2005/08/29 17:30:49 aslom Exp $