39 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/TestResources/accent_grave.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/accent_grave.html
--------------------------------------------------------------------------------
/TestResources/accent_grave.txt:
--------------------------------------------------------------------------------
1 | Àccent Grave ÄÖOpen movies in new players: Select to open movies in a new player window; deselect to replace the movie in the current player window with the new movie.
--------------------------------------------------------------------------------
/TestResources/archiversample.fi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/archiversample.fi
--------------------------------------------------------------------------------
/TestResources/archiversample.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 284
4 | 9096
5 |
--------------------------------------------------------------------------------
/TestResources/array.json:
--------------------------------------------------------------------------------
1 | ["first", "second"]
--------------------------------------------------------------------------------
/TestResources/attributes_with_double_closing_quotes.html:
--------------------------------------------------------------------------------
1 | beforeafter
--------------------------------------------------------------------------------
/TestResources/attributes_with_double_closing_quotes.txt:
--------------------------------------------------------------------------------
1 | beforeafter
--------------------------------------------------------------------------------
/TestResources/attrparserunonbug.html:
--------------------------------------------------------------------------------
1 |
14 | You can use this page to check if your browser correctly supports UTF-8 and XHTML. The web server delivers this page with the content type application/xhtml+xml.
15 |
16 |
17 |
Umlauts and accented characters: ÄËÏÖÜäëïöü ß áéíóú âêîôû àèìòù
18 |
19 |
“The quick brown fox jumps over the ‘lazy’ dog.”
20 |
21 |
„Falsches Üben von ‚Xylophonmusik‘ quält jeden größeren Zwerg.“
22 |
23 |
»Angle ›quotation‹ marks«
24 |
25 |
n–dash em—dash
26 |
27 |
Ellipsis…
28 |
29 |
Euro € sign
30 |
31 |
中文
32 |
33 |
日本語
34 |
35 |
русский язык
36 |
37 |
38 |
39 |
40 | René Puls
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/TestResources/utf8xhtml_test.txt:
--------------------------------------------------------------------------------
1 | XHTML/UTF-8 Test PageXHTML/UTF-8 Test Page
2 | You can use this page to check if your browser correctly supports UTF-8 and XHTML. The web server delivers this page with the content type application/xhtml+xml.
3 | Umlauts and accented characters: ÄËÏÖÜäëïöü ß áéíóú âêîôû àèìòù“The quick brown fox jumps over the ‘lazy’ dog.”„Falsches Üben von ‚Xylophonmusik‘ quält jeden größeren Zwerg.“»Angle ›quotation‹ marks«n–dash em—dashEllipsis…Euro € sign中文日本語русский языкRené Puls
--------------------------------------------------------------------------------
/TestResources/windows-encoded.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Search PacifiCat
8 | Search Search PacifiCat
9 | pacificat
10 | http://www.pacific.edu/images/icons/pacific.ico
11 |
12 | UTF-8
13 |
14 | false
15 |
16 |
--------------------------------------------------------------------------------
/TestResources/xml_comment_with_dash.xml:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/XmlCommonMacros.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef XMLCHAR
3 | #define XMLCHAR( x ) (x)
4 | #endif
5 |
6 | #ifndef NATIVECHAR
7 | #define NATIVECHAR( x ) (x)
8 | #endif
9 |
10 | #ifndef ISOPENTAG
11 | #define ISOPENTAG(x) ((x)==XMLCHAR('<'))
12 | #endif
13 | #ifndef ISCLOSETAG
14 | #define ISCLOSETAG(x) ((x)==XMLCHAR('>'))
15 | #endif
16 | #ifndef ISNAMESPACEDELIMITER
17 | #define ISNAMESPACEDELIMITER(x) ((x)==XMLCHAR(':'))
18 | #endif
19 |
20 | #ifndef ISAMPERSAND
21 | #define ISAMPERSAND(x) ((x)==XMLCHAR('&'))
22 | #endif
23 | #ifndef ISSEMICOLON
24 | #define ISSEMICOLON(x) ((x)==XMLCHAR(';'))
25 | #endif
26 | #ifndef ISHYPHEN
27 | #define ISHYPHEN(x) ((x)==XMLCHAR('-'))
28 | #endif
29 | #ifndef ISSINGLEQUOTE
30 | #define ISSINGLEQUOTE(x) ((x)==XMLCHAR('\''))
31 | #endif
32 | #ifndef ISDOUBLEQUOTE
33 | #define ISDOUBLEQUOTE(x) ((x)==XMLCHAR('"'))
34 | #endif
35 | #ifndef ISRIGHTSQUAREBRACKET
36 | #define ISRIGHTSQUAREBRACKET(x) ((x)==XMLCHAR(']'))
37 | #endif
38 | #ifndef ISSLASH
39 | #define ISSLASH(x) ((x)==XMLCHAR('/'))
40 | #endif
41 |
42 | #ifndef EMPTYSTRING
43 | #define EMPTYSTRING ""
44 | #endif
45 |
--------------------------------------------------------------------------------
/XmlDelimitAttrValues.h:
--------------------------------------------------------------------------------
1 |
2 |
3 | #import "XmlCommonMacros.h"
4 |
5 | static int delimitAttrValue( const xmlchar *start, const xmlchar *end,
6 | const xmlchar **keyStart, unsigned int *keyLen,
7 | const xmlchar **valStart, unsigned int *valLen );
8 | #define CHECKEND if ( cur >= end ) { return -1;}
9 | #define SYNTAXHECKEND if ( cur >= end ) {[NSException raise:@"syntax error" format:@"xml attr ended prematurely at '%c' in %.*s",*cur,end-start,start];}
10 | #define SKIPSPACE while ( cur < end && isspace(*cur) ) { cur++; }
11 |
12 | static int delimitAttrValue( const xmlchar *start, const xmlchar *end,
13 | const xmlchar **keyStart, unsigned int *keyLen,
14 | const xmlchar **valStart, unsigned int *valLen )
15 | {
16 | const xmlchar *cur=start;
17 |
18 | SKIPSPACE;
19 | *keyStart=cur;
20 | while ( cur < end && (isalnum(*cur) || *cur==':') && *cur!='=') {
21 | cur++;
22 | }
23 | *keyLen=cur-*keyStart;
24 | SKIPSPACE;
25 | CHECKEND;
26 | if ( *cur=='=' ) {
27 | cur++;
28 | SKIPSPACE;
29 | if ( ISSINGLEQUOTE(*cur) || ISDOUBLEQUOTE(*cur) ) {
30 | xmlchar delimiter=*cur;
31 | *valStart=++cur;
32 | while ( cur < end && *cur != delimiter ) {
33 | cur++;
34 | }
35 | SYNTAXHECKEND;
36 | *valLen=cur-*valStart;
37 | } else if ( cur < end && !isspace(*cur)) {
38 | // NSLog(@"not delimited by quote chars");
39 | *valStart=cur;
40 | while ( cur < end && (isalnum(*cur) || *cur=='#' || *cur=='%')) {
41 | cur++;
42 | }
43 | *valLen=cur-*valStart;
44 | } else {
45 | *valStart=EMPTYSTRING;
46 | *valLen=0;
47 | }
48 | } else {
49 | #if 1 // lenient: HTML
50 | *valStart=EMPTYSTRING;
51 | *valLen=0;
52 | #else // strict: XML
53 | [NSException raise:@"syntax error" format:@"xml attr expected '=', got '%c' in %.*s, key=%.*s",*cur,end-start,start,*keyLen,*keyStart];
54 | #endif
55 | }
56 | cur++;
57 | return cur-start;
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/XmlScannerScanCDataPseudoMacro.h:
--------------------------------------------------------------------------------
1 | /* XmlScannerScanCDataPseudoMacro.h Copyright (c) Marcel P. Weiher 1999-2006, All Rights Reserved,
2 | Redistribution and use in source and binary forms, with or without
3 | modification, are permitted provided that the following conditions
4 | are met:
5 |
6 | Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 |
9 | Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in
11 | the documentation and/or other materials provided with the distribution.
12 |
13 | Neither the name Marcel Weiher nor the names of contributors may
14 | be used to endorse or promote products derived from this software
15 | without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 | THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | , created on Mon 30-Aug-1999 */
30 |
31 |
32 | static xmlchar *scanCData( const xmlchar *currentPtr, const xmlchar *endPtr )
33 | {
34 | while ( currentPtr < endPtr ) {
35 | if ( *currentPtr == '>' ) {
36 | if ( currentPtr[-1]==']' && currentPtr[-2]==']' ) {
37 | break;
38 | } else {
39 | currentPtr+=3;
40 | }
41 | } else if ( *currentPtr == ']' ) {
42 | currentPtr+=1;
43 | } else {
44 | currentPtr+=3;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/buildfat:
--------------------------------------------------------------------------------
1 | # shell script goes here
2 | pwd
3 | export VER=3.1.3
4 | CONFIGURATION_BUILD_DIR=~/programming/Build/Release
5 | xcodebuild -configuration Release -target iXmlKit -sdk "iphonesimulator$VER" ARCHS=i386 DSTROOT=$CONFIGURATION_BUILD_DIR/../Release-iphonesimulator GCC_VERSION=4.2
6 | xcodebuild -configuration Release -target iXmlKit -sdk "iphoneos$VER" ARCHS=armv6 DSTROOT=$CONFIGURATION_BUILD_DIR/../Release-iphoneos GCC_VERSION=4.2
7 | cd $CONFIGURATION_BUILD_DIR
8 | cd ..
9 | lipo -create Release-iphoneos/libiXmlKit.a Release-iphonesimulator/libiXmlKit.a -output Release/libiXmlKit.a
10 | rm Release-iphoneos/libiXmlKit.a Release-iphonesimulator/libiXmlKit.a
11 |
--------------------------------------------------------------------------------
/createUserRequest.xmlrpc:
--------------------------------------------------------------------------------
1 |
2 | ld.submitActionlogindesktopUseruserBlapasswordpasswordBla
--------------------------------------------------------------------------------
/dllmain.m:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2006-2007 Christopher J. W. Lloyd
2 |
3 | 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 restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | 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 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 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. */
8 |
9 | #import
10 | #import
11 |
12 | int OBJCRegisterDLL(HINSTANCE handle);
13 |
14 | void FoundationThreadCleanup(void);
15 |
16 |
17 | int APIENTRY DllMain(HINSTANCE handle,DWORD reason,LPVOID _reserved) {
18 |
19 | if(reason==DLL_PROCESS_ATTACH)
20 | return OBJCRegisterDLL(handle);
21 |
22 | if(reason==DLL_THREAD_DETACH){
23 | FoundationThreadCleanup();
24 | return TRUE;
25 | }
26 | return TRUE;
27 | }
28 |
29 |
30 | void ObjectiveXMLLoad() {
31 | NSLog(@"loading ObjectiveXML");
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/extracttextappkit.stsh:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/stsh
2 | filename :=args objectAtIndex:0.
3 | attributes := NSMutableDictionary dictionary.
4 | options := NSMutableDictionary dictionary.
5 | options setObject:100000000 forKey:'NSIndexing'.
6 | data := NSData dataWithContentsOfMappedFile:filename.
7 | richText:=NSAttributedString alloc initWithData:data options:options documentAttributes:attributes error:nil.
8 | #stdout println:'attributes:'.
9 | #stdout println:attributes.
10 | #utf16data := richText string dataUsingEncoding:4.
11 | stdout println:richText string.
12 |
--------------------------------------------------------------------------------
/extracttextappkit_utf8.stsh:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/stsh
2 | filename :=args objectAtIndex:0.
3 | attributes := NSMutableDictionary dictionary.
4 | options := NSMutableDictionary dictionary.
5 | options setObject:100000000 forKey:'NSIndexing'.
6 | data := NSData dataWithContentsOfMappedFile:filename.
7 | richText:=NSAttributedString alloc initWithData:data options:options documentAttributes:attributes error:nil.
8 | string := NSMutableString stringWithString:richText string.
9 | nbsp := NSString stringWithUnichar:160.
10 | break := NSString stringWithUnichar:8232.
11 | break1 := NSString stringWithUnichar:8233.
12 | string replaceOccurrencesOfString:nbsp withString:' ' options:0 range:(1 to: string length - 1).
13 | string replaceOccurrencesOfString:break withString:' ' options:0 range:(1 to: string length - 1).
14 | string replaceOccurrencesOfString:break1 withString:' ' options:0 range:(1 to: string length - 1).
15 |
16 | #stdout println:'attributes:'.
17 | #stdout println:attributes.
18 | utf16data := string dataUsingEncoding:4.
19 | stdout println:utf16data.
20 |
--------------------------------------------------------------------------------
/extracttextmpwhtml.stsh:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/stsh
2 | xmlkit := NSBundle bundleWithPath:'/Library/Frameworks/MPWXmlKit.framework'.
3 | xmlkit load.
4 | text:=NSHTMLFileTextExtractor extractTextFromPath:(args objectAtIndex:0) maxLength:10000000 attributes:nil.
5 | text := text mutableCopy autorelease.
6 | lf := NSString stringWithUnichar:10.
7 | cr := NSString stringWithUnichar:13.
8 | text replaceOccurrencesOfString:cr withString:lf options:0 range:(1 to: text length - 1).
9 | utf16data :=text dataUsingEncoding:4.
10 | stdout println:utf16data.
11 |
--------------------------------------------------------------------------------
/h.template:
--------------------------------------------------------------------------------
1 | $$
2 | /* $FILENAME$ Copyright (c) 1999-2006 by Marcel P. Weiher. All Rights Reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions
5 | are met:
6 |
7 | Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 |
10 | Redistributions in binary form must reproduce the above copyright
11 | notice, this list of conditions and the following disclaimer in
12 | the documentation and/or other materials provided with the distribution.
13 |
14 | Neither the name Marcel Weiher nor the names of contributors may
15 | be used to endorse or promote products derived from this software
16 | without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 | THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 |
31 | */ */
32 |
33 | #import
34 |
35 | @interface $FILENAMESANSEXTENSION$ : NSObject
36 | {
37 |
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/images/.dir5_0.wmd:
--------------------------------------------------------------------------------
1 | {
2 | RootNode = /Users/marcel/programming/Kits/MPWXmlKit/images;
3 | Toolbar = No;
4 | ViewName = Browser;
5 | WindowFrame = "{{139, 228}, {450, 441}}";
6 | }
--------------------------------------------------------------------------------
/m.template:
--------------------------------------------------------------------------------
1 | $$ Lines starting with $$ are not inserted into newly created files
2 | $$ The following substitutions are made:
3 | $$
4 | $$ $FILENAME$ e.g. foo.m
5 | $$ $FILENAMESANSEXTENSION$ e.g. foo
6 | $$ $DIRECTORY$ e.g. /tmp/MyNewApp
7 | $$ $PROJECTNAME$ e.g. MyNewApp
8 | $$ $SUBPROJECTNAME$ e.g. TheGoodPart.subproj
9 | $$ $USERNAME$ e.g. mwagner
10 | $$ $DATE$ e.g. Jan-1-1994
11 | $$
12 | /* $FILENAME$ Copyright (c) 1999-2006 by Marcel P. Weiher. All Rights Reserved.
13 | Redistribution and use in source and binary forms, with or without
14 | modification, are permitted provided that the following conditions
15 | are met:
16 |
17 | Redistributions of source code must retain the above copyright
18 | notice, this list of conditions and the following disclaimer.
19 |
20 | Redistributions in binary form must reproduce the above copyright
21 | notice, this list of conditions and the following disclaimer in
22 | the documentation and/or other materials provided with the distribution.
23 |
24 | Neither the name Marcel Weiher nor the names of contributors may
25 | be used to endorse or promote products derived from this software
26 | without specific prior written permission.
27 |
28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
32 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
38 | THE POSSIBILITY OF SUCH DAMAGE.
39 |
40 |
41 | */ */
42 |
43 | #import "$FILENAMESANSEXTENSION$.h"
44 |
45 | @implementation $FILENAMESANSEXTENSION$
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/makeheaderdir:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | mkdir -p .headers
3 | cd .headers
4 | apply 'ln -s %1' `find .. -type f -name '*.h' `
5 | ln -s . ObjectiveXML
6 |
--------------------------------------------------------------------------------
/masonrunner/main.m:
--------------------------------------------------------------------------------
1 |
2 | #import
3 | #import
4 |
5 | #import
6 |
7 |
8 | @interface TestClass : NSObject {
9 | }
10 |
11 | @property (assign) int hi,there;
12 | @property (nonatomic, strong ) NSString *comment;
13 |
14 |
15 | @end
16 |
17 | @implementation TestClass
18 |
19 | -(NSString *)description
20 | {
21 | return [NSString stringWithFormat:@"<%@:%p: hi: %d there: %d comment: %@>",
22 | [self class],self,self.hi,self.there,self.comment];
23 | }
24 |
25 | -(void)dealloc
26 | {
27 | [_comment release];
28 | [super dealloc];
29 | }
30 |
31 | @end
32 |
33 |
34 |
35 |
36 |
37 | int main(int argc, char *argv[]) {
38 | NSString *filename = @(argv[1]);
39 | NSData *data=[NSData dataWithContentsOfMappedFile:filename];
40 |
41 | NSArray* result = nil;
42 | MPWMASONParser *parser=nil;
43 | MPWObjectBuilder *builder=nil;
44 | for (int i=0;i<1;i++) {
45 | #if 1
46 | parser=[MPWMASONParser parser];
47 | builder = [[[MPWObjectBuilder alloc] initWithClass:[TestClass class]] autorelease];
48 | builder.streamingThreshold=1;
49 | // builder.target = [MPWByteStream Stdout];
50 | parser.builder = builder;
51 | [parser setFrequentStrings: @[ @"hi" , @"there" ]];
52 | result = [parser parsedData:data];
53 | #else
54 | result = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
55 | #endif
56 | }
57 | NSLog(@"result: %@",[result class]);
58 | NSLog(@"array count: %ld",[result count]);
59 | NSLog(@"stram count: %ld",[builder objectCount]);
60 | NSLog(@"last: %@",[result lastObject]);
61 | NSLog(@"first: %@",[result firstObject]);
62 | NSLog(@"last comment: %@",[[result lastObject] comment]);
63 | NSLog(@"first comment: %@",[[result firstObject] comment]);
64 | NSLog(@"last comment: %p",[[result lastObject] comment]);
65 | NSLog(@"first comment: %p",[[result firstObject] comment]);
66 | return 0;
67 | }
68 |
--------------------------------------------------------------------------------
/mpwfoundation_imports.h:
--------------------------------------------------------------------------------
1 | /*
2 | * mpwfoundation_imports.h
3 | * MPWXmlKit
4 | *
5 | * Created by Marcel Weiher on 6/3/08.
6 | * Copyright 2008 Apple. All rights reserved.
7 | *
8 | */
9 | #ifdef __OBJC__
10 |
11 |
12 | #ifdef MPWXmlCoreOnly
13 |
14 | #import "MPWObject.h"
15 | #import "MPWObjectCache.h"
16 | #import "MPWSmallStringTable.h"
17 | #import "MPWCaseInsensitiveSmallStringTable.h"
18 | #import "MPWFastInvocation.h"
19 | #import "MPWSubData.h"
20 | #import "DebugMacros.h"
21 | #import "MPWFlattenStream.h"
22 | #import "MPWByteStream.h"
23 |
24 | #else
25 |
26 | #import
27 | #import
28 | #import
29 | #import
30 | #import
31 | #import
32 | #import
33 | #import
34 | #import
35 | #import
36 |
37 |
38 | #endif
39 | #endif
--------------------------------------------------------------------------------
/opennew.m:
--------------------------------------------------------------------------------
1 | //
2 | // opentester.m
3 | // MPWXmlKit
4 | //
5 | // Created by Marcel Weiher on 4/7/08.
6 | // Copyright 2008 Marcel Weiher. All rights reserved.
7 | //
8 |
9 |
10 | #import
11 | #import "MPWOpenDocumentParser.h"
12 | #import
13 |
14 | @class NSOpenDocumentParser;
15 |
16 | int main( int argc, char *argv[] ) {
17 | id pool=[NSAutoreleasePool new];
18 | id name = [NSString stringWithCString:argv[1]];
19 | id data = [NSData dataWithContentsOfFile:name];
20 |
21 | id reader;
22 | id richString;
23 | struct mstats after,before=mstats();
24 | int highWater,afterPool;
25 | int i;
26 | NSTimeInterval timeUsed;
27 | pool=[NSAutoreleasePool new];
28 | timeUsed=[NSDate timeIntervalSinceReferenceDate];
29 | for (i=0;i<10;i++) {
30 | reader = [[[NSOpenDocumentParser alloc] init] autorelease];
31 | richString = [[reader parseZip:data documentAttributes:nil] retain];
32 | }
33 | after=mstats();
34 | highWater=after.bytes_used - before.bytes_used;
35 | [pool release];
36 | timeUsed=[NSDate timeIntervalSinceReferenceDate] - timeUsed;
37 | after=mstats();
38 | afterPool=after.bytes_used - before.bytes_used;
39 | printf("%s %s %d bytes max %d bytes after pool %d ms real %d chars\n",rindex(argv[0],'/')+1,rindex(argv[1],'/')+1,highWater,afterPool,(int)(timeUsed*1000.0),[richString length]);
40 | exit(0);
41 | [pool release];
42 | return 0;
43 | }
44 |
--------------------------------------------------------------------------------
/openold.m:
--------------------------------------------------------------------------------
1 | //
2 | // opentester.m
3 | // MPWXmlKit
4 | //
5 | // Created by Marcel Weiher on 4/7/08.
6 | // Copyright 2008 Marcel Weiher. All rights reserved.
7 | //
8 |
9 |
10 | #import
11 | #import "MPWOpenDocumentParser.h"
12 | #import
13 |
14 | int main( int argc, char *argv[] ) {
15 | id pool=[NSAutoreleasePool new];
16 | id name = [NSString stringWithCString:argv[1]];
17 | id data = [NSData dataWithContentsOfFile:name];
18 | id reader;
19 | id richString;
20 | int highWater,afterPool;
21 | struct mstats after,before=mstats();
22 | int i;
23 | NSTimeInterval timeUsed;
24 | pool=[NSAutoreleasePool new];
25 | timeUsed=[NSDate timeIntervalSinceReferenceDate];
26 | for (i=0;i<10;i++) {
27 | reader = [[[NSClassFromString( @"NSOpenDocumentReader") alloc] initWithData:data options:nil] autorelease];
28 | richString = [[reader attributedString] retain];
29 | }
30 | after=mstats();
31 | highWater=after.bytes_used - before.bytes_used;
32 | [pool release];
33 | timeUsed=[NSDate timeIntervalSinceReferenceDate] - timeUsed;
34 | after=mstats();
35 | afterPool=after.bytes_used - before.bytes_used;
36 | printf("%s %s %d bytes max %d bytes after pool %d ms real %d chars\n",rindex(argv[0],'/')+1,rindex(argv[1],'/')+1,highWater,afterPool,(int)(timeUsed*1000.0),[richString length]);
37 | exit(0);
38 | return 0;
39 | }
40 |
--------------------------------------------------------------------------------
/parsebridge.stsh:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/stsh
2 | NSBundle loadFramework:'MPWXmlKit'.
3 | parser := MPWBridgeReader new.
4 | data := NSData dataWithContentsOfFile:'/System/Library/Frameworks/Foundation.framework/Resources/BridgeSupport/Foundation.bridgesupport'.
5 | parser parse:data.
6 | stdout println:parser constants.
7 |
--------------------------------------------------------------------------------
/sendReqest.stsh:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/stsh
2 | #-sendRequest:filename to:serviceString
3 | baseUrlString := 'http://app2-test.pensoft.local:15000/cgi-bin/WebObjects/LSDesktopServer.woa/xmlrpc/'
4 | urlString := baseUrlString stringByAppendingString:serviceString.
5 | context loadFramework:'MPWXmlKit'.
6 | payload := NSData dataWithContentsOfFile:filename.
7 | xmlrpc := MPWXmlRpc new.
8 | xmlrpc resultOfSendingEncodedRequest:payload toEndpoint:urlString.
9 |
--------------------------------------------------------------------------------
/sendStringRequest.stsh:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/stsh
2 | #-sendRequest:name to:urlString
3 | context loadFramework:'MPWXmlKit'.
4 | xmlrpc := MPWXmlRpc new.
5 | arg := nil.
6 | args count > 0 ifTrue: [ arg := args lastObject. ].
7 | payload := xmlrpc generateRequest:name withStringArg:arg.
8 | xmlrpc resultOfSendingEncodedRequest:payload toEndpoint:urlString.
9 |
--------------------------------------------------------------------------------
/swiftdecoder/main.swift:
--------------------------------------------------------------------------------
1 | //
2 | // main.swift
3 | // swiftdecoder
4 | //
5 | // Created by Marcel Weiher on 26.06.19.
6 | //
7 |
8 | import Foundation
9 |
10 | struct TestClass : Decodable {
11 | let hi:Int
12 | let there:Int
13 | let comment:String
14 |
15 | }
16 |
17 |
18 | NSLog("Swift Coding: \(TestClass.self)")
19 | let coder=JSONDecoder()
20 | let filename=CommandLine.arguments[1]
21 | let data = try! Data(contentsOf: URL(fileURLWithPath: filename))
22 | print("filename: \(filename)")
23 | print("data: \(data.count)")
24 | let decoded = try! coder.decode( [TestClass].self, from: data)
25 | print("decoded count: \(decoded.count)")
26 |
27 |
--------------------------------------------------------------------------------