diff options
Diffstat (limited to 'Swiften/Parser/LibXMLParser.cpp')
| -rw-r--r-- | Swiften/Parser/LibXMLParser.cpp | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/Swiften/Parser/LibXMLParser.cpp b/Swiften/Parser/LibXMLParser.cpp index c94a360..ae87f38 100644 --- a/Swiften/Parser/LibXMLParser.cpp +++ b/Swiften/Parser/LibXMLParser.cpp @@ -4,21 +4,29 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/Parser/LibXMLParser.h" +#include <Swiften/Parser/LibXMLParser.h>  #include <iostream>  #include <cassert>  #include <cstring>  #include <string> -#include "Swiften/Parser/XMLParserClient.h" +#include <Swiften/Parser/XMLParserClient.h>  namespace Swift { -static void handleStartElement(void *parser, const xmlChar* name, const xmlChar*, const xmlChar* xmlns, int, const xmlChar**, int nbAttributes, int, const xmlChar ** attributes) { +static void handleStartElement(void* parser, const xmlChar* name, const xmlChar*, const xmlChar* xmlns, int, const xmlChar**, int nbAttributes, int nbDefaulted, const xmlChar ** attributes) {  	AttributeMap attributeValues; +	if (nbDefaulted != 0) { +		// Just because i don't understand what this means yet :-) +		std::cerr << "Unexpected nbDefaulted on XML element" << std::endl; +	}  	for (int i = 0; i < nbAttributes*5; i += 5) { -		attributeValues[std::string(reinterpret_cast<const char*>(attributes[i]))] = std::string(reinterpret_cast<const char*>(attributes[i+3]), attributes[i+4]-attributes[i+3]); +		std::string attributeNS = ""; +		if (attributes[i+2]) { +			attributeNS = std::string(reinterpret_cast<const char*>(attributes[i+2])); +		} +		attributeValues.addAttribute(std::string(reinterpret_cast<const char*>(attributes[i])), attributeNS, std::string(reinterpret_cast<const char*>(attributes[i+3]), attributes[i+4]-attributes[i+3]));  	}  	static_cast<XMLParser*>(parser)->getClient()->handleStartElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string()), attributeValues);  } | 
 Swift
 Swift