--- parser3/src/classes/xnode.C 2001/09/26 11:24:07 1.1 +++ parser3/src/classes/xnode.C 2001/10/11 14:57:53 1.4 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: xnode.C,v 1.1 2001/09/26 11:24:07 parser Exp $ + $Id: xnode.C,v 1.4 2001/10/11 14:57:53 parser Exp $ */ #include "classes.h" #ifdef XML @@ -39,8 +39,6 @@ static void _select(Request& r, const St const XalanDOMChar *expression_dcstr=dstring.c_str(); XPathEvaluator evaluator; - // Initialize the XalanSourceTree subsystem... -// XalanSourceTreeInit theSourceTreeInit; // We'll use these to parse the XML file. XalanSourceTreeDOMSupport dom_support; @@ -63,7 +61,7 @@ static void _select(Request& r, const St result.set_name(method_name); r.write_no_lang(result); } catch(const XSLException& e) { - r._throw(&expression, e); + pool.exception()._throw(pool, &expression, e); } } @@ -94,13 +92,14 @@ static void _select_single(Request& r, c r.write_no_lang(result); } } catch(const XSLException& e) { - r._throw(&expression, e); + pool.exception()._throw(pool, &expression, e); } } // constructor -MXnode::MXnode(Pool& apool) : Methoded(apool) { +MXnode::MXnode(Pool& apool) : Methoded(apool), + consts(apool) { set_name(*NEW String(pool(), XNODE_CLASS_NAME)); // ^node.select[/some/xpath/query] = hash $.#[dnode] @@ -109,7 +108,26 @@ MXnode::MXnode(Pool& apool) : Methoded(a // ^node.select-single[/some/xpath/query] = first dnode add_native_method("select-single", Method::CT_DYNAMIC, _select_single, 1, 1); + // consts + +#define CONST(name, value) \ + consts.put(*new(pool()) String(pool(), #name), new(pool()) VInt(pool(), value)) + + CONST(ELEMENT_NODE, 1); + CONST(ATTRIBUTE_NODE, 2); + CONST(TEXT_NODE, 3); + CONST(CDATA_SECTION_NODE, 4); + CONST(ENTITY_REFERENCE_NODE, 5); + CONST(ENTITY_NODE, 6); + CONST(PROCESSING_INSTRUCTION_NODE, 7); + CONST(COMMENT_NODE, 8); + CONST(DOCUMENT_NODE, 9); + CONST(DOCUMENT_TYPE_NODE, 10); + CONST(DOCUMENT_FRAGMENT_NODE, 11); + CONST(NOTATION_NODE, 12); + } + // global variable Methoded *Xnode_class;