StropheCappuccino API 1.0.0
/tmp/tempDoc.doc/Build/StropheCappuccino.build/Debug/Browser.environment/Sources/TNXMLNode.j
Go to the documentation of this file.
00001 @STATIC;1.0;I;23;Foundation/Foundation.ji;28;Resources/Strophe/strophe.jsi;16;TNStropheUtils.jt;7849;objj_executeFile("Foundation/Foundation.j", NO);objj_executeFile("Resources/Strophe/strophe.js", YES);objj_executeFile("TNStropheUtils.j", YES);{var the_class = objj_allocateClassPair(CPObject, "TNXMLNode"),
00002 meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_xmlNode")]);objj_registerClassPair(the_class);
00003 class_addMethods(the_class, [new objj_method(sel_getUid("xmlNode"), function $TNXMLNode__xmlNode(self, _cmd)
00004 {
00005     return self._xmlNode;
00006 }
00007 ,["id"]), new objj_method(sel_getUid("initWithNode:"), function $TNXMLNode__initWithNode_(self, _cmd, aNode)
00008 {
00009     if (self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("TNXMLNode").super_class }, "init"))
00010     {
00011         if (aNode.c && aNode.c != undefined)
00012         {
00013             self._xmlNode = aNode;
00014         }
00015         else
00016         {
00017             self._xmlNode = new Strophe.Builder('msg');
00018             self._xmlNode.nodeTree = aNode;
00019             self._xmlNode.node = aNode;
00020         }
00021     }
00022     return self;
00023 }
00024 ,["TNXMLNode","id"]), new objj_method(sel_getUid("initWithName:andAttributes:"), function $TNXMLNode__initWithName_andAttributes_(self, _cmd, aName, attributes)
00025 {
00026     if (self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("TNXMLNode").super_class }, "init"))
00027     {
00028         self._xmlNode = new Strophe.Builder(aName, attributes);
00029     }
00030     return self;
00031 }
00032 ,["TNXMLNode","CPString","CPDictionary"]), new objj_method(sel_getUid("copy"), function $TNXMLNode__copy(self, _cmd)
00033 {
00034     return TNXMLNode.isa.objj_msgSend1(TNXMLNode, "nodeWithXMLNode:", Strophe.copyElement(self.isa.objj_msgSend0(self, "tree")));
00035 }
00036 ,["TNXMLNode"]), new objj_method(sel_getUid("addNode:"), function $TNXMLNode__addNode_(self, _cmd, aNode)
00037 {
00038     if (!aNode)
00039         return;
00040     self._xmlNode.cnode((aNode == null ? null : aNode.isa.objj_msgSend0(aNode, "tree")));
00041 }
00042 ,["void","TNXMLNode"]), new objj_method(sel_getUid("addTextNode:"), function $TNXMLNode__addTextNode_(self, _cmd, aText)
00043 {
00044     self._xmlNode = self._xmlNode.t(aText);
00045 }
00046 ,["void","CPString"]), new objj_method(sel_getUid("text"), function $TNXMLNode__text(self, _cmd)
00047 {
00048     return TNStropheStripHTMLCharCode(Strophe.getText(self.isa.objj_msgSend0(self, "tree")));
00049 }
00050 ,["CPString"]), new objj_method(sel_getUid("tree"), function $TNXMLNode__tree(self, _cmd)
00051 {
00052     return self._xmlNode.tree();
00053 }
00054 ,["id"]), new objj_method(sel_getUid("up"), function $TNXMLNode__up(self, _cmd)
00055 {
00056     if (self._xmlNode.node && self._xmlNode.node.parentNode)
00057     {
00058         self._xmlNode.up();
00059         return YES;
00060     }
00061     return NO;
00062 }
00063 ,["BOOL"]), new objj_method(sel_getUid("stringValue"), function $TNXMLNode__stringValue(self, _cmd)
00064 {
00065     return Strophe.serialize(self._xmlNode);
00066 }
00067 ,["CPString"]), new objj_method(sel_getUid("description"), function $TNXMLNode__description(self, _cmd)
00068 {
00069     return self.isa.objj_msgSend0(self, "stringValue");
00070 }
00071 ,["CPString"]), new objj_method(sel_getUid("valueForAttribute:"), function $TNXMLNode__valueForAttribute_(self, _cmd, anAttribute)
00072 {
00073     return self.isa.objj_msgSend0(self, "tree").getAttribute(anAttribute);
00074 }
00075 ,["CPString","CPString"]), new objj_method(sel_getUid("setValue:forAttribute:"), function $TNXMLNode__setValue_forAttribute_(self, _cmd, aValue, anAttribute)
00076 {
00077     var attr = {};
00078     attr[anAttribute] = aValue;
00079     self._xmlNode.attrs(attr);
00080 }
00081 ,["void","CPString","CPString"]), new objj_method(sel_getUid("name"), function $TNXMLNode__name(self, _cmd)
00082 {
00083     return self.isa.objj_msgSend0(self, "tree").tagName;
00084 }
00085 ,["CPString"]), new objj_method(sel_getUid("namespace"), function $TNXMLNode__namespace(self, _cmd)
00086 {
00087     return self.isa.objj_msgSend1(self, "valueForAttribute:", "xmlns");
00088 }
00089 ,["CPString"]), new objj_method(sel_getUid("setNamespace:"), function $TNXMLNode__setNamespace_(self, _cmd, aNamespace)
00090 {
00091     self.isa.objj_msgSend2(self, "setValue:forAttribute:", aNamespace, "xmlns");
00092 }
00093 ,["void","CPString"]), new objj_method(sel_getUid("addChildWithName:andAttributes:"), function $TNXMLNode__addChildWithName_andAttributes_(self, _cmd, aTagName, attributes)
00094 {
00095     self._xmlNode = self._xmlNode.c(aTagName, attributes);
00096 }
00097 ,["void","CPString","CPDictionary"]), new objj_method(sel_getUid("addChildWithName:"), function $TNXMLNode__addChildWithName_(self, _cmd, aTagName)
00098 {
00099     self.isa.objj_msgSend2(self, "addChildWithName:andAttributes:", aTagName, {});
00100 }
00101 ,["void","CPString"]), new objj_method(sel_getUid("childrenWithName:"), function $TNXMLNode__childrenWithName_(self, _cmd, aName)
00102 {
00103     var nodes = CPArray.isa.objj_msgSend0(CPArray, "array"),
00104         elements = self.isa.objj_msgSend0(self, "tree").getElementsByTagName(aName);
00105     for (var i = 0; i < elements.length; i++)
00106         (nodes == null ? null : nodes.isa.objj_msgSend1(nodes, "addObject:", TNXMLNode.isa.objj_msgSend1(TNXMLNode, "nodeWithXMLNode:", elements[i])));
00107     return nodes;
00108 }
00109 ,["CPArray","CPString"]), new objj_method(sel_getUid("ownChildrenWithName:"), function $TNXMLNode__ownChildrenWithName_(self, _cmd, aName)
00110 {
00111     var nodes = CPArray.isa.objj_msgSend0(CPArray, "array"),
00112         elements = self.isa.objj_msgSend0(self, "tree").childNodes;
00113     for (var i = 0; i < elements.length; i++)
00114         if (aName === nil || aName && elements[i].tagName == aName)
00115             (nodes == null ? null : nodes.isa.objj_msgSend1(nodes, "addObject:", TNXMLNode.isa.objj_msgSend1(TNXMLNode, "nodeWithXMLNode:", elements[i])));
00116     return nodes;
00117 }
00118 ,["CPArray","CPString"]), new objj_method(sel_getUid("firstChildWithName:"), function $TNXMLNode__firstChildWithName_(self, _cmd, aName)
00119 {
00120     var elements = self.isa.objj_msgSend0(self, "tree").getElementsByTagName(aName);
00121     if (elements && elements.length > 0)
00122         return TNXMLNode.isa.objj_msgSend1(TNXMLNode, "nodeWithXMLNode:", elements[0]);
00123     else
00124         return;
00125 }
00126 ,["TNXMLNode","CPString"]), new objj_method(sel_getUid("children"), function $TNXMLNode__children(self, _cmd)
00127 {
00128     return self.isa.objj_msgSend1(self, "ownChildrenWithName:", nil);
00129 }
00130 ,["CPArray"]), new objj_method(sel_getUid("containsChildrenWithName:"), function $TNXMLNode__containsChildrenWithName_(self, _cmd, aName)
00131 {
00132     return self.isa.objj_msgSend1(self, "firstChildWithName:", aName) ? YES : NO;
00133 }
00134 ,["BOOL","CPString"])]);
00135 class_addMethods(meta_class, [new objj_method(sel_getUid("nodeWithXMLNode:"), function $TNXMLNode__nodeWithXMLNode_(self, _cmd, aNode)
00136 {
00137     return ((___r1 = TNXMLNode.isa.objj_msgSend0(TNXMLNode, "alloc")), ___r1 == null ? null : ___r1.isa.objj_msgSend1(___r1, "initWithNode:", aNode));
00138     var ___r1;
00139 }
00140 ,["TNXMLNode","id"]), new objj_method(sel_getUid("nodeWithName:"), function $TNXMLNode__nodeWithName_(self, _cmd, aName)
00141 {
00142     return ((___r1 = TNXMLNode.isa.objj_msgSend0(TNXMLNode, "alloc")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "initWithName:andAttributes:", aName, nil));
00143     var ___r1;
00144 }
00145 ,["TNXMLNode","CPString"]), new objj_method(sel_getUid("nodeWithName:andAttributes:"), function $TNXMLNode__nodeWithName_andAttributes_(self, _cmd, aName, someAttributes)
00146 {
00147     return ((___r1 = TNXMLNode.isa.objj_msgSend0(TNXMLNode, "alloc")), ___r1 == null ? null : ___r1.isa.objj_msgSend2(___r1, "initWithName:andAttributes:", aName, someAttributes));
00148     var ___r1;
00149 }
00150 ,["TNXMLNode","CPString","CPDictionary"])]);
00151 }{
00152 var the_class = objj_getClass("TNXMLNode")
00153 if(!the_class) throw new SyntaxError("*** Could not find definition for class \"TNXMLNode\"");
00154 var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $TNXMLNode__initWithCoder_(self, _cmd, aCoder)
00155 {
00156     if (self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("TNXMLNode").super_class }, "init"))
00157     {
00158     }
00159     return self;
00160 }
00161 ,["id","CPCoder"]), new objj_method(sel_getUid("encodeWithCoder:"), function $TNXMLNode__encodeWithCoder_(self, _cmd, aCoder)
00162 {
00163 }
00164 ,["void","CPCoder"])]);
00165 }
 All Classes Namespaces Files Functions Variables