• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ XMLParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中XMLParser的典型用法代码示例。如果您正苦于以下问题:C++ XMLParser类的具体用法?C++ XMLParser怎么用?C++ XMLParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了XMLParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: LoadOtherStylesheet

	/* From XSLT_StylesheetParser::Callback: */
	virtual OP_STATUS LoadOtherStylesheet(URL stylesheet_url, XMLTokenHandler *token_handler, BOOL is_import)
	{
		if (!thread)
			return OpStatus::ERR;

		FramesDocument *doc = thread->GetScheduler()->GetFramesDocument();

		if (!DOM_XSLTAllowAccess(OpSecurityManager::XSLT_IMPORT_OR_INCLUDE, doc, stylesheet_url))
			/* FIXME: Should send a console message saying why here. */
			return OpStatus::ERR;

		XMLParser *parser;

		RETURN_IF_ERROR(XMLParser::Make(parser, NULL, doc, token_handler, stylesheet_url));

		OP_STATUS status = parser->Load(doc->GetURL(), TRUE);

		if (OpStatus::IsError(status))
		{
			OP_DELETE(parser);
			return status;
		}

		return OpStatus::OK;
	}
开发者ID:prestocore,项目名称:browser,代码行数:26,代码来源:domxslt.cpp


示例2: main

int main(int argc, char **argv)
{
  std::string nodeName = "node";
  std::string hostName = "localhost";
  std::string configFile = "";
  
  for(int i = 0; i < argc; i++)
  {
    if(!strcmp(argv[i], "-nodename"))
      nodeName = argv[i+1];
    if(!strcmp(argv[i], "-hostname"))
      hostName = argv[i+1];
    if(!strcmp(argv[i], "-config"))
      configFile = argv[i+1];
  }

  std::vector<boost::thread*> compThreads;
  XMLParser nodeParser;
  std::string configFileName = nodeName + ".xml";
  if (configFile.length() > 0)
    configFileName = configFile;
  if (nodeParser.Parse(configFileName))
  {      
    ros::init(argc, argv, nodeName.c_str());

    // Create Node Handle
    ros::NodeHandle n;

    ROS_INFO_STREAM(nodeName << " thread id = " << boost::this_thread::get_id());
    
    for (int i=0;i<nodeParser.compConfigList.size();i++)
    {
      std::string libraryLocation = nodeParser.compConfigList[i].libraryLocation;
      void *hndl = dlopen(libraryLocation.c_str(), RTLD_NOW);
      if(hndl == NULL)
      {
	cerr << dlerror() << endl;
	exit(-1);
      }
      void *mkr = dlsym(hndl, "maker");
      Component *comp_inst = ((Component *(*)(ComponentConfig &, int , char **))(mkr))
	(nodeParser.compConfigList[i], argc, argv);

      // Create Component Threads
      boost::thread *comp_thread = new boost::thread(componentThreadFunc, comp_inst);
      compThreads.push_back(comp_thread);
      ROS_INFO_STREAM(nodeName << " has started " << nodeParser.compConfigList[i].compName);
    }
    for (int i=0;i<compThreads.size();i++)
    {
      compThreads[i]->join();
    }
    return 0; 
  }
  else
  {
    printf("ERROR::Unable to parse XML file\n");
    return -1;
  }
}
开发者ID:finger563,项目名称:agse2015,代码行数:60,代码来源:node_main.cpp


示例3: md5File

