Diff for /parser3/src/classes/xdoc.C between versions 1.76 and 1.80

version 1.76, 2002/01/24 15:11:59 version 1.80, 2002/01/29 08:45:36
Line 7 Line 7
         $Id$          $Id$
 */  */
 #include "pa_types.h"  #include "pa_types.h"
   #include "classes.h"
 #ifdef XML  #ifdef XML
   
 #include "gdome.h"  #include "gdome.h"
Line 20  extern "C" { Line 21  extern "C" {
 #include "libxslt/xsltutils.h"  #include "libxslt/xsltutils.h"
   
 #include "pa_stylesheet_connection.h"  #include "pa_stylesheet_connection.h"
 #include "classes.h"  
 #include "pa_request.h"  #include "pa_request.h"
 #include "pa_vxdoc.h"  #include "pa_vxdoc.h"
 #include "pa_charset.h"  #include "pa_charset.h"
Line 371  static void _getElementById(Request& r, Line 371  static void _getElementById(Request& r,
                         &method_name,                           &method_name, 
                         exc);                          exc);
 }  }
   
   static void _importNode(Request& r, const String& method_name, MethodParams *params) {
           Pool& pool=r.pool();
           VXdoc& vdoc=*static_cast<VXdoc *>(r.self);
   
           GdomeNode *importedNode=
                   as_node(pool, method_name, params, 0, "importedNode must be node");
           bool deep=
                   params->as_bool(1, "deep must be bool", r);
   
           GdomeException exc;
           GdomeNode *outputNode=gdome_doc_importNode(vdoc.get_document(&method_name), 
                   importedNode,
                   deep, &exc);
           if(exc)
                   throw Exception(0, 0, 
                           &method_name, 
                           exc);
   
           // write out result
           r.write_no_lang(*new(pool) VXnode(pool, outputNode));
   }
 /*  /*
 GdomeNode *gdome_doc_importNode (GdomeDocument *self, GdomeNode *importedNode, GdomeBoolean deep, GdomeException *exc);  
 GdomeElement *gdome_doc_createElementNS (GdomeDocument *self, GdomeDOMString *namespaceURI, GdomeDOMString *qualifiedName, GdomeException *exc);  GdomeElement *gdome_doc_createElementNS (GdomeDocument *self, GdomeDOMString *namespaceURI, GdomeDOMString *qualifiedName, GdomeException *exc);
 GdomeAttr *gdome_doc_createAttributeNS (GdomeDocument *self, GdomeDOMString *namespaceURI, GdomeDOMString *qualifiedName, GdomeException *exc);  GdomeAttr *gdome_doc_createAttributeNS (GdomeDocument *self, GdomeDOMString *namespaceURI, GdomeDOMString *qualifiedName, GdomeException *exc);
 */  */
Line 423  static void _set(Request& r, const Strin Line 444  static void _set(Request& r, const Strin
         Temp_lang temp_lang(r, String::UL_XML);          Temp_lang temp_lang(r, String::UL_XML);
         const String& xml=r.process(vxml).as_string();          const String& xml=r.process(vxml).as_string();
   
           const char *cstr=xml.cstr(String::UL_UNSPECIFIED);
         GdomeDocument *document=(GdomeDocument *)          GdomeDocument *document=(GdomeDocument *)
                 gdome_xml_n_mkref((xmlNode *)xmlParseMemory(                  gdome_xml_n_mkref((xmlNode *)xmlParseMemory(
                         xml.cstr(String::UL_AS_IS), xml.size()                          cstr, strlen(cstr)
                 ));                  ));
         if(!document || xmlHaveGenericErrors()) {          if(!document || xmlHaveGenericErrors()) {
                 GdomeException exc=0;                  GdomeException exc=0;
Line 591  static void xdoc2buf(Pool& pool, VXdoc& Line 613  static void xdoc2buf(Pool& pool, VXdoc&
         OOE2STYLE(omitXmlDeclaration);          OOE2STYLE(omitXmlDeclaration);
   
         xmlDoc *document=gdome_xml_doc_get_xmlDoc(vdoc.get_document(&method_name));          xmlDoc *document=gdome_xml_doc_get_xmlDoc(vdoc.get_document(&method_name));
         if(xsltSaveResultTo(outputBuffer.get(), document, stylesheet.get())<0) {          if(xsltSaveResultTo     n(outputBuffer.get(), document, stylesheet.get())<0) {
                 GdomeException exc=0;                  GdomeException exc=0;
                 throw Exception(0, 0,                   throw Exception(0, 0, 
                         &method_name,                           &method_name, 
Line 608  static void xdoc2buf(Pool& pool, VXdoc& Line 630  static void xdoc2buf(Pool& pool, VXdoc&
                 gnome_buf=(char *)outputBuffer->buffer->content;                  gnome_buf=(char *)outputBuffer->buffer->content;
         }          }
         if(file_spec)          if(file_spec)
                 file_write(pool,                   file_write(
                                         *file_spec,                                          *file_spec,
                                         gnome_buf, gnome_size,                                           gnome_buf, gnome_size, 
                                         true/*as_text*/);                                          true/*as_text*/);
Line 796  MXdoc::MXdoc(Pool& apool) : MXnode(apool Line 818  MXdoc::MXdoc(Pool& apool) : MXnode(apool
         // ^xdoc.getElementsByTagNameNS[namespaceURI;localName] = array of nodes          // ^xdoc.getElementsByTagNameNS[namespaceURI;localName] = array of nodes
         add_native_method("getElementsByTagNameNS", Method::CT_DYNAMIC, _getElementsByTagNameNS, 2, 2);          add_native_method("getElementsByTagNameNS", Method::CT_DYNAMIC, _getElementsByTagNameNS, 2, 2);
   
         /// DOM2(?)          /// DOM2
   
         // ^xdoc.getElementById[elementId]          // ^xdoc.getElementById[elementId]
         add_native_method("getElementById", Method::CT_DYNAMIC, _getElementById, 1, 1);          add_native_method("getElementById", Method::CT_DYNAMIC, _getElementById, 1, 1);
   
       // Node (in Node importedNode, in boolean deep) raises(DOMException)
           add_native_method("importNode", Method::CT_DYNAMIC, _importNode, 2, 2);
   
         /// parser          /// parser
                   
         // ^xdoc::create{qualifiedName}          // ^xdoc::create{qualifiedName}

Removed from v.1.76  
changed lines
  Added in v.1.80


E-mail: