PageRenderTime 20ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/core/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
 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
19#import <Foundation/Foundation.h>
20
21/// Utilities for NSStrings containing XML
22@interface NSString (GTMNSStringXMLAdditions)
23
24/// Get a string where characters that need escaping for XML are escaped and invalid characters removed
25//
26/// This call escapes '&', '<, '>', '\'', '"' per the xml spec and removes all
27/// invalid characters as defined by Section 2.2 of the xml spec.
28///
29/// For obvious reasons this call is only safe once.
30//
31//  Returns:
32//    Autoreleased NSString
33//
34- (NSString *)gtm_stringBySanitizingAndEscapingForXML;
35
36/// Get a string where characters that invalid characters per the XML spec have been removed
37//
38/// This call removes all invalid characters as defined by Section 2.2 of the
39/// xml spec.  If you are writing XML yourself, you probably was to use the
40/// above api (gtm_stringBySanitizingAndEscapingForXML) so any entities also
41/// get escaped.
42//
43//  Returns:
44//    Autoreleased NSString
45//
46- (NSString *)gtm_stringBySanitizingToXMLSpec;
47
48// There is no stringByUnescapingFromXML because the XML parser will do this.
49// The above api is here just incase you need to create XML yourself.
50
51@end