热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.sonar.api.utils.text.XmlWriter.close()方法的使用及代码示例

本文整理了Java中org.sonar.api.utils.text.XmlWriter.close()方法的一些代码示例,展示了XmlWriter.clo

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

XmlWriter.close介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

@Test
public void escape_value() {
writer.prop("foo", "1<2 & 2>=2").close();
expect("1<2 & 2>=2");
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void only_root_with_value() {
writer.prop("foo", "bar").close();
expect("bar");
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void end_with_unused_parameter() {
writer.begin("foo").end("foo").close();
expect("");
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void only_root() {
writer.begin("foo").end().close();
expect("");
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void declaration() {
writer.declaration().begin("foo").end().close();
expect("");
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void ignore_null_values() {
writer.begin("root")
.prop("nullNumber", (Number) null)
.prop("nullString", (String) null)
.end().close();
expect("");
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void fail_on_NaN_value() {
thrown.expect(WriterException.class);
thrown.expectMessage("Fail to write XML. Double value is not valid: NaN");
writer.begin("root").prop("foo", Double.NaN).end().close();
}
}

代码示例来源:origin: SonarSource/sonarqube

private void writeXml(DbSession dbSession, Writer writer, QProfileDto profile, Iterator activeRules) {
XmlWriter xml = XmlWriter.of(writer).declaration();
xml.begin(ATTRIBUTE_PROFILE);
xml.prop(ATTRIBUTE_NAME, profile.getName());
xml.prop(ATTRIBUTE_LANGUAGE, profile.getLanguage());
xml.begin(ATTRIBUTE_RULES);
while (activeRules.hasNext()) {
ActiveRuleDto activeRule = activeRules.next();
xml.begin(ATTRIBUTE_RULE);
xml.prop(ATTRIBUTE_REPOSITORY_KEY, activeRule.getRuleKey().repository());
xml.prop(ATTRIBUTE_KEY, activeRule.getRuleKey().rule());
xml.prop(ATTRIBUTE_PRIORITY, activeRule.getSeverityString());
xml.begin(ATTRIBUTE_PARAMETERS);
for (ActiveRuleParamDto param : db.activeRuleDao().selectParamsByActiveRuleId(dbSession, activeRule.getId())) {
xml
.begin(ATTRIBUTE_PARAMETER)
.prop(ATTRIBUTE_PARAMETER_KEY, param.getKey())
.prop(ATTRIBUTE_PARAMETER_VALUE, param.getValue())
.end();
}
xml.end(ATTRIBUTE_PARAMETERS);
xml.end(ATTRIBUTE_RULE);
}
xml.end(ATTRIBUTE_RULES).end(ATTRIBUTE_PROFILE).close();
}

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

XmlWriter writer = new XmlWriter();
writer.writeHeader();
for (Item item : xmlitems) {
writer.write(convert(item));
}
writer.close();

代码示例来源:origin: org.sonarsource.sonarqube/sonar-server

private void writeXml(DbSession dbSession, Writer writer, QProfileDto profile, Iterator activeRules) {
XmlWriter xml = XmlWriter.of(writer).declaration();
xml.begin(ATTRIBUTE_PROFILE);
xml.prop(ATTRIBUTE_NAME, profile.getName());
xml.prop(ATTRIBUTE_LANGUAGE, profile.getLanguage());
xml.begin(ATTRIBUTE_RULES);
while (activeRules.hasNext()) {
ActiveRuleDto activeRule = activeRules.next();
xml.begin(ATTRIBUTE_RULE);
xml.prop(ATTRIBUTE_REPOSITORY_KEY, activeRule.getRuleKey().repository());
xml.prop(ATTRIBUTE_KEY, activeRule.getRuleKey().rule());
xml.prop(ATTRIBUTE_PRIORITY, activeRule.getSeverityString());
xml.begin(ATTRIBUTE_PARAMETERS);
for (ActiveRuleParamDto param : db.activeRuleDao().selectParamsByActiveRuleId(dbSession, activeRule.getId())) {
xml
.begin(ATTRIBUTE_PARAMETER)
.prop(ATTRIBUTE_PARAMETER_KEY, param.getKey())
.prop(ATTRIBUTE_PARAMETER_VALUE, param.getValue())
.end();
}
xml.end(ATTRIBUTE_PARAMETERS);
xml.end(ATTRIBUTE_RULE);
}
xml.end(ATTRIBUTE_RULES).end(ATTRIBUTE_PROFILE).close();
}

推荐阅读
author-avatar
蕊儿巧乐-滋
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有