org.codehaus.stax2.validation.XMLValidator.validateAttribute()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(84)

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

XMLValidator.validateAttribute介绍

[英]Callback method called on validator to give it a chance to validate the value of an attribute, as well as to normalize its value if appropriate (remove leading/trailing/intervening white space for certain token types etc.).
[中]回调方法调用validator,使其有机会验证属性的值,并在适当的情况下规范化其值(删除某些令牌类型的前导/尾随/中间空白等)。

代码示例

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

protected void validateAttribute(int index, XMLValidator vld)
  throws XMLStreamException
{
  Attribute attr = mAttributes[index];
  String normValue = vld.validateAttribute
    (attr.mLocalName, attr.mNamespaceURI, attr.mPrefix,
     mValueBuilder.getCharBuffer(),
     getValueStartOffset(index),
     getValueStartOffset(index+1));
  if (normValue != null) {
    attr.setValue(normValue);
  }
}

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

mValidator.validateAttribute(localName, XmlConsts.ATTR_NO_NS_URI, XmlConsts.ATTR_NO_PREFIX, value);

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

protected final void doWriteAttr(String localName, String nsURI, String prefix,
                 char[] buf, int start, int len)
  throws XMLStreamException
{
  if (mCheckAttrs) { // still need to ensure no duplicate attrs?
    mCurrElem.checkAttrWrite(nsURI, localName);
  }
  if (mValidator != null) {
    /* No need to get it normalized... even if validator does normalize
     * it, we don't use that for anything
     */
    mValidator.validateAttribute(localName, nsURI, prefix, buf, start, len);
  }
  try {
    if (prefix != null && prefix.length() > 0) {
      mWriter.writeAttribute(prefix, localName, buf, start, len);
    } else {
      mWriter.writeAttribute(localName, buf, start, len);
    }
  } catch (IOException ioe) {
    throw new WstxIOException(ioe);
  }
}

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

mValidator.validateAttribute(localName, nsURI, prefix, value);

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

validator.validateAttribute(localName, nsURI, prefix, mOutputBuffer, start, mOutputPtr);
  return;
validator.validateAttribute(localName, nsURI, prefix, valueStr);

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

