gpt4 book ai didi

com.ctc.wstx.sw.XmlWriter类的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 02:43:05 26 4
gpt4 key购买 nike

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

XmlWriter介绍

[英]This is the base class for actual physical xml outputters. These instances will only handle actual writing (possibly including encoding) of the serialized textual xml, and will in general not verify content being output. The exception are the character-by-character checks that are most efficiently done at encoding level (such as character escaping, and checks for illegal character combinations), which are handled at this level.

Note that implementations can have different operating modes: specifically, when dealing with illegal content (such as "--" in a comment, "?>" in processing instruction, or "]]>" within CDATA section), implementations can do one of 3 things:

  • Fix the problem, by splitting the section (which can be done for CDATA sections, and to some degree, comments)
  • Stop outputting, and return an index to the illegal piece of data (if there is no easy way to fix the problem: for example, for processing instruction)
  • Just output content even though it will not result in well-formed output. This should only be done if the calling application has specifically requested verifications to be disabled.
    [中]这是实际物理xml输出的基类。这些实例将只处理序列化文本xml的实际写入(可能包括编码),通常不会验证输出的内容。例外情况是在编码级别最有效地执行逐字符检查(例如字符转义和检查非法字符组合),这些检查在此级别处理。
    请注意,实现可以有不同的操作模式:具体来说,在处理非法内容时(例如,在注释中的“-”,在处理指令中的“?>”或在CDATA部分中的“]]>”,实现可以执行以下三种操作之一:
    *通过拆分分区(可以对CDATA分区进行拆分,也可以在一定程度上对注释进行拆分)来解决此问题
    *停止输出,并返回非法数据段的索引(如果没有简单的方法解决问题:例如,处理指令)
    *只输出内容,即使它不会产生格式良好的输出。只有在调用应用程序明确要求禁用验证时,才应执行此操作。

代码示例

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

