void
XalanXMLSerializerFactory::setEncoding(
                             MemoryManager&          theManager,
                             Writer&            theWriter,
                             XalanDOMString&    theEncoding)
{
    XalanOutputStream* stream = theWriter.getStream();

    if(stream != 0)
    {
        if(theEncoding.empty())
        {
            // Default to UTF-8 if the requested encoding is not supported...
            stream->setOutputEncoding(XalanDOMString(XalanTranscodingServices::s_utf8String, theManager));

            theEncoding = XalanTranscodingServices::s_utf8String;
        }
        else
        {
            try
            {
                stream->setOutputEncoding(theEncoding);
            }
            catch(const XalanOutputStream::UnsupportedEncodingException&)
            {
                // Default to UTF-8 if the requested encoding is not supported...
                stream->setOutputEncoding(XalanDOMString(XalanTranscodingServices::s_utf8String, theManager));

                theEncoding = XalanTranscodingServices::s_utf8String;
            }
        }

    }
}
Exemplo n.º 2
0
void
ExtensionNSHandler::setElements(const XalanDOMString&   elemNames)
{
    if (elemNames.empty() == false)
    {
        StringTokenizer     st(elemNames, s_tokenDelimiterCharacters, false);

        XalanDOMString theResult(m_elements.getMemoryManager());

        while (st.hasMoreTokens() == true)
        {
            st.nextToken(theResult);

            m_elements.insert(theResult); // just stick it in there basically
        }
    
        m_componentDescLoaded = true;
    }
}