#include "DNXMLElement.h"
#include "TKLog.h"
#include "DNUtils.h"
+#include "TKDebug.h"
#include "DNContainerBuilder.h"
DNXMLElement *classElement = NULL;
DNXMLElement *classScriptElement = NULL;
+ DNXMLElement *classAPIElement = NULL;
std::string className;
DNXMLElement *cellElement = NULL;
- DNXMLElement *cellAPIElement = NULL;
DNXMLElement *cellScriptElement = NULL;
std::string cellName;
std::string cellCodeClassName;
while(te)
{
std::string teclass = te->getAttributeValue("class");
- if (teclass == "dennco-cell")
+ if (teclass == "dennco-classdef")
{
- if (cellElement && cellElement == te)
+ if (classElement && classElement == te)
{
- cellAPIElement = element;
+ classAPIElement = element;
}
else
{
{
// go next
do {
-
+ if (!element->next)
+ {
+ element = element->outer;
+ }
+
// the processed element was cell code class definition.
// define it now.
- if (classElement && element->depth == classElement->depth)
+ if (classElement && (element == NULL || element->depth <= classElement->depth))
{
- TKLog::printf("TODO define code class here..class:%s", className.c_str());
+ DEBUG_TRACE("\n===== Define cell code class ===== \nClass:%s\nAPI:%s\n%s\n==================================\n\n", className.c_str(), classAPIElement->text.c_str(), classScriptElement->text.c_str());
//scriptless classdef
classElement = NULL;
classScriptElement = NULL;
+ classAPIElement = NULL;
className = "";
}
// the processed element was cell definition.
// define it now.
- if (cellElement && element->depth == cellElement->depth)
+ if (cellElement && (element == NULL || element->depth <= cellElement->depth))
{
- TKLog::printf("TODO define cell here..cellName:%s", cellName.c_str());
+ DEBUG_TRACE("\n===== Define cell ===== \nName:%s\nClass:%s\nStartup script:\n%s\n=======================\n\n", cellName.c_str(), cellCodeClassName.c_str(),cellScriptElement->text.c_str());
//scriptless celldef
cellElement = NULL;
- cellAPIElement = NULL;
cellScriptElement = NULL;
cellName = "";
cellCodeClassName = "";
}
- if (!element->next)
- {
- element = element->outer;
- }
- if (!element)
- break;
- } while(!element->next && element != xml->getRoot());
+ } while(element && !element->next && element != xml->getRoot());
if (!element)
break;
cname = "";
}
DNXMLElement *dnelement = new DNXMLElement(cname);
+ dnelement->depth = depth;
NSXMLElement *aElement = (NSXMLElement*) aNode;
for( NSXMLNode *attribute in [aElement attributes] ) {
const char *name = [[attribute name] UTF8String];
}
else if ( [aNode kind] == NSXMLTextKind )
{
- NSLog(@"body:%@", [aNode stringValue]);
NSXMLNode *parent = [aNode parent];
if (parent)
{