Annotation of parser3/src/types/pa_vxdoc.C, revision 1.33
1.1 parser 1: /** @dom
2: Parser: @b dom parser type.
3:
1.29 paf 4: Copyright(c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com)
1.11 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 parser 6: */
7: #include "pa_config_includes.h"
8: #ifdef XML
1.14 paf 9:
1.33 ! misha 10: static const char * const IDENT_VXDOC="$Date: 2006/12/19 19:06:59 $";
1.1 parser 11:
12: #include "pa_vxdoc.h"
13:
1.28 paf 14: // defines
15:
16: #define SEARCH_NAMESPACES_NAME "search-namespaces"
17:
1.30 paf 18:
19: VXnode& VXdoc::wrap(xmlNode& anode) {
20: VXnode* result;
21: if((result=static_cast<VXnode*>(anode._private))) {
22: assert(anode.doc==fdocument);
23: return *result;
24: }
25:
26: result=new VXnode(anode);
27: anode._private=result;
28: anode.doc=fdocument;
29:
30: return *result;
31: }
32:
33:
1.32 misha 34: Value* VXdoc::as(const char* atype, bool ) {
35: return atype && ( strcmp(VXdoc::type(), atype)==0 || strcmp(VXnode::type(), atype)==0 )?this:0;
1.33 ! misha 36:
! 37: /*
! 38: if(Value* result=Value::as(atype, looking_up))
! 39: return result;
! 40: else
! 41: return VXnode::as(atype, looking_up);
! 42: */
1.18 paf 43: }
44:
1.33 ! misha 45:
1.2 parser 46: /// VXdoc: $CLASS,$method
1.24 paf 47: Value* VXdoc::get_element(const String& aname, Value& aself, bool looking_up) {
1.28 paf 48: if(aname==SEARCH_NAMESPACES_NAME) {
49: return &search_namespaces;
50: }
51:
1.13 paf 52: // up
1.21 paf 53: try {
1.24 paf 54: return VXnode::get_element(aname, aself, looking_up);
55: } catch(Exception) {
56: // ignore bad node elements, they can be valid here...
57:
58: // fields
1.31 paf 59: xmlDoc& xmldoc=get_xmldoc();
1.24 paf 60:
61: if(aname=="doctype") {
62: // readonly attribute DocumentType doctype;
1.31 paf 63: if(xmlNode* node=(xmlNode*)xmldoc.intSubset)
64: return &wrap(*node);
65: else
66: return 0;
1.24 paf 67: } else if(aname=="implementation") {
68: // readonly attribute DOMImplementation implementation;
69: return 0;
70: } else if(aname=="documentElement") {
71: // readonly attribute Element documentElement;
1.31 paf 72: xmlNode* rootElement=xmlDocGetRootElement(&xmldoc);
73: assert(rootElement);
74: return &wrap(*rootElement);
1.24 paf 75: }
1.31 paf 76:
1.25 paf 77: return bark("%s field not found", &aname);
1.24 paf 78: }
1.2 parser 79: }
80:
1.1 parser 81: #endif
E-mail: