gpt4 book ai didi

com.google.gdata.util.common.xml.XmlWriter.characters()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 13:02:40 26 4
gpt4 key购买 nike

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

XmlWriter.characters介绍

[英]Emits character data subject to XML escaping.
[中]发出受XML转义约束的字符数据。

代码示例

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

/**
 * Emits character data subject to XML escaping.
 *
 * @param s string to emit. Can be {@code null}.
 * @throws IOException thrown by the underlying writer.
 */
public void characters(String s) throws IOException {
 characters(s, false);
}

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

/**
 * Emits character data subject to XML escaping.
 *
 * @param s string to emit. Can be {@code null}.
 * @throws IOException thrown by the underlying writer.
 */
public void characters(String s) throws IOException {
 characters(s, false);
}

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

/** SAX callback. */
@Override
public void characters(char[] text, int start, int len) throws SAXException {
 if (curHandler != null) {
  if (unrecognizedElements == 0) {
   if (curHandler.buffer == null) {
    curHandler.buffer = new StringBuilder();
   }
   curHandler.buffer.append(text, start, len);
  }
  if (curHandler.innerXml != null &&
    (curHandler.mixedContent || unrecognizedElements > 0)) {
   if (curHandler.fullTextIndex) {
    curHandler.fullTextIndexWriter.write(text, start, len);
    curHandler.fullTextIndexWriter.write("\n");
   }
   try {
    curHandler.innerXml.characters(new String(text, start, len));
   } catch (IOException e) {
    throw new SAXException(e);
   }
  }
 }
}

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

/** SAX callback. */
@Override
public void characters(char[] text, int start, int len) throws SAXException {
 if (curHandler != null) {
  if (unrecognizedElements == 0) {
   if (curHandler.buffer == null) {
    curHandler.buffer = new StringBuffer();
   }
   curHandler.buffer.append(text, start, len);
  }
  if (curHandler.innerXml != null &&
    (curHandler.mixedContent || unrecognizedElements > 0)) {
   if (curHandler.fullTextIndex) {
    curHandler.fullTextIndexWriter.write(text, start, len);
    curHandler.fullTextIndexWriter.write("\n");
   }
   try {
    curHandler.innerXml.characters(new String(text, start, len));
   } catch (IOException e) {
    throw new SAXException(e);
   }
  }
 }
}

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

/** SAX callback. */
@Override
public void characters(char[] text, int start, int len) throws SAXException {
 if (curHandler != null) {
  if (unrecognizedElements == 0) {
   if (curHandler.buffer == null) {
    curHandler.buffer = new StringBuffer();
   }
   curHandler.buffer.append(text, start, len);
  }
  if (curHandler.innerXml != null &&
    (curHandler.mixedContent || unrecognizedElements > 0)) {
   if (curHandler.fullTextIndex) {
    curHandler.fullTextIndexWriter.write(text, start, len);
    curHandler.fullTextIndexWriter.write("\n");
   }
   try {
    curHandler.innerXml.characters(new String(text, start, len));
   } catch (IOException e) {
    throw new SAXException(e);
   }
  }
 }
}

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

/** SAX callback. */
@Override
public void characters(char[] text, int start, int len) throws SAXException {
 if (curHandler != null) {
  if (unrecognizedElements == 0) {
   if (curHandler.buffer == null) {
    curHandler.buffer = new StringBuilder();
   }
   curHandler.buffer.append(text, start, len);
  }
  if (curHandler.innerXml != null &&
    (curHandler.mixedContent || unrecognizedElements > 0)) {
   if (curHandler.fullTextIndex) {
    curHandler.fullTextIndexWriter.write(text, start, len);
    curHandler.fullTextIndexWriter.write("\n");
   }
   try {
    curHandler.innerXml.characters(new String(text, start, len));
   } catch (IOException e) {
    throw new SAXException(e);
   }
  }
 }
}

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

