XML * xml_next(XML * xml)
{
ELEMENTLIST *list;
if (xml == NULL) return (NULL);
if (xml->parent == NULL) return (NULL);
list = xml->parent->children;
while (list != NULL && list->element != xml) list = list->next;
if (list == NULL) return (NULL);
if (list->next == NULL) return (NULL);
return (list->next->element);
}
XML * xml_nextelem(XML * xml)
{
ELEMENTLIST *list;
if (xml == NULL) return (NULL);
if (xml->parent == NULL) return (NULL);
list = xml->parent->children;
while (list != NULL && list->element != xml) list = list->next;
if (list == NULL) return (NULL);
while (list->next != NULL) {
if (list->next->element->name != NULL) break;
list = list->next;
}
if (list->next == NULL) return (NULL);
return (list->next->element);
}
XML * xml_prev(XML * xml)
{
ELEMENTLIST *list;
if (xml == NULL) return (NULL);
if (xml->parent == NULL) return (NULL);
list = xml->parent->children;
while (list != NULL && list->element != xml) list = list->next;
if (list == NULL) return (NULL);
if (list->prev == NULL) return (NULL);
return (list->prev->element);
}
XML * xml_prevelem(XML * xml)
{
ELEMENTLIST *list;
if (xml == NULL) return (NULL);
if (xml->parent == NULL) return (NULL);
list = xml->parent->children;
while (list != NULL && list->element != xml) list = list->next;
if (list == NULL) return (NULL);
while (list->prev != NULL) {
if (list->prev->element->name != NULL) break;
list = list->prev;
}
if (list->prev == NULL) return (NULL);
return (list->prev->element);
}
|