gpt4 book ai didi

net.sf.okapi.common.XMLWriter.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 05:33:05 28 4
gpt4 key购买 nike

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

XMLWriter.<init>介绍

[英]Creates a new XML document for a given writer object.
[中]为给定的writer对象创建新的XML文档。

代码示例

代码示例来源:origin: net.sf.okapi/okapi-core

protected void setPath(String path) {
  if ( path == null ) {
    throw new IllegalArgumentException("path must be set");
  }
  this.setWriteAllPropertiesAsAttributes(false);
  writer = new XMLWriter(path);
  mtAttribute = new Hashtable<String, String>();
  mtAttribute.put(CREATIONID, Util.MTFLAG);
  altAttribute = new Hashtable<String, String>();
  altAttribute.put(CREATIONID, FROMALTERNATE);
}

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation

/**
 * Saves the current rules to an SRX rules document.
 * 
 * @param rulesPath
 *            the full path of the file where to save the rules.
 * @param saveExtensions
 *            true to save Okapi SRX extensions, false otherwise.
 * @param saveNonValidInfo
 *            true to save non-SRX-valid attributes, false otherwise.
 */
public void saveRules(String rulesPath, boolean saveExtensions, boolean saveNonValidInfo) {
  XMLWriter writer = new XMLWriter(rulesPath);
  saveRules(writer, saveExtensions, saveNonValidInfo);
}

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation

/**
 * Saves the current rules to an SRX string.
 * 
 * @param saveExtensions
 *            true to save Okapi SRX extensions, false otherwise.
 * @param saveNonValidInfo
 *            true to save non-SRX-valid attributes, false otherwise.
 * @return the string containing the saved SRX rules.
 */
public String saveRulesToString(boolean saveExtensions, boolean saveNonValidInfo) {
  StringWriter strWriter = new StringWriter();
  XMLWriter writer = new XMLWriter(strWriter);
  boolean current = modified;
  saveRules(writer, saveExtensions, saveNonValidInfo);
  modified = current; // Keep the same state for modified
  writer.close();
  return strWriter.toString();
}

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-persistence

@Override
protected void startWriting(OutputStream outStream) {		
  //this.outStream = outStream;
  prWriter = new PrintWriter(outStream);
  writer = new XMLWriter(prWriter);
  writer.writeStartDocument();
  writer.writeStartElement("body");
  writer.writeLineBreak();
}

代码示例来源: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.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

private void processStartDocument (Event event) {
  StartDocument sd = (StartDocument)event.getResource();
  // Create the output
  if ( outputStream == null ) {	
    if (writer == null) {
      writer = new TMXWriter(outputPath);				
    } else {
      writer.setPath(outputPath);
    }
  }
  else if ( outputStream != null ) {
    if (writer == null) {
      writer = new TMXWriter(new XMLWriter(
          new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)));
    } else {
      writer.setXmlWriter(new XMLWriter(
          new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)));
    }
  }
    
  writer.setWriteAllPropertiesAsAttributes(params.isWriteAllPropertiesAsAttributes());        
  writer.setExpandDuplicateProps(params.isEnableDuplicateProps());
  writer.setPropValueSep(params.getPropValueSep());
  writer.setGenerateUUID(params.isGenerateUUID());
  writer.setNormalizeCodeIds(params.isNormalizeInlineIDs());
  writer.writeStartDocument(sd, sd.getLocale(), locale, null, null, segType, "unknown", "text");
}

代码示例来源:origin: net.sf.okapi.steps/okapi-step-translationcomparison

pathToOpen = getOutputFilename();
writer = new XMLWriter(getOutputFilename()); //$NON-NLS-1$
writer.writeStartDocument();
writer.writeStartElement("html"); //$NON-NLS-1$

代码示例来源:origin: net.sf.okapi/okapi-core

writer = new XMLWriter(xliffPath);                         
} else if ( outputStream != null ) {            
  writer = new XMLWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));

代码示例来源: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

report = new XMLWriter(reportPath);
report.writeStartDocument();
report.writeRawXML("<h1>Transifex Package Summary</h1>");

代码示例来源:origin: net.sf.okapi.connectors/okapi-connector-microsoft

public String toXML() {
  StringWriter sw = new StringWriter();
  XMLWriter xmlWriter = new XMLWriter(sw);
  xmlWriter.writeStartDocument();
  xmlWriter.writeStartElement("GetTranslationsArrayRequest");

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

XR = new XMLWriter(projectSaveFile);
XR.writeStartDocument();
XR.writeStartElement("omegat");

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