public final void close()
  throws IOException
{
  mWriter.close(false);
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

mWriter.enableXml11();
  mWriter.writeXmlDeclaration(version, encoding, standAlone);
} catch (IOException ioe) {
  throw new WstxIOException(ioe);

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

public final void flush()
  throws IOException
{
  mWriter.flush();
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

public XMLStreamLocation2 getLocation()
{
  return new WstxInputLocation(null, // no parent
      null, (String) null, // pub/sys ids not yet known
      mWriter.getAbsOffset(),
      mWriter.getRow(), mWriter.getColumn());
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

public Object getProperty(String name)
{
  /* These properties just exist for interoperability with
   * toolkits that were designed to work with Sun's parser (which
   * introduced properties)
   */
  if (name.equals(WstxOutputProperties.P_OUTPUT_UNDERLYING_STREAM)) {
    return mWriter.getOutputStream();
  }
  if (name.equals(WstxOutputProperties.P_OUTPUT_UNDERLYING_WRITER)) {
    return mWriter.getWriter();
  }
  return mConfig.getProperty(name);
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

public int getColumn() {
  return (getOutputPtr() - mLocRowStartOffset) + 1;
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

/**
 * Method called to verify that the name is a legal XML name.
 */
public final void verifyNameValidity(String name, boolean checkNs)
  throws XMLStreamException
{
  /* No empty names... caller must have dealt with optional arguments
   * prior to calling this method
   */
  if (name == null || name.length() == 0) {
    reportNwfName(ErrorConsts.WERR_NAME_EMPTY);
  }
  int illegalIx = WstxInputData.findIllegalNameChar(name, checkNs, mXml11);
  if (illegalIx >= 0) {
    if (illegalIx == 0) {
      reportNwfName(ErrorConsts.WERR_NAME_ILLEGAL_FIRST_CHAR,
             WstxInputData.getCharDesc(name.charAt(0)));
    }
    reportNwfName(ErrorConsts.WERR_NAME_ILLEGAL_CHAR,
           WstxInputData.getCharDesc(name.charAt(illegalIx)));
  }
}

代码示例来源:origin: woodstox/wstx-asl

public XMLStreamLocation2 getLocation()
{
  return new WstxInputLocation(null, // no parent
                 null, null, // pub/sys ids not yet known
                 mWriter.getAbsOffset(),
                 mWriter.getRow(), mWriter.getColumn());
}

代码示例来源:origin: woodstox/wstx-asl

public Object getProperty(String name) {
  if (name.equals(WstxOutputProperties.P_OUTPUT_UNDERLYING_STREAM)) {
    return mWriter.getOutputStream();
  }
  if (name.equals(WstxOutputProperties.P_OUTPUT_UNDERLYING_WRITER)) {
    return mWriter.getWriter();
  }
  return mConfig.getProperty(name);
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

public int getAbsOffset() {
  return mLocPastChars +getOutputPtr();
}

代码示例来源:origin: com.fasterxml.woodstox/woodstox-core

/**
 * Method called to verify that the name is a legal XML name.
 */
public final void verifyNameValidity(String name, boolean checkNs)
  throws XMLStreamException
{
  /* No empty names... caller must have dealt with optional arguments
   * prior to calling this method
   */
  if (name == null || name.length() == 0) {
    reportNwfName(ErrorConsts.WERR_NAME_EMPTY);
  }
  int illegalIx = WstxInputData.findIllegalNameChar(name, checkNs, mXml11);
  if (illegalIx >= 0) {
    if (illegalIx == 0) {
      reportNwfName(ErrorConsts.WERR_NAME_ILLEGAL_FIRST_CHAR,
             WstxInputData.getCharDesc(name.charAt(0)));
    }
    reportNwfName(ErrorConsts.WERR_NAME_ILLEGAL_CHAR,
           WstxInputData.getCharDesc(name.charAt(illegalIx)));
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.woodstox

public XMLStreamLocation2 getLocation()
{
  return new WstxInputLocation(null, // no parent
                 null, null, // pub/sys ids not yet known
                 mWriter.getAbsOffset(),
                 mWriter.getRow(), mWriter.getColumn());
}

代码示例来源:origin: woodstox/wstx-lgpl

public Object getProperty(String name) {
  if (name.equals(WstxOutputProperties.P_OUTPUT_UNDERLYING_STREAM)) {
    return mWriter.getOutputStream();
  }
  if (name.equals(WstxOutputProperties.P_OUTPUT_UNDERLYING_WRITER)) {
    return mWriter.getWriter();
  }
  return mConfig.getProperty(name);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.woodstox

mWriter.enableXml11();
  mWriter.writeXmlDeclaration(version, encoding, standAlone);
} catch (IOException ioe) {
  throw new WstxIOException(ioe);

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

protected void throwOutputError(String msg)
  throws XMLStreamException
{
  // First, let's flush any output we may have, to make debugging easier
  try {
    flush();
  } catch (IOException ioe) {
    throw new WstxIOException(ioe);
  }
  throw new XMLStreamException(msg);
}

代码示例来源:origin: com.fasterxml.woodstox/woodstox-core

@Override
public final void close() throws IOException
{
  mWriter.close(false);
}

代码示例来源:origin: com.fasterxml.woodstox/woodstox-core

public int getColumn() {
  return (getOutputPtr() - mLocRowStartOffset) + 1;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.woodstox

/**
 * Method called to verify that the name is a legal XML name.
 */
public final void verifyNameValidity(String name, boolean checkNs)
  throws XMLStreamException
{
  /* No empty names... caller must have dealt with optional arguments
   * prior to calling this method
   */
  if (name == null || name.length() == 0) {
    reportNwfName(ErrorConsts.WERR_NAME_EMPTY);
  }
  int illegalIx = WstxInputData.findIllegalNameChar(name, checkNs, mXml11);
  if (illegalIx >= 0) {
    if (illegalIx == 0) {
      reportNwfName(ErrorConsts.WERR_NAME_ILLEGAL_FIRST_CHAR,
             WstxInputData.getCharDesc(name.charAt(0)));
    }
    reportNwfName(ErrorConsts.WERR_NAME_ILLEGAL_CHAR,
           WstxInputData.getCharDesc(name.charAt(illegalIx)));
  }
}

代码示例来源:origin: Nextdoor/bender

@Override
public XMLStreamLocation2 getLocation()
{
  return new WstxInputLocation(null, // no parent
      null, (String) null, // pub/sys ids not yet known
      mWriter.getAbsOffset(),
      mWriter.getRow(), mWriter.getColumn());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.woodstox

public Object getProperty(String name) {
  if (name.equals(WstxOutputProperties.P_OUTPUT_UNDERLYING_STREAM)) {
    return mWriter.getOutputStream();
  }
  if (name.equals(WstxOutputProperties.P_OUTPUT_UNDERLYING_WRITER)) {
    return mWriter.getWriter();
  }
  return mConfig.getProperty(name);
}

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