本文整理汇总了C++中XMLNode::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLNode::Name方法的具体用法?C++ XMLNode::Name怎么用?C++ XMLNode::Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLNode
的用法示例。
在下文中一共展示了XMLNode::Name方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Export
bool SOAPSecAttr::Export(SecAttrFormat format,XMLNode &val) const {
if(format == UNDEFINED) {
} else if(format == ARCAuth) {
NS ns;
ns["ra"]="http://www.nordugrid.org/schemas/request-arc";
val.Namespaces(ns); val.Name("ra:Request");
XMLNode item = val.NewChild("ra:RequestItem");
if(!object_.empty()) {
XMLNode object = item.NewChild("ra:Resource");
object=object_;
object.NewAttribute("Type")="string";
object.NewAttribute("AttributeId")="http://www.nordugrid.org/schemas/policy-arc/types/soap/endpoint";
};
if(!action_.empty()) {
XMLNode action = item.NewChild("ra:Action");
action=action_;
action.NewAttribute("Type")="string";
action.NewAttribute("AttributeId")="http://www.nordugrid.org/schemas/policy-arc/types/soap/operation";
};
if(!context_.empty()) {
XMLNode context = item.NewChild("ra:Context").NewChild("ra:ContextAttribute");
context=context_;
context.NewAttribute("Type")="string";
context.NewAttribute("AttributeId")="http://www.nordugrid.org/schemas/policy-arc/types/soap/namespace";
};
return true;
} else if(format == XACML) {
NS ns;
ns["ra"]="urn:oasis:names:tc:xacml:2.0:context:schema:os";
val.Namespaces(ns); val.Name("ra:Request");
if(!object_.empty()) {
XMLNode object = val.NewChild("ra:Resource");
XMLNode attr = object.NewChild("ra:Attribute");
attr.NewChild("ra:AttributeValue") = object_;
attr.NewAttribute("DataType")="xs:string";
attr.NewAttribute("AttributeId")="http://www.nordugrid.org/schemas/policy-arc/types/soap/endpoint";
};
if(!action_.empty()) {
XMLNode action = val.NewChild("ra:Action");
XMLNode attr = action.NewChild("ra:Attribute");
attr.NewChild("ra:AttributeValue") = action_;
attr.NewAttribute("DataType")="xs:string";
attr.NewAttribute("AttributeId")="http://www.nordugrid.org/schemas/policy-arc/types/soap/operation";
};
if(!context_.empty()) {
XMLNode context = val.NewChild("ra:Environment");
XMLNode attr = context.NewChild("ra:Attribute");
attr.NewChild("ra:AttributeValue") = context_;
attr.NewAttribute("DataType")="xs:string";
attr.NewAttribute("AttributeId")="http://www.nordugrid.org/schemas/policy-arc/types/soap/namespace";
};
return true;
} else {
};
return false;
}
示例2: XMLNode
XMLNode *
XMLNode::AddChild(const string &name)
{
XMLNode *child = new XMLNode();
child->Name() = name;
children.push_back(child);
return child;
}
示例3: CheckComputingService
bool CheckComputingService(XMLNode result) {
if(result.Namespace() != GLUE2_NAMESPACE) {
logger.msg(ERROR,"Query returned unexpected element: %s:%s",result.Namespace(),result.Name());
return false;
};
if(result.Name() != "ComputingService") {
logger.msg(ERROR,"Query returned unexpected element: %s:%s",result.Namespace(),result.Name());
return false;
};
std::string errstr;
std::string glue2_schema = ArcLocation::GetDataDir()+G_DIR_SEPARATOR_S+"schema"+G_DIR_SEPARATOR_S+"GLUE2.xsd";
if(!result.Validate(glue2_schema,errstr)) {
logger.msg(ERROR,"Element validation according to GLUE2 schema failed: %s",errstr);
return false;
};
return true;
}
示例4: ProcessAsRoot
//----------------------------------------------------------------------
StatementData OutputChannelNodeProcessor::ProcessAsRoot( XMLParser& parser, XMLNode* node )
{
std::string statement;
m_shaderGenerator->EnableOuputChannel( m_lightingModelComp );
XMLNode* child = node->FirstChildElement();
if( child != nullptr )
{
for( ; child != nullptr; child = child->NextSiblingElement() )
{
std::string name = child->Name();
if( name.compare( "Input" ) == 0 )
{
StatementData statementData;
statementData = ProcessInputNode( parser, child );
if( statementData.outputType == m_outputType || ( m_outputType == VT_VECTOR_4 && statementData.outputType == VT_TEXTURE_SAMPLE_2D ) )
{
statement = m_outputVariable + " = " + statementData.statement + ";";
}
else
{
m_shaderGenerator->AddLogMessage( "Incorrect data type: \'%s\' provided for output channel %s", color::RED, GetVariableTypeAsString( statementData.outputType ).c_str(), m_name.c_str() );
m_shaderGenerator->EnableCompilerErrorFlag();
}
}
else
{
StatementNodeProcessor* processor = m_shaderGenerator->GetStatementNodeProcessor( name );
if( processor != nullptr )
{
statement = m_outputVariable + " = " + processor->ProcessAsChild( parser, child ).statement + ";";
}
else
{
//Invalid node processor
m_shaderGenerator->AddLogMessage( "Invalid node as child statement for %s output channel: %s", color::RED, name.c_str(), m_name.c_str() );
m_shaderGenerator->EnableCompilerErrorFlag();
}
}
}
}
else
{
//Invalid Diffuse statement no input :(
m_shaderGenerator->AddLogMessage( "Invalid %s channel statement. No input provided", color::RED, m_name.c_str() );
m_shaderGenerator->EnableCompilerErrorFlag();
}
StatementData shaderVariable;
shaderVariable.statement = statement;
shaderVariable.outputType = VT_VECTOR_4;
return shaderVariable;
}
示例5: if
std::map<std::string, Status*> Status::GetAllStatusses()
{
if (s_allStatusses.size() == 0)
{
IImageManager* imageManager = PlatformSpecific::GetImageManager();
//otherwise open status XML file
typedef vector<XMLNode*>::const_iterator SI;
vector<XMLNode*> statusNodes = BmeClient::GetPreferences()->GetIconPrefs()->GetStatusNodes();
for (SI s = statusNodes.begin(); s != statusNodes.end(); ++s)
{
XMLNode* statusNode = *s;
if (statusNode->Name() == "status")
{
vector<XMLNode*> children = statusNode->Children();
Status* status = new Status();
for (SI c = children.begin(); c != children.end(); ++c)
{
XMLNode* statusChild = *c;
if (statusChild->Name() == "icon")
{
std::string iconPath = statusChild->StringValue();
IPath* iconFullPath = PlatformSpecific::GetPathManager()->GetIconPrefsPath()->Append(iconPath);
Image* statusIcon = imageManager->GetImageFromFile(iconFullPath->ToString());
status->AddIcon(statusIcon);
delete iconFullPath;
}
else if (statusChild->Name() == "message")
{
status->SetStatusName(statusChild->StringValue());
}
else if (statusChild->Name() == "protocol")
{
status->SetAbbreviation(statusChild->StringValue());
}
else if (statusChild->Name() == "visible")
{
bool userChoice = atoi(statusChild->StringValue().c_str());
status->SetUserChoice(userChoice);
}
else if (statusChild->Name() == "color")
{
}
}
s_allStatusses[status->GetAbbreviation()] = (status);
}
}
delete imageManager;
}
return s_allStatusses;
}
示例6:
XMLNode*
resource_to_xmb_msg(const StringResource& res)
{
// the msg element
vector<XMLAttribute> attrs;
string name = res.pos.file;
name += ":";
name += res.TypedID();
attrs.push_back(XMLAttribute("", "name", name));
attrs.push_back(XMLAttribute("", "desc", strip_newlines(res.comment)));
attrs.push_back(XMLAttribute(XMLNS_XMLNS, "space", "preserve"));
XMLNode* msg = XMLNode::NewElement(res.pos, "", "msg", attrs, XMLNode::EXACT);
// the contents are in xliff/html, convert it to xliff
int err = 0;
XMLNode* value = res.value;
string tag = value->Name();
int phID = 0;
for (vector<XMLNode*>::const_iterator it=value->Children().begin();
it!=value->Children().end(); it++) {
err |= convert_html_to_xliff(*it, tag, msg, &phID);
}
if (err != 0) {
return NULL;
}
// and then convert that to xmb
for (vector<XMLNode*>::iterator it=msg->EditChildren().begin();
it!=msg->EditChildren().end(); it++) {
err |= convert_xliff_to_ph(*it, &phID);
}
if (err == 0) {
return msg;
} else {
return NULL;
}
}
示例7: ProcessAsRoot
//----------------------------------------------------------------------
StatementData VariableNodeProcessor::ProcessAsRoot( XMLParser& parser, XMLNode* node )
{
std::string variableName;
std::string variableValue;
std::string variableType;
if( parser.validateXMLAttributes( node, "name,type", "" ) )
{
variableName = parser.getXMLAttributeAsString( node, "name", "" );
variableType = parser.getXMLAttributeAsString( node, "type", "" );
std::string variableData = parser.getXMLElementPCDataAsString( node );
if( variableType.compare( "Texture2D" ) == 0 )
{
m_shaderGenerator->AddLogMessage( "Cannot declare textures as variables", color::RED );
m_shaderGenerator->EnableCompilerErrorFlag();
}
else
{
XMLNode* child = node->FirstChildElement();
if( child != nullptr )
{
for( ; child != nullptr; child = child->NextSiblingElement() )
{
std::string name = child->Name();
if( name.compare( "Input" ) == 0 )
{
StatementData statementData;
statementData = ProcessInputNode( parser, child );
if( statementData.outputType != VT_COUNT )
{
if( statementData.outputType == VT_TEXTURE_SAMPLE_2D )
{
m_shaderGenerator->AddLogMessage( "Cannot declare a variable of type Texture2D", color::RED );
}
else
{
variableValue = statementData.statement;
}
}
else
{
variableValue = "0";
variableType = "Real";
}
}
else
{
StatementNodeProcessor* processor = m_shaderGenerator->GetStatementNodeProcessor( name );
if( processor != nullptr )
{
variableValue = processor->ProcessAsChild( parser, child ).statement;
}
else
{
//Invalid node processor
m_shaderGenerator->AddLogMessage( "Invalid child node: %s for variable: %s", color::RED, name.c_str(), variableName.c_str() );
m_shaderGenerator->EnableCompilerErrorFlag();
}
}
}
}
else
{
std::vector< std::string > variableDataList;
stringTokenizer( variableData, variableDataList, "," );
if( ValidListOfVariables( variableDataList ) )
variableValue = GetVariableConstructionFromType( GetVariableTypeFromString( variableType ), StripDollarSignsFromCommaSeperatedVariables( variableData ) );
else
{
for( unsigned int i = 0; i < variableDataList.size(); ++i )
{
if( variableDataList[i][0] == '$' )
variableDataList[i] = variableDataList[i].substr( 1, variableDataList[i].npos );
else if( !ValidRealNumber( variableDataList[i] ) )
{
m_shaderGenerator->AddLogMessage( "Syntax error in variable declaration in variable name usage: %s. Missing \'$\'?", color::RED, variableData.c_str() );
m_shaderGenerator->EnableCompilerErrorFlag();
}
}
if( !m_shaderGenerator->WasCompilerError() && ValidListOfVariables( variableDataList ) )
{
variableValue = StripDollarSignsFromListOfVariables( variableDataList );
}
else
{
m_shaderGenerator->AddLogMessage( "Invalid data entered for variable declaration: Variable name: %s Data: %s", color::RED, variableName.c_str(), variableData.c_str() );
m_shaderGenerator->EnableCompilerErrorFlag();
}
}
}
}
}
if( variableName.size() > 0 )
m_shaderGenerator->AddVariable( variableType, variableName, variableValue, ( m_name.compare( "Constant" ) == 0 ) );
return StatementData( "", VT_COUNT );
}
示例8: if
void MSNP12ContactListProtocol::HandleMessage(ProtocolMessage* message)
{
std::string command = message->CommandType();
//CHANGED IN MSNP11!!!!
if (command == NotificationMessages::K_SYNCHRONISE_LIST)
{
std::string firstTimeStamp = message->GetParam(0);
std::string secondTimeStamp = message->GetParam(1);
if (firstTimeStamp != secondTimeStamp)
{
//we should update our contactlist
std::string numContacts = message->GetParam(2);
m_numContacts = atoi(numContacts.c_str());
std::string numGroups = message->GetParam(3);
m_numGroups = atoi(numGroups.c_str());
}
else
{
//if we don't have to synchronise the list and are using the cached contact list instead
//be sure to set the m_contactsAdded and m_groupsAdded to the number of contacts and groups
//available. In that way the initial status message will always be sent, and always after
//the syn message
m_contactsAdded = m_numContacts;
m_groupsAdded = m_numGroups;
}
}
else if (command == NotificationMessages::K_CONTACT_LIST_MSG)
{
Contact *newContact = new Contact();
for (int i = 0; i < message->ParamCount(); i++)
{
std::string temp = message->GetParam(i);
if (temp.find("N=") != std::string::npos)
{
temp = temp.substr(2);
newContact->SetPassport(temp);
}
else if (temp.find("F=") != std::string::npos)
{
temp = temp.substr(2);
std::string friendlyName = temp;
friendlyName = Common::decodeURL(friendlyName);
newContact->SetFriendlyName(friendlyName);
}
else if (temp.find("C=") != std::string::npos)
{
temp = temp.substr(2);
newContact->SetGUID(temp);
}
else if (i == 4)
{
//only in this order!!!
//parse groupID's
std::string groupId;
int32_t startIndex = 0;
size_t commaIndex = std::string::npos;
do
{
commaIndex = temp.find(",",startIndex);
if (commaIndex != std::string::npos)
{
//get one of the groupID's
groupId = temp.substr(startIndex, commaIndex-startIndex);
//add group to grouplist of contact
newContact->AddGroup(groupId);
cout << "GroupID 1= " << groupId << endl;
groupId = "";
//start searching at position past the previous found comma
startIndex = commaIndex + 1;
}
else
{
//get one of the groupID's
//temp.CopyInto(groupID,0, temp.CountChars());
groupId = temp;
//add group to grouplist of contact
newContact->AddGroup(groupId);
cout << "GroupID 2= " << groupId << endl;
groupId = "";
break;
}
}
while (commaIndex <= temp.size());
}
else
{
int32_t partOfLists = atoi(temp.c_str());
newContact->SetPartOfLists(partOfLists);
}
}
//set initial status for the contact to offline
newContact->SetStatus(Status::GetStatusForAbbreviation(Statusses::K_OFFLINE));
//inform the contact list that a new contact has been found
m_contactListProtocolDelegate->ContactFound(newContact);
m_contactsAdded++;
//see if we're done synchronizing the lists
//.........这里部分代码省略.........
示例9: main
//.........这里部分代码省略.........
};
} else if(command == "kill") {
EMIESJob job;
FillJob(job,argc,argv);
if(!ac.kill(job)) {
logger.msg(ERROR,"Kill failed");
return 1;
};
} else if(command == "list") {
std::list<EMIESJob> jobs;
if(!ac.list(jobs)) {
logger.msg(ERROR,"List failed");
return 1;
}
print(jobs);
} else if(command == "ivalidate") {
std::map<std::string,std::string> interfaces;
interfaces["org.ogf.glue.emies.activitycreation"] = "";
interfaces["org.ogf.glue.emies.activitymanagement"] = "";
interfaces["org.ogf.glue.emies.activityinfo"] = "";
interfaces["org.ogf.glue.emies.resourceinfo"] = "";
interfaces["org.ogf.glue.emies.delegation"] = "";
logger.msg(INFO,"Fetching resource description from %s",url.str());
XMLNode info;
if(!ac.sstat(info,false)) {
logger.msg(ERROR,"Failed to obtain resource description: %s",ac.failure());
return 1;
};
int n = 0;
int cnum1 = 0;
for(;;++n) {
XMLNode node = info.Child(n);
if(!node) break;
if(node.Namespace() != GLUE2_NAMESPACE) {
logger.msg(ERROR,"Resource description contains unexpected element: %s:%s",node.Namespace(),node.Name());
return 1;
};
if((node.Name() != "ComputingService") && (node.Name() != "Service")) {
logger.msg(ERROR,"Resource description contains unexpected element: %s:%s",node.Namespace(),node.Name());
return 1;
};
std::string errstr;
std::string glue2_schema = ArcLocation::GetDataDir()+G_DIR_SEPARATOR_S+"schema"+G_DIR_SEPARATOR_S+"GLUE2.xsd";
if(!node.Validate(glue2_schema,errstr)) {
logger.msg(ERROR,"Resource description validation according to GLUE2 schema failed: ");
for(std::string::size_type p = 0;;) {
if(p >= errstr.length()) break;
std::string::size_type e = errstr.find('\n',p);
if(e == std::string::npos) e = errstr.length();
logger.msg(ERROR,"%s", errstr.substr(p,e-p));
p = e + 1;
};
return 1;
};
if(node.Name() == "ComputingService") {
++cnum1;
XMLNode endpoint = node["ComputingEndpoint"];
for(;(bool)endpoint;++endpoint) {
XMLNode name = endpoint["InterfaceName"];
for(;(bool)name;++name) {
std::string iname = (std::string)name;
if((bool)endpoint["URL"]) {
if(interfaces.find(iname) != interfaces.end()) interfaces[iname] = (std::string)endpoint["URL"];
};
};
};
示例10: NewChild
XMLNode XMLNode::NewChild(const char *name, const NS& namespaces, int n, bool global_order) {
XMLNode x = NewChild("", n, global_order); // placeholder
x.Namespaces(namespaces);
x.Name(name);
return x;
}
示例11: ae
void GLUE2::ParseExecutionTargets(XMLNode glue2tree, std::list<ComputingServiceType>& targets) {
XMLNode GLUEService = glue2tree;
if(GLUEService.Name() != "ComputingService") {
GLUEService = glue2tree["ComputingService"];
}
for (; GLUEService; ++GLUEService) {
ComputingServiceType cs;
if (GLUEService["ID"]) {
cs->ID = (std::string)GLUEService["ID"];
}
if (GLUEService["Name"]) {
cs->Name = (std::string)GLUEService["Name"];
}
if (GLUEService["Capability"]) {
for (XMLNode n = GLUEService["Capability"]; n; ++n) {
cs->Capability.insert((std::string)n);
}
}
if (GLUEService["Type"]) {
cs->Type = (std::string)GLUEService["Type"];
} else {
logger.msg(VERBOSE, "The Service doesn't advertise its Type.");
}
if (GLUEService["QualityLevel"]) {
cs->QualityLevel = (std::string)GLUEService["QualityLevel"];
} else {
logger.msg(VERBOSE, "The ComputingService doesn't advertise its Quality Level.");
}
if (GLUEService["TotalJobs"]) {
cs->TotalJobs = stringtoi((std::string)GLUEService["TotalJobs"]);
}
if (GLUEService["RunningJobs"]) {
cs->RunningJobs = stringtoi((std::string)GLUEService["RunningJobs"]);
}
if (GLUEService["WaitingJobs"]) {
cs->WaitingJobs = stringtoi((std::string)GLUEService["WaitingJobs"]);
}
if (GLUEService["StagingJobs"]) {
cs->StagingJobs = stringtoi((std::string)GLUEService["StagingJobs"]);
}
if (GLUEService["SuspendedJobs"]) {
cs->SuspendedJobs = stringtoi((std::string)GLUEService["SuspendedJobs"]);
}
if (GLUEService["PreLRMSWaitingJobs"]) {
cs->PreLRMSWaitingJobs = stringtoi((std::string)GLUEService["PreLRMSWaitingJobs"]);
}
// The GLUE2 specification does not have attribute ComputingService.LocalRunningJobs
//if (GLUEService["LocalRunningJobs"]) {
// cs->LocalRunningJobs = stringtoi((std::string)GLUEService["LocalRunningJobs"]);
//}
// The GLUE2 specification does not have attribute ComputingService.LocalWaitingJobs
//if (GLUEService["LocalWaitingJobs"]) {
// cs->LocalWaitingJobs = stringtoi((std::string)GLUEService["LocalWaitingJobs"]);
//}
// The GLUE2 specification does not have attribute ComputingService.LocalSuspendedJobs
//if (GLUEService["LocalSuspendedJobs"]) {
// cs->LocalWaitingJobs = stringtoi((std::string)GLUEService["LocalSuspendedJobs"]);
//}
XMLNode xmlCENode = GLUEService["ComputingEndpoint"];
int endpointID = 0;
for(;(bool)xmlCENode;++xmlCENode) {
ComputingEndpointType ComputingEndpoint;
if (xmlCENode["URL"]) {
ComputingEndpoint->URLString = (std::string)xmlCENode["URL"];
} else {
logger.msg(VERBOSE, "The ComputingEndpoint has no URL.");
}
if (xmlCENode["HealthState"]) {
ComputingEndpoint->HealthState = (std::string)xmlCENode["HealthState"];
} else {
logger.msg(VERBOSE, "The Service advertises no Health State.");
}
if (xmlCENode["HealthStateInfo"]) {
ComputingEndpoint->HealthStateInfo = (std::string)xmlCENode["HealthStateInfo"];
}
if (xmlCENode["Capability"]) {
for (XMLNode n = xmlCENode["Capability"]; n; ++n) {
ComputingEndpoint->Capability.insert((std::string)n);
}
}
if (xmlCENode["QualityLevel"]) {
ComputingEndpoint->QualityLevel = (std::string)xmlCENode["QualityLevel"];
} else {
logger.msg(VERBOSE, "The ComputingEndpoint doesn't advertise its Quality Level.");
}
if (xmlCENode["Technology"]) {
ComputingEndpoint->Technology = (std::string)xmlCENode["Technology"];
}
if (xmlCENode["InterfaceName"]) {
ComputingEndpoint->InterfaceName = lower((std::string)xmlCENode["InterfaceName"]);
} else if (xmlCENode["Interface"]) { // No such attribute according to GLUE2 document. Legacy/backward compatibility?
ComputingEndpoint->InterfaceName = lower((std::string)xmlCENode["Interface"]);
} else {
logger.msg(VERBOSE, "The ComputingService doesn't advertise its Interface.");
//.........这里部分代码省略.........