# XmlPullParserFactory

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Constants](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#constants)\|[Fields](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#lfields)\|[Protected Ctors](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#proctors)\|[Methods](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#inhmethods)  

# XmlPullParserFactory

`
public


class
XmlPullParserFactory
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | org.xmlpull.v1.XmlPullParserFactory |

<br />

*** ** * ** ***

This class is used to create implementations of XML Pull Parser defined in XMPULL V1 API.  
**See also:**

- [XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser)

## Summary

|                                                                                     ### Constants                                                                                     ||
|--------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | [PROPERTY_NAME](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#PROPERTY_NAME) <br /> |

|                                                                                                                                                                                                   ### Fields                                                                                                                                                                                                    ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` protected `[String](https://developer.android.com/reference/java/lang/String)                                                                                                                                                   | [classNamesLocation](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#classNamesLocation) Unused, but we have to keep it because it's public API. |
| ` protected `[HashMap](https://developer.android.com/reference/java/util/HashMap)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[Boolean](https://developer.android.com/reference/java/lang/Boolean)`>` | [features](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#features) <br />                                                                      |
| ` protected `[ArrayList](https://developer.android.com/reference/java/util/ArrayList)`<E>`                                                                                                                                        | [parserClasses](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#parserClasses) <br />                                                            |
| ` protected `[ArrayList](https://developer.android.com/reference/java/util/ArrayList)`<E>`                                                                                                                                        | [serializerClasses](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#serializerClasses) <br />                                                    |

|                                                                                      ### Protected constructors                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[XmlPullParserFactory](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#XmlPullParserFactory())`() ` Protected constructor to be called by factory implementations. |

|                                                                                                                                                                                                                                                                                                                                       ### Public methods                                                                                                                                                                                                                                                                                                                                       ||
|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean`                                                                                                    | ` `[getFeature](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#getFeature(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` name) ` Return the current value of the feature with given name.                                                                                                                                                                                                                                                                                                                |
| ` boolean`                                                                                                    | ` `[isNamespaceAware](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#isNamespaceAware())`() ` Indicates whether or not the factory is configured to produce parsers which are namespace aware (it simply set feature XmlPullParser.FEATURE_PROCESS_NAMESPACES to true or false).                                                                                                                                                                                                                                                                   |
| ` boolean`                                                                                                    | ` `[isValidating](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#isValidating())`() ` Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.                                                                                                                                                                                                                                                                                                                                           |
| ` static `[XmlPullParserFactory](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory) | ` `[newInstance](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#newInstance())`() ` Creates a new instance of a PullParserFactory that can be used to create XML pull parsers.                                                                                                                                                                                                                                                                                                                                                                     |
| ` static `[XmlPullParserFactory](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory) | ` `[newInstance](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#newInstance(java.lang.String,%20java.lang.Class))`(`[String](https://developer.android.com/reference/java/lang/String)` unused, `[Class](https://developer.android.com/reference/java/lang/Class)`<T> unused2) ` Creates a factory that always returns instances of Android's built-in[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser)and[XmlSerializer](https://developer.android.com/reference/org/xmlpull/v1/XmlSerializer)implementation. |
| ` `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser)                      | ` `[newPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#newPullParser())`() ` Creates a new instance of a XML Pull Parser using the currently configured factory features.                                                                                                                                                                                                                                                                                                                                                               |
| ` `[XmlSerializer](https://developer.android.com/reference/org/xmlpull/v1/XmlSerializer)                      | ` `[newSerializer](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#newSerializer())`() ` Creates a new instance of a XML Serializer.                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`                                                                                                       | ` `[setFeature](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#setFeature(java.lang.String,%20boolean))`(`[String](https://developer.android.com/reference/java/lang/String)` name, boolean state) ` Set the features to be set when XML Pull Parser is created by this factory.                                                                                                                                                                                                                                                                   |
| ` void`                                                                                                       | ` `[setNamespaceAware](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#setNamespaceAware(boolean))`(boolean awareness) ` Specifies that the parser produced by this factory will provide support for XML namespaces.                                                                                                                                                                                                                                                                                                                                |
| ` void`                                                                                                       | ` `[setValidating](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory#setValidating(boolean))`(boolean validating) ` Specifies that the parser produced by this factory will be validating (it simply set feature XmlPullParser.FEATURE_VALIDATION to true or false).                                                                                                                                                                                                                                                                                  |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### PROPERTY_NAME

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String PROPERTY_NAME
```

<br />

<br />

Constant Value: "org.xmlpull.v1.XmlPullParserFactory"

## Fields

### classNamesLocation

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected String classNamesLocation
```

Unused, but we have to keep it because it's public API.

<br />

### features

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected HashMap<String, Boolean> features
```

<br />

<br />

### parserClasses

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected ArrayList<E> parserClasses
```

<br />

<br />

### serializerClasses

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected ArrayList<E> serializerClasses
```

<br />

<br />

## Protected constructors

### XmlPullParserFactory

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected XmlPullParserFactory ()
```

Protected constructor to be called by factory implementations.

<br />

## Public methods

### getFeature

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean getFeature (String name)
```

Return the current value of the feature with given name.

**NOTE:**factory features are not used for XML Serializer.

<br />

|                          Parameters                           ||
|--------|-------------------------------------------------------|
| `name` | `String`: The name of feature to be retrieved. <br /> |

|                                          Returns                                          ||
|-----------|--------------------------------------------------------------------------------|
| `boolean` | The value of named feature. Unknown features arealwaysreturned as false <br /> |

### isNamespaceAware

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isNamespaceAware ()
```

Indicates whether or not the factory is configured to produce parsers which are namespace aware (it simply set feature XmlPullParser.FEATURE_PROCESS_NAMESPACES to true or false).

<br />

|                                                      Returns                                                       ||
|-----------|---------------------------------------------------------------------------------------------------------|
| `boolean` | true if the factory is configured to produce parsers which are namespace aware; false otherwise. <br /> |

### isValidating

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isValidating ()
```

Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.

<br />

|                                                               Returns                                                                ||
|-----------|---------------------------------------------------------------------------------------------------------------------------|
| `boolean` | true if the factory is configured to produce parsers which validate the XML content during parse; false otherwise. <br /> |

### newInstance

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static XmlPullParserFactory newInstance ()
```

Creates a new instance of a PullParserFactory that can be used to create XML pull parsers. The factory will always return instances of Android's built-in[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser)and[XmlSerializer](https://developer.android.com/reference/org/xmlpull/v1/XmlSerializer).

<br />

|                                                   Returns                                                   ||
|-----------------------------------------------------------------------------------------------------|--------|
| [XmlPullParserFactory](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory) | <br /> |

|                                                   Throws                                                   ||
|---------------------------------------------------------------------------------------------------------|---|
| [XmlPullParserException](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException) |   |

### newInstance

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static XmlPullParserFactory newInstance (String unused, 
                Class<T> unused2)
```

Creates a factory that always returns instances of Android's built-in[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser)and[XmlSerializer](https://developer.android.com/reference/org/xmlpull/v1/XmlSerializer)implementation. This**does not**support factories capable of creating arbitrary parser and serializer implementations. Both arguments to this method are unused.

<br />

|         Parameters         ||
|-----------|-----------------|
| `unused`  | `String` <br /> |
| `unused2` | `Class` <br />  |

|                                                   Returns                                                   ||
|-----------------------------------------------------------------------------------------------------|--------|
| [XmlPullParserFactory](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserFactory) | <br /> |

|                                                   Throws                                                   ||
|---------------------------------------------------------------------------------------------------------|---|
| [XmlPullParserException](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException) |   |

### newPullParser

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public XmlPullParser newPullParser ()
```

Creates a new instance of a XML Pull Parser using the currently configured factory features.

<br />

|                                                              Returns                                                               ||
|---------------------------------------------------------------------------------------|---------------------------------------------|
| [XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser) | A new instance of a XML Pull Parser. <br /> |

|                                                   Throws                                                   ||
|---------------------------------------------------------------------------------------------------------|---|
| [XmlPullParserException](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException) |   |

### newSerializer

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public XmlSerializer newSerializer ()
```

Creates a new instance of a XML Serializer.

**NOTE:**factory features are not used for XML Serializer.

<br />

|                                                              Returns                                                              ||
|---------------------------------------------------------------------------------------|--------------------------------------------|
| [XmlSerializer](https://developer.android.com/reference/org/xmlpull/v1/XmlSerializer) | A new instance of a XML Serializer. <br /> |

|                                                                                       Throws                                                                                        ||
|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| [XmlPullParserException](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException) | if a parser cannot be created which satisfies the requested configuration. |

### setFeature

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setFeature (String name, 
                boolean state)
```

Set the features to be set when XML Pull Parser is created by this factory.

**NOTE:**factory features are not used for XML Serializer.

<br />

|                                    Parameters                                    ||
|---------|-------------------------------------------------------------------------|
| `name`  | `String`: string with URI identifying feature <br />                    |
| `state` | `boolean`: if true feature will be set; if false will be ignored <br /> |

|                                                   Throws                                                   ||
|---------------------------------------------------------------------------------------------------------|---|
| [XmlPullParserException](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException) |   |

### setNamespaceAware

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setNamespaceAware (boolean awareness)
```

Specifies that the parser produced by this factory will provide support for XML namespaces. By default the value of this is set to false.

<br />

|                                                            Parameters                                                             ||
|-------------|----------------------------------------------------------------------------------------------------------------------|
| `awareness` | `boolean`: true if the parser produced by this code will provide support for XML namespaces; false otherwise. <br /> |

### setValidating

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setValidating (boolean validating)
```

Specifies that the parser produced by this factory will be validating (it simply set feature XmlPullParser.FEATURE_VALIDATION to true or false). By default the value of this is set to false.

<br />

|                                            Parameters                                             ||
|--------------|-------------------------------------------------------------------------------------|
| `validating` | `boolean`: - if true the parsers created by this factory must be validating. <br /> |