writeRawAscii(copyBuffer, 0, last);
if (enc.isCompleted()) {
  validator.validateAttribute(localName, nsURI, prefix, copyBuffer, 0, last);
  return;
validator.validateAttribute(localName, nsURI, prefix, valueStr);

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

public String validateAttribute(String localName, String uri,
                String prefix, String value)
  throws XMLValidationException
{
  String retVal =  mFirst.validateAttribute(localName, uri, prefix,
                       value);
  if (retVal != null) {
    value = retVal;
  }
  return mSecond.validateAttribute(localName, uri, prefix, value);
}

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

public String validateAttribute(String localName, String uri,
                String prefix, String value)
  throws XMLStreamException
{
  String retVal =  mFirst.validateAttribute(localName, uri, prefix,
                       value);
  if (retVal != null) {
    value = retVal;
  }
  return mSecond.validateAttribute(localName, uri, prefix, value);
}

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

public String validateAttribute(String localName, String uri,
                String prefix, String value)
  throws XMLValidationException
{
  String retVal =  mFirst.validateAttribute(localName, uri, prefix,
                       value);
  if (retVal != null) {
    value = retVal;
  }
  return mSecond.validateAttribute(localName, uri, prefix, value);
}

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

public String validateAttribute(String localName, String uri,
                String prefix, String value)
  throws XMLValidationException
{
  String retVal =  mFirst.validateAttribute(localName, uri, prefix,
                       value);
  if (retVal != null) {
    value = retVal;
  }
  return mSecond.validateAttribute(localName, uri, prefix, value);
}

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

public String validateAttribute(String localName, String uri,
                String prefix,
                char[] valueChars, int valueStart,
                int valueEnd)
  throws XMLValidationException
{
  String retVal =  mFirst.validateAttribute(localName, uri, prefix,
                       valueChars, valueStart, valueEnd);
  /* If it got normalized, let's pass normalized value to the second
   * validator
   */
  if (retVal != null) {
    return mSecond.validateAttribute(localName, uri, prefix, retVal);
  }
  // Otherwise the original
  return mSecond.validateAttribute(localName, uri, prefix,
                   valueChars, valueStart, valueEnd);
}

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

public String validateAttribute(String localName, String uri,
                String prefix,
                char[] valueChars, int valueStart,
                int valueEnd)
  throws XMLValidationException
{
  String retVal =  mFirst.validateAttribute(localName, uri, prefix,
                       valueChars, valueStart, valueEnd);
  /* If it got normalized, let's pass normalized value to the second
   * validator
   */
  if (retVal != null) {
    return mSecond.validateAttribute(localName, uri, prefix, retVal);
  }
  // Otherwise the original
  return mSecond.validateAttribute(localName, uri, prefix,
                   valueChars, valueStart, valueEnd);
}

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

public String validateAttribute(String localName, String uri,
                String prefix,
                char[] valueChars, int valueStart,
                int valueEnd)
  throws XMLValidationException
{
  String retVal =  mFirst.validateAttribute(localName, uri, prefix,
                       valueChars, valueStart, valueEnd);
  /* If it got normalized, let's pass normalized value to the second
   * validator
   */
  if (retVal != null) {
    return mSecond.validateAttribute(localName, uri, prefix, retVal);
  }
  // Otherwise the original
  return mSecond.validateAttribute(localName, uri, prefix,
                   valueChars, valueStart, valueEnd);
}

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

public String validateAttribute(String localName, String uri,
                String prefix,
                char[] valueChars, int valueStart,
                int valueEnd)
  throws XMLStreamException
{
  String retVal =  mFirst.validateAttribute(localName, uri, prefix,
                       valueChars, valueStart, valueEnd);
  /* If it got normalized, let's pass normalized value to the second
   * validator
   */
  if (retVal != null) {
    return mSecond.validateAttribute(localName, uri, prefix, retVal);
  }
  // Otherwise the original
  return mSecond.validateAttribute(localName, uri, prefix,
                   valueChars, valueStart, valueEnd);
}

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

protected final void doWriteAttr(String localName, String nsURI, String prefix,
                 char[] buf, int start, int len)
  throws XMLStreamException
{
  if (mCheckAttrs) { // still need to ensure no duplicate attrs?
    mCurrElem.checkAttrWrite(nsURI, localName);
  }
  if (mValidator != null) {
    // No need to get it normalized... even if validator does normalize
    // it, we don't use that for anything
    mValidator.validateAttribute(localName, nsURI, prefix, buf, start, len);
  }
  try {
    if (prefix != null && prefix.length() > 0) {
      mWriter.writeAttribute(prefix, localName, buf, start, len);
    } else {
      mWriter.writeAttribute(localName, buf, start, len);
    }
  } catch (IOException ioe) {
    throw new WstxIOException(ioe);
  }
}

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

protected final void doWriteAttr(String localName, String nsURI, String prefix,
                 char[] buf, int start, int len)
  throws XMLStreamException
{
  if (mCheckAttrs) { // still need to ensure no duplicate attrs?
    mCurrElem.checkAttrWrite(nsURI, localName);
  }
  if (mValidator != null) {
    /* No need to get it normalized... even if validator does normalize
     * it, we don't use that for anything
     */
    mValidator.validateAttribute(localName, nsURI, prefix, buf, start, len);
  }
  try {
    if (prefix != null && prefix.length() > 0) {
      mWriter.writeAttribute(prefix, localName, buf, start, len);
    } else {
      mWriter.writeAttribute(localName, buf, start, len);
    }
  } catch (IOException ioe) {
    throw new WstxIOException(ioe);
  }
}

代码示例来源:origin: FasterXML/woodstox

protected void validateAttribute(int index, XMLValidator vld)
  throws XMLStreamException
{
  Attribute attr = mAttributes[index];
  String normValue = vld.validateAttribute
    (attr.mLocalName, attr.mNamespaceURI, attr.mPrefix,
     mValueBuilder.getCharBuffer(),
     getValueStartOffset(index),
     getValueStartOffset(index+1));
  if (normValue != null) {
    attr.setValue(normValue);
  }
}

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

protected void validateAttribute(int index, XMLValidator vld)
  throws XMLStreamException
{
  Attribute attr = mAttributes[index];
  String normValue = vld.validateAttribute
    (attr.mLocalName, attr.mNamespaceURI, attr.mPrefix,
     mValueBuilder.getCharBuffer(),
     getValueStartOffset(index),
     getValueStartOffset(index+1));
  if (normValue != null) {
    attr.setValue(normValue);
  }
}

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

protected void validateAttribute(int index, XMLValidator vld)
  throws XMLStreamException
{
  Attribute attr = mAttributes[index];
  String normValue = vld.validateAttribute
    (attr.mLocalName, attr.mNamespaceURI, attr.mPrefix,
     mValueBuilder.getCharBuffer(),
     getValueStartOffset(index),
     getValueStartOffset(index+1));
  if (normValue != null) {
    attr.setValue(normValue);
  }
}

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

protected void validateAttribute(int index, XMLValidator vld)
  throws XMLStreamException
{
  Attribute attr = mAttributes[index];
  String normValue = vld.validateAttribute
    (attr.mLocalName, attr.mNamespaceURI, attr.mPrefix,
     mValueBuilder.getCharBuffer(),
     getValueStartOffset(index),
     getValueStartOffset(index+1));
  if (normValue != null) {
    attr.setValue(normValue);
  }
}

相关文章