Probleme mit XercesC



  • Hallo,

    Ersteinmal der Code:

    XMLPlatformUtils::Initialize();
    	const char* xmlFile = "gamedata.xml";
    	static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
    
    	DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(gLS);
    	DOMBuilder* parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
    
    	parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
    
    	parser->resetDocumentPool();
    
    	XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* doc = 0;
    
    	try 
    	{	
    		doc = parser->parseURI(xmlFile);
    
    		DOMNode* root = doc->getDocumentElement();
    		DOMNodeList* nodes = root->getChildNodes();
    
    		for (int i = 0; i < nodes->getLength(); i++)
    		{
    			DOMNode* child_node = nodes->item(i);
    			const XMLCh* attribute_name = child_node->getNodeName();
    			const XMLCh* attribute_value = child_node->getNodeValue();
    

    XML-File "gamedata.xml":

    <?xml version="1.0" encoding="utf-8"?>
    <bla>
    <resolution>1024:768</resolution>
    <colordepth>32</colordepth>
    </bla>
    

    Also ersten Bekomme ich mal eine Exception: "Eine Ausnahme (erste Chance) bei 0x7c81eb33 in Test.exe: Microsoft C++ exception: xercesc_2_6::XMLErrs::Codes @ 0x0012f0a8." (kann im Quelltext nicht gefunden werden laut Compiler).

    Das grössere Problem ist jedoch, dass in "attribute_name" die attributnamen stehen, aber in "attribute_value" keine werte!

    Ich muss zugeben, dass ich mich mit xerces noch kaum auskenne, und daher so meine probleme habe,...

    Peter


Anmelden zum Antworten