From 403c6e35bf556f7ddff7dbe0a1a62c108def5aea Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Fri, 28 Oct 2011 07:15:59 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- .gitignore | 20 + LGXMLParser/LGXMLParser.m | 32 +- TouchJSON/NuTests/test_json.nu | 12 +- TouchJSON/Source/CDataScanner.h | 2 +- TouchJSON/Source/CDataScanner.m | 8 +- .../Extensions/CDataScanner_Extensions.m | 6 +- .../Source/Extensions/NSScanner_Extensions.m | 6 +- TouchJSON/Source/JSON/CJSONScanner.m | 16 +- TouchJSON/Source/JSON/CJSONSerializer.m | 2 +- TouchJSON/UnitTests/CDataScanner_UnitTests.m | 2 +- .../UnitTests/CJSONDeserializer_UnitTests.m | 2 +- TouchJSON/UnitTests/TestData/ex3.json | 4 +- TouchJSON/UnitTests/TestData/ex4.json | 6 +- TouchXML/Common/Source/CXMLDocument.m | 16 +- TouchXML/Common/Source/CXMLElement.m | 4 +- TouchXML/Common/Source/CXMLNode.m | 6 +- .../Common/Source/CXMLNode_XPathExtensions.m | 4 +- TouchXML/Coverage/BasicTests.m.gcov | 2 +- TouchXML/Coverage/CXMLDocument.m.gcov | 10 +- TouchXML/Coverage/CXMLNode.m.gcov | 4 +- TouchXML/Externals/tidy/build/gmake/Makefile | 16 +- .../Externals/tidy/build/gmake/readme.txt | 6 +- .../Externals/tidy/build/gnuauto/Makefile.am | 12 +- .../Externals/tidy/build/gnuauto/configure.in | 22 +- .../tidy/build/gnuauto/console/Makefile.am | 12 +- .../tidy/build/gnuauto/include/Makefile.am | 12 +- .../Externals/tidy/build/gnuauto/readme.txt | 2 +- .../Externals/tidy/build/gnuauto/setup.sh | 16 +- .../tidy/build/gnuauto/src/Makefile.am | 12 +- TouchXML/Externals/tidy/build/msvc/tidy.dsp | 14 +- .../Externals/tidy/build/msvc/tidydll.dsp | 14 +- .../Externals/tidy/build/msvc/tidylib.dsp | 18 +- TouchXML/Externals/tidy/build/rpm/tidy.spec | 10 +- TouchXML/Externals/tidy/console/tab2space.c | 10 +- TouchXML/Externals/tidy/console/tidy.c | 12 +- .../tidy/experimental/TidyNodeIter.c | 2 +- .../tidy/experimental/TidyNodeIter.h | 10 +- TouchXML/Externals/tidy/experimental/httpio.c | 10 +- TouchXML/Externals/tidy/htmldoc/Overview.html | 52 +- TouchXML/Externals/tidy/htmldoc/doxygen.cfg | 1024 ++++++++--------- TouchXML/Externals/tidy/htmldoc/faq.html | 38 +- TouchXML/Externals/tidy/htmldoc/license.html | 6 +- TouchXML/Externals/tidy/htmldoc/pending.html | 6 +- .../Externals/tidy/htmldoc/release-notes.html | 10 +- TouchXML/Externals/tidy/include/buffio.h | 12 +- TouchXML/Externals/tidy/include/platform.h | 38 +- TouchXML/Externals/tidy/include/tidy.h | 56 +- TouchXML/Externals/tidy/include/tidyenum.h | 30 +- TouchXML/Externals/tidy/src/access.c | 368 +++--- TouchXML/Externals/tidy/src/access.h | 32 +- TouchXML/Externals/tidy/src/alloc.c | 6 +- TouchXML/Externals/tidy/src/attrask.c | 8 +- TouchXML/Externals/tidy/src/attrdict.c | 202 ++-- TouchXML/Externals/tidy/src/attrget.c | 8 +- TouchXML/Externals/tidy/src/attrs.c | 118 +- TouchXML/Externals/tidy/src/attrs.h | 8 +- TouchXML/Externals/tidy/src/buffio.c | 8 +- TouchXML/Externals/tidy/src/clean.c | 38 +- TouchXML/Externals/tidy/src/clean.h | 6 +- TouchXML/Externals/tidy/src/config.c | 56 +- TouchXML/Externals/tidy/src/config.h | 8 +- TouchXML/Externals/tidy/src/entities.c | 10 +- TouchXML/Externals/tidy/src/entities.h | 6 +- TouchXML/Externals/tidy/src/fileio.c | 6 +- TouchXML/Externals/tidy/src/fileio.h | 8 +- TouchXML/Externals/tidy/src/forward.h | 8 +- TouchXML/Externals/tidy/src/iconvtc.c | 2 +- TouchXML/Externals/tidy/src/istack.c | 12 +- TouchXML/Externals/tidy/src/lexer.c | 94 +- TouchXML/Externals/tidy/src/lexer.h | 16 +- TouchXML/Externals/tidy/src/localize.c | 52 +- TouchXML/Externals/tidy/src/mappedio.c | 2 +- TouchXML/Externals/tidy/src/message.h | 10 +- TouchXML/Externals/tidy/src/parser.c | 126 +- TouchXML/Externals/tidy/src/parser.h | 8 +- TouchXML/Externals/tidy/src/pprint.c | 66 +- TouchXML/Externals/tidy/src/pprint.h | 18 +- TouchXML/Externals/tidy/src/streamio.c | 106 +- TouchXML/Externals/tidy/src/streamio.h | 12 +- TouchXML/Externals/tidy/src/tagask.c | 6 +- TouchXML/Externals/tidy/src/tags.c | 28 +- TouchXML/Externals/tidy/src/tags.h | 6 +- TouchXML/Externals/tidy/src/tidy-int.h | 8 +- TouchXML/Externals/tidy/src/tidylib.c | 40 +- TouchXML/Externals/tidy/src/tmbstr.c | 8 +- TouchXML/Externals/tidy/src/tmbstr.h | 6 +- TouchXML/Externals/tidy/src/utf8.c | 56 +- TouchXML/Externals/tidy/src/utf8.h | 6 +- TouchXML/Externals/tidy/src/version.h | 6 +- TouchXML/Externals/tidy/src/win32tc.c | 2 +- .../tidy/test/accessTest/1-1-12-1.html | 4 +- .../tidy/test/accessTest/4-1-1-1.html | 2 +- .../tidy/test/accessTest/5-1-2-1.html | 2 +- .../tidy/test/accessTest/5-1-2-2.html | 2 +- .../tidy/test/accessTest/5-1-2-3.html | 2 +- .../Externals/tidy/test/input/cfg_616744.txt | 6 +- .../Externals/tidy/test/input/cfg_634889.txt | 14 +- .../Externals/tidy/test/input/cfg_640473.txt | 8 +- .../tidy/test/input/in_1590220-1.html | 2 +- .../tidy/test/input/in_1590220-2.html | 2 +- .../tidy/test/input/in_1986717-1.html | 2 +- .../tidy/test/input/in_1986717-2.html | 2 +- .../Externals/tidy/test/input/in_426885.html | 28 +- .../Externals/tidy/test/input/in_427633.html | 8 +- .../Externals/tidy/test/input/in_427662.html | 16 +- .../Externals/tidy/test/input/in_427664.html | 12 +- .../Externals/tidy/test/input/in_427671.html | 26 +- .../Externals/tidy/test/input/in_427672.html | 12 +- .../Externals/tidy/test/input/in_427675.html | 16 +- .../Externals/tidy/test/input/in_427676.html | 8 +- .../Externals/tidy/test/input/in_427677.html | 10 +- .../Externals/tidy/test/input/in_427811.html | 20 +- .../Externals/tidy/test/input/in_427813.html | 10 +- .../Externals/tidy/test/input/in_427816.html | 10 +- .../Externals/tidy/test/input/in_427818.html | 20 +- .../Externals/tidy/test/input/in_427819.html | 32 +- .../Externals/tidy/test/input/in_427820.html | 2 +- .../Externals/tidy/test/input/in_427822.html | 14 +- .../Externals/tidy/test/input/in_427823.html | 30 +- .../Externals/tidy/test/input/in_427825.html | 14 +- .../Externals/tidy/test/input/in_427827.html | 8 +- .../Externals/tidy/test/input/in_427834.html | 20 +- .../Externals/tidy/test/input/in_427836.html | 6 +- .../Externals/tidy/test/input/in_427838.html | 26 +- .../Externals/tidy/test/input/in_427840.html | 16 +- .../Externals/tidy/test/input/in_427841.html | 48 +- .../Externals/tidy/test/input/in_427844.html | 22 +- .../Externals/tidy/test/input/in_427845.html | 4 +- .../Externals/tidy/test/input/in_427846.html | 2 +- .../Externals/tidy/test/input/in_431719.html | 24 +- .../Externals/tidy/test/input/in_431721.html | 2 +- .../Externals/tidy/test/input/in_431739.html | 8 +- .../Externals/tidy/test/input/in_431883.html | 6 +- .../Externals/tidy/test/input/in_431889.html | 2 +- .../Externals/tidy/test/input/in_431895.html | 4 +- .../Externals/tidy/test/input/in_433021.html | 6 +- .../Externals/tidy/test/input/in_433672.html | 18 +- .../Externals/tidy/test/input/in_434940.html | 4 +- .../Externals/tidy/test/input/in_435920.html | 8 +- .../Externals/tidy/test/input/in_435923.html | 2 +- .../Externals/tidy/test/input/in_437468.html | 6 +- .../Externals/tidy/test/input/in_438650.html | 4 +- .../Externals/tidy/test/input/in_438954.html | 2 +- .../Externals/tidy/test/input/in_438956.html | 2 +- .../Externals/tidy/test/input/in_441568.html | 4 +- .../Externals/tidy/test/input/in_443362.html | 44 +- .../Externals/tidy/test/input/in_443381.xhtml | 18 +- .../Externals/tidy/test/input/in_443576.html | 18 +- .../Externals/tidy/test/input/in_445074.html | 6 +- .../Externals/tidy/test/input/in_445394.html | 12 +- .../Externals/tidy/test/input/in_445557.html | 4 +- .../Externals/tidy/test/input/in_446019.xhtml | 16 +- .../Externals/tidy/test/input/in_470663.html | 10 +- .../Externals/tidy/test/input/in_470688.html | 2 +- .../Externals/tidy/test/input/in_500236.xml | 2 +- .../Externals/tidy/test/input/in_501230.xhtml | 6 +- .../Externals/tidy/test/input/in_508936.html | 2 +- .../Externals/tidy/test/input/in_525081.html | 4 +- .../Externals/tidy/test/input/in_531964.xhtml | 4 +- .../Externals/tidy/test/input/in_533105.html | 2 +- .../Externals/tidy/test/input/in_539369.html | 8 +- .../Externals/tidy/test/input/in_539369a.html | 8 +- .../Externals/tidy/test/input/in_543262.html | 2 +- .../Externals/tidy/test/input/in_545067.html | 2 +- .../Externals/tidy/test/input/in_553468.xhtml | 8 +- .../Externals/tidy/test/input/in_570027.html | 4 +- .../Externals/tidy/test/input/in_578216.html | 26 +- .../Externals/tidy/test/input/in_588061.html | 8 +- .../Externals/tidy/test/input/in_640473.html | 18 +- .../Externals/tidy/test/input/in_655338.html | 8 +- .../Externals/tidy/test/input/in_658230.html | 8 +- .../Externals/tidy/test/input/in_660397.html | 30 +- .../Externals/tidy/test/input/in_663548.html | 24 +- .../Externals/tidy/test/input/in_676156.html | 2 +- .../Externals/tidy/test/input/in_676205.html | 12 +- .../Externals/tidy/test/input/in_678268.html | 22 +- .../Externals/tidy/test/input/in_688746.html | 2 +- .../Externals/tidy/test/input/in_696799.html | 10 +- TouchXML/Externals/tidy/test/onetest.cmd | 2 +- TouchXML/Externals/tidy/test/testone.sh | 2 +- TouchXML/NuTests/test_xml.nu | 46 +- TouchXML/Nukefile | 2 +- TouchXML/UnitTests/Source/BasicTests.m | 2 +- TouchXML/UnitTests/Source/XPath_Tests.m | 2 +- kissxml/DDXMLDocument.m | 16 +- kissxml/DDXMLElement.m | 124 +- kissxml/DDXMLElementAdditions.m | 18 +- kissxml/DDXMLNode.h | 4 +- kissxml/DDXMLNode.m | 300 ++--- kissxml/DDXMLTesting.m | 434 +++---- 190 files changed, 2580 insertions(+), 2560 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac8f968 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc + +# Logs and databases # +###################### +*.log + +# OS generated files # +###################### +.DS_Store* +ehthumbs.db +Icon? +Thumbs.db diff --git a/LGXMLParser/LGXMLParser.m b/LGXMLParser/LGXMLParser.m index d6f8a7f..4c3c272 100644 --- a/LGXMLParser/LGXMLParser.m +++ b/LGXMLParser/LGXMLParser.m @@ -1,5 +1,5 @@ /* Copyright (c) 2008 Louis Gerbarg - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without @@ -8,10 +8,10 @@ copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -20,7 +20,7 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + */ #import "LGXMLParser.h" @@ -49,7 +49,7 @@ @implementation LGXMLParser - (void) dealloc { xmlFreeParserCtxt(ctxt); self.delegate = nil; - + [super dealloc]; } @@ -60,7 +60,7 @@ - (xmlParserCtxtPtr) ctxt { if (!ctxt) { ctxt = xmlCreatePushParserCtxt(emptySAXHandler, self, NULL, 0, NULL); } - + return ctxt; } @@ -119,11 +119,11 @@ - (void)setShouldResolveExternalEntities:(BOOL)shouldResolveExternalEntities { static void startElement2(void *ctx, const xmlChar *name, const xmlChar **atts) { LGXMLParser *self = (LGXMLParser *)ctx; - + if ([self.delegate respondsToSelector:@selector(parser:didStartElement:namespaceURI:qualifiedName:attributes:)]) { - NSMutableDictionary *returnAttributes = nil; + NSMutableDictionary *returnAttributes = nil; NSUInteger i = 0; - + //We need to walk through the attributes and make a dictionary out of them if (atts) { returnAttributes = [NSMutableDictionary dictionary]; @@ -131,7 +131,7 @@ - (void)setShouldResolveExternalEntities:(BOOL)shouldResolveExternalEntities { [returnAttributes setObject:[NSString stringWithUTF8String:(char *)atts[i+1]] forKey:[NSString stringWithUTF8String:(char *)atts[i]]]; } } - + [self.delegate parser:(NSXMLParser *)self didStartElement:[NSString stringWithUTF8String:(const char *)name] namespaceURI:nil qualifiedName:nil attributes:returnAttributes]; } } @@ -166,7 +166,7 @@ - (void)setShouldResolveExternalEntities:(BOOL)shouldResolveExternalEntities { static void characters2(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len) { LGXMLParser *self = (LGXMLParser *)ctx; - + if ([self.delegate respondsToSelector:@selector(parser:foundCharacters:)]) { NSString *characters = [[[NSString alloc] initWithBytes:(const void *)ch length:len encoding:NSUTF8StringEncoding] autorelease];; [self.delegate parser:(NSXMLParser *)self foundCharacters:characters]; @@ -175,10 +175,10 @@ - (void)setShouldResolveExternalEntities:(BOOL)shouldResolveExternalEntities { //We could do better error handling if we needed it -static void +static void xmlParserErrors2(void *ctx, const char *msg, ...) { LGXMLParser *self = (LGXMLParser *)ctx; - + if ([self.delegate respondsToSelector:@selector(parser:parseErrorOccurred:)]) { //FIXME this should be better, but on the phone this is mainly a debugging niceity NSError *error = [NSError errorWithDomain:@"LGXMLParser" code:0 userInfo:nil]; @@ -189,7 +189,7 @@ - (void)setShouldResolveExternalEntities:(BOOL)shouldResolveExternalEntities { static void ignorableWhitespace2 (void *ctx, const xmlChar *ch, int len) { LGXMLParser *self = (LGXMLParser *)ctx; - + if ([self.delegate respondsToSelector:@selector(parser:foundIgnorableWhitespace:)]) { NSString *characters = [[[NSString alloc] initWithBytes:(const void *)ch length:len encoding:NSUTF8StringEncoding] autorelease]; [self.delegate parser:(NSXMLParser *)self foundIgnorableWhitespace:characters]; @@ -199,7 +199,7 @@ - (void)setShouldResolveExternalEntities:(BOOL)shouldResolveExternalEntities { static void comment2 (void *ctx, const xmlChar *value) { LGXMLParser *self = (LGXMLParser *)ctx; - + if ([self.delegate respondsToSelector:@selector(parser:foundComment:)]) { NSString *characters = [[[NSString alloc] initWithBytes:value length:strlen((const char *)value) encoding:NSUTF8StringEncoding] autorelease]; [self.delegate parser:(NSXMLParser *)self foundComment:characters]; @@ -209,7 +209,7 @@ - (void)setShouldResolveExternalEntities:(BOOL)shouldResolveExternalEntities { static void cdataBlock2 (void *ctx, const xmlChar *value, int len) { LGXMLParser *self = (LGXMLParser *)ctx; - + if ([self.delegate respondsToSelector:@selector(parser:foundCDATA:)]) { NSData *data = [[[NSData alloc] initWithBytes:(const void *)value length:len] autorelease]; [self.delegate parser:(NSXMLParser *)self foundCDATA:data]; diff --git a/TouchJSON/NuTests/test_json.nu b/TouchJSON/NuTests/test_json.nu index 0287495..04c8aba 100644 --- a/TouchJSON/NuTests/test_json.nu +++ b/TouchJSON/NuTests/test_json.nu @@ -1,7 +1,7 @@ (load "TouchJSON") (class TestJSON is NuTestCase - + (- testSerializer is (set s (CJSONSerializer serializer)) (assert_equal "null" (s serializeNull:nil)) @@ -10,7 +10,7 @@ (assert_equal "[1,\"two\",3]" (s serializeArray:(array 1 "two" 3.0))) (assert_equal "{\"three\":[1,2,3]}" (s serializeDictionary:(dict three:(array 1 2 3)))) - + ;; It seemed to me that an orthgonal API would let me do this... ;;(assert_equal "null" (s serializeObject:nil)) (assert_equal "123" (s serializeObject:123)) @@ -18,19 +18,19 @@ (assert_equal "[1,\"two\",3]" (s serializeObject:(array 1 "two" 3.0))) (assert_equal "{\"three\":[1,2,3]}" (s serializeObject:(dict three:(array 1 2 3))))) - + (- testDeserializer is (set d (CJSONDeserializer deserializer)) (assert_equal nil (d deserialize:"null")) (assert_equal 123 (d deserialize:"123")) - (assert_equal "one two three" (d deserialize:"\"one two three\"")) + (assert_equal "one two three" (d deserialize:"\"one two three\"")) (assert_equal (array 1 "two" 3.0) (d deserialize:"[1,\"two\",3]")) (assert_equal (dict three:(array 1 2 3)) (d deserialize:"{\"three\":[1,2,3]}"))) - + (- testInfoInAndOut is (set s (CJSONSerializer serializer)) (set d (CJSONDeserializer deserializer)) - + (set info (NSDictionary dictionaryWithContentsOfFile:"UnitTests/Info.plist")) (set serialized (s serializeObject:info)) (set info2 (d deserialize:serialized)) diff --git a/TouchJSON/Source/CDataScanner.h b/TouchJSON/Source/CDataScanner.h index a768892..218857c 100644 --- a/TouchJSON/Source/CDataScanner.h +++ b/TouchJSON/Source/CDataScanner.h @@ -38,7 +38,7 @@ u_int8_t *end; u_int8_t *current; NSUInteger length; - + NSCharacterSet *doubleCharacters; } diff --git a/TouchJSON/Source/CDataScanner.m b/TouchJSON/Source/CDataScanner.m index 44df309..f3dbe31 100644 --- a/TouchJSON/Source/CDataScanner.m +++ b/TouchJSON/Source/CDataScanner.m @@ -88,7 +88,7 @@ - (NSUInteger)scanLocation - (NSData *)data { -return(data); +return(data); } - (void)setData:(NSData *)inData @@ -100,7 +100,7 @@ - (void)setData:(NSData *)inData [data release]; data = NULL; } - + if (inData) { data = [inData retain]; @@ -192,7 +192,7 @@ - (BOOL)scanCharactersFromSet:(NSCharacterSet *)inSet intoString:(NSString **)ou { *outValue = [[[NSString alloc] initWithBytes:current length:P - current encoding:NSUTF8StringEncoding] autorelease]; } - + current = P; return(YES); @@ -232,7 +232,7 @@ - (BOOL)scanUpToCharactersFromSet:(NSCharacterSet *)inSet intoString:(NSString * { *outValue = [[[NSString alloc] initWithBytes:current length:P - current encoding:NSUTF8StringEncoding] autorelease]; } - + current = P; return(YES); diff --git a/TouchJSON/Source/Extensions/CDataScanner_Extensions.m b/TouchJSON/Source/Extensions/CDataScanner_Extensions.m index c1a16d9..bb5e818 100644 --- a/TouchJSON/Source/Extensions/CDataScanner_Extensions.m +++ b/TouchJSON/Source/Extensions/CDataScanner_Extensions.m @@ -40,13 +40,13 @@ - (BOOL)scanCStyleComment:(NSString **)outComment NSString *theComment = NULL; if ([self scanUpToString:@"*/" intoString:&theComment] == NO) [NSException raise:NSGenericException format:@"Started to scan a C style comment but it wasn't terminated."]; - + if ([theComment rangeOfString:@"/*"].location != NSNotFound) [NSException raise:NSGenericException format:@"C style comments should not be nested."]; - + if ([self scanString:@"*/" intoString:NULL] == NO) [NSException raise:NSGenericException format:@"C style comment did not end correctly."]; - + if (outComment != NULL) *outComment = theComment; diff --git a/TouchJSON/Source/Extensions/NSScanner_Extensions.m b/TouchJSON/Source/Extensions/NSScanner_Extensions.m index 981366f..33f3626 100644 --- a/TouchJSON/Source/Extensions/NSScanner_Extensions.m +++ b/TouchJSON/Source/Extensions/NSScanner_Extensions.m @@ -78,13 +78,13 @@ - (BOOL)scanCStyleComment:(NSString **)outComment NSString *theComment = NULL; if ([self scanUpToString:@"*/" intoString:&theComment] == NO) [NSException raise:NSGenericException format:@"Started to scan a C style comment but it wasn't terminated."]; - + if ([theComment rangeOfString:@"/*"].location != NSNotFound) [NSException raise:NSGenericException format:@"C style comments should not be nested."]; - + if ([self scanString:@"*/" intoString:NULL] == NO) [NSException raise:NSGenericException format:@"C style comment did not end correctly."]; - + if (outComment != NULL) *outComment = theComment; diff --git a/TouchJSON/Source/JSON/CJSONScanner.m b/TouchJSON/Source/JSON/CJSONScanner.m index c9b1d58..9628745 100644 --- a/TouchJSON/Source/JSON/CJSONScanner.m +++ b/TouchJSON/Source/JSON/CJSONScanner.m @@ -93,7 +93,7 @@ - (void)setData:(NSData *)inData else if (theChars[1] != 0) theEncoding = NSUTF16BigEndianStringEncoding; } - + if (theEncoding != NSUTF8StringEncoding) { NSString *theString = [[NSString alloc] initWithData:theData encoding:theEncoding]; @@ -157,7 +157,7 @@ - (BOOL)scanJSONObject:(id *)outObject error:(NSError **)outError [self scanJSONArray:&theObject error:outError]; break; default: - + break; } @@ -187,7 +187,7 @@ - (BOOL)scanJSONDictionary:(NSDictionary **)outDictionary error:(NSError **)outE while ([self currentCharacter] != '}') { [self skipWhitespace]; - + if ([self currentCharacter] == '}') break; @@ -324,7 +324,7 @@ - (BOOL)scanJSONArray:(NSArray **)outArray error:(NSError **)outError } [theArray addObject:theValue]; - + [self skipWhitespace]; if ([self scanCharacter:','] == NO) { @@ -342,7 +342,7 @@ - (BOOL)scanJSONArray:(NSArray **)outArray error:(NSError **)outError [theArray release]; return(NO); } - + break; } [self skipWhitespace]; @@ -401,7 +401,7 @@ - (BOOL)scanJSONStringConstant:(NSString **)outStringConstant error:(NSError **) { [theString appendString:theStringChunk]; } - + if ([self scanCharacter:'\\'] == YES) { unichar theCharacter = [self scanCharacter]; @@ -469,7 +469,7 @@ - (BOOL)scanJSONStringConstant:(NSString **)outStringConstant error:(NSError **) CFStringAppendCharacters((CFMutableStringRef)theString, &theCharacter, 1); } } - + if (outStringConstant != NULL) *outStringConstant = [[theString copy] autorelease]; @@ -527,7 +527,7 @@ - (BOOL)scanNotQuoteCharactersIntoString:(NSString **)outValue { *outValue = [[[NSString alloc] initWithBytes:current length:P - current encoding:NSUTF8StringEncoding] autorelease]; } - + current = P; return(YES); diff --git a/TouchJSON/Source/JSON/CJSONSerializer.m b/TouchJSON/Source/JSON/CJSONSerializer.m index 7511e11..0596b1d 100644 --- a/TouchJSON/Source/JSON/CJSONSerializer.m +++ b/TouchJSON/Source/JSON/CJSONSerializer.m @@ -173,7 +173,7 @@ - (NSString *)serializeDictionary:(NSDictionary *)inDictionary while ((theKey = [theEnumerator nextObject]) != NULL) { id theValue = [inDictionary objectForKey:theKey]; - + [theString appendFormat:@"%@:%@", [self serializeString:theKey], [self serializeObject:theValue]]; if (theKey != [theKeys lastObject]) [theString appendString:@","]; diff --git a/TouchJSON/UnitTests/CDataScanner_UnitTests.m b/TouchJSON/UnitTests/CDataScanner_UnitTests.m index f958019..a306dde 100644 --- a/TouchJSON/UnitTests/CDataScanner_UnitTests.m +++ b/TouchJSON/UnitTests/CDataScanner_UnitTests.m @@ -41,7 +41,7 @@ - (void)testSomething STAssertFalse(theScanner.isAtEnd, NULL); NSString *theString = NULL; -BOOL theResult = +BOOL theResult = theResult = [theScanner scanString:@"Hello" intoString:&theString]; STAssertTrue(theResult, NULL); diff --git a/TouchJSON/UnitTests/CJSONDeserializer_UnitTests.m b/TouchJSON/UnitTests/CJSONDeserializer_UnitTests.m index d27259f..c7ef70e 100644 --- a/TouchJSON/UnitTests/CJSONDeserializer_UnitTests.m +++ b/TouchJSON/UnitTests/CJSONDeserializer_UnitTests.m @@ -65,7 +65,7 @@ -(void)testDeserializeDictionaryWithAnEmbeddedArray { @"a_method", @"method", [NSArray arrayWithObject:@"a_param"], @"params", nil]; - STAssertEqualObjects(dictionary, theObject, nil); + STAssertEqualObjects(dictionary, theObject, nil); } -(void)testCheckForError { diff --git a/TouchJSON/UnitTests/TestData/ex3.json b/TouchJSON/UnitTests/TestData/ex3.json index 9b820d8..d7237a5 100644 --- a/TouchJSON/UnitTests/TestData/ex3.json +++ b/TouchJSON/UnitTests/TestData/ex3.json @@ -6,7 +6,7 @@ "width": 500, "height": 500 }, - "image": { + "image": { "src": "Images/Sun.png", "name": "sun1", "hOffset": 250, @@ -23,4 +23,4 @@ "alignment": "center", "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" } -}} +}} diff --git a/TouchJSON/UnitTests/TestData/ex4.json b/TouchJSON/UnitTests/TestData/ex4.json index d540b57..def7329 100644 --- a/TouchJSON/UnitTests/TestData/ex4.json +++ b/TouchJSON/UnitTests/TestData/ex4.json @@ -1,5 +1,5 @@ {"web-app": { - "servlet": [ + "servlet": [ { "servlet-name": "cofaxCDS", "servlet-class": "org.cofax.cds.CDSServlet", @@ -55,7 +55,7 @@ { "servlet-name": "cofaxAdmin", "servlet-class": "org.cofax.cds.AdminServlet"}, - + { "servlet-name": "fileServlet", "servlet-class": "org.cofax.cds.FileServlet"}, @@ -82,7 +82,7 @@ "cofaxAdmin": "/admin/*", "fileServlet": "/static/*", "cofaxTools": "/tools/*"}, - + "taglib": { "taglib-uri": "cofax.tld", "taglib-location": "/WEB-INF/tlds/cofax.tld"}}} \ No newline at end of file diff --git a/TouchXML/Common/Source/CXMLDocument.m b/TouchXML/Common/Source/CXMLDocument.m index 478817a..7452cbb 100644 --- a/TouchXML/Common/Source/CXMLDocument.m +++ b/TouchXML/Common/Source/CXMLDocument.m @@ -58,7 +58,7 @@ - (id)initWithXMLString:(NSString *)inString options:(NSUInteger)inOptions error { if (outError) *outError = NULL; - + xmlDocPtr theDoc; if ( inOptions & CXMLDocumentTidyHTML ) { @@ -68,8 +68,8 @@ - (id)initWithXMLString:(NSString *)inString options:(NSUInteger)inOptions error if (! ctx ) { return 0; - } - + } + ctx->vctxt.error = htmlparser_error; ctx->vctxt.warning = htmlparser_warning; if (ctx->sax != NULL) @@ -115,10 +115,10 @@ - (id)initWithContentsOfURL:(NSURL *)inURL options:(NSUInteger)inOptions error:( } else { - + self = NULL; } - + return(self); } @@ -132,7 +132,7 @@ - (id)initWithData:(NSData *)inData options:(NSUInteger)inOptions error:(NSError { theDoc = xmlRecoverMemory([inData bytes], [inData length]); } - + if (theDoc != NULL) { _node = (xmlNodePtr)theDoc; @@ -172,7 +172,7 @@ - (void)dealloc - (CXMLElement *)rootElement { xmlNodePtr theLibXMLNode = xmlDocGetRootElement((xmlDocPtr)_node); - + return([CXMLNode nodeWithLibXMLNode:theLibXMLNode]); } @@ -201,7 +201,7 @@ - (NSString *)description xmlDocDumpFormatMemory((xmlDocPtr)(self->_node), &xmlbuff, &buffersize, 1); NSString *dump = [[[NSString alloc] initWithBytes:xmlbuff length:buffersize encoding:NSUTF8StringEncoding] autorelease]; xmlFree(xmlbuff); - + [result appendString:dump]; return result; } diff --git a/TouchXML/Common/Source/CXMLElement.m b/TouchXML/Common/Source/CXMLElement.m index fe68c9b..e769b35 100644 --- a/TouchXML/Common/Source/CXMLElement.m +++ b/TouchXML/Common/Source/CXMLElement.m @@ -122,7 +122,7 @@ - (NSString*)_XMLStringWithOptions:(NSUInteger)options appendingToString:(NSMuta } [str appendString:@">"]; - + if ( _node->children ) { for (id child in [self children]) @@ -135,7 +135,7 @@ - (NSString*)_XMLStringWithOptions:(NSUInteger)options appendingToString:(NSMuta - (NSString *)description { NSAssert(_node != NULL, @"TODO"); - + return([NSString stringWithFormat:@"<%@ %p [%p] %@ %@>", NSStringFromClass([self class]), self, self->_node, [self name], [self XMLStringWithOptions:0]]); } diff --git a/TouchXML/Common/Source/CXMLNode.m b/TouchXML/Common/Source/CXMLNode.m index 6ab44bd..19cb822 100644 --- a/TouchXML/Common/Source/CXMLNode.m +++ b/TouchXML/Common/Source/CXMLNode.m @@ -70,7 +70,7 @@ - (NSString *)stringValue { NSAssert(_node != NULL, @"TODO"); xmlChar *theXMLString; -if ( _node->type == CXMLTextKind ) +if ( _node->type == CXMLTextKind ) theXMLString = _node->content; else theXMLString = xmlNodeListGetString(_node->doc, _node->children, YES); @@ -148,7 +148,7 @@ - (NSArray *)children [theChildren addObject:theNode]; theCurrentNode = theCurrentNode->next; } -return(theChildren); +return(theChildren); } - (CXMLNode *)childAtIndex:(NSUInteger)index @@ -271,7 +271,7 @@ - (NSArray *)nodesForXPath:(NSString *)xpath error:(NSError **)error xmlNodePtr theNode = theXPathObject->nodesetval->nodeTab[N]; [theArray addObject:[CXMLNode nodeWithLibXMLNode:theNode]]; } - + theResult = theArray; } diff --git a/TouchXML/Common/Source/CXMLNode_XPathExtensions.m b/TouchXML/Common/Source/CXMLNode_XPathExtensions.m index b20a0d6..4c46fdb 100644 --- a/TouchXML/Common/Source/CXMLNode_XPathExtensions.m +++ b/TouchXML/Common/Source/CXMLNode_XPathExtensions.m @@ -64,10 +64,10 @@ - (NSArray *)nodesForXPath:(NSString *)xpath namespaceMappings:(NSDictionary *)i xmlNodePtr theNode = theXPathObject->nodesetval->nodeTab[N]; [theArray addObject:[CXMLNode nodeWithLibXMLNode:theNode]]; } - + theResult = theArray; } - + xmlXPathFreeObject(theXPathObject); xmlXPathFreeContext(theXPathContext); diff --git a/TouchXML/Coverage/BasicTests.m.gcov b/TouchXML/Coverage/BasicTests.m.gcov index 305112a..ace2ef9 100644 --- a/TouchXML/Coverage/BasicTests.m.gcov +++ b/TouchXML/Coverage/BasicTests.m.gcov @@ -54,7 +54,7 @@ 30: 49: STAssertEquals([theNode index], [theArray indexOfObject:theNode], NULL); 30: 50: STAssertEquals((int)[theNode level], 2, NULL); -: 51: } - -: 52: + -: 52: 10: 53:STAssertEquals([[theXMLDocument rootElement] childAtIndex:0], [theArray objectAtIndex:0], NULL); 10: 54:STAssertEquals([[theXMLDocument rootElement] childAtIndex:1], [theArray objectAtIndex:1], NULL); 10: 55:STAssertEquals([[theXMLDocument rootElement] childAtIndex:2], [theArray objectAtIndex:2], NULL); diff --git a/TouchXML/Coverage/CXMLDocument.m.gcov b/TouchXML/Coverage/CXMLDocument.m.gcov index 8684017..03486a7 100644 --- a/TouchXML/Coverage/CXMLDocument.m.gcov +++ b/TouchXML/Coverage/CXMLDocument.m.gcov @@ -25,7 +25,7 @@ 50: 20:if ((self = [super init]) != NULL) -: 21: { 50: 22: xmlDocPtr theDoc = xmlParseDoc((xmlChar *)[inString UTF8String]); - -: 23: + -: 23: 50: 24: if (theDoc != NULL) -: 25: { 40: 26: _node = (xmlNodePtr)theDoc; @@ -51,10 +51,10 @@ -: 46: } -: 47:else -: 48: { - -: 49: + -: 49: #####: 50: self = NULL; -: 51: } - -: 52: + -: 52: #####: 53:return(self); -: 54:} -: 55: @@ -67,7 +67,7 @@ -: 62: { #####: 63: theDoc = xmlParseMemory([inData bytes], [inData length]); -: 64: } - -: 65: + -: 65: #####: 66: if (theDoc != NULL) -: 67: { #####: 68: _node = (xmlNodePtr)theDoc; @@ -105,7 +105,7 @@ -: 100:- (CXMLElement *)rootElement 110: 101:{ 110: 102:xmlNodePtr theLibXMLNode = xmlDocGetRootElement((xmlDocPtr)_node); - -: 103: + -: 103: 110: 104:return([CXMLNode nodeWithLibXMLNode:theLibXMLNode]); -: 105:} -: 106: diff --git a/TouchXML/Coverage/CXMLNode.m.gcov b/TouchXML/Coverage/CXMLNode.m.gcov index ddd9319..232c0a0 100644 --- a/TouchXML/Coverage/CXMLNode.m.gcov +++ b/TouchXML/Coverage/CXMLNode.m.gcov @@ -128,7 +128,7 @@ #####: 123: [theChildren addObject:theNode]; #####: 124: theCurrentNode = theCurrentNode->next; -: 125: } - #####: 126:return(theChildren); + #####: 126:return(theChildren); -: 127:} -: 128: -: 129:- (CXMLNode *)childAtIndex:(NSUInteger)index @@ -207,7 +207,7 @@ 50: 202: xmlNodePtr theNode = theXPathObject->nodesetval->nodeTab[N]; 50: 203: [theArray addObject:[CXMLNode nodeWithLibXMLNode:theNode]]; -: 204: } - -: 205: + -: 205: 20: 206: theResult = theArray; -: 207: } -: 208: diff --git a/TouchXML/Externals/tidy/build/gmake/Makefile b/TouchXML/Externals/tidy/build/gmake/Makefile index 0c716ab..295a119 100644 --- a/TouchXML/Externals/tidy/build/gmake/Makefile +++ b/TouchXML/Externals/tidy/build/gmake/Makefile @@ -2,12 +2,12 @@ # # CVS Info : # -# $Author: arnaud02 $ -# $Date: 2008/03/22 21:13:38 $ -# $Revision: 1.37 $ +# $Author: arnaud02 $ +# $Date: 2008/03/22 21:13:38 $ +# $Revision: 1.37 $ # # Copyright (c) 1998-2008 World Wide Web Consortium -# (Massachusetts Institute of Technology, European Research +# (Massachusetts Institute of Technology, European Research # Consortium for Informatics and Mathematics, Keio University). # All Rights Reserved. # @@ -29,7 +29,7 @@ # but not limited to, warranties of merchantability or fitness # for any particular purpose or that the use of the software or # documentation will not infringe any third party patents, -# copyrights, trademarks or other rights. +# copyrights, trademarks or other rights. # # The copyright holders and contributing author(s) will not be # liable for any direct, indirect, special or consequential damages @@ -45,7 +45,7 @@ # not be misrepresented as being the original source. # 3. This Copyright notice may not be removed or altered from any # source or altered source distribution. -# +# # The copyright holders and contributing author(s) specifically # permit, without fee, and encourage the use of this source code # as a component for supporting the Hypertext Markup Language in @@ -77,11 +77,11 @@ BINDIR = ${TOPDIR}/bin DOCDIR = ${TOPDIR}/htmldoc # Note about shared library and exported symbols: -# With gcc, one can control the exported symbols by either using +# With gcc, one can control the exported symbols by either using # "-fvisibility=hidden -DTIDY_EXPORT='__attribute__((visibility("default")))'" # or using a linker map (see GNU ld "--version-script"). -# Lookup based on hash table can be disabled with +# Lookup based on hash table can be disabled with # "-DELEMENT_HASH_LOOKUP=0 -DATTRIBUTE_HASH_LOOKUP=0" # Memory mapped i/o can be disabled with -DSUPPORT_POSIX_MAPPED_FILES=0 diff --git a/TouchXML/Externals/tidy/build/gmake/readme.txt b/TouchXML/Externals/tidy/build/gmake/readme.txt index 7e83cb3..fd579a0 100644 --- a/TouchXML/Externals/tidy/build/gmake/readme.txt +++ b/TouchXML/Externals/tidy/build/gmake/readme.txt @@ -1,10 +1,10 @@ This Makefile works on most Unix platforms. Although, by default, it runs gcc, by setting the CC macro, it runs with many C compilers. -You can override the default build options by setting environment +You can override the default build options by setting environment variables of the same name as the corresponding macro: DMALLOC, SUPPORT_ACCESSIBILITY_CHECKS, SUPPORT_UTF16_ENCODINGS and -SUPPORT_ASIAN_ENCODINGS. +SUPPORT_ASIAN_ENCODINGS. $ DMALLOC=1 gmake @@ -12,5 +12,5 @@ Note this Makefile will only run with gmake. But you should be able to easily locate a pre-built executable for your platform. To customize the location of output files or install locations, just -edit the Makefile. There are variable definitions for just about +edit the Makefile. There are variable definitions for just about everything, so you shouldn't have to alter the build rules. diff --git a/TouchXML/Externals/tidy/build/gnuauto/Makefile.am b/TouchXML/Externals/tidy/build/gnuauto/Makefile.am index 89abf38..7b4a726 100644 --- a/TouchXML/Externals/tidy/build/gnuauto/Makefile.am +++ b/TouchXML/Externals/tidy/build/gnuauto/Makefile.am @@ -2,12 +2,12 @@ # # CVS Info : # -# $Author: creitzel $ -# $Date: 2003/03/19 18:37:37 $ -# $Revision: 1.3 $ +# $Author: creitzel $ +# $Date: 2003/03/19 18:37:37 $ +# $Revision: 1.3 $ # # Copyright (c) 1998-2003 World Wide Web Consortium -# (Massachusetts Institute of Technology, European Research +# (Massachusetts Institute of Technology, European Research # Consortium for Informatics and Mathematics, Keio University). # All Rights Reserved. # @@ -29,7 +29,7 @@ # but not limited to, warranties of merchantability or fitness # for any particular purpose or that the use of the software or # documentation will not infringe any third party patents, -# copyrights, trademarks or other rights. +# copyrights, trademarks or other rights. # # The copyright holders and contributing author(s) will not be # liable for any direct, indirect, special or consequential damages @@ -45,7 +45,7 @@ # not be misrepresented as being the original source. # 3. This Copyright notice may not be removed or altered from any # source or altered source distribution. -# +# # The copyright holders and contributing author(s) specifically # permit, without fee, and encourage the use of this source code # as a component for supporting the Hypertext Markup Language in diff --git a/TouchXML/Externals/tidy/build/gnuauto/configure.in b/TouchXML/Externals/tidy/build/gnuauto/configure.in index f86e23f..5344d1a 100644 --- a/TouchXML/Externals/tidy/build/gnuauto/configure.in +++ b/TouchXML/Externals/tidy/build/gnuauto/configure.in @@ -1,29 +1,29 @@ # configure.in - HTML TidyLib GNU autoconf input file # # Copyright (c) 2003-2004 World Wide Web Consortium -# (Massachusetts Institute of Technology, European Research +# (Massachusetts Institute of Technology, European Research # Consortium for Informatics and Mathematics, Keio University). # All Rights Reserved. # # CVS Info : # -# $Author: arnaud02 $ -# $Date: 2008/03/24 21:08:16 $ -# $Revision: 1.4 $ +# $Author: arnaud02 $ +# $Date: 2008/03/24 21:08:16 $ +# $Revision: 1.4 $ # AC_INIT([include/tidy.h]) # Making releases: -# +# # TIDY_MICRO_VERSION += 1; # TIDY_INTERFACE_AGE += 1; # TIDY_BINARY_AGE += 1; -# +# # if any functions have been added, set TIDY_INTERFACE_AGE to 0. # if backwards compatibility has been broken, # set TIDY_BINARY_AGE and TIDY_INTERFACE_AGE to 0. -# +# TIDY_MAJOR_VERSION=0 TIDY_MINOR_VERSION=99 TIDY_MICRO_VERSION=0 @@ -35,7 +35,7 @@ LIBTIDY_VERSION=$TIDY_MAJOR_VERSION.$TIDY_MINOR_VERSION.$TIDY_MICRO_VERSION AC_SUBST(LIBTIDY_VERSION) # libtool versioning -# +# LT_RELEASE=$TIDY_MAJOR_VERSION.$TIDY_MINOR_VERSION LT_CURRENT=`expr $TIDY_MICRO_VERSION - $TIDY_INTERFACE_AGE` LT_REVISION=$TIDY_INTERFACE_AGE @@ -52,7 +52,7 @@ AM_INIT_AUTOMAKE(tidy,$LIBTIDY_VERSION) # ============================================= # AC_PROG_CC has a habit of adding -g to CFLAGS -# +# save_cflags="$CFLAGS" AC_PROG_CC @@ -74,7 +74,7 @@ if test $debug_build = yes; then else CFLAGS="-O2 $save_cflags" fi -# +# # ============================================= AC_PROG_CPP @@ -122,7 +122,7 @@ fi # TODO: this defines "WITH_DMALLOC" but tidy expects "DMALLOC" # need to do: #if defined(DMALLOC) || defined(WITH_DMALLOC) -# +# AM_WITH_DMALLOC AC_OUTPUT([ diff --git a/TouchXML/Externals/tidy/build/gnuauto/console/Makefile.am b/TouchXML/Externals/tidy/build/gnuauto/console/Makefile.am index feae290..e5dbae0 100644 --- a/TouchXML/Externals/tidy/build/gnuauto/console/Makefile.am +++ b/TouchXML/Externals/tidy/build/gnuauto/console/Makefile.am @@ -2,12 +2,12 @@ # # CVS Info : # -# $Author: arnaud02 $ -# $Date: 2008/03/17 12:49:40 $ -# $Revision: 1.3 $ +# $Author: arnaud02 $ +# $Date: 2008/03/17 12:49:40 $ +# $Revision: 1.3 $ # # Copyright (c) 1998-2008 World Wide Web Consortium -# (Massachusetts Institute of Technology, European Research +# (Massachusetts Institute of Technology, European Research # Consortium for Informatics and Mathematics, Keio University). # All Rights Reserved. # @@ -29,7 +29,7 @@ # but not limited to, warranties of merchantability or fitness # for any particular purpose or that the use of the software or # documentation will not infringe any third party patents, -# copyrights, trademarks or other rights. +# copyrights, trademarks or other rights. # # The copyright holders and contributing author(s) will not be # liable for any direct, indirect, special or consequential damages @@ -45,7 +45,7 @@ # not be misrepresented as being the original source. # 3. This Copyright notice may not be removed or altered from any # source or altered source distribution. -# +# # The copyright holders and contributing author(s) specifically # permit, without fee, and encourage the use of this source code # as a component for supporting the Hypertext Markup Language in diff --git a/TouchXML/Externals/tidy/build/gnuauto/include/Makefile.am b/TouchXML/Externals/tidy/build/gnuauto/include/Makefile.am index e5de2bd..be63ae8 100644 --- a/TouchXML/Externals/tidy/build/gnuauto/include/Makefile.am +++ b/TouchXML/Externals/tidy/build/gnuauto/include/Makefile.am @@ -2,12 +2,12 @@ # # CVS Info : # -# $Author: arnaud02 $ -# $Date: 2006/10/06 09:25:13 $ -# $Revision: 1.3 $ +# $Author: arnaud02 $ +# $Date: 2006/10/06 09:25:13 $ +# $Revision: 1.3 $ # # Copyright (c) 1998-2006 World Wide Web Consortium -# (Massachusetts Institute of Technology, European Research +# (Massachusetts Institute of Technology, European Research # Consortium for Informatics and Mathematics, Keio University). # All Rights Reserved. # @@ -29,7 +29,7 @@ # but not limited to, warranties of merchantability or fitness # for any particular purpose or that the use of the software or # documentation will not infringe any third party patents, -# copyrights, trademarks or other rights. +# copyrights, trademarks or other rights. # # The copyright holders and contributing author(s) will not be # liable for any direct, indirect, special or consequential damages @@ -45,7 +45,7 @@ # not be misrepresented as being the original source. # 3. This Copyright notice may not be removed or altered from any # source or altered source distribution. -# +# # The copyright holders and contributing author(s) specifically # permit, without fee, and encourage the use of this source code # as a component for supporting the Hypertext Markup Language in diff --git a/TouchXML/Externals/tidy/build/gnuauto/readme.txt b/TouchXML/Externals/tidy/build/gnuauto/readme.txt index 365d9d4..31413ed 100644 --- a/TouchXML/Externals/tidy/build/gnuauto/readme.txt +++ b/TouchXML/Externals/tidy/build/gnuauto/readme.txt @@ -1,6 +1,6 @@ To use GNU "Auto" tools (AutoConf/AutoMake/LibTool), run /bin/sh build/gnuauto/setup.sh from the top-level Tidy -directory. This script will copy the appropriate +directory. This script will copy the appropriate Makefile.am files into each source directory, along with configure.in. diff --git a/TouchXML/Externals/tidy/build/gnuauto/setup.sh b/TouchXML/Externals/tidy/build/gnuauto/setup.sh index b720dc6..fd4fb4e 100644 --- a/TouchXML/Externals/tidy/build/gnuauto/setup.sh +++ b/TouchXML/Externals/tidy/build/gnuauto/setup.sh @@ -10,14 +10,14 @@ if ! test -f build/gnuauto/setup.sh; then else - for i in libtoolize glibtoolize - do - ( $i --version) < /dev/null > /dev/null 2>&1 && - LIBTOOLIZE=$i - done - if test -z "$LIBTOOLIZE" ; then - echo "You need libtoolize to continue" - exit 1; + for i in libtoolize glibtoolize + do + ( $i --version) < /dev/null > /dev/null 2>&1 && + LIBTOOLIZE=$i + done + if test -z "$LIBTOOLIZE" ; then + echo "You need libtoolize to continue" + exit 1; fi top_srcdir=`pwd` echo "" diff --git a/TouchXML/Externals/tidy/build/gnuauto/src/Makefile.am b/TouchXML/Externals/tidy/build/gnuauto/src/Makefile.am index 76bdf56..c6d8df4 100644 --- a/TouchXML/Externals/tidy/build/gnuauto/src/Makefile.am +++ b/TouchXML/Externals/tidy/build/gnuauto/src/Makefile.am @@ -2,12 +2,12 @@ # # CVS Info : # -# $Author: arnaud02 $ -# $Date: 2008/03/17 12:49:41 $ -# $Revision: 1.8 $ +# $Author: arnaud02 $ +# $Date: 2008/03/17 12:49:41 $ +# $Revision: 1.8 $ # # Copyright (c) 1998-2008 World Wide Web Consortium -# (Massachusetts Institute of Technology, European Research +# (Massachusetts Institute of Technology, European Research # Consortium for Informatics and Mathematics, Keio University). # All Rights Reserved. # @@ -29,7 +29,7 @@ # but not limited to, warranties of merchantability or fitness # for any particular purpose or that the use of the software or # documentation will not infringe any third party patents, -# copyrights, trademarks or other rights. +# copyrights, trademarks or other rights. # # The copyright holders and contributing author(s) will not be # liable for any direct, indirect, special or consequential damages @@ -45,7 +45,7 @@ # not be misrepresented as being the original source. # 3. This Copyright notice may not be removed or altered from any # source or altered source distribution. -# +# # The copyright holders and contributing author(s) specifically # permit, without fee, and encourage the use of this source code # as a component for supporting the Hypertext Markup Language in diff --git a/TouchXML/Externals/tidy/build/msvc/tidy.dsp b/TouchXML/Externals/tidy/build/msvc/tidy.dsp index e95adde..5ab482f 100644 --- a/TouchXML/Externals/tidy/build/msvc/tidy.dsp +++ b/TouchXML/Externals/tidy/build/msvc/tidy.dsp @@ -7,19 +7,19 @@ CFG=tidy - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "tidy.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "tidy.mak" CFG="tidy - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "tidy - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "tidy - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -76,7 +76,7 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -!ENDIF +!ENDIF # Begin Target diff --git a/TouchXML/Externals/tidy/build/msvc/tidydll.dsp b/TouchXML/Externals/tidy/build/msvc/tidydll.dsp index 129c6de..db40930 100644 --- a/TouchXML/Externals/tidy/build/msvc/tidydll.dsp +++ b/TouchXML/Externals/tidy/build/msvc/tidydll.dsp @@ -7,19 +7,19 @@ CFG=tidydll - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "tidydll.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "tidydll.mak" CFG="tidydll - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "tidydll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "tidydll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -82,7 +82,7 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"DebugDLL/libtidy.dll" /pdbtype:sept -!ENDIF +!ENDIF # Begin Target diff --git a/TouchXML/Externals/tidy/build/msvc/tidylib.dsp b/TouchXML/Externals/tidy/build/msvc/tidylib.dsp index d5a233c..f14a0f2 100644 --- a/TouchXML/Externals/tidy/build/msvc/tidylib.dsp +++ b/TouchXML/Externals/tidy/build/msvc/tidylib.dsp @@ -7,19 +7,19 @@ CFG=tidylib - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "tidylib.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "tidylib.mak" CFG="tidylib - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "tidylib - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "tidylib - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -76,7 +76,7 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"Debug\libtidy.lib" -!ENDIF +!ENDIF # Begin Target @@ -142,7 +142,7 @@ SOURCE=..\..\src\lexer.c SOURCE=..\..\src\localize.c # End Source File # Begin Source File - + SOURCE=..\..\src\mappedio.c !IF "$(CFG)" == "tidylib - Win32 Release" @@ -151,7 +151,7 @@ SOURCE=..\..\src\mappedio.c # ADD CPP /Ze -!ENDIF +!ENDIF # End Source File # Begin Source File diff --git a/TouchXML/Externals/tidy/build/rpm/tidy.spec b/TouchXML/Externals/tidy/build/rpm/tidy.spec index e6c44dc..609c542 100644 --- a/TouchXML/Externals/tidy/build/rpm/tidy.spec +++ b/TouchXML/Externals/tidy/build/rpm/tidy.spec @@ -16,7 +16,7 @@ # norootforbuild # neededforbuild doxygen libxslt libtool -BuildRequires: doxygen libxslt libtool +BuildRequires: doxygen libxslt libtool Name: tidy Version: 1.0 @@ -54,7 +54,7 @@ are logged as "errors" rather than "warnings". Authors: -------- - Tidy was written by Dave Raggett and is now maintained + Tidy was written by Dave Raggett and is now maintained and developed by the Tidy team at http://tidy.sourceforge.net/. @@ -78,13 +78,13 @@ Autoreqprov: on %description -n libtidy-devel -This package contains the headers, the shared libraries and the API -documentation which programmers will need to develop applications based on +This package contains the headers, the shared libraries and the API +documentation which programmers will need to develop applications based on tidy. %debug_package %prep -%setup -q -n %{name} -b 1 +%setup -q -n %{name} -b 1 mv htmldoc/doxygen.cfg Doxyfile diff --git a/TouchXML/Externals/tidy/console/tab2space.c b/TouchXML/Externals/tidy/console/tab2space.c index 2cdc434..9c16961 100644 --- a/TouchXML/Externals/tidy/console/tab2space.c +++ b/TouchXML/Externals/tidy/console/tab2space.c @@ -143,7 +143,7 @@ static int ReadChar(Stream *in) in->tabs--; return ' '; } - + /* Else go on with normal buffer: */ for (;;) { @@ -331,14 +331,14 @@ int main(int argc, char **argv) if (fin != stdin) fclose(fin); - + if (fout != stdout) fout = fopen(outfile, "wb"); - + if (fout) { WriteFile(in, fout); - + if (fout != stdout) fclose(fout); } @@ -352,7 +352,7 @@ int main(int argc, char **argv) --argc; ++argv; - + if (argc <= 1) break; } diff --git a/TouchXML/Externals/tidy/console/tidy.c b/TouchXML/Externals/tidy/console/tidy.c index e54b56c..823fecf 100644 --- a/TouchXML/Externals/tidy/console/tidy.c +++ b/TouchXML/Externals/tidy/console/tidy.c @@ -2,15 +2,15 @@ tidy.c - HTML TidyLib command line driver Copyright (c) 1998-2008 World Wide Web Consortium - (Massachusetts Institute of Technology, European Research + (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved. CVS Info : - $Author: arnaud02 $ - $Date: 2008/03/22 20:53:08 $ - $Revision: 1.50 $ + $Author: arnaud02 $ + $Date: 2008/03/22 20:53:08 $ + $Revision: 1.50 $ */ #include "tidy.h" @@ -928,7 +928,7 @@ int main( int argc, char** argv ) errout = stderr; /* initialize to stderr */ status = 0; - + #ifdef TIDY_CONFIG_FILE if ( tidyFileExists( tdoc, TIDY_CONFIG_FILE) ) { @@ -1290,7 +1290,7 @@ int main( int argc, char** argv ) errout == stderr && !contentErrors) fprintf(errout, "\n"); - if (contentErrors + contentWarnings > 0 && + if (contentErrors + contentWarnings > 0 && !tidyOptGetBool(tdoc, TidyQuiet)) tidyErrorSummary(tdoc); diff --git a/TouchXML/Externals/tidy/experimental/TidyNodeIter.c b/TouchXML/Externals/tidy/experimental/TidyNodeIter.c index f010d0c..bf4d061 100644 --- a/TouchXML/Externals/tidy/experimental/TidyNodeIter.c +++ b/TouchXML/Externals/tidy/experimental/TidyNodeIter.c @@ -26,7 +26,7 @@ Node *nextTidyNode( TidyNodeIter *pThis ) // the next element, if any, is my first-born child pThis->pCurrent = pThis->pCurrent->content; } - else + else { // no children, I guess my next younger brother inherits the throne. while ( NULL == pThis->pCurrent->next diff --git a/TouchXML/Externals/tidy/experimental/TidyNodeIter.h b/TouchXML/Externals/tidy/experimental/TidyNodeIter.h index e949e3f..6fc4753 100644 --- a/TouchXML/Externals/tidy/experimental/TidyNodeIter.h +++ b/TouchXML/Externals/tidy/experimental/TidyNodeIter.h @@ -2,7 +2,7 @@ (c) 1998-2003 (W3C) MIT, ERCIM, Keio University See tidy.h for the copyright notice. - + These files contain utility routines to perform in-order traversals of the Tidy document tree, beginning at an arbitrary node. @@ -28,11 +28,11 @@ typedef struct _TidyNodeIter TidyNodeIter *newTidyNodeIter( Node *pStart ); -/* +/* nextTidyNode( TidyNodeIter *pIter ) if pCurrent is NULL, this function initializes it to match pTop, and - returns that value, otherwise it advances to the next node in order, + returns that value, otherwise it advances to the next node in order, and returns that value. When pTop == pCurrent, the function returns NULL to indicate that the entire tree has been visited. */ @@ -42,10 +42,10 @@ Node *nextTidyNode( TidyNodeIter *pIter ); setCurrentNode( TidyNodeIter *pThis, Node *newCurr ) Resets pCurrent to match the passed value; useful if you need to back up - to an unaltered point in the tree, or to skip a section. The next call to + to an unaltered point in the tree, or to skip a section. The next call to nextTidyNode() will return the node which follows newCurr in order. - Minimal error checking is performed; unexpected results _will_ occur if + Minimal error checking is performed; unexpected results _will_ occur if newCurr is not a descendant node of pTop. */ void setCurrentNode( TidyNodeIter *pThis, Node *newCurr ); diff --git a/TouchXML/Externals/tidy/experimental/httpio.c b/TouchXML/Externals/tidy/experimental/httpio.c index cda9270..7406795 100644 --- a/TouchXML/Externals/tidy/experimental/httpio.c +++ b/TouchXML/Externals/tidy/experimental/httpio.c @@ -109,13 +109,13 @@ int fillBuffer( HTTPInputSource *in ) int openURL( HTTPInputSource *in, tmbstr pUrl ) { int rc = -1; -#ifdef WIN32 +#ifdef WIN32 WSADATA wsaData; rc = WSAStartup( 514, &wsaData ); #endif - in->tis.getByte = (TidyGetByteFunc) HTTPGetByte; + in->tis.getByte = (TidyGetByteFunc) HTTPGetByte; in->tis.ungetByte = (TidyUngetByteFunc) HTTPUngetByte; in->tis.eof = (TidyEOFFunc) HTTPIsEOF; in->tis.sourceData = (uint) in; @@ -137,8 +137,8 @@ int openURL( HTTPInputSource *in, tmbstr pUrl ) { if (1 < blanks) break; - for (; in->nextBytePos < sizeof( in->buffer ) - && 0 != in->buffer[ in->nextBytePos ]; + for (; in->nextBytePos < sizeof( in->buffer ) + && 0 != in->buffer[ in->nextBytePos ]; in->nextBytePos++ ) { ch = in->buffer[ in->nextBytePos ]; @@ -209,7 +209,7 @@ Bool HTTPIsEOF( HTTPInputSource *source ) /* pending ungot bytes, not done */ return no; - if ( 0 != source->nBufSize + if ( 0 != source->nBufSize && source->nextBytePos >= source->nBufSize) /* We've consumed the existing buffer, get another */ fillBuffer( source ); diff --git a/TouchXML/Externals/tidy/htmldoc/Overview.html b/TouchXML/Externals/tidy/htmldoc/Overview.html index 5c80529..1de7524 100644 --- a/TouchXML/Externals/tidy/htmldoc/Overview.html +++ b/TouchXML/Externals/tidy/htmldoc/Overview.html @@ -8,9 +8,9 @@ content="HTML, validation, error correction, pretty-printing" /> diff --git a/TouchXML/Externals/tidy/test/input/in_545067.html b/TouchXML/Externals/tidy/test/input/in_545067.html index 7b28f1c..5f634f7 100644 --- a/TouchXML/Externals/tidy/test/input/in_545067.html +++ b/TouchXML/Externals/tidy/test/input/in_545067.html @@ -1,3 +1,3 @@ [ 545067 ] Implicit closing of head broken -

