@Deprecatedadmin管理员组文章数量:1641942
public static Advertisement newAdvertisement(MimeMediaType mimetype,
InputStream stream)
throws IOExceptionDeprecated. Please convert your code to construct an XMLDocument using StructuredDocumentFactory and then call newAdvertisement(XMLElement). For example :
XMLDocument xml = (XMLDocument) StructuredDocumentFactory.newStructuredDocument( MimeMediaType.XMLUTF8, is );
or frequently:
XMLDocument xml = (XMLDocument) StructuredDocumentFactory.newStructuredDocument( msgElement );
followed by:
Advertisement adv = AdvertisementFactory.newAdvertisement(xml);
Constructs an instance of Advertisement from the provided InputStream. The content type of the stream is declared via the mimetype parameter.
Parameters:
mimetype - Specifies the mime media type of the stream being read.
stream - input stream used to read data to construct the advertisement
Returns:
The instance of Advertisement
Throws:
IOException - error reading message from input stream
NoSuchElementException - if there is no matching advertisement type for the type of document read in.
--------------------------------------------------------------------
@Deprecated
public static Advertisement newAdvertisement(MimeMediaType mimetype,
Reader source)
throws IOExceptionDeprecated. Please convert your code to construct an XMLDocument using StructuredDocumentFactory and then call newAdvertisement(XMLElement). For example :
XMLDocument xml = (XMLDocument) StructuredDocumentFactory.newStructuredDocument( MimeMediaType.XMLUTF8, reader );
or frequently:
XMLDocument xml = (XMLDocument) StructuredDocumentFactory.newStructuredDocument( msgElement );
followed by:
Advertisement adv = AdvertisementFactory.newAdvertisement(xml);
Reconstructs an instance of Advertisement from the provided Reader. The content type of the reader is declared via the mimetype parameter.
Parameters:
mimetype - Specifies the mime media type of the stream being read.
source - used to read data to construct the advertisement.
Returns:
The instance of Advertisement
Throws:
IOException - error reading message from input stream
NoSuchElementException - if there is no matching advertisement type for the type of document read in.
UnsupportedOperationException - if the specified mime type is not associated with a text oriented document type.
------------------------------------------------------------------------------
@Deprecated
public static Advertisement newAdvertisement(TextElement root)Deprecated. Advertisements must be encoded in XML. This is a legacy static constructor. You should convert your code to use the XMLElement version.
Reconstructs an instance of Advertisement matching the type specified by the root parameter.
Parameters:
root - Specifies a portion of a StructuredDocument which will be converted into an Advertisement.
Returns:
The instance of Advertisement.
Throws:
NoSuchElementException - if there is no advertisement type matching the type of the root node.
-------------- 通常建议使用下面这个方法 -----------------------
上面几个方法在阅读使用老版本的代码时经常遇到,如果使用新版本开发,要转换为使用下面这个方法。
public static Advertisement newAdvertisement(XMLElement root)Reconstructs an instance of Advertisement matching the type specified by the root parameter.Parameters:
root - Specifies a portion of an XMLElement which will be converted into an Advertisement.
Returns:
The instance of Advertisement.
Throws:
NoSuchElementException - if there is no advertisement type matching the type of the root node.
转载于:https://wwwblogs/cuizhf/archive/2011/09/03/2165351.html
本文标签: 几个方法AdvertisementFactory
版权声明:本文标题:关于AdvertisementFactory废弃的几个方法 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1729329721a1196233.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论