本文整理汇总了Java中org.xml.sax.Attributes.getQName方法的典型用法代码示例。如果您正苦于以下问题:Java Attributes.getQName方法的具体用法?Java Attributes.getQName怎么用?Java Attributes.getQName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xml.sax.Attributes
的用法示例。
在下文中一共展示了Attributes.getQName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startGraphics
import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void startGraphics(Attributes attributes) throws SAXException {
SynthGraphicsUtils graphics = null;
for(int i = attributes.getLength() - 1; i >= 0; i--) {
String key = attributes.getQName(i);
if (key.equals(ATTRIBUTE_IDREF)) {
graphics = (SynthGraphicsUtils)lookup(attributes.getValue(i),
SynthGraphicsUtils.class);
}
}
if (graphics == null) {
throw new SAXException("graphicsUtils: you must supply an idref");
}
if (_style != null) {
_style.setGraphicsUtils(graphics);
}
}
示例2: begin
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Handle the beginning of an XML element.
*
* @param attributes The attributes of this element
*
* @exception Exception if a processing error occurs
*/
@Override
public void begin(String namespace, String nameX, Attributes attributes)
throws Exception {
for (int i = 0; i < attributes.getLength(); i++) {
String name = attributes.getLocalName(i);
if ("".equals(name)) {
name = attributes.getQName(i);
}
if ("path".equals(name) || "docBase".equals(name)) {
continue;
}
String value = attributes.getValue(i);
if (!digester.isFakeAttribute(digester.peek(), name)
&& !IntrospectionUtils.setProperty(digester.peek(), name, value)
&& digester.getRulesValidation()) {
digester.getLogger().warn("[SetContextPropertiesRule]{" + digester.getMatch() +
"} Setting property '" + name + "' to '" +
value + "' did not find a matching property.");
}
}
}
示例3: 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);
}
}
示例4: setAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* 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();
if (length > 0) {
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);
}
}
}
示例5: startStyle
import org.xml.sax.Attributes; //导入方法依赖的package包/类
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);
}
示例6: addAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void addAttributes(Attributes attrs) {
if (attrs != null) {
int len = attrs.getLength();
for (int i=0; i<len; i++) {
String qName = attrs.getQName(i);
if ("version".equals(qName)) {
continue;
}
// Bugzilla 35252: http://issues.apache.org/bugzilla/show_bug.cgi?id=35252
if(rootAttrs.getIndex(qName) == -1) {
rootAttrs.addAttribute(attrs.getURI(i),
attrs.getLocalName(i),
qName,
attrs.getType(i),
attrs.getValue(i));
}
}
}
}
示例7: updateAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Compares the given {@link Attributes} with {@link #fCurrentAttributes}
* and update the latter accordingly.
*/
private void updateAttributes( Attributes atts ) {
int len = atts.getLength();
for( int i=0; i<len; i++ ) {
String aqn = atts.getQName(i);
int j = fCurrentAttributes.getIndex(aqn);
String av = atts.getValue(i);
if(j==-1) {
// newly added attribute. add to the current attribute list.
String prefix;
int idx = aqn.indexOf(':');
if( idx<0 ) {
prefix = null;
} else {
prefix = symbolize(aqn.substring(0,idx));
}
j = fCurrentAttributes.addAttribute(
new QName(
prefix,
symbolize(atts.getLocalName(i)),
symbolize(aqn),
symbolize(atts.getURI(i))),
atts.getType(i),av);
} else {
// the attribute is present.
if( !av.equals(fCurrentAttributes.getValue(j)) ) {
// but the value was changed.
fCurrentAttributes.setValue(j,av);
}
}
/** Augmentations augs = fCurrentAttributes.getAugmentations(j);
augs.putItem( Constants.TYPEINFO,
typeInfoProvider.getAttributeTypeInfo(i) );
augs.putItem( Constants.ID_ATTRIBUTE,
typeInfoProvider.isIdAttribute(i)?Boolean.TRUE:Boolean.FALSE ); **/
}
}
示例8: startInputMap
import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void startInputMap(Attributes attributes) throws SAXException {
_inputMapBindings.clear();
_inputMapID = null;
if (_style != null) {
for(int i = attributes.getLength() - 1; i >= 0; i--) {
String key = attributes.getQName(i);
if (key.equals(ATTRIBUTE_ID)) {
_inputMapID = attributes.getValue(i);
}
}
}
}
示例9: parsePathAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
private VdPath parsePathAttributes(Attributes attributes) {
int len = attributes.getLength();
VdPath vgPath = new VdPath();
for (int i = 0; i < len; i++) {
String name = attributes.getQName(i);
String value = attributes.getValue(i);
logger.log(Level.FINE, "name " + name + "value " + value);
setNameValue(vgPath, name, value);
}
return vgPath;
}
示例10: parseGroupAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
private VdGroup parseGroupAttributes(Attributes attributes) {
int len = attributes.getLength();
VdGroup vgGroup = new VdGroup();
for (int i = 0; i < len; i++) {
String name = attributes.getQName(i);
String value = attributes.getValue(i);
logger.log(Level.FINE, "name " + name + "value " + value);
}
return vgGroup;
}
示例11: setAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* 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);
}
}
示例12: handlePropertyTag
import org.xml.sax.Attributes; //导入方法依赖的package包/类
@NbBundle.Messages({
"# {0} - tag name",
"ERR_invalidPropertyName=Invalid property name: {0}"
})
private FxNode handlePropertyTag(String propName, Attributes atts) {
PropertyValue pv;
int errorAttrs = 0;
for (int i = 0; i < atts.getLength(); i++) {
String uri = atts.getURI(i);
if (uri != null) {
String qn = atts.getQName(i);
errorAttrs++;
addAttributeError(qn,
"property-namespaced-attribute",
ERR_propertyElementNamespacedAttribute(qn),
qn
);
}
}
int stProp = FxXmlSymbols.findStaticProperty(propName);
switch (stProp) {
case -1:
// simple property
if (!Utilities.isJavaIdentifier(propName)) {
addError(new ErrorMark(
start, end,
"invalid-property-name",
ERR_invalidPropertyName(propName),
propName
));
}
if (errorAttrs == atts.getLength()) {
pv = handleSimpleProperty(propName, atts);
} else {
pv = handleMapProperty(propName, atts);
}
break;
case -2:
// broken name, but must create a node
pv = accessor.makeBroken(accessor.createProperty(propName, false));
// do not add the property to the parent, it's broken beyond repair
addError(new ErrorMark(
start, end,
"invalid-property-name",
ERR_invalidPropertyName(propName),
propName
));
break;
default:
// static property, just ignore for now
pv = handleStaticProperty(propName.substring(0, stProp),
propName.substring(stProp + 1), atts);
break;
}
return pv;
}
示例13: handleFxInclude
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Processes ?include directive
*
* @param include
*/
@NbBundle.Messages({
"ERR_missingIncludeName=Missing include name",
"# {0} - attribute name",
"ERR_unexpectedIncludeAttribute=Unexpected attribute in fx:include: {0}"
})
private FxNode handleFxInclude(Attributes atts, String localName) {
String include = null;
String id = null;
for (int i = 0; i < atts.getLength(); i++) {
String uri = atts.getURI(i);
String attName = atts.getLocalName(i);
if (FX_ATTR_REFERENCE_SOURCE.equals(attName)) {
include = atts.getValue(i);
continue;
}
if (isFxmlNamespaceUri(uri)) {
if (FX_ID.equals(attName)) {
id = atts.getValue(i);
} else {
String qName = atts.getQName(i);
addAttributeError(
qName,
"unexpected-include-attribute",
ERR_unexpectedIncludeAttribute(qName),
qName
);
}
}
}
if (include == null) {
// must be some text, otherwise = error
addAttributeError(
ContentLocator.ATTRIBUTE_TARGET,
"missing-included-name",
ERR_missingIncludeName()
);
FxNode n = accessor.createErrorElement(localName);
initElement(n);
addError("invalid-fx-element", ERR_invalidFxElement(localName), localName);
return n;
}
// guide: fnames starting with slash are treated relative to the classpath
FxInclude fxInclude = accessor.createInclude(include, id);
return fxInclude;
}
示例14: 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());
}
示例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());
}