#include <rwsf/core/XmlUtils.h>
rwsf::XmlUtils is a utility class used primarily internally. However, it may be useful for its string processing helper functions.
In particular, this class can perform character set conversions between a non-UTF-8 character encoding and UTF-8, using its convertCharset() function. For more information, Chapter 20, "Internationalizing Your Services," in the HydraExpress Web Service Development Guide
static std::string stripWhiteSpaceAndNewlines(const std::string& str, rwsf::stdstripType toStrip = rwsf::both);
Removes all whitespace and newlines from string str.
The parameter toStrip defines whether characters are stripped from the beginning of the string, the end, or both. The default is both.
static std::string getPrefix(const std::string& qName);
Returns the prefix in qName, if any
static void getPrefixAndLocalName(const std::string& qName, std::string& prefix, std::string& lname );
Extracts the prefix and local name from qName, storing the results in prefix and lname appropriately.
static std::string changeName(rwsf::XmlName name, std::string element);
Changes the name of an element in a string. Adds namespace information if necessary.
static rwsf::DateTime convertISODateStringToDateTime(const std::string& anISODateStr);
Converts an ISO8601Date string to an rwsf::DateTime.
static std::string convertDateTimeToISOString(const rwsf::DateTime& dt, const std::string& format = ISO8601Format);
Converts an rwsf::DateTime to an ISO8601Date string.
static std::string convertCharset(const std::string& buffer, const std::string& from, const std::string& to);
Converts a string buffer from the character encoding specified in from to the character encoding specified in to. Returns the string as an std::string. Throws an rwsf::XmlException if the conversion fails.
static bool isWhiteSpace(const char c);
Returns true if c is whitespace.
static bool compareAttributeSet(const rwsf::XmlAttributeSet& a1, const rwsf::XmlAttributeSet& a2); static bool compareAttributeSet(const rwsf::XmlAttributeSet& a1, const rwsf::XmlAttributeSet& a2,\ std::string& compareInfo);
Returns true if set a1 is equal to set a2. Order may be different. This method checks that all namespaces in each attribute set are equivalent XML, but they need not be identical strings.
The compareInfo string contains diagnostic information about differences, if any are found.
static bool compareXml(const std::string& xml1, const std::string& xml2, std::string& compareInfo, bool ignoreWhitespace);
DEPRECATED. Performs a simple comparison of two XML documents. Elements are expected to be in the same order, and if they are not this method returns false. Whitespace is ignored. Attributes can be in any order.
Note that a comparison may fail due to lack of schema information. Since compareXML() does not have access to the schema that constrains the documents, it may fail due to missing fixed or default values, or additional or differently defined namespaces.
©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks and HydraSDO is a trademark of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.