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


Java Attributes.getQName方法代码示例

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


在下文中一共展示了Attributes.getQName方法的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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:SynthParser.java

示例2: 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

示例3: 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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:SynthParser.java

示例4: 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:AttributesImpl.java

示例5: 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

示例6: addAttributes

import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void addAttributes(Attributes attrs) {
    if (attrs != null) {
	int len = attrs.getLength();

	for (int i=0; i<len; i++) {
                   String qName = attrs.getQName(i);
	    if ("version".equals(qName)) {
		continue;
	    }

                   // Bugzilla 35252: http://issues.apache.org/bugzilla/show_bug.cgi?id=35252
                   if(rootAttrs.getIndex(qName) == -1) {
                       rootAttrs.addAttribute(attrs.getURI(i),
                                              attrs.getLocalName(i),
                                              qName,
                                              attrs.getType(i),
                                              attrs.getValue(i));
                   }
	}
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:PageDataImpl.java

示例7: updateAttributes

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Compares the given {@link Attributes} with {@link #fCurrentAttributes}
 * and update the latter accordingly.
 */
private void updateAttributes( Attributes atts ) {
    int len = atts.getLength();
    for( int i=0; i<len; i++ ) {
        String aqn = atts.getQName(i);
        int j = fCurrentAttributes.getIndex(aqn);
        String av = atts.getValue(i);
        if(j==-1) {
            // newly added attribute. add to the current attribute list.

            String prefix;
            int idx = aqn.indexOf(':');
            if( idx<0 ) {
                prefix = null;
            } else {
                prefix = symbolize(aqn.substring(0,idx));
            }

            j = fCurrentAttributes.addAttribute(
                new QName(
                    prefix,
                    symbolize(atts.getLocalName(i)),
                    symbolize(aqn),
                    symbolize(atts.getURI(i))),
                atts.getType(i),av);
        } else {
            // the attribute is present.
            if( !av.equals(fCurrentAttributes.getValue(j)) ) {
                // but the value was changed.
                fCurrentAttributes.setValue(j,av);
            }
        }

        /** Augmentations augs = fCurrentAttributes.getAugmentations(j);
        augs.putItem( Constants.TYPEINFO,
            typeInfoProvider.getAttributeTypeInfo(i) );
        augs.putItem( Constants.ID_ATTRIBUTE,
            typeInfoProvider.isIdAttribute(i)?Boolean.TRUE:Boolean.FALSE ); **/
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:JAXPValidatorComponent.java

示例8: startInputMap

import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void startInputMap(Attributes attributes) throws SAXException {
    _inputMapBindings.clear();
    _inputMapID = null;
    if (_style != null) {
        for(int i = attributes.getLength() - 1; i >= 0; i--) {
            String key = attributes.getQName(i);

            if (key.equals(ATTRIBUTE_ID)) {
                _inputMapID = attributes.getValue(i);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:SynthParser.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: parseGroupAttributes

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

    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);
    }
    return vgGroup;
}
 
开发者ID:RaysonYeungHK,项目名称:Svg2AndroidXml,代码行数:12,代码来源:VdParser.java

示例11: 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:AttributesImpl.java

示例12: handlePropertyTag

import org.xml.sax.Attributes; //导入方法依赖的package包/类
@NbBundle.Messages({
    "# {0} - tag name",
    "ERR_invalidPropertyName=Invalid property name: {0}"
})
private FxNode handlePropertyTag(String propName, Attributes atts) {
    PropertyValue pv;
    
    int errorAttrs = 0;
    for (int i = 0; i < atts.getLength(); i++) {
        String uri = atts.getURI(i);
        if (uri != null) {
            String qn = atts.getQName(i);
            errorAttrs++;
            addAttributeError(qn, 
                "property-namespaced-attribute",
                ERR_propertyElementNamespacedAttribute(qn),
                qn
            );
        }
    }
    
    int stProp = FxXmlSymbols.findStaticProperty(propName);
    switch (stProp) {
        case -1:
            // simple property
            if (!Utilities.isJavaIdentifier(propName)) {
                addError(new ErrorMark(
                    start, end,
                    "invalid-property-name",
                    ERR_invalidPropertyName(propName),
                    propName
                ));
            }
            if (errorAttrs == atts.getLength()) {
                pv = handleSimpleProperty(propName, atts);
            } else {
                pv = handleMapProperty(propName, atts);
            }
            break;
            
        case -2:
            // broken name, but must create a node
            pv = accessor.makeBroken(accessor.createProperty(propName, false));
            // do not add the property to the parent, it's broken beyond repair
            addError(new ErrorMark(
                start, end,
                "invalid-property-name",
                ERR_invalidPropertyName(propName),
                propName
            ));
            break;
            
        default:
            // static property, just ignore for now
            pv = handleStaticProperty(propName.substring(0, stProp), 
                    propName.substring(stProp + 1), atts);
            break;
    }
    
    return pv;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:62,代码来源:FxModelBuilder.java

示例13: handleFxInclude

import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
 * Processes ?include directive
 * 
 * @param include 
 */
@NbBundle.Messages({
    "ERR_missingIncludeName=Missing include name",
    "# {0} - attribute name",
    "ERR_unexpectedIncludeAttribute=Unexpected attribute in fx:include: {0}"
})
private FxNode handleFxInclude(Attributes atts, String localName) {
    String include = null;
    String id = null;
    
    for (int i = 0; i < atts.getLength(); i++) {
        String uri = atts.getURI(i);
        String attName = atts.getLocalName(i);
        if (FX_ATTR_REFERENCE_SOURCE.equals(attName)) {
            include = atts.getValue(i);
            continue;
        }
        if (isFxmlNamespaceUri(uri)) {
            if (FX_ID.equals(attName)) {
                id = atts.getValue(i);
            } else {
                String qName = atts.getQName(i);
                addAttributeError(
                    qName,
                    "unexpected-include-attribute",
                    ERR_unexpectedIncludeAttribute(qName),
                    qName
                );
            }
        }
    }
    if (include == null) {
        // must be some text, otherwise = error
        addAttributeError(
            ContentLocator.ATTRIBUTE_TARGET, 
            "missing-included-name",
            ERR_missingIncludeName()
        );
        
        FxNode n = accessor.createErrorElement(localName);
        initElement(n);
        addError("invalid-fx-element", ERR_invalidFxElement(localName), localName);
        return n;
    }
    // guide: fnames starting with slash are treated relative to the classpath
    FxInclude fxInclude = accessor.createInclude(include, id);
    return fxInclude;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:53,代码来源:FxModelBuilder.java

示例14: visit

import org.xml.sax.Attributes; //导入方法依赖的package包/类
@Override
public void visit(Node.TagDirective n) throws JasperException {
	// Note: Most of the validation is done in TagFileProcessor
	// when it created a TagInfo object from the
	// tag file in which the directive appeared.

	// This method does additional processing to collect page info

	Attributes attrs = n.getAttributes();
	for (int i = 0; attrs != null && i < attrs.getLength(); i++) {
		String attr = attrs.getQName(i);
		String value = attrs.getValue(i);

		if ("language".equals(attr)) {
			if (pageInfo.getLanguage(false) == null) {
				pageInfo.setLanguage(value, n, err, false);
			} else if (!pageInfo.getLanguage(false).equals(value)) {
				err.jspError(n, "jsp.error.tag.conflict.language", pageInfo.getLanguage(false), value);
			}
		} else if ("isELIgnored".equals(attr)) {
			if (pageInfo.getIsELIgnored() == null) {
				pageInfo.setIsELIgnored(value, n, err, false);
			} else if (!pageInfo.getIsELIgnored().equals(value)) {
				err.jspError(n, "jsp.error.tag.conflict.iselignored", pageInfo.getIsELIgnored(), value);
			}
		} else if ("pageEncoding".equals(attr)) {
			if (pageEncodingSeen)
				err.jspError(n, "jsp.error.tag.multi.pageencoding");
			pageEncodingSeen = true;
			compareTagEncodings(value, n);
			n.getRoot().setPageEncoding(value);
		} else if ("deferredSyntaxAllowedAsLiteral".equals(attr)) {
			if (pageInfo.getDeferredSyntaxAllowedAsLiteral() == null) {
				pageInfo.setDeferredSyntaxAllowedAsLiteral(value, n, err, false);
			} else if (!pageInfo.getDeferredSyntaxAllowedAsLiteral().equals(value)) {
				err.jspError(n, "jsp.error.tag.conflict.deferredsyntaxallowedasliteral",
						pageInfo.getDeferredSyntaxAllowedAsLiteral(), value);
			}
		} else if ("trimDirectiveWhitespaces".equals(attr)) {
			if (pageInfo.getTrimDirectiveWhitespaces() == null) {
				pageInfo.setTrimDirectiveWhitespaces(value, n, err, false);
			} else if (!pageInfo.getTrimDirectiveWhitespaces().equals(value)) {
				err.jspError(n, "jsp.error.tag.conflict.trimdirectivewhitespaces",
						pageInfo.getTrimDirectiveWhitespaces(), value);
			}
		}
	}

	// Attributes for imports for this node have been processed by
	// the parsers, just add them to pageInfo.
	pageInfo.addImports(n.getImports());
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:53,代码来源:Validator.java

示例15: visit

import org.xml.sax.Attributes; //导入方法依赖的package包/类
@Override
public void visit(Node.TagDirective n) throws JasperException {
    // Note: Most of the validation is done in TagFileProcessor
    // when it created a TagInfo object from the
    // tag file in which the directive appeared.

    // This method does additional processing to collect page info

    Attributes attrs = n.getAttributes();
    for (int i = 0; attrs != null && i < attrs.getLength(); i++) {
        String attr = attrs.getQName(i);
        String value = attrs.getValue(i);

        if ("language".equals(attr)) {
            if (pageInfo.getLanguage(false) == null) {
                pageInfo.setLanguage(value, n, err, false);
            } else if (!pageInfo.getLanguage(false).equals(value)) {
                err.jspError(n, "jsp.error.tag.conflict.language",
                        pageInfo.getLanguage(false), value);
            }
        } else if ("isELIgnored".equals(attr)) {
            if (pageInfo.getIsELIgnored() == null) {
                pageInfo.setIsELIgnored(value, n, err, false);
            } else if (!pageInfo.getIsELIgnored().equals(value)) {
                err.jspError(n, "jsp.error.tag.conflict.iselignored",
                        pageInfo.getIsELIgnored(), value);
            }
        } else if ("pageEncoding".equals(attr)) {
            if (pageEncodingSeen)
                err.jspError(n, "jsp.error.tag.multi.pageencoding");
            pageEncodingSeen = true;
            compareTagEncodings(value, n);
            n.getRoot().setPageEncoding(value);
        } else if ("deferredSyntaxAllowedAsLiteral".equals(attr)) {
            if (pageInfo.getDeferredSyntaxAllowedAsLiteral() == null) {
                pageInfo.setDeferredSyntaxAllowedAsLiteral(value, n,
                        err, false);
            } else if (!pageInfo.getDeferredSyntaxAllowedAsLiteral()
                    .equals(value)) {
                err
                        .jspError(
                                n,
                                "jsp.error.tag.conflict.deferredsyntaxallowedasliteral",
                                pageInfo
                                        .getDeferredSyntaxAllowedAsLiteral(),
                                value);
            }
        } else if ("trimDirectiveWhitespaces".equals(attr)) {
            if (pageInfo.getTrimDirectiveWhitespaces() == null) {
                pageInfo.setTrimDirectiveWhitespaces(value, n, err,
                        false);
            } else if (!pageInfo.getTrimDirectiveWhitespaces().equals(
                    value)) {
                err
                        .jspError(
                                n,
                                "jsp.error.tag.conflict.trimdirectivewhitespaces",
                                pageInfo.getTrimDirectiveWhitespaces(),
                                value);
            }
        }
    }

    // Attributes for imports for this node have been processed by
    // the parsers, just add them to pageInfo.
    pageInfo.addImports(n.getImports());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:68,代码来源:Validator.java


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