1 #include "ACEXML/common/SAXExceptions.h"
2 #include "ACEXML/parser/debug_validator/Debug_Element_Builder.h"
4 ACEXML_Debug_Element_Builder::ACEXML_Debug_Element_Builder ()
10 ACEXML_Debug_Element_Builder::~ACEXML_Debug_Element_Builder ()
16 ACEXML_Debug_Element_Builder::setElementName (const ACEXML_Char
*,
18 const ACEXML_Char
*qName
)
20 this->element_
.set (qName
, 0);
25 ACEXML_Debug_Element_Builder::setContentType (CONTENT_TYPE type
)
27 if (this->type_
== UNDEFINED
)
33 ACEXML_THROW_RETURN (ACEXML_SAXParseException (ACE_TEXT("Element type redefinition in Debug_Validator.")), -1);
37 ACEXML_Debug_Element_Builder::insertMixedElement (const ACEXML_Char
*,
39 const ACEXML_Char
*qName
)
41 ACEXML_Element_Tree_Name_Node
*node
= 0;
43 // @@ We should "throw" an exception here instead of returning -1.
45 ACEXML_Element_Tree_Name_Node (qName
),
49 // @@ Memory leak if fail?
50 ACE_NEW_RETURN (this->root_
,
51 ACEXML_Element_Tree_List_Node (),
55 return this->root_
->insert (node
);
59 ACEXML_Debug_Element_Builder::startChildGroup ()
61 ACEXML_Element_Tree_List_Node
*lnode
= 0;
63 ACE_NEW_RETURN (lnode
,
64 ACEXML_Element_Tree_List_Node (),
74 this->root_
->insert (lnode
);
77 this->active_list_
.push (lnode
);
82 ACEXML_Debug_Element_Builder::endChildGroup (CARDINALITY
)
84 this->active_list_
.pop ();
89 ACEXML_Debug_Element_Builder::setChoice ()
91 this->active_list_
.top ()->set (ACEXML_Element_Tree_List_Node::CHOICE
);
96 ACEXML_Debug_Element_Builder::setSequence ()
98 this->active_list_
.top ()->set (ACEXML_Element_Tree_List_Node::SEQUENCE
);
103 ACEXML_Debug_Element_Builder::insertElement (const ACEXML_Char
*,
105 const ACEXML_Char
*qName
)
107 ACEXML_Element_Tree_Name_Node
*node
= 0;
109 // @@ We should "throw" an exception here instead of returning -1.
110 ACE_NEW_RETURN (node
,
111 ACEXML_Element_Tree_Name_Node (qName
),
114 return this->active_list_
.top ()->insert (node
);
118 ACEXML_Debug_Element_Builder::dump ()
120 cout
<< "<!ELEMENT " << this->element_
;
122 // @@ Also dump element contentspec here.
133 // @@ Dump the content of this->root_
134 cout
<< "*** not implemented ***";
137 cout
<< "*** Unidentified element type ***";