/** SAX callback. */
@Override
public void characters(char[] text, int start, int len) throws SAXException {
 if (curHandler != null) {
  if (unrecognizedElements == 0) {
   if (curHandler.buffer == null) {
    curHandler.buffer = new StringBuffer();
   }
   curHandler.buffer.append(text, start, len);
  }
  if (curHandler.innerXml != null &&
    (curHandler.mixedContent || unrecognizedElements > 0)) {
   if (curHandler.fullTextIndex) {
    curHandler.fullTextIndexWriter.write(text, start, len);
    curHandler.fullTextIndexWriter.write("\n");
   }
   try {
    curHandler.innerXml.characters(new String(text, start, len));
   } catch (IOException e) {
    throw new SAXException(e);
   }
  }
 }
}

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

/** SAX callback. */
@Override
public void characters(char[] text, int start, int len) throws SAXException {
 if (curHandler != null) {
  if (unrecognizedElements == 0) {
   if (curHandler.buffer == null) {
    curHandler.buffer = new StringBuilder();
   }
   curHandler.buffer.append(text, start, len);
  }
  if (curHandler.innerXml != null &&
    (curHandler.mixedContent || unrecognizedElements > 0)) {
   if (curHandler.fullTextIndex) {
    curHandler.fullTextIndexWriter.write(text, start, len);
    curHandler.fullTextIndexWriter.write("\n");
   }
   try {
    curHandler.innerXml.characters(new String(text, start, len));
   } catch (IOException e) {
    throw new SAXException(e);
   }
  }
 }
}

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

public void textContent(XmlWriter xw, Element e,
  ElementMetadata<?, ?> metadata) throws IOException {
 Object value = (metadata == null) ? e.getTextValue()
   : metadata.generateValue(e, metadata);
 if (value != null) {
  String valStr = value.toString();
  if (valStr.length() > 0) {
   xw.characters(valStr);
  }
 }
}

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

public void textContent(XmlWriter xw, Element e,
  ElementMetadata<?, ?> metadata) throws IOException {
 Object value = (metadata == null) ? e.getTextValue()
   : metadata.generateValue(e, metadata);
 if (value != null) {
  String valStr = value.toString();
  if (valStr.length() > 0) {
   xw.characters(valStr);
  }
 }
}

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

public void textContent(XmlWriter xw, Element e,
  ElementMetadata<?, ?> metadata) throws IOException {
 Object value = (metadata == null) ? e.getTextValue()
   : metadata.generateValue(e, metadata);
 if (value != null) {
  String valStr = value.toString();
  if (valStr.length() > 0) {
   xw.characters(valStr);
  }
 }
}

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

/**
 * Generates XML code for the value of the {@code attribute}.
 *
 * @param attribute
 * @param xmlWriter
 * @throws java.io.IOException
 */
private void generateValue(GoogleBaseAttribute attribute, XmlWriter xmlWriter)
  throws IOException {
 if (attribute.hasValue()) {
  xmlWriter.characters(attribute.getValueAsString());
 }
}

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

/**
 * Generates XML code for the value of the {@code attribute}.
 *
 * @param attribute
 * @param xmlWriter
 * @throws java.io.IOException
 */
private void generateValue(GoogleBaseAttribute attribute, XmlWriter xmlWriter)
  throws IOException {
 if (attribute.hasValue()) {
  xmlWriter.characters(attribute.getValueAsString());
 }
}

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

/**
 * Emits a simple element (without child elements).
 *
 * @param   namespace element namespace.
 * @param   name element name.
 * @param   attrs attributes. Can be {@code null}.
 * @param   value element value. Can be {@code null}.
 * @throws  IOException thrown by the underlying writer.
 */
public void simpleElement(XmlNamespace namespace, String name,
  List<Attribute> attrs, String value) throws IOException {
 startElement(namespace, name, attrs, null);
 characters(value);
 endElement(namespace, name);
}

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

