Package com.google.gdata.util

Examples of com.google.gdata.util.XmlBlob


   * recognize the same set of extensions.
   */
  public XmlBlob generateCumulativeXmlBlob(ExtensionProfile extProfile)
      throws IOException {

    XmlBlob cumulative = new XmlBlob();
    Collection<XmlNamespace> namespaces = cumulative.getNamespaces();

    StringWriter w = new StringWriter();
    XmlWriter xw = new XmlWriter(w);

    if (xmlBlob != null) {
      cumulative.setLang(xmlBlob.getLang());
      cumulative.setBase(xmlBlob.getBase());
      namespaces.addAll(xmlBlob.getNamespaces());
      w.write(xmlBlob.getBlob());
    }

    if (manifest != null) {
      for (XmlNamespace ns : manifest.getNamespaceDecls()) {
        XmlNamespace newNs = new XmlNamespace(ns.getAlias(), ns.getUri());
        if (!namespaces.contains(newNs)) {
          namespaces.add(newNs);
        }
      }
    }

    for (Extension ext : nonRepeatingExtensionMap.values()) {
      ext.generate(xw, extProfile);
    }

    for (List<Extension> extList : repeatingExtensionMap.values()) {
      xw.startRepeatingElement();
      for (Extension ext : extList) {
        ext.generate(xw, extProfile);
      }
      xw.endRepeatingElement();
    }

    cumulative.setBlob(w.toString());
    return cumulative;
  }
View Full Code Here


  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();
View Full Code Here

      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);
      }
    }
View Full Code Here

   * @return <code>true</code> if claimed can be found
   */
  public boolean isClaimed(VideoEntry videoEntry) {
    // currently the element is only available in the extensions blob as an unrecognized extension
    // TODO - jarekw@ , once the client library supports the extension, this code needs to change
    XmlBlob xmlBlob = videoEntry.getXmlBlob();
    String text = xmlBlob.getFullText();
    return text != null && text.contains(CLAIMED);
  }
View Full Code Here

    public String getContentBlob(BaseContentEntry<?> entry) {
     return ((XhtmlTextConstruct) entry.getTextContent().getContent()).getXhtml().getBlob();
    }

    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));
    }
View Full Code Here

   * recognize the same set of extensions.
   */
  public XmlBlob generateCumulativeXmlBlob(ExtensionProfile extProfile)
      throws IOException {

    XmlBlob cumulative = new XmlBlob();
    Collection<XmlNamespace> namespaces = cumulative.getNamespaces();

    StringWriter w = new StringWriter();
    XmlWriter xw = new XmlWriter(w);

    if (xmlBlob != null) {
      cumulative.setLang(xmlBlob.getLang());
      cumulative.setBase(xmlBlob.getBase());
      namespaces.addAll(xmlBlob.getNamespaces());
      w.write(xmlBlob.getBlob());
    }

    if (manifest != null) {
      for (XmlNamespace ns : manifest.getNamespaceDecls()) {
        XmlNamespace newNs = new XmlNamespace(ns.getAlias(), ns.getUri());
        if (!namespaces.contains(newNs)) {
          namespaces.add(newNs);
        }
      }
    }

    for (Extension ext : nonRepeatingExtensionMap.values()) {
      ext.generate(xw, extProfile);
    }

    for (List<Extension> extList : repeatingExtensionMap.values()) {
      xw.startRepeatingElement();
      for (Extension ext : extList) {
        ext.generate(xw, extProfile);
      }
      xw.endRepeatingElement();
    }

    cumulative.setBlob(w.toString());
    return cumulative;
  }
View Full Code Here

  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();
View Full Code Here

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

     * Class constructor.
     *
     * @throws IOException
     */
    public AtomHandler() throws IOException {
      xhtml = new XmlBlob();
      initializeXmlBlob(xhtml, true, true);
      lang = xmlLang;
    }
View Full Code Here

    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();
View Full Code Here

TOP

Related Classes of com.google.gdata.util.XmlBlob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.