洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.0 KiB

8 months ago
  1. //
  2. // XMLDictionary.h
  3. //
  4. // Version 1.4
  5. //
  6. // Created by Nick Lockwood on 15/11/2010.
  7. // Copyright 2010 Charcoal Design. All rights reserved.
  8. //
  9. // Get the latest version of XMLDictionary from here:
  10. //
  11. // https://github.com/nicklockwood/XMLDictionary
  12. //
  13. // This software is provided 'as-is', without any express or implied
  14. // warranty. In no event will the authors be held liable for any damages
  15. // arising from the use of this software.
  16. //
  17. // Permission is granted to anyone to use this software for any purpose,
  18. // including commercial applications, and to alter it and redistribute it
  19. // freely, subject to the following restrictions:
  20. //
  21. // 1. The origin of this software must not be misrepresented; you must not
  22. // claim that you wrote the original software. If you use this software
  23. // in a product, an acknowledgment in the product documentation would be
  24. // appreciated but is not required.
  25. //
  26. // 2. Altered source versions must be plainly marked as such, and must not be
  27. // misrepresented as being the original software.
  28. //
  29. // 3. This notice may not be removed or altered from any source distribution.
  30. //
  31. #import <Foundation/Foundation.h>
  32. #import "OSSConstants.h"
  33. #pragma GCC diagnostic push
  34. #pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis"
  35. @interface OSSXMLDictionaryParser : NSObject <NSCopying>
  36. + (OSSXMLDictionaryParser *)sharedInstance;
  37. @property (nonatomic, assign) BOOL collapseTextNodes; // defaults to YES
  38. @property (nonatomic, assign) BOOL stripEmptyNodes; // defaults to YES
  39. @property (nonatomic, assign) BOOL trimWhiteSpace; // defaults to YES
  40. @property (nonatomic, assign) BOOL alwaysUseArrays; // defaults to NO
  41. @property (nonatomic, assign) BOOL preserveComments; // defaults to NO
  42. @property (nonatomic, assign) BOOL wrapRootNode; // defaults to NO
  43. @property (nonatomic, assign) OSSXMLDictionaryAttributesMode attributesMode;
  44. @property (nonatomic, assign) OSSXMLDictionaryNodeNameMode nodeNameMode;
  45. - (NSDictionary *)dictionaryWithParser:(NSXMLParser *)parser;
  46. - (NSDictionary *)dictionaryWithData:(NSData *)data;
  47. - (NSDictionary *)dictionaryWithString:(NSString *)string;
  48. - (NSDictionary *)dictionaryWithFile:(NSString *)path;
  49. @end
  50. @interface NSDictionary (OSSXMLDictionary)
  51. + (NSDictionary *)oss_dictionaryWithXMLParser:(NSXMLParser *)parser;
  52. + (NSDictionary *)oss_dictionaryWithXMLData:(NSData *)data;
  53. + (NSDictionary *)oss_dictionaryWithXMLString:(NSString *)string;
  54. + (NSDictionary *)oss_dictionaryWithXMLFile:(NSString *)path;
  55. - (NSDictionary *)oss_attributes;
  56. - (NSDictionary *)oss_childNodes;
  57. - (NSArray *)oss_comments;
  58. - (NSString *)oss_nodeName;
  59. - (NSString *)oss_innerText;
  60. - (NSString *)oss_innerXML;
  61. - (NSString *)oss_XMLString;
  62. - (NSArray *)oss_arrayValueForKeyPath:(NSString *)keyPath;
  63. - (NSString *)oss_stringValueForKeyPath:(NSString *)keyPath;
  64. - (NSDictionary *)oss_dictionaryValueForKeyPath:(NSString *)keyPath;
  65. @end
  66. @interface NSString (OSSXMLDictionary)
  67. - (NSString *)oss_XMLEncodedString;
  68. @end
  69. #pragma GCC diagnostic pop