/**
 * Emits a simple element (without child elements).
 *
 * @param   namespace element namespace.
 * @param   name element name.
 * @param   attrs attributes. Can be {@code null}.
 * @param   value element value. Can be {@code null}.
 * @throws  IOException thrown by the underlying writer.
 */
public void simpleElement(XmlNamespace namespace, String name,
  List<Attribute> attrs, String value) throws IOException {
 startElement(namespace, name, attrs, null);
 characters(value);
 endElement(namespace, name);
}

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

/**
 * Emits a simple element (without child elements).
 *
 * @param   namespace element namespace.
 * @param   name element name.
 * @param   attrs attributes. Can be {@code null}.
 * @param   value element value. Can be {@code null}.
 * @throws  IOException thrown by the underlying writer.
 */
public void simpleElement(XmlNamespace namespace, String name,
  List<Attribute> attrs, String value) throws IOException {
 startElement(namespace, name, attrs, null);
 characters(value);
 endElement(namespace, name);
}

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

/**
 * Writes a attribute to the {@code xmlWriter} with the specified 
 * {@code namespace} and {@code name} and with the text content defined by
 * the {@code value}.
 *   
 * @param xmlWriter
 * @param namespace
 * @param name
 * @param value
 * @throws IOException
 */
private void writeXmlNameValue(XmlWriter xmlWriter, Namespace namespace, 
  String name, String value) throws IOException {
 xmlWriter.startElement(namespace,
     convertToElementName(name),
     null,
     null);
 xmlWriter.characters(value);
 xmlWriter.endElement();
}

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

/**
 * Writes a attribute to the {@code xmlWriter} with the specified 
 * {@code namespace} and {@code name} and with the text content defined by
 * the {@code value}.
 *   
 * @param xmlWriter
 * @param namespace
 * @param name
 * @param value
 * @throws IOException
 */
private void writeXmlNameValue(XmlWriter xmlWriter, Namespace namespace, 
  String name, String value) throws IOException {
 xmlWriter.startElement(namespace,
     convertToElementName(name),
     null,
     null);
 xmlWriter.characters(value);
 xmlWriter.endElement();
}

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

/**
 * Generate an Atom XML representation of the current object.
 */
@Override
public void generate(XmlWriter w, ExtensionProfile extProfile)
  throws IOException {
 List<XmlWriter.Attribute> attributes =
   new ArrayList<XmlWriter.Attribute>(4);
 if (code > 0) {
  attributes.add(new XmlWriter.Attribute("code", Integer.toString(code)));
 }
 if (reason != null) {
  attributes.add(new XmlWriter.Attribute("reason", reason));
 }
 if (contentType != null) {
  // Charset makes no sense in this context
  contentType.getAttributes().remove(ContentType.ATTR_CHARSET);
  attributes.add(new XmlWriter.Attribute("content-type",
                      contentType.toString()));
 }
 generateStartElement(w, Namespaces.batchNs, "status", attributes, null);
 generateExtensions(w, extProfile);
 if (content != null) {
  w.characters(content);
 }
 w.endElement(Namespaces.batchNs, "status");
}

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

/**
 * Generate an Atom XML representation of the current object.
 */
@Override
public void generate(XmlWriter w, ExtensionProfile extProfile)
  throws IOException {
 List<XmlWriter.Attribute> attributes =
   new ArrayList<XmlWriter.Attribute>(4);
 if (code > 0) {
  attributes.add(new XmlWriter.Attribute("code", Integer.toString(code)));
 }
 if (reason != null) {
  attributes.add(new XmlWriter.Attribute("reason", reason));
 }
 if (contentType != null) {
  // Charset makes no sense in this context
  contentType.getAttributes().remove(ContentType.ATTR_CHARSET);
  attributes.add(new XmlWriter.Attribute("content-type",
                      contentType.toString()));
 }
 generateStartElement(w, Namespaces.batchNs, "status", attributes, null);
 generateExtensions(w, extProfile);
 if (content != null) {
  w.characters(content);
 }
 w.endElement(Namespaces.batchNs, "status");
}

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