Annotation of parser3/src/classes/xdoc.C, revision 1.6

1.1       parser      1: /** @file
1.2       parser      2:        Parser: @b xdoc parser class.
1.1       parser      3: 
                      4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
                      5:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      6: 
1.6     ! parser      7:        $Id: xdoc.C,v 1.5 2001/09/28 09:37:09 parser Exp $
1.1       parser      8: */
                      9: #include "classes.h"
                     10: #ifdef XML
                     11: 
                     12: #include "pa_request.h"
                     13: #include "pa_vxdoc.h"
                     14: #include "pa_xslt_stylesheet_manager.h"
                     15: #include "pa_stylesheet_connection.h"
                     16: #include "pa_vfile.h"
                     17: #include "xnode.h"
                     18: 
                     19: #include <strstream>
                     20: #include <Include/PlatformDefinitions.hpp>
                     21: #include <util/PlatformUtils.hpp>
1.5       parser     22: #include <util/TransENameMap.hpp>
1.1       parser     23: #include <XalanTransformer/XalanTransformer.hpp>
                     24: #include <XalanTransformer/XalanParsedSource.hpp>
                     25: #include <XMLSupport/FormatterToXML.hpp>
                     26: #include <XMLSupport/FormatterToHTML.hpp>
                     27: #include <XMLSupport/FormatterToText.hpp>
                     28: #include <XMLSupport/FormatterTreeWalker.hpp>
                     29: #include <PlatformSupport/XalanFileOutputStream.hpp>
                     30: #include <PlatformSupport/XalanOutputStreamPrintWriter.hpp>
                     31: #include <PlatformSupport/DOMStringPrintWriter.hpp>
1.2       parser     32: #include <XalanDOM/XalanElement.hpp>
                     33: #include <XalanDOM/XalanNodeList.hpp>
