本文整理汇总了C#中AttributeList.getName方法的典型用法代码示例。如果您正苦于以下问题:C# AttributeList.getName方法的具体用法?C# AttributeList.getName怎么用?C# AttributeList.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeList
的用法示例。
在下文中一共展示了AttributeList.getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: startElement
//throws SAXException
/**
* Adapter implementation method; do not call.
* Adapt a SAX1 startElement event.
*
* <p>If necessary, perform Namespace processing.</p>
*
* @param qName The qualified (prefixed) name.
* @param qAtts The XML attribute list (with qnames).
* @exception SAXException The client may raise a
* processing exception.
*/
public void startElement(String qName, AttributeList qAtts)
{
// These are exceptions from the
// first pass; they should be
// ignored if there's a second pass,
// but reported otherwise.
java.util.Vector<SAXException> exceptions = null;
// If we're not doing Namespace
// processing, dispatch this quickly.
if (!namespaces)
{
if (contentHandler != null)
{
attAdapter.setAttributeList(qAtts);
contentHandler.startElement("", "", qName.intern(),
attAdapter);
}
return;
}
// OK, we're doing Namespace processing.
nsSupport.pushContext();
int length = qAtts.getLength();
// First pass: handle NS decls
for (int i = 0; i < length; i++)
{
String attQName = qAtts.getName(i);
if (!attQName.startsWith("xmlns"))
continue;
// Could be a declaration...
String prefix;
int n = attQName.indexOf(':');
// xmlns=...
if (n == -1 && attQName.length() == 5)
{
prefix = "";
}
else if (n != 5)
{
// XML namespaces spec doesn't discuss "xmlnsf:oo"
// (and similarly named) attributes ... at most, warn
continue;
}
else // xmlns:foo=...
prefix = attQName.substring(n + 1);
String value = qAtts.getValue(i);
if (!nsSupport.declarePrefix(prefix, value))
{
reportError("Illegal Namespace prefix: " + prefix);
continue;
}
if (contentHandler != null)
contentHandler.startPrefixMapping(prefix, value);
}
// Second pass: copy all relevant
// attributes into the SAX2 AttributeList
// using updated prefix bindings
atts.clear();
for (int i = 0; i < length; i++)
{
String attQName = qAtts.getName(i);
String type = qAtts.getType(i);
String value = qAtts.getValue(i);
// Declaration?
if (attQName.startsWith("xmlns"))
{
String prefix;
int n = attQName.indexOf(':');
if (n == -1 && attQName.length() == 5)
{
prefix = "";
}
else if (n != 5)
{
// XML namespaces spec doesn't discuss "xmlnsf:oo"
// (and similarly named) attributes ... ignore
prefix = null;
}
else
{
//.........这里部分代码省略.........
示例2: setAttributeList
////////////////////////////////////////////////////////////////////
// Methods specific to this class.
////////////////////////////////////////////////////////////////////
/**
* Set the attribute list, discarding previous contents.
*
* <p>This method allows an application writer to reuse an
* attribute list easily.</p>
*
* @param atts The attribute list to copy.
*/
public void setAttributeList(AttributeList atts)
{
int count = atts.getLength();
clear();
for (int i = 0; i < count; i++)
{
addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
}
}