Implementing IXmlWriter Part 6: Escaping Attribute Content

C++, XML No Comments »

Last time’s IXmlWriter has a serious bug: it doesn’t properly handle attribute value escaping and can lead to malformed XML.

Read the rest of this entry »

Implementing IXmlWriter Part 5: Supporting WriteAttributeString()

C++, XML No Comments »

Today I will add support for writing attributes to yesterday’s version of IXmlWriter.

Read the rest of this entry »

Implementing IXmlWriter Part 4: Collapsing Empty Elements

C++, XML No Comments »

One of the enhancements that XML introduced over SGML was a shorthand for specifying an element with no content by adding a trailing slash at the end of an open element. For example, <br/> is equivalent to <br></br>. Let’s add this functionality to the previous version of IXmlWriter.

Read the rest of this entry »

Implementing IXmlWriter Part 3: Supporting WriteElementString()

C++, XML No Comments »

Today’s addition to the previous iteration of IXmlWriter is quite trivial: supporting the WriteElementString() method.

Read the rest of this entry »

Implementing IXmlWriter Part 2: Escaping Element Content

C++, XML No Comments »

In the previous post of this series, we ended up with a simple class which could write XML elements and element content to a std::string. However, this code has a common, serious problem that was mentioned in my post Don’t Form XML Using String Concatenation: it doesn’t properly escape XML special characters such as & and < This means that if you call WriteString() with one of these characters, your generated XML will be invalid and will not be able to be parsed by an XML parser.

Read the rest of this entry »

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in