当前位置: 首页>>代码示例>>Java>>正文


Java Attributes.getLocalName方法代码示例

本文整理汇总了Java中org.xml.sax.Attributes.getLocalName方法的典型用法代码示例。如果您正苦于以下问题:Java Attributes.getLocalName方法的具体用法?Java Attributes.getLocalName怎么用?Java Attributes.getLocalName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xml.sax.Attributes的用法示例。


在下文中一共展示了Attributes.getLocalName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setAttributes

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Copy an entire Attributes object.
 *
 * @param atts The attributes to copy.
 */
public void setAttributes(Attributes atts) {
    _length = atts.getLength();
    if (_length > 0) {

        if (_length >= _algorithmData.length) {
            resizeNoCopy();
        }

        int index = 0;
        for (int i = 0; i < _length; i++) {
            _data[index++] = atts.getURI(i);
            _data[index++] = atts.getLocalName(i);
            _data[index++] = atts.getQName(i);
            _data[index++] = atts.getType(i);
            _data[index++] = atts.getValue(i);
            index++;
            _toIndex[i] = false;
            _alphabets[i] = null;
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:EncodingAlgorithmAttributesImpl.java

示例2: setAttributes

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Copy an entire Attributes object.
 *
 * <p>It may be more efficient to reuse an existing object
 * rather than constantly allocating new ones.</p>
 *
 * @param atts The attributes to copy.
 */
public void setAttributes (Attributes atts)
{
    clear();
    length = atts.getLength();
    if (length > 0) {
        data = new String[length*5];
        for (int i = 0; i < length; i++) {
            data[i*5] = atts.getURI(i);
            data[i*5+1] = atts.getLocalName(i);
            data[i*5+2] = atts.getQName(i);
            data[i*5+3] = atts.getType(i);
            data[i*5+4] = atts.getValue(i);
        }
    }
}
 
开发者ID:Pixplicity,项目名称:HtmlCompat,代码行数:24,代码来源:AttributesImpl.java

示例3: handleFxScript

import org.xml.sax.Attributes; //导入方法依赖的package包/类
@NbBundle.Messages({
    "#0 - attribute name",
    "ERR_unexpectedScriptAttribute=Unexpected attribute in fx:script: {0}"
})
private FxNode handleFxScript(Attributes atts) {
    String ref = null;
    
    for (int i = 0; i < atts.getLength(); i++) {
        String name = atts.getLocalName(i);
         if (!FX_ATTR_REFERENCE_SOURCE.equals(name)) {
            addAttributeError(atts.getQName(i),
                "invalid-script-attribute",
                ERR_unexpectedScriptAttribute(name),
                name
            );
            continue;
        }
        ref = atts.getValue(i);
    }
    return accessor.createScript(ref);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:FxModelBuilder.java

示例4: begin

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Handle the beginning of an XML element.
 *
 * @param attributes The attributes of this element
 *
 * @exception Exception if a processing error occurs
 */
@Override
public void begin(String namespace, String nameX, Attributes attributes)
    throws Exception {

    for (int i = 0; i < attributes.getLength(); i++) {
        String name = attributes.getLocalName(i);
        if ("".equals(name)) {
            name = attributes.getQName(i);
        }
        if ("path".equals(name) || "docBase".equals(name)) {
            continue;
        }
        String value = attributes.getValue(i);
        if (!digester.isFakeAttribute(digester.peek(), name) 
                && !IntrospectionUtils.setProperty(digester.peek(), name, value) 
                && digester.getRulesValidation()) {
            digester.getLogger().warn("[SetContextPropertiesRule]{" + digester.getMatch() +
                    "} Setting property '" + name + "' to '" +
                    value + "' did not find a matching property.");
        }
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:31,代码来源:SetContextPropertiesRule.java

示例5: startElement

import org.xml.sax.Attributes; //导入方法依赖的package包/类
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    if (atts != null) {
        boolean eos = false;
        if (namespaceURI == DSIG_NS || XENC_NS == namespaceURI) {
            eos = true;
        }
        int length = atts.getLength();
        AttributesImpl attrImpl = new AttributesImpl();
        for (int i = 0; i < length; i++) {
            String name = atts.getLocalName(i);
            if (name != null && (name.equals("Id"))) {
                if (eos || atts.getURI(i) == WSU_NS) {
                    attrImpl.addAttribute(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), ID_NAME, atts.getValue(i));
                } else {
                    attrImpl.addAttribute(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), atts.getType(i), atts.getValue(i));
                }
            } else {
                attrImpl.addAttribute(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), atts.getType(i), atts.getValue(i));
            }
        }
        super.startElement(namespaceURI, localName, qName, attrImpl);
    } else {
        super.startElement(namespaceURI, localName, qName, atts);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:SAX2DOMTest.java

示例6: begin

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Handle the beginning of an XML element.
 *
 * @param attributes
 *            The attributes of this element
 *
 * @exception Exception
 *                if a processing error occurs
 */
@Override
public void begin(String namespace, String nameX, Attributes attributes) throws Exception {

	for (int i = 0; i < attributes.getLength(); i++) {
		String name = attributes.getLocalName(i);
		if ("".equals(name)) {
			name = attributes.getQName(i);
		}
		if ("path".equals(name) || "docBase".equals(name)) {
			continue;
		}
		String value = attributes.getValue(i);
		if (!digester.isFakeAttribute(digester.peek(), name)
				&& !IntrospectionUtils.setProperty(digester.peek(), name, value) && digester.getRulesValidation()) {
			digester.getLogger().warn("[SetContextPropertiesRule]{" + digester.getMatch() + "} Setting property '"
					+ name + "' to '" + value + "' did not find a matching property.");
		}
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:30,代码来源:SetContextPropertiesRule.java

示例7: begin

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Handle the beginning of an XML element.
 *
 * @param attributes
 *            The attributes of this element
 *
 * @exception Exception
 *                if a processing error occurs
 */
@Override
public void begin(String namespace, String nameX, Attributes attributes) throws Exception {

	for (int i = 0; i < attributes.getLength(); i++) {
		String name = attributes.getLocalName(i);
		if ("".equals(name)) {
			name = attributes.getQName(i);
		}
		String value = attributes.getValue(i);
		if (!excludes.containsKey(name)) {
			if (!digester.isFakeAttribute(digester.peek(), name)
					&& !IntrospectionUtils.setProperty(digester.peek(), name, value)
					&& digester.getRulesValidation()) {
				digester.getLogger().warn("[SetAllPropertiesRule]{" + digester.getMatch() + "} Setting property '"
						+ name + "' to '" + value + "' did not find a matching property.");
			}
		}
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:30,代码来源:SetAllPropertiesRule.java

示例8: addAttributes

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Add the contents of the attribute list to this list.
 *
 * @param atts List of attributes to add to this list
 */
public void addAttributes(Attributes atts)
{

  int nAtts = atts.getLength();

  for (int i = 0; i < nAtts; i++)
  {
    String uri = atts.getURI(i);

    if (null == uri)
      uri = "";

    String localName = atts.getLocalName(i);
    String qname = atts.getQName(i);
    int index = this.getIndex(uri, localName);
    // System.out.println("MutableAttrListImpl#addAttributes: "+uri+":"+localName+", "+index+", "+atts.getQName(i)+", "+this);
    if (index >= 0)
      this.setAttribute(index, uri, localName, qname, atts.getType(i),
                        atts.getValue(i));
    else
      addAttribute(uri, localName, qname, atts.getType(i),
                   atts.getValue(i));
  }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:MutableAttrListImpl.java

示例9: startElement

import org.xml.sax.Attributes; //导入方法依赖的package包/类
@Override
public void startElement(String uri, String name, String qName, Attributes atts) throws SAXException 
{
    mAttributes.clear();
    for (int i=0; i < atts.getLength(); ++i) {
        String attName = atts.getLocalName(i);
        mAttributes.put(attName, atts.getValue(i));
    }
    
    mContentBuilder.setLength(0);
    
    mTagStack.add(name);

    String xmlPath = getXMLPath();
    
    onAsyncElementStart(xmlPath, name, mAttributes);
    
    Method method = mStartHandlers.get(xmlPath);
    if (method != null) {
        try {
            method.invoke(XmlSaxTask.this, mAttributes);
        } 
        catch (Exception e) {
            throw new RuntimeException(e);
        } 
    }
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:28,代码来源:XmlSaxTask.java

示例10: setAttributes

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Copy an entire Attributes object.
 *
 * <p>It may be more efficient to reuse an existing object
 * rather than constantly allocating new ones.</p>
 *
 * @param atts The attributes to copy.
 */
public void setAttributes (Attributes atts)
{
clear();
length = atts.getLength();
data = new String[length*5];
for (int i = 0; i < length; i++) {
    data[i*5] = atts.getURI(i);
    data[i*5+1] = atts.getLocalName(i);
    data[i*5+2] = atts.getQName(i);
    data[i*5+3] = atts.getType(i);
    data[i*5+4] = atts.getValue(i);
}
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:AttributesImpl.java

示例11: startElement

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Adds a new child {@link org.w3c.dom.Element Element} to the current
 * node.
 * 
 * @param namespaceURI the namespace URI
 * @param localName the local name
 * @param qName the qualified (prefixed) name
 * @param atts the list of attributes
 * @throws SAXException if the DOM implementation throws an exception
 */
@Override
public void startElement(String namespaceURI, String localName,
                         String qName, Attributes atts)
    throws SAXException {

    try {
        Node previousTop = top;
        if ((localName == null) || (localName.length() == 0)) { 
            top = doc.createElement(qName);
        } else {
            top = doc.createElementNS(namespaceURI, localName);
        }
        for (int i = 0; i < atts.getLength(); i++) {
            Attr attr = null;
            if ((atts.getLocalName(i) == null) ||
                (atts.getLocalName(i).length() == 0)) {
                attr = doc.createAttribute(atts.getQName(i));
                attr.setNodeValue(atts.getValue(i));
                ((Element)top).setAttributeNode(attr);
            } else {
                attr = doc.createAttributeNS(atts.getURI(i),
                                             atts.getLocalName(i));
                attr.setNodeValue(atts.getValue(i));
                ((Element)top).setAttributeNodeNS(attr);
            }
        }
        previousTop.appendChild(top);
        depth++;
    } catch (DOMException e) {
        throw new SAXException(e.getMessage(), e);
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:44,代码来源:NodeCreateRule.java

示例12: startElement

import org.xml.sax.Attributes; //导入方法依赖的package包/类
@Override
public void startElement(
  ParseContext context,
  String       namespaceURI,
  String       localName,
  Attributes   attrs) throws SAXParseException
{
  _type = attrs.getValue(NAMESPACE, "type");
  if (_type == null)
    logError(context, "tr:type attribute not on component", null);
  String facet = attrs.getValue(NAMESPACE, "facet");
  _definition = new ComponentDefinition(_type, _info);
  for (int i = 0; i < attrs.getLength(); i++)
  {
    if ("".equals(attrs.getURI(i)))
    {
      String name = attrs.getLocalName(i);
      String valueStr = attrs.getValue(i);
      _definition.getAttributes().put(name, valueStr);
    }
  }

  if (_parent != null)
  {
    if (facet != null)
      _parent.getFacets().put(facet, _definition);
    else
      _parent.getChildren().add(_definition);
  }

  _definition.setUsesUpload(
     "true".equals(attrs.getValue(NAMESPACE, "usesUpload")));
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:34,代码来源:TestScriptParser.java

示例13: startElement

import org.xml.sax.Attributes; //导入方法依赖的package包/类
public void startElement(String namespace, String localName, String qName, Attributes attrs) {
  final Element tmp = (Element) _document.createElementNS(namespace, qName);

  // Add name space declarations first
  if (_namespaceDecls != null) {
    final int nDecls = _namespaceDecls.size();
    for (int i = 0; i < nDecls; i++) {
      final String prefix = (String) _namespaceDecls.elementAt(i++);

      if (prefix == null || prefix.equals(EMPTYSTRING)) {
        tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX, (String) _namespaceDecls.elementAt(i));
      } else {
        tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix,
            (String) _namespaceDecls.elementAt(i));
      }
    }
    _namespaceDecls.clear();
  }

  // Add attributes to element
  final int nattrs = attrs.getLength();
  for (int i = 0; i < nattrs; i++) {
    if (attrs.getLocalName(i) == null) {
      tmp.setAttribute(attrs.getQName(i), attrs.getValue(i));
    } else {
      tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i), attrs.getValue(i));
    }
  }

  // Append this new node onto current stack node
  Node last = _nodeStk.peek();
  last.appendChild(tmp);

  // Push this node onto stack
  _nodeStk.push(tmp);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:37,代码来源:Sax2Dom.java

示例14: handleFxReference

import org.xml.sax.Attributes; //导入方法依赖的package包/类
@NbBundle.Messages({
    "# {0} - attribute local name",
    "ERR_unexpectedReferenceAttribute=Unexpected attribute in fx:reference or fx:copy: {0}",
    "ERR_missingReferenceSource=Missing 'source' attribute in fx:reference or fx:copy"
})
private FxNode handleFxReference(Attributes atts, boolean copy) {
    String refId = null;
    String id = null;
    
    for (int i = 0; i < atts.getLength(); i++) {
        String ns = atts.getURI(i);
        String name = atts.getLocalName(i);
        if (!isFxmlNamespaceUri(ns)) {
            if (FX_ATTR_REFERENCE_SOURCE.equals(name) && refId == null) {
                refId = atts.getValue(i);
            } else if (!copy) {
                // error, references do not support normal attributes
                addAttributeError(atts.getQName(i),
                    "invalid-reference-attribute",
                    ERR_unexpectedReferenceAttribute(name),
                    name
                );
            }
        } else {
            if (FX_ID.equals(name) && id == null) {
                id = atts.getValue(i);
            } else {
                // error, unexpected attribute
                addAttributeError(atts.getQName(i),
                    "invalid-reference-attribute",
                    ERR_unexpectedReferenceAttribute(name),
                    name
                );
            }
        }
    }
    
    FxObjectBase ref = accessor.createCopyReference(copy, refId);
    if (refId == null || "".equals(refId)) {
        // error, no source attribute found
        addError(
                "missing-reference-source",
                ERR_missingReferenceSource()
        );
        accessor.makeBroken(ref);
    }
    return ref;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:FxModelBuilder.java

示例15: begin

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Process the beginning of this element.
 *
 * @param namespace the namespace URI of the matching element, or an 
 *   empty string if the parser is not namespace aware or the element has
 *   no namespace
 * @param theName the local name if the parser is namespace aware, or just 
 *   the element name otherwise
 * @param attributes The attribute list for this element
 * 
 * @exception NoSuchMethodException if the bean does not
 *  have a writable property of the specified name
 */
@Override
public void begin(String namespace, String theName, Attributes attributes)
        throws Exception {

    // Identify the actual property name and value to be used
    String actualName = null;
    String actualValue = null;
    for (int i = 0; i < attributes.getLength(); i++) {
        String name = attributes.getLocalName(i);
        if ("".equals(name)) {
            name = attributes.getQName(i);
        }
        String value = attributes.getValue(i);
        if (name.equals(this.name)) {
            actualName = value;
        } else if (name.equals(this.value)) {
            actualValue = value;
        }
    }

    // Get a reference to the top object
    Object top = digester.peek();

    // Log some debugging information
    if (digester.log.isDebugEnabled()) {
        digester.log.debug("[SetPropertyRule]{" + digester.match +
                "} Set " + top.getClass().getName() + " property " +
                actualName + " to " + actualValue);
    }

    // Set the property (with conversion as necessary)
    if (!digester.isFakeAttribute(top, actualName) 
            && !IntrospectionUtils.setProperty(top, actualName, actualValue) 
            && digester.getRulesValidation()) {
        digester.log.warn("[SetPropertyRule]{" + digester.match +
                "} Setting property '" + name + "' to '" +
                value + "' did not find a matching property.");
    }

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:54,代码来源:SetPropertyRule.java


注:本文中的org.xml.sax.Attributes.getLocalName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。