Java Code Examples for org.xml.sax.Attributes#getValue()
The following examples show how to use
org.xml.sax.Attributes#getValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SynthParser.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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); }
Example 2
Source File: JRPartFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
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; }
Example 3
Source File: WSDLInternalizationLogic.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@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; }
Example 4
Source File: JRChartPlotFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
@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); }
Example 5
Source File: ASMContentHandler.java From jtransc with Apache License 2.0 | 6 votes |
@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); } } }
Example 6
Source File: SynthParser.java From JDKSourceCode1.8 with MIT License | 6 votes |
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); }
Example 7
Source File: ResourcesReader.java From netbeans with Apache License 2.0 | 6 votes |
@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); } } }
Example 8
Source File: ASMContentHandler.java From JByteMod-Beta with GNU General Public License v2.0 | 5 votes |
@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); }
Example 9
Source File: AttributesImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 10
Source File: AbstractLDMLHandler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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; }
Example 11
Source File: XMLSchemaInternalizationLogic.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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; }
Example 12
Source File: JRChartPlotFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@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; }
Example 13
Source File: AbstractLDMLHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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; }
Example 14
Source File: JRScriptletFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
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)); } }
Example 15
Source File: GraphMLReader.java From jpa-unit with Apache License 2.0 | 5 votes |
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; }
Example 16
Source File: SynthParser.java From Bytecoder with Apache License 2.0 | 5 votes |
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"); } }
Example 17
Source File: MergeCellTagHandler.java From easyexcel with Apache License 2.0 | 5 votes |
@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); }
Example 18
Source File: SynthParser.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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"); } }
Example 19
Source File: JB7DatasourceHandler.java From netbeans with Apache License 2.0 | 5 votes |
@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; } }
Example 20
Source File: Validator.java From Tomcat8-Source-Read with MIT License | 4 votes |
@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()); }