Пример #1
0
xmlNodePtr UXML2Document::findNode(const xmlNodePtr parent, const xmlChar* name, const xmlChar* ns)
{
   U_TRACE(0, "UXML2Document::findNode(%p,%S,%S)", parent, name, ns)

   U_INTERNAL_ASSERT_POINTER(name)

   xmlNodePtr ret;
   xmlNodePtr cur = parent;

   while (cur)
      {
      if (cur->type == XML_ELEMENT_NODE &&
          UXML2Node(cur).checkNodeName(name, ns))
         {
         U_RETURN_POINTER(cur, xmlNode);
         }

      if (cur->children)
         {
         ret = findNode(cur->children, name, ns);

         if (ret) U_RETURN_POINTER(ret, xmlNode);
         }

      cur = cur->next;
      }

   U_RETURN_POINTER(0, xmlNode);
}
Пример #2
0
xmlNodePtr UXML2Document::findChild(const xmlNodePtr parent, const xmlChar* name, const xmlChar* ns)
{
   U_TRACE(0, "UXML2Document::findChild(%p,%S,%S)", parent, name, ns)

   U_INTERNAL_ASSERT_POINTER(name)
   U_INTERNAL_ASSERT_POINTER(parent)

   xmlNodePtr cur = parent->children;

   while (cur)
      {
      if (cur->type == XML_ELEMENT_NODE &&
          UXML2Node(cur).checkNodeName(name, ns))
         {
         U_RETURN_POINTER(cur, xmlNode);
         }

      cur = cur->next;
      }

   U_RETURN_POINTER(U_NULLPTR, xmlNode);
}
Пример #3
0
xmlNodePtr UXML2Document::findParent(const xmlNodePtr cur, const xmlChar* name, const xmlChar* ns)
{
   U_TRACE(0, "UXML2Document::findParent(%p,%S,%S)", cur, name, ns)

   U_INTERNAL_ASSERT_POINTER(cur)
   U_INTERNAL_ASSERT_POINTER(name)

   xmlNodePtr ret;

   if (cur->type == XML_ELEMENT_NODE &&
       UXML2Node(cur).checkNodeName(name, ns))
      {
      U_RETURN_POINTER(cur, xmlNode);
      }

   if (cur->parent)
      {
      ret = findParent(cur->parent, name, ns);

      if (ret) U_RETURN_POINTER(ret, xmlNode);
      }

   U_RETURN_POINTER(0, xmlNode);
}