gpt4 book ai didi

com.google.gdata.util.XmlBlob类的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 11:29:05 28 4
gpt4 key购买 nike

本文整理了Java中com.google.gdata.util.XmlBlob类的一些代码示例,展示了XmlBlob类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlBlob类的具体详情如下:
包路径:com.google.gdata.util.XmlBlob
类名称:XmlBlob

XmlBlob介绍

[英]Arbitrary self-contained block of XML.
[中]任意自包含的XML块。

代码示例

代码示例来源:origin: com.mulesoft.google/google-api-gdata

throws IOException {
XmlBlob cumulative = new XmlBlob();
Collection<XmlNamespace> namespaces = cumulative.getNamespaces();
 cumulative.setLang(xmlBlob.getLang());
 cumulative.setBase(xmlBlob.getBase());
 namespaces.addAll(xmlBlob.getNamespaces());
 w.write(xmlBlob.getBlob());
cumulative.setBlob(w.toString());
return cumulative;

代码示例来源:origin: com.google.gdata/gdata-java-client

/**
 * 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");
}

代码示例来源:origin: com.google.gdata/gdata-core-1.0

curHandler.xmlBlob.setBlob(blob.toString());
 curHandler.xmlBlob.setFullText(
  curHandler.fullTextIndexWriter.toString());

代码示例来源:origin: sih4sing5hong5/google-sites-liberation

/**
 * 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);
}

代码示例来源:origin: com.mulesoft.google/google-api-gdata

/**
 * 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);
}

代码示例来源:origin: com.google.gdata/gdata-core-1.0

/** Generates an element closing tag containing an XML blob. */
 public static void endElement(XmlWriter w,
                XmlNamespace namespace,
                String elementName,
                XmlBlob xml) throws IOException {

  if (xml != null && xml.getBlob() != null) {
   w.innerXml(xml.getBlob());
  }

  w.endElement(namespace, elementName);
 }
}

代码示例来源:origin: com.google.gdata/gdata-core-1.0

String lang = xml.getLang();
String base = xml.getBase();
List<XmlNamespace> blobNamespaces = xml.getNamespaces();
int additionalNsSize = (additionalNs == null ? 0 : additionalNs.size());

代码示例来源:origin: com.google.gdata/gdata-core-1.0

/** @return the XHTML contents of this text construct */
public XmlBlob getXhtml() {
 if (xhtml == null) {
  xhtml = new XmlBlob();  // init on demand
 }
 return xhtml;
}
/** Specifies the XHTML contents of this text construct. */

代码示例来源:origin: com.mulesoft.google/google-api-gdata

curHandler.xmlBlob.setLang(curHandler.xmlLang);
curHandler.xmlBlob.setBase(curHandler.xmlBase);

代码示例来源:origin: stackoverflow.com

private void setPublicState(VideoEntry entry) throws Exception {
  YouTubeMediaGroup mediaGroup = entry.getMediaGroup();
  if (mediaGroup.isPrivate()) {
    System.out.println("Video is private");
    mediaGroup.setPrivate(false);
  }

  XmlBlob entryBlob = entry.getXmlBlob();
  entryBlob.setBlob("<yt:accessControl action='list' permission='allowed'/>");
  entry.setXmlBlob(entryBlob);
  entry.update();
}

代码示例来源:origin: com.google.gdata/gdata-core-1.0

/** Ensures that the namespace from the QName is stored with the blob. */
private void ensureBlobNamespace(ElementHandler handler, String qName) {
 // Get the namespace.
 NamespaceDecl nsDecl = null;
 String alias = qName.substring(0, Math.max(0, qName.indexOf(":")));
 if (alias.equals("xml")) {
  // "xml:" doesn't need a declaration.
  return;
 }
 Stack<NamespaceDecl> mapping = namespaceMap.get(alias);
 if (mapping != null) {
  nsDecl = mapping.peek();
 }
 // The namespace might be null for a namespace-less element.
 assert alias.length() == 0 || nsDecl != null :
  "Namespace alias '" + alias + "' should be mapped in 'namespaceMap'.";
 // Make sure the namespace is described within the blob if it was
 // originally declared externally to it
 if (nsDecl != null && !nsDecl.inBlob && nsDecl.ns != null &&
   !handler.blobNamespaces.contains(alias)) {
  handler.blobNamespaces.add(alias);
  handler.xmlBlob.getNamespaces().add(
    new XmlNamespace(alias, nsDecl.ns.getUri()));
 }
}

