--------------------------------------------------------------------
@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://www.cnblogs.com/cuizhf/archive/2011/09/03/2165351.html
