本文整理汇总了C++中Attributes::getValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Attributes::getValue方法的具体用法?C++ Attributes::getValue怎么用?C++ Attributes::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attributes
的用法示例。
在下文中一共展示了Attributes::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
void dhListText::startElement(const XMLCh* const uri,
const XMLCh* const localname,
const XMLCh* const qname,
const Attributes& att)
{
string message1 = XMLString::transcode(qname);
if (!message1.compare("text") || !message1.compare("TEXT"))
{
string message2 = XMLString::transcode(att.getValue(XMLString::transcode("id")));
tempVecTextIDList.push_back(message2);
message2 = XMLString::transcode(att.getValue(XMLString::transcode("src")));
tempVecTextFileList.push_back(message2);
}
}
示例2: startElement
void startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs ) {
theOStream << "<" << qname;
for ( unsigned int i = 0; i < attrs.getLength(); i++ ) {
theOStream << " " << attrs.getQName( i ) << "=\"" << attrs.getValue( i ) << "\"";
}
theOStream << ">";
}
示例3: startElement
void startElement(const XMLCh* const uri,const XMLCh* const localname,
const XMLCh* const qname, const Attributes& attributes)
{
//cout << "TestHandler::startElement: " << StrX(qname) << endl;
char* buf = XMLString::transcode(qname);
string sbuf(buf);
if ( sbuf == tag )
{
read = true;
}
XMLString::release(&buf);
if ( read )
{
// copy start element tag with attributes
cout << "<" << StrX(qname).localForm();
unsigned int len = attributes.getLength();
for (unsigned int index = 0; index < len; index++)
{
cout << " " << attributes.getQName(index)
<< "=\""
<< attributes.getValue(index)
<< "\"";
}
cout << ">";
}
};
示例4: strtod
void MySAX2Handler::inTrackSegment::startElement(const XMLCh* const uri,
const XMLCh* const localname,
const XMLCh* const qname,
const Attributes& attrs)
{
char* message = XMLString::transcode(localname);
if(!strcmp(message, "trkpt")) {
XMLCh* latStr = XMLString::transcode("lat");
XMLCh* lonStr = XMLString::transcode("lon");
const XMLCh* xmlLat = attrs.getValue(latStr);
const XMLCh* xmlLon = attrs.getValue(lonStr);
XMLString::release(&latStr);
XMLString::release(&lonStr);
if(xmlLat && xmlLon) {
char* slat = XMLString::transcode(xmlLat);
char* slon = XMLString::transcode(xmlLon);
double lat = strtod(slat, (char **)NULL);
double lon = strtod(slon, (char **)NULL);
Track::TrackPoint *tp = new Track::TrackPoint(lat, lon);
mSegment->addPoint(tp);
//std::cout << "New point: (" << lat << ", " << lon << ") : " << *tp << std::endl;
setState(new inTrackPoint(getHandler(), this, mTrack, *tp));
XMLString::release(&slat);
XMLString::release(&slon);
} else {
std::cout << "Can't find lat " << xmlLat << " and " << xmlLon
<< std::endl;
}
} else {
std::cout << "Unknown tag:"<< message << ":" << ": in track segment"<< std::endl;
}
XMLString::release(&message);
}
示例5:
void ILI2Handler::startElement(
CPL_UNUSED const XMLCh* const uri,
CPL_UNUSED const XMLCh* const localname,
const XMLCh* const qname,
const Attributes& attrs
) {
// start to add the layers, features with the DATASECTION
char *tmpC = NULL;
m_nEntityCounter = 0;
if ((level >= 0) || (cmpStr(ILI2_DATASECTION, tmpC = XMLString::transcode(qname)) == 0)) {
level++;
if (level >= 2) {
// create the dom tree
DOMElement *elem = (DOMElement*)dom_doc->createElement(qname);
// add all attributes
unsigned int len = attrs.getLength();
for (unsigned int index = 0; index < len; index++)
elem->setAttribute(attrs.getQName(index), attrs.getValue(index));
dom_elem->appendChild(elem);
dom_elem = elem;
}
}
XMLString::release(&tmpC);
}
示例6:
void
XMLTreeGenerator::startElement(const XMLCh* const uri,
const XMLCh* const localname,
const XMLCh* const qname,
const Attributes& attrs)
{
string name = XMLUtil::trim(XMLUtil::WideCharToString(localname ));
if (name.empty() ) return;
XMLTree* pTree = NULL;
if (m_pBuffer == NULL )
{
m_pRoot->SetName(name);
pTree = m_pRoot;
}
else
{
pTree = m_pBuffer->AddChild(name);
}
for (unsigned int i = 0; i < attrs.getLength(); i++ )
{
pTree->AddAttribute(
XMLUtil::trim(XMLUtil::WideCharToString(attrs.getLocalName(i ) ) ),
XMLUtil::trim(XMLUtil::WideCharToString(attrs.getValue(i ) ) ));
}
m_pBuffer = pTree;
}
示例7: CheckForRelations
void NASReader::CheckForRelations( const char *pszElement,
const Attributes &attrs,
char **ppszCurField )
{
GMLFeature *poFeature = GetState()->m_poFeature;
CPLAssert( poFeature != NULL );
int nIndex;
XMLCh Name[100];
tr_strcpy( Name, "xlink:href" );
nIndex = attrs.getIndex( Name );
if( nIndex != -1 )
{
char *pszHRef = tr_strdup( attrs.getValue( nIndex ) );
if( EQUALN(pszHRef,"urn:adv:oid:", 12 ) )
{
poFeature->AddOBProperty( pszElement, pszHRef );
CPLFree( *ppszCurField );
*ppszCurField = CPLStrdup( pszHRef + 12 );
}
CPLFree( pszHRef );
}
}
示例8: if
void MySAX2Handler::startElement(const XMLCh* const uri,
const XMLCh* const localname,
const XMLCh* const qname,
const Attributes& attrs)
{
char* message = XMLString::transcode(localname);
if (strcmp(message, "TIME_SLOT") == 0) {
string label;
int value;
for (int i=0; i<attrs.getLength(); i++) {
char *localname = XMLString::transcode(attrs.getLocalName(i));
char *atvalue = XMLString::transcode(attrs.getValue(i));
if (strcmp(localname, "TIME_SLOT_ID") == 0) {
label = atvalue;
} else if (strcmp(localname, "TIME_VALUE") == 0) {
value = atoi(atvalue);
}
//cout << localname << " " << value << endl;
time_slots[label] = value;
XMLString::release(&localname);
XMLString::release(&atvalue);
}
cout << label << " " << value << endl;
} else {
cout << "I saw element: "<< message << endl;
}
XMLString::release(&message);
}
示例9: PushFeature
void NASReader::PushFeature( const char *pszElement,
const Attributes &attrs )
{
int iClass;
/* -------------------------------------------------------------------- */
/* Find the class of this element. */
/* -------------------------------------------------------------------- */
for( iClass = 0; iClass < GetClassCount(); iClass++ )
{
if( EQUAL(pszElement,GetClass(iClass)->GetElementName()) )
break;
}
/* -------------------------------------------------------------------- */
/* Create a new feature class for this element, if there is no */
/* existing class for it. */
/* -------------------------------------------------------------------- */
if( iClass == GetClassCount() )
{
CPLAssert( !IsClassListLocked() );
GMLFeatureClass *poNewClass = new GMLFeatureClass( pszElement );
AddClass( poNewClass );
}
/* -------------------------------------------------------------------- */
/* Create a feature of this feature class. */
/* -------------------------------------------------------------------- */
GMLFeature *poFeature = new GMLFeature( GetClass( iClass ) );
/* -------------------------------------------------------------------- */
/* Create and push a new read state. */
/* -------------------------------------------------------------------- */
GMLReadState *poState;
poState = new GMLReadState();
poState->m_poFeature = poFeature;
PushState( poState );
/* -------------------------------------------------------------------- */
/* Check for gml:id, and if found push it as an attribute named */
/* gml_id. */
/* -------------------------------------------------------------------- */
int nFIDIndex;
XMLCh anFID[100];
tr_strcpy( anFID, "gml:id" );
nFIDIndex = attrs.getIndex( anFID );
if( nFIDIndex != -1 )
{
char *pszFID = tr_strdup( attrs.getValue( nFIDIndex ) );
SetFeatureProperty( "gml_id", pszFID );
CPLFree( pszFID );
}
}
示例10:
//---------------------------------------------------------------------------
// @function:
// CParseHandlerPhysicalSplit::StartElement
//
// @doc:
// Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerPhysicalSplit::StartElement
(
const XMLCh* const, // xmlszUri,
const XMLCh* const xmlszLocalname,
const XMLCh* const, // xmlszQname
const Attributes &attrs
)
{
if (0 != XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenPhysicalSplit), xmlszLocalname))
{
CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
}
const XMLCh *xmlszDeleteColIds = CDXLOperatorFactory::XmlstrFromAttrs(attrs, EdxltokenDeleteCols, EdxltokenPhysicalSplit);
m_pdrgpulDelete = CDXLOperatorFactory::PdrgpulFromXMLCh(m_pphm->Pmm(), xmlszDeleteColIds, EdxltokenDeleteCols, EdxltokenPhysicalSplit);
const XMLCh *xmlszInsertColIds = CDXLOperatorFactory::XmlstrFromAttrs(attrs, EdxltokenInsertCols, EdxltokenPhysicalSplit);
m_pdrgpulInsert = CDXLOperatorFactory::PdrgpulFromXMLCh(m_pphm->Pmm(), xmlszInsertColIds, EdxltokenInsertCols, EdxltokenPhysicalSplit);
m_ulAction = CDXLOperatorFactory::UlValueFromAttrs(m_pphm->Pmm(), attrs, EdxltokenActionColId, EdxltokenPhysicalSplit);
m_ulCtid = CDXLOperatorFactory::UlValueFromAttrs(m_pphm->Pmm(), attrs, EdxltokenCtidColId, EdxltokenPhysicalSplit);
m_ulSegmentId = CDXLOperatorFactory::UlValueFromAttrs(m_pphm->Pmm(), attrs, EdxltokenGpSegmentIdColId, EdxltokenPhysicalSplit);
const XMLCh *xmlszPreserveOids = attrs.getValue(CDXLTokens::XmlstrToken(EdxltokenUpdatePreservesOids));
if (NULL != xmlszPreserveOids)
{
m_fPreserveOids = CDXLOperatorFactory::FValueFromXmlstr
(
m_pphm->Pmm(),
xmlszPreserveOids,
EdxltokenUpdatePreservesOids,
EdxltokenPhysicalSplit
);
}
if (m_fPreserveOids)
{
m_ulTupleOidColId = CDXLOperatorFactory::UlValueFromAttrs(m_pphm->Pmm(), attrs, EdxltokenTupleOidColId, EdxltokenPhysicalSplit);
}
// parse handler for physical operator
CParseHandlerBase *pphChild = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenPhysical), m_pphm, this);
m_pphm->ActivateParseHandler(pphChild);
// parse handler for the proj list
CParseHandlerBase *pphPrL = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalarProjList), m_pphm, this);
m_pphm->ActivateParseHandler(pphPrL);
//parse handler for the properties of the operator
CParseHandlerBase *pphProp = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenProperties), m_pphm, this);
m_pphm->ActivateParseHandler(pphProp);
// store child parse handlers in array
this->Append(pphProp);
this->Append(pphPrL);
this->Append(pphChild);
}
示例11: CDXLNode
//---------------------------------------------------------------------------
// @function:
// CParseHandlerLogicalLimit::StartElement
//
// @doc:
// Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerLogicalLimit::StartElement
(
const XMLCh* const, // element_uri,
const XMLCh* const element_local_name,
const XMLCh* const, // element_qname
const Attributes& attrs
)
{
if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenLogicalLimit), element_local_name))
{
const XMLCh *non_removable_limit_str = attrs.getValue(CDXLTokens::XmlstrToken(EdxltokenTopLimitUnderDML));
BOOL keep_limit = false;
if (non_removable_limit_str)
{
keep_limit = CDXLOperatorFactory::ConvertAttrValueToBool
(
m_parse_handler_mgr->GetDXLMemoryManager(),
non_removable_limit_str,
EdxltokenTopLimitUnderDML,
EdxltokenLogicalLimit
);
}
m_dxl_node = GPOS_NEW(m_mp) CDXLNode(m_mp, GPOS_NEW(m_mp) CDXLLogicalLimit(m_mp, keep_limit));
// create child node parsers
// parse handler for logical operator
CParseHandlerBase *child_parse_handler = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenLogical), m_parse_handler_mgr, this);
m_parse_handler_mgr->ActivateParseHandler(child_parse_handler);
CParseHandlerBase *offset_parse_handler = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenScalarLimitOffset), m_parse_handler_mgr, this);
m_parse_handler_mgr->ActivateParseHandler(offset_parse_handler);
CParseHandlerBase *count_parse_handler = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenScalarLimitCount), m_parse_handler_mgr, this);
m_parse_handler_mgr->ActivateParseHandler(count_parse_handler);
// parse handler for the sorting column list
CParseHandlerBase *sort_col_list_parse_handler = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenScalarSortColList), m_parse_handler_mgr, this);
m_parse_handler_mgr->ActivateParseHandler(sort_col_list_parse_handler);
// store child parse handler in array
this->Append(sort_col_list_parse_handler);
this->Append(count_parse_handler);
this->Append(offset_parse_handler);
this->Append(child_parse_handler);
}
else
{
CWStringDynamic *str = CDXLUtils::CreateDynamicStringFromXMLChArray(m_parse_handler_mgr->GetDXLMemoryManager(), element_local_name);
GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, str->GetBuffer());
}
}
示例12: CDouble
//---------------------------------------------------------------------------
// @function:
// CParseHandlerStatsDerivedRelation::StartElement
//
// @doc:
// Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerStatsDerivedRelation::StartElement
(
const XMLCh* const xmlszUri,
const XMLCh* const xmlszLocalname,
const XMLCh* const xmlszQname,
const Attributes& attrs
)
{
if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenStatsDerivedColumn), xmlszLocalname))
{
// start new derived column element
CParseHandlerBase *pph = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenStatsDerivedColumn), m_pphm, this);
m_pphm->ActivateParseHandler(pph);
// store parse handler
this->Append(pph);
pph->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
}
else
{
GPOS_ASSERT(0 == this->UlLength());
// parse rows
const XMLCh *xmlszRows = CDXLOperatorFactory::XmlstrFromAttrs
(
attrs,
EdxltokenRows,
EdxltokenStatsDerivedRelation
);
m_dRows = CDouble(CDXLOperatorFactory::DValueFromXmlstr
(
m_pphm->Pmm(),
xmlszRows,
EdxltokenRows,
EdxltokenStatsDerivedRelation
));
m_fEmpty = false;
const XMLCh *xmlszEmpty = attrs.getValue(CDXLTokens::XmlstrToken(EdxltokenEmptyRelation));
if (NULL != xmlszEmpty)
{
m_fEmpty = CDXLOperatorFactory::FValueFromXmlstr
(
m_pphm->Pmm(),
xmlszEmpty,
EdxltokenEmptyRelation,
EdxltokenStatsDerivedRelation
);
}
}
}
示例13: SetAttributes
void GpXmlStateMachine::SetAttributes(GpType* target, const Attributes& attrs)
{
XMLSize_t numAtts = attrs.getLength();
string retValue;
map<string, string> attributes;
DEBOUT("GpXmlStateMachine::SetAttributes - Type");
if (numAtts > 0)
{
for (XMLSize_t i = 0; i < numAtts; i++)
{
string local(XMLString::transcode(attrs.getLocalName(i) ) );
string value(XMLString::transcode(attrs.getValue(i) ) );
attributes[local] = value;
DEBOUT(i);
DEBOUT(local);
DEBOUT(value);
}
// Checking the member for constness
if (FindAttribute(attributes, ConstStr, retValue) )
{
if (retValue.compare(TrueStr) == 0)
{
target->Const(true);
}
}
// Checking the member for staticness
if (FindAttribute(attributes, StaticStr, retValue) )
{
if (retValue.compare(TrueStr) == 0)
{
target->Static(true);
}
}
// Checking if the member is a pointer or reference
if (FindAttribute(attributes, DirecStr, retValue) )
{
if (retValue.compare(PtrStr) == 0)
{
target->Direc(POINTER);
DEBOUT("Pointer");
}
else
{
if (retValue.compare(RefStr) == 0)
{
target->Direc(REFERENCE);
DEBOUT("Reference");
}
}
}
}
}
示例14: CDouble
//---------------------------------------------------------------------------
// @function:
// CParseHandlerStatsDerivedRelation::StartElement
//
// @doc:
// Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerStatsDerivedRelation::StartElement
(
const XMLCh* const element_uri,
const XMLCh* const element_local_name,
const XMLCh* const element_qname,
const Attributes& attrs
)
{
if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenStatsDerivedColumn), element_local_name))
{
// start new derived column element
CParseHandlerBase *parse_handler_base = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenStatsDerivedColumn), m_parse_handler_mgr, this);
m_parse_handler_mgr->ActivateParseHandler(parse_handler_base);
// store parse handler
this->Append(parse_handler_base);
parse_handler_base->startElement(element_uri, element_local_name, element_qname, attrs);
}
else
{
GPOS_ASSERT(0 == this->Length());
// parse rows
const XMLCh *xml_rows = CDXLOperatorFactory::ExtractAttrValue
(
attrs,
EdxltokenRows,
EdxltokenStatsDerivedRelation
);
m_rows = CDouble(CDXLOperatorFactory::ConvertAttrValueToDouble
(
m_parse_handler_mgr->GetDXLMemoryManager(),
xml_rows,
EdxltokenRows,
EdxltokenStatsDerivedRelation
));
m_empty = false;
const XMLCh *xml_is_empty = attrs.getValue(CDXLTokens::XmlstrToken(EdxltokenEmptyRelation));
if (NULL != xml_is_empty)
{
m_empty = CDXLOperatorFactory::ConvertAttrValueToBool
(
m_parse_handler_mgr->GetDXLMemoryManager(),
xml_is_empty,
EdxltokenEmptyRelation,
EdxltokenStatsDerivedRelation
);
}
}
}
示例15: startElement
void XTandemInfileXMLHandler::startElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname, const Attributes & attributes)
{
tag_.push_back(String(sm_.convert(qname)));
if (tag_.back() == "note")
{
int type_idx = attributes.getIndex(sm_.convert("type"));
int label_idx = attributes.getIndex(sm_.convert("label"));
if (type_idx != -1)
{
actual_note_.note_type = String(sm_.convert(attributes.getValue(type_idx)));
}
if (label_idx != -1)
{
actual_note_.note_label = String(sm_.convert(attributes.getValue(label_idx)));
}
}
}