+

diff --git a/TouchXML/Externals/tidy/test/input/in_553468.xhtml b/TouchXML/Externals/tidy/test/input/in_553468.xhtml index a1b4825..1b49c49 100644 --- a/TouchXML/Externals/tidy/test/input/in_553468.xhtml +++ b/TouchXML/Externals/tidy/test/input/in_553468.xhtml @@ -1,11 +1,11 @@ - - + + [ #553468 ] Doesn't warn about <u> in XHTML strict -

Tidy doesn't complain about underlining in +

Tidy doesn't complain about underlining in XHTML strict documents

diff --git a/TouchXML/Externals/tidy/test/input/in_570027.html b/TouchXML/Externals/tidy/test/input/in_570027.html index 125774e..ed8b8a3 100644 --- a/TouchXML/Externals/tidy/test/input/in_570027.html +++ b/TouchXML/Externals/tidy/test/input/in_570027.html @@ -11,14 +11,14 @@

      ;   [ 578216 ] Incorrect indent of <SPAN> elements -

- Benefits: Using a new Project Profile Knowledge + Benefits: Using a new Project Profile Knowledge Base...
- Solutions: Comprehensive intranet-based + Solutions: Comprehensive intranet-based knowledge base containing...
- Roles: Drove site and content management + Roles: Drove site and content management architecture...
- Technology: Visual InterDev, IIS, + Technology: Visual InterDev, IIS, ...
diff --git a/TouchXML/Externals/tidy/test/input/in_588061.html b/TouchXML/Externals/tidy/test/input/in_588061.html index 811a715..06f5307 100644 --- a/TouchXML/Externals/tidy/test/input/in_588061.html +++ b/TouchXML/Externals/tidy/test/input/in_588061.html @@ -316,12 +316,12 @@

Stock status subject to change. We try to update the stock status continuously but we sometimes don't get it changed immediately. Check with us for current stock status.

Our Return Policy

Software Return Policy - +

Accessories and Miscellaneous Items - +

@@ -332,7 +332,7 @@

We also sell Garmin GPS accessories such as mounts, cables, cases, etc.

- + We sell everything in the Garmin outdoor recreation, marine and cartography line. Email us for prices on any items you don't see listed above.


@@ -346,7 +346,7 @@

We also sell Garmin GPS access

-
Email us for requirements/costs for out of 48/US sales or click here. +Email us for requirements/costs for out of 48/US sales or click here.



diff --git a/TouchXML/Externals/tidy/test/input/in_640473.html b/TouchXML/Externals/tidy/test/input/in_640473.html index 2006909..222c9ff 100644 --- a/TouchXML/Externals/tidy/test/input/in_640473.html +++ b/TouchXML/Externals/tidy/test/input/in_640473.html @@ -1,9 +1,9 @@ -[ 640473 ] new-empty-tags doesn't work, breaks doc - -Foo bar foo foo foo -

This is a test

- - -This is a pre-formatted Baz! - - +[ 640473 ] new-empty-tags doesn't work, breaks doc + +Foo bar foo foo foo +

This is a test

+ + +This is a pre-formatted Baz! + + diff --git a/TouchXML/Externals/tidy/test/input/in_655338.html b/TouchXML/Externals/tidy/test/input/in_655338.html index cae767e..33ad025 100644 --- a/TouchXML/Externals/tidy/test/input/in_655338.html +++ b/TouchXML/Externals/tidy/test/input/in_655338.html @@ -1,8 +1,8 @@ - - - + + + [ 655338 ] Tidy leaves XML decl in wrong place -

foo +

foo diff --git a/TouchXML/Externals/tidy/test/input/in_658230.html b/TouchXML/Externals/tidy/test/input/in_658230.html index b546d8b..9564028 100644 --- a/TouchXML/Externals/tidy/test/input/in_658230.html +++ b/TouchXML/Externals/tidy/test/input/in_658230.html @@ -498,7 +498,7 @@ @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o - p q r s t u v w x y z { | } ~ + p q r s t u v w x y z { | } ~ ɠ ɡ ɢ ɣ ɤ ɥ ɦ ɧ ɨ ɩ ɪ ɫ ɬ ɭ ɮ ɯ ɰ ɱ ɲ ɳ ɴ ɵ ɶ ɷ ɸ ɹ ɺ ɻ ɼ ɽ ɾ ɿ @@ -859,7 +859,7 @@ P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ - + @@ -980,7 +980,7 @@ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ - + @@ -1101,7 +1101,7 @@ p q r s t u v w x y z { | } ~ - + diff --git a/TouchXML/Externals/tidy/test/input/in_660397.html b/TouchXML/Externals/tidy/test/input/in_660397.html index 5c9320e..7296cf9 100644 --- a/TouchXML/Externals/tidy/test/input/in_660397.html +++ b/TouchXML/Externals/tidy/test/input/in_660397.html @@ -7,12 +7,12 @@

Aufklrung ist der Ausgang des Menschen
aus seiner selbstverschuldeten Unmndigkeit.
/Immanuel Kant/
- - + +

TCPA und Palladium

Ein weiterer Schritt in die Unmndigkeit
oder ein Schritt hin zur Emanzipation?

- +

Von der ffentlichkeit weitgehend unbemerkt geistern seit einigen Wochen geheimnisvolle neue Schlagworte und Krzel durch die Welt der EDV-Profis: TCPA und Palladium. Interessiert habe ich mich damit @@ -26,11 +26,11 @@ nur auf den ersten Blick, denn wenn man sich des Horrorszenarios bewut wird, das hinter TCPA in Kombination mit Palladium steckt, so drfte wohl selbst der unbedarfteste EDV-Anwender schlaflose Nchte bekommen.

- +

Was hat es also mit diesen Begriffen auf sich, welche Intentionen liegen diesen Schlagworten zugrunde und was bedeuten die dahintersteckenden neuen Techniken fr den EDV-Anwender?

- +

Die TCPA ist ein Zusammenschlu fhrender Hardwarehersteller, darunter IBM, HP, AMD und Intel, die sich vorgenommen haben, den Personal Computer durch Implementation neuer Hardwaretechnologien sicherer zu @@ -57,7 +57,7 @@ langer eindeutiger Wert aus den gewonnenen Daten und einem speziellen Schlssel generiert wird, hat der Fritz-Chip jederzeit die vllige Kontrolle ber das Gesamtsystem.

- +

Damit taucht schon die erste Problematik fr den Anwender auf: Bereits ein Flash-Update des Rechner-BIOS legt das gesamte System lahm, da dann die generierten Werte des Fritz-Chip nicht mehr mit den gespeicherten @@ -74,7 +74,7 @@ geprfter Hardware (HCL) und einer weiteren Liste mit gesperrten Seriennummern (SRL) die Konformittstabelle des Rechners geprft und aktualisiert.

- +

Hat der Fritz-Chip beim Bootvorgang alle Komponenten als TCPA-konform berprft und erkannt, bergibt er die Kontrolle schlielich an das Betriebssystem. Ab diesem Punkt hakt nun - wie knnte es anders sein? - @@ -88,7 +88,7 @@ gesperrten Dokumenten fr dieses Programm abgerufen (DRL), um zu verhindern, da der Anwender fr ihn nicht vorgesehene Dateien ffnet oder unerlaubterweise nutzt.

- +

Was sich auf den ersten Blick tatschlich als wirksame Waffe gegen Viren, Trojaner, Wrmer und hnliche Probleme geriert, entmndigt jedoch den Anwender: Palladium stt vor allem bei der @@ -100,17 +100,17 @@ Musikstcke zu privaten Zwecken am heimischen PC wird damit unterbunden - dank Microsoft werden also vermutlich die ohnehin bervollen Kassen der Unterhaltungsindustrie zuknftig noch krftiger klingeln!

- +

Doch der Anwender hat natrlich noch die Mglichkeit, auch nicht TCPA-konforme Software auf seinem heimischen PC zu installieren und zu starten. Bemerkt Palladium eine solche Anwendung, wird das Gesamtsystem als kompromittiert gekennzeichnet und alle konformen Anwendungen samt Dateien werden geschlossen. Der Nutzwert eines solchen Systems drfte fr den Anwender dann wohl gegen Null tendieren.

- +

Doch gehen wir einen Schritt weiter und bedenken wir die Folgen dieser Technologie:

- +
  1. Die SRL's, DRL's und HCL's, die fr die @@ -204,7 +204,7 @@ in den entsprechenden Standardisierungs-Richtlinien.
- +

Das hier geschilderte Horrorszenario erscheint keineswegs abwegig: Bill Gates hat mit der Unterhaltungsindustrie starke Kombattanten im Rcken, denen es genauso wie ihm um die Profitmaximierung um jeden Preis geht - @@ -226,14 +226,14 @@ sie sich mit ihrer offensichtlich blinden Profitsucht einem Mann ausliefern, den andere als den gefhrlichsten Zeitgenossen seit Adolf Hitler betrachten.

- +

Es wird Zeit, da die Demokraten unter den EDV-Profis und -Anwendern endlich aus ihrem Dornrschenschlaf aufwachen, denn:

- +
Man darf nicht warten, bis aus dem Schneeball eine Lawine geworden ist. Man mu den rollenden Schneeball zertreten. Die Lawine hlt keiner mehr auf. Sie ruht erst, wenn sie alles unter sich begraben hat...
/Erich Kstner/
- + diff --git a/TouchXML/Externals/tidy/test/input/in_663548.html b/TouchXML/Externals/tidy/test/input/in_663548.html index f26332e..59992a5 100644 --- a/TouchXML/Externals/tidy/test/input/in_663548.html +++ b/TouchXML/Externals/tidy/test/input/in_663548.html @@ -1,21 +1,21 @@ - - + + [663548] Javascript and Tidy - missing code - - + } + } +} +// --> + +