1.1       parser     34: 
                     35: // defines
                     36: 
                     37: #define XDOC_CLASS_NAME "xdoc"
                     38: 
                     39: #define XDOC_OUTPUT_METHOD_OPTION_NAME "method"
                     40: #define XDOC_OUTPUT_METHOD_OPTION_VALUE_XML "xml"
                     41: #define XDOC_OUTPUT_METHOD_OPTION_VALUE_HTML "html"
                     42: #define XDOC_OUTPUT_METHOD_OPTION_VALUE_TEXT "text"
                     43: 
                     44: #define XDOC_OUTPUT_ENCODING_OPTION_NAME "encoding"
                     45: 
                     46: #define XDOC_OUTPUT_DEFAULT_INDENT 4
                     47: 
                     48: // class
                     49: 
                     50: class MXdoc : public MXnode {
                     51: public: // VStateless_class
                     52:        Value *create_new_value(Pool& pool) { return new(pool) VXdoc(pool); }
                     53: 
                     54: public:
                     55:        MXdoc(Pool& pool);
                     56: 
                     57: public: // Methoded
                     58:        bool used_directly() { return true; }
1.5       parser     59:        void configure_admin(Request& r);
1.1       parser     60: };
                     61: 
                     62: // methods
                     63: 
                     64: class ParserStringXalanOutputStream: public XalanOutputStream {
                     65: public:
                     66:        
                     67:        explicit ParserStringXalanOutputStream(String& astring) : fstring(astring) {}
                     68: 
                     69: protected: // XalanOutputStream
                     70: 
                     71:        virtual void writeData(const char *theBuffer, unsigned long theBufferLength) {
                     72:                char *copy=(char *)fstring.malloc((size_t)theBufferLength);
                     73:                memcpy(copy, theBuffer, (size_t)theBufferLength);
1.2       parser     74:                fstring.APPEND_CLEAN(copy, (size_t)theBufferLength, "xdoc", 0);
1.1       parser     75:        }
                     76: 
                     77:        virtual void doFlush() {}
                     78: 
                     79: private:
                     80: 
                     81:        String& fstring;
                     82:        
                     83: };
                     84: 
                     85: static void create_optioned_listener(
                     86:                                                                         const char *& content_type, const char *& charset, FormatterListener *& listener, 
                     87:                                                                         Pool& pool, 
                     88:                                                                         const String& method_name, MethodParams *params, int index, Writer& writer) {
                     89:        // default encoding from pool
                     90:        const String *scharset=&pool.get_charset();
                     91:        const String *method=0;
                     92:        XalanDOMString xalan_encoding;
                     93: 
                     94:        if(params->size()>index) {
                     95:                Value& voptions=params->as_no_junction(index, "options must not be code");
                     96:                if(voptions.is_defined()) {
                     97:                        if(Hash *options=voptions.get_hash()) {
                     98:                                // $.method[xml|html|text]
                     99:                                if(Value *vmethod=static_cast<Value *>(options->get(*new(pool) 
                    100:                                        String(pool, XDOC_OUTPUT_METHOD_OPTION_NAME))))
                    101:                                        method=&vmethod->as_string();
                    102: 
                    103:                                // $.encoding[windows-1251|...]
                    104:                                if(Value *vencoding=static_cast<Value *>(options->get(*new(pool) 
                    105:                                        String(pool, XDOC_OUTPUT_ENCODING_OPTION_NAME)))) {
                    106:                                        scharset=&vencoding->as_string();
                    107:                                }
                    108:                        } else
                    109:                                PTHROW(0, 0,
                    110:                                        &method_name,
                    111:                                        "options must be hash");
                    112:                }
                    113:        }
                    114: 
                    115:        xalan_encoding.append(charset=scharset->cstr());
                    116:        if(!method/*default='xml'*/ || *method == XDOC_OUTPUT_METHOD_OPTION_VALUE_XML) {
                    117:                content_type="text/xml";
                    118:                listener=new FormatterToXML(writer,
                    119:                        XalanDOMString(),  // version
                    120:                        true, // doIndent
                    121:                        XDOC_OUTPUT_DEFAULT_INDENT, // indent 
                    122:                        xalan_encoding  // encoding
                    123:                );
                    124:        } else if(*method == XDOC_OUTPUT_METHOD_OPTION_VALUE_HTML) {
                    125:                content_type="text/html";
                    126:                listener=new FormatterToHTML(writer,
                    127:                        xalan_encoding,  // encoding
                    128:                        XalanDOMString(),  // mediaType 
                    129:                        XalanDOMString(),  // doctypeSystem; String to be printed at the top of the document 
                    130:                        XalanDOMString(),  // doctypePublic  
                    131:                        true, // doIndent 
                    132:                        XDOC_OUTPUT_DEFAULT_INDENT // indent 
                    133:                );
                    134:        } else if(*method == XDOC_OUTPUT_METHOD_OPTION_VALUE_TEXT) {
                    135:                content_type="text/plain";
                    136:                listener=new FormatterToText(writer,
                    137:                        xalan_encoding  // encoding
                    138:                );
                    139:        } else
                    140:                PTHROW(0, 0,
                    141:                        method,
                    142:                        XDOC_OUTPUT_METHOD_OPTION_NAME " option is invalid; valid methods are: "
                    143:                                "'" XDOC_OUTPUT_METHOD_OPTION_VALUE_XML "', "
                    144:                                "'" XDOC_OUTPUT_METHOD_OPTION_VALUE_HTML "', "
                    145:                                "'" XDOC_OUTPUT_METHOD_OPTION_VALUE_TEXT "'");                  
                    146: 
                    147:        // never reached
                    148: }
                    149: 
                    150: static void _save(Request& r, const String& method_name, MethodParams *params) {
                    151:        Pool& pool=r.pool();
                    152:        VXnode& vnode=*static_cast<VXnode *>(r.self);
                    153: 
                    154:        // filespec
                    155:        const String& file_name=params->as_string(0, "file name must not be code");
                    156:        const char *filespec=r.absolute(file_name).cstr(String::UL_FILE_SPEC);
                    157:        
                    158:        // node
                    159:        XalanNode& node=vnode.get_node(pool, &method_name);
                    160: 
                    161:        try {
                    162:                XalanFileOutputStream stream(XalanDOMString(filespec, strlen(filespec)));
                    163:                XalanOutputStreamPrintWriter writer(stream);
                    164:                const char *content_type, *charset;
                    165:                FormatterListener *formatterListener;
                    166:                create_optioned_listener(content_type, charset, formatterListener, 
                    167:                        pool, method_name, params, 1, writer);
                    168:                FormatterTreeWalker treeWalker(*formatterListener);
                    169:                treeWalker.traverse(&node); // Walk that node and produce the XML...
                    170:        } catch(const XSLException& e) {
                    171:                r._throw(&method_name, e);
                    172:        }
                    173: }
                    174: 
                    175: static void _string(Request& r, const String& method_name, MethodParams *params) {
                    176:        Pool& pool=r.pool();
                    177:        VXnode& vnode=*static_cast<VXnode *>(r.self);
                    178: 
                    179:        // node
                    180:        XalanNode& node=vnode.get_node(pool, &method_name);
                    181: 
                    182:        try {
                    183:                String parserString=*new(pool) String(pool);
                    184:                ParserStringXalanOutputStream stream(parserString);
                    185:                XalanOutputStreamPrintWriter writer(stream);
                    186:                const char *content_type, *charset;
                    187:                FormatterListener *formatterListener;
                    188:                create_optioned_listener(content_type, charset, formatterListener, 
                    189:                        pool, method_name, params, 0, writer);
                    190:                FormatterTreeWalker treeWalker(*formatterListener);
                    191:                treeWalker.traverse(&node); // Walk that node and produce the XML...
                    192: 
                    193:                // write out result
                    194:                r.write_no_lang(parserString);
                    195:        } catch(const XSLException& e) {
                    196:                r._throw(&method_name, e);
                    197:        }
                    198: }
                    199: 
                    200: 
                    201: static void _file(Request& r, const String& method_name, MethodParams *params) {
                    202:        Pool& pool=r.pool();
                    203:        VXnode& vnode=*static_cast<VXnode *>(r.self);
                    204: 
                    205:        // node
                    206:        XalanNode& node=vnode.get_node(pool, &method_name);
                    207: 
                    208:        try {
                    209:                String& parserString=*new(pool) String(pool);
                    210:                ParserStringXalanOutputStream stream(parserString);
                    211:                XalanOutputStreamPrintWriter writer(stream);
                    212:                const char *content_type, *charset;
                    213:                FormatterListener *formatterListener;
                    214:                create_optioned_listener(content_type, charset, formatterListener, 
                    215:                        pool, method_name, params, 0, writer);
                    216:                FormatterTreeWalker treeWalker(*formatterListener);
                    217:                treeWalker.traverse(&node); // Walk that node and produce the XML...
                    218: 
                    219:                // write out result
                    220:                VFile& vfile=*new(pool) VFile(pool);
                    221:                const char *cstr=parserString.cstr();
                    222:                String *scontent_type=new(pool) String(pool, content_type);
                    223:                Value *vcontent_type;
                    224:                if(charset) {
                    225:                        VHash *vhcontent_type=new(pool) VHash(pool);
                    226:                        vhcontent_type->hash().put(*value_name, new(pool) VString(*scontent_type));
                    227:                        String *scharset=new(pool) String(pool, charset);
                    228:                        vhcontent_type->hash().put(*new(pool) String(pool, "charset"), new(pool) VString(*scharset));
                    229:                        vcontent_type=vhcontent_type;
                    230:                } else
                    231:                        vcontent_type=new(pool) VString(*scontent_type);
                    232:                vfile.set(false/*tainted*/, cstr, strlen(cstr), 0/*file_name*/, vcontent_type);
                    233:                r.write_no_lang(vfile);
                    234:        } catch(const XSLException& e) {
                    235:                r._throw(&method_name, e);
                    236:        }
                    237: }
                    238: 
                    239: static void _set(Request& r, const String& method_name, MethodParams *params) {
                    240:        Pool& pool=r.pool();
1.5       parser    241:        VXdoc& vdoc=*static_cast<VXdoc *>(r.self);
1.1       parser    242: 
                    243:        Value& vxml=params->as_junction(0, "xml must be code");
                    244:        Temp_lang temp_lang(r, String::UL_XML);
                    245:        const String& xml=r.process(vxml).as_string();
                    246: 
                    247:        std::istrstream stream(xml.cstr());
                    248:        const XalanParsedSource* parsedSource;
1.5       parser    249:        int error=vdoc.transformer().parseSource(&stream, parsedSource);
1.1       parser    250: 
                    251:        if(error)
                    252:                PTHROW(0, 0,
                    253:                        &method_name,
1.5       parser    254:                        vdoc.transformer().getLastError());
1.1       parser    255: 
                    256:        // replace any previous parsed source
1.5       parser    257:        vdoc.set_parsed_source(*parsedSource);
1.1       parser    258: }
                    259: 
                    260: static void _load(Request& r, const String& method_name, MethodParams *params) {
                    261:        Pool& pool=r.pool();
1.5       parser    262:        VXdoc& vdoc=*static_cast<VXdoc *>(r.self);
1.1       parser    263: 
                    264:        // filespec
                    265:        const String& file_name=params->as_string(0, "file name must not be code");
                    266:        const char *filespec=r.absolute(file_name).cstr(String::UL_FILE_SPEC);
                    267:        
                    268:        const XalanParsedSource* parsedSource;
1.5       parser    269:        int error=vdoc.transformer().parseSource(filespec, parsedSource);
1.1       parser    270: 
                    271:        if(error)
                    272:                PTHROW(0, 0,
                    273:                        &file_name,
1.5       parser    274:                        vdoc.transformer().getLastError());
1.1       parser    275: 
                    276:        // replace any previous parsed source
1.5       parser    277:        vdoc.set_parsed_source(*parsedSource);
1.1       parser    278: }
                    279: 
                    280: static void add_xslt_param(const Hash::Key& aattribute, Hash::Val *ameaning, 
                    281:                                                   void *info) {
                    282:        XalanTransformer& transformer=*static_cast<XalanTransformer *>(info);
                    283:        const char *attribute_cstr=aattribute.cstr();
                    284:        const char *meaning_cstr=static_cast<Value *>(ameaning)->as_string().cstr();
                    285: 
                    286:        transformer.setStylesheetParam(
                    287:                XalanDOMString(attribute_cstr),  
                    288:                XalanDOMString(meaning_cstr));
                    289: }
                    290: static void _xslt(Request& r, const String& method_name, MethodParams *params) {
                    291:        Pool& pool=r.pool();
1.5       parser    292:        VXdoc& vdoc=*static_cast<VXdoc *>(r.self);
1.1       parser    293: 
                    294:        // params
                    295:        if(params->size()>1) {
                    296:                Value& vparams=params->as_no_junction(1, "transform parameters parameter must not be code");
                    297:                if(vparams.is_defined())
                    298:                        if(Hash *params=vparams.get_hash())
1.5       parser    299:                                params->for_each(add_xslt_param, &vdoc.transformer());
1.1       parser    300:                        else
                    301:                                PTHROW(0, 0,
                    302:                                        &method_name,
                    303:                                        "transform parameters parameter must be hash");
                    304:        }
                    305: 
                    306:        // source
1.5       parser    307:        const XalanParsedSource &parsed_source=vdoc.get_parsed_source(pool, &method_name);
1.1       parser    308: 
                    309:        // stylesheet
                    310:        const String& stylesheet_file_name=params->as_string(0, "file name must not be code");
                    311:        const String& stylesheet_filespec=r.absolute(stylesheet_file_name);
                    312:        //_asm int 3;
                    313:        Stylesheet_connection& connection=XSLT_stylesheet_manager->get_connection(stylesheet_filespec);
                    314: 
                    315:        // target
1.5       parser    316:        XalanDocument* target=vdoc.parser_liaison().createDocument();
1.1       parser    317:        XSLTResultTarget domResultTarget(target);
                    318: 
                    319:        // transform
1.5       parser    320:        int error=vdoc.transformer().transform(
1.1       parser    321:                parsed_source, 
1.6     ! parser    322:                &connection.stylesheet(true/*nocache*/), 
1.1       parser    323:                domResultTarget);
                    324:        connection.close();
                    325:        if(error)
                    326:                PTHROW(0, 0,
                    327:                        &stylesheet_file_name,
1.5       parser    328:                        vdoc.transformer().getLastError());
1.1       parser    329: 
                    330:        // write out result
                    331:        VXdoc& result=*new(pool) VXdoc(pool);
                    332:        result.set_document(*target);
                    333:        r.write_no_lang(result);
                    334: }
                    335: 
