本文整理汇总了Java中org.apache.xerces.xni.XMLAttributes.getName方法的典型用法代码示例。如果您正苦于以下问题:Java XMLAttributes.getName方法的具体用法?Java XMLAttributes.getName怎么用?Java XMLAttributes.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.xni.XMLAttributes
的用法示例。
在下文中一共展示了XMLAttributes.getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Info
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/**
* Creates an element information object.
* <p>
* <strong>Note:</strong>
* This constructor makes a copy of the element information.
*
* @param element The element qualified name.
* @param attributes The element attributes.
*/
public Info(HTMLElements.Element element,
QName qname, XMLAttributes attributes) {
this.element = element;
this.qname = new QName(qname);
if (attributes != null) {
int length = attributes.getLength();
if (length > 0) {
QName aqname = new QName();
XMLAttributes newattrs = new XMLAttributesImpl();
for (int i = 0; i < length; i++) {
attributes.getName(i, aqname);
String type = attributes.getType(i);
String value = attributes.getValue(i);
String nonNormalizedValue = attributes.getNonNormalizedValue(i);
boolean specified = attributes.isSpecified(i);
newattrs.addAttribute(aqname, type, value);
newattrs.setNonNormalizedValue(i, nonNormalizedValue);
newattrs.setSpecified(i, specified);
}
this.attributes = newattrs;
}
}
}
示例2: startElement
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
public void startElement(QName element, XMLAttributes attributes,
Augmentations augs) throws XNIException {
Element elem;
int attrCount = attributes.getLength();
if (fDocumentImpl == null) {
elem = fDocument.createElementNS(element.uri, element.rawname);
for (int i = 0; i < attrCount; ++i) {
attributes.getName(i, fAttributeQName);
elem.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i));
}
}
// If it's a Xerces DOM store type information for attributes, set idness, etc..
else {
elem = fDocumentImpl.createElementNS(element.uri, element.rawname, element.localpart);
for (int i = 0; i < attrCount; ++i) {
attributes.getName(i, fAttributeQName);
AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri,
fAttributeQName.rawname, fAttributeQName.localpart);
attr.setValue(attributes.getValue(i));
elem.setAttributeNodeNS(attr);
// write type information to this attribute
AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI);
if (attrPSVI != null) {
if (fStorePSVI) {
((PSVIAttrNSImpl) attr).setPSVI(attrPSVI);
}
Object type = attrPSVI.getMemberTypeDefinition();
if (type == null) {
type = attrPSVI.getTypeDefinition();
if (type != null) {
attr.setType (type);
if (((XSSimpleType) type).isIDType()) {
((ElementImpl) elem).setIdAttributeNode (attr, true);
}
}
}
else {
attr.setType (type);
if (((XSSimpleType) type).isIDType()) {
((ElementImpl) elem).setIdAttributeNode (attr, true);
}
}
}
attr.setSpecified(attributes.isSpecified(i));
}
}
append(elem);
fCurrentNode = elem;
if (fFragmentRoot == null) {
fFragmentRoot = elem;
}
}
示例3: printElement
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/** Prints an element. */
protected void printElement(QName element, XMLAttributes attributes) {
fOut.print("element=");
fOut.print('{');
fOut.print("prefix=");
printQuotedString(element.prefix);
fOut.print(',');
fOut.print("localpart=");
printQuotedString(element.localpart);
fOut.print(',');
fOut.print("rawname=");
printQuotedString(element.rawname);
fOut.print(',');
fOut.print("uri=");
printQuotedString(element.uri);
fOut.print('}');
fOut.print(',');
fOut.print("attributes=");
if (attributes == null) {
fOut.println("null");
}
else {
fOut.print('{');
int length = attributes.getLength();
for (int i = 0; i < length; i++) {
if (i > 0) {
fOut.print(',');
}
attributes.getName(i, fQName);
String attrType = attributes.getType(i);
String attrValue = attributes.getValue(i);
String attrNonNormalizedValue = attributes.getNonNormalizedValue(i);
Augmentations augs = attributes.getAugmentations(i);
fOut.print("name=");
fOut.print('{');
fOut.print("prefix=");
printQuotedString(fQName.prefix);
fOut.print(',');
fOut.print("localpart=");
printQuotedString(fQName.localpart);
fOut.print(',');
fOut.print("rawname=");
printQuotedString(fQName.rawname);
fOut.print(',');
fOut.print("uri=");
printQuotedString(fQName.uri);
fOut.print('}');
fOut.print(',');
fOut.print("type=");
printQuotedString(attrType);
fOut.print(',');
fOut.print("value=");
printQuotedString(attrValue);
fOut.print(',');
fOut.print("nonNormalizedValue=");
printQuotedString(attrNonNormalizedValue);
if (attributes.isSpecified(i) == false ) {
fOut.print("(default)");
}
if (augs != null) {
fOut.print(',');
printAugmentations(augs);
}
fOut.print('}');
}
fOut.print('}');
}
}
示例4: handleStartElement
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/** Handle start element. */
protected void handleStartElement(QName element, XMLAttributes attrs) {
// handle element and attributes
element = purifyQName(element);
int attrCount = attrs != null ? attrs.getLength() : 0;
for (int i = attrCount-1; i >= 0; i--) {
// purify attribute name
attrs.getName(i, fQName);
attrs.setName(i, purifyQName(fQName));
// synthesize namespace bindings
if (fNamespaces) {
if (!fQName.rawname.equals("xmlns") &&
!fQName.rawname.startsWith("xmlns:")) {
// NOTE: Must get attribute name again because the
// purifyQName method does not guarantee that
// the same QName object is returned. -Ac
attrs.getName(i, fQName);
if (fQName.prefix != null && fQName.uri == null) {
synthesizeBinding(attrs, fQName.prefix);
}
}
}
}
// synthesize namespace bindings
if (fNamespaces) {
if (element.prefix != null && element.uri == null) {
synthesizeBinding(attrs, element.prefix);
}
}
// synthesize doctype declaration
if (!fSeenRootElement && fSeenDoctype) {
Augmentations augs = synthesizedAugs();
super.doctypeDecl(element.rawname, fPublicId, fSystemId, augs);
}
// mark start element as seen
fSeenRootElement = true;
}