foo diff --git a/TouchXML/Externals/tidy/test/input/in_676156.html b/TouchXML/Externals/tidy/test/input/in_676156.html index f822cb6..8ca226b 100644 --- a/TouchXML/Externals/tidy/test/input/in_676156.html +++ b/TouchXML/Externals/tidy/test/input/in_676156.html @@ -1,5 +1,5 @@ foo bar diff --git a/TouchXML/Externals/tidy/test/input/in_676205.html b/TouchXML/Externals/tidy/test/input/in_676205.html index 77b87b5..3199494 100644 --- a/TouchXML/Externals/tidy/test/input/in_676205.html +++ b/TouchXML/Externals/tidy/test/input/in_676205.html @@ -1,10 +1,10 @@ - - [676205] <img src="> crashes Tidy - - - + diff --git a/TouchXML/Externals/tidy/test/input/in_678268.html b/TouchXML/Externals/tidy/test/input/in_678268.html index 7436c74..ab7b14d 100644 --- a/TouchXML/Externals/tidy/test/input/in_678268.html +++ b/TouchXML/Externals/tidy/test/input/in_678268.html @@ -1,14 +1,14 @@ - + -Error: File Copy Error! File=C:\WinNT\ -System32\PERFLIB_PERFDATA_<#>.DAT (copying to a -'.fil'). - - -Error: File Copy Error! File=C:\WinNT\ -System32\PERFLIB_PERFDATA_ -<#>.DAT (copying to a '.fil'). -
id
- +Error: File Copy Error! File=C:\WinNT\ +System32\PERFLIB_PERFDATA_<#>.DAT (copying to a +'.fil'). + + +Error: File Copy Error! File=C:\WinNT\ +System32\PERFLIB_PERFDATA_ +<#>.DAT (copying to a '.fil'). +
id
+ diff --git a/TouchXML/Externals/tidy/test/input/in_688746.html b/TouchXML/Externals/tidy/test/input/in_688746.html index 8cb6d50..ae526e9 100644 --- a/TouchXML/Externals/tidy/test/input/in_688746.html +++ b/TouchXML/Externals/tidy/test/input/in_688746.html @@ -3,7 +3,7 @@ [ 688746 ] incorrect charset value for utf-8 - +

