• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XmlBlob类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.gdata.util.XmlBlob的典型用法代码示例。如果您正苦于以下问题:Java XmlBlob类的具体用法?Java XmlBlob怎么用?Java XmlBlob使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmlBlob类属于com.google.gdata.util包,在下文中一共展示了XmlBlob类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseCumulativeXmlBlob

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Reverses {@link #generateCumulativeXmlBlob(ExtensionProfile)}. This
 * operation overwrites the current contents of this extension point.
 */
public void parseCumulativeXmlBlob(XmlBlob blob,
    ExtensionProfile extProfile, 
    Class<? extends ExtensionPoint> extendedClass)
    throws IOException, ParseException {

  this.xmlBlob = new XmlBlob();
  nonRepeatingExtensionMap.clear();
  repeatingExtensionMap.clear();

  // Prepare a fake XML document from the blob.
  StringWriter sw = new StringWriter();
  XmlWriter w = new XmlWriter(sw);
  XmlBlob.startElement(w, null, "CUMULATIVE_BLOB", blob, null, null);
  XmlBlob.endElement(w, null, "CUMULATIVE_BLOB", blob);

  // Now parse it.
  StringReader sr = new StringReader(sw.toString());
  XmlParser parser = new XmlParser();
  parser.parse(sr, new CumulativeBlobHandler(extProfile, extendedClass), "",
      "CUMULATIVE_BLOB");
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:26,代码来源:ExtensionPoint.java


示例2: generateAtom

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Generates XML in the Atom format.
 *
 * @param   w
 *            output writer
 *
 * @param   elementName
 *            Atom element name
 *
 * @throws  IOException
 */
@Override
public void generateAtom(XmlWriter w,
                         String elementName) throws IOException {

  ArrayList<XmlWriter.Attribute> attrs =
    new ArrayList<XmlWriter.Attribute>(2);

  attrs.add(new XmlWriter.Attribute("type", "xhtml"));

  if (lang != null) {
    attrs.add(new XmlWriter.Attribute("xml:lang", lang));
  }

  XmlBlob.startElement(w, Namespaces.atomNs, elementName, xhtml, attrs, null);
  XmlBlob.endElement(w, Namespaces.atomNs, elementName, xhtml);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:28,代码来源:XhtmlTextConstruct.java


示例3: AtomHandler

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Class constructor specifying attributes.
 *
 * @throws   IOException
 */
AtomHandler(ExtensionProfile extProfile, Attributes attrs)
    throws IOException {

  this.extProfile = extProfile;
  String typeAttr = attrs.getValue("", "type");

  if ("application/atom+xml;type=feed".equals(typeAttr)) {
    ext = new Feed();
    type = Content.Type.OTHER_XML;
  } else if ("application/atom+xml;type=entry".equals(typeAttr)) {
    type = Content.Type.OTHER_XML;
    ext = new Entry();
  } else if (typeAttr.endsWith("+xml") || typeAttr.endsWith("/xml")) {
    type = Content.Type.OTHER_XML;
    xml = new XmlBlob();
    initializeXmlBlob(xml, true, true);
  } else if (typeAttr.startsWith("text/")) {
    type = Content.Type.OTHER_TEXT;
  } else {
    type = Content.Type.OTHER_BINARY;
  }
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:28,代码来源:OtherContent.java


示例4: processEndElement

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
@Override
public void processEndElement() throws ParseException {

  if (name == null) {
    throw new ParseException(
        CoreErrorDomain.ERR.nameRequired);
  }

  XmlBlob xmlBlob = getXmlBlob();

  if (val != null && xmlBlob.getBlob() != null) {
    throw new ParseException(
        CoreErrorDomain.ERR.valueXmlMutuallyExclusive);
  }

  if (val == null && xmlBlob.getBlob() == null) {
    throw new ParseException(
        CoreErrorDomain.ERR.valueOrXmlRequired);
  }
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:21,代码来源:ExtendedProperty.java


示例5: create

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Creates a text construct.
 * This method is convenient for some service implementations.
 * Note that XHTML is treated somewhat differently from text and HTML.
 *
 * @param   type
 *            the type of the new text construct (TEXT, HTML, or XHTML)
 *
 * @param   textOrHtml
 *            the contents to put in this text construct, if the type is
 *            TEXT or HTML.
 *            If type is XHTML, set this parameter to {@code null}.
 *
 * @param   xhtml
 *            the contents to put in this text construct, if the type is
 *            XHTML.
 *            If type is TEXT or HTML, set this parameter to {@code null}.
 *
 * @return  a {@link TextConstruct}, or {@code null} if invalid type.
 */
public static TextConstruct create(int type,
                                   String textOrHtml,
                                   XmlBlob xhtml) {

  switch (type) {

  case Type.TEXT:
    PlainTextConstruct ptc = new PlainTextConstruct(textOrHtml);
    return ptc;

  case Type.HTML:
    HtmlTextConstruct htc = new HtmlTextConstruct(textOrHtml);
    return htc;

  case Type.XHTML:
    XhtmlTextConstruct xtc = new XhtmlTextConstruct(xhtml);
    return xtc;

  default:
    assert false : "Invalid type: " + String.valueOf(type);
    return null;
  }
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:44,代码来源:TextConstruct.java


示例6: uploadVideo

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Metóda uploadVideo slúži na odovzdanie multimediálneho video a súboru na server YouTube. Taktiež priradzuje k videu aj  detaily o videosúbore a detaily o serveri s kadiaľ je odovzdávaný.
 * @param file - video multimediálny súbor, zapísaný v štruktúre FileImpl
 * @param user - používateľ (majiteľ), ktorý daný video multimediálnych súbor odovzdáva z potálu
 * @param name - názov vytváranej trasy ku ktorej daný súbor patrí
 * @param ID - poradove číslo multimediálneho súboru v danej trase
 * @return Navratová hodnota je ID daného odovzdaneho multimedialneho súboru, pomocou ktoreho sa ten da vyvolať na serveri YouTube
 * @throws YouTubeAgentException je vyhodená ppri problemoch s odovzdaním video multimediálneho súboru
 */
public String uploadVideo (FileImpl file, String user, String name, String ID) throws YouTubeAgentException{
    try {
        VideoEntry newEntry = new VideoEntry();
        
       YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
            mg.setTitle(new MediaTitle());
            mg.getTitle().setPlainTextContent(user + "=" + name + "=" + ID);
            mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos"));
            mg.setKeywords(new MediaKeywords());
            mg.getKeywords().addKeyword("GPSWebApp");
            mg.setDescription(new MediaDescription());
            mg.getDescription().setPlainTextContent("This video has been uploaded from GPSWebApp server, and it is property of GPSWebApp server.");
            //mg.setPrivate(true);
            //mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag"));
            //mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag"));
        
        MediaFileSource ms = new MediaFileSource(new File(file.getPath()), "video/quicktime");
        newEntry.setMediaSource(ms);
        String uploadUrl = "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";
  //      
        XmlBlob xmlBlob = new XmlBlob(); 
        xmlBlob.setBlob("<yt:accessControl action='list' permission='denied'/>"); 
        newEntry.setXmlBlob(xmlBlob); 
  //      
        VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry);
        System.out.println("Video has been uploaded to YouTube: " + createdEntry.getMediaGroup().getPlayer().getUrl());
        FileLogger.getInstance().createNewLog("Successfully uploaded video to YouTube with URL " + createdEntry.getMediaGroup().getPlayer().getUrl() + " .");
        
        
        return createdEntry.getMediaGroup().getVideoId();
    } catch (Exception ex) {
        ex.printStackTrace();
        System.out.println("ERROR: Cannot upload video to YouTube server!!!");
        FileLogger.getInstance().createNewLog("ERROR: Cannot upload video to YouTube with ID !!!");
        throw new YouTubeAgentException();
    }
}
 
开发者ID:lp190zn,项目名称:gTraxxx,代码行数:47,代码来源:YouTubeAgent.java


示例7: generateStartElement

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Generates XML corresponding to the type implementing {@link
 * ExtensionPoint}. The reason this routine is necessary is that the embedded
 * XML blob may contain namespace declarations.
 */
protected void generateStartElement(XmlWriter w,
    XmlNamespace namespace, String elementName,
    Collection<XmlWriter.Attribute> additionalAttrs,
    Collection<XmlNamespace> additionalNs) throws IOException {

  XmlBlob.startElement(w, namespace, elementName, xmlBlob, additionalAttrs,
      additionalNs);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:14,代码来源:ExtensionPoint.java


示例8: setXml

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/** Specifies the XML contents. */
public void setXml(XmlBlob v) {
  ext = null;
  xml = v;
  text = null;
  bytes = null;
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:8,代码来源:OtherContent.java


示例9: generateAtom

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Generates XML in the Atom format.
 *
 * @param   w
 *            output writer
 * @param   extProfile
 *            Extension Profile for nested extensions
 *
 * @throws  IOException
 */
@Override
public void generateAtom(XmlWriter w, ExtensionProfile extProfile)
    throws IOException {

  ArrayList<XmlWriter.Attribute> attrs =
    new ArrayList<XmlWriter.Attribute>(2);

  if (mimeType != null) {
    attrs.add(new XmlWriter.Attribute("type", mimeType.getMediaType()));
  }

  if (ext != null) {
    w.startElement(Namespaces.atomNs, "content", attrs, null);
    ext.generate(w, extProfile);
    w.endElement(Namespaces.atomNs, "content");
  } else if (xml != null) {
    XmlBlob.startElement(w, Namespaces.atomNs, "content", xml, attrs, null);
    XmlBlob.endElement(w, Namespaces.atomNs, "content", xml);
  } else {
    
    String value;
    if (text != null) {
      value = text;
      if (lang != null) {
        attrs.add(new XmlWriter.Attribute("xml:lang", lang));
      }
    } else if (bytes != null) {
      value = Base64.encode(bytes);
      if (lang != null) {
        attrs.add(new XmlWriter.Attribute("xml:lang", lang));
      }
    } else {
      value = null;
    }

    w.simpleElement(Namespaces.atomNs, "content", attrs, value);
  }
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:49,代码来源:OtherContent.java


示例10: getKml

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * @return the content of the feature in KML format as an XmlBlob.
 */
public XmlBlob getKml() {
  Content content = getContent();
  if (null == content || !(content instanceof OtherContent)) {
    return null;
  }
  return ((OtherContent) getContent()).getXml();
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:11,代码来源:FeatureEntry.java


示例11: isAlbumOfType

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
private static boolean isAlbumOfType( String type, AlbumEntry album ){
    String albumType = String.format( ALBUM_TYPE_PATTERN, type);

    XmlBlob blob = album.getXmlBlob();

    if( blob != null ) {
        String x = blob.getBlob();

        if( x != null && x.equals( albumType ) ) {
            return true;
        }
    }
    return false;
}
 
开发者ID:Dotosoft,项目名称:dotoquiz-tools,代码行数:15,代码来源:PicasawebClient.java


示例12: setContent

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Sets the content of the given entry to the given String.
 */
public static void setContent(BaseContentEntry<?> entry, String content) {
  XmlBlob blob = new XmlBlob();
  blob.setBlob(content);
  TextConstruct textConstruct = new XhtmlTextConstruct(blob);
  entry.setContent(textConstruct);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:10,代码来源:EntryUtils.java


示例13: testOnePage

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
@Test
public void testOnePage() throws IOException {
  final BasePageEntry<?> page = new WebPageEntry();
  page.setId("1");
  page.setTitle(new PlainTextConstruct("Page 1"));
  page.setPageName(new PageName("Page-1"));
  XmlBlob blob = new XmlBlob();
  blob.setBlob("content");
  page.setContent(new XhtmlTextConstruct(blob));
  entries.add(page);
  final Appendable out = context.mock(Appendable.class);
  
  context.checking(new Expectations() {{
    allowing (entryStoreFactory).newEntryStore(); 
        will(returnValue(entryStore));
    allowing (feedProvider).getEntries(feedUrl, sitesService);
        will(returnValue(entries));
    allowing (entryStore).getEntry("1"); will(returnValue(page));
    allowing (entryStore).getParent("1"); will(returnValue(null));
    allowing (progressListener).setStatus(with(any(String.class)));
    allowing (progressListener).setProgress(with(any(Double.class)));
    oneOf (entryStore).addEntry(page);
    oneOf (appendableFactory).getAppendable(
        new File("path/Page-1/index.html"));
        will(returnValue(out));
    oneOf (linkConverter).convertLinks(page, entryStore, 
        new URL("https://host/a/domain/webspace"), false);
    oneOf (pageExporter).exportPage(page, entryStore, out, true);
    oneOf (revisionsExporter).exportRevisions(page, entryStore, 
        new File("path/Page-1"), sitesService, 
        new URL("https://host/a/domain/webspace"));
  }});
  
  export(true);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:36,代码来源:SiteExporterImplTest.java


示例14: setContentFromXmlString

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Utility method that given XML source for a feed entry, populates the content of this entry.
 * 
 * @param xmlText XML source for the associated feed entry.
 * @throws FeedServerClientException if any conversion errors occur parsing the XML.
 */
public void setContentFromXmlString(String xmlText) throws FeedServerClientException {
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(xmlText);
  setXmlBlob(xmlBlob);
  setContent(contentUtil.createXmlContent(xmlText));
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:13,代码来源:FeedServerEntry.java


示例15: createXmlContent

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Converts XML text to a GData {@code  OtherContent} description of the
 * payload
 * @param xmlSource XML source of the payload
 * @return A GData {@code OtherContent} representation of the payload
 */
public OtherContent createXmlContent(String xmlSource) {
  OtherContent xmlContent = new OtherContent();
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(xmlSource);
  xmlContent.setXml(xmlBlob);
  xmlContent.setMimeType(APPLICATION_XML);
  return xmlContent;
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:15,代码来源:ContentUtil.java


示例16: FeedServerClientTestUtil

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Populates bean with static info to match XML. The XML and the bean should
 * be interchangable using utilities provided by FeedServerClient.
 */
public FeedServerClientTestUtil() {
  // Setup sample bean.
  sampleVehicleBean = new VehicleBean();
  sampleVehicleBean.setName(NAME);
  sampleVehicleBean.setOwner(OWNER);
  sampleVehicleBean.setPrice(PRICE);
  sampleVehicleBean.setPropertyName(PROPERTY_NAMES);
  sampleVehicleBean.setPropertyValue(PROPERTY_VALUES);

  // Setup sample map.
  sampleVehicleMap = new HashMap<String, Object>();
  sampleVehicleMap.put("name", NAME);
  sampleVehicleMap.put("owner", OWNER);
  sampleVehicleMap.put("price", PRICE);
  sampleVehicleMap.put("propertyName", PROPERTY_NAMES);
  sampleVehicleMap.put("propertyValue", PROPERTY_VALUES);

  // Create populated gdata entry.
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(ENTRY_XML);
  OtherContent xmlContent = new OtherContent();
  xmlContent.setXml(xmlBlob);
  xmlContent.setXml(xmlBlob);
  xmlContent.setMimeType(ContentUtil.APPLICATION_XML);
  vehicleEntry = new FeedServerEntry();
  vehicleEntry.setXmlBlob(xmlBlob);
  vehicleEntry.setContent(xmlContent);
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:33,代码来源:FeedServerClientTestUtil.java


示例17: setContentBlob

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
private void setContentBlob(BaseContentEntry<?> entry) {
  XmlBlob xml = new XmlBlob();
  xml.setBlob(String.format(
      "content for %s", entry.getCategories().iterator().next().getLabel()));
  entry.setContent(new XhtmlTextConstruct(xml));
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:7,代码来源:SitesHelper.java


示例18: initializeXmlBlob

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * If a derived class wishes to retrieve all unrecognized XML in a blob,
 * it calls this method. It must be called in the constructor, in
 * the parent element handler, or in {@link #processAttribute}.
 *
 * @param   xmlBlob
 *            Supplies the XML blob that stores the resulting XML.
 *
 * @param   mixedContent
 *            Specifies that the handler accepts mixed content XML.
 *
 * @param   fullTextIndex
 *            Flag indicating whether unrecognized XML should be processed
 *            for full-text indexing. If set, the resulting string ready for
 *            indexing is stored in {@link XmlBlob#fullText}.
 */
public void initializeXmlBlob(XmlBlob xmlBlob,
                              boolean mixedContent,
                              boolean fullTextIndex) throws IOException {

  assert okToInitializeXmlBlob;

  this.xmlBlob = xmlBlob;
  this.mixedContent = mixedContent;
  this.innerXmlStringWriter = new StringWriter();
  this.innerXml = new XmlWriter(innerXmlStringWriter);
  this.fullTextIndex = fullTextIndex;
  if (fullTextIndex) {
    this.fullTextIndexWriter = new StringWriter();
  }
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:32,代码来源:XmlParser.java


示例19: getXmlBlob

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/**
 * Retrieves the XML blob containing arbitrary (unrecognized) extensions.
 */
public XmlBlob getXmlBlob() {
  return xmlBlob;
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:7,代码来源:ExtensionPoint.java


示例20: setXmlBlob

import com.google.gdata.util.XmlBlob; //导入依赖的package包/类
/** Sets the XML blob containing arbitrary (unrecognized) extensions. */
public void setXmlBlob(XmlBlob xmlBlob) {
  this.xmlBlob = xmlBlob;
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:5,代码来源:ExtensionPoint.java



注:本文中的com.google.gdata.util.XmlBlob类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConnectorTableLayout类代码示例发布时间:2022-05-23
下一篇:
Java PopupFeatures类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap