|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.xml.transform.sax.SAXSource
javax.xml.bind.util.JAXBSource
public class JAXBSource
編組 JAXB 產生的物件的 JAXP Source 實作。
此實用工具類別對於將 JAXB 與其他 Java/XML 技術組合很有用。
以下範例顯示了如何使用 JAXB 編組將由 XSLT 轉換的文檔。
MyObject o = // get JAXB content tree
// jaxbContext is a JAXBContext object from which 'o' is created.
JAXBSource source = new JAXBSource( jaxbContext, o );
// set up XSLT transformation
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer(new StreamSource("test.xsl"));
// run transformation
t.transform(source,new StreamResult(System.out));
SAXSource 派生於 JAXBSource 是一個實作細節。因此,通常應用程序最好不要存取 SAXSource 上定義的方法。尤其不能調用 setXMLReader 和 setInputSource 方法。通過 getXMLReader 方法獲取的 XMLReader 物件只能用於解析 getInputSource 方法返回的 InputSource 物件。
同樣,通過 getInputSource 方法獲得的 InputSource 物件只能由 getXMLReader 返回的 XMLReader 物件來解析。
| 欄位摘要 |
|---|
| 從類別 javax.xml.transform.sax.SAXSource 繼承的欄位 |
|---|
FEATURE |
| 建構子摘要 | |
|---|---|
JAXBSource(JAXBContext context,
Object contentObject)
針對給定的內容物件創建一個新 Source。 |
|
JAXBSource(Marshaller marshaller,
Object contentObject)
針對給定的內容物件創建一個新 Source。 |
|
| 方法摘要 |
|---|
| 從類別 javax.xml.transform.sax.SAXSource 繼承的方法 |
|---|
getInputSource, getSystemId, getXMLReader, setInputSource, setSystemId, setXMLReader, sourceToInputSource |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 建構子詳細資訊 |
|---|
public JAXBSource(JAXBContext context,
Object contentObject)
throws JAXBException
Source。
context - 用於創建 contentObject 的 JAXBContext。此上下文用於創建 marshaller 的新實例,不得為 null。contentObject - JAXB 產生的類別的實例,將用作 Source(通過將它編組到 XML)。它不得為 null。
JAXBException - 如果創建 JAXBSource 時遇到錯誤,或者任何一個參數為 null。
public JAXBSource(Marshaller marshaller,
Object contentObject)
throws JAXBException
Source。
marshaller - 用於將 contentObject 編組到 XML 的 marshaller 實例。此實例必須根據用來建構 contentObject 的 JAXBContext 創建,不得為 null。contentObject - JAXB 產生的類別的實例,將用作 Source(通過將它編組到 XML)。它不得為 null。
JAXBException - 如果創建 JAXBSource 時遇到錯誤,或者任何一個參數為 null。
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。