How to…
diff --git a/TouchXML/Externals/tidy/test/input/in_696799.html b/TouchXML/Externals/tidy/test/input/in_696799.html index b2d909b..dcea5c7 100644 --- a/TouchXML/Externals/tidy/test/input/in_696799.html +++ b/TouchXML/Externals/tidy/test/input/in_696799.html @@ -3,10 +3,10 @@ [ 696799 ] Crash: <script language=""> - + diff --git a/TouchXML/Externals/tidy/test/onetest.cmd b/TouchXML/Externals/tidy/test/onetest.cmd index 828f0e2..77924b1 100755 --- a/TouchXML/Externals/tidy/test/onetest.cmd +++ b/TouchXML/Externals/tidy/test/onetest.cmd @@ -35,7 +35,7 @@ if NOT exist %CFGFILE% set CFGFILE=input\cfg_default.txt REM Get specific input file name @set INFILE= -for %%F in ( %INFILES% ) do set INFILE=%%F +for %%F in ( %INFILES% ) do set INFILE=%%F @if "%INFILE%." == "." goto Err6 @if NOT EXIST %INFILE% goto Err7 diff --git a/TouchXML/Externals/tidy/test/testone.sh b/TouchXML/Externals/tidy/test/testone.sh index 8abb3b9..ac08ca8 100755 --- a/TouchXML/Externals/tidy/test/testone.sh +++ b/TouchXML/Externals/tidy/test/testone.sh @@ -70,7 +70,7 @@ STATUS=$? if [ $STATUS -ne $EXPECTED ] then - echo "== $TESTNO failed (Status received: $STATUS vs expected: $EXPECTED)" + echo "== $TESTNO failed (Status received: $STATUS vs expected: $EXPECTED)" cat $MSGFILE exit 1 fi diff --git a/TouchXML/NuTests/test_xml.nu b/TouchXML/NuTests/test_xml.nu index f17cd3f..277d04a 100644 --- a/TouchXML/NuTests/test_xml.nu +++ b/TouchXML/NuTests/test_xml.nu @@ -7,23 +7,23 @@ (assert_not_equal nil theXMLDocument) (assert_equal nil (theError value)) (assert_not_equal nil (theXMLDocument rootElement)) - + (assert_equal (theXMLDocument rootElement) (theXMLDocument rootElement)) (assert_equal "foo" ((theXMLDocument rootElement) name))) - + (- testBadXMLTest is (set theXMLDocument ((CXMLDocument alloc) initWithXMLString:"This is invalid XML." options:0 error:(set theError ((NuReference alloc) init)))) (assert_equal nil theXMLDocument) (assert_not_equal nil (theError value))) - + (- testNodeNavigation is (set theXML "") (set theXMLDocument ((CXMLDocument alloc) initWithXMLString:theXML options:0 error:(set theError ((NuReference alloc) init)))) (assert_not_equal nil theXMLDocument) (assert_equal 3 ((theXMLDocument rootElement) childCount)) - + (set theArray (theXMLDocument nodesForXPath:"/root/*" error:theError)) (assert_not_equal nil theArray) (assert_equal 3 (theArray count)) @@ -31,49 +31,49 @@ (do (theNode) (assert_equal (theNode index) (theArray indexOfObject:theNode)) (assert_equal 2 (theNode level)))) - + (assert_equal ((theXMLDocument rootElement) childAtIndex:0) (theArray 0)) (assert_equal ((theXMLDocument rootElement) childAtIndex:1) (theArray 1)) (assert_equal ((theXMLDocument rootElement) childAtIndex:2) (theArray 2)) - + (assert_equal "node_1" ((theArray 0) name)) (assert_equal "node_2" ((theArray 1) name)) (assert_equal "node_3" ((theArray 2) name)) - + (assert_equal (theArray 1) ((theArray 0) nextSibling)) (assert_equal (theArray 2) ((theArray 1) nextSibling)) (assert_equal nil ((theArray 2) nextSibling)) - + (assert_equal nil ((theArray 0) previousSibling)) (assert_equal (theArray 0) ((theArray 1) previousSibling)) (assert_equal (theArray 1) ((theArray 2) previousSibling))) - + (- testBasic is (set theData ("" dataUsingEncoding:NSUTF8StringEncoding)) (set theDocument ((CXMLDocument alloc) initWithData:theData options:0 error:(set theError ((NuReference alloc) init)))) - + (assert_equal nil ((theDocument rootElement) stringValue)) (assert_equal 1 (((theDocument rootElement) children) count)) (assert_equal (theDocument rootElement) ((((theDocument rootElement) children) 0) parent)) - + (assert_equal nil (theDocument parent)) - + (set nodes (theDocument nodesForXPath:"/outer/inner" error:nil)) (assert_equal 1 (nodes count)) (assert_equal "bar" (((nodes 0) attributeForName:"y") stringValue)) - + (set nodes (theDocument nodesForXPath:"/outer/inner/@y" error:nil)) (assert_equal 1 (nodes count)) (assert_equal "bar" ((nodes 0) stringValue)) - + (assert_equal "foo" (((theDocument rootElement) attributeForName:"x") stringValue)) (assert_equal "bar" (((((theDocument rootElement) elementsForName:"inner") 0) attributeForName:"y") stringValue))) - + (- testAttributes is (set theXML <<-END @@ -85,14 +85,14 @@ END) (set theXMLDocument ((CXMLDocument alloc) initWithXMLString:theXML options:0 error:(set theError ((NuReference alloc) init)))) (assert_not_equal nil theXMLDocument) - + (set theNodes ((theXMLDocument rootElement) elementsForName:"node_1")) (assert_equal 1 (theNodes count)) (set theElement (theNodes lastObject)) (assert_equal YES (theElement isKindOfClass:CXMLElement)) (assert_not_equal nil (theElement attributes)) (assert_equal 0 ((theElement attributes) count)) - + (set theNodes ((theXMLDocument rootElement) elementsForName:"node_2")) (assert_equal 1 (theNodes count)) (set theElement (theNodes lastObject)) @@ -101,7 +101,7 @@ END) (assert_equal 1 ((theElement attributes) count)) (assert_equal ((theElement attributes) 0) (theElement attributeForName:"attribute_1")) (assert_equal "value_1" ((theElement attributeForName:"attribute_1") stringValue)) - + (set theNodes ((theXMLDocument rootElement) elementsForName:"node_3")) (assert_equal 1 (theNodes count)) (set theElement (theNodes lastObject)) @@ -112,25 +112,25 @@ END) (assert_equal ((theElement attributes) 1) (theElement attributeForName:"attribute_2")) (assert_equal "value_1" ((theElement attributeForName:"attribute_1") stringValue)) (assert_equal "value_2" ((theElement attributeForName:"attribute_2") stringValue))) - + (- testRSS is (set theData (NSData dataWithContentsOfFile:"NuTests/ycombinator.rss")) (set theDocument ((CXMLDocument alloc) initWithData:theData options:0 error:(set theError ((NuReference alloc) init)))) (assert_equal "rss" ((theDocument rootElement) name)) - + (set titles (theDocument nodesForXPath:"/rss/channel/title" error:nil)) (assert_equal 1 (titles count)) (assert_equal "Hacker News" ((titles 0) stringValue)) - + (set links (theDocument nodesForXPath:"/rss/channel/link" error:nil)) (assert_equal 1 (links count)) (assert_equal "http://news.ycombinator.com/" ((links 0) stringValue)) - + (set items (theDocument nodesForXPath:"/rss/channel/item" error:nil)) (assert_equal 25 (items count)) - + (set item (items 5)) (assert_equal 4 ((item children) count)) ((item children) each: diff --git a/TouchXML/Nukefile b/TouchXML/Nukefile index 5959c1c..e652a82 100644 --- a/TouchXML/Nukefile +++ b/TouchXML/Nukefile @@ -1,6 +1,6 @@ ;; ;; Nukefile for TouchXML -;; +;; ;; Commands: ;; nuke - builds TouchXML as a framework ;; nuke test - runs the unit tests in the NuTests directory diff --git a/TouchXML/UnitTests/Source/BasicTests.m b/TouchXML/UnitTests/Source/BasicTests.m index 9ee443f..7c47c8b 100644 --- a/TouchXML/UnitTests/Source/BasicTests.m +++ b/TouchXML/UnitTests/Source/BasicTests.m @@ -70,7 +70,7 @@ - (void)test_nodeNavigation STAssertEquals([theNode index], [theArray indexOfObject:theNode], NULL); STAssertEquals((int)[theNode level], 2, NULL); } - + STAssertEquals([[theXMLDocument rootElement] childAtIndex:0], [theArray objectAtIndex:0], NULL); STAssertEquals([[theXMLDocument rootElement] childAtIndex:1], [theArray objectAtIndex:1], NULL); STAssertEquals([[theXMLDocument rootElement] childAtIndex:2], [theArray objectAtIndex:2], NULL); diff --git a/TouchXML/UnitTests/Source/XPath_Tests.m b/TouchXML/UnitTests/Source/XPath_Tests.m index ca0bdec..694817a 100644 --- a/TouchXML/UnitTests/Source/XPath_Tests.m +++ b/TouchXML/UnitTests/Source/XPath_Tests.m @@ -79,7 +79,7 @@ - (void)test_relative_paths { theNodes = [theElement nodesForXPath:@"./node" error:NULL]; STAssertTrue([theNodes count] == 1, NULL); - + } } diff --git a/kissxml/DDXMLDocument.m b/kissxml/DDXMLDocument.m index 3050651..624525e 100644 --- a/kissxml/DDXMLDocument.m +++ b/kissxml/DDXMLDocument.m @@ -18,7 +18,7 @@ + (void)initialize // Redirect error output to our own function (don't clog up the console) initGenericErrorDefaultFunc(NULL); xmlSetStructuredErrorFunc(NULL, MyErrorHandler); - + initialized = YES; } } @@ -35,14 +35,14 @@ - (id)initWithPrimitive:(xmlKindPtr)nodePtr [super dealloc]; return nil; } - + self = [super initWithPrimitive:nodePtr]; return self; } /** * Initializes and returns a DDXMLDocument object created from an NSData object. - * + * * Returns an initialized DDXMLDocument object, or nil if initialization fails * because of parsing errors or other reasons. **/ @@ -51,20 +51,20 @@ - (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)err if(data == nil || [data length] == 0) { if(error) *error = [NSError errorWithDomain:@"DDXMLErrorDomain" code:0 userInfo:nil]; - + [super dealloc]; return nil; } - + xmlDocPtr doc = xmlParseMemory([data bytes], [data length]); if(doc == NULL) { if(error) *error = [NSError errorWithDomain:@"DDXMLErrorDomain" code:1 userInfo:nil]; - + [super dealloc]; return nil; } - + return [self initWithPrimitive:(xmlKindPtr)doc]; } @@ -74,7 +74,7 @@ - (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)err - (DDXMLElement *)rootElement { xmlDocPtr docPtr = (xmlDocPtr)genericPtr; - + if(docPtr->children == NULL) return nil; else diff --git a/kissxml/DDXMLElement.m b/kissxml/DDXMLElement.m index 4caf40b..af58690 100644 --- a/kissxml/DDXMLElement.m +++ b/kissxml/DDXMLElement.m @@ -8,33 +8,33 @@ @implementation DDXMLElement - (id)initWithName:(NSString *)name { // Note: Make every guarantee that genericPtr is not null - + xmlNodePtr node = xmlNewNode(NULL, [name xmlChar]); - + return [self initWithPrimitive:(xmlKindPtr)node]; } - (id)initWithName:(NSString *)name URI:(NSString *)URI { // Note: Make every guarantee that genericPtr is not null - + xmlNodePtr node = xmlNewNode(NULL, [name xmlChar]); - + id result = [self initWithPrimitive:(xmlKindPtr)node]; [result setURI:URI]; - + return result; } - (id)initWithName:(NSString *)name stringValue:(NSString *)string { // Note: Make every guarantee that genericPtr is not null - + xmlNodePtr node = xmlNewNode(NULL, [name xmlChar]); - + id result = [self initWithPrimitive:(xmlKindPtr)node]; [result setStringValue:string]; - + return result; } @@ -50,7 +50,7 @@ - (id)initWithPrimitive:(xmlKindPtr)nodePtr [super dealloc]; return nil; } - + self = [super initWithPrimitive:nodePtr]; return self; } @@ -61,7 +61,7 @@ - (id)initWithPrimitive:(xmlKindPtr)nodePtr /** * Returns the child element nodes (as DDXMLElement objects) of the receiver that have a specified name. - * + * * If name is a qualified name, then this method invokes elementsForLocalName:URI: with the URI parameter set to * the URI associated with the prefix. Otherwise comparison is based on string equality of the qualified or * non-qualified name. @@ -69,12 +69,12 @@ - (id)initWithPrimitive:(xmlKindPtr)nodePtr - (NSArray *)elementsForName:(NSString *)name { if(name == nil) return [NSArray array]; - + // We need to check to see if name has a prefix. // If it does have a prefix, we need to figure out what the corresponding URI is for that prefix, // and then search for any elements that have the same name (including prefix) OR have the same URI. // Otherwise we loop through the children as usual and do a string compare on the name - + NSString *prefix = [[self class] prefixForName:name]; if([prefix length] > 0) { @@ -85,25 +85,25 @@ - (NSArray *)elementsForName:(NSString *)name NSString *uri = [NSString stringWithUTF8String:((const char *)ns->href)]; return [self elementsWithName:name uri:uri]; } - + // Note: We used xmlSearchNs instead of resolveNamespaceForName: - avoid creating wrapper objects when possible } - + return [self elementsWithName:name uri:nil]; } - (NSArray *)elementsForLocalName:(NSString *)localName URI:(NSString *)URI { if(localName == nil) return [NSArray array]; - + // We need to figure out what the prefix is for this URI. // Then we search for elements that are named prefix:localName OR (named localName AND have the given URI). - + NSString *prefix = [self resolvePrefixForNamespaceURI:URI]; if(prefix != nil) { NSString *name = [NSString stringWithFormat:@"%@:%@", prefix, localName]; - + return [self elementsWithName:name uri:URI]; } else @@ -121,14 +121,14 @@ - (NSArray *)elementsWithName:(NSString *)name uri:(NSString *)uri // Supplied: name, !uri : match: name // Supplied: p:name, uri : match: p:name || (name && uri) // Supplied: name, uri : match: name && uri - + NSMutableArray *result = [NSMutableArray array]; - + xmlNodePtr node = (xmlNodePtr)genericPtr; - + BOOL hasPrefix = [[[self class] prefixForName:name] length] > 0; NSString *localName = [[self class] localNameForName:name]; - + xmlNodePtr child = node->children; while(child != NULL) { @@ -143,31 +143,31 @@ - (NSArray *)elementsWithName:(NSString *)name uri:(NSString *)uri { BOOL nameMatch = xmlStrEqual(child->name, [name xmlChar]); BOOL localNameMatch = xmlStrEqual(child->name, [localName xmlChar]); - + BOOL uriMatch = NO; if(child->ns != NULL) { uriMatch = xmlStrEqual(child->ns->href, [uri xmlChar]); } - + if(hasPrefix) match = nameMatch || (localNameMatch && uriMatch); else match = nameMatch && uriMatch; } - + if(match) { DDXMLElement *childElement = [[DDXMLElement alloc] initWithPrimitive:(xmlKindPtr)child]; - + [result addObject:childElement]; [childElement release]; } } - + child = child->next; } - + return result; } @@ -180,14 +180,14 @@ - (void)addAttribute:(DDXMLNode *)attribute // NSXML version uses this same assertion DDCheck([attribute parent] == nil, @"Cannot add an attribute with a parent; detach or copy first"); DDCheck([attribute isXmlAttrPtr], @"Not an attribute"); - + // xmlNodePtr xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) // Add a new node to @parent, at the end of the child (or property) list merging // adjacent TEXT nodes (in which case @cur is freed). If the new node is ATTRIBUTE, it is added // into properties instead of children. If there is an attribute with equal name, it is first destroyed. - + [self removeAttributeForName:[attribute name]]; - + xmlAddChild((xmlNodePtr)genericPtr, (xmlNodePtr)attribute->genericPtr); } @@ -205,7 +205,7 @@ - (void)removeAttributeForName:(NSString *)name { // If we use xmlUnsetProp, then the attribute will be automatically freed. // We don't want this unless no other wrapper objects have a reference to the property. - + xmlAttrPtr attr = ((xmlNodePtr)genericPtr)->properties; while(attr != NULL) { @@ -221,18 +221,18 @@ - (void)removeAttributeForName:(NSString *)name - (NSArray *)attributes { NSMutableArray *result = [NSMutableArray array]; - + xmlAttrPtr attr = ((xmlNodePtr)genericPtr)->properties; while(attr != NULL) { DDXMLNode *attrNode = [[DDXMLNode alloc] initWithPrimitive:(xmlKindPtr)attr]; - + [result addObject:attrNode]; [attrNode release]; - + attr = attr->next; } - + return result; } @@ -257,7 +257,7 @@ - (DDXMLNode *)attributeForName:(NSString *)name - (void)setAttributes:(NSArray *)attributes { [self removeAllAttributes]; - + NSUInteger i; for(i = 0; i < [attributes count]; i++) { @@ -275,11 +275,11 @@ - (void)addNamespace:(DDXMLNode *)namespace // NSXML version uses this same assertion DDCheck([namespace parent] == nil, @"Cannot add a namespace with a parent; detach or copy first"); DDCheck([namespace isXmlNsPtr], @"Not a namespace"); - + // Beware: [namespace prefix] does NOT return what you might expect. Use [namespace name] instead. - + [self removeNamespaceForPrefix:[namespace name]]; - + xmlNsPtr currentNs = ((xmlNodePtr)genericPtr)->nsDef; if(currentNs == NULL) { @@ -297,10 +297,10 @@ - (void)addNamespace:(DDXMLNode *)namespace currentNs = currentNs->next; } } - + // The xmlNs structure doesn't contain a reference to the parent, so we manage our own reference namespace->nsParentPtr = (xmlNodePtr)genericPtr; - + // Did we just add a default namespace if([[namespace name] isEqualToString:@""]) { @@ -322,7 +322,7 @@ - (void)removeNamespaceForPrefix:(NSString *)name { // If name is nil or the empty string, the user is wishing to remove the default namespace const xmlChar *xmlName = [name length] > 0 ? [name xmlChar] : NULL; - + xmlNsPtr ns = ((xmlNodePtr)genericPtr)->nsDef; while(ns != NULL) { @@ -338,25 +338,25 @@ - (void)removeNamespaceForPrefix:(NSString *)name - (NSArray *)namespaces { NSMutableArray *result = [NSMutableArray array]; - + xmlNsPtr ns = ((xmlNodePtr)genericPtr)->nsDef; while(ns != NULL) { DDXMLNode *nsNode = [[DDXMLNode alloc] initWithPrimitive:(xmlKindPtr)ns nsParent:(xmlNodePtr)genericPtr]; - + [result addObject:nsNode]; [nsNode release]; - + ns = ns->next; } - + return result; } - (DDXMLNode *)namespaceForPrefix:(NSString *)prefix { // If the prefix is nil or the empty string, the user is requesting the default namespace - + if([prefix length] == 0) { // Requesting the default namespace @@ -378,14 +378,14 @@ - (DDXMLNode *)namespaceForPrefix:(NSString *)prefix ns = ns->next; } } - + return nil; } - (void)setNamespaces:(NSArray *)namespaces { [self removeAllNamespaces]; - + NSUInteger i; for(i = 0; i < [namespaces count]; i++) { @@ -400,7 +400,7 @@ - (void)setNamespaces:(NSArray *)namespaces + (DDXMLNode *)resolveNamespaceForPrefix:(NSString *)prefix atNode:(xmlNodePtr)nodePtr { if(nodePtr == NULL) return nil; - + xmlNsPtr ns = nodePtr->nsDef; while(ns != NULL) { @@ -410,7 +410,7 @@ + (DDXMLNode *)resolveNamespaceForPrefix:(NSString *)prefix atNode:(xmlNodePtr)n } ns = ns->next; } - + return [self resolveNamespaceForPrefix:prefix atNode:nodePtr->parent]; } @@ -425,18 +425,18 @@ - (DDXMLNode *)resolveNamespaceForName:(NSString *)name { return [[self class] resolveNamespaceForPrefix:nil atNode:(xmlNodePtr)genericPtr]; } - + NSString *prefix = [[self class] prefixForName:name]; - + if([prefix length] > 0) { // Unfortunately we can't use xmlSearchNs because it returns an xmlNsPtr. // This gives us mostly what we want, except we also need to know the nsParent. // So we do the recursive search ourselves. - + return [[self class] resolveNamespaceForPrefix:prefix atNode:(xmlNodePtr)genericPtr]; } - + return nil; } @@ -446,7 +446,7 @@ - (DDXMLNode *)resolveNamespaceForName:(NSString *)name + (NSString *)resolvePrefixForURI:(NSString *)uri atNode:(xmlNodePtr)nodePtr { if(nodePtr == NULL) return nil; - + xmlNsPtr ns = nodePtr->nsDef; while(ns != NULL) { @@ -459,7 +459,7 @@ + (NSString *)resolvePrefixForURI:(NSString *)uri atNode:(xmlNodePtr)nodePtr } ns = ns->next; } - + return [self resolvePrefixForURI:uri atNode:nodePtr->parent]; } @@ -471,7 +471,7 @@ - (NSString *)resolvePrefixForNamespaceURI:(NSString *)namespaceURI { // We can't use xmlSearchNsByHref because it will return xmlNsPtr's with NULL prefixes. // We're looking for a definitive prefix for the given URI. - + return [[self class] resolvePrefixForURI:namespaceURI atNode:(xmlNodePtr)genericPtr]; } @@ -492,7 +492,7 @@ - (void)removeAllChildren - (void)removeChildAtIndex:(NSUInteger)index { NSUInteger i = 0; - + xmlNodePtr child = ((xmlNodePtr)genericPtr)->children; while(child != NULL) { @@ -504,7 +504,7 @@ - (void)removeChildAtIndex:(NSUInteger)index [self removeChild:child]; return; } - + i++; } child = child->next; @@ -516,14 +516,14 @@ - (void)addChild:(DDXMLNode *)child // NSXML version uses these same assertions DDCheck([child parent] == nil, @"Cannot add a child that has a parent; detach or copy first"); DDCheck([child isXmlNodePtr], @"Elements can only have text, elements, processing instructions, and comments as children"); - + xmlAddChild((xmlNodePtr)genericPtr, (xmlNodePtr)child->genericPtr); } - (void)setChildren:(NSArray *)children { [self removeAllChildren]; - + NSUInteger i; for(i = 0; i < [children count]; i++) { diff --git a/kissxml/DDXMLElementAdditions.m b/kissxml/DDXMLElementAdditions.m index 1c00937..fc54d33 100644 --- a/kissxml/DDXMLElementAdditions.m +++ b/kissxml/DDXMLElementAdditions.m @@ -17,21 +17,21 @@ - (DDXMLElement *)elementForName:(NSString *)name { // There is a bug in the NSXMLElement elementsForName: method. // Consider the following XML fragment: - // + // // // // - // + // // Calling [query elementsForName:@"x"] results in an empty array! - // + // // However, it will work properly if you use the following: // [query elementsForLocalName:@"x" URI:@"some:other:namespace"] - // + // // The trouble with this is that we may not always know the xmlns in advance, // so in this particular case there is no way to access the element without looping through the children. - // + // // This bug was submitted to apple on June 1st, 2007 and was classified as "serious". - + return nil; } } @@ -43,7 +43,7 @@ - (DDXMLElement *)elementForName:(NSString *)name - (DDXMLElement *)elementForName:(NSString *)name xmlns:(NSString *)xmlns { NSLog(@"elementForName:%@ xmlns:%@", name, xmlns); - + NSArray *elements = [self elementsForLocalName:name URI:xmlns]; if([elements count] > 0) { @@ -80,12 +80,12 @@ - (NSDictionary *)attributesAsDictionary { NSArray *attributes = [self attributes]; NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity:[attributes count]]; - + int i; for(i = 0; i < [attributes count]; i++) { DDXMLNode *node = [attributes objectAtIndex:i]; - + [result setObject:[node stringValue] forKey:[node name]]; } return result; diff --git a/kissxml/DDXMLNode.h b/kissxml/DDXMLNode.h index bfd6c94..efaa245 100644 --- a/kissxml/DDXMLNode.h +++ b/kissxml/DDXMLNode.h @@ -33,7 +33,7 @@ enum { * All of these are pointers to structures, and all of those structures start with a pointer, and a type. * The xmlKind struct is used as a generic structure, and a stepping stone. * We use it to check the type of a structure, and then perform the appropriate cast. - * + * * For example: * if(genericPtr->type == XML_ATTRIBUTE_NODE) * { @@ -69,7 +69,7 @@ typedef struct _xmlStd *xmlStdPtr; { // Every DDXML object is simply a wrapper around an underlying libxml node xmlKindPtr genericPtr; - + // The xmlNsPtr type doesn't store a reference to it's parent // This is here to fix that problem, and make this class more compatible with the NSXML classes xmlNodePtr nsParentPtr; diff --git a/kissxml/DDXMLNode.m b/kissxml/DDXMLNode.m index 1e7d1f2..27ae976 100644 --- a/kissxml/DDXMLNode.m +++ b/kissxml/DDXMLNode.m @@ -22,7 +22,7 @@ + (id)elementWithName:(NSString *)name children:(NSArray *)children attributes:( DDXMLElement *result = [[[DDXMLElement alloc] initWithName:name] autorelease]; [result setChildren:children]; [result setAttributes:attributes]; - + return result; } @@ -34,17 +34,17 @@ + (id)elementWithName:(NSString *)name URI:(NSString *)URI + (id)attributeWithName:(NSString *)name stringValue:(NSString *)stringValue { xmlAttrPtr attr = xmlNewProp(NULL, [name xmlChar], [stringValue xmlChar]); - + return [DDXMLNode nodeWithPrimitive:(xmlKindPtr)attr]; } + (id)attributeWithName:(NSString *)name URI:(NSString *)URI stringValue:(NSString *)stringValue { xmlAttrPtr attr = xmlNewProp(NULL, [name xmlChar], [stringValue xmlChar]); - + DDXMLNode *result = [[[DDXMLNode alloc] initWithPrimitive:(xmlKindPtr)attr] autorelease]; [result setURI:URI]; - + return result; } @@ -52,30 +52,30 @@ + (id)namespaceWithName:(NSString *)name stringValue:(NSString *)stringValue { // If the user passes a nil or empty string name, they are trying to create a default namespace const xmlChar *xmlName = [name length] > 0 ? [name xmlChar] : NULL; - + xmlNsPtr ns = xmlNewNs(NULL, [stringValue xmlChar], xmlName); - + return [DDXMLNode nodeWithPrimitive:(xmlKindPtr)ns]; } + (id)processingInstructionWithName:(NSString *)name stringValue:(NSString *)stringValue { xmlNodePtr procInst = xmlNewPI([name xmlChar], [stringValue xmlChar]); - + return [DDXMLNode nodeWithPrimitive:(xmlKindPtr)procInst]; } + (id)commentWithStringValue:(NSString *)stringValue { xmlNodePtr comment = xmlNewComment([stringValue xmlChar]); - + return [DDXMLNode nodeWithPrimitive:(xmlKindPtr)comment]; } + (id)textWithStringValue:(NSString *)stringValue { xmlNodePtr text = xmlNewText([stringValue xmlChar]); - + return [DDXMLNode nodeWithPrimitive:(xmlKindPtr)text]; } @@ -95,7 +95,7 @@ - (id)initWithPrimitive:(xmlKindPtr)nodePtr [super dealloc]; return nil; } - + if(self = [super init]) { genericPtr = nodePtr; @@ -117,7 +117,7 @@ - (id)initWithPrimitive:(xmlKindPtr)nodePtr nsParent:(xmlNodePtr)parentPtr [super dealloc]; return nil; } - + if(self = [super init]) { genericPtr = nodePtr; @@ -155,7 +155,7 @@ - (void)setName:(NSString *)name if([self isXmlNsPtr]) { xmlNsPtr ns = (xmlNsPtr)genericPtr; - + xmlFree((xmlChar *)ns->prefix); ns->prefix = xmlStrdup([name xmlChar]); } @@ -187,14 +187,14 @@ - (void)setStringValue:(NSString *)string if([self isXmlNsPtr]) { xmlNsPtr ns = (xmlNsPtr)genericPtr; - + xmlFree((xmlChar *)ns->href); ns->href = xmlEncodeSpecialChars(NULL, [string xmlChar]); } else if([self isXmlAttrPtr]) { xmlAttrPtr attr = (xmlAttrPtr)genericPtr; - + if(attr->children != NULL) { xmlChar *escapedString = xmlEncodeSpecialChars(attr->doc, [string xmlChar]); @@ -210,11 +210,11 @@ - (void)setStringValue:(NSString *)string else if([self isXmlNodePtr]) { xmlStdPtr node = (xmlStdPtr)genericPtr; - + // Setting the content of a node erases any existing child nodes. // Therefore, we need to remove them properly first. [[self class] removeAllChildrenFromNode:(xmlNodePtr)node]; - + xmlChar *escapedString = xmlEncodeSpecialChars(node->doc, [string xmlChar]); xmlNodeSetContent((xmlNodePtr)node, escapedString); xmlFree(escapedString); @@ -223,7 +223,7 @@ - (void)setStringValue:(NSString *)string /** * Returns the content of the receiver as a string value. - * + * * If the receiver is a node object of element kind, the content is that of any text-node children. * This method recursively visits elements nodes and concatenates their text nodes in document order with * no intervening spaces. @@ -237,24 +237,24 @@ - (NSString *)stringValue else if([self isXmlAttrPtr]) { xmlAttrPtr attr = (xmlAttrPtr)genericPtr; - + if(attr->children != NULL) { return [NSString stringWithUTF8String:(const char *)attr->children->content]; } - + return nil; } else if([self isXmlNodePtr]) { xmlChar *content = xmlNodeGetContent((xmlNodePtr)genericPtr); - + NSString *result = [NSString stringWithUTF8String:(const char *)content]; - + xmlFree(content); return result; } - + return nil; } @@ -272,9 +272,9 @@ - (NSUInteger)index { // The xmlNsPtr has no prev pointer, so we have to search from the parent if(nsParentPtr == NULL) return 0; - + xmlNsPtr currentNs = nsParentPtr->nsDef; - + NSUInteger result = 0; while(currentNs != NULL) { @@ -287,16 +287,16 @@ - (NSUInteger)index } return 0; } - + xmlStdPtr currentNode = ((xmlStdPtr)genericPtr)->prev; - + NSUInteger result = 0; while(currentNode != NULL) { result++; currentNode = currentNode->prev; } - + return result; } @@ -311,14 +311,14 @@ - (NSUInteger)level currentNode = nsParentPtr; else currentNode = ((xmlStdPtr)genericPtr)->parent; - + NSUInteger result = 0; while(currentNode != NULL) { result++; currentNode = currentNode->parent; } - + return result; } @@ -334,7 +334,7 @@ - (DDXMLDocument *)rootDocument node = (xmlStdPtr)nsParentPtr; else node = (xmlStdPtr)genericPtr; - + if((node == NULL) || (node->doc == NULL)) return nil; else @@ -343,7 +343,7 @@ - (DDXMLDocument *)rootDocument /** * Returns the parent node of the receiver. - * + * * Document nodes and standalone nodes (that is, the root of a detached branch of a tree) have no parent, and * sending this message to them returns nil. A one-to-one relationship does not always exists between a parent and * its children; although a namespace or attribute node cannot be a child, it still has a parent element. @@ -358,9 +358,9 @@ - (DDXMLNode *)parent } return nil; } - + xmlStdPtr node = (xmlStdPtr)genericPtr; - + if(node->parent == NULL) return nil; else @@ -374,16 +374,16 @@ - (DDXMLNode *)parent - (NSUInteger)childCount { if(![self isXmlDocPtr] && ![self isXmlNodePtr] && ![self isXmlDtdPtr]) return 0; - + NSUInteger result = 0; - + xmlNodePtr child = ((xmlStdPtr)genericPtr)->children; while(child != NULL) { result++; child = child->next; } - + return result; } @@ -393,75 +393,75 @@ - (NSUInteger)childCount - (NSArray *)children { if(![self isXmlDocPtr] && ![self isXmlNodePtr] && ![self isXmlDtdPtr]) return nil; - + NSMutableArray *result = [NSMutableArray array]; - + xmlNodePtr child = ((xmlStdPtr)genericPtr)->children; while(child != NULL) { DDXMLNode *childNode = [[DDXMLNode alloc] initWithPrimitive:(xmlKindPtr)child]; - + [result addObject:childNode]; [childNode release]; - + child = child->next; } - + return [[result copy] autorelease]; } /** * Returns the child node of the receiver at the specified location. * Returns a DDXMLNode object or nil if the receiver has no children. - * + * * If the receive has children and index is out of bounds, an exception is raised. - * + * * The receiver should be a DDXMLNode object representing a document, element, or document type declaration. * The returned node object can represent an element, comment, text, or processing instruction. **/ - (DDXMLNode *)childAtIndex:(NSUInteger)index { if(![self isXmlDocPtr] && ![self isXmlNodePtr] && ![self isXmlDtdPtr]) return nil; - + NSUInteger i = 0; - + xmlNodePtr child = ((xmlStdPtr)genericPtr)->children; - + if(child == NULL) { // NSXML doesn't raise an exception if there are no children return nil; } - + while(child != NULL) { if(i == index) { return [DDXMLNode nodeWithPrimitive:(xmlKindPtr)child]; } - + i++; child = child->next; } - + // NSXML version uses this same assertion DDCheck(NO, @"index (%u) beyond bounds (%u)", (unsigned)index, (unsigned)i); - + return nil; } /** * Returns the previous DDXMLNode object that is a sibling node to the receiver. - * + * * This object will have an index value that is one less than the receiver’s. * If there are no more previous siblings (that is, other child nodes of the receiver’s parent) the method returns nil. **/ - (DDXMLNode *)previousSibling { if([self isXmlNsPtr]) return nil; - + xmlStdPtr node = (xmlStdPtr)genericPtr; - + if(node->prev == NULL) return nil; else @@ -470,7 +470,7 @@ - (DDXMLNode *)previousSibling /** * Returns the next DDXMLNode object that is a sibling node to the receiver. - * + * * This object will have an index value that is one more than the receiver’s. * If there are no more subsequent siblings (that is, other child nodes of the receiver’s parent) the * method returns nil. @@ -478,9 +478,9 @@ - (DDXMLNode *)previousSibling - (DDXMLNode *)nextSibling { if([self isXmlNsPtr]) return nil; - + xmlStdPtr node = (xmlStdPtr)genericPtr; - + if(node->next == NULL) return nil; else @@ -489,7 +489,7 @@ - (DDXMLNode *)nextSibling /** * Returns the previous DDXMLNode object in document order. - * + * * You use this method to “walk” backward through the tree structure representing an XML document or document section. * (Use nextNode to traverse the tree in the opposite direction.) Document order is the natural order that XML * constructs appear in markup text. If you send this message to the first node in the tree (that is, the root element), @@ -498,12 +498,12 @@ - (DDXMLNode *)nextSibling - (DDXMLNode *)previousNode { if([self isXmlNsPtr] || [self isXmlAttrPtr]) return nil; - + // If the node has a previous sibling, // then we need the last child of the last child of the last child etc - + // Note: Try to accomplish this task without creating dozens of intermediate wrapper objects - + xmlStdPtr previousSibling = ((xmlStdPtr)genericPtr)->prev; if(previousSibling != NULL) { @@ -514,7 +514,7 @@ - (DDXMLNode *)previousNode { lastChild = lastChild->last; } - + return [DDXMLNode nodeWithPrimitive:(xmlKindPtr)lastChild]; } else @@ -523,15 +523,15 @@ - (DDXMLNode *)previousNode return [DDXMLNode nodeWithPrimitive:(xmlKindPtr)previousSibling]; } } - + // If there are no previous siblings, then the previous node is simply the parent - + return [self parent]; } /** * Returns the next DDXMLNode object in document order. - * + * * You use this method to “walk” forward through the tree structure representing an XML document or document section. * (Use previousNode to traverse the tree in the opposite direction.) Document order is the natural order that XML * constructs appear in markup text. If you send this message to the last node in the tree, nil is returned. @@ -540,23 +540,23 @@ - (DDXMLNode *)previousNode - (DDXMLNode *)nextNode { if([self isXmlNsPtr] || [self isXmlAttrPtr]) return nil; - + // If the node has children, then next node is the first child DDXMLNode *firstChild = [self childAtIndex:0]; if(firstChild) return firstChild; - + // If the node has a next sibling, then next node is the same as next sibling - + DDXMLNode *nextSibling = [self nextSibling]; if(nextSibling) return nextSibling; - + // There are no children, and no more siblings, so we need to get the next sibling of the parent. // If that is nil, we need to get the next sibling of the grandparent, etc. - + // Note: Try to accomplish this task without creating dozens of intermediate wrapper objects - + xmlNodePtr parent = ((xmlStdPtr)genericPtr)->parent; while(parent != NULL) { @@ -566,7 +566,7 @@ - (DDXMLNode *)nextNode else parent = parent->parent; } - + return nil; } @@ -586,11 +586,11 @@ - (void)detach } return; } - + xmlStdPtr node = (xmlStdPtr)genericPtr; - + if(node->parent == NULL) return; - + if([self isXmlAttrPtr]) { [[self class] detachAttribute:(xmlAttrPtr)node fromNode:node->parent]; @@ -607,7 +607,7 @@ - (void)detach /** * Returns the local name of the receiver. - * + * * The local name is the part of a node name that follows a namespace-qualifying colon or the full name if * there is no colon. For example, “chapter” is the local name in the qualified name “acme:chapter”. **/ @@ -622,13 +622,13 @@ - (NSString *)localName else return @""; } - + return [[self class] localNameForName:[self name]]; } /** * Returns the prefix of the receiver’s name. - * + * * The prefix is the part of a namespace-qualified name that precedes the colon. * For example, “acme” is the local name in the qualified name “acme:chapter”. * This method returns an empty string if the receiver’s name is not qualified by a namespace. @@ -640,7 +640,7 @@ - (NSString *)prefix // Strangely enough, the localName of a namespace is the prefix, and the prefix is an empty string return @""; } - + return [[self class] prefixForName:[self name]]; } @@ -654,13 +654,13 @@ - (void)setURI:(NSString *)URI { // Note: xmlAttrPtr and xmlNodePtr both have the same ns pointer, so // in this case it's safe to cast a xmlAttrPtr to a xmlNodePtr. - + xmlNodePtr node = (xmlNodePtr)genericPtr; if(node->ns != NULL) { [[self class] removeNamespace:node->ns fromNode:node]; } - + if(URI) { // Create a new xmlNsPtr, add it to the nsDef list, and make ns point to it @@ -674,7 +674,7 @@ - (void)setURI:(NSString *)URI /** * Returns the URI associated with the receiver. - * + * * A node’s URI is derived from its namespace or a document’s URI; for documents, the URI comes either from the * parsed XML or is explicitly set. You cannot change the URI for a particular node other for than a namespace * or document node. @@ -697,13 +697,13 @@ - (NSString *)URI return [NSString stringWithUTF8String:((const char *)node->ns->href)]; } } - + return nil; } /** * Returns the local name from the specified qualified name. - * + * * Examples: * "a:node" -> "node" * "a:a:node" -> "a:node" @@ -715,7 +715,7 @@ + (NSString *)localNameForName:(NSString *)name if(name) { NSRange range = [name rangeOfString:@":"]; - + if(range.length != 0) return [name substringFromIndex:(range.location + range.length)]; else @@ -727,7 +727,7 @@ + (NSString *)localNameForName:(NSString *)name /** * Extracts the prefix from the given name. * If name is nil, or has no prefix, an empty string is returned. - * + * * Examples: * "a:deusty.com" -> "a" * "a:a:deusty.com" -> "a" @@ -739,7 +739,7 @@ + (NSString *)prefixForName:(NSString *)name if(name) { NSRange range = [name rangeOfString:@":"]; - + if(range.length != 0) { return [name substringToIndex:range.location]; @@ -770,40 +770,40 @@ - (NSString *)XMLStringWithOptions:(NSUInteger)options // as but . those two forms are undistinguishable // once parsed. // Disabled by default - + if(options & DDXMLNodeCompactEmptyElement) xmlSaveNoEmptyTags = 0; else xmlSaveNoEmptyTags = 1; - + int format = 0; if(options & DDXMLNodePrettyPrint) { format = 1; xmlIndentTreeOutput = 1; } - + xmlBufferPtr bufferPtr = xmlBufferCreate(); if([self isXmlNsPtr]) xmlNodeDump(bufferPtr, NULL, (xmlNodePtr)genericPtr, 0, format); else xmlNodeDump(bufferPtr, ((xmlStdPtr)genericPtr)->doc, (xmlNodePtr)genericPtr, 0, format); - + if([self kind] == DDXMLTextKind) { NSString *result = [NSString stringWithUTF8String:(const char *)bufferPtr->content]; - + xmlBufferFree(bufferPtr); - + return result; } else { NSMutableString *result = [NSMutableString stringWithUTF8String:(const char *)bufferPtr->content]; CFStringTrimWhitespace((CFMutableStringRef)result); - + xmlBufferFree(bufferPtr); - + return result; } } @@ -837,8 +837,8 @@ + (BOOL)isXmlNodePtr:(xmlKindPtr)kindPtr switch(type) { case XML_ELEMENT_NODE : - case XML_PI_NODE : - case XML_COMMENT_NODE : + case XML_PI_NODE : + case XML_COMMENT_NODE : case XML_TEXT_NODE : return YES; default : return NO; } @@ -903,23 +903,23 @@ - (BOOL)isXmlNsPtr /** * - - - - - - - - - - R E A D M E - - - - - - - - - - - * + * * The memory management of these wrapper classes is straight-forward, but requires explanation. * To understand the problem, consider the following situation: - * + * * * * * * - * + * * Imagine the user has retained two DDXMLElements - one for root, and one for level2. * Then they release the root element, but they want to hold onto the level2 element. * We need to release root, and level1, but keep level2 intact until the user is done with it. * Note that this is also how the NSXML classes work. * The user will no longer be able to traverse up the tree from level2, but will be able to access all the normal * information in level2, as well as any children, if there was any. - * + * * So the first question is, how do we know if a libxml node is being referenced by a cocoa wrapper? * In order to accomplish this, we take advantage of the node's _private variable. * If the private variable is NULL, then the node isn't being directly referenced by any cocoa wrapper objects. @@ -928,21 +928,21 @@ - (BOOL)isXmlNsPtr * and a pointer to the next xmlRetain structure. So it's a linked list of the cocoa wrapper objects. * When a cocoa wrapper object is created, it adds itself to the retain list (via nodeRetain), and when it's * dealloced it removes itself from the retain list (via nodeRelease). - * + * * With this structure in place, then given any libxml node, we can easily determine if it's still needed, * or if we can free it: * Are there any cocoa wrapper objects still directly referring to the node? * If so, we can't free the node. * Otherwise, does the node still have a parent? * If so, then the node is still part of a heirarchy, and we can't free the node. - * + * * To fully understand the parent restriction, consider the following scenario: * Imagine the user extracts the level1 DDXMLElement from the root. * The user reads the data, and the level1 DDXMLElement is autoreleased. The root is still retained. * When the level1 DDXMLElement is dealloced, nodeRelease will be called, and the retain list will become empty. * Can we free the level1 node at this point? * Of course not, because it's still within the root heirarchy, and the user is still using the root element. - * + * * The following should be spelled out: * If you call xmlFreeNode, this method will free all linked attributes and children. * So you can't blindly call this method, because you can't free nodes that are still being referenced. @@ -957,7 +957,7 @@ + (void)stripDocPointersFromAttr:(xmlAttrPtr)attr child->doc = NULL; child = child->next; } - + attr->doc = NULL; } @@ -969,14 +969,14 @@ + (void)recursiveStripDocPointersFromNode:(xmlNodePtr)node [self stripDocPointersFromAttr:attr]; attr = attr->next; } - + xmlNodePtr child = node->children; while(child != NULL) { [self recursiveStripDocPointersFromNode:child]; child = child->next; } - + node->doc = NULL; } @@ -987,13 +987,13 @@ + (void)recursiveStripDocPointersFromNode:(xmlNodePtr)node + (void)nodeFree:(xmlNodePtr)node { NSAssert([self isXmlNodePtr:(xmlKindPtr)node], @"Wrong kind of node passed to nodeFree"); - + if(node->_private == NULL) { [self removeAllAttributesFromNode:node]; [self removeAllNamespacesFromNode:node]; [self removeAllChildrenFromNode:node]; - + xmlFreeNode(node); } else @@ -1037,7 +1037,7 @@ + (void)detachAttribute:(xmlAttrPtr)attr fromNode:(xmlNodePtr)node attr->next->prev = attr->prev; } } - + // Nullify pointers attr->parent = NULL; attr->prev = NULL; @@ -1054,7 +1054,7 @@ + (void)detachAttribute:(xmlAttrPtr)attr fromNode:(xmlNodePtr)node + (void)removeAttribute:(xmlAttrPtr)attr fromNode:(xmlNodePtr)node { [self detachAttribute:attr fromNode:node]; - + // Free the attr if it's no longer in use if(attr->_private == NULL) { @@ -1070,11 +1070,11 @@ + (void)removeAttribute:(xmlAttrPtr)attr fromNode:(xmlNodePtr)node + (void)removeAllAttributesFromNode:(xmlNodePtr)node { xmlAttrPtr attr = node->properties; - + while(attr != NULL) { xmlAttrPtr nextAttr = attr->next; - + // Free the attr if it's no longer in use if(attr->_private == NULL) { @@ -1087,10 +1087,10 @@ + (void)removeAllAttributesFromNode:(xmlNodePtr)node attr->next = NULL; if(attr->doc != NULL) [self stripDocPointersFromAttr:attr]; } - + attr = nextAttr; } - + node->properties = NULL; } @@ -1112,29 +1112,29 @@ + (void)detachNamespace:(xmlNsPtr)ns fromNode:(xmlNodePtr)node node->nsDef = currentNs->next; else previousNs->next = currentNs->next; - + break; } - + previousNs = currentNs; currentNs = currentNs->next; } - + // Nullify pointers ns->next = NULL; - + if(node->ns == ns) { node->ns = NULL; } - + // We also have to nullify the nsParentPtr's, which are in the cocoa wrapper objects xmlRetainPtr retainPtr = (xmlRetainPtr)ns->_private; while(retainPtr != NULL) { DDXMLNode *node = (DDXMLNode *)retainPtr->retainee; node->nsParentPtr = NULL; - + retainPtr = retainPtr->next; } } @@ -1148,7 +1148,7 @@ + (void)detachNamespace:(xmlNsPtr)ns fromNode:(xmlNodePtr)node + (void)removeNamespace:(xmlNsPtr)ns fromNode:(xmlNodePtr)node { [self detachNamespace:ns fromNode:node]; - + // Free the ns if it's no longer in use if(ns->_private == NULL) { @@ -1164,21 +1164,21 @@ + (void)removeNamespace:(xmlNsPtr)ns fromNode:(xmlNodePtr)node + (void)removeAllNamespacesFromNode:(xmlNodePtr)node { xmlNsPtr ns = node->nsDef; - + while(ns != NULL) { xmlNsPtr nextNs = ns->next; - + // We manage the nsParent pointers, which are in the cocoa wrapper objects, so we have to nullify them ourself xmlRetainPtr retainPtr = (xmlRetainPtr)ns->_private; while(retainPtr != NULL) { DDXMLNode *node = (DDXMLNode *)retainPtr->next; node->nsParentPtr = NULL; - + retainPtr = retainPtr->next; } - + // Free the ns if it's no longer in use if(ns->_private == NULL) { @@ -1188,10 +1188,10 @@ + (void)removeAllNamespacesFromNode:(xmlNodePtr)node { ns->next = NULL; } - + ns = nextNs; } - + node->nsDef = NULL; node->ns = NULL; } @@ -1230,7 +1230,7 @@ + (void)detachChild:(xmlNodePtr)child fromNode:(xmlNodePtr)node andNullifyPointe child->next->prev = child->prev; } } - + if(flag) { // Nullify pointers @@ -1256,7 +1256,7 @@ + (void)detachChild:(xmlNodePtr)child fromNode:(xmlNodePtr)node * The child's surrounding prev/next pointers are properly updated to remove the child from the node's children list. * Then the child is recursively freed if it's no longer being referenced. * Otherwise, it's parent, prev, next and doc pointers are destroyed. - * + * * During the recursive free, subnodes still being referenced are properly handled. **/ + (void)removeChild:(xmlNodePtr)child fromNode:(xmlNodePtr)node @@ -1267,7 +1267,7 @@ + (void)removeChild:(xmlNodePtr)child fromNode:(xmlNodePtr)node // Then, when we call nodeFree:, it will again traverse the entire tree, freeing all the nodes. // To avoid this double traversal, we skip the nullification step in the detach method, and let nodeFree do it. [self detachChild:child fromNode:node andNullifyPointers:NO]; - + // Free the child recursively if it's no longer in use [self nodeFree:child]; } @@ -1276,23 +1276,23 @@ + (void)removeChild:(xmlNodePtr)child fromNode:(xmlNodePtr)node * Removes all children from the given node. * All children are either recursively freed, or their parent, prev, next and doc pointers are properly destroyed. * Upon return, the given node's children pointer is NULL. - * + * * During the recursive free, subnodes still being referenced are properly handled. **/ + (void)removeAllChildrenFromNode:(xmlNodePtr)node { xmlNodePtr child = node->children; - + while(child != NULL) { xmlNodePtr nextChild = child->next; - + // Free the child recursively if it's no longer in use [self nodeFree:child]; - + child = nextChild; } - + node->children = NULL; node->last = NULL; } @@ -1313,17 +1313,17 @@ + (void)removeRootElementFromDoc:(xmlDocPtr)doc - (void)nodeRetain { // Warning: The _private variable is in a different location in the xmlNsPtr - + xmlRetainPtr first; if([self isXmlNsPtr]) first = (xmlRetainPtr)((xmlNsPtr)genericPtr)->_private; else first = (xmlRetainPtr)((xmlStdPtr)genericPtr)->_private; - + xmlRetainPtr myPtr = malloc(sizeof(struct _xmlRetain)); myPtr->retainee = self; myPtr->next = first; - + if([self isXmlNsPtr]) ((xmlNsPtr)genericPtr)->_private = myPtr; else @@ -1339,24 +1339,24 @@ - (void)nodeRetain - (void)nodeRelease { // Warning: The _private variable is in a different location in the xmlNsPtr - + void **privatePtrPtr; if([self isXmlNsPtr]) privatePtrPtr = &(((xmlNsPtr)genericPtr)->_private); else privatePtrPtr = &(((xmlStdPtr)genericPtr)->_private); - + xmlRetainPtr previousRetainPtr = NULL; xmlRetainPtr currentRetainPtr = (xmlRetainPtr)(*privatePtrPtr); - + // WTF is going on here? - // + // // We've created a pointer to a pointer. // The variable privatePtrPtr points to the "void * _private" variable. // This way, to update the private variable, we can simply dereference the privatePtrPtr. - // + // // void **privatePtrPtr -> void * _private -> struct _xmlRetain - + while(currentRetainPtr != NULL) { if(currentRetainPtr->retainee == self) @@ -1369,22 +1369,22 @@ - (void)nodeRelease { previousRetainPtr->next = currentRetainPtr->next; } - + free(currentRetainPtr); break; } - + previousRetainPtr = currentRetainPtr; currentRetainPtr = currentRetainPtr->next; } - + // Now check to see if the node can be released // Did you read the giant readme comment section above? - + if([self isXmlNsPtr]) { xmlNsPtr ns = (xmlNsPtr)genericPtr; - + if(ns->_private == NULL) { if(nsParentPtr == NULL) @@ -1404,7 +1404,7 @@ - (void)nodeRelease else { xmlStdPtr node = (xmlStdPtr)genericPtr; - + if(node->_private == NULL) { if(node->parent == NULL) diff --git a/kissxml/DDXMLTesting.m b/kissxml/DDXMLTesting.m index 9a135c2..23ffe16 100644 --- a/kissxml/DDXMLTesting.m +++ b/kissxml/DDXMLTesting.m @@ -26,7 +26,7 @@ @implementation DDXMLTesting + (void)performTests { [self setUp]; - + [self testLocalName]; [self testPrefixName]; [self testDoubleAdd]; @@ -59,120 +59,120 @@ + (void)tearDown + (void)testLocalName { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + NSString *nsTest1 = [NSXMLNode localNameForName:@"a:quack"]; NSString *ddTest1 = [DDXMLNode localNameForName:@"a:quack"]; - + NSAssert([nsTest1 isEqualToString:ddTest1], @"Failed test 1"); - + NSString *nsTest2 = [NSXMLNode localNameForName:@"a:a:quack"]; NSString *ddTest2 = [DDXMLNode localNameForName:@"a:a:quack"]; - + NSAssert([nsTest2 isEqualToString:ddTest2], @"Failed test 2"); - + NSString *nsTest3 = [NSXMLNode localNameForName:@"quack"]; NSString *ddTest3 = [DDXMLNode localNameForName:@"quack"]; - + NSAssert([nsTest3 isEqualToString:ddTest3], @"Failed test 3"); - + NSString *nsTest4 = [NSXMLNode localNameForName:@"a:"]; NSString *ddTest4 = [DDXMLNode localNameForName:@"a:"]; - + NSAssert([nsTest4 isEqualToString:ddTest4], @"Failed test 4"); - + NSString *nsTest5 = [NSXMLNode localNameForName:nil]; NSString *ddTest5 = [DDXMLNode localNameForName:nil]; - + NSAssert(!nsTest5 && !ddTest5, @"Failed test 5"); - + NSXMLNode *nsNode = [NSXMLNode namespaceWithName:@"tucker" stringValue:@"dog"]; DDXMLNode *ddNode = [DDXMLNode namespaceWithName:@"tucker" stringValue:@"dog"]; - + NSString *nsTest6 = [nsNode localName]; NSString *ddTest6 = [ddNode localName]; - + NSAssert([nsTest6 isEqualToString:ddTest6], @"Failed test 6"); } + (void)testPrefixName { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + NSString *nsTest1 = [NSXMLNode prefixForName:@"a:quack"]; NSString *ddTest1 = [DDXMLNode prefixForName:@"a:quack"]; - + NSAssert([nsTest1 isEqualToString:ddTest1], @"Failed test 1"); - + NSString *nsTest2 = [NSXMLNode prefixForName:@"a:a:quack"]; NSString *ddTest2 = [DDXMLNode prefixForName:@"a:a:quack"]; - + NSAssert([nsTest2 isEqualToString:ddTest2], @"Failed test 2"); - + NSString *nsTest3 = [NSXMLNode prefixForName:@"quack"]; NSString *ddTest3 = [DDXMLNode prefixForName:@"quack"]; - + NSAssert([nsTest3 isEqualToString:ddTest3], @"Failed test 3"); - + NSString *nsTest4 = [NSXMLNode prefixForName:@"a:"]; NSString *ddTest4 = [DDXMLNode prefixForName:@"a:"]; - + NSAssert([nsTest4 isEqualToString:ddTest4], @"Failed test 4"); - + NSString *nsTest5 = [NSXMLNode prefixForName:nil]; NSString *ddTest5 = [DDXMLNode prefixForName:nil]; - + NSAssert([nsTest5 isEqualToString:ddTest5], @"Failed test 5"); - + NSXMLNode *nsNode = [NSXMLNode namespaceWithName:@"tucker" stringValue:@"dog"]; DDXMLNode *ddNode = [DDXMLNode namespaceWithName:@"tucker" stringValue:@"dog"]; - + NSString *nsTest6 = [nsNode prefix]; NSString *ddTest6 = [ddNode prefix]; - + NSAssert([nsTest6 isEqualToString:ddTest6], @"Failed test 6"); } + (void)testDoubleAdd { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + // NSXMLElement *nsRoot1 = [NSXMLElement elementWithName:@"root1"]; // NSXMLElement *nsRoot2 = [NSXMLElement elementWithName:@"root2"]; - + // NSXMLElement *nsNode = [NSXMLElement elementWithName:@"node"]; // NSXMLNode *nsAttr = [NSXMLNode attributeWithName:@"key" stringValue:@"value"]; // NSXMLNode *nsNs = [NSXMLNode namespaceWithName:@"a" stringValue:@"domain.com"]; - + // [nsRoot1 addChild:nsAttr]; // Elements can only have text, elements, processing instructions, and comments as children // [nsRoot1 addAttribute:nsNode]; // Not an attribute // [nsRoot1 addNamespace:nsNode]; // Not a namespace - + // [nsRoot1 addChild:nsNode]; // [nsRoot2 addChild:nsNode]; // Cannot add a child that has a parent; detach or copy first - + // [nsRoot1 addAttribute:nsAttr]; // [nsRoot2 addAttribute:nsAttr]; // Cannot add an attribute with a parent; detach or copy first - + // [nsRoot1 addNamespace:nsNs]; // [nsRoot2 addNamespace:nsNs]; // Cannot add a namespace with a parent; detach or copy first - + // DDXMLElement *ddRoot1 = [DDXMLElement elementWithName:@"root1"]; // DDXMLElement *ddRoot2 = [DDXMLElement elementWithName:@"root2"]; - + // DDXMLElement *ddNode = [DDXMLElement elementWithName:@"node"]; // DDXMLNode *ddAttr = [DDXMLNode attributeWithName:@"key" stringValue:@"value"]; // DDXMLNode *ddNs = [DDXMLNode namespaceWithName:@"a" stringValue:@"domain.com"]; - + // [ddRoot1 addChild:ddAttr]; // Elements can only have text, elements, processing instructions, and comments as children // [ddRoot1 addAttribute:ddNode]; // Not an attribute // [ddRoot1 addNamespace:ddNode]; // Not a namespace - + // [ddRoot1 addChild:ddNode]; // [ddRoot2 addChild:ddNode]; // Cannot add a child that has a parent; detach or copy first - + // [ddRoot1 addAttribute:ddAttr]; // [ddRoot2 addAttribute:ddAttr]; // Cannot add an attribute with a parent; detach or copy first - + // [ddRoot1 addNamespace:ddNs]; // [ddRoot2 addNamespace:ddNs]; // Cannot add a namespace with a parent; detach or copy first } @@ -180,40 +180,40 @@ + (void)testDoubleAdd + (void)testNsGeneral { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + NSXMLNode *nsNs = [NSXMLNode namespaceWithName:@"a" stringValue:@"deusty.com"]; DDXMLNode *ddNs = [DDXMLNode namespaceWithName:@"a" stringValue:@"deusty.com"]; - + NSString *nsTest1 = [nsNs XMLString]; NSString *ddTest1 = [ddNs XMLString]; - + NSAssert([nsTest1 isEqualToString:ddTest1], @"Failed test 1"); - + [nsNs setName:@"b"]; [ddNs setName:@"b"]; - + NSString *nsTest2 = [nsNs XMLString]; NSString *ddTest2 = [ddNs XMLString]; - + NSAssert([nsTest2 isEqualToString:ddTest2], @"Failed test 2"); - + [nsNs setStringValue:@"robbiehanson.com"]; [ddNs setStringValue:@"robbiehanson.com"]; - + NSString *nsTest3 = [nsNs XMLString]; NSString *ddTest3 = [ddNs XMLString]; - + NSAssert([nsTest3 isEqualToString:ddTest3], @"Failed test 3"); } + (void)testNsLevel { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + // // // - + NSXMLElement *nsRoot = [NSXMLElement elementWithName:@"root"]; NSXMLElement *nsNode = [NSXMLElement elementWithName:@"node"]; NSXMLNode *nsNs0 = [NSXMLNode namespaceWithName:@"a" stringValue:@"apple.com"]; @@ -223,7 +223,7 @@ + (void)testNsLevel [nsNode addNamespace:nsNs2]; [nsRoot addNamespace:nsNs0]; [nsRoot addChild:nsNode]; - + DDXMLElement *ddRoot = [DDXMLElement elementWithName:@"root"]; DDXMLElement *ddNode = [DDXMLElement elementWithName:@"node"]; DDXMLNode *ddNs0 = [DDXMLNode namespaceWithName:@"a" stringValue:@"apple.com"]; @@ -233,11 +233,11 @@ + (void)testNsLevel [ddNode addNamespace:ddNs2]; [ddRoot addNamespace:ddNs0]; [ddRoot addChild:ddNode]; - + NSAssert([nsNs0 index] == [ddNs0 index], @"Failed test 1"); NSAssert([nsNs1 index] == [ddNs1 index], @"Failed test 2"); NSAssert([nsNs2 index] == [ddNs2 index], @"Failed test 3"); - + NSAssert([nsNs0 level] == [ddNs0 level], @"Failed test 4"); NSAssert([nsNs1 level] == [ddNs1 level], @"Failed test 5"); NSAssert([nsNs2 level] == [ddNs2 level], @"Failed test 6"); @@ -246,140 +246,140 @@ + (void)testNsLevel + (void)testNsURI { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + NSXMLElement *nsNode = [NSXMLElement elementWithName:@"duck" URI:@"quack.com"]; DDXMLElement *ddNode = [DDXMLElement elementWithName:@"duck" URI:@"quack.com"]; - + NSString *nsTest1 = [nsNode URI]; NSString *ddTest1 = [ddNode URI]; - + NSAssert([nsTest1 isEqualToString:ddTest1], @"Failed test 1"); - + NSXMLElement *nsAttr = [NSXMLElement attributeWithName:@"duck" URI:@"quack.com" stringValue:@"quack"]; DDXMLElement *ddAttr = [DDXMLElement attributeWithName:@"duck" URI:@"quack.com" stringValue:@"quack"]; - + NSString *nsTest2 = [nsAttr URI]; NSString *ddTest2 = [ddAttr URI]; - + NSAssert([nsTest2 isEqualToString:ddTest2], @"Failed test 2"); } + (void)testAttrGeneral { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + NSXMLNode *nsAttr = [NSXMLNode attributeWithName:@"apple" stringValue:@"inc"]; DDXMLNode *ddAttr = [DDXMLNode attributeWithName:@"apple" stringValue:@"inc"]; - + NSString *nsStr1 = [nsAttr XMLString]; NSString *ddStr1 = [ddAttr XMLString]; - + NSAssert([nsStr1 isEqualToString:ddStr1], @"Failed test 1"); - + [nsAttr setName:@"deusty"]; [ddAttr setName:@"deusty"]; - + NSString *nsStr2 = [nsAttr XMLString]; NSString *ddStr2 = [ddAttr XMLString]; - + NSAssert([nsStr2 isEqualToString:ddStr2], @"Failed test 2"); - + [nsAttr setStringValue:@"designs"]; [ddAttr setStringValue:@"designs"]; - + NSString *nsStr3 = [nsAttr XMLString]; NSString *ddStr3 = [ddAttr XMLString]; - + NSAssert([nsStr3 isEqualToString:ddStr3], @"Failed test 3"); } + (void)testAttrSiblings { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + // - + NSXMLElement *nsNode = [NSXMLElement elementWithName:@"duck"]; [nsNode addAttribute:[NSXMLNode attributeWithName:@"sound" stringValue:@"quack"]]; [nsNode addAttribute:[NSXMLNode attributeWithName:@"swims" stringValue:@"YES"]]; [nsNode addAttribute:[NSXMLNode attributeWithName:@"flys" stringValue:@"YES"]]; - + DDXMLElement *ddNode = [DDXMLElement elementWithName:@"duck"]; [ddNode addAttribute:[DDXMLNode attributeWithName:@"sound" stringValue:@"quack"]]; [ddNode addAttribute:[DDXMLNode attributeWithName:@"swims" stringValue:@"YES"]]; [ddNode addAttribute:[DDXMLNode attributeWithName:@"flys" stringValue:@"YES"]]; - + NSXMLNode *nsAttr = [nsNode attributeForName:@"swims"]; DDXMLNode *ddAttr = [ddNode attributeForName:@"swims"]; - + NSString *nsTest1 = [nsAttr XMLString]; NSString *ddTest1 = [ddAttr XMLString]; - + NSAssert([nsTest1 isEqualToString:ddTest1], @"Failed test 1"); - + // NSLog(@"nsAttr prev: %@", [[nsAttr previousSibling] XMLString]); // NSLog(@"nsAttr next: %@", [[nsAttr nextSibling] XMLString]); -// +// // NSLog(@"ddAttr prev: %@", [[ddAttr previousSibling] XMLString]); // NSLog(@"ddAttr next: %@", [[ddAttr nextSibling] XMLString]); -// +// // Analysis: Ours works and theirs doesn't. I see no need to cripple ours because of that. } + (void)testAttrDocOrder { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + // - + NSXMLElement *nsNode = [NSXMLElement elementWithName:@"duck"]; [nsNode addAttribute:[NSXMLNode attributeWithName:@"sound" stringValue:@"quack"]]; [nsNode addAttribute:[NSXMLNode attributeWithName:@"swims" stringValue:@"YES"]]; [nsNode addAttribute:[NSXMLNode attributeWithName:@"flys" stringValue:@"YES"]]; - + DDXMLElement *ddNode = [DDXMLElement elementWithName:@"duck"]; [ddNode addAttribute:[DDXMLNode attributeWithName:@"sound" stringValue:@"quack"]]; [ddNode addAttribute:[DDXMLNode attributeWithName:@"swims" stringValue:@"YES"]]; [ddNode addAttribute:[DDXMLNode attributeWithName:@"flys" stringValue:@"YES"]]; - + NSXMLNode *nsAttr = [nsNode attributeForName:@"swims"]; DDXMLNode *ddAttr = [ddNode attributeForName:@"swims"]; - + NSXMLNode *nsTest1 = [nsAttr previousNode]; DDXMLNode *ddTest1 = [ddAttr previousNode]; - + NSAssert((!nsTest1 && !ddTest1), @"Failed test 1"); - + NSXMLNode *nsTest2 = [nsAttr nextNode]; DDXMLNode *ddTest2 = [ddAttr nextNode]; - + NSAssert((!nsTest2 && !ddTest2), @"Failed test 2"); - + // Notes: Attributes play no part in the document order. } + (void)testAttrChildren { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + NSXMLNode *nsAttr1 = [NSXMLNode attributeWithName:@"deusty" stringValue:@"designs"]; DDXMLNode *ddAttr1 = [DDXMLNode attributeWithName:@"deusty" stringValue:@"designs"]; - + NSXMLNode *nsTest1 = [nsAttr1 childAtIndex:0]; DDXMLNode *ddTest1 = [ddAttr1 childAtIndex:0]; - + NSAssert((!nsTest1 && !ddTest1), @"Failed test 1"); - + NSUInteger nsTest2 = [nsAttr1 childCount]; NSUInteger ddTest2 = [ddAttr1 childCount]; - + NSAssert((nsTest2 == ddTest2), @"Failed test 2"); - + NSArray *nsTest3 = [nsAttr1 children]; NSArray *ddTest3 = [ddAttr1 children]; - + NSAssert((!nsTest3 && !ddTest3), @"Failed test 3"); - + // Notes: Attributes aren't supposed to have children, although in libxml they technically do. // The child is simply a pointer to a text node, which contains the attribute value. } @@ -387,7 +387,7 @@ + (void)testAttrChildren + (void)testString { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + // // // @@ -401,7 +401,7 @@ + (void)testString // // // - + NSXMLElement *nsNode0 = [NSXMLElement elementWithName:@"pizza"]; NSXMLElement *nsNode1 = [NSXMLElement elementWithName:@"toppings"]; NSXMLElement *nsNode2 = [NSXMLElement elementWithName:@"pepperoni"]; @@ -411,7 +411,7 @@ + (void)testString NSXMLElement *nsNode6 = [NSXMLElement elementWithName:@"crust"]; NSXMLElement *nsNode7 = [NSXMLElement elementWithName:@"thin"]; NSXMLElement *nsNode8 = [NSXMLElement elementWithName:@"thick"]; - + [nsNode0 addChild:nsNode1]; [nsNode0 addChild:nsNode6]; [nsNode1 addChild:nsNode2]; @@ -420,7 +420,7 @@ + (void)testString [nsNode3 addChild:nsNode5]; [nsNode6 addChild:nsNode7]; [nsNode6 addChild:nsNode8]; - + DDXMLElement *ddNode0 = [DDXMLElement elementWithName:@"pizza"]; DDXMLElement *ddNode1 = [DDXMLElement elementWithName:@"toppings"]; DDXMLElement *ddNode2 = [DDXMLElement elementWithName:@"pepperoni"]; @@ -430,7 +430,7 @@ + (void)testString DDXMLElement *ddNode6 = [DDXMLElement elementWithName:@"crust"]; DDXMLElement *ddNode7 = [DDXMLElement elementWithName:@"thin"]; DDXMLElement *ddNode8 = [DDXMLElement elementWithName:@"thick"]; - + [ddNode0 addChild:ddNode1]; [ddNode0 addChild:ddNode6]; [ddNode1 addChild:ddNode2]; @@ -439,57 +439,57 @@ + (void)testString [ddNode3 addChild:ddNode5]; [ddNode6 addChild:ddNode7]; [ddNode6 addChild:ddNode8]; - + NSXMLNode *nsAttr1 = [NSXMLNode attributeWithName:@"price" stringValue:@"1.00"]; DDXMLNode *ddAttr1 = [DDXMLNode attributeWithName:@"price" stringValue:@"1.00"]; - + [nsNode1 addAttribute:nsAttr1]; [ddNode1 addAttribute:ddAttr1]; - + [nsNode4 setStringValue:@""]; [ddNode4 setStringValue:@""]; - + [nsNode5 setStringValue:@"too hot"]; [ddNode5 setStringValue:@"too hot"]; - + NSString *nsTest1 = [nsNode0 stringValue]; // Returns "too hot" NSString *ddTest1 = [ddNode0 stringValue]; - + NSAssert([nsTest1 isEqualToString:ddTest1], @"Failed test 1"); - + NSString *nsTest2 = [nsAttr1 stringValue]; // Returns "1.00" NSString *ddTest2 = [ddAttr1 stringValue]; - + NSAssert([nsTest2 isEqualToString:ddTest2], @"Failed test 2"); - + [nsAttr1 setStringValue:@"1.25"]; [ddAttr1 setStringValue:@"1.25"]; - + NSString *nsTest3 = [nsAttr1 stringValue]; // Returns "1.25" NSString *ddTest3 = [ddAttr1 stringValue]; - + NSAssert([nsTest3 isEqualToString:ddTest3], @"Failed test 3"); - + [nsNode0 setStringValue:@"ESCAPE"]; [ddNode0 setStringValue:@"ESCAPE"]; - + NSString *nsTest4 = [nsNode0 stringValue]; // Returns "ESCAPE" NSString *ddTest4 = [ddNode0 stringValue]; - + NSAssert([nsTest4 isEqualToString:ddTest4], @"Failed test 4"); - + // NSString *nsTest5 = [nsNode0 XMLString]; // Returns "<wtf>ESCAPE</wtf>" // NSString *ddTest5 = [ddNode0 XMLString]; // Returns "<wtf>ESCAPE</wtf>" -// +// // NSAssert([nsTest5 isEqualToString:ddTest5], @"Failed test 5"); -// +// // The DDXML version is actually more accurate, so we'll accept the difference. } + (void)testPreviousNextNode { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + // // // @@ -503,7 +503,7 @@ + (void)testPreviousNextNode // // // - + NSXMLElement *nsNode0 = [NSXMLElement elementWithName:@"pizza"]; NSXMLElement *nsNode1 = [NSXMLElement elementWithName:@"toppings"]; NSXMLElement *nsNode2 = [NSXMLElement elementWithName:@"pepperoni"]; @@ -513,7 +513,7 @@ + (void)testPreviousNextNode NSXMLElement *nsNode6 = [NSXMLElement elementWithName:@"crust"]; NSXMLElement *nsNode7 = [NSXMLElement elementWithName:@"thin"]; NSXMLElement *nsNode8 = [NSXMLElement elementWithName:@"thick"]; - + [nsNode0 addChild:nsNode1]; [nsNode0 addChild:nsNode6]; [nsNode1 addChild:nsNode2]; @@ -522,7 +522,7 @@ + (void)testPreviousNextNode [nsNode3 addChild:nsNode5]; [nsNode6 addChild:nsNode7]; [nsNode6 addChild:nsNode8]; - + DDXMLElement *ddNode0 = [DDXMLElement elementWithName:@"pizza"]; DDXMLElement *ddNode1 = [DDXMLElement elementWithName:@"toppings"]; DDXMLElement *ddNode2 = [DDXMLElement elementWithName:@"pepperoni"]; @@ -532,7 +532,7 @@ + (void)testPreviousNextNode DDXMLElement *ddNode6 = [DDXMLElement elementWithName:@"crust"]; DDXMLElement *ddNode7 = [DDXMLElement elementWithName:@"thin"]; DDXMLElement *ddNode8 = [DDXMLElement elementWithName:@"thick"]; - + [ddNode0 addChild:ddNode1]; [ddNode0 addChild:ddNode6]; [ddNode1 addChild:ddNode2]; @@ -541,89 +541,89 @@ + (void)testPreviousNextNode [ddNode3 addChild:ddNode5]; [ddNode6 addChild:ddNode7]; [ddNode6 addChild:ddNode8]; - + NSString *nsTest1 = [[nsNode2 nextNode] name]; NSString *ddTest1 = [[ddNode2 nextNode] name]; - + NSAssert2([nsTest1 isEqualToString:ddTest1], @"Failed test 1: ns(%@) dd(%@)", nsTest1, ddTest1); - + NSString *nsTest2 = [[nsNode3 nextNode] name]; NSString *ddTest2 = [[ddNode3 nextNode] name]; - + NSAssert2([nsTest2 isEqualToString:ddTest2], @"Failed test 2: ns(%@) dd(%@)", nsTest2, ddTest2); - + NSString *nsTest3 = [[nsNode5 nextNode] name]; NSString *ddTest3 = [[ddNode5 nextNode] name]; - + NSAssert2([nsTest3 isEqualToString:ddTest3], @"Failed test 3: ns(%@) dd(%@)", nsTest3, ddTest3); - + NSString *nsTest4 = [[nsNode5 previousNode] name]; NSString *ddTest4 = [[ddNode5 previousNode] name]; - + NSAssert2([nsTest4 isEqualToString:ddTest4], @"Failed test 4: ns(%@) dd(%@)", nsTest4, ddTest4); - + NSString *nsTest5 = [[nsNode6 previousNode] name]; NSString *ddTest5 = [[ddNode6 previousNode] name]; - + NSAssert2([nsTest5 isEqualToString:ddTest5], @"Failed test 5: ns(%@) dd(%@)", nsTest5, ddTest5); - + NSString *nsTest6 = [[nsNode8 nextNode] name]; NSString *ddTest6 = [[ddNode8 nextNode] name]; - + NSAssert2((!nsTest6 && !ddTest6), @"Failed test 6: ns(%@) dd(%@)", nsTest6, ddTest6); - + NSString *nsTest7 = [[nsNode0 previousNode] name]; NSString *ddTest7 = [[ddNode0 previousNode] name]; - + NSAssert2((!nsTest7 && !ddTest7), @"Failed test 7: ns(%@) dd(%@)", nsTest7, ddTest7); } + (void)testPrefix { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + // // // // // // - + NSXMLElement *nsNode1 = [NSXMLElement elementWithName:@"dog"]; NSXMLElement *nsNode2 = [NSXMLElement elementWithName:@"a:dog"]; NSXMLElement *nsNode3 = [NSXMLElement elementWithName:@"a:b:dog"]; NSXMLElement *nsNode4 = [NSXMLElement elementWithName:@"dog" URI:@"beagle"]; - + DDXMLElement *ddNode1 = [DDXMLElement elementWithName:@"dog"]; DDXMLElement *ddNode2 = [DDXMLElement elementWithName:@"a:dog"]; DDXMLElement *ddNode3 = [DDXMLElement elementWithName:@"a:b:dog"]; DDXMLElement *ddNode4 = [DDXMLElement elementWithName:@"dog" URI:@"beagle"]; - + NSString *nsTest1 = [nsNode1 prefix]; NSString *ddTest1 = [ddNode1 prefix]; - + NSAssert([nsTest1 isEqualToString:ddTest1], @"Failed test 1"); - + NSString *nsTest2 = [nsNode2 prefix]; NSString *ddTest2 = [ddNode2 prefix]; - + NSAssert([nsTest2 isEqualToString:ddTest2], @"Failed test 2"); - + NSString *nsTest3 = [nsNode3 prefix]; NSString *ddTest3 = [ddNode3 prefix]; - + NSAssert([nsTest3 isEqualToString:ddTest3], @"Failed test 3"); - + NSString *nsTest4 = [nsNode4 prefix]; NSString *ddTest4 = [ddNode4 prefix]; - + NSAssert([nsTest4 isEqualToString:ddTest4], @"Failed test 4"); } + (void)testURI { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + // // // @@ -631,207 +631,207 @@ + (void)testURI // // // - + NSXMLElement *nsRoot = [NSXMLElement elementWithName:@"root"]; [nsRoot addNamespace:[NSXMLNode namespaceWithName:@"a" stringValue:@"deusty.com"]]; [nsRoot addNamespace:[NSXMLNode namespaceWithName:@"b" stringValue:@"robbiehanson.com"]]; - + NSXMLElement *nsNode1 = [NSXMLElement elementWithName:@"test"]; [nsNode1 addAttribute:[NSXMLNode attributeWithName:@"test" stringValue:@"1"]]; - + NSXMLElement *nsNode2 = [NSXMLElement elementWithName:@"a:test"]; [nsNode2 addAttribute:[NSXMLNode attributeWithName:@"test" stringValue:@"2"]]; - + NSXMLElement *nsNode3 = [NSXMLElement elementWithName:@"b:test"]; [nsNode3 addAttribute:[NSXMLNode attributeWithName:@"test" stringValue:@"3"]]; - + NSXMLElement *nsNode4 = [NSXMLElement elementWithName:@"test" URI:@"deusty.com"]; [nsNode4 addAttribute:[NSXMLNode attributeWithName:@"test" stringValue:@"4"]]; - + NSXMLElement *nsNode5 = [NSXMLElement elementWithName:@"test" URI:@"quack.com"]; [nsNode5 addAttribute:[NSXMLNode attributeWithName:@"test" stringValue:@"5"]]; - + [nsRoot addChild:nsNode1]; [nsRoot addChild:nsNode2]; [nsRoot addChild:nsNode3]; [nsRoot addChild:nsNode4]; [nsRoot addChild:nsNode5]; - + DDXMLElement *ddRoot = [DDXMLElement elementWithName:@"root"]; [ddRoot addNamespace:[DDXMLNode namespaceWithName:@"a" stringValue:@"deusty.com"]]; [ddRoot addNamespace:[DDXMLNode namespaceWithName:@"b" stringValue:@"robbiehanson.com"]]; - + DDXMLElement *ddNode1 = [DDXMLElement elementWithName:@"test"]; [ddNode1 addAttribute:[DDXMLNode attributeWithName:@"test" stringValue:@"1"]]; - + DDXMLElement *ddNode2 = [DDXMLElement elementWithName:@"a:test"]; [ddNode2 addAttribute:[DDXMLNode attributeWithName:@"test" stringValue:@"2"]]; - + DDXMLElement *ddNode3 = [DDXMLElement elementWithName:@"b:test"]; [ddNode3 addAttribute:[DDXMLNode attributeWithName:@"test" stringValue:@"3"]]; - + DDXMLElement *ddNode4 = [DDXMLElement elementWithName:@"test" URI:@"deusty.com"]; [ddNode4 addAttribute:[DDXMLNode attributeWithName:@"test" stringValue:@"4"]]; - + DDXMLElement *ddNode5 = [DDXMLElement elementWithName:@"test" URI:@"quack.com"]; [ddNode5 addAttribute:[DDXMLNode attributeWithName:@"test" stringValue:@"5"]]; - + [ddRoot addChild:ddNode1]; [ddRoot addChild:ddNode2]; [ddRoot addChild:ddNode3]; [ddRoot addChild:ddNode4]; [ddRoot addChild:ddNode5]; - + NSString *nsTest1 = [[nsNode1 resolveNamespaceForName:[nsNode1 name]] stringValue]; NSString *ddTest1 = [[ddNode1 resolveNamespaceForName:[ddNode1 name]] stringValue]; - + NSAssert(!nsTest1 && !ddTest1, @"Failed test 1"); - + NSString *nsTest2 = [[nsNode2 resolveNamespaceForName:[nsNode2 name]] stringValue]; NSString *ddTest2 = [[ddNode2 resolveNamespaceForName:[ddNode2 name]] stringValue]; - + NSAssert2([nsTest2 isEqualToString:ddTest2], @"Failed test 2: ns(%@) dd(%@)", nsTest2, ddTest2); - + NSString *nsTest3 = [[nsNode3 resolveNamespaceForName:[nsNode3 name]] stringValue]; NSString *ddTest3 = [[ddNode3 resolveNamespaceForName:[ddNode3 name]] stringValue]; - + NSAssert([nsTest3 isEqualToString:ddTest3], @"Failed test 3"); - + NSString *nsTest4 = [[nsNode4 resolveNamespaceForName:[nsNode4 name]] stringValue]; NSString *ddTest4 = [[ddNode4 resolveNamespaceForName:[ddNode4 name]] stringValue]; - + NSAssert2(!nsTest4 && !ddTest4, @"Failed test 4: ns(%@) dd(%@)", nsTest4, ddTest4); - + NSString *nsTest5 = [nsNode4 resolvePrefixForNamespaceURI:@"deusty.com"]; NSString *ddTest5 = [ddNode4 resolvePrefixForNamespaceURI:@"deusty.com"]; - + NSAssert2([nsTest5 isEqualToString:ddTest5], @"Failed test 5: ns(%@) dd(%@)", nsTest5, ddTest5); - + NSString *nsTest6 = [nsNode4 resolvePrefixForNamespaceURI:@"robbiehanson.com"]; NSString *ddTest6 = [ddNode4 resolvePrefixForNamespaceURI:@"robbiehanson.com"]; - + NSAssert([nsTest6 isEqualToString:ddTest6], @"Failed test 6"); - + NSString *nsTest7 = [nsNode4 resolvePrefixForNamespaceURI:@"quack.com"]; NSString *ddTest7 = [ddNode4 resolvePrefixForNamespaceURI:@"quack.com"]; - + NSAssert(!nsTest7 && !ddTest7, @"Failed test 7"); - + NSString *nsTest8 = [nsNode4 resolvePrefixForNamespaceURI:nil]; NSString *ddTest8 = [ddNode4 resolvePrefixForNamespaceURI:nil]; - + NSAssert(!nsTest8 && !ddTest8, @"Failed test 8"); - + NSUInteger nsTest9 = [[nsRoot elementsForName:@"test"] count]; // Returns test1, test4, test5 NSUInteger ddTest9 = [[ddRoot elementsForName:@"test"] count]; // Returns test1, test4, test5 - + NSAssert(nsTest9 == ddTest9, @"Failed test 9"); - + NSUInteger nsTest10 = [[nsRoot elementsForName:@"a:test"] count]; // Returns node2 and node4 NSUInteger ddTest10 = [[ddRoot elementsForName:@"a:test"] count]; // Returns node2 and node4 - + NSAssert(nsTest10 == ddTest10, @"Failed test 10"); - + NSUInteger nsTest11 = [[nsRoot elementsForLocalName:@"test" URI:@"deusty.com"] count]; // Returns node2 and node4 NSUInteger ddTest11 = [[ddRoot elementsForLocalName:@"test" URI:@"deusty.com"] count]; // Returns node2 and node4 - + NSAssert(nsTest11 == ddTest11, @"Failed test 11"); - + NSUInteger nsTest12 = [[nsRoot elementsForLocalName:@"a:test" URI:@"deusty.com"] count]; // Returns nothing NSUInteger ddTest12 = [[ddRoot elementsForLocalName:@"a:test" URI:@"deusty.com"] count]; // Returns nothing - + NSAssert(nsTest12 == ddTest12, @"Failed test 12"); - + NSUInteger nsTest13 = [[nsRoot elementsForLocalName:@"test" URI:@"quack.com"] count]; // Returns node5 NSUInteger ddTest13 = [[ddRoot elementsForLocalName:@"test" URI:@"quack.com"] count]; // Returns node5 - + NSAssert(nsTest13 == ddTest13, @"Failed test 13"); } + (void)testXmlns { NSLog(@"Starting %@...", NSStringFromSelector(_cmd)); - + NSString *parseMe = @""; NSData *data = [parseMe dataUsingEncoding:NSUTF8StringEncoding]; - + NSXMLDocument *nsDoc = [[NSXMLDocument alloc] initWithData:data options:0 error:nil]; NSXMLElement *nsRootElement = [nsDoc rootElement]; - + DDXMLDocument *ddDoc = [[DDXMLDocument alloc] initWithData:data options:0 error:nil]; DDXMLElement *ddRootElement = [ddDoc rootElement]; - + // Both URI and namespaceForPrefix:@"" should return "jabber:iq:roster" - + NSString *nsTest1 = [nsRootElement URI]; NSString *ddTest1 = [ddRootElement URI]; - + NSAssert([nsTest1 isEqualToString:ddTest1], @"Failed test 1"); - + NSString *nsTest2 = [[nsRootElement namespaceForPrefix:@""] stringValue]; NSString *ddTest2 = [[ddRootElement namespaceForPrefix:@""] stringValue]; - + NSAssert([nsTest2 isEqualToString:ddTest2], @"Failed test 2"); - + // In NSXML namespaceForPrefix:nil returns nil // In DDXML namespaceForPrefix:nil returns the same as namespaceForPrefix:@"" - // + // // This actually makes more sense, as many users would consider a prefix of nil or an empty string to be the same. // Plus many XML documents state that a prefix of nil or "" should be treated equally. - // + // // This difference comes into play in other areas. - // + // // In NSXML creating a namespace with prefix:nil doesn't work. // In DDXML creating a namespace with prefix:nil acts as if you had passed an empty string. - + NSUInteger nsTest3 = [[nsRootElement namespaces] count]; NSUInteger ddTest3 = [[ddRootElement namespaces] count]; - + NSAssert(nsTest3 == ddTest3, @"Failed test 3"); - + // An odd quirk of NSXML is that if the data is parsed, then the namespaces array contains the default namespace. // However, if the XML tree is generated in code, and the default namespace was set via setting the URI, // then the namespaces array doesn't contain that default namespace. // If instead the addNamespace method is used to add the default namespace, then it is contained in the array, // and the URI is also properly set. - // + // // I consider this to be a bug in NSXML. - + NSString *nsTest4 = [[nsRootElement resolveNamespaceForName:@""] stringValue]; NSString *ddTest4 = [[ddRootElement resolveNamespaceForName:@""] stringValue]; - + NSAssert([nsTest4 isEqualToString:ddTest4], @"Failed test 4"); - + // Oddly enough, even though NSXML seems completely resistant to nil namespace prefixes, this works fine NSString *nsTest5 = [[nsRootElement resolveNamespaceForName:nil] stringValue]; NSString *ddTest5 = [[ddRootElement resolveNamespaceForName:nil] stringValue]; - + NSAssert([nsTest5 isEqualToString:ddTest5], @"Failed test 5"); - + NSXMLElement *nsNode = [NSXMLElement elementWithName:@"query"]; [nsNode addNamespace:[NSXMLNode namespaceWithName:@"" stringValue:@"jabber:iq:auth"]]; - + DDXMLElement *ddNode = [DDXMLElement elementWithName:@"query"]; [ddNode addNamespace:[DDXMLNode namespaceWithName:@"" stringValue:@"jabber:iq:auth"]]; - + NSString *nsTest6 = [[nsNode resolveNamespaceForName:@""] stringValue]; NSString *ddTest6 = [[ddNode resolveNamespaceForName:@""] stringValue]; - + NSAssert([nsTest6 isEqualToString:ddTest6], @"Failed test 6"); - + NSString *nsTest7 = [[nsNode resolveNamespaceForName:nil] stringValue]; NSString *ddTest7 = [[ddNode resolveNamespaceForName:nil] stringValue]; - + NSAssert([nsTest7 isEqualToString:ddTest7], @"Failed test 7"); - + NSString *nsTest8 = [nsNode URI]; NSString *ddTest8 = [ddNode URI]; - + NSAssert([nsTest8 isEqualToString:ddTest8], @"Failed test 8"); - + NSUInteger nsTest9 = [[nsNode namespaces] count]; NSUInteger ddTest9 = [[ddNode namespaces] count]; - + NSAssert(nsTest9 == ddTest9, @"Failed test 9"); }