org.xml.sax.AttributeList.getName()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(88)

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

AttributeList.getName介绍

[英]Return the name of an attribute in this list (by position).

The names must be unique: the SAX parser shall not include the same attribute twice. Attributes without values (those declared #IMPLIED without a value specified in the start tag) will be omitted from the list.

If the attribute name has a namespace prefix, the prefix will still be attached.
[中]返回此列表中属性的名称(按位置)。
名称必须是唯一的:SAX解析器不能两次包含相同的属性。没有值的属性(那些声明的#隐含的没有在开始标记中指定值的属性)将从列表中忽略。
如果属性名称具有名称空间前缀,则仍将附加前缀。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Return the qualified (prefixed) name of the specified attribute.
 *
 * @param The attribute's index.
 * @return The attribute's qualified name, internalized.
 */
public String getQName (int i)
{
  return qAtts.getName(i).intern();
}

代码示例来源:origin: robovm/robovm

/**
 * Look up an attribute index by qualified (prefixed) name.
 *
 * @param qName The qualified name.
 * @return The attributes index, or -1 if none was found.
 * @see org.xml.sax.Attributes#getIndex(java.lang.String)
 */
public int getIndex (String qName)
{
  int max = atts.getLength();
  for (int i = 0; i < max; i++) {
  if (qAtts.getName(i).equals(qName)) {
    return i;
  }
  }
  return -1;
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Sets the attributes for the wrapped element.
 *
 * @param attributes List of attributes defined in the XML for this
 *                   element. May be <code>null</code>.
 * @deprecated since 1.6.x.
 */
@Deprecated
public synchronized void setAttributes(AttributeList attributes) {
  this.attributes = new AttributeListImpl(attributes);
  for (int i = 0; i < attributes.getLength(); i++) {
    setAttribute(attributes.getName(i), attributes.getValue(i));
  }
}

代码示例来源:origin: org.apache.ant/ant

ih.setAttribute(project, target, attrs.getName(i).toLowerCase(Locale.ENGLISH), value);
} catch (BuildException be) {
  if (!attrs.getName(i).equals("id")) {
    throw be;

代码示例来源:origin: robovm/robovm

String attQName = qAtts.getName(i);
String attQName = qAtts.getName(i);
String type = qAtts.getType(i);
String value = qAtts.getValue(i);

代码示例来源:origin: robovm/robovm

/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
int count = atts.getLength();
clear();
for (int i = 0; i < count; i++) {
  addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
}
}

代码示例来源:origin: org.apache.ant/ant

String key = attrs.getName(i);
String value = attrs.getValue(i);
switch (key) {

代码示例来源:origin: org.apache.ant/ant

String key = attrs.getName(i);
String value = attrs.getValue(i);
switch (key) {

代码示例来源:origin: MobiVM/robovm

/**
 * Return the qualified (prefixed) name of the specified attribute.
 *
 * @param The attribute's index.
 * @return The attribute's qualified name, internalized.
 */
public String getQName (int i)
{
  return qAtts.getName(i).intern();
}

代码示例来源:origin: msv/msv

/**
 * Return the qualified (prefixed) name of the specified attribute.
 *
 * @param The attribute's index.
 * @return The attribute's qualified name, internalized.
 */
public String getQName (int i)
{
  return qAtts.getName(i).intern();
}

代码示例来源:origin: javax.xml.parsers/jaxp-api

/**
 * Return the qualified (prefixed) name of the specified attribute.
 *
 * @param The attribute's index.
 * @return The attribute's qualified name, internalized.
 */
public String getQName (int i)
{
  return qAtts.getName(i).intern();
}

代码示例来源:origin: ibinti/bugvm

/**
 * Return the qualified (prefixed) name of the specified attribute.
 *
 * @param The attribute's index.
 * @return The attribute's qualified name, internalized.
 */
public String getQName (int i)
{
  return qAtts.getName(i).intern();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Return the qualified (prefixed) name of the specified attribute.
 *
 * @param The attribute's index.
 * @return The attribute's qualified name, internalized.
 */
public String getQName (int i)
{
  return qAtts.getName(i).intern();
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Return the qualified (prefixed) name of the specified attribute.
 *
 * @param The attribute's index.
 * @return The attribute's qualified name, internalized.
 */
public String getQName (int i)
{
  return qAtts.getName(i).intern();
}

代码示例来源:origin: com.sun.xml.bind/jaxb1-impl

/**
 * Return the qualified (prefixed) name of the specified attribute.
 *
 * @param The attribute's index.
 * @return The attribute's qualified name, internalized.
 */
public String getQName (int i)
{
  return qAtts.getName(i).intern();
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Return the qualified (prefixed) name of the specified attribute.
 *
 * @param The attribute's index.
 * @return The attribute's qualified name, internalized.
 */
public String getQName (int i)
{
  return qAtts.getName(i).intern();
}

代码示例来源:origin: larsga/Duke

public void startElement(String name, AttributeList atts) {
 if (level > 0)
  indent();
 // Write start tag
 write(writer, '<');
 write(writer, name);
 if (atts != null) {
  for (int i = 0; i < atts.getLength(); i++) {
   write(writer, ' ');
   write(writer, atts.getName(i));
   write(writer, "=\"");
   escapeAttrValue(atts.getValue(i), writer);
   write(writer, "\"");
  }
 }
 write(writer, '>');
 level++;
 // check arrays are still of right size
 if (offset + level*2 > startline.length)
  makeStartLineBuffer((offset + level*2) * 2);
 if (level >= subelements.length)
  makeSubelements(level * 2);
 
 // Set sub element flag on parent element to true
 if (level > 0)
  subelements[level - 1] = true;
 // Set sub element flag on this element to false
 subelements[level] = false;
}

代码示例来源:origin: org.fudaa.business/fudaa-common-corba

public void startElement(String name, AttributeList atts)
  throws SAXException {
Element elem = document.createElement(name);
if (atts != null) {
  int count = atts.getLength();
  for (int i = 0; i < count; i++) {
  elem.setAttribute(atts.getName(i), atts.getValue(i));
  }
}     
current.appendChild(elem);
current = elem;
}

代码示例来源:origin: org.codehaus.castor/castor-xml

@Override
public void startElement(final String name, final AttributeList attributes) {
 Node parent = !_parents.isEmpty() ? _parents.peek() : _node;
 final Document document = getDocument(parent);
 Element element = document.createElement(name);
 int length = attributes.getLength();
 for (int i = 0; i < length; i++) {
  element.setAttribute(attributes.getName(i), attributes.getValue(i));
 }
 parent.appendChild(element);
 _parents.push(element);
}

代码示例来源:origin: uk.org.ponder.rsf/rsf-core-ponderutilcore

SAXAttributeHash(AttributeList attrs) {
 for (int i = 0; i < attrs.getLength(); ++ i) {
  put(attrs.getName(i), attrs.getType(i), attrs.getValue(i));
  }
 }
public SAXAttributeHash() {}

相关文章

微信公众号

最新文章

更多