共用方式為


ISQLXML.GetSource(Class) Method

Definition

Returns a Source for reading the XML value designated by this SQLXML instance.

[Android.Runtime.Register("getSource", "(Ljava/lang/Class;)Ljavax/xml/transform/Source;", "GetGetSource_Ljava_lang_Class_Handler:Java.Sql.ISQLXMLInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T extends javax.xml.transform.Source" })]
public Java.Lang.Object? GetSource (Java.Lang.Class? sourceClass);
[<Android.Runtime.Register("getSource", "(Ljava/lang/Class;)Ljavax/xml/transform/Source;", "GetGetSource_Ljava_lang_Class_Handler:Java.Sql.ISQLXMLInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T extends javax.xml.transform.Source" })>]
abstract member GetSource : Java.Lang.Class -> Java.Lang.Object

Parameters

sourceClass
Class

The class of the source, or null. If the class is null, a vendor specifc Source implementation will be returned. The following classes are supported at a minimum: <pre> javax.xml.transform.dom.DOMSource - returns a DOMSource javax.xml.transform.sax.SAXSource - returns a SAXSource javax.xml.transform.stax.StAXSource - returns a StAXSource javax.xml.transform.stream.StreamSource - returns a StreamSource </pre>

Returns

a Source for reading the XML value.

Attributes

Remarks

Returns a Source for reading the XML value designated by this SQLXML instance. Sources are used as inputs to XML parsers and XSLT transformers.

Sources for XML parsers will have namespace processing on by default. The systemID of the Source is implementation dependent.

The SQL XML object becomes not readable when this method is called and may also become not writable depending on implementation.

Note that SAX is a callback architecture, so a returned SAXSource should then be set with a content handler that will receive the SAX events from parsing. The content handler will receive callbacks based on the contents of the XML.

SAXSource saxSource = sqlxml.getSource(SAXSource.class);
              XMLReader xmlReader = saxSource.getXMLReader();
              xmlReader.setContentHandler(myHandler);
              xmlReader.parse(saxSource.getInputSource());

Added in 1.6.

Java documentation for java.sql.SQLXML.getSource(java.lang.Class<T>).

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.

Applies to