List of usage examples for org.xml.sax Attributes getValue
public abstract String getValue(String uri, String localName);
From source file:com.adobe.acs.commons.rewriter.impl.VersionedClientlibsTransformerFactory.java
private Attributes versionClientLibs(final String elementName, final Attributes attrs, final SlingHttpServletRequest request) { if (SaxElementUtils.isCss(elementName, attrs)) { return this.rebuildAttributes(new AttributesImpl(attrs), attrs.getIndex("", ATTR_CSS_PATH), attrs.getValue("", ATTR_CSS_PATH), LibraryType.CSS, request); } else if (SaxElementUtils.isJavaScript(elementName, attrs)) { return this.rebuildAttributes(new AttributesImpl(attrs), attrs.getIndex("", ATTR_JS_PATH), attrs.getValue("", ATTR_JS_PATH), LibraryType.JS, request); } else {//from ww w . java2 s .c o m return attrs; } }
From source file:net.ontopia.topicmaps.db2tm.RelationMapping.java
protected String getValue(Attributes attrs, String name) { return attrs.getValue("", name); }
From source file:net.ontopia.topicmaps.db2tm.RelationMapping.java
protected String getValue(Attributes attrs, String name, String _default) { String result = attrs.getValue("", name); return (result == null ? _default : result); }
From source file:net.bible.service.format.osistohtml.OsisToHtmlSaxHandler.java
@Override public void startElement(String namespaceURI, String sName, // simple name String qName, // qualified name Attributes attrs) { String name = getName(sName, qName); // element name debug(name, attrs, true);/*from w w w .j a v a2 s . co m*/ if (name.equals(OSISUtil.OSIS_ELEMENT_VERSE)) { if (attrs != null) { currentVerseNo = osisIdToVerseNum(attrs.getValue("", OSISUtil.OSIS_ATTR_OSISID)); } else { currentVerseNo++; } if (commonHandlerData.getParameters().isVersePerline()) { //close preceding verse if (currentVerseNo > 1) { write("</div>"); } // start current verse write("<div>"); } writeVerse(currentVerseNo); } else if (name.equals(OSISUtil.OSIS_ELEMENT_TITLE) && commonHandlerData.getParameters().isShowHeadings()) { getWriter().beginInsertAt(currentVersePosition); write("<h1>"); } else if (name.equals(OSISUtil.OSIS_ELEMENT_NOTE)) { noteAndReferenceHandler.startNote(attrs); } else if (name.equals(OSISUtil.OSIS_ELEMENT_REFERENCE)) { noteAndReferenceHandler.startReference(attrs); } else if (name.equals(OSISUtil.OSIS_ELEMENT_LB)) { write(HTML.BR); } else if (name.equals(OSISUtil.OSIS_ELEMENT_L)) { lHandler.startL(attrs); } else if (name.equals(OSISUtil.OSIS_ELEMENT_P)) { write("<p />"); } else if (name.equals(OSISUtil.OSIS_ELEMENT_Q)) { TagHandler tagHandler = tagHandlerMap.get(name); TagHandlerData tagData = tagHandler.createData(attrs, commonHandlerData); stack.push(tagData); tagHandler.start(tagData, commonHandlerData); } else if (name.equals("transChange")) { write("<span class='transChange'>"); } else if ((commonHandlerData.getParameters().isShowStrongs() || commonHandlerData.getParameters().isShowMorphology()) && name.equals(OSISUtil.OSIS_ELEMENT_W) && isAttr(OSISUtil.ATTRIBUTE_W_LEMMA, attrs)) { // Strongs & morphology references // example of strongs refs: <w lemma="strong:H0430">God</w> <w lemma="strong:H0853 strong:H01254" morph="strongMorph:TH8804">created</w> // better example, because we just use Robinson: <w lemma="strong:G652" morph="robinson:N-NSM" src="2">an apostle</w> String strongsLemma = attrs.getValue(OSISUtil.ATTRIBUTE_W_LEMMA); if (strongsLemma.startsWith(OSISUtil.LEMMA_STRONGS)) { String morphology = attrs.getValue(OSISUtil.ATTRIBUTE_W_MORPH); pendingStrongsAndMorphTags = getStrongsAndMorphTags(strongsLemma, morphology); } } else { // log.info("Verse "+currentVerseNo+" unsupported OSIS tag:"+name); } }
From source file:net.pandoragames.far.ui.MimeConfParser.java
public void startElement(String uri, String localName, String qname, Attributes atts) throws SAXException { if (skipCurrentBranch > 0) { skipCurrentBranch++;//from w w w . jav a 2 s . co m return; } String tagName = tagName(localName, qname); if (MimeConfParser.ROOT_NODE_NAME.equals(tagName)) { typeStack.add(FileType.FILE); } else if (typeStack.size() == 0) { throw new SAXException("Illegal root element '" + tagName + "'"); } else if (MimeConfParser.MIME_NODE_NAME.equals(tagName)) { String typeName = atts.getValue("", "name"); if (MimeType.isValidMimeIdentifier(typeName)) { MimeType oldMime = (MimeType) MimeType.getType(typeName); if (oldMime != null) { MimeType.MimeRegistry.remove(oldMime); currentMime = new MimeType(typeName, oldMime.getParentType(), MimeType.MimeRegistry); currentMime.setPredefined(oldMime.isPredefined()); } else { currentMime = new MimeType(typeName, typeStack.get(typeStack.size() - 1), MimeType.MimeRegistry); } typeStack.add(currentMime); String encoding = atts.getValue("", "encoding"); if (encoding != null) { try { if (Charset.isSupported(encoding)) { currentMime.setCharacterset(Charset.forName(encoding)); } else { logger.warn("Unsupported character set '" + encoding + "' specified for mime type " + typeName); } } catch (IllegalCharsetNameException icnx) { logger.warn("Illegal character set '" + encoding + "' specified for mime type " + typeName); } } String extensionList = atts.getValue("", "extensions"); if (extensionList != null) { String[] extensions = extensionList.split("\\s"); for (String ext : extensions) currentMime.addExtension(ext); } } else { skipCurrentBranch = 1; logger.warn("Invalid mime type name: '" + typeName + "': skipping"); return; } } else { String typeName = tagName.toUpperCase(); FileType type = FileType.getType(typeName); if (type == null) { skipCurrentBranch = 1; logger.warn("Unknown tag name '" + tagName + "' encountered: skipping"); return; } typeStack.add(type); } }