Sdílet prostřednictvím


XMLReaderFactory.CreateXMLReader Method

Definition

Overloads

CreateXMLReader()

Attempt to create an XMLReader from system defaults.

CreateXMLReader(String)

Attempt to create an XML reader from a class name.

CreateXMLReader()

Attempt to create an XMLReader from system defaults.

[Android.Runtime.Register("createXMLReader", "()Lorg/xml/sax/XMLReader;", "")]
public static Org.Xml.Sax.IXMLReader? CreateXMLReader ();
[<Android.Runtime.Register("createXMLReader", "()Lorg/xml/sax/XMLReader;", "")>]
static member CreateXMLReader : unit -> Org.Xml.Sax.IXMLReader

Returns

A new XMLReader.

Attributes

Exceptions

If no default XMLReader class can be identified and instantiated.

Remarks

Attempt to create an XMLReader from system defaults. In environments which can support it, the name of the XMLReader class is determined by trying each these options in order, and using the first one which succeeds:</p> <ul>

<li>If the system property org.xml.sax.driver has a value, that is used as an XMLReader class name. </li>

<li>The JAR "Services API" is used to look for a class name in the <em>META-INF/services/org.xml.sax.driver</em> file in jarfiles available to the runtime.</li>

<li> SAX parser distributions are strongly encouraged to provide a default XMLReader class name that will take effect only when previous options (on this list) are not successful.</li>

<li>Finally, if ParserFactory#makeParser() can return a system default SAX1 parser, that parser is wrapped in a ParserAdapter. (This is a migration aid for SAX1 environments, where the org.xml.sax.parser system property will often be usable.) </li>

</ul>

In environments such as small embedded systems, which can not support that flexibility, other mechanisms to determine the default may be used.

Note that many Java environments allow system properties to be initialized on a command line. This means that <em>in most cases</em> setting a good value for that property ensures that calls to this method will succeed, except when security policies intervene. This will also maximize application portability to older SAX environments, with less robust implementations of this method.

Java documentation for org.xml.sax.helpers.XMLReaderFactory.createXMLReader().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

CreateXMLReader(String)

Attempt to create an XML reader from a class name.

[Android.Runtime.Register("createXMLReader", "(Ljava/lang/String;)Lorg/xml/sax/XMLReader;", "")]
public static Org.Xml.Sax.IXMLReader? CreateXMLReader (string? className);
[<Android.Runtime.Register("createXMLReader", "(Ljava/lang/String;)Lorg/xml/sax/XMLReader;", "")>]
static member CreateXMLReader : string -> Org.Xml.Sax.IXMLReader

Parameters

className
String

the name of the class that should be instantiated.

        &lt;p&gt;Note that this method will not be usable in environments where
        the caller (perhaps an applet) is not permitted to load classes
        dynamically.&lt;/p&gt;

Returns

A new XML reader.

Attributes

Exceptions

If the class cannot be loaded, instantiated, and cast to XMLReader.

Remarks

Attempt to create an XML reader from a class name.

Given a class name, this method attempts to load and instantiate the class as an XML reader.

Java documentation for org.xml.sax.helpers.XMLReaderFactory.createXMLReader(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to