xmlreader.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. //-----------------------------------------------------------------------------
  6. //
  7. // Description:
  8. //
  9. // Simple C++ Xml Reader classes.
  10. //
  11. // Remarks:
  12. //
  13. //-----------------------------------------------------------------------------
  14. namespace Xml
  15. {
  16. // May want Unicode someday.
  17. typedef char Char;
  18. class Attribute
  19. {
  20. public:
  21. Attribute(Char * name, Char * value);
  22. Char * GetValue(const Char * name);
  23. void Dump();
  24. public:
  25. Attribute * Next;
  26. Char * Name;
  27. Char * Value;
  28. };
  29. class Node
  30. {
  31. public:
  32. Node() {}
  33. Node(const Char * name, Attribute * attributeList);
  34. Node * GetChild(const Char * name);
  35. Char * GetAttributeValue(const Char * name);
  36. void Dump(int indent);
  37. void Dump();
  38. public:
  39. Node * Next;
  40. Node * ChildList;
  41. Attribute * AttributeList;
  42. const Char * Name;
  43. Char * Data;
  44. int LineNumber;
  45. static Node * TopNode;
  46. };
  47. Node * ReadFile(const char * fileName);
  48. } // namespace Xml