本文整理汇总了C++中XElement::AddChild方法的典型用法代码示例。如果您正苦于以下问题:C++ XElement::AddChild方法的具体用法?C++ XElement::AddChild怎么用?C++ XElement::AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XElement
的用法示例。
在下文中一共展示了XElement::AddChild方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddSymbolNode
void GetSymbolResponse::AddSymbolNode(XElement* pxParent, Symbol* pSymbol)
{
XElement *pxSymbol = pxParent->AddChild("Symbol", NULL);
XElement *pxName = pxSymbol->AddChild("Name");
pxName->AddChildText(pSymbol->GetName(), true);
const char* icon_name = pSymbol->GetIcon();
//icon_name = pSymbol->GetIcon();
char icon_xlink[AUGE_PATH_MAX];
memset(icon_xlink, 0, AUGE_PATH_MAX);
g_sprintf(icon_xlink,"http://%s:%s/%s/symbol/%s", m_pWebContext->GetServer(), m_pWebContext->GetPort(), AUGE_VIRTUAL_NAME, icon_name);
XElement *pxIcon = pxSymbol->AddChild("Icon", NULL);
pxIcon->SetAttribute("xlink:href",icon_xlink, NULL);
}
示例2: AddDataSourceNode
void GetDataSourceResponse::AddDataSourceNode(XElement* pxRoot, Workspace* pWorkspace)
{
XElement *pxNode = NULL;
XElement *pxDataSource = NULL;
pxDataSource = pxRoot->AddChild("DataSource", NULL);
pxNode = pxDataSource->AddChild("Name");
pxNode->AddChildText(pWorkspace->GetName());
pxNode = pxDataSource->AddChild("Engine");
pxNode->AddChildText(pWorkspace->GetEngine()->GetID());
pxNode = pxDataSource->AddChild("ConnectionString");
pxNode->AddChildText(pWorkspace->GetConnectionString());
}
示例3: WriteDocument
void DescribeCsvResponse::WriteDocument(XDocument* pxDoc)
{
const char* setName = m_pDataset->GetName();
char str[AUGE_NAME_MAX];
XElement *pxNode = NULL;
XElement *pxRoot = NULL;
pxRoot = pxDoc->CreateRootNode("schema", NULL, NULL);
pxRoot->SetNamespaceDeclaration("http://www.opengis.net/wfs",NULL);
pxRoot->SetNamespaceDeclaration("http://www.opengis.net/wfs","wfs");
pxRoot->SetNamespaceDeclaration("http://www.opengis.net/ows","ows");
pxRoot->SetNamespaceDeclaration("http://www.opengis.net/gml","gml");
pxRoot->SetNamespaceDeclaration("http://www.w3.org/1999/xlink","xlink");
pxRoot->SetNamespaceDeclaration("http://www.w3.org/2001/XMLSchema-instance","xsi");
pxRoot->SetNamespaceDeclaration("http://www.w3.org/2001/XMLSchema","xsd");
pxRoot->SetAttribute("version", "1.1.0", NULL);
// schema-->import
XElement* pxImport = pxRoot->AddChild("import", "xsd");
pxImport->SetAttribute("namespace","http://www.opengis.net/gml", NULL);
// schema-->complexType
g_sprintf(str,"%sType", setName);
XElement* pxComplexType = pxRoot->AddChild("complexType", "xsd");
pxComplexType->SetAttribute("name", str, NULL, true);
// schema-->complexType-->complexContent
XElement* pxComplexContent = pxComplexType->AddChild("complexContent","xsd");
// schema-->complexType-->complexContent-->extentsion
XElement* pxExtentsion = pxComplexContent->AddChild("extentsion", "xsd");
pxExtentsion->SetAttribute("base","gml:AbstractFeatureType", NULL);
// schema-->complexType-->complexContent-->extentsion-->sequence
XElement* pxSequence = pxExtentsion->AddChild("sequence", "xsd");
GField *pField = NULL;
GFields *pFields = m_pDataset->GetFields();
g_uint count = pFields->Count();
augeFieldType ftype = augeFieldTypeNone;
// schema-->complexType-->complexContent-->extentsion-->sequence-->element
XElement* pxElement = NULL;
for(g_uint i=0; i<count; i++)
{
pField = pFields->GetField(i);
pxElement = pxSequence->AddChild("element", "xsd");
const char* fname = pField->GetName();
const char* utf8_name = auge_encoding_convert("GBK","UTF-8",fname,strlen(fname));
pxElement->SetAttribute("name",utf8_name, NULL);
pxElement->SetAttribute("nillable",pField->IsNullable()?"true":"false", NULL);
pxElement->SetAttribute("minOccurs","0", NULL);
pxElement->SetAttribute("maxOccurs","1", NULL);
pxElement->SetAttribute("type","xsd:string", NULL);
}
// schema-->element
pxElement = pxRoot->AddChild("element", "xsd");
g_sprintf(str, "%sType", setName);
pxElement->SetAttribute("type",str, NULL, true);
pxElement->SetAttribute("name",setName, NULL, true);
pxElement->SetAttribute("substitutionGroup","gml:_Feature", NULL);
}
示例4: AddJobNode
void GetJobResponse::AddJobNode(XElement* pxRoot, Job* pJob)
{
char str[AUGE_MSG_MAX];
XElement *pxNode = NULL;
XElement *pxExtent = NULL;
XElement *pxJob = pxRoot->AddChild("Job", NULL);
pxNode = pxJob->AddChild("UUID");
pxNode->AddChildText(pJob->GetUUID());
pxNode = pxJob->AddChild("Operation");
pxNode->AddChildText(pJob->GetOperation());
pxNode = pxJob->AddChild("Params");
pxNode->AddChildText(pJob->GetParams());
pxNode = pxJob->AddChild("Client");
pxNode->AddChildText(pJob->GetClient());
pxNode = pxJob->AddChild("Server");
pxNode->AddChildText(pJob->GetServer());
TIME_STRU start_stru;
pJob->GetStartTime(&start_stru);
char time_str[AUGE_NAME_MAX];
memset(time_str, 0, AUGE_NAME_MAX);
g_snprintf(time_str,AUGE_NAME_MAX,"%d-%02d-%02d %02d:%02d:%02d",start_stru.usYear,
start_stru.usMonth,
start_stru.usDay,
start_stru.usHour,
start_stru.usMinute,
start_stru.usSecond);
pxNode = pxJob->AddChild("StartTime");
pxNode->AddChildText(time_str);
pJob->GetEndTime(&start_stru);
memset(time_str, 0, AUGE_NAME_MAX);
g_snprintf(time_str,AUGE_NAME_MAX,"%d-%02d-%02d %02d:%02d:%02d",start_stru.usYear,
start_stru.usMonth,
start_stru.usDay,
start_stru.usHour,
start_stru.usMinute,
start_stru.usSecond);
pxNode = pxJob->AddChild("EndTime");
pxNode->AddChildText(time_str);
pxNode = pxJob->AddChild("State");
switch(pJob->GetState())
{
case augeStateRunning:
pxNode->AddChildText("Running");
break;
case augeStateFinished:
pxNode->AddChildText("Finished");
break;
case augeStateCanceled:
pxNode->AddChildText("Canceled");
break;
}
}
示例5: XDocument
bool DescribeFeatureTypeHandler::WriteDescribeFeatureType_1_1_0(WebContext* pWebContext, const char* typeName, FeatureClass* pFeatureClass)
{
char str[AUGE_NAME_MAX];
char cache_name[AUGE_NAME_MAX];
char cache_file[AUGE_PATH_MAX];
const char* cache_path = pWebContext->GetCacheProtocolPath();
g_snprintf(cache_name, AUGE_NAME_MAX,"%s_wfs_%s_describe_feauretype_1_1_0", pWebContext->GetService(), typeName);
auge_make_path(cache_file, NULL, cache_path, cache_name,"xml");
XElement *pxNode = NULL;
XElement *pxRoot = NULL;
XDocument *pxDoc = new XDocument();
pxRoot = pxDoc->CreateRootNode("schema", NULL, NULL);
pxRoot->SetNamespaceDeclaration("http://www.opengis.net/wfs",NULL);
pxRoot->SetNamespaceDeclaration("http://www.opengis.net/wfs","wfs");
pxRoot->SetNamespaceDeclaration("http://www.opengis.net/ows","ows");
pxRoot->SetNamespaceDeclaration("http://www.opengis.net/gml","gml");
pxRoot->SetNamespaceDeclaration("http://www.w3.org/1999/xlink","xlink");
pxRoot->SetNamespaceDeclaration("http://www.w3.org/2001/XMLSchema-instance","xsi");
pxRoot->SetNamespaceDeclaration("http://www.w3.org/2001/XMLSchema","xsd");
pxRoot->SetAttribute("version", "1.1.0", NULL);
// schema-->import
XElement* pxImport = pxRoot->AddChild("import", "xsd");
pxImport->SetAttribute("namespace","http://www.opengis.net/gml", NULL);
// schema-->complexType
g_sprintf(str,"%sType", typeName);
XElement* pxComplexType = pxRoot->AddChild("complexType", "xsd");
pxComplexType->SetAttribute("name", str, NULL, true);
// schema-->complexType-->complexContent
XElement* pxComplexContent = pxComplexType->AddChild("complexContent","xsd");
// schema-->complexType-->complexContent-->extentsion
XElement* pxExtentsion = pxComplexContent->AddChild("extentsion", "xsd");
pxExtentsion->SetAttribute("base","gml:AbstractFeatureType", NULL);
// schema-->complexType-->complexContent-->extentsion-->sequence
XElement* pxSequence = pxExtentsion->AddChild("sequence", "xsd");
GField *pField = NULL;
GFields *pFields = pFeatureClass->GetFields();
g_uint count = pFields->Count();
augeFieldType ftype = augeFieldTypeNone;
// schema-->complexType-->complexContent-->extentsion-->sequence-->element
XElement* pxElement = NULL;
for(g_uint i=0; i<count; i++)
{
pField = pFields->GetField(i);
pxElement = pxSequence->AddChild("element", "xsd");
const char* fname = pField->GetName();
const char* utf8_name = auge_encoding_convert("GBK","UTF-8",fname,strlen(fname));
pxElement->SetAttribute("name",utf8_name, NULL);
pxElement->SetAttribute("nillable",pField->IsNullable()?"true":"false", NULL);
pxElement->SetAttribute("minOccurs","0", NULL);
pxElement->SetAttribute("maxOccurs","1", NULL);
ftype = pField->GetType();
if(ftype==augeFieldTypeGeometry)
{
augeGeometryType gtype = pField->GetGeometryDef()->GeometryType();
const char* sss = GetOgcGeometryType(gtype);
g_sprintf(str,"gml:%sPropertyType",sss);
pxElement->SetAttribute("type",str, NULL);
}
else
{
g_sprintf(str, "xsd:%s", GetOgcFieldType(pField->GetType()));
pxElement->SetAttribute("type",str, NULL);
}
if(ftype==augeFieldTypeString)
{
g_sprintf(str,"%d",pField->GetLength());
pxElement->SetAttribute("length",str, NULL);
}
}
// schema-->element
pxElement = pxRoot->AddChild("element", "xsd");
g_sprintf(str, "%sType", typeName);
pxElement->SetAttribute("type",str, NULL, true);
pxElement->SetAttribute("name",typeName, NULL, true);
pxElement->SetAttribute("substitutionGroup","gml:_Feature", NULL);
pxDoc->Save(cache_file, pWebContext->GetResponseEncoding(), 1);
pxDoc->Release();
return true;
}
示例6: Write
RESULTCODE CapabilitiesResponse::Write(WebWriter* pWriter)
{
if(pWriter==NULL)
{
return AG_FAILURE;
}
char ims_xlink[AUGE_MSG_MAX];
g_sprintf(ims_xlink, "http://%s/%s/%s/ims?service=ims", m_pRequest->GetHost(),
AUGE_VIRTUAL_NAME,
m_pRequest->GetUser());
GLogger* pLogger = augeGetLoggerInstance();
pLogger->Debug(m_path.c_str(), __FILE__, __LINE__);
Service* pService = NULL;
EnumService *pServices = NULL;
ServiceManager* pServiceManager = augeGetServiceManagerInstance();
XElement *pxNode = NULL;
XDocument *pxDoc = new XDocument();
XElement *pxRoot = pxDoc->CreateRootNode("IMS_Capabilities", NULL, NULL);
pxRoot->SetNamespaceDeclaration("http://www.opengis.net/wms",NULL);
pxRoot->SetNamespaceDeclaration("http://www.w3.org/1999/xlink","xlink");
pxRoot->SetNamespaceDeclaration("http://www.w3.org/2001/XMLSchema-instance","xsi");
// IMS_Capabilities-->Capability
XElement *pxCapability = pxRoot->AddChild("Capability", NULL);
// IMS_Capabilities-->Capability-->Request
XElement *pxRequest = pxCapability->AddChild("Request", NULL);
WEngine* pWEngine = (WEngine*)augeGetWebEngineInstance();
std::vector<WebHandler*>& handlers = pWEngine->m_handlers;
std::vector<WebHandler*>::iterator iter;
for(iter=handlers.begin(); iter!=handlers.end(); iter++)
{
WebHandler* handler = *iter;
// IMS_Capabilities-->Capability-->Request-->GetCapabilities
XElement *pxOperation = pxRequest->AddChild("Operation", NULL);
pxOperation->SetAttribute("name",handler->GetName(), NULL);
// IMS_Capabilities-->Capability-->Request-->GetCapabilities-->Format
XElement *pxFormat = pxOperation->AddChild("Format", NULL);
// IMS_Capabilities-->Capability-->Request-->GetCapabilities-->Format-->DCPType
XElement *pxDCPType = pxOperation->AddChild("DCPType", NULL);
// IMS_Capabilities-->Capability-->Request-->GetCapabilities-->Format-->DCPType-->HTTP
XElement *pxHttp = pxDCPType->AddChild("HTTP", NULL);
// IMS_Capabilities-->Capability-->Request-->GetCapabilities-->Format-->DCPType-->HTTP-->Get
XElement *pxGet = pxHttp->AddChild("Get", NULL);
// IMS_Capabilities-->Capability-->Request-->GetCapabilities-->Format-->DCPType-->HTTP-->Get-->OnlineResource
XElement *pxOnlineResource = pxGet->AddChild("OnlineResource", NULL);
pxOnlineResource->SetAttribute("xlink:href",ims_xlink, NULL);
pxHttp = pxDCPType->AddChild("HTTP", NULL);
// IMS_Capabilities-->Capability-->Request-->GetCapabilities-->Format-->DCPType-->HTTP-->Post
XElement *pxPost = pxHttp->AddChild("Post", NULL);
// IMS_Capabilities-->Capability-->Request-->GetCapabilities-->Format-->DCPType-->HTTP-->Post-->OnlineResource
pxOnlineResource = pxPost->AddChild("OnlineResource", NULL);
pxOnlineResource->SetAttribute("xlink:href",ims_xlink, NULL);
}
XElement *pxServices = NULL;
XElement *pxService = NULL;
pxServices = pxRoot->AddChild("Services", NULL);
//pServices = pServiceManager->GetServices();
//pServices->Reset();
//pServices->Release();
pServices = pServiceManager->GetServices(m_pUser->GetID());
pServices->Reset();
const char* name = NULL;
while((pService=pServices->Next())!=NULL)
{
name = pService->GetName();
pxService = pxServices->AddChild("Service", NULL);
pxService->SetAttribute("name", name, NULL);
}
pServices->Release();
int len = 0;
g_uchar* buffer = NULL;
pxDoc->WriteToString(&buffer, len, "GBK",0);
pWriter->WriteHead(m_pRequest->GetMimeType());
pWriter->Write(buffer, len);
pWriter->WriteTail();
pLogger->Trace((g_char*)buffer);
pxDoc->Close();
AUGE_SAFE_RELEASE(pxDoc);
return AG_SUCCESS;
}