本文整理汇总了Java中org.apache.xerces.xni.XMLAttributes.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java XMLAttributes.setValue方法的具体用法?Java XMLAttributes.setValue怎么用?Java XMLAttributes.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.xni.XMLAttributes
的用法示例。
在下文中一共展示了XMLAttributes.setValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanAttribute
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/**
* Scans an attribute.
* <p>
* <pre>
* [41] Attribute ::= Name Eq AttValue
* </pre>
* <p>
* <strong>Note:</strong> This method assumes that the next
* character on the stream is the first character of the attribute
* name.
* <p>
* <strong>Note:</strong> This method uses the fAttributeQName and
* fQName variables. The contents of these variables will be
* destroyed.
*
* @param attributes The attributes list for the scanned attribute.
*/
protected void scanAttribute(XMLAttributes attributes)
throws IOException, XNIException {
if (DEBUG_CONTENT_SCANNING) System.out.println(">>> scanAttribute()");
// name
if (fNamespaces) {
fEntityScanner.scanQName(fAttributeQName);
}
else {
String name = fEntityScanner.scanName();
fAttributeQName.setValues(null, name, name, null);
}
// equals
fEntityScanner.skipSpaces();
if (!fEntityScanner.skipChar('=')) {
reportFatalError("EqRequiredInAttribute",
new Object[]{fCurrentElement.rawname,fAttributeQName.rawname});
}
fEntityScanner.skipSpaces();
// content
int oldLen = attributes.getLength();
int attrIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null);
// WFC: Unique Att Spec
if (oldLen == attributes.getLength()) {
reportFatalError("AttributeNotUnique",
new Object[]{fCurrentElement.rawname,
fAttributeQName.rawname});
}
// Scan attribute value and return true if the un-normalized and normalized value are the same
boolean isSameNormalizedAttr = scanAttributeValue(fTempString, fTempString2,
fAttributeQName.rawname, fIsEntityDeclaredVC, fCurrentElement.rawname);
attributes.setValue(attrIndex, fTempString.toString());
// If the non-normalized and normalized value are the same, avoid creating a new string.
if (!isSameNormalizedAttr) {
attributes.setNonNormalizedValue(attrIndex, fTempString2.toString());
}
attributes.setSpecified(attrIndex, true);
if (DEBUG_CONTENT_SCANNING) System.out.println("<<< scanAttribute()");
}