org.xml.sax.Attributes#getValue ( )源码实例Demo

下面列出了org.xml.sax.Attributes#getValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jasperreports   文件: JRPartFactory.java
protected PartEvaluationTime readEvaluationTime(Attributes atts)
{
	PartEvaluationTime evaluationTime = null;
	String evaluationTimeAttr = atts.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime);
	if (evaluationTimeAttr != null)
	{
		if (evaluationTimeAttr.equals(PartEvaluationTimeType.GROUP.getName()))
		{
			String evaluationGroupAttr = atts.getValue(JRXmlConstants.ATTRIBUTE_evaluationGroup);
			evaluationTime = StandardPartEvaluationTime.forGroup(evaluationGroupAttr);
		}
		else
		{
			evaluationTime = StandardPartEvaluationTime.forType(evaluationTimeAttr);
		}
	}
	return evaluationTime;
}
 
源代码2 项目: jasperreports   文件: JRChartPlotFactory.java
@Override
public Object createObject(Attributes atts)
{
	int seriesIndex = -1;
	Color color = null;
	
	String seriesNumber = atts.getValue(JRXmlConstants.ATTRIBUTE_seriesOrder);
	if (seriesNumber != null && seriesNumber.length() > 0)
	{
		seriesIndex = Integer.valueOf(seriesNumber);
	}
	String colorName = atts.getValue(JRXmlConstants.ATTRIBUTE_color);
	if (colorName != null && colorName.length() > 0)
	{
		color = JRColorUtil.getColor(colorName, null);
	}
	
	return new JRBaseChartPlot.JRBaseSeriesColor(seriesIndex, color);
}
 
源代码3 项目: jtransc   文件: ASMContentHandler.java
@Override
public void begin(final String name, final Attributes attrs) {
    @SuppressWarnings("unchecked")
    ArrayList<Object> types = (ArrayList<Object>) ((HashMap<?, ?>) peek())
            .get(name);
    String type = attrs.getValue("type");
    if ("uninitialized".equals(type)) {
        types.add(getLabel(attrs.getValue("label")));
    } else {
        Integer t = TYPES.get(type);
        if (t == null) {
            types.add(type);
        } else {
            types.add(t);
        }
    }
}
 
源代码4 项目: JDKSourceCode1.8   文件: SynthParser.java
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);
}
 
源代码5 项目: netbeans   文件: ResourcesReader.java
@Override
public void readAttributes(String qname, Attributes attributes) throws
        SAXException {
    properties = new HashMap<String, String>();

    String resourceName = attributes.getValue(keyName);
    properties.put(keyName, resourceName);

    int attrLen = attributes.getLength();
    for (int i = 0 ; i < attrLen ; i++) {
        String name = attributes.getQName(i);
        String value = attributes.getValue(i);
        if (name != null && name.length() > 0 && value != null && value.
                length() > 0) {
            properties.put(name, value);
        }
    }
}
 
源代码6 项目: openjdk-8   文件: WSDLInternalizationLogic.java
@Override
        protected String findExternalResource( String nsURI, String localName, Attributes atts) {
            if(WSDLConstants.NS_WSDL.equals(nsURI) && "import".equals(localName)){
//                if(parent.isExtensionMode()){
//                    //TODO: add support for importing schema using wsdl:import
//                }
                return atts.getValue("location");
            }

            // We don't need to do this anymore, JAXB handles the schema imports, includes etc., but this is useful for the clientJar option in
            // fetching  the imported schemas to package in the jar..
            if (parent.options.clientjar != null) {
                if (SchemaConstants.NS_XSD.equals(nsURI) && "import".equals(localName)) {
                    return atts.getValue("schemaLocation");
                }
            }
            return null;
        }
 
源代码7 项目: jdk8u60   文件: SynthParser.java
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);
}
 
源代码8 项目: jasperreports   文件: JRScriptletFactory.java
protected void setScriptletAttributes(JRDesignScriptlet scriptlet, Attributes atts)
{
	scriptlet.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name));
	
	if (atts.getValue(JRXmlConstants.ATTRIBUTE_class) != null)
	{
		scriptlet.setValueClassName(atts.getValue(JRXmlConstants.ATTRIBUTE_class));
	}
}
 
源代码9 项目: netbeans   文件: JB7DatasourceHandler.java
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
    content.setLength(0);
    if ("datasources".equals(qName)) {
        isDatasources = true;
    } else if (isDatasources && "datasource".equals(qName)) {
        isDatasource = true;
        jndiName = attributes.getValue("jndi-name");
    } else if (isDatasource && "security".equals(qName)) {
        isSecurity = true;
    }
}
 
源代码10 项目: openjdk-8   文件: SynthParser.java
private void startBind(Attributes attributes) throws SAXException {
    ParsedSynthStyle style = null;
    String path = null;
    int type = -1;

    for(int i = attributes.getLength() - 1; i >= 0; i--) {
        String key = attributes.getQName(i);

        if (key.equals(ATTRIBUTE_STYLE)) {
            style = (ParsedSynthStyle)lookup(attributes.getValue(i),
                                              ParsedSynthStyle.class);
        }
        else if (key.equals(ATTRIBUTE_TYPE)) {
            String typeS = attributes.getValue(i).toUpperCase();

            if (typeS.equals("NAME")) {
                type = DefaultSynthStyleFactory.NAME;
            }
            else if (typeS.equals("REGION")) {
                type = DefaultSynthStyleFactory.REGION;
            }
            else {
                throw new SAXException("bind: unknown type " + typeS);
            }
        }
        else if (key.equals(ATTRIBUTE_KEY)) {
            path = attributes.getValue(i);
        }
    }
    if (style == null || path == null || type == -1) {
        throw new SAXException("bind: you must specify a style, type " +
                               "and key");
    }
    try {
        _factory.addStyle(style, path, type);
    } catch (PatternSyntaxException pse) {
        throw new SAXException("bind: " + path + " is not a valid " +
                               "regular expression");
    }
}
 
