EXTXMLMETHOD int OSXMLEncodeBuffer::addXMLHeader (
const OSUTF8CHAR* version, const OSUTF8CHAR* encoding, OSBOOL newLine)
{
   if (0 != version && 0 != encoding) {
      size_t len = OSUTF8LEN(version) + OSUTF8LEN(encoding) + 32;
      OSCTXT* pctxt = getCtxtPtr();

      /* Encode Unicode BOM */
      int stat = rtXmlEncBOM (pctxt);
      if (stat != 0) return LOG_RTERR (pctxt, stat);

      // Verify text will fit in encode buffer
      stat = rtxCheckBuffer (pctxt, len+1);
      if (stat != 0) return LOG_RTERR (pctxt, stat);

      OSRTMEMCPY (pctxt, "<?xml version=\"", 15);
      OSRTMEMCPY (pctxt, version, OSUTF8LEN(version));
      OSRTMEMCPY (pctxt, "\" encoding=\"", 12);
      OSRTMEMCPY (pctxt, encoding, OSUTF8LEN(encoding));
      OSRTMEMCPY (pctxt, "\"?>", 3);
      if (newLine) OSRTPUTCHAR (pctxt, '\n');

      // Indicate XML message shouls be encoded as a fragment since
      // header had already been added manually..
      setFragment ();
   }
   return 0;
}
Exemple #2
0
//-------------------------------------------------------------------------------------------------
inline void_t
Uri::setUri(
    std::ctstring_t &a_scheme,
    std::ctstring_t &a_authority,
    std::ctstring_t &a_path,
    std::ctstring_t &a_query,
    std::ctstring_t &a_fragment
)
{
    setScheme   (a_scheme);
    setAuthority(a_authority);
    setPath     (a_path);
    setQuery    (a_query);
    setFragment (a_fragment);
}
void URI::setId(const String& id) {
    setFragment(id);
}