代码示例来源:origin: com.mulesoft.google/google-api-gdata

String lang = xmlBlob.getLang();
if (lang != null) {
 w.simpleElement(Namespaces.rssNs, "language", null, lang);

代码示例来源:origin: sih4sing5hong5/google-sites-liberation

@Override
public Content parseContent(Element element) {
 checkNotNull(element);
 String href = element.getAttribute("href");
 if (href.equals("")) {
  StringBuilder builder = new StringBuilder();
  NodeList nodeList = element.getChildNodes();
  for (int i = 0; i < nodeList.getLength(); i++) {
   Node child = nodeList.item(i);
   if (child.getNodeType() == Node.ELEMENT_NODE) {
    builder.append(xmlElementOf((Element) child));
   } else if (child.getNodeType() == Node.TEXT_NODE) {
    builder.append(child.getNodeValue());
   }
  }
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(builder.toString());
  TextContent content = new TextContent();
  content.setContent(new XhtmlTextConstruct(xmlBlob));
  return content;
 }
 OutOfLineContent content = new OutOfLineContent();
 content.setUri(href);
 return content;
}

代码示例来源:origin: com.mulesoft.google/google-api-gdata

/** Generates an element closing tag containing an XML blob. */
 public static void endElement(XmlWriter w,
                XmlNamespace namespace,
                String elementName,
                XmlBlob xml) throws IOException {

  if (xml != null && xml.getBlob() != null) {
   w.innerXml(xml.getBlob());
  }

  w.endElement(namespace, elementName);
 }
}

代码示例来源:origin: com.google.gdata/gdata-java-client

String lang = xml.getLang();
String base = xml.getBase();
List<XmlNamespace> blobNamespaces = xml.getNamespaces();
int additionalNsSize = (additionalNs == null ? 0 : additionalNs.size());

代码示例来源:origin: com.google.gdata/gdata-java-client

/** @return the XHTML contents of this text construct */
public XmlBlob getXhtml() {
 if (xhtml == null) {
  xhtml = new XmlBlob();  // init on demand
 }
 return xhtml;
}
/** Specifies the XHTML contents of this text construct. */

代码示例来源:origin: com.google.gdata/gdata-java-client

/**
 * 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);
}

代码示例来源:origin: com.google.gdata/gdata-core-1.0

curHandler.xmlBlob.setLang(curHandler.xmlLang);
curHandler.xmlBlob.setBase(curHandler.xmlBase);

代码示例来源:origin: stackoverflow.com

private void setUnlistedState(VideoEntry entry) throws Exception {
  YouTubeMediaGroup mediaGroup = entry.getMediaGroup();
  if (mediaGroup.isPrivate()) {
    System.out.println("Video is private");
    mediaGroup.setPrivate(false);
  }

  XmlBlob xmlBlob = entry.getXmlBlob();
  xmlBlob.setBlob("<yt:accessControl action='list' permission='denied'/>");
  entry.setXmlBlob(xmlBlob);
  entry.update();
}

代码示例来源:origin: com.google.gdata/gdata-java-client

/** Ensures that the namespace from the QName is stored with the blob. */
private void ensureBlobNamespace(ElementHandler handler, String qName) {
 // Get the namespace.
 NamespaceDecl nsDecl = null;
 String alias = qName.substring(0, Math.max(0, qName.indexOf(":")));
 if (alias.equals("xml")) {
  // "xml:" doesn't need a declaration.
  return;
 }
 Stack<NamespaceDecl> mapping = namespaceMap.get(alias);
 if (mapping != null) {
  nsDecl = mapping.peek();
 }
 // The namespace might be null for a namespace-less element.
 assert alias.length() == 0 || nsDecl != null :
  "Namespace alias '" + alias + "' should be mapped in 'namespaceMap'.";
 // Make sure the namespace is described within the blob if it was
 // originally declared externally to it
 if (nsDecl != null && !nsDecl.inBlob && nsDecl.ns != null &&
   !handler.blobNamespaces.contains(alias)) {
  handler.blobNamespaces.add(alias);
  handler.xmlBlob.getNamespaces().add(
    new XmlNamespace(alias, nsDecl.ns.getUri()));
 }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com