tags:

views:

46

answers:

1

Hello

The XML contains symbols that the C++ may misinterpret (like the // in http://www.w3.org/2000/10/XMLSchema)

I am wondering if you know about clean ways to include some hard-coded XML into a std::string or a CString, at compile time.

(in deed I'm trying to encode an .xsd file for validating some xml input, because I don't want to depend upon the presence or not of this xsd file, so I want it to be compiled in the binary)

+1  A: 
const char* XML_STRING = "<?xml version=\"1.0\"?><Test></Test>";

std::string aTestXmlStr(XML_STRING);
aJ
Many thanx, you were completely right, the only problem was with the use of double quotation mark. That way it works just fine:static const string strXsd = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\ <xs:element name=\"Configs\">\ <xs:complexType>\ <xs:sequence>\ <xs:element name=\"Config\">\ <xs:attribute name=\"UserName\" type=\"xs:string\" />\ <xs:attribute name=\"ScreenPermutation\" type=\"xs:integer\" />\ </xs:element>\ </xs:sequence>\ </xs:complexType>\ </xs:element>\</xs:schema>\";
Stephane Rolland