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


Java Attributes.getLength方法代码示例

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


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

示例1: startGraphics

import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void startGraphics(Attributes attributes) throws SAXException {
    SynthGraphicsUtils graphics = null;

    for(int i = attributes.getLength() - 1; i >= 0; i--) {
        String key = attributes.getQName(i);
        if (key.equals(ATTRIBUTE_IDREF)) {
            graphics = (SynthGraphicsUtils)lookup(attributes.getValue(i),
                                             SynthGraphicsUtils.class);
        }
    }
    if (graphics == null) {
        throw new SAXException("graphicsUtils: you must supply an idref");
    }
    if (_style != null) {
        _style.setGraphicsUtils(graphics);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:SynthParser.java

示例2: parseForeignAttributes

import org.xml.sax.Attributes; //导入方法依赖的package包/类
public ForeignAttributesImpl parseForeignAttributes( ForeignAttributesImpl next ) {
    ForeignAttributesImpl impl = new ForeignAttributesImpl(createValidationContext(),copyLocator(),next);

    Attributes atts = getCurrentAttributes();
    for( int i=0; i<atts.getLength(); i++ ) {
        if(atts.getURI(i).length()>0) {
            impl.addAttribute(
                atts.getURI(i),
                atts.getLocalName(i),
                atts.getQName(i),
                atts.getType(i),
                atts.getValue(i)
            );
        }
    }

    return impl;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:NGCCRuntimeEx.java

示例3: 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
 */
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:lamsfoundation,项目名称:lams,代码行数:29,代码来源:SetAllPropertiesRule.java

示例4: startStyle

import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void startStyle(Attributes attributes) throws SAXException {
    String id = null;

    _style = null;
    for(int i = attributes.getLength() - 1; i >= 0; i--) {
        String key = attributes.getQName(i);
        if (key.equals(ATTRIBUTE_CLONE)) {
            _style = (ParsedSynthStyle)((ParsedSynthStyle)lookup(
                     attributes.getValue(i), ParsedSynthStyle.class)).
                     clone();
        }
        else if (key.equals(ATTRIBUTE_ID)) {
            id = attributes.getValue(i);
        }
    }
    if (_style == null) {
        _style = new ParsedSynthStyle();
    }
    register(id, _style);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:SynthParser.java

示例5: startBindKey

import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void startBindKey(Attributes attributes) throws SAXException {
    if (_inputMapID == null) {
        // Not in an inputmap, bail.
        return;
    }
    if (_style != null) {
        String key = null;
        String value = null;
        for(int i = attributes.getLength() - 1; i >= 0; i--) {
            String aKey = attributes.getQName(i);

            if (aKey.equals(ATTRIBUTE_KEY)) {
                key = attributes.getValue(i);
            }
            else if (aKey.equals(ATTRIBUTE_ACTION)) {
                value = attributes.getValue(i);
            }
        }
        if (key == null || value == null) {
            throw new SAXException(
                "bindKey: you must supply a key and action");
        }
        _inputMapBindings.add(key);
        _inputMapBindings.add(value);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:SynthParser.java

示例6: findUri

import org.xml.sax.Attributes; //导入方法依赖的package包/类
private String findUri(String prefix, Node n) {

			for (Node p = n; p != null; p = p.getParent()) {
				Attributes attrs = p.getTaglibAttributes();
				if (attrs == null) {
					continue;
				}
				for (int i = 0; i < attrs.getLength(); i++) {
					String name = attrs.getQName(i);
					int k = name.indexOf(':');
					if (prefix == null && k < 0) {
						// prefix not specified and a default ns found
						return attrs.getValue(i);
					}
					if (prefix != null && k >= 0 && prefix.equals(name.substring(k + 1))) {
						return attrs.getValue(i);
					}
				}
			}
			return null;
		}
 
开发者ID:how2j,项目名称:lazycat,代码行数:22,代码来源:Validator.java

示例7: getNumberParseAttr

import org.xml.sax.Attributes; //导入方法依赖的package包/类
private static NumberParse getNumberParseAttr(String name, Attributes attributes) {
	int n = attributes.getLength();
	for (int i = 0; i < n; i++) {
		if (attributes.getLocalName(i).equals(name)) {
			return parseNumbers(attributes.getValue(i));
		}
	}
	return null;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:10,代码来源:SVGParser.java

示例8: _getMapFromList

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Create a Map of name/value pairs from the attrList given
 * to us by the Sax parser.
 *
 * @param attrList List of attributes of an XML element
 * @return Map hashMap of attributes converted to name/value pairs.
 */
@SuppressWarnings("unchecked")
private Map<String, String> _getMapFromList(Attributes attrList)
{
  Map<String, String> attrMap = new HashMap<String, String>();

  for (int i=0; i < attrList.getLength(); i++)
  {
    attrMap.put(attrList.getQName(i), attrList.getValue(i) );
  }

  return attrMap;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:20,代码来源:MenuContentHandlerImpl.java

示例9: parsePathAttributes

import org.xml.sax.Attributes; //导入方法依赖的package包/类
private VdPath parsePathAttributes(Attributes attributes) {
    int len = attributes.getLength();
    VdPath vgPath = new VdPath();

    for (int i = 0; i < len; i++) {
        String name = attributes.getQName(i);
        String value = attributes.getValue(i);
        logger.log(Level.FINE, "name " + name + "value " + value);
        setNameValue(vgPath, name, value);
    }
    return vgPath;
}
 
开发者ID:RaysonYeungHK,项目名称:Svg2AndroidXml,代码行数:13,代码来源:VdParser.java

示例10: search

import org.xml.sax.Attributes; //导入方法依赖的package包/类
String search(Attributes attr, String name, String defaultValue) {
    String result = attr.getValue(name);
    if (result != null) {
        return result;
    }
    if (defaultValue != null) {
        return defaultValue;
    }
    for (int i = 0; i < attr.getLength(); i++) {
        System.out.println(attr.getQName(i) + " " + attr.getValue(attr.getQName(i)));
    }
    throw new InternalError("can't find " + name);
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:14,代码来源:LogParser.java

示例11: findAttributeValue

import org.xml.sax.Attributes; //导入方法依赖的package包/类
private static String findAttributeValue(
        String qnameToFind,
        Attributes attrs) {

    for (int i = 0; i < attrs.getLength(); i++) {
        String qname = attrs.getQName(i);
        if (qname.trim().equalsIgnoreCase(qnameToFind.trim())) {
            return attrs.getValue(i);
        }
    }

    return null;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:14,代码来源:XmlResponsesSaxParser.java

示例12: parsePageDirective

import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void parsePageDirective(Node parent) throws JasperException {
    Attributes attrs = parseAttributes(true);
    Node.PageDirective n = new Node.PageDirective(attrs, start, parent);

    /*
     * A page directive may contain multiple 'import' attributes, each of
     * which consists of a comma-separated list of package names. Store each
     * list with the node, where it is parsed.
     */
    for (int i = 0; i < attrs.getLength(); i++) {
        if ("import".equals(attrs.getQName(i))) {
            n.addImport(attrs.getValue(i));
        }
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:16,代码来源:Parser.java

示例13: startElement

import org.xml.sax.Attributes; //导入方法依赖的package包/类
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
{
	if( !ignoreTag(localName) )
	{
		final Set<String> lookAt;
		if( scanAllAttributes )
		{
			lookAt = new HashSet<String>();
			for( int i = 0; i < atts.getLength(); i++ )
			{
				lookAt.add(atts.getLocalName(i));
			}
		}
		else
		{
			lookAt = RECOGNISED_ATTRIBUTES;
		}

		for( String attr : lookAt )
		{
			checkHref((AttributesImpl) atts, attr);
		}

		super.startElement(outputNamespaces ? uri : "", localName, qName, atts); //$NON-NLS-1$
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:28,代码来源:FindHrefHandler.java

示例14: getAttributesMap

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Returns a map representation of the specified attributes.
 *
 * @param attributes
 *            The attributes which are parsed.
 * @param useQualifiedNames
 *            If <code>true</code> prefixed attribute names are used, if <code>false</code>
 *            local names are used.
 * @return A map with attribute names and the respective values.
 */
private Map<String, String> getAttributesMap(Attributes attributes, boolean useQualifiedNames) {
	Map<String, String> map = new TreeMap<>();
	for (int i = 0; i < attributes.getLength(); i++) {
		if (useQualifiedNames) {
			map.put(attributes.getQName(i), attributes.getValue(i));
		} else {
			map.put(attributes.getLocalName(i), attributes.getValue(i));
		}
	}
	return map;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:22,代码来源:XlsxWorkbookRelationParser.java

示例15: begin

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Implemented to replace the content handler currently in use by a 
 * NodeBuilder.
 * 
 * @param namespaceURI 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 name the local name if the parser is namespace aware, or just 
 *   the element name otherwise
 * @param attributes The attribute list of this element
 * @throws Exception indicates a JAXP configuration problem
 */
public void begin(String namespaceURI, String name, Attributes attributes)
    throws Exception {

    XMLReader xmlReader = getDigester().getXMLReader();
    Document doc = documentBuilder.newDocument();
    NodeBuilder builder = null;
    if (nodeType == Node.ELEMENT_NODE) {
        Element element = null;
        if (getDigester().getNamespaceAware()) {
            element =
                doc.createElementNS(namespaceURI, name);
            for (int i = 0; i < attributes.getLength(); i++) {
                element.setAttributeNS(attributes.getURI(i),
                                       attributes.getLocalName(i),
                                       attributes.getValue(i));
            }
        } else {
            element = doc.createElement(name);
            for (int i = 0; i < attributes.getLength(); i++) {
                element.setAttribute(attributes.getQName(i),
                                     attributes.getValue(i));
            }
        }
        builder = new NodeBuilder(doc, element);
    } else {
        builder = new NodeBuilder(doc, doc.createDocumentFragment());
    }
    xmlReader.setContentHandler(builder);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:NodeCreateRule.java


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