本文整理汇总了C++中AttributeList::getLength方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeList::getLength方法的具体用法?C++ AttributeList::getLength怎么用?C++ AttributeList::getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeList
的用法示例。
在下文中一共展示了AttributeList::getLength方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
void BulletMLParserXercesSAXHandler::startElement(const XMLCh* const name,
AttributeList& attributes)
{
BulletMLNode* node = parser_->addContent(parser_->uc2string(name));
if (node->getName() == BulletMLNode::bulletml) {
for (unsigned int i = 0; i < attributes.getLength(); i++) {
if (parser_->uc2string(attributes.getName(i)) == "type" &&
parser_->uc2string(attributes.getValue(i)) == "horizontal")
{
parser_->setHorizontal();
}
}
}
else {
BulletMLParserXerces::MyAttributes mattr;
for (unsigned int i = 0; i < attributes.getLength(); i++) {
mattr.push_back(parser_->uc2string(attributes.getName(i)));
mattr.push_back(parser_->uc2string(attributes.getValue(i)));
}
parser_->addAttribute(mattr, node);
}
if (curNode_ != 0) curNode_->addChild(node);
curNode_ = node;
}
示例2: StoreNameValueAttributes
/*
* Stores the attributes from a name value type element.
* Parse out the probe array type into its own member.
*/
void SAXArrayHandlers::StoreNameValueAttributes(AttributeList& attributes)
{
unsigned int len = attributes.getLength();
AttributeNameValueType param;
for (unsigned int index = 0; index < len; index++)
{
if (attributes.getName(index) == NAME_ATTRIBUTE)
{
param.name = XMLChToString(attributes.getValue(index));
}
else if (attributes.getName(index) == VALUE_ATTRIBUTE)
{
param.value = XMLChToString(attributes.getValue(index));
}
else if (attributes.getName(index) == TYPE_ATTRIBUTE)
{
param.type = XMLChToString(attributes.getValue(index));
if (param.name == PROBE_ARRAY_TYPE_PARAMETER_NAME)
{
arrayData->SetArrayType(param.value);
}
else
{
arrayData->Attributes().push_back(param);
}
}
}
}
示例3:
void SAX_TransAGHandler::structuredMetaStart
(const XMLCh* const name, AttributeList& attr)
{
string s;
// if start-of-element is reported,
// store structured element as XML string in feature value
// and push structuredMetaEnd handler
// storeMetaValueStart(name, attr);
if ( ! prevValue.empty() ) prevValue += " ";
prevValue += "<";
prevValue += set_string(s, name);
for ( int i = 0; i < attr.getLength(); ++i ) {
prevValue += " ";
prevValue += set_string(s, attr.getName(i));
prevValue += "=\"";
prevValue += set_string(s, attr.getValue(i));
prevValue += "\"";
}
prevValue += ">";
prevPos = prevValue.length();
StartStack.push(&SAX_TransAGHandler::structuredMetaStart);
EndStack.push(&SAX_TransAGHandler::structuredMetaEnd);
}
示例4: startElement
void SAXPrintHandlers::startElement(const XMLCh* const name
, AttributeList& attributes)
{
// The name has to be representable without any escapes
fFormatter << XMLFormatter::NoEscapes
<< chOpenAngle << name;
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 << attributes.getName(index)
<< chEqual << chDoubleQuote
<< XMLFormatter::AttrEscapes
<< attributes.getValue(index)
<< XMLFormatter::NoEscapes
<< chDoubleQuote;
}
fFormatter << chCloseAngle;
}
示例5:
void
StdInParseHandlers::startElement( const XMLCh* const /* name */
, AttributeList& attributes)
{
fElementCount++;
fAttrCount += attributes.getLength();
}
示例6: startElement
void startElement(const XMLCh* const name, AttributeList& attrList)
{
string label=XMLString::transcode(name);
map<string,string> attrs;
for (unsigned int i=0;i<attrList.getLength();i++)
attrs[XMLString::transcode(attrList.getName(i))] = XMLString::transcode(attrList.getValue(i));
myStream.onElement(label, attrs);
}
示例7: if
void
SBlogErrorMapper::MySAXHandler::startElement(const XMLCh* const name,
AttributeList& attributes)
{
// 1. parse module name from the root
XMLCh2VXIchar(name, tempString, 4096);
if(wcscmp(tempString, L"ErrorMessages") == 0)
{
for(unsigned int i = 0; i < attributes.getLength(); i++)
{
XMLCh2VXIchar(attributes.getName(i), tempString, 4096);
if(wcscmp(tempString, L"moduleName") == 0)
{
XMLCh2VXIchar(attributes.getValue(i), tempString, 4096);
moduleName = tempString;
}
}
}
// 2. only care about <error> elements
else if(wcscmp(tempString, L"error") == 0) {
isProcessing = 1;
errorMessage = L"";
// Find the error number and severity (tag attributes)
for (unsigned int i = 0; i < attributes.getLength(); i++) {
XMLCh2VXIchar(attributes.getName(i), tempString, 4096);
if(wcscmp(tempString, L"num") == 0) {
XMLCh2VXIchar(attributes.getValue(i), tempString, 4096);
errorNumber = wtoint(tempString);
}
else if(wcscmp(tempString, L"severity") == 0) {
XMLCh2VXIchar(attributes.getValue(i), tempString, 4096);
errorSeverity = wtoint(tempString);
}
}
}
else if(wcscmp(tempString, L"advice") == 0) {
// ignore the advice tag, just concate the advice's message
}
else if(isProcessing)
errorMessage += L"???"; // Runtime-determined value, unknown
}
示例8: StoreExperimentNameAttribute
/*
* Stores the experiment name attribute from the experiment element.
*/
void SAXArrayHandlers::StoreExperimentNameAttribute(AttributeList& attributes)
{
unsigned int len = attributes.getLength();
for (unsigned int index = 0; index < len; index++)
{
if (attributes.getName(index) == NAME_ATTRIBUTE)
{
arrayData->SetExperimentName(XMLChToString(attributes.getValue(index)));
break;
}
}
}
示例9:
//
// startElement - our SAX handler callback function for startElement.
// Update the document checksum with the element name
// and any attribute names and values.
//
void ThreadParser::SAXHandler::startElement(const XMLCh *const name, AttributeList &attributes)
{
SAXInstance->addToCheckSum(name);
XMLSize_t n = attributes.getLength();
XMLSize_t i;
for (i=0; i<n; i++)
{
const XMLCh *attNam = attributes.getName(i);
SAXInstance->addToCheckSum(attNam);
const XMLCh *attVal = attributes.getValue(i);
SAXInstance->addToCheckSum(attVal);
}
}
示例10: startElement
void OptionsLoader::startElement(const XMLCh* const name,
AttributeList& attributes) {
myItem = TplConvert<XMLCh>::_2str(name);
for (int i = 0; i < (int) attributes.getLength(); i++) {
std::string key = TplConvert<XMLCh>::_2str(attributes.getName(i));
std::string value = TplConvert<XMLCh>::_2str(attributes.getValue(i));
if (key == "value" || key == "v") {
key = myItem;
}
setValue(key, value);
}
myValue = "";
}
示例11: StoreSampleProjectAttribute
/*
* Stores the sample project attribute from the biosource/characteristics element.
*/
void SAXArrayHandlers::StoreSampleProjectAttribute(AttributeList& attributes)
{
unsigned int len = attributes.getLength();
for (unsigned int index = 0; index < len; index++)
{
if (attributes.getName(index) == ONTOLOGY_VALUE_ATTRIBUTE)
{
AttributeNameValueType param;
param.name = GCOS_SAMPLE_PROJECT_PARAMETER_NAME;
param.value = XMLChToString(attributes.getValue(index));
param.type = STRING_TYPE;
arrayData->Attributes().push_back(param);
break;
}
}
}
示例12: jsonize
const std::string jsonize(AttributeList &attrs) {
StringBuffer s;
Writer<StringBuffer> w(s);
w.StartObject();
for (int i = 0; i < attrs.getLength(); ++i) {
const XMLCh* name = attrs.getName(i);
char *tmpName = XMLString::transcode(name),
*tmpValue = XMLString::transcode(attrs.getValue(name));
w.String(tmpName);
w.String(tmpValue);
XMLString::release(&tmpName);
XMLString::release(&tmpValue);
}
w.EndObject();
return s.GetString();
}
示例13: findName
string DictionaryHandler::findName( AttributeList& attributes )
{
string str;
XMLSize_t i = 0;
XMLSize_t numAttributes = attributes.getLength();
for ( i = 0; i < numAttributes; i++ ) {
const XMLCh *xmlName = attributes.getName( i );
char *name = XMLString::transcode( xmlName );
if ( strncmp( name, "name", 5 ) == 0 ) {
const XMLCh *xmlValue = attributes.getValue( i );
char *value = XMLString::transcode( xmlValue );
str = string( static_cast<const char *>( value ) );
XMLString::release( &value );
}
XMLString::release( &name );
}
return str;
}
示例14: startElement
void TestCasesHandler::startElement(const XMLCh* const name, AttributeList& attributes)
{
Transcode attributeName;
Transcode attributeType;
Transcode attributeValue;
Transcode message;
try
{
message.translate(name);
cout << "<" << message.getString() << ">" << endl;
const string messageString(message.getChar());
m_currentStartElement = createTagClass(messageString);
m_tagStack.push(m_currentStartElement);
}
catch(nullString &)
{
//Do nothing
cout << "caught nullString on message.getChar()" << endl;
}
for(unsigned int i = 0; i < attributes.getLength(); i++)
{
try
{
attributeName.translate(attributes.getName(static_cast<unsigned int>(i)));
cout << "Attribute name:" << attributeName.getString() << endl;
attributeValue.translate(attributes.getValue(static_cast<unsigned int>(i)));
cout << "Attribute Value:" + attributeValue.getString() << endl;
m_currentStartElement->setAttribute(attributeName.getStringPimpl(), attributeValue.getStringPimpl());
}
catch(nullString &)
{
//Do nothing
cout << "caught nullString on attributeValue.getChar()" << endl;
}
}
}
示例15: startElement
void FeatureDocumentHandler::startElement(const XMLCh* const name, AttributeList& attrs)
{
char elementName[1024];
XMLString::transcode(name, elementName, 1024 - 1);
std::string elemName(elementName);
std::map<std::string, std::string> attributes;
for (unsigned int c = 0; c < attrs.getLength() ; c++)
{
char attributeName[1024];
char attributeValue [1024];
XMLString::transcode(attrs.getName(c), attributeName, 1024 - 1);
XMLString::transcode(attrs.getValue(c), attributeValue, 1024 - 1);
std::string attribName(attributeName);
std::string attribVal(attributeValue);
attributes.insert(Pair_Attrib(attribName, attribVal));
}
m_pFeatureMat->StartElement(elemName, attributes);
}