Xmlchar format in Libxml

Is it ok to write XmlChar like this as constants like chOpenAngle etc. are being used from xerces-c:XMLUniDefs. But no such direct replacement for the constants available in libxml

// Constants for XML serialization
//static const XMLCh XmlStartElement = { chOpenAngle, chNull };
//static const XMLCh XmlEndElement = { chOpenAngle, chForwardSlash, chNull };
//static const XMLCh XmlStartPI = { chOpenAngle, chQuestion, chNull };
//static const XMLCh XmlEndPI = { chQuestion, chCloseAngle, chNull };

//LIBXML2 changes
static const xmlChar XmlStartElement = { ‘<’, ‘\0’ }; // Updated for libxml2
static const xmlChar XmlEndElement = { ‘<’, ‘/’, ‘\0’ }; // Updated for libxml2
static const xmlChar XmlStartPI = { ‘<’, ‘?’, ‘\0’ }; // Updated for libxml2
static const xmlChar XmlEndPI = { ‘?’, ‘>’, ‘\0’ }; // Updated for libxml2

I don’t see any such macros in libxml2. FWIW, you can copy the header from xerces-c and use it directly in your project.

You can also search https://gitlab.gnome.org/GNOME/libxml2/-/issues/ for related issues.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.