- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.google.gdata.util.common.xml.XmlWriter.<init>()
方法的一些代码示例,展示了XmlWriter.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlWriter.<init>()
方法的具体详情如下:
包路径:com.google.gdata.util.common.xml.XmlWriter
类名称:XmlWriter
方法名:<init>
[英]Constructs an XmlWriter instance associated that will generate XML content to an underlying Writer.
[中]构造一个关联的XmlWriter实例,该实例将为底层编写器生成XML内容。
代码示例来源:origin: com.google.gdata/gdata-java-client
public XmlWriter getRequestWriter() throws IOException {
OutputStream requestStream = getRequestStream();
Writer writer = new OutputStreamWriter(requestStream, "utf-8");
return new XmlWriter(writer);
}
代码示例来源:origin: com.google.gdata/gdata-core-1.0
public XmlWriter getRequestWriter() throws IOException {
OutputStream requestStream = getRequestStream();
Writer writer = new OutputStreamWriter(requestStream, "utf-8");
return new XmlWriter(writer);
}
代码示例来源:origin: com.mulesoft.google/google-api-gdata
public XmlWriter getRequestWriter() throws IOException {
OutputStream requestStream = getRequestStream();
Writer writer = new OutputStreamWriter(requestStream, "utf-8");
return new XmlWriter(writer);
}
代码示例来源:origin: com.google.gdata/gdata-core-1.0
/**
* 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();
}
}
代码示例来源:origin: com.mulesoft.google/google-api-gdata
/**
* 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();
}
}
代码示例来源:origin: com.google.gdata/gdata-java-client
/**
* 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();
}
}
代码示例来源:origin: com.mulesoft.google/google-api-gdata
/**
* Returns an XmlWriter configured based upon request attributes.
*
* @param w The underlying writer to write to
* @param outProps output properties
* @param charset The writer's character encoding (determines which characters
* need to be escaped. Note that the writer must already be configured to
* use this character set. If the writer and the character set are out of
* sync, the generated XML may be overly escaped (not too bad) or
* malformed (pretty serious.)
* @return An XmlWriter
* @throws IOException If an error occurs creating the XmlWriter.
*/
protected XmlWriter getXmlWriter(Writer w, OutputProperties outProps,
String charset) throws IOException {
EnumSet<WriterFlags> writerFlags = EnumSet.of(WriterFlags.WRITE_HEADER);
if (usePrettyPrint(outProps)) {
writerFlags.add(WriterFlags.PRETTY_PRINT);
}
return new XmlWriter(w, writerFlags, charset);
}
代码示例来源:origin: com.google.gdata/gdata-core-1.0
/**
* Creates a new xml generator for generating xml output, using the
* given namespace as the default namespace.
*/
public XmlGenerator(StreamProperties props, Writer w, Charset cs,
boolean prettyPrint, XmlNamespace defaultNamespace) {
EnumSet<WriterFlags> flags = EnumSet.of(WriterFlags.WRITE_HEADER);
if (prettyPrint) {
flags.add(WriterFlags.PRETTY_PRINT);
}
try {
this.xw = new XmlWriter(w, flags, cs.name());
} catch (IOException ioe) {
throw new RuntimeException("Unable to create XML generator", ioe);
}
this.rootMetadata = props.getRootMetadata();
this.defaultNamespace = defaultNamespace;
}
代码示例来源:origin: com.google.gdata/gdata-java-client
/**
* Creates a new xml generator for generating xml output, using the
* given namespace as the default namespace.
*/
public XmlGenerator(StreamProperties props, Writer w, Charset cs,
boolean prettyPrint, XmlNamespace defaultNamespace) {
EnumSet<WriterFlags> flags = EnumSet.of(WriterFlags.WRITE_HEADER);
if (prettyPrint) {
flags.add(WriterFlags.PRETTY_PRINT);
}
try {
this.xw = new XmlWriter(w, flags, cs.name());
} catch (IOException ioe) {
throw new RuntimeException("Unable to create XML generator", ioe);
}
this.rootMetadata = props.getRootMetadata();
this.defaultNamespace = defaultNamespace;
}
代码示例来源:origin: com.mulesoft.google/google-api-gdata
/**
* Creates a new xml generator for generating xml output, using the
* given namespace as the default namespace.
*/
public XmlGenerator(StreamProperties props, Writer w, Charset cs,
boolean prettyPrint, XmlNamespace defaultNamespace) {
EnumSet<WriterFlags> flags = EnumSet.of(WriterFlags.WRITE_HEADER);
if (prettyPrint) {
flags.add(WriterFlags.PRETTY_PRINT);
}
try {
this.xw = new XmlWriter(w, flags, cs.name());
} catch (IOException ioe) {
throw new RuntimeException("Unable to create XML generator", ioe);
}
this.rootMetadata = props.getRootMetadata();
this.defaultNamespace = defaultNamespace;
}
代码示例来源:origin: com.google.gdata/gdata-core-1.0
/**
* Returns an XmlWriter configured based upon request attributes.
*
* @param w The underlying writer to write to
* @param outProps output properties
* @param charset The writer's character encoding (determines which characters
* need to be escaped. Note that the writer must already be configured to
* use this character set. If the writer and the character set are out of
* sync, the generated XML may be overly escaped (not too bad) or
* malformed (pretty serious.)
* @return An XmlWriter
* @throws IOException If an error occurs creating the XmlWriter.
*/
protected XmlWriter getXmlWriter(Writer w, OutputProperties outProps,
String charset) throws IOException {
EnumSet<WriterFlags> writerFlags = EnumSet.of(WriterFlags.WRITE_HEADER);
if (usePrettyPrint(outProps)) {
writerFlags.add(WriterFlags.PRETTY_PRINT);
}
return new XmlWriter(w, writerFlags, charset);
}
代码示例来源:origin: com.google.gdata/gdata-java-client
/**
* Returns an XmlWriter configured based upon request attributes.
*
* @param w The underlying writer to write to
* @param outProps output properties
* @param charset The writer's character encoding (determines which characters
* need to be escaped. Note that the writer must already be configured to
* use this character set. If the writer and the character set are out of
* sync, the generated XML may be overly escaped (not too bad) or
* malformed (pretty serious.)
* @return An XmlWriter
* @throws IOException If an error occurs creating the XmlWriter.
*/
protected XmlWriter getXmlWriter(Writer w, OutputProperties outProps,
String charset) throws IOException {
EnumSet<WriterFlags> writerFlags = EnumSet.of(WriterFlags.WRITE_HEADER);
if (usePrettyPrint(outProps)) {
writerFlags.add(WriterFlags.PRETTY_PRINT);
}
return new XmlWriter(w, writerFlags, charset);
}
代码示例来源:origin: com.google.gdata/gdata-java-client
/**
* @return a plain-text representation of this text construct,
* or {@code null} in case of error
*/
@Override
public String getPlainText() {
try {
StringWriter sw = new StringWriter();
XmlWriter xw = new XmlWriter(sw);
xw.innerXml(xhtml.getBlob());
return HtmlToText.htmlToPlainText(sw.toString());
} catch (IOException e) {
// IOException isn't very meaningful to callers, so it's better to
// return null in this case.
return null;
}
}
代码示例来源:origin: com.google.gdata/gdata-core-1.0
/**
* @return a plain-text representation of this text construct,
* or {@code null} if there is no text content available.
*/
@Override
public String getPlainText() {
if (xhtml == null) {
return null;
}
try {
StringWriter sw = new StringWriter();
XmlWriter xw = new XmlWriter(sw);
xw.innerXml(xhtml.getBlob());
return HtmlToText.htmlToPlainText(sw.toString());
} catch (IOException e) {
// IOException isn't very meaningful to callers, so it's better to
// return null in this case.
return null;
}
}
代码示例来源:origin: com.mulesoft.google/google-api-gdata
/**
* @return a plain-text representation of this text construct,
* or {@code null} if there is no text content available.
*/
@Override
public String getPlainText() {
if (xhtml == null) {
return null;
}
try {
StringWriter sw = new StringWriter();
XmlWriter xw = new XmlWriter(sw);
xw.innerXml(xhtml.getBlob());
return HtmlToText.htmlToPlainText(sw.toString());
} catch (IOException e) {
// IOException isn't very meaningful to callers, so it's better to
// return null in this case.
return null;
}
}
代码示例来源:origin: wso2-attic/esb-connectors
/**
* Generates a SOAP envelope based on XML Serialization provided by GData(BaseEntry) API generate method.
*
* @param baseEntry the object to be serialized.
* @param contactsService Contacts Service object.
* @return A SOAP Envelope containing the XML generated from the object.
* @throws IOException On failure to initialize XML Writer.
* @throws XMLStreamException On failure to convert XML String to OM Element.
*/
protected final SOAPEnvelope getGDataSOAPEnvelope(final BaseEntry< ? > baseEntry,
final ContactsService contactsService) throws IOException, XMLStreamException {
Writer stringWriter = new StringWriter();
XmlWriter xmlWriter = new XmlWriter(stringWriter);
baseEntry.generate(xmlWriter, contactsService.getExtensionProfile());
return TransportUtils.createSOAPEnvelope(AXIOMUtil.stringToOM(stringWriter.toString()));
}
代码示例来源:origin: wso2-attic/esb-connectors
/**
* Generates a SOAP envelope based on XML Serialization provided by GData(BaseFeed) API generate method.
*
* @param baseFeed The object to be serialized.
* @param contactsService Contact Service object.
* @return a SOAP envelope containing the serialized XML.
* @throws IOException Thrown on failure to initialize the XML writer.
* @throws XMLStreamException On failure to convert the XML String to OMElement.
*/
public final SOAPEnvelope getGDataSOAPEnvelope(final BaseFeed< ? , ? > baseFeed,
final ContactsService contactsService) throws IOException, XMLStreamException {
Writer stringWriter = new StringWriter();
XmlWriter xmlWriter = new XmlWriter(stringWriter);
baseFeed.generate(xmlWriter, contactsService.getExtensionProfile());
return TransportUtils.createSOAPEnvelope(AXIOMUtil.stringToOM(stringWriter.toString()));
}
代码示例来源: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
/**
* 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.mulesoft.google/google-api-gdata
/**
* 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");
}
我想知道 XmlWriter.WriteStartDocument() 背后的原因和 XmlWriter.WriteEndDocument() . 在我的场景中,我正在创建一个包含一些数据的 XML
我想使用 XMLWriter 在 XML 文档之上生成一个嵌套的实体 DTD 声明。我从不带 XMLWriter 的字符串构建代码开始,它也说明了所需的输出: \n"; $sXML .= "%nest
我正在使用 XmlWriter,我想知道是否有人曾尝试编写带有属性的 xml 元素字符串(叶节点),以便输出看起来像 999 代替 999 最佳答案 您可以使用 WriteString .
我无法理解 XmlWriter 在 C# 中的工作方式。假设以下代码在某处使用过。 StringBuilder builder = new StringBuilder(); XmlWriterSett
我正在使用 XmlWriter 并且正在努力创建以下 XML 标记。 我有以下内容: XmlWriterSettings settings = new XmlWriterSettings(); se
我正在尝试生成符合这种格式的 XML 数据: 由于匿名原因,它显然缺少很多标签。 我正在使用 XmlWriter。 我设法用不同的 WriteStartElement() 和 Write
目前我正在使用 XmlWriter,想问一下如何在现有的 XML 文件中写入,例如: a.xml Test3 100 加入 ,例如 Test1 的位置没有任何作用,但最好写在
我正在使用 XmlWriter 构建一些 xml,使用有效的 xml 文件作为我的模板。在文件中,我有这一行: 所以,我在 C# 中做了这个: writer.WriteStartElement("ds
我有一个问题。我编写了一个程序,将大量数据转换为 VML-GML 格式。问题是我需要使用 XmlWriter... 现在我的方法有问题: private void StartDocument() {
下面是代码。我的问题是,如果我想创建此文件,然后稍后使用 XmlWriter 重新打开它并向当前文件添加更多内容,该怎么做?喜欢使用 XmlWriter 进入并编辑此 xml using System
我在 msdn 文档中找到了异步使用 XmlWriter 的示例 http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.aspx a
我正在使用 XMLWriter http://www.php.net/manual/en/book.xmlwriter.php让我的网络客户端创建一个 XML 文件。一开始必须有一个具有很多属性的元素
我有一个 WCF 服务需要返回一个 XML 字符串。但似乎作者只想建立一个文件,而不是一个字符串。我试过: string nextXMLstring = ""; using (XmlWriter wr
我正在尝试生成此文档类型字符串: 这是我一直在尝试的: $writer.WriteDocType("games", $null , "transform.dtd", $null ) 我不完全确定如何
我试图将我的应用程序中的一些元素保存在 xml 文件中,但是当我开始使用以下代码开发它时: public static void WriteInFile(string savefilepath)
我有以下代码: MemoryStream ms = new MemoryStream(); XmlWriter w = XmlWriter.Create(ms); w.Writ
本文整理了Java中org.pageseeder.xmlwriter.XMLStringWriter类的一些代码示例,展示了XMLStringWriter类的具体用法。这些代码示例主要来源于Githu
System.Xml.XmlWriter的一个实例正在写入底层 Stream 吗?(不管 XmlWriter 的具体实现是什么) 那么为什么程序员没有方法可以从 XmlWriter 中检索 Strea
我将如何使用 XMlWriter 类创建这个字符串?我不断收到错误。 这是我尝试创建的 XML 字符串: 这是我试图用它生成的代码: using (XmlWriter writer = XmlWri
我在 XMLWriter 没有关闭时遇到了一些麻烦。我可以成功写入一次 XML 文件,但是如果我尝试再次写入(覆盖),则会出现异常: “该进程无法访问文件 'somefile.xml',因为它正被另一
我是一名优秀的程序员,十分优秀!