PageRenderTime 17143ms CodeModel.GetById 51ms RepoModel.GetById 4ms app.codeStats 0ms

/core/externals/update-engine/externals/google-toolbox-for-mac/Foundation/GTMNSString+XML.h

http://macfuse.googlecode.com/
C++ Header | 51 lines | 5 code | 6 blank | 40 comment | 0 complexity | 64c7b67231dfdb441dda3708c4d8c57d MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, GPL-2.0
  1. //
  2. // GTMNSString+XML.h
  3. //
  4. // Copyright 2007-2008 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations under
  16. // the License.
  17. //
  18. #import <Foundation/Foundation.h>
  19. /// Utilities for NSStrings containing XML
  20. @interface NSString (GTMNSStringXMLAdditions)
  21. /// Get a string where characters that need escaping for XML are escaped and invalid characters removed
  22. //
  23. /// This call escapes '&', '<, '>', '\'', '"' per the xml spec and removes all
  24. /// invalid characters as defined by Section 2.2 of the xml spec.
  25. ///
  26. /// For obvious reasons this call is only safe once.
  27. //
  28. // Returns:
  29. // Autoreleased NSString
  30. //
  31. - (NSString *)gtm_stringBySanitizingAndEscapingForXML;
  32. /// Get a string where characters that invalid characters per the XML spec have been removed
  33. //
  34. /// This call removes all invalid characters as defined by Section 2.2 of the
  35. /// xml spec. If you are writing XML yourself, you probably was to use the
  36. /// above api (gtm_stringBySanitizingAndEscapingForXML) so any entities also
  37. /// get escaped.
  38. //
  39. // Returns:
  40. // Autoreleased NSString
  41. //
  42. - (NSString *)gtm_stringBySanitizingToXMLSpec;
  43. // There is no stringByUnescapingFromXML because the XML parser will do this.
  44. // The above api is here just incase you need to create XML yourself.
  45. @end