- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中net.sf.okapi.common.XMLWriter.writeAttributeString()
方法的一些代码示例,展示了XMLWriter.writeAttributeString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLWriter.writeAttributeString()
方法的具体详情如下:
包路径:net.sf.okapi.common.XMLWriter
类名称:XMLWriter
方法名:writeAttributeString
[英]Writes an attribute and its associated value. You must use #writeStartElement(String) just before.
[中]写入属性及其关联值。您必须在之前使用#WriteStarteElement(字符串)。
代码示例来源:origin: net.sf.okapi/okapi-core
private void writeAnnotatorsRefIfNeeded () {
if ( needAnnotatorsRef && params.getIncludeIts() ) {
writer.writeAttributeString(Namespaces.ITS_NS_PREFIX+":annotatorsRef", annotatorsRef.peek());
needAnnotatorsRef = false;
}
}
代码示例来源:origin: net.sf.okapi/okapi-core
protected void writeAllPropertiesAsAttibutes (XMLWriter writer,
Set<String> names,
TextContainer item)
{
// Write any TUV-level properties as attributes (but only standard attributes)
for ( String name : names ) {
if (ATTR_NAMES.contains(";"+name+";") && !name.equals("tuid")) {
writer.writeAttributeString(name, item.getProperty(name).getValue());
}
}
}
代码示例来源:origin: net.sf.okapi/okapi-core
protected void writeAllPropertiesAsAttibutes (XMLWriter writer,
Set<String> names,
ITextUnit item)
{
// Write any TU-level properties as attributes (but only standard attributes)
for ( String name : names ) {
if ( ATTR_NAMES.contains(";"+name+";") && !name.equals("tuid")) {
writer.writeAttributeString(name, item.getProperty(name).getValue());
}
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-gttbatchtranslation
private void startExtractedBlock () {
try {
File tmpFile = File.createTempFile("~okapi-45_gttbt_", ".html");
blocks.add(tmpFile);
// Create the HTML file
htmlWriter = new XMLWriter(tmpFile.getPath());
// Start building the source file
htmlWriter.writeStartElement("html");
htmlWriter.writeStartElement("meta");
htmlWriter.writeAttributeString("http-equiv", "Content-Type");
htmlWriter.writeAttributeString("content", "text/html; charset=UTF-8");
htmlWriter.writeEndElementLineBreak();
count = 100; // Roughly
}
catch ( IOException e ) {
throw new OkapiIOException("Error creating extraction file.", e);
}
}
代码示例来源:origin: net.sf.okapi/okapi-core
protected void writeProp(String name, String value) {
// Write out the property
if (expandDuplicateProps) {
StringTokenizer st = new StringTokenizer(value, propValueSep, false);
while (st.hasMoreTokens()) {
writer.writeStartElement("prop");
writer.writeAttributeString("type", name);
writer.writeString(st.nextToken());
writer.writeEndElementLineBreak(); // prop
}
} else {
writer.writeStartElement("prop");
writer.writeAttributeString("type", name);
writer.writeString(value);
writer.writeEndElementLineBreak(); // prop
}
}
代码示例来源:origin: net.sf.okapi/okapi-core
private static void writeSizeProperties(XMLWriter writer, INameable resource) {
boolean sizeWritten = false;
if (resource.hasProperty(Property.MAX_WIDTH)) {
writer.writeAttributeString("maxwidth", resource.getProperty(Property.MAX_WIDTH).getValue());
sizeWritten = true;
}
if (resource.hasProperty(Property.MAX_HEIGHT)) {
writer.writeAttributeString("maxheight", resource.getProperty(Property.MAX_HEIGHT).getValue());
sizeWritten = true;
}
if (sizeWritten) {
if (resource.hasProperty(Property.SIZE_UNIT)) {
writer.writeAttributeString("size-unit", resource.getProperty(Property.SIZE_UNIT).getValue());
} else {
//default
writer.writeAttributeString("size-unit", "pixel");
}
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging
private XMLWriter startTemporaryFiles () {
// Create the HTML source file
XMLWriter htmlWriter = new XMLWriter(htmlSourceFile.getPath());
// Start building the source file
htmlWriter.writeStartElement("html");
htmlWriter.writeStartElement("meta");
htmlWriter.writeAttributeString("http-equiv", "Content-Type");
htmlWriter.writeAttributeString("content", "text/html; charset=UTF-8");
htmlWriter.writeEndElementLineBreak();
// Set the output name and make sure it's deleted
String path = htmlSourceFile.getAbsolutePath();
path = Util.getDirectoryName(path) + File.separator + Util.getFilename(path, false) + ".trg.html";
htmlTargetFile = new File(path);
if ( htmlTargetFile.exists() ) {
htmlTargetFile.delete();
}
// Create the store for the original source
path = htmlSourceFile.getAbsolutePath();
path = Util.getDirectoryName(path) + File.separator + Util.getFilename(path, false) + ".ori.bin";
originalStoreFile = new File(path);
store.create(originalStoreFile);
return htmlWriter;
}
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Writes the start of a <group> element.
* @see #writeEndGroup()
*/
public void writeStartGroup (StartGroup resource) {
if ( !inFile ) {
writeStartFile(original, dataType, skeletonPath, fwConfigId, fwInputEncoding, null);
}
String id = resource.getId();
String resName = resource.getName();
String resType = resource.getType();
writer.writeStartElement("group");
writer.writeAttributeString("id", id);
if ( !Util.isEmpty(resName) ) {
writer.writeAttributeString("resname", resName);
}
if ( !Util.isEmpty(resType) ) {
if ( resType.startsWith("x-") || ( RESTYPEVALUES.contains(";"+resType+";")) ) {
writer.writeAttributeString("restype", resType);
}
else { // Make sure the value is valid
writer.writeAttributeString("restype", "x-"+resType);
}
}
writeAnnotatorsRefIfNeeded();
writeSizeProperties(writer, resource);
writer.writeLineBreak();
}
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeAttributeString("version", "1.2");
writer.writeAttributeString("xmlns", Namespaces.NS_XLIFF12);
writer.writeAttributeString("xmlns:okp", Namespaces.NS_XLIFFOKAPI);
if ( params.getIncludeIts() ) {
writer.writeAttributeString("xmlns:"+Namespaces.ITS_NS_PREFIX, Namespaces.ITS_NS_URI);
writer.writeAttributeString("xmlns:"+Namespaces.ITSXLF_NS_PREFIX, Namespaces.ITSXLF_NS_URI);
writer.writeAttributeString(Namespaces.ITS_NS_PREFIX+":version", "2.0");
代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation
writer.writeAttributeString("xmlns", NSURI_SRX20);
if (saveExtensions) {
writer.writeAttributeString("xmlns:" + NSPREFIX_OKPSRX, NSURI_OKPSRX);
writer.writeAttributeString("version", "2.0");
version = "2.0";
writer.writeLineBreak();
writer.writeAttributeString("segmentsubflows", (segmentSubFlows ? "yes" : "no"));
writer.writeAttributeString("cascade", (cascade ? "yes" : "no"));
writer.writeLineBreak();
writer.writeAttributeString("type", "start");
writer.writeAttributeString("include", (includeStartCodes ? "yes" : "no"));
writer.writeAttributeString("type", "end");
writer.writeAttributeString("include", (includeEndCodes ? "yes" : "no"));
writer.writeAttributeString("type", "isolated");
writer.writeAttributeString("include", (includeIsolatedCodes ? "yes" : "no"));
writer.writeAttributeString("oneSegmentIncludesAll", (oneSegmentIncludesAll ? "yes" : "no"));
writer.writeAttributeString("trimLeadingWhitespaces", (trimLeadingWS ? "yes" : "no"));
writer.writeAttributeString("trimTrailingWhitespaces", (trimTrailingWS ? "yes" : "no"));
writer.writeAttributeString("useJavaRegex", "yes");
writer.writeAttributeString("useIcu4JBreakRules",
(useIcu4JBreakRules ? "yes" : "no"));
writer.writeAttributeString("treatIsolatedCodesAsWhitespace",
(treatIsolatedCodesAsWhitespace ? "yes" : "no"));
代码示例来源:origin: net.sf.okapi/okapi-core
private void writeXliffNotes(ITextUnit tu) {
XLIFFNoteAnnotation notes = tu.getAnnotation(XLIFFNoteAnnotation.class);
if (notes == null) {
return;
}
for (XLIFFNote n : notes) {
writer.writeStartElement("note");
// annotates
if (n.getAnnotates() != null) {
writer.writeAttributeString("annotates", n.getAnnotates().toString());
}
// from
if (n.getFrom() != null) {
writer.writeAttributeString("from", n.getFrom());
}
// priority
if (n.getPriority() != null) {
writer.writeAttributeString("priority", n.getPriority().toString());
}
writer.writeString(n.getNoteText());
writer.writeEndElementLineBreak(); // note
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-gttbatchtranslation
String out = String.format("%d:%s:%s", subDocId, tu.getId(), seg.id);
count += (out.length() + 10);
htmlWriter.writeAttributeString("id", out);
out = qutil.toCodedHTML(seg.text);
try {
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeStartElement("tu");
if ( !Util.isEmpty(tuid) ) {
writer.writeAttributeString("tuid", tuid);
writer.writeAttributeString("type", name);
writer.writeString(attributes.get(name));
writer.writeAttributeString("xml:lang", srcLoc.toBCP47());
writer.writeStartElement("seg");
writer.writeRawXML(tmxCont.setContent(source).toString());
writer.writeAttributeString("xml:lang",
((altTrgLoc != null) ? altTrgLoc.toBCP47() : trgLoc.toBCP47()));
writer.writeAttributeString(CREATIONID, attributes.get(CREATIONID));
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeAttributeString("original",
(original!=null) ? original : "unknown");
writer.writeAttributeString("source-language", srcLoc.toBCP47());
if ( trgLoc != null ) {
writer.writeAttributeString("target-language", trgLoc.toBCP47());
writer.writeAttributeString("datatype", dataType);
writer.writeAttributeString("okp:inputEncoding", inputEncoding);
writer.writeAttributeString("okp:configId", configId);
writer.writeStartElement("skl");
writer.writeStartElement("external-file");
writer.writeAttributeString("href", skeletonPath);
writer.writeAttributeString("tool-id", params.getToolId());
writer.writeAttributeString("tool-name", params.getToolName());
writer.writeAttributeString("tool-version", params.getToolVersion());
if (!Util.isEmpty(params.getToolCompany()))
writer.writeAttributeString("tool-company", params.getToolCompany());
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeStartElement("alt-trans");
if ( segment != null ) {
writer.writeAttributeString("mid", segment.getId());
writer.writeAttributeString("match-quality", String.format("%d", alt.getCombinedScore()));
writer.writeAttributeString("origin", alt.getOrigin());
writer.writeAttributeString("okp:"+OKP_MATCHTYPE, alt.getType().toString());
writer.writeAttributeString("okp:"+OKP_ENGINE, alt.getEngine());
writer.writeAttributeString("xml:lang", alt.getSourceLocale().toBCP47());
writer.writeAttributeString("xml:lang", alt.getTargetLocale().toBCP47());
if ( params.getIncludeIts() ) {
writeAnnotatorsRefIfNeeded();
代码示例来源:origin: net.sf.okapi.connectors/okapi-connector-microsoft
xmlWriter.writeElementString("From", srcLang);
xmlWriter.writeStartElement("Options");
xmlWriter.writeAttributeString("xmlns:o", "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2");
xmlWriter.writeElementString("o:Category", category);
xmlWriter.writeElementString("o:ContentType", contentType);
xmlWriter.writeAttributeString("xmlns:s", "http://schemas.microsoft.com/2003/10/Serialization/Arrays");
for (String text : texts) {
xmlWriter.writeStartElement("s:string");
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeAttributeString("tuid", tuid);
writer.writeAttributeString("tuid", String.format("%s_%s", tuid, srcSeg.id));
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeAttributeString("xml:lang", locale.toBCP47());
if (isWriteAllPropertiesAsAttributes()) {
Set<String> names;
writer.writeAttributeString("type", name);
writer.writeString(contForProp.getProperty(name).getValue());
代码示例来源:origin: net.sf.okapi.connectors/okapi-connector-microsoft
public String toXML() {
StringWriter sw = new StringWriter();
XMLWriter xml = new XMLWriter(sw);
xml.writeStartDocument();
xml.writeStartElement("TranslateOptions");
xml.writeAttributeString("xmlns", "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2");
xml.writeStartElement("Category");
xml.writeString(this.category);
xml.writeEndElement();
xml.writeStartElement("ContentType");
xml.writeString(this.contentType);
xml.writeEndElement();
xml.writeStartElement("ReservedFlags");
xml.writeEndElement();
xml.writeStartElement("State");
xml.writeEndElement();
xml.writeStartElement("Uri");
xml.writeEndElement();
xml.writeStartElement("User");
xml.writeString("defaultUser");
xml.writeEndElement();
xml.writeEndElement(); // !TranslateOptions
xml.close();
return sw.toString();
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit
XR.writeStartElement("omegat");
XR.writeStartElement("project");
XR.writeAttributeString("version", "1.0");
我是 C++ 的新手,所以请放轻松。 我正在尝试使用 sfml 创建 RenderWindow。然后,在创建播放器时,该播放器关联的“窗口”对象被设置为先前创建的 RenderWindow。我的目的是
我有一个 sf 的列表我想行绑定(bind)以创建单个 sf 的对象目的。我正在寻找类似于 data.table::rbindlist 的函数,这将以有效的方式堆叠各个对象。 可重现示例的数据: my
我正在尝试在 R 中使用 sf 创建一个 95% 的最小凸多边形。只要我只将数据分组到 1 个变量上,我的代码就可以正常工作,但是当我分组到两个变量上时,输出将失去其 sf 类并且改为 grouped
我试图使用内连接或左连接连接两个 sf 数据帧。这些数据框内部都有几何列。我不断收到错误: check_join(x, y) 中的错误: y 应该是一个 data.frame;对于空间连接,使用 st
我对使用 SFML 图形库中的 sf::Shape 有疑问。在我的游戏中,我使用 sf::RectangleShapes。例如用户界面或播放器。这是一个和平的代码: std::unique_ptr r
我正在学习 C++ 中的 SFML 库。我一直在尝试通过制作一个包含两个独立的 std::map 的音乐类 (sf::Music) 和声音 (sf::Sound) 来实现一种在我的游戏中组织音频的有效
有没有一种简单的方法可以使 sf::Text 对象在 sf::RectangleShape 对象中居中? 文本具有可变长度,但在创建后不会改变。 我正在使用 SFML 2.4。 最佳答案 将一个对象置
在我的 SwiftUI 应用程序中,我的字符串名称是 SF 符号图像的名称,或存储在 Assets 目录中的图像。 我想创建一个 View ,首先尝试将图像显示为 SF 符号图像,如果不存在具有该名称
我一直在使用EhCache在我的项目中实现一些缓存。我已经将以下依赖项添加到我的pom.xml中 org.springframework spring-context 4.
我想创建一个数组,其中包含将绘制到窗口上的所有 Sprite 、文本和形状,我的问题是如何使这个数组同时具有 sf::Drawable 和 sf::Transformable? 最佳答案 您需要创建一
我得到了一个派生自 sf::Packet 的类,它在其构造函数中传递了一个引用 iots 类型的 Integer。现在在构造函数中,我尝试将 Integer 添加到 sf::Packet 的数据中,如
当我尝试编译以下代码时: SFMLSet.cpp: #include "SFMLSet.h" SFMLSet::SFMLSet(string texturePath) { if(!textur
我正在使用 sf::Clock 来控制循环。 我想知道是否允许我使用超过 1 个 sf::Clock,如果允许,是否所有“时钟”都将正常运行并按预期工作在所有操作系统上。 例如: sf::Clock
我将C++图形中的SFML libraby用于我的国际象棋游戏。 当您在游戏中移动棋子时,会发生鼠标左键事件。所以这是我最初的跟踪方式。 sf::Event e; if (e.type == sf::
我正在尝试使用 SFML 库制作简单的按钮。当我将鼠标放在按钮上时,该按钮应该会更改其文本颜色。 void Button::updateColor(sf::Vector2i MousePos) {
void update(bool moright, bool moleft) { Clock Clock(); if (moright == true){
我的 JSON 有问题。我的代码中的这一行抛出异常 String jsontxt = IOUtils.toString(new FileInputStream(Filename), "UTF-8");
代码如下: 引擎.h #include #include #include #include #include #include #include class Engine { publ
我意识到这可能是重复的,但我搜索了许多论坛和问题,知道是什么原因导致了问题,但无法在此处找到它。我正在使用 SFML 2.0,我已将错误追踪到: void GameObjectManager::Dra
我在 sf 类型的简单特征( POINT )中保存了多个轨迹.我想计算后续位置(即行)之间的欧几里得距离。到目前为止,我已经使用 Pythagorean formula for calculating
我是一名优秀的程序员,十分优秀!