本文整理汇总了C++中Attributes::getURI方法的典型用法代码示例。如果您正苦于以下问题:C++ Attributes::getURI方法的具体用法?C++ Attributes::getURI怎么用?C++ Attributes::getURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attributes
的用法示例。
在下文中一共展示了Attributes::getURI方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: declareAttributeNamespaces
void XMLWriter::declareAttributeNamespaces(const Attributes& attributes)
{
for (int i = 0; i < attributes.getLength(); i++)
{
XMLString namespaceURI = attributes.getURI(i);
XMLString localName = attributes.getLocalName(i);
XMLString qname = attributes.getQName(i);
if (!localName.empty())
{
XMLString prefix;
XMLString splitLocalName;
Name::split(qname, prefix, splitLocalName);
if (prefix.empty()) prefix = _namespaces.getPrefix(namespaceURI);
if (prefix.empty() && !namespaceURI.empty() && !_namespaces.isMapped(namespaceURI))
{
prefix = newPrefix();
_namespaces.declarePrefix(prefix, namespaceURI);
}
const XMLString& uri = _namespaces.getURI(prefix);
if ((uri.empty() || uri != namespaceURI) && !namespaceURI.empty())
{
_namespaces.declarePrefix(prefix, namespaceURI);
}
}
}
}
示例2:
void SAX2PrintHandlers::startElement(const XMLCh* const uri,
const XMLCh* const localname,
const XMLCh* const qname,
const Attributes& attributes)
{
// The name has to be representable without any escapes
fFormatter << XMLFormatter::NoEscapes << chOpenAngle ;
if ( fExpandNS )
{
if (XMLString::compareIString(uri,XMLUni::fgZeroLenString) != 0)
fFormatter << uri << chColon;
fFormatter << localname ;
}
else
fFormatter << qname ;
unsigned int len = attributes.getLength();
for (unsigned int index = 0; index < len; index++)
{
//
// Again the name has to be completely representable. But the
// attribute can have refs and requires the attribute style
// escaping.
//
fFormatter << XMLFormatter::NoEscapes << chSpace ;
if ( fExpandNS )
{
if (XMLString::compareIString(attributes.getURI(index),XMLUni::fgZeroLenString) != 0)
fFormatter << attributes.getURI(index) << chColon;
fFormatter << attributes.getLocalName(index) ;
}
else
fFormatter << attributes.getQName(index) ;
fFormatter << chEqual << chDoubleQuote
<< XMLFormatter::AttrEscapes
<< attributes.getValue(index)
<< XMLFormatter::NoEscapes
<< chDoubleQuote;
}
fFormatter << chCloseAngle;
}
示例3: setAttributes
void AttributesImpl::setAttributes(const Attributes& attributes)
{
if (&attributes != this)
{
int count = attributes.getLength();
_attributes.clear();
_attributes.reserve(count);
for (int i = 0; i < count; i++)
{
addAttribute(attributes.getURI(i), attributes.getLocalName(i), attributes.getQName(i), attributes.getType(i), attributes.getValue(i));
}
}
}
示例4: addAttributes
void XMLWriter::addAttributes(AttributeMap& attributeMap, const Attributes& attributes, const XMLString& elementNamespaceURI)
{
for (int i = 0; i < attributes.getLength(); i++)
{
XMLString namespaceURI = attributes.getURI(i);
XMLString localName = attributes.getLocalName(i);
XMLString qname = attributes.getQName(i);
if (!localName.empty())
{
XMLString prefix;
if (namespaceURI != elementNamespaceURI)
prefix = _namespaces.getPrefix(namespaceURI);
if (!prefix.empty())
{
qname = prefix;
qname.append(toXMLString(MARKUP_COLON));
}
else qname.clear();
qname.append(localName);
}
attributeMap[qname] = attributes.getValue(i);
}
}
示例5: sortedList
// ---------------------------------------------------------------------------
// SAX2SortAttributesFilter: Overrides of the SAX2XMLFilter interface
// ---------------------------------------------------------------------------
void SAX2SortAttributesFilter::startElement(const XMLCh* const uri,
const XMLCh* const localname,
const XMLCh* const qname,
const Attributes& attributes)
{
AttrList sortedList(attributes.getLength());
for(XMLSize_t i=0;i<attributes.getLength();i++)
{
XMLSize_t j;
for(j=0;j<sortedList.getLength();j++)
{
if(XMLString::compareString(sortedList.elementAt(j)->qName,attributes.getQName(i))>=0)
break;
}
Attr* pClone=new Attr;
pClone->qName = attributes.getQName(i);
pClone->uri = attributes.getURI(i);
pClone->localPart = attributes.getLocalName(i);
pClone->value = attributes.getValue(i);
pClone->attrType = attributes.getType(i);
sortedList.insertElementAt(pClone, j);
}
SAX2XMLFilterImpl::startElement(uri, localname, qname, sortedList);
}