源代码11 项目: easyexcel   文件: MergeCellTagHandler.java
@Override
public void startElement(XlsxReadContext xlsxReadContext, String name, Attributes attributes) {
    String ref = attributes.getValue(ExcelXmlConstants.ATTRIBUTE_REF);
    if (StringUtils.isEmpty(ref)) {
        return;
    }
    CellExtra cellExtra = new CellExtra(CellExtraTypeEnum.MERGE, null, ref);
    xlsxReadContext.readSheetHolder().setCellExtra(cellExtra);
    xlsxReadContext.analysisEventProcessor().extra(xlsxReadContext);
}
 
源代码12 项目: Bytecoder   文件: SynthParser.java
private void startBind(Attributes attributes) throws SAXException {
    ParsedSynthStyle style = null;
    String path = null;
    int type = -1;

    for(int i = attributes.getLength() - 1; i >= 0; i--) {
        String key = attributes.getQName(i);

        if (key.equals(ATTRIBUTE_STYLE)) {
            style = (ParsedSynthStyle)lookup(attributes.getValue(i),
                                              ParsedSynthStyle.class);
        }
        else if (key.equals(ATTRIBUTE_TYPE)) {
            String typeS = attributes.getValue(i).toUpperCase();

            if (typeS.equals("NAME")) {
                type = DefaultSynthStyleFactory.NAME;
            }
            else if (typeS.equals("REGION")) {
                type = DefaultSynthStyleFactory.REGION;
            }
            else {
                throw new SAXException("bind: unknown type " + typeS);
            }
        }
        else if (key.equals(ATTRIBUTE_KEY)) {
            path = attributes.getValue(i);
        }
    }
    if (style == null || path == null || type == -1) {
        throw new SAXException("bind: you must specify a style, type " +
                               "and key");
    }
    try {
        _factory.addStyle(style, path, type);
    } catch (PatternSyntaxException pse) {
        throw new SAXException("bind: " + path + " is not a valid " +
                               "regular expression");
    }
}
 
源代码13 项目: jpa-unit   文件: GraphMLReader.java
private String findAttribute(final String localName, final Attributes attributes) {
    for (int i = 0; i < attributes.getLength(); i++) {
        final String attrLocalName = attributes.getLocalName(i);
        if (attrLocalName.equals(localName)) {
            return attributes.getValue(i);
        }
    }
    return null;
}
 
源代码14 项目: JByteMod-Beta   文件: ASMContentHandler.java
@Override
public final void begin(final String element, final Attributes attrs) {
  String owner = attrs.getValue("owner");
  String name = attrs.getValue("name");
  String desc = attrs.getValue("desc");
  cv.visitOuterClass(owner, name, desc);
}
 
源代码15 项目: jdk8u60   文件: AbstractLDMLHandler.java
boolean isIgnored(Attributes attributes) {
    if (attributes.getValue("alt") != null) {
        return true;
    }
    String draftValue = attributes.getValue("draft");
    if (draftValue != null) {
        return DraftType.getDefault().ordinal() > DraftType.forKeyword(draftValue).ordinal();
    }
    return false;
}
 
源代码16 项目: jasperreports   文件: JRChartPlotFactory.java
@Override
@SuppressWarnings("deprecation")
public Object createObject(Attributes atts)
{
	JRChartPlot plot = (JRChartPlot) digester.peek();

	Color color = JRColorUtil.getColor(atts.getValue(JRXmlConstants.ATTRIBUTE_backcolor), Color.black);
	if (color != null)
	{
		plot.setBackcolor(color);
	}

	PlotOrientationEnum orientation = PlotOrientationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_orientation));
	if (orientation != null)
	{
		plot.setOrientation(orientation);
	}
	String foregroundAlpha = atts.getValue(JRXmlConstants.ATTRIBUTE_foregroundAlpha);
	if (foregroundAlpha != null && foregroundAlpha.length() > 0)
	{
		plot.setForegroundAlpha(Float.valueOf(foregroundAlpha));
	}
	String backgroundAlpha = atts.getValue(JRXmlConstants.ATTRIBUTE_backgroundAlpha);
	if (backgroundAlpha != null && backgroundAlpha.length() > 0)
	{
		plot.setBackgroundAlpha(Float.valueOf(backgroundAlpha));
	}
	String labelRotation = atts.getValue(JRXmlConstants.ATTRIBUTE_labelRotation);
	if (labelRotation != null && labelRotation.length() > 0)
	{
		plot.setLabelRotation(Double.valueOf(labelRotation));
	}
	return plot;
}
 
protected String findExternalResource( String nsURI, String localName, Attributes atts) {
    if( WellKnownNamespace.XML_SCHEMA.equals(nsURI)
    && ("import".equals(localName) || "include".equals(localName) ) )
        return atts.getValue("schemaLocation");
    else
        return null;
}
 
源代码18 项目: openjdk-8-source   文件: AbstractLDMLHandler.java
boolean isIgnored(Attributes attributes) {
    if (attributes.getValue("alt") != null) {
        return true;
    }
    String draftValue = attributes.getValue("draft");
    if (draftValue != null) {
        return DraftType.getDefault().ordinal() > DraftType.forKeyword(draftValue).ordinal();
    }
    return false;
}
 
源代码19 项目: openjdk-jdk8u-backup   文件: AttributesImpl.java
/**
 * 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);
}
}
 
源代码20 项目: Tomcat8-Source-Read   文件: Validator.java
@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());
}