void MainDlg::parseListDotXml() {
    //extract ZIP file
    bool extracted = FileTools::getInstance()->unzip(tmpDir, "/list.zip");
    if (!extracted) {
        //TODO: get error message
        hasError = true;
    }

    //verify MD5 sum.
    QString calculatedMd5 = md5::md5FromFile(tmpDir.path()+"/list.xml");
    QFile md5File(tmpDir.path()+"/list.md5");
    if (!md5File.open(QIODevice::ReadOnly)) {
        hasError = true;
    } else {
        QString originalMd5(md5File.readLine());
        if (originalMd5.compare(calculatedMd5)) {
            hasError = true;
        }
    }

    //actually parse XML file
    if (!hasError) {
        XMLParser xml;

        connect(&xml, SIGNAL(hasNewItem(SoftwareEntry*)), this, SLOT(addSoftwareEntry(SoftwareEntry*)));
        connect(&xml, SIGNAL(finished()), this, SLOT(buildTabContent()));

        xml.readFile(tmpDir.path()+"/list.xml");
    }
开发者ID:deadbird99,项目名称:Tinu,代码行数:29,代码来源:maindlg.cpp


示例4: Base64Decode

void DictionaryInfo::ReadLangTo(const GUTF8String& str, bool bEncoded)
{
	strLangToCode = "";
	langToLoc.clear();

	if (str.length() == 0)
		return;

	string strTemp = str;
	if (bEncoded)
		Base64Decode(strTemp);

	strLangToRaw = strTemp.c_str();

	stringstream sin(strTemp.c_str());
	XMLParser parser;
	if (parser.Parse(sin))
	{
		wstring strCode;
		if (parser.GetRoot()->GetAttribute(pszAttrCode, strCode))
			strLangToCode = MakeUTF8String(strCode);

		ReadLocalizedStrings(langToLoc, *parser.GetRoot());
	}
}
开发者ID:mavrus95,项目名称:windjview-subpix,代码行数:25,代码来源:DjVuSource.cpp


示例5: LoadXMLFile

	HRESULT XmlFileParser::LoadXMLFile( const CHAR* strFilename,void* pNode,UINT nType)
	{
		XMLParser parser;
		XmlFileParser XATGParser;

		g_strParseError[0] = '\0';
		
		localFind = true;
		m_nType = nType;
		if(m_nType == 1)
		{
			pArcadeInfo = (ArcadeInfo*)pNode;
		}

		parser.RegisterSAXCallbackInterface( &XATGParser );


		HRESULT hr = parser.ParseXMLFile( strFilename );

		if( SUCCEEDED( hr ) )
		{

		}
		return hr;
	}
开发者ID:maninha22crazy,项目名称:xboxplayer,代码行数:25,代码来源:AtgXmlFileParser.cpp


示例6: main

int main()
{
    XMLParser   parser;
    ub4         flags;
    uword       ecode;
    flags = XML_FLAG_VALIDATE | XML_FLAG_DISCARD_WHITESPACE;

    cout << "\nXML C++ DOM Namespace\n";

    cout << "Initializing XML package...\n";

    if (ecode = parser.xmlinit())
    {
        cout << "Failed to initialize XML parser, error " << ecode;
        return 1;
    }

    cout << "Parsing '" << DOCUMENT << "'...\n";
    cout.flush();
    if (ecode = parser.xmlparse((oratext *) DOCUMENT, (oratext *) 0, flags))
	return 1;

    cout << "\nThe elements are:\n";
    dump(parser.getDocumentElement());

    (void) parser.xmlterm();	// terminate LPX package

    return 0;
}
开发者ID:amitabha66,项目名称:JLibrary01,代码行数:29,代码来源:DOMNamespace.cpp


示例7: CCLOG

void ChatLayer::requestFinishedCallback(CCNode* pSender,void *data)
{
    CCHttpResponse *response =  (CCHttpResponse*)data;
	if(response==NULL)
	{
		return;
	}
	int statusCode = response->getResponseCode();
	char statusString[64] = {};
	CCLOG(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());

	if (!response->isSucceed())   
	{  
		CCLog("response failed");  
		CCLog("error buffer: %s", response->getErrorBuffer());  
		return;  
	}
	std::vector<char> *buffer = response->getResponseData(); 

	std::string content(buffer->begin(),buffer->end());

	XMLParser *xmlParser = XMLParser::parseWithString(content.c_str());
	CCLOG("%s",xmlParser->getString("content")->getCString());

//	parseJson();
}
开发者ID:crazyit,项目名称:iGame,代码行数:26,代码来源:ChatLayer.cpp


示例8: XMLParser

void Container::loadCache(std::string fichier, QTreeWidget *treeView){
    std::cout << "Opening file \"" << fichier << "\"" << std::endl;

    XMLParser *xmlParser = new XMLParser(fichier.c_str());
    this->root = xmlParser->parseProject();
    this->addProject(treeView, this->root);
}
开发者ID:Niiner,项目名称:PeaceTache,代码行数:7,代码来源:container.cpp


示例9: parser_start_element

static void
parser_start_element (GMarkupParseContext  *context,
                      const gchar          *element_name,
                      const gchar         **attribute_names,
                      const gchar         **attribute_values,
                      gpointer              user_data,
                      GError              **error)
{
  XMLParserState  new_state;
  XMLParser      *parser = (XMLParser *) user_data;

  switch (parser->state)
    {
    case XML_PARSER_STATE_TOPLEVEL:
    default:
      if (parser->start_element &&
          (new_state = parser->start_element (parser->state,
                                              element_name,
                                              attribute_names,
                                              attribute_values,
                                              parser->user_data,
                                              error)))
        {
          parser->last_state = parser->state;
          parser->state      = new_state;
          break;
        }
      /* else fallthru */
    case XML_PARSER_STATE_UNKNOWN:
      parser_start_unknown (parser);
      break;
    }

  g_string_truncate (parser->cdata, 0);
}
开发者ID:,项目名称:,代码行数:35,代码来源:


示例10: validateXml

void validateXml(const string& sXML, const string& sSchema, const string& sXMLName,
        const string& sSchemaName)
{
    XMLParser parser;
    parser.setSchema(sSchema, sSchemaName);

    parser.parse(sXML, sXMLName);
}
开发者ID:JohnChu,项目名称:libavg,代码行数:8,代码来源:XMLHelper.cpp


示例11: parseHeader

int NBUSPacket::parseHeader(void *data, unsigned int length)
{
	XMLParser *pXmlParser = XMLParser::getInstance();

	IXML *pIXml = pXmlParser->parseXML((char *)data, length);

	if (pIXml == NULL)
	{
		delete pXmlParser;
		LOGE("Header XML corruption");
		return -1;
	}

	this->mHeaderLength = length;
	this->mpXml = pIXml;

	if (pIXml->getXMLType() == XML_TYPE_EVENT)
	{
		EventXML *pEventXml = (EventXML *)pIXml;

		this->mpXml = pEventXml;

		this->mDataLength = pEventXml->getLength();

		this->mPacketLength = strlen(NBUS_PACKET_START_CODE) + NBUS_PACKET_HEADER_LEGNTH_BYTES + this->mHeaderLength + this->mDataLength;
		this->mpPacket = new char[this->mPacketLength];

		memcpy(this->mpPacket, NBUS_PACKET_START_CODE, strlen(NBUS_PACKET_START_CODE));

		this->mpHeader = (char *)this->mpPacket + strlen(NBUS_PACKET_START_CODE) + NBUS_PACKET_HEADER_LEGNTH_BYTES;

		memcpy(this->mpHeader, data, length);

		if (this->mDataLength)
		{
			this->mpData = (char *)this->mpHeader + this->mHeaderLength;
		}
	}
	else if (pIXml->getXMLType() == XML_TYPE_COMMAND)
	{
		CommandXML *pCmdXml = (CommandXML *)pIXml;

		this->mpXml = pCmdXml;

		this->mPacketLength = strlen(NBUS_PACKET_START_CODE) + NBUS_PACKET_HEADER_LEGNTH_BYTES + this->mHeaderLength;
		this->mpPacket = new char[this->mPacketLength];

		memcpy(this->mpPacket, NBUS_PACKET_START_CODE, strlen(NBUS_PACKET_START_CODE));

		this->mpHeader = (char *)this->mpPacket + strlen(NBUS_PACKET_START_CODE) + NBUS_PACKET_HEADER_LEGNTH_BYTES;

		memcpy(this->mpHeader, data, length);
	}

	delete pXmlParser;

	return 0;
}
开发者ID:SeonghoBaek,项目名称:wilson_android,代码行数:58,代码来源:Packet.cpp


示例12: ProcessAsRoot

	//----------------------------------------------------------------------
	StatementData DeclareTextureSampleNodeProcessor::ProcessAsRoot( XMLParser& parser, XMLNode* node )
	{
		if( parser.validateXMLAttributes( node, "name,textureSampleName","" ) )
		{
			std::string name = parser.getXMLAttributeAsString( node, "name", "" );
			m_shaderGenerator->AddUniform( "Texture2D", name );
		}
		return StatementData();
	}
开发者ID:hulcyp,项目名称:GuildhallProjects,代码行数:10,代码来源:DeclareTextureSampleNodeProcessor.cpp


示例13: XMLParser

XMLParser* XMLParser::parseWithFile(const char *xmlFileName) {
	XMLParser *pXMLParser = new XMLParser();
	if (pXMLParser->initWithFile(xmlFileName)) {
		pXMLParser->autorelease();
		return pXMLParser;
	}
	CC_SAFE_DELETE(pXMLParser);
	return NULL;
}
开发者ID:garymabin,项目名称:YGODroid,代码行数:9,代码来源:XMLParser.cpp


示例14: createFromFile

bool Job::createFromFile(QString filename)
{
	XMLParser bitsParser;
	Task *tempTask;
	QFile *xmlFile = new QFile(filename);
	bitsParser.parseFile(xmlFile);
	
	QMapIterator<QString, QMap<QString,QVariant> > it(bitsParser.properties);
	while (it.hasNext())
	{
		it.next();
		if (it.key() == "Job")
			setAttributeValue("Filename",filename);
		else if (it.key() == "Task")
		{
			tempTask = new Task;
			tempTask->setAttributeValue("Filename",filename);
		}
		else
			continue;
		
		QMapIterator<QString,QVariant> j(it.value());
		while (j.hasNext())
		{
			j.next();
			if (it.key() == "Job")
			{
				addAttribute(j.key());
				setAttributeValue(j.key(),j.value());
			}
			else if (it.key() == "Task" && tempTask)
			{
				if (j.key() != "Name" && j.key() != "StartDate" && j.key() != "EndDate" && j.key() != "TimeSpent" && j.key() != "TaskID" && j.key() != "HotKey" && j.key() != "Completed")
					tempTask->addAttribute(j.key());
				tempTask->setAttributeValue(j.key(),j.value());
			}
		}
		if (it.key() == "Task" && tempTask)
		{
			if (tempTask->isValid())
				addTask(tempTask);	
			else
				emit statusChanged("Invalid Task not added!");
		}
			
	}
	if (isValid())
	{
		makeTaskIDs();
		writeConfigFile();
	}
	else
		emit statusChanged(QString("Invalid Job in %1 not added!").arg(filename));
	xmlFile->close();
	delete xmlFile;
	return true;
}
开发者ID:JoelB,项目名称:BITS,代码行数:57,代码来源:job.cpp


示例15: handleError

void XMLParser::handleError( void *pArg,  const char *pMsg,
                             xmlParserSeverities severity,
                             xmlTextReaderLocatorPtr locator)
{
    XMLParser *pThis = (XMLParser*)pArg;
    int line = xmlTextReaderLocatorLineNumber( locator );
    msg_Err( pThis->getIntf(), "XML parser error (line %d) : %s", line, pMsg );
    pThis->m_errors = true;
}
开发者ID:forthyen,项目名称:SDesk,代码行数:9,代码来源:xmlparser.cpp


示例16: parse

ParserElement::ref StringTreeParser::parse(const std::string &xml) {
	PlatformXMLParserFactory factory;
	DefaultStringTreeParser client;
	XMLParser *parser = factory.createXMLParser(&client);
	
	parser->parse(xml);
	ParserElement::ref root = client.getRoot();
	delete parser;
	return root;
}
开发者ID:HazWard,项目名称:spectrum2,代码行数:10,代码来源:StringTreeParser.cpp


示例17:

	void D3DCEGUI::init(ID3D11Device *pD3D11Device, ID3D11DeviceContext *pD3D11DeviceContext)
	{
		// create renderer and enable extra states
		Direct3D11Renderer& cegui_renderer = Direct3D11Renderer::create(pD3D11Device, pD3D11DeviceContext);
		//	cegui_renderer.enableExtraStateSettings(true);

		// create CEGUI system object
		CEGUI::System::create(cegui_renderer);

		// setup resource directories
		DefaultResourceProvider* rp = static_cast<DefaultResourceProvider*>(System::getSingleton().getResourceProvider());
		rp->setResourceGroupDirectory("schemes", "../../media/datafiles/schemes/");
		rp->setResourceGroupDirectory("imagesets", "../../media/datafiles/imagesets/");
		rp->setResourceGroupDirectory("fonts", "../../media/datafiles/fonts/");
		rp->setResourceGroupDirectory("layouts", "../../media/datafiles/layouts/");
		rp->setResourceGroupDirectory("looknfeels", "../../media/datafiles/looknfeel/");
		rp->setResourceGroupDirectory("lua_scripts", "../../media/datafiles/lua_scripts/");
		rp->setResourceGroupDirectory("schemas", "../../media/datafiles/xml_schemas/");

		// set default resource groups
		ImageManager::setImagesetDefaultResourceGroup("imagesets");
		CEGUI::Font::setDefaultResourceGroup("fonts");
		Scheme::setDefaultResourceGroup("schemes");
		WidgetLookManager::setDefaultResourceGroup("looknfeels");
		WindowManager::setDefaultResourceGroup("layouts");
		ScriptModule::setDefaultResourceGroup("lua_scripts");

		XMLParser* parser = System::getSingleton().getXMLParser();
		if (parser->isPropertyPresent("SchemaDefaultResourceGroup"))
			parser->setProperty("SchemaDefaultResourceGroup", "schemas");

		// load TaharezLook scheme and DejaVuSans-10 font
		SchemeManager::getSingleton().createFromFile("TaharezLook.scheme", "schemes");
		FontManager::getSingleton().createFromFile("DejaVuSans-10.font");

		// set default font and cursor image and tooltip type
		System::getSingleton().getDefaultGUIContext().setDefaultFont("DejaVuSans-10");
		System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");
		System::getSingleton().getDefaultGUIContext().setDefaultTooltipType("TaharezLook/Tooltip");

		/////////////////////////////////////////////////////////////
		// Add your gui initialisation code in here.
		// You should preferably use layout loading because you won't
		// have to recompile everytime you change the layout. But you
		// can also use static window creation code here, of course.
		/////////////////////////////////////////////////////////////

		//System::getSingleton().notifyDisplaySizeChanged(Sizef(800.f, 600.f));

		// load layout
		Window* root = WindowManager::getSingleton().loadLayoutFromFile("application_templates.layout");
		System::getSingleton().getDefaultGUIContext().setRootWindow(root);
		// notify system of the window size
		renderer= static_cast<Direct3D11Renderer*>(System::getSingleton().getRenderer());
	}
开发者ID:byhj,项目名称:byhj-Render,代码行数:55,代码来源:d3dCEGUI.cpp


示例18:

	//--------------------------------------------------
	ChorusDSP::ChorusDSP( XMLParser& parser, XMLNode* chorusNode )
		:	DSP( MONKY_DSP_TYPE_CHORUS )
	{
		const float NO_VALUE_SPECIFIED = -1000000000.0f;
		parser.validateXMLChildElements( chorusNode, "", "WetVolume" );
		parser.validateXMLAttributes( chorusNode, "", "type,dryVolume,delayMS,modulationRate,modulationDepth" );
		float dryVolume = parser.getXMLAttributeAsFloat( chorusNode, "dryVolume", NO_VALUE_SPECIFIED );
		float delay = parser.getXMLAttributeAsFloat( chorusNode, "delayMS", NO_VALUE_SPECIFIED );
		float modulationRate = parser.getXMLAttributeAsFloat( chorusNode, "modulationRate", NO_VALUE_SPECIFIED );
		float modulationDepth = parser.getXMLAttributeAsFloat( chorusNode, "modulationDepth", NO_VALUE_SPECIFIED );
				
		for( const XMLNode* wetNode = chorusNode->FirstChildElement( "WetVolume" ); wetNode != nullptr; wetNode = wetNode->NextSiblingElement( "WetVolume" ) )
		{
			parser.validateXMLAttributes( wetNode, "channel,volume", "" );
			int channel = parser.getXMLAttributeAsInt( wetNode, "channel", -1 );
			float volume = parser.getXMLAttributeAsFloat( wetNode, "volume", 0.0f );
			if( channel > 0 )
				setWetMixVolume( channel, volume );
		}

		if( dryVolume != NO_VALUE_SPECIFIED )
			setDryMixVolume( dryVolume );
		if( delay != NO_VALUE_SPECIFIED )
			setDelayMS( delay );
		if( modulationRate != NO_VALUE_SPECIFIED )
			setModulationRate( modulationRate );
		if( modulationDepth != NO_VALUE_SPECIFIED )
			setModulationDepth( modulationDepth );
	}
开发者ID:hulcyp,项目名称:GuildhallProjects,代码行数:30,代码来源:ChorusDSP.cpp


示例19: global

void
dmz::ArchivePluginAutoSave::update_plugin_state (
      const PluginStateEnum State,
      const UInt32 Level) {

   if (State == PluginStateStart) {

      if (_firstStart && _saveFile && is_valid_path (_saveFile) && _archiveMod) {

         _log.info << "Restoring from auto save archive: " << _saveFile << endl;

         Config global ("global");
         XMLParser parser;
         XMLInterpreterConfig interpreter (global);
         parser.set_interpreter (&interpreter);

         FILE *file = open_file (_saveFile, "rb");

         if (file) {

            Boolean error (False);
            String buffer;

            while (read_file (file, 1024, buffer) && !error) {

               const Int32 Length = buffer.get_length ();
               const char *cbuf = buffer.get_buffer ();

               if (!parser.parse_buffer (cbuf, Length, Length < 1024)) {

                  error = True;
                  _log.error << "Unable to restore from auto save archive: " << _saveFile
                     << " : " << parser.get_error ();
               }
            }

            close_file (file);

            Config data;

            if (!error && global.lookup_all_config_merged ("dmz", data)) {

               _archiveMod->process_archive (_archiveHandle, data);
            }
         }
      }

      _firstStart = False;
   }
   else if (State == PluginStateShutdown) {

      if (is_valid_path (_saveFile)) { remove_file (_saveFile); }
   }
}
开发者ID:Andais,项目名称:dmz,代码行数:54,代码来源:dmzArchivePluginAutoSave.cpp


示例20: getOscillatorType

	//-----------------------------------------------------
	OscillatorDSP::OscillatorDSP( XMLParser& parser, XMLNode* oscillatorNode )
		:	DSP( MONKY_DSP_TYPE_OSCILLATOR )
	{
		const float NO_VALUE_SPECIFIED = -1000000000.0f;
		parser.validateXMLAttributes( oscillatorNode, "", "type,oscillatorType,freq" );
		std::string typeStr = parser.getXMLAttributeAsString( oscillatorNode, "oscillatorType", "SINE" );
		float freq = parser.getXMLAttributeAsFloat( oscillatorNode, "freq", NO_VALUE_SPECIFIED );

		setType( getOscillatorType( typeStr ) );
		if( freq != NO_VALUE_SPECIFIED )
			setFrequency( freq );
	}
开发者ID:hulcyp,项目名称:GuildhallProjects,代码行数:13,代码来源:OscillatorDSP.cpp



注:本文中的XMLParser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XMLPrinter类代码示例发布时间:2022-05-31
下一篇:
C++ XMLOutputStream类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap