本文整理汇总了Java中org.xml.sax.Attributes.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Attributes.getValue方法的具体用法?Java Attributes.getValue怎么用?Java Attributes.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xml.sax.Attributes
的用法示例。
在下文中一共展示了Attributes.getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: startPdx
import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void startPdx(Attributes atts) {
String readSerialized = atts.getValue(READ_SERIALIZED);
if (readSerialized != null) {
cache.setPdxReadSerialized(Boolean.parseBoolean(readSerialized));
}
String ignoreUnreadFields = atts.getValue(IGNORE_UNREAD_FIELDS);
if (ignoreUnreadFields != null) {
cache.setPdxIgnoreUnreadFields(Boolean.parseBoolean(ignoreUnreadFields));
}
String persistent = atts.getValue(PERSISTENT);
if (persistent != null) {
cache.setPdxPersistent(Boolean.parseBoolean(persistent));
}
String diskStoreName = atts.getValue(DISK_STORE_NAME);
if (diskStoreName != null) {
cache.setPdxDiskStore(diskStoreName);
}
}
示例3: createObject
import org.xml.sax.Attributes; //导入方法依赖的package包/类
public Object createObject(Attributes attributes) {
// Identify the name of the class to instantiate
String className = attributes.getValue("className");
if (className == null) {
ModuleConfig mc = (ModuleConfig) digester.peek();
className = mc.getActionFormBeanClass();
}
// Instantiate the new object and return it
Object actionFormBean = null;
try {
actionFormBean =
RequestUtils.applicationInstance(className);
} catch (Exception e) {
digester.getLogger().error(
"ActionFormBeanFactory.createObject: ", e);
}
return actionFormBean;
}
示例4: 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;
}
示例5: begin
import org.xml.sax.Attributes; //导入方法依赖的package包/类
@Override
public void begin(final String name, final Attributes attrs) {
String desc = attrs.getValue("desc");
boolean visible = Boolean.valueOf(attrs.getValue("visible"))
.booleanValue();
int typeRef = Integer.parseInt(attrs.getValue("typeRef"));
TypePath typePath = TypePath.fromString(attrs.getValue("typePath"));
Object v = peek();
if (v instanceof ClassVisitor) {
push(((ClassVisitor) v).visitTypeAnnotation(typeRef, typePath,
desc, visible));
} else if (v instanceof FieldVisitor) {
push(((FieldVisitor) v).visitTypeAnnotation(typeRef, typePath,
desc, visible));
} else if (v instanceof MethodVisitor) {
push(((MethodVisitor) v).visitTypeAnnotation(typeRef, typePath,
desc, visible));
}
}
示例6: setAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Copy an entire Attributes object.
*
* @param atts The attributes to copy.
*/
public void setAttributes(Attributes atts) {
_length = atts.getLength();
if (_length > 0) {
if (_length >= _algorithmData.length) {
resizeNoCopy();
}
int index = 0;
for (int i = 0; i < _length; i++) {
_data[index++] = atts.getURI(i);
_data[index++] = atts.getLocalName(i);
_data[index++] = atts.getQName(i);
_data[index++] = atts.getType(i);
_data[index++] = atts.getValue(i);
index++;
_toIndex[i] = false;
_alphabets[i] = null;
}
}
}
示例7: startElement
import org.xml.sax.Attributes; //导入方法依赖的package包/类
@Override
public void startElement(String name, Attributes attrs) {
switch(name) {
case "Settings":
String type = attrs.getValue("xsi:type");
switch(type) {
case "GoogleSettings":
current = new Host(protocols.forType(Protocol.Type.googlestorage));
break;
case "S3Settings":
case "DunkelSettings":
current = new Host(protocols.forType(Protocol.Type.s3));
break;
default:
log.warn("Unsupported connection type:" + type);
break;
}
break;
}
}
示例8: startDeviceElement
import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void startDeviceElement(Attributes attributes) {
device = new Device();
device.setId(attributes.getValue(ATTRIBUTE_DEVICE_ID));
if (attributes.getValue(ATTRIBUTE_DEVICE_PARENT_ID) != null) {
device.setParentId(attributes.getValue(ATTRIBUTE_DEVICE_PARENT_ID));
}
properties = new HashMap();
}
示例9: parseInt
import org.xml.sax.Attributes; //导入方法依赖的package包/类
private static int parseInt(Attributes attrs, String attr,
int def) {
int value = def;
String temp = attrs.getValue(attr);
if (temp != null) {
try {
value = Integer.parseInt(temp);
} catch (NumberFormatException nfe) {
nfe.printStackTrace();
}
}
return value;
}
示例10: getValidatedBillingID
import org.xml.sax.Attributes; //导入方法依赖的package包/类
String getValidatedBillingID(Attributes atts, String techProductId)
throws SAXException {
String billingID = atts.getValue(ATTRIBUTE_BILLING_IDENTIFIER);
if (billingID != null) {
billingID = billingID.trim();
} else {
billingID = "";
}
return getBillingAdapter(billingID, techProductId)
.getBillingIdentifier();
}
示例11: startElement
import org.xml.sax.Attributes; //导入方法依赖的package包/类
@Override
public void startElement(
String uri,
String localName,
String qName,
Attributes attributes) throws SAXException {
accumulator.setLength(0);
if ("terminaldefinition".equals(qName)) { // NOI18N
context.push(Context.root);
String xmlns = attributes.getValue("xmlns"); // NOI18N
if (xmlns != null) {
int lastSlash = xmlns.lastIndexOf('/'); // NOI18N
if (lastSlash >= 0 && (lastSlash + 1 < xmlns.length())) {
String versionStr = xmlns.substring(lastSlash + 1);
if (versionStr.length() > 0) {
try {
version = Integer.parseInt(versionStr);
} catch (NumberFormatException ex) {
// skip
log.fine("Incorrect version information:" + xmlns); // NOI18N
}
log.log(Level.FINE, "Terminal definition XML version: " + version); // NOI18N
}
} else {
log.fine("Incorrect version information:" + xmlns); // NOI18N
}
}
} else {
context.push(elementStarted(qName, attributes));
}
}
示例12: processPricedEvent
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Process a priced event element (get the corresponding event and insert a
* new priced event).
*
* @param techProduct
* the technical product which defines the events.
* @param product
* the product with the price model for the priced event.
* @param qName
* the qualified name (with prefix) of the current element.
* @param atts
* the attributes attached to the current element.
*/
private void processPricedEvent(TechnicalProduct techProduct,
Product product, String qName, Attributes atts) {
String type = getMandatoryValue(atts, ATTRIBUTE_TYPE);
String id = atts.getValue(ATTRIBUTE_ID);
String price = getMandatoryValue(atts, ATTRIBUTE_PRICE);
if (isBlank(type) || isBlank(id) || isBlank(price)
|| techProduct == null || product == null) {
return;
}
// find the event
Event event = null;
if (type.equals(EventType.PLATFORM_EVENT.toString())
&& id.equals(PlatformEventIdentifier.USER_LOGIN_TO_SERVICE)) {
event = getPlatformEvent(id);
} else if (type.equals(EventType.PLATFORM_EVENT.toString())
&& id.equals(PlatformEventIdentifier.USER_LOGOUT_FROM_SERVICE)) {
event = getPlatformEvent(id);
} else if (type.equals(EventType.SERVICE_EVENT.toString())) {
List<Event> events = techProduct.getEvents();
event = findEvent(events, id);
} else {
addError(qName, "Unknown event type '" + type + "'");
}
// add the priced event
if (event != null) {
PricedEvent pricedEvent = new PricedEvent();
pricedEvent.setPriceModel(product.getPriceModel());
pricedEvent.setEvent(event);
pricedEvent.setEventPrice(new BigDecimal(price));
persist(pricedEvent);
} else {
addError(qName, "Unknown event type:'" + type + "' id:'" + id + "'");
}
}
示例13: begin
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Process a <code><user></code> element from the XML database file.
*
* @param attributes The attribute list for this element
*/
public void begin(Attributes attributes) throws Exception {
String username = attributes.getValue("name");
if (username == null) {
username = attributes.getValue("username");
}
String password = attributes.getValue("password");
String roles = attributes.getValue("roles");
MemoryRealm realm =
(MemoryRealm) digester.peek(digester.getCount() - 1);
realm.addUser(username, password, roles);
}
示例14: findExternalResource
import org.xml.sax.Attributes; //导入方法依赖的package包/类
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;
}
示例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());
}