2
0

xmlreader.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #pragma prefast(disable:26439) // implicit noexcept
  17. #pragma prefast(disable:26495) // uninitialized member variable
  18. // May want Unicode someday.
  19. typedef char Char;
  20. class Attribute
  21. {
  22. public:
  23. Attribute(Char * name, Char * value);
  24. Char * GetValue(const Char * name);
  25. void Dump();
  26. public:
  27. Attribute * Next;
  28. Char * Name;
  29. Char * Value;
  30. };
  31. class Node
  32. {
  33. public:
  34. Node() {}
  35. Node(const Char * name, Attribute * attributeList);
  36. Node * GetChild(const Char * name);
  37. Char * GetAttributeValue(const Char * name);
  38. void Dump(int indent);
  39. void Dump();
  40. public:
  41. Node * Next;
  42. Node * ChildList;
  43. Attribute * AttributeList;
  44. const Char * Name;
  45. Char * Data;
  46. int LineNumber;
  47. static Node * TopNode;
  48. };
  49. Node * ReadFile(const char * fileName);
  50. } // namespace Xml