本文整理汇总了Java中org.xml.sax.Attributes类的典型用法代码示例。如果您正苦于以下问题:Java Attributes类的具体用法?Java Attributes怎么用?Java Attributes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Attributes类属于org.xml.sax包,在下文中一共展示了Attributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processUsesConfiguration
import org.xml.sax.Attributes; //导入依赖的package包/类
/**
* Processes the supports-screens node.
* @param attributes the attributes for the supports-screens node.
*/
private void processUsesConfiguration(Attributes attributes) {
mManifestData.mUsesConfiguration = new UsesConfiguration();
mManifestData.mUsesConfiguration.mReqFiveWayNav = getAttributeBooleanValue(
attributes,
AndroidManifest.ATTRIBUTE_REQ_5WAYNAV, true /*hasNamespace*/);
mManifestData.mUsesConfiguration.mReqNavigation = Navigation.getEnum(
getAttributeValue(attributes,
AndroidManifest.ATTRIBUTE_REQ_NAVIGATION, true /*hasNamespace*/));
mManifestData.mUsesConfiguration.mReqHardKeyboard = getAttributeBooleanValue(
attributes,
AndroidManifest.ATTRIBUTE_REQ_HARDKEYBOARD, true /*hasNamespace*/);
mManifestData.mUsesConfiguration.mReqKeyboardType = Keyboard.getEnum(
getAttributeValue(attributes,
AndroidManifest.ATTRIBUTE_REQ_KEYBOARDTYPE, true /*hasNamespace*/));
mManifestData.mUsesConfiguration.mReqTouchScreen = TouchScreen.getEnum(
getAttributeValue(attributes,
AndroidManifest.ATTRIBUTE_REQ_TOUCHSCREEN, true /*hasNamespace*/));
}
示例2: begin
import org.xml.sax.Attributes; //导入依赖的package包/类
/**
* Process the beginning of this element.
*
* @param attributes The attribute list of this element
*/
public void begin(Attributes attributes) throws Exception {
// Identify the name of the class to instantiate
String realClassName = className;
if (attributeName != null) {
String value = attributes.getValue(attributeName);
if (value != null) {
realClassName = value;
}
}
if (digester.log.isDebugEnabled()) {
digester.log.debug("[ObjectCreateRule]{" + digester.match +
"}New " + realClassName);
}
// Instantiate the new object and push it on the context stack
Class clazz = digester.getClassLoader().loadClass(realClassName);
Object instance = clazz.newInstance();
digester.push(instance);
}
示例3: doStartElement
import org.xml.sax.Attributes; //导入依赖的package包/类
@Override
protected void doStartElement(String uri, String name, String qName, Attributes attrs) {
if (in("AccessControlPolicy")) {
if (name.equals("Owner")) {
accessControlList.setOwner(new Owner());
}
}
else if (in("AccessControlPolicy", "AccessControlList", "Grant")) {
if (name.equals("Grantee")) {
String type = XmlResponsesSaxParser.findAttributeValue("xsi:type", attrs);
if ("Group".equals(type)) {
/*
* Nothing to do for GroupGrantees here since we
* can't construct an empty enum value early.
*/
} else if ("CanonicalUser".equals(type)) {
currentGrantee = new UinGrantee(null);
}
}
}
}
示例4: startElement
import org.xml.sax.Attributes; //导入依赖的package包/类
@Override
public void startElement(final String pUri, final String pLocalName, final String pQualifiedName, final Attributes pAttributes) throws SAXException {
if(pLocalName.equals(TMXConstants.TAG_TILESET)){
this.mInTileset = true;
this.mTMXTileSet = new TMXTileSet(this.mFirstGlobalTileID, pAttributes, this.mTextureOptions, this.mTMXTileSetSourceManager);
} else if (pLocalName.equals(TMXConstants.TAG_OFFSET)){
this.mInTileOffset = true;
this.mTMXTileSet.addTileOffset(pAttributes);
} else if(pLocalName.equals(TMXConstants.TAG_IMAGE)){
this.mInImage = true;
this.mTMXTileSet.setImageSource(this.mAssetManager, this.mTextureManager, pAttributes);
} else if(pLocalName.equals(TMXConstants.TAG_TILE)) {
this.mInTile = true;
this.mLastTileSetTileID = SAXUtils.getIntAttributeOrThrow(pAttributes, TMXConstants.TAG_TILE_ATTRIBUTE_ID);
} else if(pLocalName.equals(TMXConstants.TAG_PROPERTIES)) {
this.mInProperties = true;
} else if(pLocalName.equals(TMXConstants.TAG_PROPERTY)) {
this.mInProperty = true;
this.mTMXTileSet.addTMXTileProperty(this.mLastTileSetTileID, new TMXTileProperty(pAttributes));
} else {
throw new TMXParseException("Unexpected start tag: '" + pLocalName + "'.");
}
}
示例5: enterElement
import org.xml.sax.Attributes; //导入依赖的package包/类
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
int $ai;
$uri = $__uri;
$localName = $__local;
$qname = $__qname;
switch($_ngcc_current_state) {
case 0:
{
revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
}
break;
default:
{
unexpectedEnterElement($__qname);
}
break;
}
}
示例6: enterElement
import org.xml.sax.Attributes; //导入依赖的package包/类
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
int $ai;
$uri = $__uri;
$localName = $__local;
$qname = $__qname;
switch($_ngcc_current_state) {
case 0:
{
revertToParentFromEnterElement($runtime.parseUName(qvalue), super._cookie, $__uri, $__local, $__qname, $attrs);
}
break;
default:
{
unexpectedEnterElement($__qname);
}
break;
}
}
示例7: startElement
import org.xml.sax.Attributes; //导入依赖的package包/类
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (bodyStarted) {
payloadQName = new QName(uri, localName);
// we have what we wanted - let's skip rest of parsing ...
throw new SAXException("Payload element found, interrupting the parsing process.");
}
// check for both SOAP 1.1/1.2
if (equalsQName(uri, localName, SOAPConstants.QNAME_SOAP_BODY) ||
equalsQName(uri, localName, SOAP12Constants.QNAME_SOAP_BODY)) {
bodyStarted = true;
}
}
示例8: startAsynchronousWrites
import org.xml.sax.Attributes; //导入依赖的package包/类
/**
* When a <code>asynchronous-writes</code> element is encounter, we push a
* {@link DiskWriteAttributes} for doing asynchronous writes on the stack.
*/
private void startAsynchronousWrites(Attributes atts) {
int maxOplogSize = ((Integer) stack.pop()).intValue();
String rollOplog = (String) stack.pop();
// convery megabytes to bytes for DiskWriteAttributes creation
long maxOplogSizeInBytes = maxOplogSize;
maxOplogSizeInBytes = maxOplogSizeInBytes * 1024 * 1024;
long timeInterval = parseLong(atts.getValue(TIME_INTERVAL));
long bytesThreshold = parseLong(atts.getValue(BYTES_THRESHOLD));
Properties props = new Properties();
props.setProperty(MAX_OPLOG_SIZE, String.valueOf(maxOplogSizeInBytes));
props.setProperty(ROLL_OPLOG, rollOplog);
props.setProperty(TIME_INTERVAL, String.valueOf(timeInterval));
props.setProperty(DiskWriteAttributesImpl.SYNCHRONOUS_PROPERTY, "false");
props.setProperty(BYTES_THRESHOLD, String.valueOf(bytesThreshold));
stack.push(new DiskWriteAttributesImpl(props));
}
示例9: startElement
import org.xml.sax.Attributes; //导入依赖的package包/类
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
if( itemList.size() < maxItemCount ) {
if( "item".equals( localName )
|| "entry".equals( localName ) ) { // NOI18N
currentItem = new FeedItem();
} else if( "link".equals( localName ) // NOI18N
|| "pubDate".equals( localName ) // NOI18N
|| "date".equals( localName ) // NOI18N
|| "published".equals( localName ) // NOI18N
|| "description".equals( localName ) // NOI18N
|| "content".equals( localName ) // NOI18N
|| "title".equals( localName ) ) { // NOI18N
textBuffer = new StringBuffer( 110 );
if( "link".equals(localName) && null != currentItem && null != atts.getValue("href") )
currentItem.link = fixFeedItemUrl(atts.getValue("href"));
} else if( "enclosure".equals( localName ) && null != currentItem ) { //NOI18N
currentItem.enclosureUrl = atts.getValue( "url" ); //NOI18N
}
}
}
示例10: 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;
}
}
}
示例11: startElement
import org.xml.sax.Attributes; //导入依赖的package包/类
@Override
public void startElement(String uri, String localName, String name, Attributes attributes)
throws SAXException {
if (NODE_DEVICE.equals(localName)) {
// Reset for a new device
mDefaultSeen = false;
} else if (NODE_STATE.equals(localName)) {
// Check if the state is set to be a default state
String val = attributes.getValue(ATTR_DEFAULT);
if (val != null && ("1".equals(val) || Boolean.parseBoolean(val))) {
/*
* If it is and we already have a default state for this
* device, then the device configuration is invalid.
* Otherwise, set that we've seen a default state for this
* device and continue
*/
if (mDefaultSeen) {
validationError("More than one default state for device " + mDeviceName);
} else {
mDefaultSeen = true;
}
}
}
mStringAccumulator.setLength(0);
}
示例12: tspan
import org.xml.sax.Attributes; //导入依赖的package包/类
private void tspan(Attributes attributes) throws SAXException {
debug("<tspan>");
if (currentElement == null)
throw new SAXException(
"Invalid document. Root element must be <svg>");
if (!(currentElement instanceof SVG.TextContainer))
throw new SAXException(
"Invalid document. <tspan> elements are only valid inside <text> or other <tspan> elements.");
SVG.TSpan obj = new SVG.TSpan();
obj.document = svgDocument;
obj.parent = currentElement;
parseAttributesCore(obj, attributes);
parseAttributesStyle(obj, attributes);
parseAttributesConditional(obj, attributes);
parseAttributesTextPosition(obj, attributes);
currentElement.addChild(obj);
currentElement = obj;
if (obj.parent instanceof TextRoot)
obj.setTextRoot((TextRoot) obj.parent);
else
obj.setTextRoot(((TextChild) obj.parent).getTextRoot());
}
示例13: startChildProperty
import org.xml.sax.Attributes; //导入依赖的package包/类
/**
* Called when an XML element is being parsed as a bean property.
* @see #startInlineChildProperty
* @see #startEnvelopeChildProperty
* @param context the parsing context
* @param namespaceURI the namespace of the element
* @param localName the local name of the element
* @param attrs the attributes attached to the element
* @param def the property definition
*/
final protected NodeParser startChildProperty(
ParseContext context,
String namespaceURI,
String localName,
Attributes attrs,
PropertyDef def)
{
if (isInlineChildProperty(context, namespaceURI, localName, def))
{
return startInlineChildProperty(context, namespaceURI, localName,
attrs, def);
}
else
{
return startEnvelopeChildProperty(context, namespaceURI, localName,
attrs, def);
}
}
示例14: addStart
import org.xml.sax.Attributes; //导入依赖的package包/类
protected final void addStart(final String name, final Attributes attrs) {
try {
h.startElement("", name, name, attrs);
} catch (SAXException ex) {
throw new RuntimeException(ex.getMessage(), ex.getException());
}
}
示例15: getVersion
import org.xml.sax.Attributes; //导入依赖的package包/类
/**
* Gets the String value of the "version" attribute.
* <p>
* Returns null if the version attribute is not specified.
* Otherwise, returns a String indicating the value of the
* version attribute.
*/
protected String getVersion(
ParseContext context,
Attributes attrs
)
{
return attrs.getValue(XMLConstants.VERSION_ATTR);
}