Hi & welcome to cplusplus :+D
To make things easier for everyone, please use code tags:
First up, I am by no means an expert :+) Hopefully I can still give some advice that may be a little bit helpful.
My first instinct is to give the general advice of NOT using
new
or
delete
. Use RAII instead by way of smart pointers. There are situations where use of
new
is warranted, but that is for low level memory management, as far as I understand it. You are using exceptions - a problem there is when an exception is thrown, the code may never reach the
delete
.
Apart from that, for the default constructor shouldn't it be:
XmlUtils *xmlUtils = new XmlUtils; // without the parentheses
Also, wondering why you use the
this
pointer so much? It is not necessary to access member variables, but it is needed when overloading operators.
Your constructors aren't initialising all the member variables - you should do this with an initialiser list, instead of all those set functions.
Your aren't calling your constructor for
XmlUtils
, so none of those append statements are happening, and no member variable is initialised to anything useful. Instead the implicitly created constructor is called. So what you need is to call the constructor that takes a std::string as an argument.
One should sanitise any string entered by the user, otherwise it is a huge security hole. I am sure this is the case for html, and fairly sure it is the same for xml.
I would be wary of names like
XmlUtils
and
xmlUtils
which only differ in the case of the first character.
Any way good luck, hopefully my advice has been a little helpful - if not there are plenty here who are way, way more advanced than me.