void u_cfNodeInit( u_cfNode _this, const u_participant participant, const v_cfNode kNode) { v_configuration config; assert(_this != NULL); assert(participant != NULL); assert(kNode != NULL); config = v_cfNodeConfiguration(kNode); _this->configuration = u_handleNew(v_public(config)); _this->participant = participant; _this->kind = v_cfNodeKind(kNode); _this->id = kNode->id; }
c_iter u_cfElementXPath( u_cfElement element, const c_char *xpathExpr) { u_result r; v_cfElement ke; v_cfNode vChild; c_iter vChildren; c_iter children; u_participant p; u_cfNode proxy; children = c_iterNew(NULL); if ((element != NULL) && (xpathExpr != NULL)) { r = u_cfNodeReadClaim(u_cfNode(element), (v_cfNode*)(&ke)); if (r == U_RESULT_OK) { p = u_cfNodeParticipant(u_cfNode(element)); vChildren = v_cfElementXPath(ke, xpathExpr); vChild = c_iterTakeFirst(vChildren); while (vChild != NULL) { switch(v_cfNodeKind(vChild)) { case V_CFELEMENT: proxy = u_cfNode(u_cfElementNew(p, v_cfElement(vChild))); break; case V_CFATTRIBUTE: proxy = u_cfNode(u_cfAttributeNew(p, v_cfAttribute(vChild))); break; case V_CFDATA: proxy = u_cfNode(u_cfDataNew(p,v_cfData(vChild))); break; default: proxy = NULL; break; } children = c_iterInsert(children, proxy); vChild = c_iterTakeFirst(vChildren); } c_iterFree(vChildren); u_cfNodeRelease(u_cfNode(element)); } } return children; }
c_iter u_cfElementGetChildren( u_cfElement element) { u_result r; v_cfElement ke; v_cfNode child; u_cfNode proxy; c_iter kc; c_iter children; u_participant p; children = c_iterNew(NULL); if (element != NULL) { r = u_cfNodeReadClaim(u_cfNode(element), (v_cfNode*)(&ke)); if (r == U_RESULT_OK) { p = u_cfNodeParticipant(u_cfNode(element)); kc = v_cfElementGetChildren(ke); child = c_iterTakeFirst(kc); while (child != NULL) { switch(v_cfNodeKind(child)) { case V_CFELEMENT: proxy = u_cfNode(u_cfElementNew(p, v_cfElement(child))); break; case V_CFATTRIBUTE: proxy = u_cfNode(u_cfAttributeNew(p, v_cfAttribute(child))); break; case V_CFDATA: proxy = u_cfNode(u_cfDataNew(p,v_cfData(child))); break; default: proxy = NULL; break; } c_iterInsert(children, proxy); child = c_iterTakeFirst(kc); } c_iterFree(kc); u_cfNodeRelease(u_cfNode(element)); } } return children; }