xmlattribute.c 896 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*====================================================================*
  2. *
  3. * struct node * xmlattribute (struct node const * node, char const * name);
  4. *
  5. * node.h
  6. *
  7. * search an element node for the named attribute node; return the
  8. * attribute node address;
  9. *
  10. * Motley Tools by Charles Maier;
  11. * Copyright (c) 2001-2006 by Charles Maier Associates;
  12. * Licensed under the Internet Software Consortium License;
  13. *
  14. *--------------------------------------------------------------------*/
  15. #ifndef XMLATTRIBUTE_SOURCE
  16. #define XMLATTRIBUTE_SOURCE
  17. #include <string.h>
  18. #include "../nodes/node.h"
  19. struct node const * xmlattribute (struct node const * node, char const * name)
  20. {
  21. if (node)
  22. {
  23. node = node->below;
  24. }
  25. while (node)
  26. {
  27. if (node->type == NODE_ATTR)
  28. {
  29. if (!strcmp (node->text, name))
  30. {
  31. break;
  32. }
  33. }
  34. node=node->after;
  35. }
  36. return (node);
  37. }
  38. #endif