1.2       parser    336: static void _getElementById(Request& r, const String& method_name, MethodParams *params) {
                    337:        Pool& pool=r.pool();
                    338:        VXdoc& vdoc=*static_cast<VXdoc *>(r.self);
                    339: 
                    340:        // elementId
                    341:        const char *elementId=params->as_string(0, "elementID must not be code").cstr(String::UL_AS_IS);
                    342: 
                    343:        if(XalanElement *element=
                    344:                vdoc.get_document(pool, &method_name).getElementById(XalanDOMString(elementId))) {
                    345:                // write out result
                    346:                VXnode& result=*new(pool) VXnode(pool, element);
                    347:                r.write_no_lang(result);
                    348:        }
                    349: }
1.4       parser    350: /*
1.2       parser    351: static void _getElementsByTagName(Request& r, const String& method_name, MethodParams *params) {
                    352:        Pool& pool=r.pool();
                    353:        VXdoc& vdoc=*static_cast<VXdoc *>(r.self);
                    354: 
                    355:        // tagname
                    356:        const char *tagname=params->as_string(0, "tagname must not be code").cstr(String::UL_AS_IS);
                    357: 
                    358:        VHash& result=*new(pool) VHash(pool);
                    359:        if(const XalanNodeList *nodes=
                    360:                vdoc.get_document(pool, &method_name).getElementsByTagName(XalanDOMString(tagname))) {
                    361:                for(int i=0; i<nodes->getLength(); i++) {
                    362:                        String& skey=*new(pool) String(pool);
                    363:                        {
                    364:                                char *buf=(char *)pool.malloc(MAX_NUMBER);
                    365:                                snprintf(buf, MAX_NUMBER, "%d", i);
                    366:                                skey << buf;
                    367:                        }
                    368: 
                    369:                        result.hash().put(skey, new(pool) VXnode(pool, nodes->item(i)));
                    370:                }
                    371:        }
                    372: 
                    373:        // write out result
                    374:        r.write_no_lang(result);
                    375: }
                    376: 
                    377: static void _getElementsByTagNameNS(Request& r, const String& method_name, MethodParams *params) {
                    378:        Pool& pool=r.pool();
                    379:        VXdoc& vdoc=*static_cast<VXdoc *>(r.self);
                    380: 
                    381:        // namespaceURI;localName
                    382:        const char *namespaceURI=params->as_string(0, "namespaceURI must not be code").cstr(String::UL_AS_IS);
                    383:        const char *localName=params->as_string(0, "localName must not be code").cstr(String::UL_AS_IS);
                    384: 
                    385:        VHash& result=*new(pool) VHash(pool);
                    386:        if(const XalanNodeList *nodes=
                    387:                vdoc.get_document(pool, &method_name).getElementsByTagNameNS(
                    388:                        XalanDOMString(namespaceURI), XalanDOMString(localName))) {
                    389:                for(int i=0; i<nodes->getLength(); i++) {
                    390:                        String& skey=*new(pool) String(pool);
                    391:                        {
                    392:                                char *buf=(char *)pool.malloc(MAX_NUMBER);
                    393:                                snprintf(buf, MAX_NUMBER, "%d", i);
                    394:                                skey << buf;
                    395:                        }
                    396: 
                    397:                        result.hash().put(skey, new(pool) VXnode(pool, nodes->item(i)));
                    398:                }
                    399:        }
                    400: 
                    401:        // write out result
                    402:        r.write_no_lang(result);
                    403: }
1.4       parser    404: */
1.1       parser    405: // constructor
                    406: 
                    407: MXdoc::MXdoc(Pool& apool) : MXnode(apool) {
                    408:        set_name(*NEW String(pool(), XDOC_CLASS_NAME));
                    409: 
1.2       parser    410:        // ^xdoc.save[some.xml]
                    411:        // ^xdoc.save[some.xml;options hash]
1.1       parser    412:        add_native_method("save", Method::CT_DYNAMIC, _save, 1, 2);
                    413: 
1.2       parser    414:        // ^xdoc.string[] <doc/>
                    415:        // ^xdoc.string[options hash] <doc/>
1.1       parser    416:        add_native_method("string", Method::CT_DYNAMIC, _string, 0, 1);
                    417: 
1.2       parser    418:        // ^xdoc.file[] file with "<doc/>"
                    419:        // ^xdoc.file[options hash] file with "<doc/>"
1.1       parser    420:        add_native_method("file", Method::CT_DYNAMIC, _file, 0, 1);
                    421: 
1.2       parser    422:        // ^xdoc::set[<some>xml</some>]
1.1       parser    423:        add_native_method("set", Method::CT_DYNAMIC, _set, 1, 1);
                    424: 
1.2       parser    425:        // ^xdoc::load[some.xml]
1.1       parser    426:        add_native_method("load", Method::CT_DYNAMIC, _load, 1, 1);
                    427: 
1.2       parser    428:        // ^xdoc.xslt[stylesheet file_name]
                    429:        // ^xdoc.xslt[stylesheet file_name;params hash]
1.1       parser    430:        add_native_method("xslt", Method::CT_DYNAMIC, _xslt, 1, 2);
1.2       parser    431: 
                    432:        // ^xdoc.getElementById[elementId]
                    433:        add_native_method("getElementById", Method::CT_DYNAMIC, _getElementById, 1, 1);
1.4       parser    434: /*     
1.3       parser    435:        // ^xdoc.getElementsByTagName[tagname]
1.2       parser    436:        add_native_method("getElementsByTagName", Method::CT_DYNAMIC, _getElementsByTagName, 1, 1);
                    437: 
                    438:        // ^xdoc.getElementsByTagNameNS[namespaceURI;localName] = array of nodes
                    439:        add_native_method("getElementsByTagNameNS", Method::CT_DYNAMIC, _getElementsByTagNameNS, 2, 2);
1.4       parser    440: */
1.1       parser    441: }
1.5       parser    442: 
                    443: 
                    444: 
                    445: #include <util/XercesDefs.hpp>
                    446: #include <util/XML256TableTranscoder.hpp>
                    447: //
                    448: //  This class provides an implementation of the XMLTranscoder interface
                    449: //  for the Windows variant of Latin1, called Windows-1251. Its close to
                    450: //  Latin1, but is somewhat different.
                    451: //
                    452: class XMLWin1251Transcoder : public XML256TableTranscoder
                    453: {
                    454: public :
                    455:     // -----------------------------------------------------------------------
                    456:     //  Public constructors and destructor
                    457:     // -----------------------------------------------------------------------
                    458:     XMLWin1251Transcoder
                    459:     (
                    460:         const   XMLCh* const    encodingName
                    461:         , const unsigned int    blockSize
                    462:     );
                    463: 
                    464:     virtual ~XMLWin1251Transcoder();
                    465: 
                    466: 
                    467: private :
                    468:     // -----------------------------------------------------------------------
                    469:     //  Unimplemented constructors and operators
                    470:     // -----------------------------------------------------------------------
                    471:     XMLWin1251Transcoder();
                    472:     XMLWin1251Transcoder(const XMLWin1251Transcoder&);
                    473:     void operator=(const XMLWin1251Transcoder&);
                    474: };
                    475: 
                    476: // from ICU: ibm-1251.ucm by PAF@design.ru
                    477: // ---------------------------------------------------------------------------
                    478: //  Local const data
                    479: //
                    480: //  gFromTable
                    481: //      This is the translation table for Windows 1251 to Unicode. This
                    482: //      table contains 255 entries. The entry for 1251 byte x is the
                    483: //      Unicode translation of that byte.
                    484: //
                    485: //  gToTable
                    486: //  gToTableSz
                    487: //      This is the translation table for Unicode to Windows 1251. This one
                    488: //      contains a list of records, sorted by the Unicode code point. We do
                    489: //      a binary search to find the Unicode point, and that record's other
                    490: //      field is the 1251 code point to translate to.
                    491: // ---------------------------------------------------------------------------
                    492: static const XMLCh gFromTable[256] =
                    493: {
                    494: 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 
                    495: 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 
                    496: 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 
                    497: 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 
                    498: 0x0020, 0xFF01, 0xFF02, 0xFF03, 0xFF04, 0xFF05, 0xFF06, 0xFF07, 
                    499: 0xFF08, 0xFF09, 0xFF0A, 0xFF0B, 0xFF0C, 0xFF0D, 0xFF0E, 0xFF0F, 
                    500: 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17, 
                    501: 0xFF18, 0xFF19, 0xFF1A, 0xFF1B, 0xFF1C, 0xFF1D, 0xFF1E, 0xFF1F, 
                    502: 0xFF20, 0xFF21, 0xFF22, 0xFF23, 0xFF24, 0xFF25, 0xFF26, 0xFF27, 
                    503: 0xFF28, 0xFF29, 0xFF2A, 0xFF2B, 0xFF2C, 0xFF2D, 0xFF2E, 0xFF2F, 
                    504: 0xFF30, 0xFF31, 0xFF32, 0xFF33, 0xFF34, 0xFF35, 0xFF36, 0xFF37, 
                    505: 0xFF38, 0xFF39, 0xFF3A, 0xFF3B, 0xFF3C, 0xFF3D, 0xFF3E, 0xFF3F, 
                    506: 0xFF40, 0xFF41, 0xFF42, 0xFF43, 0xFF44, 0xFF45, 0xFF46, 0xFF47, 
                    507: 0xFF48, 0xFF49, 0xFF4A, 0xFF4B, 0xFF4C, 0xFF4D, 0xFF4E, 0xFF4F, 
                    508: 0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57, 
                    509: 0xFF58, 0xFF59, 0xFF5A, 0xFF5B, 0xFF5C, 0xFF5D, 0xFF5E, 0x007F, 
                    510: 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 
                    511: 0x0088, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, 
                    512: 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 
                    513: 0x0098, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, 
                    514: 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, 
                    515: 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, 
                    516: 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, 
                    517: 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, 
                    518: 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 
                    519: 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 
                    520: 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 
                    521: 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, 
                    522: 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 
                    523: 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 
                    524: 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 
                    525: 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F
                    526: };
                    527: 
                    528: static const XMLTransService::TransRec gToTable[] =
                    529: {
                    530: { 0x0000, 0x00 }, { 0x0001, 0x01 }, { 0x0002, 0x02 }, { 0x0003, 0x03 }, 
                    531: { 0x0004, 0x04 }, { 0x0005, 0x05 }, { 0x0006, 0x06 }, { 0x0007, 0x07 }, 
                    532: { 0x0008, 0x08 }, { 0x0009, 0x09 }, { 0x000A, 0x0A }, { 0x000B, 0x0B }, 
                    533: { 0x000C, 0x0C }, { 0x000D, 0x0D }, { 0x000E, 0x0E }, { 0x000F, 0x0F }, 
                    534: { 0x0010, 0x10 }, { 0x0011, 0x11 }, { 0x0012, 0x12 }, { 0x0013, 0x13 }, 
                    535: { 0x0014, 0x14 }, { 0x0015, 0x15 }, { 0x0016, 0x16 }, { 0x0017, 0x17 }, 
                    536: { 0x0018, 0x18 }, { 0x0019, 0x19 }, { 0x001A, 0x1A }, { 0x001B, 0x1B }, 
                    537: { 0x001C, 0x1C }, { 0x001D, 0x1D }, { 0x001E, 0x1E }, { 0x001F, 0x1F }, 
                    538: { 0x0020, 0x20 }, { 0x0021, 0x21 }, { 0x0022, 0x22 }, { 0x0023, 0x23 }, 
                    539: { 0x0024, 0x24 }, { 0x0025, 0x25 }, { 0x0026, 0x26 }, { 0x0027, 0x27 }, 
                    540: { 0x0028, 0x28 }, { 0x0029, 0x29 }, { 0x002A, 0x2A }, { 0x002B, 0x2B }, 
                    541: { 0x002C, 0x2C }, { 0x002D, 0x2D }, { 0x002E, 0x2E }, { 0x002F, 0x2F }, 
                    542: { 0x0030, 0x30 }, { 0x0031, 0x31 }, { 0x0032, 0x32 }, { 0x0033, 0x33 }, 
                    543: { 0x0034, 0x34 }, { 0x0035, 0x35 }, { 0x0036, 0x36 }, { 0x0037, 0x37 }, 
                    544: { 0x0038, 0x38 }, { 0x0039, 0x39 }, { 0x003A, 0x3A }, { 0x003B, 0x3B }, 
                    545: { 0x003C, 0x3C }, { 0x003D, 0x3D }, { 0x003E, 0x3E }, { 0x003F, 0x3F }, 
                    546: { 0x0040, 0x40 }, { 0x0041, 0x41 }, { 0x0042, 0x42 }, { 0x0043, 0x43 }, 
                    547: { 0x0044, 0x44 }, { 0x0045, 0x45 }, { 0x0046, 0x46 }, { 0x0047, 0x47 }, 
                    548: { 0x0048, 0x48 }, { 0x0049, 0x49 }, { 0x004A, 0x4A }, { 0x004B, 0x4B }, 
                    549: { 0x004C, 0x4C }, { 0x004D, 0x4D }, { 0x004E, 0x4E }, { 0x004F, 0x4F }, 
                    550: { 0x0050, 0x50 }, { 0x0051, 0x51 }, { 0x0052, 0x52 }, { 0x0053, 0x53 }, 
                    551: { 0x0054, 0x54 }, { 0x0055, 0x55 }, { 0x0056, 0x56 }, { 0x0057, 0x57 }, 
                    552: { 0x0058, 0x58 }, { 0x0059, 0x59 }, { 0x005A, 0x5A }, { 0x005B, 0x5B }, 
                    553: { 0x005C, 0x5C }, { 0x005D, 0x5D }, { 0x005E, 0x5E }, { 0x005F, 0x5F }, 
                    554: { 0x0060, 0x60 }, { 0x0061, 0x61 }, { 0x0062, 0x62 }, { 0x0063, 0x63 }, 
                    555: { 0x0064, 0x64 }, { 0x0065, 0x65 }, { 0x0066, 0x66 }, { 0x0067, 0x67 }, 
                    556: { 0x0068, 0x68 }, { 0x0069, 0x69 }, { 0x006A, 0x6A }, { 0x006B, 0x6B }, 
                    557: { 0x006C, 0x6C }, { 0x006D, 0x6D }, { 0x006E, 0x6E }, { 0x006F, 0x6F }, 
                    558: { 0x0070, 0x70 }, { 0x0071, 0x71 }, { 0x0072, 0x72 }, { 0x0073, 0x73 }, 
                    559: { 0x0074, 0x74 }, { 0x0075, 0x75 }, { 0x0076, 0x76 }, { 0x0077, 0x77 }, 
                    560: { 0x0078, 0x78 }, { 0x0079, 0x79 }, { 0x007A, 0x7A }, { 0x007B, 0x7B }, 
                    561: { 0x007C, 0x7C }, { 0x007D, 0x7D }, { 0x007E, 0x7E }, { 0x007F, 0x7F }, 
                    562: { 0x0088, 0x88 }, { 0x0098, 0x98 }, { 0x00A0, 0xA0 }, { 0x00A4, 0xA4 }, 
                    563: { 0x00A6, 0xA6 }, { 0x00A7, 0xA7 }, { 0x00A9, 0xA9 }, { 0x00AB, 0xAB }, 
                    564: { 0x00AC, 0xAC }, { 0x00AD, 0xAD }, { 0x00AE, 0xAE }, { 0x00B0, 0xB0 }, 
                    565: { 0x00B1, 0xB1 }, { 0x00B5, 0xB5 }, { 0x00B6, 0xB6 }, { 0x00B7, 0xB7 }, 
                    566: { 0x00BB, 0xBB }, { 0x0401, 0xA8 }, { 0x0402, 0x80 }, { 0x0403, 0x81 }, 
                    567: { 0x0404, 0xAA }, { 0x0405, 0xBD }, { 0x0406, 0xB2 }, { 0x0407, 0xAF }, 
                    568: { 0x0408, 0xA3 }, { 0x0409, 0x8A }, { 0x040A, 0x8C }, { 0x040B, 0x8E }, 
                    569: { 0x040C, 0x8D }, { 0x040E, 0xA1 }, { 0x040F, 0x8F }, { 0x0410, 0xC0 }, 
                    570: { 0x0411, 0xC1 }, { 0x0412, 0xC2 }, { 0x0413, 0xC3 }, { 0x0414, 0xC4 }, 
                    571: { 0x0415, 0xC5 }, { 0x0416, 0xC6 }, { 0x0417, 0xC7 }, { 0x0418, 0xC8 }, 
                    572: { 0x0419, 0xC9 }, { 0x041A, 0xCA }, { 0x041B, 0xCB }, { 0x041C, 0xCC }, 
                    573: { 0x041D, 0xCD }, { 0x041E, 0xCE }, { 0x041F, 0xCF }, { 0x0420, 0xD0 }, 
                    574: { 0x0421, 0xD1 }, { 0x0422, 0xD2 }, { 0x0423, 0xD3 }, { 0x0424, 0xD4 }, 
                    575: { 0x0425, 0xD5 }, { 0x0426, 0xD6 }, { 0x0427, 0xD7 }, { 0x0428, 0xD8 }, 
                    576: { 0x0429, 0xD9 }, { 0x042A, 0xDA }, { 0x042B, 0xDB }, { 0x042C, 0xDC }, 
                    577: { 0x042D, 0xDD }, { 0x042E, 0xDE }, { 0x042F, 0xDF }, { 0x0430, 0xE0 }, 
                    578: { 0x0431, 0xE1 }, { 0x0432, 0xE2 }, { 0x0433, 0xE3 }, { 0x0434, 0xE4 }, 
                    579: { 0x0435, 0xE5 }, { 0x0436, 0xE6 }, { 0x0437, 0xE7 }, { 0x0438, 0xE8 }, 
                    580: { 0x0439, 0xE9 }, { 0x043A, 0xEA }, { 0x043B, 0xEB }, { 0x043C, 0xEC }, 
                    581: { 0x043D, 0xED }, { 0x043E, 0xEE }, { 0x043F, 0xEF }, { 0x0440, 0xF0 }, 
                    582: { 0x0441, 0xF1 }, { 0x0442, 0xF2 }, { 0x0443, 0xF3 }, { 0x0444, 0xF4 }, 
                    583: { 0x0445, 0xF5 }, { 0x0446, 0xF6 }, { 0x0447, 0xF7 }, { 0x0448, 0xF8 }, 
                    584: { 0x0449, 0xF9 }, { 0x044A, 0xFA }, { 0x044B, 0xFB }, { 0x044C, 0xFC }, 
                    585: { 0x044D, 0xFD }, { 0x044E, 0xFE }, { 0x044F, 0xFF }, { 0x0451, 0xB8 }, 
                    586: { 0x0452, 0x90 }, { 0x0453, 0x83 }, { 0x0454, 0xBA }, { 0x0455, 0xBE }, 
                    587: { 0x0456, 0xB3 }, { 0x0457, 0xBF }, { 0x0458, 0xBC }, { 0x0459, 0x9A }, 
                    588: { 0x045A, 0x9C }, { 0x045B, 0x9E }, { 0x045C, 0x9D }, { 0x045E, 0xA2 }, 
                    589: { 0x045F, 0x9F }, { 0x0490, 0xA5 }, { 0x0491, 0xB4 }, { 0x2013, 0x96 }, 
                    590: { 0x2014, 0x97 }, { 0x2018, 0x91 }, { 0x2019, 0x92 }, { 0x201A, 0x82 }, 
                    591: { 0x201C, 0x93 }, { 0x201D, 0x94 }, { 0x201E, 0x84 }, { 0x2020, 0x86 }, 
                    592: { 0x2021, 0x87 }, { 0x2022, 0x95 }, { 0x2026, 0x85 }, { 0x2030, 0x89 }, 
                    593: { 0x2039, 0x8B }, { 0x203A, 0x9B }, { 0x2116, 0xB9 }, { 0x2122, 0x99 }, 
                    594: { 0xFF01, 0x21 }, { 0xFF02, 0x22 }, { 0xFF03, 0x23 }, { 0xFF04, 0x24 }, 
                    595: { 0xFF05, 0x25 }, { 0xFF06, 0x26 }, { 0xFF07, 0x27 }, { 0xFF08, 0x28 }, 
                    596: { 0xFF09, 0x29 }, { 0xFF0A, 0x2A }, { 0xFF0B, 0x2B }, { 0xFF0C, 0x2C }, 
                    597: { 0xFF0D, 0x2D }, { 0xFF0E, 0x2E }, { 0xFF0F, 0x2F }, { 0xFF10, 0x30 }, 
                    598: { 0xFF11, 0x31 }, { 0xFF12, 0x32 }, { 0xFF13, 0x33 }, { 0xFF14, 0x34 }, 
                    599: { 0xFF15, 0x35 }, { 0xFF16, 0x36 }, { 0xFF17, 0x37 }, { 0xFF18, 0x38 }, 
                    600: { 0xFF19, 0x39 }, { 0xFF1A, 0x3A }, { 0xFF1B, 0x3B }, { 0xFF1C, 0x3C }, 
                    601: { 0xFF1D, 0x3D }, { 0xFF1E, 0x3E }, { 0xFF1F, 0x3F }, { 0xFF20, 0x40 }, 
                    602: { 0xFF21, 0x41 }, { 0xFF22, 0x42 }, { 0xFF23, 0x43 }, { 0xFF24, 0x44 }, 
                    603: { 0xFF25, 0x45 }, { 0xFF26, 0x46 }, { 0xFF27, 0x47 }, { 0xFF28, 0x48 }, 
                    604: { 0xFF29, 0x49 }, { 0xFF2A, 0x4A }, { 0xFF2B, 0x4B }, { 0xFF2C, 0x4C }, 
                    605: { 0xFF2D, 0x4D }, { 0xFF2E, 0x4E }, { 0xFF2F, 0x4F }, { 0xFF30, 0x50 }, 
                    606: { 0xFF31, 0x51 }, { 0xFF32, 0x52 }, { 0xFF33, 0x53 }, { 0xFF34, 0x54 }, 
                    607: { 0xFF35, 0x55 }, { 0xFF36, 0x56 }, { 0xFF37, 0x57 }, { 0xFF38, 0x58 }, 
                    608: { 0xFF39, 0x59 }, { 0xFF3A, 0x5A }, { 0xFF3B, 0x5B }, { 0xFF3C, 0x5C }, 
                    609: { 0xFF3D, 0x5D }, { 0xFF3E, 0x5E }, { 0xFF3F, 0x5F }, { 0xFF40, 0x60 }, 
                    610: { 0xFF41, 0x61 }, { 0xFF42, 0x62 }, { 0xFF43, 0x63 }, { 0xFF44, 0x64 }, 
                    611: { 0xFF45, 0x65 }, { 0xFF46, 0x66 }, { 0xFF47, 0x67 }, { 0xFF48, 0x68 }, 
                    612: { 0xFF49, 0x69 }, { 0xFF4A, 0x6A }, { 0xFF4B, 0x6B }, { 0xFF4C, 0x6C }, 
                    613: { 0xFF4D, 0x6D }, { 0xFF4E, 0x6E }, { 0xFF4F, 0x6F }, { 0xFF50, 0x70 }, 
                    614: { 0xFF51, 0x71 }, { 0xFF52, 0x72 }, { 0xFF53, 0x73 }, { 0xFF54, 0x74 }, 
                    615: { 0xFF55, 0x75 }, { 0xFF56, 0x76 }, { 0xFF57, 0x77 }, { 0xFF58, 0x78 }, 
                    616: { 0xFF59, 0x79 }, { 0xFF5A, 0x7A }, { 0xFF5B, 0x7B }, { 0xFF5C, 0x7C }, 
                    617: { 0xFF5D, 0x7D }, { 0xFF5E, 0x7E }
                    618: };
                    619: static const unsigned int gToTableSz = 350;
                    620: 
                    621: 
                    622: 
                    623: // ---------------------------------------------------------------------------
                    624: //  XML1140Transcoder: Constructors and Destructor
                    625: // ---------------------------------------------------------------------------
                    626: XMLWin1251Transcoder::XMLWin1251Transcoder( const   XMLCh* const encodingName
                    627:                                             , const unsigned int blockSize) :
                    628:     XML256TableTranscoder
                    629:     (
                    630:         encodingName
                    631:         , blockSize
                    632:         , gFromTable
                    633:         , gToTable
                    634:         , gToTableSz
                    635:     )
                    636: {
                    637: }
                    638: 
                    639: 
                    640: XMLWin1251Transcoder::~XMLWin1251Transcoder()
                    641: {
                    642: }
                    643: 
                    644: 
                    645: 
                    646: void MXdoc::configure_admin(Request& r) {
                    647:        XalanDOMString *sencoding=new XalanDOMString("WINDOWS-125ODIN");
                    648:        const XMLCh* const encoding_cstr=sencoding->c_str();
                    649:     XMLPlatformUtils::fgTransService->addEncoding(
                    650:                encoding_cstr, 
                    651:                new ENameMapFor<XMLWin1251Transcoder>(encoding_cstr));
                    652:        // delete sencoding; somehow
                    653: }
                    654: 
1.1       parser    655: // global variable
                    656: 
                    657: Methoded *Xdoc_class;
                    658: 
                    659: // creator
                    660: 
                    661: #endif
                    662: 
                    663: Methoded *MXdoc_create(Pool& pool) {
                    664:        return 
                    665: #ifdef XML
                    666:                Xdoc_class=new(pool) MXdoc(pool);
                    667: #else
                    668:                0
                    669: #endif
                    670:        ;
                    671: }

E-mail: