├── .gitignore ├── B&I-Info.plist ├── COPYING ├── Concepts.rtf ├── GNUmakefile ├── GNUstep └── testobjectivexml.m ├── Info-MPWXmlKit__Framework___Upgraded_ copy 2.plist ├── Info-MPWXmlKit__Framework___Upgraded_ copy.plist ├── Info-MPWXmlKit__Framework___Upgraded_.plist ├── MPWAppKitXMLTesting-Info.plist ├── MPWAtomLink.h ├── MPWAtomLink.m ├── MPWAtomParser.h ├── MPWAtomParser.m ├── MPWBridgeReader.h ├── MPWBridgeReader.m ├── MPWFeed.h ├── MPWFeed.m ├── MPWFeedItem.h ├── MPWFeedItem.m ├── MPWFoundation_support ├── AccessorMacros.h ├── CodingAdditions.h ├── DebugMacros.h ├── MPWCaseInsensitiveSmallStringTable.h ├── MPWCaseInsensitiveSmallStringTable.m ├── MPWFastInvocation.h ├── MPWFastInvocation.m ├── MPWFoundation_support_originals ├── MPWObject.h ├── MPWObject.m ├── MPWObjectCache.h ├── MPWObjectCache.m ├── MPWObject_fastrc.h ├── MPWSmallStringTable.h ├── MPWSmallStringTable.m ├── MPWSubData.h ├── MPWSubData.m ├── NSInvocationAdditions_lookup.h ├── Readme-MPWFoundation-support └── reversecopy ├── MPWHTMLFileTextExtractor.h ├── MPWHTMLFileTextExtractor.m ├── MPWHrefScanner.h ├── MPWHrefScanner.m ├── MPWMASONParser.h ├── MPWMASONParser.m ├── MPWMAXParser.h ├── MPWMAXParser.m ├── MPWMAXParser_private.h ├── MPWNSXMLDocumentParser.h ├── MPWNSXMLDocumentParser.m ├── MPWObjectBuilder.h ├── MPWObjectBuilder.m ├── MPWOpenDocumentParser.h ├── MPWOpenDocumentParser.m ├── MPWRSSParser.h ├── MPWRSSParser.m ├── MPWSaxProtocol.h ├── MPWTagAction.h ├── MPWTagAction.m ├── MPWTagHandler.h ├── MPWTagHandler.m ├── MPWTemplateApply.h ├── MPWTemplateApply.m ├── MPWXmlAppleProplistGenerator.h ├── MPWXmlAppleProplistGenerator.m ├── MPWXmlAppleProplistReader.h ├── MPWXmlAppleProplistReader.m ├── MPWXmlArchiver.h ├── MPWXmlArchiver.m ├── MPWXmlAttributes.h ├── MPWXmlAttributes.m ├── MPWXmlCloseTag.h ├── MPWXmlCloseTag.m ├── MPWXmlCore-Info.plist ├── MPWXmlDOM.h ├── MPWXmlElement.h ├── MPWXmlElement.m ├── MPWXmlFastInfosetParser.h ├── MPWXmlFastInfosetParser.m ├── MPWXmlGeneratorStream.h ├── MPWXmlGeneratorStream.m ├── MPWXmlParser.h ├── MPWXmlParser.m ├── MPWXmlParser16bit.h ├── MPWXmlParser16bit.m ├── MPWXmlParserTesting.h ├── MPWXmlParserTesting.m ├── MPWXmlProplistGenerator.h ├── MPWXmlProplistGenerator.m ├── MPWXmlRpcGeneratorStream.h ├── MPWXmlRpcGeneratorStream.m ├── MPWXmlSaxScanner.h ├── MPWXmlSaxScanner.m ├── MPWXmlScanner.h ├── MPWXmlScanner.m ├── MPWXmlScanner16BitBE.h ├── MPWXmlScanner16BitBE.m ├── MPWXmlScanner16BitLE.h ├── MPWXmlScanner16BitLE.m ├── MPWXmlStartTag.h ├── MPWXmlStartTag.m ├── MPWXmlTag.h ├── MPWXmlTag.m ├── MPWXmlTag2ElementProcessor.h ├── MPWXmlTag2ElementProcessor.m ├── MPWXmlUnarchiver.h ├── MPWXmlUnarchiver.m ├── MPWXmlWrapperArchiver.h ├── MPWXmlWrapperArchiver.m ├── MPWXmlWrapperUnarchiver.h ├── MPWXmlWrapperUnarchiver.m ├── NSString+extras.h ├── NSString+extras.m ├── Notes.rtf ├── Objective-XML-Concepts.rtf ├── ObjectiveXML.h ├── ObjectiveXML.map ├── ObjectiveXML.xcodeproj ├── marcel.mode1v3 ├── marcel.pbxuser ├── project.pbxproj ├── xcshareddata │ └── xcschemes │ │ ├── MPWXmlKit (Linux).xcscheme │ │ ├── ObjectiveXML.xcscheme │ │ └── masonrunner.xcscheme └── xcuserdata │ └── marcel.xcuserdatad │ ├── xcdebugger │ └── Breakpoints.xcbkptlist │ └── xcschemes │ ├── ObjectiveXMLTests.xcscheme │ ├── ObjectiveXMLTouch.xcscheme │ └── xcschememanagement.plist ├── ObjectiveXMLTests ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── ObjectiveXMLTouch ├── Info.plist └── ObjectiveXMLTouch.h ├── ObjectiveXMLTouchTests ├── Info.plist └── ObjectiveXMLTouchTests.m ├── PBUserInfo └── PBUserInfo_marcel.plist ├── README.md ├── SaxDocumentHandler.h ├── TestResources ├── AllNames.html ├── CricketFeedTest.fi ├── CricketFeedTest.xml ├── Dg-duplex.htm ├── Faehre-iso.xml ├── Faehre.xml ├── Itunes_info.plist ├── JapTitle.html ├── Package-org.xml.sax.helpers.html ├── Package-org.xml.sax.html ├── Unspecified.atom ├── accent_grave.html ├── accent_grave.txt ├── applenew.rss ├── archiversample.fi ├── archiversample.xml ├── array.json ├── atomfeed.xml ├── attributes_with_double_closing_quotes.html ├── attributes_with_double_closing_quotes.txt ├── attrparserunonbug.html ├── c1qt12.html ├── c1qt12.txt ├── categories.atom ├── cdatatest1.xml ├── checkForPenApps_with_ISO8859_claiming_UTF8.xmlrpc ├── close_tag_not_closed.html ├── close_tag_not_closed.txt ├── com.apple.adc.documentation.AppleSnowLeopard.atom ├── decor.html ├── decor.txt ├── dict.json ├── dictAfterNumber.json ├── dolby.rss ├── duplex.htm ├── emptyElementWithAttribute.fi ├── emptyElementWithAttribute.xml ├── empty_elements.plist ├── empty_html.html ├── empty_html.txt ├── emptyelement.fi ├── emptyelement.xml ├── emptyelements.json ├── emptytagwithattribute.xml ├── entity_runon.html ├── entity_runon.txt ├── getDictRequest.xmlrpc ├── getDictResponse.xmlrpc ├── getListResponse.xmlrpc ├── getSimpleDictResponse.xmlrpc ├── glossary.json ├── hreftest.html ├── html_comment_with_dash.html ├── html_comment_with_dash.txt ├── html_text_through_tag.html ├── html_text_through_tag.txt ├── html_with_javascript.html ├── html_with_javascript.txt ├── htmlfragment_attribute_no_value.html ├── htmlfragment_entities.html ├── htmlfragment_unquoted_attr_values.html ├── iso-encoded.xml ├── jap-pto-other-meta.html ├── jap-pto-other-meta.txt ├── jap-pto.html ├── jap-pto.html-1 ├── jap-pto.txt ├── jap-pto_all_upcase_meta.html ├── jap-pto_all_upcase_meta.txt ├── jap-pto_upcase_meta.html ├── jap-pto_upcase_meta.txt ├── literals.json ├── loginRequest.xmlrpc ├── meta_attributes.html ├── metadata_unicode.html ├── metadata_unicode_utf16.txt ├── metaobject.rss ├── mojibake_utf16.txt ├── mojibake_utf8.xhtml ├── naked_html_fragment.html ├── naked_html_fragment.txt ├── nested.xml ├── no_space_between_attributes.html ├── no_space_between_attributes.txt ├── numbers.json ├── numericEntities.xml ├── packages.html ├── responseWithAmpersands.xmlrpc ├── revision3-diggnation-quicktime.rss ├── session.xml ├── simple-xml-with-namespaces.fi ├── simple-xml-with-namespaces.xml ├── space_before_tag_close.html ├── space_before_tag_close.txt ├── states.xml ├── string.json ├── stringLengthRequest.xmlrpc ├── stringLengthResponse.xmlrpc ├── stringLengthResponse1.xmlrpc ├── stringescapes.json ├── tagconflict_disambiguated_by_namespace.xml ├── test1.fi ├── test1.h ├── test1.result ├── test1.xml ├── test1.xml.MPWXmlScanner-result ├── test2.fi ├── test2.xml ├── test3.fi ├── test3.xml ├── test3_16bit.xml ├── test4.xml ├── textwith_br.html ├── textwith_br.txt ├── textwith_headings.html ├── textwith_headings.txt ├── textwith_multiple_body.html ├── textwith_multiple_body.txt ├── textwith_p.html ├── textwith_p.txt ├── textwith_td.html ├── textwith_td.txt ├── textwith_th.html ├── textwith_th.txt ├── tree.html ├── unicodeescapes.json ├── utf8xhtml_test.html ├── utf8xhtml_test.txt ├── windows-encoded.xml └── xml_comment_with_dash.xml ├── XmlCommonMacros.h ├── XmlDelimitAttrValues.h ├── XmlScannerPseudoMacro.h ├── XmlScannerScanCDataPseudoMacro.h ├── allPlists_on_User_via_find ├── allPlists_via_Spotlight ├── allPlists_via_find ├── avi.rdf ├── buildfat ├── createUserRequest.xmlrpc ├── dllmain.m ├── extracttextappkit.stsh ├── extracttextappkit_utf8.stsh ├── extracttextmpwhtml.stsh ├── h.template ├── images └── .dir5_0.wmd ├── m.template ├── makeheaderdir ├── masonrunner └── main.m ├── mpwfoundation_imports.h ├── opennew.m ├── openold.m ├── parsebridge.stsh ├── sendReqest.stsh ├── sendStringRequest.stsh └── swiftdecoder └── main.swift /.gitignore: -------------------------------------------------------------------------------- 1 | .svn 2 | CVS 3 | .headers 4 | GNUstep/testobjectivexml 5 | -------------------------------------------------------------------------------- /B&I-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.metaobject.${PRODUCT_NAME:identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | FMWK 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /GNUmakefile: -------------------------------------------------------------------------------- 1 | # $Id: GNUmakefile,v 1.3 2004/01/07 16:43:52 marcel Exp $ 2 | 3 | include $(GNUSTEP_MAKEFILES)/common.make 4 | 5 | LIBRARY_NAME = libMPWXmlKit 6 | GNUSTEP_BUILD_DIR = ~/Build 7 | 8 | OBJCFLAGS += -Wno-import -fobjc-runtime=gnustep 9 | 10 | LDFLAGS += -L /home/gnustep/Build/obj 11 | 12 | 13 | libMPWXmlKit_HEADER_FILES = \ 14 | MPWSaxProtocol.h \ 15 | MPWXmlAppleProplistGenerator.h \ 16 | MPWXmlAppleProplistReader.h \ 17 | MPWXmlArchiver.h \ 18 | MPWXmlAttribute.h \ 19 | MPWXmlAttributes.h \ 20 | MPWXmlCloseTag.h \ 21 | MPWXmlDOM.h \ 22 | MPWXmlDomParser.h \ 23 | MPWXmlElement.h \ 24 | MPWXmlEntityReference.h \ 25 | MPWXmlGeneratorStream.h \ 26 | MPWXmlParser.h \ 27 | MPWXmlParser16bit.h \ 28 | MPWXmlProplistGenerator.h \ 29 | MPWXmlSaxScanner.h \ 30 | MPWXmlScanner.h \ 31 | MPWXmlScanner16BitBE.h \ 32 | MPWXmlScanner16BitLE.h \ 33 | MPWXmlStartTag.h \ 34 | MPWXmlTag.h \ 35 | MPWXmlTag2ElementProcessor.h \ 36 | MPWXmlUnarchiver.h \ 37 | MPWXmlWrapperArchiver.h \ 38 | MPWXmlWrapperUnarchiver.h \ 39 | SaxDocumentHandler.h \ 40 | XmlCommonMacros.h \ 41 | XmlDelimitAttrValues.h \ 42 | XmlScannerPseudoMacro.h \ 43 | XmlScannerScanCDataPseudoMacro.h\ 44 | 45 | libMPWXmlKit_HEADER_FILES_DIR = . 46 | libMPWXmlKit_HEADER_FILES_INSTALL_DIR = /MPWXmlKit 47 | 48 | libMPWXmlKit_OBJC_FILES = \ 49 | MPWXmlAppleProplistGenerator.m\ 50 | MPWXmlArchiver.m MPWXmlAttributes.m\ 51 | MPWXmlGeneratorStream.m\ 52 | MPWXmlParser.m \ 53 | MPWMAXParser.m \ 54 | MPWTagHandler.m \ 55 | MPWTagAction.m \ 56 | MPWXmlElement.m \ 57 | MPWXmlProplistGenerator.m MPWXmlSaxScanner.m\ 58 | MPWXmlScanner.m \ 59 | MPWXmlUnarchiver.m MPWXmlWrapperArchiver.m\ 60 | MPWXmlWrapperUnarchiver.m\ 61 | MPWXmlParserTesting.m\ 62 | 63 | 64 | libMPWXmlKit_LIBRARIES_DEPEND_UPON += \ 65 | -lMPWFoundation -lgnustep-base -lobjc 66 | 67 | libMPWXmlKit_INCLUDE_DIRS += -I. -I.. -I../MPWFoundation/.headers/ 68 | libMPWXmlKit_OBJCFLAGS += -Wno-import 69 | libMPWXmlKit_CFLAGS += -Wno-import 70 | 71 | -include GNUmakefile.preamble 72 | include $(GNUSTEP_MAKEFILES)/library.make 73 | -include GNUmakefile.postamble 74 | 75 | 76 | test : libMPWXmlKit tester 77 | LD_LIBRARY_PATH=/home/gnustep/GNUstep/Library/Libraries:/usr/local/lib:/home/gnustep/Build/obj/ ./GNUstep/testobjectivexml 78 | 79 | tester : 80 | clang -fobjc-runtime=gnustep-1.9 -I../MPWFoundation/.headers/ -I.headers -o GNUstep/testobjectivexml GNUstep/testobjectivexml.m -L/home/gnustep/Build/obj -lMPWXmlKit -lMPWFoundation -lgnustep-base -L/usr/local/lib/ -lobjc 81 | -------------------------------------------------------------------------------- /GNUstep/testobjectivexml.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSObject(testSelectors) 4 | -(NSArray*)testSelectors; 5 | -testFixture; 6 | @end 7 | 8 | @implementation NSObject(resources) 9 | 10 | +resourceWithName:(NSString*)name type:(NSString*)extension 11 | { 12 | NSString *path=[NSString stringWithFormat:@"TestResources/%@.%@",name,extension]; 13 | return [NSData dataWithContentsOfFile:path]; 14 | } 15 | 16 | +frameworkResource:(NSString*)name category:(NSString*)extension 17 | { 18 | return [self resourceWithName:name type:extension]; 19 | } 20 | 21 | @end 22 | 23 | 24 | static void runTests() 25 | { 26 | int tests=0; 27 | int success=0; 28 | int failure=0; 29 | NSArray *classes=@[ 30 | @"MPWTagHandlerTesting", 31 | @"MPWXmlGeneratorStream", 32 | // @"MPWMAXParser", 33 | // @"MPWXmlParserTesting", 34 | ]; 35 | 36 | for (NSString *className in classes ) { 37 | id testClass=NSClassFromString( className ); 38 | id fixture=testClass; 39 | if ( fixture ) { 40 | NSArray *testNames=[testClass testSelectors]; 41 | for ( NSString *testName in testNames ) { 42 | if ( [testClass respondsToSelector:@selector(testFixture)] ) { 43 | fixture=[testClass testFixture]; 44 | } 45 | SEL testSel=NSSelectorFromString( testName ); 46 | @try { 47 | tests++; 48 | // NSLog(@"%@:%@ -- will test",className,testName); 49 | [fixture performSelector:testSel]; 50 | // NSLog(@"%@:%@ -- success",className,testName); 51 | success++; 52 | } @catch (id error) { 53 | NSLog(@"\033[91;31m%@:%@ == error %@\033[0m",className,testName,error); 54 | failure++; 55 | } 56 | } 57 | } else { 58 | tests++; 59 | failure++; 60 | NSLog(@"\033[91;31m%@ == class not found\033[0m",className); 61 | } 62 | 63 | } 64 | printf("\033[91;3%dmtests: %d total, %d successes %d failures\033[0m\n",failure>0 ? 1:2,tests,success,failure); 65 | } 66 | 67 | int main( int argc, char *argv[] ) { 68 | MPWDictStore *a=[MPWDictStore store]; 69 | a[@"hi"]=@"there"; 70 | runTests(); 71 | return 0; 72 | 73 | } 74 | -------------------------------------------------------------------------------- /Info-MPWXmlKit__Framework___Upgraded_ copy 2.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | 19 | CFBundlePackageType 20 | FMWK 21 | CFBundleShortVersionString 22 | 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 0.0.1d1 27 | 28 | 29 | -------------------------------------------------------------------------------- /Info-MPWXmlKit__Framework___Upgraded_ copy.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | 19 | CFBundlePackageType 20 | FMWK 21 | CFBundleShortVersionString 22 | 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 0.0.1d1 27 | 28 | 29 | -------------------------------------------------------------------------------- /Info-MPWXmlKit__Framework___Upgraded_.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | 19 | CFBundlePackageType 20 | FMWK 21 | CFBundleShortVersionString 22 | 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 0.0.1d1 27 | 28 | 29 | -------------------------------------------------------------------------------- /MPWAppKitXMLTesting-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.yourcompany.MPWAppKitXMLTesting 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | FMWK 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /MPWAtomLink.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWAtomLink.h 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 1/3/11. 6 | // Copyright 2012 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "mpwfoundation_imports.h" 11 | 12 | 13 | @interface MPWAtomLink : NSObject { 14 | NSString *href; 15 | NSString *rel; 16 | NSString *type; 17 | } 18 | 19 | objectAccessor_h( NSString, href, setHref ) 20 | objectAccessor_h( NSString, rel, setRel ) 21 | objectAccessor_h( NSString, type , setType ) 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /MPWAtomLink.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPWAtomLink.m 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 1/3/11. 6 | // Copyright 2012 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import "MPWAtomLink.h" 10 | 11 | @implementation MPWAtomLink 12 | 13 | objectAccessor( NSString, href, setHref ) 14 | objectAccessor( NSString, rel, setRel ) 15 | objectAccessor( NSString, type , setType ) 16 | 17 | 18 | -(void)dealloc 19 | { 20 | [href release]; 21 | [rel release]; 22 | [type release]; 23 | [super dealloc]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /MPWAtomParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWAtomParser.h 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 12/14/10. 6 | // Copyright 2010 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MPWAtomParser : NSObject { 12 | 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MPWBridgeReader.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWBridgeReader.h 3 | // MPWXmlKit 4 | // 5 | // Created by Marcel Weiher on 6/4/07. 6 | // Copyright 2007 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MPWBridgeReader : NSObject { 12 | id context; 13 | id loadedSet; 14 | int count; 15 | 16 | } 17 | 18 | -(void)parseFrameworkAtPath:(NSString*)frameworkPath; 19 | 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MPWBridgeReader.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPWBridgeReader.m 3 | // MPWXmlKit 4 | // 5 | // Created by Marcel Weiher on 6/4/07. 6 | // Copyright 2007 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import "MPWBridgeReader.h" 10 | #import "MPWMAXParser.h" 11 | #import "mpwfoundation_imports.h" 12 | #ifndef WINDOWS 13 | #include 14 | #endif 15 | 16 | @interface NSObject(valueBinding) 17 | 18 | -(void)bindValue:value toVariableNamed:name; 19 | 20 | @end 21 | 22 | @implementation MPWBridgeReader 23 | 24 | idAccessor( context ,setContext ) 25 | idAccessor( loadedSet, setLoadedSet ) 26 | 27 | -(NSUInteger)count { return count; } 28 | 29 | -initWithContext:aContext 30 | { 31 | self=[super init]; 32 | [self setContext:aContext]; 33 | [self setLoadedSet:[NSMutableSet new]]; 34 | return self; 35 | } 36 | 37 | +(void)parseBridgeDict:aDict forContext:aContext 38 | { 39 | id pool=[NSAutoreleasePool new]; 40 | id reader = [[[self alloc] initWithContext:aContext] autorelease]; 41 | [reader parse:aDict]; 42 | // NSLog(@"%d total elements",(int)[reader count]); 43 | [pool release]; 44 | } 45 | 46 | -enumTag:attrs parser:parser 47 | { 48 | [context bindValue:[NSNumber numberWithInt:[[attrs objectForKey:@"value"] intValue]] toVariableNamed:[[attrs objectForKey:@"name"] stringValue]]; 49 | return nil; 50 | } 51 | 52 | -defaultElement:children attributes:a parser:p { count++; /* NSLog(@"<%@ > ",[p currentTag]); */ return nil; } 53 | 54 | -depends_onElement:children attributes:attributes parser:parser 55 | { 56 | id path = [[[attributes objectForKey:@"path"] copy] autorelease]; 57 | // NSLog(@"dependency: %@",path); 58 | if ( path ) { 59 | if ( ![[self loadedSet] containsObject:path] ) { 60 | [[self loadedSet] addObject:path]; 61 | [self parseFrameworkAtPath:path]; 62 | } else { 63 | // NSLog(@"skipping %@, already seen",path); 64 | } 65 | } 66 | return nil; 67 | } 68 | 69 | -constantTag:attrs parser:parser 70 | { 71 | if ( [[attrs objectForKey:@"type"] isEqual:@"@"] ) { 72 | char symbol[255]=""; 73 | id name = [attrs objectForKey:@"name"]; 74 | [name getCString:symbol maxLength:250 encoding:NSISOLatin1StringEncoding]; 75 | symbol[ [name length] ] =0; 76 | 77 | #if !WINDOWS && !LINUX 78 | id* ptr=dlsym( RTLD_DEFAULT, symbol ); 79 | if ( ptr && *ptr ) { 80 | [context bindValue:*ptr toVariableNamed:[name stringValue]]; 81 | } 82 | #endif 83 | } 84 | return nil; 85 | } 86 | 87 | 88 | -(BOOL)parse:xmlData 89 | { 90 | id pool=[NSAutoreleasePool new]; 91 | if ( xmlData ) { 92 | id parser=[MPWMAXParser parser]; 93 | 94 | [parser setHandler:self forTags:[NSArray arrayWithObjects:@"enum",@"constant",@"depends_on",nil]]; 95 | 96 | 97 | [parser parse:xmlData]; 98 | 99 | [pool release]; 100 | } 101 | return YES; 102 | } 103 | 104 | -(void)parseFrameworkAtPath:(NSString*)frameworkPath 105 | { 106 | id frameworkName=[[frameworkPath lastPathComponent] stringByDeletingPathExtension]; 107 | id bridgeSupportFilePath = [NSString stringWithFormat:@"%@/Resources/BridgeSupport/%@.bridgesupport", 108 | frameworkPath,frameworkName]; 109 | [self parse:[NSData dataWithContentsOfFile:bridgeSupportFilePath]]; 110 | } 111 | 112 | -(void)dealloc 113 | { 114 | [context release]; 115 | [super dealloc]; 116 | } 117 | 118 | @end 119 | -------------------------------------------------------------------------------- /MPWFeed.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | BSD License 4 | 5 | Copyright (c) by Marcel Weiher 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * Neither the name of ranchero.com or Brent Simmons nor the names of its 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 24 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 25 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | 32 | */ 33 | 34 | /* 35 | RSS.h 36 | A class for reading RSS feeds. 37 | 38 | */ 39 | 40 | 41 | #import 42 | 43 | 44 | @interface MPWFeed : NSObject { 45 | NSDictionary *headerItems; 46 | NSMutableArray *newsItems; 47 | NSString *version; 48 | BOOL flRdf; 49 | BOOL normalize; 50 | } 51 | 52 | 53 | -(instancetype)initWithVersion:(NSString*)newVersion items:(NSArray*)newItems header:(NSDictionary*)newHeaderItems; 54 | - (instancetype) initWithData: (NSData *) rssData normalize: (BOOL) fl; 55 | - (instancetype) initWithURL: (NSURL *) url normalize: (BOOL) fl; 56 | 57 | - (NSDictionary *) headerItems; 58 | - (NSArray *) newsItems; 59 | - (NSString *) version; 60 | 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /MPWFeedItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWFeedItem.h 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 1/3/11. 6 | // Copyright 2012 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | 13 | @interface MPWFeedItem : NSObject 14 | { 15 | } 16 | 17 | @property (nonatomic, strong) NSString *guid; 18 | @property (nonatomic, strong) NSString *title; 19 | @property (nonatomic, strong) NSString *category; 20 | @property (nonatomic, strong) NSString *imageLink; 21 | @property (nonatomic, strong) NSString *pubDate; 22 | @property (nonatomic, strong) NSDictionary *remainder; 23 | @property (nonatomic, strong) NSMutableArray *links; 24 | 25 | 26 | @end 27 | 28 | -------------------------------------------------------------------------------- /MPWFeedItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPWFeedItem.m 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 1/3/11. 6 | // Copyright 2012 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import "MPWFeedItem.h" 10 | #import "mpwfoundation_imports.h" 11 | #import "MPWAtomLink.h" 12 | 13 | @implementation MPWFeedItem 14 | 15 | 16 | -(void)setLink:(NSString*)aLink 17 | { 18 | MPWAtomLink* link=[[[MPWAtomLink alloc] init] autorelease]; 19 | [link setHref:aLink]; 20 | [self setLinks:[NSMutableArray arrayWithObject:link]]; 21 | } 22 | 23 | -(NSString*)link 24 | { 25 | return [[[self links] objectAtIndex:0] href]; 26 | } 27 | 28 | -(void)dealloc 29 | { 30 | [_guid release]; 31 | [_title release]; 32 | [_category release]; 33 | [_links release]; 34 | [_imageLink release]; 35 | [_pubDate release]; 36 | [super dealloc]; 37 | } 38 | 39 | -description { 40 | return [NSString stringWithFormat:@"<%@:%p: title: %@ guid: %@ category: %@ link: %@ date: %@ remainder: %@>", 41 | [self class],self,[self title],[self guid],[self category],[self link],[self pubDate],[self remainder]]; 42 | } 43 | 44 | @end 45 | 46 | 47 | -------------------------------------------------------------------------------- /MPWFoundation_support/CodingAdditions.h: -------------------------------------------------------------------------------- 1 | /* CodingAdditions.h Copyright (c) 1998-2017 by Marcel Weiher, All Rights Reserved. 2 | */ 3 | 4 | 5 | #import 6 | 7 | //#define encodeObject( coder, name ) [(coder) encodeObject:name withName:@"##name##"] 8 | //#define decodeObject( coder, name ) name=[[(coder) decodeObjectWithName:@"##name##"] retain] 9 | 10 | //#define QUICKSTRING( str ) (MPWUniqueString( (str), (sizeof (str))-1)) 11 | #define QUICKSTRING( str ) ( @str ) 12 | 13 | #define encodeVarName( coder, var, name ) [(coder) encodeValueOfObjCType:@encode(typeof(var)) at:(void*)&var withName:name]; 14 | #define decodeVarName( coder, var, name ) [(coder) decodeValueOfObjCType:@encode(typeof(var)) at:(void*)&var withName:name]; 15 | 16 | #define encodeArrayName( coder, var, name,elemCount ) [(coder) encodeArrayOfObjCType:@encode(typeof(*var)) count:elemCount at:(void*)var withName:name]; 17 | #define decodeArrayName( coder, var, name,elemCount ) [(coder) decodeArrayOfObjCType:@encode(typeof(*var)) count:elemCount at:(void*)var withName:name]; 18 | 19 | #define decodeVar( coder, var ) decodeVarName( coder, var, #var ) 20 | #define encodeVar( coder, var ) encodeVarName( coder, var, #var ) 21 | #define decodeArray( coder, var,count ) decodeArrayName( coder, var, #var, count ) 22 | #define encodeArray( coder, var,count ) encodeArrayName( coder, var, #var, count ) 23 | 24 | @interface NSCoder(NamedCoding) 25 | 26 | -(void)encodeObject:anObject withName:aName; 27 | -decodeObjectWithName:aName; 28 | -(void)encodeValueOfObjCType:(const char*)type at:(const void*)var withName:(const char*)name; 29 | -(void)decodeValueOfObjCType:(const char*)type at:(void*)var withName:(const char*)name; 30 | -(void)encodeArrayOfObjCType:(const char*)type count:(long)count at:(const void*)var withName:(const char*)name; 31 | -(void)decodeArrayOfObjCType:(const char*)type count:(long)count at:(void*)var withName:(const char*)name; 32 | -(void)encodeKey:aKey ofObject:anObject; 33 | -(void)decodeKey:aKey ofObject:anObject; 34 | 35 | 36 | @end 37 | 38 | @interface NSObject(reflectiveCoding) 39 | 40 | 41 | -(void)encodeKeys:keys withCoder:(NSCoder*)aCoder; 42 | -decodeWithCoder:(NSCoder*)aCoder keys:keys; 43 | +(BOOL)doReflectiveCoding; 44 | +(NSArray*)defaultEncodingKeys; 45 | -(NSArray*)encodingKeys; 46 | //-(void)encodeWithCoder:(NSCoder*)aCoder; 47 | //-initWithCoder:(NSCoder*)aCoder; 48 | -(NSArray*)theKeysToCopy; 49 | -(void)takeKey:aKey from:otherObject; 50 | -copyReflectivelyWithZone:(NSZone*)aZone; 51 | 52 | 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /MPWFoundation_support/MPWCaseInsensitiveSmallStringTable.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWCaseInsensitiveSmallStringTabe.h 3 | // MPWFoundation 4 | // 5 | // Created by Marcel Weiher on 8/6/07. 6 | // Copyright 2007 by Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import "MPWSmallStringTable.h" 10 | 11 | 12 | @interface MPWCaseInsensitiveSmallStringTable : MPWSmallStringTable { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MPWFoundation_support/MPWFastInvocation.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWFastInvocation.h 3 | // MPWFoundation 4 | // 5 | // Created by Marcel Weiher on 27/3/07. 6 | // Copyright 2010-2017 by Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import "MPWObject.h" 10 | #import 11 | 12 | @class MPWBlockInvocable; 13 | 14 | @interface MPWFastInvocation : MPWObject { 15 | SEL selector; 16 | id target; 17 | int numargs; 18 | id args[10]; 19 | id result; 20 | IMP0 cached; 21 | BOOL useCaching; 22 | NSMethodSignature *methodSignature; 23 | @public 24 | IMP0 invokeFun; 25 | } 26 | 27 | #define INVOKE( inv ) ((inv)->invokeFun( (inv), @selector(resultOfInvoking))) 28 | 29 | +quickInvocation; 30 | -target; 31 | -(void)invoke; 32 | -resultOfInvoking; 33 | -(void)setArgument:(void*)buffer atIndex:(NSInteger)argIndex; 34 | -(void)setTarget:newTarget; 35 | -(SEL)selector; 36 | -(void)setSelector:(SEL)newSelector; 37 | -resultOfInvokingWithArgs:(id*)newArgs count:(int)count; 38 | -(void)setUseCaching:(BOOL)doCaching; 39 | -returnValueAfterInvokingWithTarget:aTarget; 40 | 41 | @end 42 | 43 | @interface NSInvocation(convenience) 44 | 45 | -resultOfInvoking; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /MPWFoundation_support/MPWFoundation_support_originals: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | operator=$1 3 | MPWFOUNDATION=$2 4 | 5 | $operator AccessorMacros.h $MPWFOUNDATION/Classes/AccessorMacros.h 6 | $operator CodingAdditions.h $MPWFOUNDATION/Classes/CodingAdditions.h 7 | $operator DebugMacros.h $MPWFOUNDATION/Classes/DebugMacros.h 8 | $operator MPWCaseInsensitiveSmallStringTable.h $MPWFOUNDATION/Collections.subproj/MPWCaseInsensitiveSmallStringTable.h 9 | $operator MPWCaseInsensitiveSmallStringTable.m $MPWFOUNDATION/Collections.subproj/MPWCaseInsensitiveSmallStringTable.m 10 | $operator MPWFastInvocation.h $MPWFOUNDATION/Classes/MPWFastInvocation.h 11 | $operator MPWFastInvocation.m $MPWFOUNDATION/Classes/MPWFastInvocation.m 12 | $operator MPWObject.h $MPWFOUNDATION/Classes/MPWObject.h 13 | $operator MPWObject.m $MPWFOUNDATION/Classes/MPWObject.m 14 | $operator MPWObjectCache.h $MPWFOUNDATION/Classes/MPWObjectCache.h 15 | $operator MPWObjectCache.m $MPWFOUNDATION/Classes/MPWObjectCache.m 16 | $operator MPWSmallStringTable.h $MPWFOUNDATION/Collections.subproj/MPWSmallStringTable.h 17 | $operator MPWSmallStringTable.m $MPWFOUNDATION/Collections.subproj/MPWSmallStringTable.m 18 | $operator MPWSubData.h $MPWFOUNDATION/Collections.subproj/MPWSubData.h 19 | $operator MPWSubData.m $MPWFOUNDATION/Collections.subproj/MPWSubData.m 20 | $operator NSInvocationAdditions_lookup.h $MPWFOUNDATION/Classes/NSInvocationAdditions_lookup.h 21 | $operator MPWObject_fastrc.h $MPWFOUNDATION/Classes/MPWObject_fastrc.h 22 | -------------------------------------------------------------------------------- /MPWFoundation_support/MPWObject.h: -------------------------------------------------------------------------------- 1 | /* MPWObject.h Copyright (c) 1998-2017 by Marcel Weiher, All Rights Reserved. 2 | */ 3 | 4 | 5 | #import 6 | //#import 7 | 8 | typedef id (*IMP0)(id, SEL, ...); 9 | 10 | @interface MPWObject : NSObject 11 | { 12 | @public 13 | int _retainCount; 14 | int flags; 15 | } 16 | -(void)mydealloc; 17 | 18 | @end 19 | extern id retainMPWObject( MPWObject *obj ); 20 | extern void retainMPWObjects( MPWObject **objs, unsigned count ); 21 | extern void releaseMPWObject( MPWObject *obj ); 22 | extern void releaseMPWObjects( MPWObject **objs, unsigned count ); 23 | 24 | #if __OBJC_GC__ 25 | #include 26 | #define IS_OBJC_GC_ON objc_collecting_enabled() 27 | #define ALLOC_POINTERS( size ) NSAllocateCollectable( (size), NSScannedOption) 28 | #else 29 | #define IS_OBJC_GC_ON NO 30 | #define ALLOC_POINTERS( size) malloc( (size) ) 31 | #endif 32 | -------------------------------------------------------------------------------- /MPWFoundation_support/MPWObjectCache.h: -------------------------------------------------------------------------------- 1 | /* MPWObjectCache.h Copyright (c) 1998-2017 by Marcel Weiher, All Rights Reserved. 2 | */ 3 | 4 | 5 | #import "MPWObject.h" 6 | #import "AccessorMacros.h" 7 | #import 8 | 9 | 10 | typedef long (*INT_IMP)(id, SEL ); 11 | typedef void (*VOID_IMP)(id, SEL, ...); 12 | 13 | 14 | 15 | @interface MPWObjectCache : MPWObject 16 | { 17 | @public 18 | IMP0 getObject; 19 | } 20 | 21 | +cacheWithCapacity:(int)newCap class:(Class)newClass; 22 | -initWithCapacity:(int)newCap class:(Class)newClass; 23 | -getObject; 24 | -(void)makeThreadSafeOnDemand; 25 | -(IMP)getObjectIMP; 26 | -(void)clearCache; 27 | 28 | 29 | boolAccessor_h( unsafeFastAlloc, setUnsafeFastAlloc ) 30 | scalarAccessor_h( SEL, reInitSelector, setReInitSelector ) 31 | 32 | #define GETOBJECT( cache ) ((cache)->getObject( (cache), @selector(getObject))) 33 | 34 | //#define GETOBJECT( cache ) ([(cache) getObject]) 35 | 36 | 37 | 38 | #define CACHING_ALLOC( selector,size, unsafe ) \ 39 | static pthread_key_t key=0;\ 40 | static void __objc_cache_destructor( void *objref ) { [(id)objref release]; }\ 41 | +selector\ 42 | {\ 43 | if ( !key ) {\ 44 | pthread_key_create(&key, __objc_cache_destructor);\ 45 | }\ 46 | MPWObjectCache *cache=pthread_getspecific( key );\ 47 | if ( !cache ) {\ 48 | /* NSLog(@"will create a local cache for %@ for thread %p",NSStringFromClass(self),[NSThread currentThread]); */\ 49 | cache = [[MPWObjectCache alloc] initWithCapacity:size class:self];\ 50 | [cache setUnsafeFastAlloc:unsafe];\ 51 | pthread_setspecific( key, cache );\ 52 | }\ 53 | return GETOBJECT(cache);\ 54 | } 55 | 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /MPWFoundation_support/MPWObject_fastrc.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWObject_fastrc.h 3 | // MPWFoundation 4 | // 5 | // Created by Marcel Weiher on 6/14/12. 6 | // 7 | // 8 | 9 | #import 10 | 11 | static inline id _retainMPWObject( MPWObject *obj ) { 12 | if ( obj ) { 13 | (obj->_retainCount)++; 14 | } 15 | return obj; 16 | } 17 | 18 | static inline void _releaseMPWObject( MPWObject *obj ) { 19 | if (obj && (--(obj->_retainCount) < 0) ) { 20 | [obj mydealloc]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MPWFoundation_support/MPWSmallStringTable.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWSmallStringTable.h 3 | // MPWFoundation 4 | // 5 | // Created by Marcel Weiher on 29/3/07. 6 | // Copyright 2007-2017 by Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MPWObject.h" 11 | #import "AccessorMacros.h" 12 | 13 | typedef id (*LOOKUPIMP)(id, SEL, char*, int); 14 | 15 | 16 | typedef struct { 17 | int index; 18 | int length; 19 | int offset; 20 | int next; 21 | 22 | } StringTableIndex; 23 | 24 | @interface MPWSmallStringTable : NSDictionary { 25 | int __retainCount; 26 | int flags; 27 | int tableLength; 28 | unsigned char *table; 29 | #if WINDOWS || LINUX 30 | id *tableValues; 31 | #else 32 | __strong id *tableValues; 33 | #endif 34 | StringTableIndex *tableIndex; 35 | int *chainStarts; 36 | int *tableOffsetsPerLength; 37 | int maxLen; 38 | id defaultValue; 39 | BOOL caseInsensitive; 40 | 41 | @public 42 | LOOKUPIMP __stringTableLookupFun; 43 | } 44 | 45 | //extern IMP __stringTableLookupFun; 46 | 47 | -initWithKeys:(NSArray*)keys values:(NSArray*)values; 48 | 49 | -(NSUInteger)count; 50 | -objectForKey:(NSString*)key; 51 | -objectAtIndex:(NSUInteger)anIndex; 52 | -objectForCString:(const char*)cstr length:(int)len; 53 | -objectForCString:(const char*)cstr; 54 | -(int)offsetForCString:(const char*)cstr length:(int)len; 55 | -(int)offsetForCString:(const char*)cstr; 56 | -keyAtIndex:(NSUInteger)anIndex; 57 | -(void)setObject:anObject forKey:aKey; 58 | - (void)replaceObjectAtIndex:(NSUInteger)anIndex withObject:(id)anObject; 59 | -(int)offsetForKey:(NSString*)key; 60 | 61 | idAccessor_h( defaultValue, setDefaultValue ) 62 | 63 | #define OBJECTFORSTRINGLENGTH( table, str, stlen ) (table->__stringTableLookupFun( table, @selector(objectForCString:length:) , str, stlen )) 64 | #define OBJECTFORCONSTANTSTRING( table, str ) OBJECTFORSTRINGLENGTH( table, str, (sizeof str) -1 ) 65 | 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /MPWFoundation_support/MPWSubData.h: -------------------------------------------------------------------------------- 1 | /* MPWSubData.h Copyright (c) 1998-2017 by Marcel Weiher, All Rights Reserved. 2 | */ 3 | 4 | 5 | #import 6 | #import "AccessorMacros.h" 7 | #import "MPWObject.h" 8 | 9 | @interface MPWSubData : NSString // make these NSString compatible 10 | { 11 | int __retainCount; // also make them MPWObject compatible 12 | int flags; 13 | NSData* myData; 14 | const void *myBytes; 15 | long myLength; 16 | BOOL mustUnique,interned; 17 | } 18 | 19 | -initWithData:(NSData*)data bytes:(const char*)bytes length:(long)len; 20 | -reInitWithData:(NSData*)data bytes:(const char*)bytes length:(long)len; 21 | -(const void*)bytes; 22 | -(const char*)cString; 23 | -(NSUInteger)length; 24 | boolAccessor_h( mustUnique, setMustUnique ) 25 | -originalData; 26 | 27 | @end 28 | 29 | @interface NSObject(descr) 30 | 31 | -(NSString*)descr; 32 | 33 | @end 34 | 35 | -------------------------------------------------------------------------------- /MPWFoundation_support/NSInvocationAdditions_lookup.h: -------------------------------------------------------------------------------- 1 | /* NSInvocationAdditions_lookup.h Copyright (c) 1998-2017 by Marcel Weiher, All Rights Reserved. 2 | */ 3 | 4 | // #warning NSInvocationAdditions_lookup 5 | 6 | #if Darwin || TARGET_OS_IPHONE 7 | //#import "NSInvocationAdditions.h" 8 | 9 | #if TARGET_OS_IPHONE 10 | #import 11 | #else 12 | #import 13 | #endif 14 | //#define FAST_MSG_LOOKUPS 1 15 | #import 16 | 17 | // extern IMP class_lookupMethod( Class aClass , SEL msg ); for 10.4 or earlier 18 | #if __OBJC2__ || ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 ) || TARGET_OS_IPHONE 19 | 20 | //extern id objc_msgSend(id receiver, SEL _cmd, ...); 21 | static inline IMP objc_class_msg_lookup( Class aClass, SEL msg ) 22 | { 23 | // return objc_msgSend; 24 | // return [aClass instanceMethodForSelector:msg]; 25 | 26 | return class_getMethodImplementation( aClass, msg ); 27 | } 28 | 29 | // #warning define objc_msg_lookup in terms of class_getMethodImplementation 30 | //extern id objc_msgSend( id, SEL, ... ); 31 | static inline IMP objc_msg_lookup( id obj, SEL msg ) 32 | { 33 | // return objc_msgSend; 34 | // return [obj methodForSelector:msg]; 35 | 36 | // if ( obj ) { 37 | // return class_getMethodImplementation(*(Class*)obj, msg ); 38 | // } else { 39 | return objc_msgSend; 40 | // } 41 | } 42 | #else 43 | 44 | #error no objc_msg_lookup 45 | 46 | #endif 47 | 48 | #define CACHED_LOOKUP_WITH_CACHE( obj, msg,lastImp , lastClass ) \ 49 | {\ 50 | extern id _objc_msgForward(id sef, SEL _cmd, ...);\ 51 | if ( obj && *(Class*)obj != lastClass ) \ 52 | {\ 53 | lastClass=*(Class*)obj;\ 54 | lastImp=(IMP)objc_msg_lookup( obj, msg );\ 55 | }\ 56 | if ( lastImp == (IMP)NULL || lastImp == (IMP)_objc_msgForward ) {\ 57 | lastImp=(IMP)objc_msgSend;\ 58 | }\ 59 | } 60 | 61 | #define CACHED_LOOKUP( obj, msg ) \ 62 | {\ 63 | static Class lastClass=(Class)nil;\ 64 | static IMP lastImp=(IMP)nil;\ 65 | CACHED_LOOKUP_WITH_CACHE( obj, msg,lastImp , lastClass) \ 66 | } 67 | 68 | 69 | 70 | #else 71 | 72 | 73 | #endif 74 | 75 | 76 | -------------------------------------------------------------------------------- /MPWFoundation_support/Readme-MPWFoundation-support: -------------------------------------------------------------------------------- 1 | These are classes required from MPWFoundation, copied here in 2 | order to allow MPWXmlCore to build without any external 3 | framework references. 4 | 5 | They should not be modified, or if modified, the changes must 6 | be synchronized back with MPWFoundation. 7 | -------------------------------------------------------------------------------- /MPWFoundation_support/reversecopy: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cp $2 $1 3 | -------------------------------------------------------------------------------- /MPWHTMLFileTextExtractor.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSHTMLFileTextExtractor.h 3 | // AKCmds 4 | // 5 | // Created by on 29/7/06. 6 | // Copyright 2006 Apple Computer. All rights reserved. 7 | // 8 | 9 | #import "MPWXmlParser.h" 10 | 11 | @interface MPWHTMLFileTextExtractor : MPWSAXParser { 12 | // id parser; 13 | id string; 14 | int maxLen; 15 | id title; 16 | BOOL inBody,inScript,inTitle,inFragment; 17 | id metadata; 18 | } 19 | 20 | +extractTextFromPath:url maxLength:(long)maxLen attributes:dict; 21 | @end 22 | -------------------------------------------------------------------------------- /MPWHrefScanner.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWHrefScanner.h 3 | // MPWXmlKit 4 | // 5 | // Created by Marcel Weiher on 06/07/2006. 6 | /* Copyright 2006 Marcel Weiher. All Rights Reserved. 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in 16 | the documentation and/or other materials provided with the distribution. 17 | 18 | Neither the name Marcel Weiher nor the names of contributors may 19 | be used to endorse or promote products derived from this software 20 | without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 32 | THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | 35 | */ 36 | 37 | #import "MPWMAXParser.h" 38 | 39 | 40 | @interface MPWHrefScanner : MPWMAXParser { 41 | id base; 42 | id hrefs; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /MPWMASONParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWMASONParser.h 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 12/29/10. 6 | // Copyright 2010 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import "MPWXmlAppleProplistReader.h" 10 | 11 | @class MPWSmallStringTable; 12 | @protocol MPWPlistStreaming; 13 | 14 | @interface MPWMASONParser : MPWXmlAppleProplistReader { 15 | BOOL inDict; 16 | BOOL inArray; 17 | MPWSmallStringTable *commonStrings; 18 | } 19 | 20 | @property (nonatomic, strong) id builder; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /MPWNSXMLDocumentParser.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlDomParser.h Copyright (c) 2007 by Marcel P. Weiher. 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 | 30 | */ 31 | 32 | #import "MPWMAXParser.h" 33 | 34 | 35 | @interface MPWNSXMLDocumentParser : MPWMAXParser 36 | { 37 | void *allocator; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /MPWObjectBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWObjectBuilder.h 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 27.06.19. 6 | // 7 | 8 | #import 9 | 10 | 11 | @interface MPWObjectBuilder :MPWPListBuilder 12 | 13 | -(instancetype)initWithClass:(Class)theClass; 14 | 15 | @property (nonatomic, strong) MPWObjectCache *cache; 16 | @property (nonatomic, assign) long objectCount; 17 | @property (nonatomic, assign) long arrayDepth; 18 | @property (nonatomic, assign) long objectDepth; 19 | @property (nonatomic, assign) long streamingThreshold; 20 | @property (nonatomic, strong) id target; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /MPWObjectBuilder.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPWObjectBuilder.m 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 27.06.19. 6 | // 7 | 8 | #import "MPWObjectBuilder.h" 9 | 10 | #define ARRAYTOS (NSMutableArray*)(*tos) 11 | #define DICTTOS (NSMutableDictionary*)(*tos) 12 | 13 | 14 | @implementation MPWObjectBuilder 15 | 16 | -(instancetype)initWithClass:(Class)theClass 17 | { 18 | self=[super init]; 19 | self.cache=[MPWObjectCache cacheWithCapacity:20 class:theClass]; 20 | self.streamingThreshold=1; 21 | return self; 22 | } 23 | 24 | -(void)beginArray 25 | { 26 | _arrayDepth++; 27 | [super beginArray]; 28 | } 29 | 30 | -(void)endArray 31 | { 32 | _arrayDepth--; 33 | [super endArray]; 34 | } 35 | 36 | -(void)beginDictionary 37 | { 38 | [self pushContainer:GETOBJECT(_cache) ]; 39 | } 40 | 41 | -(void)endDictionary 42 | { 43 | tos--; 44 | if ( _arrayDepth <= _streamingThreshold) { 45 | [self.target writeObject:[ARRAYTOS lastObject] sender:self]; 46 | [ARRAYTOS removeLastObject]; 47 | } 48 | _objectCount++; 49 | } 50 | 51 | -(void)writeObject:anObject forKey:aKey 52 | { 53 | [*tos setValue:anObject forKey:aKey]; 54 | } 55 | 56 | 57 | 58 | @end 59 | 60 | @implementation MPWObjectBuilder(testing) 61 | 62 | +(NSArray*)testSelectors 63 | { 64 | return @[ 65 | ]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /MPWOpenDocumentParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWOpenDocumentParser.h 3 | // MPWXmlKit 4 | // 5 | // Created by Marcel Weiher on 2/19/08. 6 | // Copyright 2008 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface MPWOpenDocumentParser : NSObject { 13 | id parser; 14 | id resultString; 15 | id declaredFonts; 16 | id styles; 17 | id documentAttributes; 18 | } 19 | 20 | -styleForName:(NSString*)styleName; 21 | 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /MPWRSSParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWRSSParser.h 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 1/3/11. 6 | // Copyright 2012 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class MPWMAXParser; 12 | 13 | @interface MPWRSSParser : NSObject { 14 | Class feedClass,feedItemClass; 15 | MPWMAXParser *xmlparser; 16 | NSMutableArray *items; 17 | NSDictionary *headerItems; 18 | } 19 | 20 | scalarAccessor_h( Class, feedClass , setFeedClass ) 21 | scalarAccessor_h( Class, feedItemClass , setFeedItemClass ) 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /MPWRSSParser.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPWRSSParser.m 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 1/3/11. 6 | // Copyright 2012 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import "MPWRSSParser.h" 10 | #import "MPWMAXParser.h" 11 | #import "MPWFeedItem.h" 12 | #import "MPWFeed.h" 13 | #import "AccessorMacros.h" 14 | #import "MPWXmlAttributes.h" 15 | 16 | @implementation MPWRSSParser 17 | 18 | #define titleKey @"title" 19 | #define linkKey @"link" 20 | #define descriptionKey @"description" 21 | 22 | 23 | 24 | objectAccessor( MPWMAXParser, xmlparser, setXmlparser ) 25 | objectAccessor( NSMutableArray, items, setItems ) 26 | objectAccessor( NSDictionary, headerItems, setHeaderItems ) 27 | scalarAccessor( Class, feedClass , setFeedClass ) 28 | scalarAccessor( Class, feedItemClass , setFeedItemClass ) 29 | 30 | 31 | -(void)createParser 32 | { 33 | [self setXmlparser: [MPWMAXParser parser]]; 34 | [[self xmlparser] setHandler:self forElements:[NSArray arrayWithObjects:@"rss",@"item",@"channel",@"title",@"enclosure",nil] inNamespace:nil 35 | prefix:@"" map:nil]; 36 | [[self xmlparser] setUndefinedTagAction:MAX_ACTION_PLIST]; 37 | #if 0 38 | [[self xmlparser] handleElement:@"channel" withBlock:^(id elements, id attributes, id parser) { 39 | // NSLog(@"got channel"); 40 | [self setHeaderItems:[elements asDictionary]]; 41 | return nil; 42 | }]; 43 | #endif 44 | } 45 | 46 | -init 47 | { 48 | self=[super init]; 49 | return self; 50 | } 51 | 52 | -parsedData:(NSData*)data 53 | { 54 | [self createParser]; 55 | [self setItems:[NSMutableArray array]]; 56 | [self setHeaderItems:[NSMutableDictionary dictionary]]; 57 | id feed=[[self xmlparser] parsedData:data]; 58 | return feed; 59 | } 60 | 61 | -defaultElement:(MPWXMLAttributes*)children attributes:(MPWXMLAttributes*)attributes parser:(MPWMAXParser*)parser 62 | { 63 | return [parser buildPlistWithChildren:children attributes:attributes parser:parser]; 64 | } 65 | 66 | -channelElement:(MPWXMLAttributes*)children attributes:(MPWXMLAttributes*)attributes parser:parser 67 | { 68 | // NSLog(@"got channel"); 69 | [self setHeaderItems:[children asDictionary]]; 70 | return nil; 71 | } 72 | 73 | -(NSArray*)getItemKeys 74 | { 75 | return [NSArray arrayWithObjects: 76 | @"guid",@"title",@"category",@"link", 77 | @"pubDate",nil]; 78 | } 79 | 80 | -(NSArray*)itemKeys 81 | { 82 | static NSArray *keys=nil; 83 | if ( !keys ) { 84 | keys=[[self getItemKeys] retain]; 85 | } 86 | return keys; 87 | } 88 | 89 | -(NSSet*)itemKeySet { 90 | static NSSet *keys=nil; 91 | if ( !keys ) { 92 | keys=[[NSSet setWithArray:[self itemKeys]] retain]; 93 | } 94 | return keys; 95 | } 96 | 97 | // -(Class)feedItemClass { return [MPWFeedItem class]; } 98 | 99 | -itemElement:children attributes:attributes parser:parser 100 | { 101 | MPWFeedItem *item=[[[self feedItemClass] alloc] init]; 102 | for ( NSString *key in [self itemKeys] ) { 103 | [item setValue:[children objectForKey:key] forKey:key]; 104 | } 105 | [item setRemainder:[children asDictionaryExcludingKeys:[self itemKeySet]]]; 106 | [items addObject:[item autorelease]]; 107 | // NSLog(@"got an item"); 108 | return nil; 109 | } 110 | 111 | -rssElement:children attributes:attributes parser:parser 112 | { 113 | // NSLog(@" feedClass: %@",[self feedClass]); 114 | id result=[[[self feedClass] alloc] initWithVersion:[attributes objectForKey:@"version"] 115 | items:[self items] 116 | header:[self headerItems]]; 117 | return result; 118 | } 119 | 120 | 121 | @end 122 | -------------------------------------------------------------------------------- /MPWSaxProtocol.h: -------------------------------------------------------------------------------- 1 | /* MPWSaxProtocol.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 Tue 09-Feb-1999 */ 30 | 31 | #import 32 | 33 | @protocol MPWSaxDocumentLocator 34 | 35 | -(int)getLineNumber; 36 | -(int)getColumnNumber; 37 | -(NSString*)getSystemId; 38 | -(NSString*)getPublicId; 39 | 40 | @end 41 | 42 | 43 | @protocol MPWSaxDocumentHandler 44 | 45 | -(void)startDocument; 46 | -(void)endDocument; 47 | -(void)startElement:elementName attributes:attributes; 48 | -(void)endElement:elementName; 49 | #if EMULATE_JAVA_SAX 50 | -(void)characters:(char*)base from:(unsigned)start length:(unsigned)length; 51 | -(void)ignorableWhitespace:(char*)base from:(unsigned)start length:(unsigned)length; 52 | -(void)processingInstruction:target data:data; 53 | #else 54 | -(void)characters:characterData; 55 | -(void)cdata:cdataData; 56 | #endif 57 | -(void)setDocumentLocator:locator; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /MPWTagAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWTagAction.h 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 7/12/12. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @class MPWFastInvocation; 12 | 13 | @interface MPWTagAction : NSObject 14 | { 15 | NSString *mappedName; 16 | NSString *tagNamespace; 17 | NSString *namespacePrefix; 18 | @public 19 | NSString *tagName; 20 | MPWFastInvocation *tagAction; 21 | MPWFastInvocation *elementAction; 22 | } 23 | 24 | +undeclaredElementAction; 25 | 26 | -initWithTagName:(NSString*)tag; 27 | +tagActionWithName:(NSString*)tag; 28 | -(NSString*)tagName; 29 | -(void)setTagName:(NSString*)newName; 30 | -(MPWFastInvocation*)tagAction; 31 | -(void)setMappedName:(NSString*)newMappedName; 32 | -(void)setElementInvocationForTarget:primary backup:backup; 33 | -(void)setNamespacePrefix:(NSString*)aPrefix; 34 | -(void)setTagInvocationForTarget:primaryTarget; 35 | 36 | @property (nonatomic, strong) MPWFastInvocation* elementAction; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /MPWTagHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWTagHandler.h 3 | // MPWXmlKit 4 | // 5 | // Created by Marcel Weiher on 2/19/08. 6 | // Copyright 2008 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class MPWSmallStringTable,MPWTagAction; 12 | 13 | @interface MPWTagHandler : NSObject { 14 | id exceptionMap; 15 | id attributeMap; 16 | id namespaceString; 17 | NSMutableDictionary *tagDict; 18 | MPWSmallStringTable *tagTable; 19 | MPWTagAction *undeclared; 20 | BOOL isCaseInsensitive; 21 | } 22 | 23 | -(void)setIsCaseInsensitive:(BOOL)caseSensitivty; 24 | -(void)setExceptionMap:(NSDictionary*)map; 25 | -(void)declareAttributes:(NSArray*)attributes; 26 | 27 | 28 | -(void)setUndeclaredElementHandler:handler backup:backup; 29 | -(void)setInvocation:anInvocation forElement:(NSString*)tagName; 30 | 31 | -(void)initializeElementActionMapWithTags:(NSArray*)keys target:actionTarget prefix:prefix; 32 | 33 | -(void)initializeTagActionMapWithTags:(NSArray*)keys target:actionTarget prefix:prefix; 34 | 35 | 36 | 37 | //--- getting FastInvocations for names 38 | 39 | 40 | /* 41 | -elementHandlerInvocationForCString:(const char*)cstr length:(int)len; 42 | -tagHandlerInvocationForCString:(const char*)cstr length:(int)len; 43 | */ 44 | -namespaceString; 45 | -(void)setNamespaceString:(id)newNamespaceString; 46 | -actionForCString:(const char*)aCstring length:(long)len; 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /MPWTemplateApply.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWTemplateApply.h 3 | // MPWXmlKit 4 | // 5 | // Created by Marcel Weiher on 4/3/07. 6 | // Copyright 2007 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface MPWTemplateApply : NSObject { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MPWTemplateApply.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPWTemplateApply.m 3 | // MPWXmlKit 4 | // 5 | // Created by Marcel Weiher on 4/3/07. 6 | // Copyright 2007 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import "MPWTemplateApply.h" 10 | 11 | 12 | @implementation MPWTemplateApply 13 | 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MPWXmlAppleProplistGenerator.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlAppleProplistGenerator.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 Sat 17-Jul-1999 */ 30 | 31 | #import 32 | 33 | @interface MPWXmlAppleProplistGenerator : MPWXmlProplistGenerator 34 | { 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /MPWXmlAppleProplistGenerator.m: -------------------------------------------------------------------------------- 1 | /* MPWXmlAppleProplistGenerator.m 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 Sat 17-Jul-1999 */ 30 | 31 | #import "MPWXmlAppleProplistGenerator.h" 32 | 33 | @implementation MPWXmlAppleProplistGenerator 34 | 35 | static const char *key="key"; 36 | -(void)writeObject:anObject forKey:aKey 37 | { 38 | [self writeElementName:key attributes:nil contents:aKey]; 39 | [self writeObject:anObject]; 40 | } 41 | 42 | 43 | @end 44 | 45 | @implementation MPWXmlAppleProplistGenerator(testing) 46 | 47 | +(void)testWriteStringPlist 48 | { 49 | IDEXPECT( [[self process:@"hello world"] stringValue], @"hello world", @"hello world"); 50 | } 51 | 52 | +(NSArray*)testSelectors 53 | { 54 | return [NSArray arrayWithObjects: 55 | @"testWriteStringPlist", 56 | nil]; 57 | } 58 | 59 | @end 60 | 61 | -------------------------------------------------------------------------------- /MPWXmlAppleProplistReader.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlAppleProplistReader.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 Tue 20-Jul-1999 */ 30 | 31 | #import "MPWMAXParser.h" 32 | 33 | @interface MPWXmlAppleProplistReader : MPWMAXParser 34 | { 35 | const void *allocator; 36 | id true_value,false_value; 37 | } 38 | 39 | 40 | -realElement:(const char*)start length:(long)len; 41 | -integerElement:(id )children attributes:(id )attrs parser:(MPWMAXParser*)parser; 42 | -dictElement:(MPWXMLAttributes*)children attributes:(id )attrs parser:(MPWMAXParser*)parser; 43 | -arrayElement:(MPWXMLAttributes*)children attributes:(id )attrs parser:(MPWMAXParser*)parser; 44 | -integerElementAtPtr:(const char*)start length:(long)len; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /MPWXmlArchiver.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlArchiver.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 Sat 24-Jul-1999 */ 30 | 31 | #import 32 | 33 | @interface MPWXmlArchiver : NSCoder 34 | { 35 | id target; 36 | id currentObject; 37 | id todo; 38 | int ivarIndex; 39 | NSMapTable* objectTable; 40 | id classVersionTable; 41 | } 42 | 43 | //--- public API 44 | 45 | -initWithTarget:target; 46 | 47 | +archivedDataWithRootObject:root; 48 | -resultOfEncodingRootObject:root; 49 | -(void)encodeValueOfObjCType:(const char *)itemType at:(const void*)address withName:(const char*)name; 50 | -(void)encodeArrayOfObjCType:(const char *)itemType count:(unsigned)count at:(const void*)address withName:(const char*)name; 51 | -(void)encodeValueOfObjCType:(const char *)itemType at:(const void*)address; 52 | -(void)encodeArrayOfObjCType:(const char *)itemType count:(unsigned)count at:(const void*)address; 53 | -(void)encodeString:(NSString*)value name:(const char*)name; 54 | -(void)encodeRootObject:someObject; 55 | -(void)encodeDataObject:(NSData*)theObject; 56 | 57 | //--- private API 58 | 59 | -(void)writeClass:(Class)aClass; 60 | 61 | @end 62 | 63 | @interface NSObject(xmlArchiving) 64 | 65 | -(void)encodeXmlOn:aCoder withName:(const char*)name; 66 | -(void)encodeWithXmlCoder:(NSCoder*)aCoder; 67 | 68 | @end 69 | 70 | 71 | -------------------------------------------------------------------------------- /MPWXmlAttributes.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlAttributes.h Copyright (c) Marcel P. Weiher 1998-2008, 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 | 30 | #import 31 | #import "MPWMAXParser.h" 32 | 33 | 34 | @interface MPWXMLAttributes : NSObject 35 | { 36 | NSInteger _retainCount; 37 | id builtinKeys[6]; 38 | id builtinValues[6]; 39 | id builtinNamespace[6]; 40 | id* keys; 41 | id* values; 42 | id* namespaces; 43 | NSInteger attrCount; 44 | NSInteger attrCapacity; 45 | } 46 | 47 | 48 | -(id)objectForKey:(id)aKey; // retrieve first value whose local name matches aKey 49 | -(id)objectForUniqueKey:(id)aKey; // assumes keys have been uniqued 50 | -(id)objectsForKey:(id)aKey; // retrieve all values whose local name matches aKey 51 | -(id)objectsForUniqueKey:(id)aKey; // assumes keys have been uniqued 52 | -(id)objectsForUniqueKey:(id)aKey namespace:aNamespace; // assumes keys have been uniqued 53 | -(id)objectForCaseInsensitiveKey:(id)aKey; // retrieve first value whose local name matches aKey ignoring case 54 | -(id)objectAtIndex:(NSUInteger)anIndex; // get value by position 55 | -(id)keyAtIndex:(NSUInteger)anIndex; 56 | -(NSUInteger)count; 57 | -(NSDictionary*)asDictionaryExcludingKeys:(NSSet*)excludedKeys; 58 | -(NSDictionary*)asDictionary; 59 | -(NSArray*)allValues; 60 | -(NSArray*)allKeys; 61 | -(id*)_pointerToObjects; 62 | -(id)lastObject; 63 | -(BOOL)isLeaf; 64 | 65 | 66 | -(void)setValue:anObject forAttribute:aKey; 67 | -(void)removeAllObjects; 68 | -(void)pop:(long)n; 69 | -(void)copyKeysTo:(MPWXMLAttributes*)copy; 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /MPWXmlCloseTag.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlCloseTag.h Copyright (c) Marcel P. Weiher 1999, All Rights Reserver, created on Mon 28-Sep-1998 */ 2 | 3 | #import 4 | 5 | @interface MPWXmlCloseTag : MPWXmlTag 6 | { 7 | } 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /MPWXmlCloseTag.m: -------------------------------------------------------------------------------- 1 | /* MPWXmlCloseTag.m Copyright (c) Marcel P. Weiher 1999, All Rights Reserver, created on Mon 28-Sep-1998 */ 2 | 3 | #import "MPWXmlCloseTag.h" 4 | #import "MPWXmlGeneratorStream.h" 5 | 6 | @implementation MPWXmlCloseTag 7 | 8 | -description 9 | { 10 | return [NSString stringWithFormat:@"",name]; 11 | } 12 | 13 | -(void)generateXmlOnto:aStream 14 | { 15 | [aStream writeCloseTag:name]; 16 | } 17 | 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /MPWXmlCore-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | MPWXmlCore 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.1.0 19 | CFBundleVersion 20 | 4.1.0 21 | 22 | 23 | -------------------------------------------------------------------------------- /MPWXmlDOM.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlDOM.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 12-Oct-1998 */ 30 | 31 | @protocol Node 32 | 33 | const unsigned short ELEMENT_NODE = 1; 34 | const unsigned short ATTRIBUTE_NODE = 2; 35 | const unsigned short TEXT_NODE = 3; 36 | const unsigned short CDATA_SECTION_NODE = 4; 37 | const unsigned short ENTITY_REFERENCE_NODE = 5; 38 | const unsigned short ENTITY_NODE = 6; 39 | const unsigned short PROCESSING_INSTRUCTION_NODE = 7; 40 | const unsigned short COMMENT_NODE = 8; 41 | const unsigned short DOCUMENT_NODE = 9; 42 | const unsigned short DOCUMENT_TYPE_NODE = 10; 43 | const unsigned short DOCUMENT_FRAGMENT_NODE = 11; 44 | const unsigned short NOTATION_NODE = 12; 45 | 46 | -(NSString*)nodeName; 47 | -(NSString*)nodeValue; 48 | -(unsigned short)nodeType; 49 | -(id )parentNode; 50 | -(id )childNodes; 51 | -(id )firstChild; 52 | -(id )lastChild; 53 | -(id )previousSibling; 54 | -(id )nextSibling; 55 | -(id ) attributes; 56 | -(id )ownerDocument; 57 | 58 | -(id )insert:(in id )newChild before:(in id )refChild; 59 | -(id )replaceChild:(in id )oldChild with:(in id )newChild 60 | -(id )removeChild(in Node oldChild) 61 | -(id )appendChild:(in id )oldChild; 62 | -(BOOL)hasChildNodes; 63 | -(id )cloneNode:(in BOOL)deep; 64 | 65 | 66 | @end -------------------------------------------------------------------------------- /MPWXmlElement.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlElement.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 28-Sep-1998 */ 30 | 31 | #import 32 | #import "mpwfoundation_imports.h" 33 | 34 | @interface MPWXmlElement : NSObject 35 | { 36 | NSInteger _retainCount; 37 | id name; 38 | id attributes; 39 | id subelements; 40 | id parent; 41 | id elementBytes; 42 | BOOL isIncomplete,isDirty; 43 | } 44 | 45 | idAccessor_h( name, setName ) 46 | idAccessor_h( attributes, setAttributes) 47 | idAccessor_h( subelements, setSubelements) 48 | idAccessor_h( parent, setParent ) 49 | idAccessor_h( elementBytes, setElementBytes ) 50 | boolAccessor_h( isIncomplete, setIsIncomplete ) 51 | 52 | -initWithName:name attributes:attrs subelements:elements; 53 | -attributeForKey:akey; 54 | -childAtIndex:(NSUInteger)offset; 55 | -(NSEnumerator*)elementEnumerator; 56 | -(NSUInteger)count; 57 | 58 | //--- mutable 59 | 60 | //-(void)insertElement:anElement before:otherElement; 61 | -(void)addElement:anElement; 62 | //-(void)removeElement:anElement; 63 | -(BOOL)hasChildren; 64 | 65 | //-objectForXPointer:xPointer; 66 | 67 | @end 68 | 69 | 70 | //--- issues: DOM has explicit parent and document pointers 71 | //--- this allows access to siblings etc. 72 | //--- however it mandates containment 73 | 74 | -------------------------------------------------------------------------------- /MPWXmlFastInfosetParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWXmlFastInfosetParser.h 3 | // MPWXmlKit 4 | // 5 | // Created by Marcel Weiher on 10/4/07. 6 | // Copyright 2007 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import "MPWXmlParser.h" 10 | 11 | 12 | @interface MPWXmlFastInfosetParser : MPWSAXParser { 13 | NSData* fiData; 14 | unsigned const char *bytestart; 15 | unsigned const char *byteend; 16 | unsigned const char *curpos; 17 | int header; 18 | int fiVersion; 19 | unsigned char optionalComponentsMask; 20 | } 21 | 22 | -(void)parseElement:(unsigned char)startByte; 23 | @end 24 | -------------------------------------------------------------------------------- /MPWXmlParser.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlParser.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 Sun 05-Sep-1999 */ 30 | 31 | #import "MPWMAXParser.h" 32 | 33 | @interface MPWSAXParser : MPWMAXParser 34 | { 35 | } 36 | 37 | -(BOOL)characterDataAllowed:parser; 38 | 39 | 40 | @end 41 | 42 | @interface MPWSAXParser(alreadyThere) 43 | 44 | -(void)setDelegate:newDelegate; 45 | 46 | @end -------------------------------------------------------------------------------- /MPWXmlParser16bit.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlParser16bit.h Copyright (c) 1999 by Marcel P. Weiher, All Rights Reserved */ 2 | 3 | #import 4 | 5 | @interface MPWXmlParser16bit : NSObject 6 | { 7 | 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /MPWXmlParser16bit.m: -------------------------------------------------------------------------------- 1 | /* MPWXmlParser16bit.m Copyright (c) 1999 by Marcel P. Weiher, All Rights Reserved */ 2 | 3 | #import "MPWXmlParser16bit.h" 4 | 5 | @implementation MPWXmlParser(sixtenBit) 6 | 7 | typedef unichar xmlchar; 8 | 9 | #import "delimitAttrValues.h" 10 | 11 | 12 | -(BOOL)endElementBE:(const xmlchar*)start length:(int)len 13 | { 14 | id endName; 15 | start+=2; 16 | len-=3; 17 | endName = MPWUniqueStringWithUnichars(start,len); 18 | if ( [[self currentTag] isEqual: endName] ) { 19 | POPTAG; 20 | ENDELEMENT( endName ); 21 | return YES; 22 | } else { 23 | [NSException raise:@"non-matching tags" format:@"non matching tags start '%@' end '%@'",[self currentTag],endName]; 24 | return NO; 25 | } 26 | } 27 | 28 | -(BOOL)beginElementBE:(const xmlchar*)start length:(int)len nameLen:(int)nameLen 29 | { 30 | id tag; 31 | BOOL isEmpty=NO; 32 | const xmlchar *attrStart; 33 | int attrLen; 34 | id attrs; 35 | 36 | 37 | start++; 38 | nameLen--; 39 | len-=2; 40 | attrStart=start+nameLen+1; 41 | attrLen=len-nameLen-1; 42 | 43 | if ( start[len-1]=='/' ) { 44 | isEmpty=YES; 45 | len--; 46 | } else { 47 | 48 | } 49 | tag = MPWUniqueStringWithUnichars(start,nameLen); 50 | [self pushTag:tag]; 51 | attrs = GETOBJECT(attributeCache); 52 | // [self scanAttributesFromData:[NSString stringWithCharacters:start length:nameLen] into:attrs]; 53 | BEGINELEMENT( tag, attrs ); 54 | if ( isEmpty ) { 55 | POPTAG; 56 | ENDELEMENT(tag); 57 | } 58 | return YES; 59 | } 60 | 61 | -(BOOL)characterDataAllowed 62 | { 63 | return NO; 64 | } 65 | 66 | -(BOOL)makeTextBE:(const xmlchar*)start length:(int)len firstEntityOffset:(int)entityOffset 67 | { 68 | if ([self characterDataAllowed] ) { 69 | CHARACTERS([NSString stringWithCharacters:start length:len]); 70 | } 71 | return YES; 72 | } 73 | 74 | -(BOOL)makeCDataBE:(const xmlchar*)start length:(int)len 75 | { 76 | int cdlen = 9; 77 | start+=cdlen; 78 | len-=cdlen+2; 79 | if ( [self characterDataAllowed] ) { 80 | CDATA([NSString stringWithCharacters:start length:len]); 81 | //--- also have to check for non '@' valueType 82 | } 83 | return YES; 84 | } 85 | 86 | 87 | 88 | @end 89 | 90 | -------------------------------------------------------------------------------- /MPWXmlParserTesting.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWXmlParserTesting.h 3 | // MPWXmlKit 4 | // 5 | // Created by Marcel Weiher on 10/4/07. 6 | // Copyright 2007 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface MPWXmlParserTesting : NSObject { 13 | id messages; 14 | BOOL shouldAbort; 15 | NSMutableString *totalText; 16 | NSCharacterSet *nonWSCharSet; 17 | 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /MPWXmlProplistGenerator.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlProplistGenerator.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 Tue 13-Jul-1999 */ 30 | 31 | #import 32 | 33 | @interface MPWXmlProplistGenerator : MPWXmlGeneratorStream 34 | { 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /MPWXmlProplistGenerator.m: -------------------------------------------------------------------------------- 1 | /* MPWXmlProplistGenerator.m 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 Tue 13-Jul-1999 */ 30 | 31 | #import "MPWXmlProplistGenerator.h" 32 | 33 | @interface NSObject(xmlProplist) 34 | 35 | -(void)generateXmlProplistOnto:aStream; 36 | 37 | @end 38 | 39 | 40 | @implementation MPWXmlProplistGenerator 41 | 42 | static const char *array="array"; 43 | static const char *dict="dict"; 44 | static const char *string="string"; 45 | 46 | -(SEL)streamWriterMessage 47 | { 48 | return @selector(generateXmlProplistOnto:); 49 | } 50 | 51 | -(void)writeProplistArray:(NSArray*)anArray 52 | { 53 | [self writeElementName:array attributes:nil contents:anArray]; 54 | } 55 | 56 | -(void)writeObject:anObject forKey:aKey 57 | { 58 | [self writeStartTag:[aKey cString] attributes:nil single:NO]; 59 | [self writeObject:anObject]; 60 | [self closeTag]; 61 | } 62 | 63 | -(void)writeProplistDictionary:(NSDictionary*)aDict 64 | { 65 | [self writeElementName:dict attributes:nil contents:aDict]; 66 | } 67 | 68 | -(void)writeProplistString:(NSString*)aString 69 | { 70 | [self writeElementName:string attributes:nil contents:aString]; 71 | } 72 | 73 | @end 74 | 75 | @implementation NSObject(xmlProplist) 76 | 77 | -(void)generateXmlProplistOnto:aStream 78 | { 79 | [self generateXmlOnto:aStream]; 80 | } 81 | 82 | @end 83 | @implementation NSArray(xmlProplist) 84 | 85 | -(void)generateXmlProplistOnto:aStream 86 | { 87 | [aStream writeProplistArray:self]; 88 | } 89 | 90 | @end 91 | @implementation NSDictionary(xmlProplist) 92 | 93 | -(void)generateXmlProplistOnto:aStream 94 | { 95 | [aStream writeProplistDictionary:self]; 96 | } 97 | 98 | @end 99 | @implementation NSString(xmlProplist) 100 | 101 | -(void)generateXmlProplistOnto:aStream 102 | { 103 | [aStream writeProplistString:self]; 104 | } 105 | 106 | @end 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /MPWXmlRpcGeneratorStream.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWXmlRpcGeneratorStream.h 3 | // MPWXmlKit 4 | // 5 | // Created by Marcel Weiher on 21.4.09. 6 | // Copyright 2009 Marcel Weiher. All rights reserved. 7 | // 8 | 9 | #import "MPWXmlGeneratorStream.h" 10 | 11 | 12 | @interface MPWXmlRpcGeneratorStream : MPWFlattenStream { 13 | } 14 | 15 | -(NSData*)requestWithMethodName:(NSString*)requestName parameters:params; 16 | -(NSData*)requestWithMethodName:(NSString*)requestName parameter:param; 17 | 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /MPWXmlSaxScanner.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlSaxScanner.h Copyright (c) Marcel P. Weiher 1999, All Rights Reserver, created on Tue 09-Feb-1999 */ 2 | 3 | #import 4 | 5 | @interface MPWXmlSaxScanner : NSObject 6 | { 7 | 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /MPWXmlSaxScanner.m: -------------------------------------------------------------------------------- 1 | /* MPWXmlSaxScanner.m Copyright (c) Marcel P. Weiher 1999, All Rights Reserver, created on Tue 09-Feb-1999 */ 2 | 3 | #import "MPWXmlSaxScanner.h" 4 | 5 | @implementation MPWXmlSaxScanner 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /MPWXmlScanner.h: -------------------------------------------------------------------------------- 1 | /* 2 | MPWXmlScanner.h Copyright (c) Marcel P. Weiher 1998-2008, 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 | created on Sun 23-Aug-1998 */ 31 | 32 | #import 33 | 34 | 35 | 36 | @interface NSXMLScanner : NSObject 37 | { 38 | NSData* data; 39 | void *text,*space,*cdataTagCallback,*sgml,*pi; 40 | void *openTag,*closeTag ,*attVal,*entityRef; 41 | unsigned char *lastPosition; 42 | id delegate; 43 | } 44 | 45 | +parser; 46 | -(BOOL)parse:(NSData*)data; 47 | -(void)setDelegate:newDelegate; 48 | @end 49 | -------------------------------------------------------------------------------- /MPWXmlScanner16BitBE.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlScanner16BitBE.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 Sat 11-Sep-1999 */ 30 | 31 | #import "MPWXmlScanner.h" 32 | 33 | @interface NSXMLScanner(sixteenBitBE) 34 | 35 | -(void)scan16bit:(NSData*)aData; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /MPWXmlScanner16BitLE.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlScanner16BitLE.h Copyright (c) 1999 by Marcel P. Weiher, All Rights Reserved */ 2 | 3 | #import 4 | 5 | @interface MPWXmlScanner16BitLE : NSObject 6 | { 7 | 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /MPWXmlStartTag.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlStartTag.h Copyright (c) Marcel P. Weiher 1999, All Rights Reserver, created on Mon 28-Sep-1998 */ 2 | 3 | #import 4 | 5 | @interface MPWXmlStartTag : MPWXmlTag 6 | { 7 | id attributes; 8 | BOOL single; 9 | } 10 | 11 | idAccessor_h( attributes, setAttributes) 12 | boolAccessor_h( single, setSingle ) 13 | -attributeForKey:aKey; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MPWXmlStartTag.m: -------------------------------------------------------------------------------- 1 | /* MPWXmlStartTag.m Copyright (c) Marcel P. Weiher 1999, All Rights Reserver, created on Mon 28-Sep-1998 */ 2 | 3 | #import "MPWXmlStartTag.h" 4 | #import "MPWXmlGeneratorStream.h" 5 | 6 | @implementation MPWXmlStartTag 7 | 8 | idAccessor( attributes, setAttributes) 9 | boolAccessor( single, setSingle ) 10 | 11 | -(void)dealloc 12 | { 13 | [attributes release]; 14 | [super dealloc]; 15 | } 16 | 17 | -description 18 | { 19 | return attributes ? 20 | [NSString stringWithFormat:@"<%@ %@%s>",name,attributes,single?"/":""] : 21 | [super description]; 22 | } 23 | 24 | 25 | -attributeForKey:aKey 26 | { 27 | return [attributes objectForKey:aKey]; 28 | } 29 | 30 | -(void)generateXmlOnto:aStream 31 | { 32 | [aStream writeStartTag:name attributes:attributes single:single]; 33 | } 34 | 35 | @end 36 | 37 | -------------------------------------------------------------------------------- /MPWXmlTag.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlTag.h Copyright (c) Marcel P. Weiher 1999, All Rights Reserver, created on Sun 23-Aug-1998 */ 2 | 3 | #import 4 | 5 | @interface MPWXmlTag : NSObject 6 | { 7 | id name; 8 | } 9 | 10 | +tagWithName:aName; 11 | -name; 12 | @end 13 | -------------------------------------------------------------------------------- /MPWXmlTag.m: -------------------------------------------------------------------------------- 1 | /* MPWXmlTag.m Copyright (c) Marcel P. Weiher 1999, All Rights Reserver, created on Sun 23-Aug-1998 */ 2 | 3 | #import "MPWXmlTag.h" 4 | 5 | @implementation MPWXmlTag 6 | 7 | 8 | +tagWithName:aName 9 | { 10 | return [[[self alloc] initWithName:aName] autorelease]; 11 | } 12 | 13 | -initWithName:aName 14 | { 15 | self = [super init]; 16 | name = [aName retain]; 17 | return self; 18 | } 19 | 20 | -(void)dealloc 21 | { 22 | [name release]; 23 | [super dealloc]; 24 | } 25 | 26 | -description 27 | { 28 | return [NSString stringWithFormat:@"<%@>",name]; 29 | } 30 | 31 | -name 32 | { 33 | return name; 34 | } 35 | 36 | @end 37 | 38 | -------------------------------------------------------------------------------- /MPWXmlTag2ElementProcessor.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlTag2ElementProcessor.h Copyright (c) Marcel P. Weiher 1999, All Rights Reserver, created on Mon 12-Oct-1998 */ 2 | 3 | #import 4 | 5 | @interface MPWXmlTag2ElementProcessor : MPWHierarchicalStream 6 | { 7 | id entityStack; 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /MPWXmlTag2ElementProcessor.m: -------------------------------------------------------------------------------- 1 | /* MPWXmlTag2ElementProcessor.m Copyright (c) Marcel P. Weiher 1999, All Rights Reserver, created on Mon 12-Oct-1998 */ 2 | 3 | #import "MPWXmlTag2ElementProcessor.h" 4 | #import "MPWXmlElement.h" 5 | #import "MPWXmlScanner.h" 6 | #import 7 | 8 | @implementation MPWXmlTag2ElementProcessor 9 | 10 | -initWithTarget:aTarget 11 | { 12 | self = [super initWithTarget:aTarget]; 13 | entityStack = [[NSMutableArray alloc] init]; 14 | return self; 15 | } 16 | 17 | -(void)dealloc 18 | { 19 | [entityStack release]; 20 | [super dealloc]; 21 | } 22 | 23 | -(void)writeXmlStartTag:aTag 24 | { 25 | id element = [[MPWXmlElement alloc] initWithTag:aTag]; 26 | [self pushTarget:element]; 27 | [element release]; 28 | } 29 | 30 | -(void)writeXmlCloseTag:aTag 31 | { 32 | id lastTarget=[target retain]; 33 | [self popTarget]; 34 | [self writeObject:lastTarget]; 35 | [lastTarget release]; 36 | } 37 | 38 | @end 39 | 40 | @implementation MPWXmlTag2ElementProcessor(testing) 41 | 42 | +(NSString*)frameworkPath:(NSString*)aPath 43 | { 44 | return [[[NSBundle bundleForClass:self] resourcePath] stringByAppendingPathComponent:aPath]; 45 | } 46 | 47 | 48 | +testSelectors 49 | { 50 | return [NSArray arrayWithObject:@"testParserWithDefaultFile"]; 51 | } 52 | 53 | +(NSString*)defaultTestFileName 54 | { 55 | return [self frameworkPath:@"test1.xml"]; 56 | } 57 | 58 | +(void)testParserWithDefaultFile 59 | { 60 | id scanner = [MPWXmlScanner scannerWithData:[NSData dataWithContentsOfMappedFile:[self defaultTestFileName]]]; 61 | id result = [self process:scanner]; 62 | NSLog(@"result = %@",result); 63 | } 64 | 65 | 66 | 67 | @end 68 | 69 | -------------------------------------------------------------------------------- /MPWXmlUnarchiver.h: -------------------------------------------------------------------------------- 1 | /* MPWXmlUnarchiver.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 Sun 25-Jul-1999 */ 30 | 31 | #import "MPWXmlParser.h" 32 | 33 | 34 | @interface MPWXmlUnarchiver : MPWSAXParser 35 | { 36 | id target; 37 | NSMutableArray *objects; 38 | id holderCache,valueCache; 39 | char valueType; 40 | id currentValue; 41 | id decoder; 42 | id objectTable; 43 | int dataLen; 44 | } 45 | 46 | 47 | +unarchiveObjectWithData:(NSData*)archivedData; 48 | -unarchiveObjectWithData:(NSData*)archivedData; 49 | -initWithTarget:aTarget; 50 | 51 | -(void)setCurrentValue:someValue; 52 | 53 | -(void)makeValue:endName; 54 | 55 | - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)endName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName; 56 | 57 | @end 58 | 59 | @class ValueHolder,ObjectHolder; 60 | 61 | 62 | @interface XmlDecoder : NSCoder 63 | { 64 | ObjectHolder* currentObjectHolder; 65 | int currentValue; 66 | id currentObject; 67 | id classVersionTable; 68 | } 69 | -(unsigned)versionForClassName:(NSString*)className; 70 | -(void)decodeValueOfObjCType:(const char *)itemType at:(void*)address withName:(const char*)name; 71 | -(void)decodeArrayOfObjCType:(const char *)itemType count:(unsigned)count at:(void*)address withName:(const char*)name; 72 | -(void)decodeValueOfObjCType:(const char *)itemType at:(void*)address; 73 | -(void)decodeArrayOfObjCType:(const char *)itemType count:(unsigned)count at:(void*)address; 74 | -decodeDataObject; 75 | + (void)setDefaultVersion:(int)version forClass:(Class)aClass; 76 | 77 | @end 78 | 79 | @interface NSObject(xmlUnarchiving) 80 | 81 | -initWithXmlCoder:(NSCoder*)coder; 82 | +(BOOL)canHaveRecursiveReferences; 83 | +(void)setDefaultXmlVersion:(int)version; 84 | 85 | @end 86 | 87 | 88 | -------------------------------------------------------------------------------- /MPWXmlWrapperArchiver.h: -------------------------------------------------------------------------------- 1 | /* 2 | MPWXmlWrapperArchiver.h 3 | MPWXmlKit 4 | 5 | 6 | Copyright (c) 2001-2006 Marcel Weiher. All Rights Reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | 15 | Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the distribution. 18 | 19 | Neither the name Marcel Weiher nor the names of contributors may 20 | be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 33 | THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | 36 | */ 37 | #import 38 | 39 | 40 | @interface MPWXmlWrapperArchiver : MPWXmlArchiver { 41 | id datas; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /MPWXmlWrapperArchiver.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPWXmlWrapperArchiver.m 3 | // MPWXmlKit 4 | // 5 | // Created by marcel on Wed Aug 15 2001. 6 | /* Copyright (c) 2001 Marcel Weiher. All Rights Reserved. 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in 16 | the documentation and/or other materials provided with the distribution. 17 | 18 | Neither the name Marcel Weiher nor the names of contributors may 19 | be used to endorse or promote products derived from this software 20 | without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 32 | THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | 35 | */ 36 | 37 | #import "MPWXmlWrapperArchiver.h" 38 | #import "mpwfoundation_imports.h" 39 | #import "MPWXmlGeneratorStream.h" 40 | 41 | 42 | @implementation MPWXmlWrapperArchiver 43 | 44 | idAccessor( datas, setDatas ) 45 | 46 | -initWithTarget:newTarget 47 | { 48 | self = [super initWithTarget:newTarget]; 49 | [self setDatas:[NSMutableArray array]]; 50 | return self; 51 | } 52 | 53 | 54 | -(void)encodeDataObject:(NSData*)theObject 55 | { 56 | [target writeElementName:"datareference" attributes:[NSString stringWithFormat:@"length='%d'",(int)[theObject length]] contents:nil]; 57 | [datas addObject:theObject]; 58 | } 59 | 60 | -resultOfEncodingRootObject:root 61 | { 62 | id dict=[NSMutableDictionary dictionary]; 63 | int i; 64 | id base = [super resultOfEncodingRootObject:root]; 65 | [dict setObject:base forKey:@"document.xml"]; 66 | for (i=0;i<[datas count];i++) { 67 | [dict setObject:[datas objectAtIndex:i] 68 | forKey:[NSString stringWithFormat:@"data_%d.data",i]]; 69 | } 70 | return dict; 71 | } 72 | 73 | -(void)dealloc 74 | { 75 | [datas release]; 76 | [super dealloc]; 77 | } 78 | 79 | +testSelectors 80 | { 81 | return @[ 82 | ]; 83 | } 84 | 85 | 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /MPWXmlWrapperUnarchiver.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPWXmlWrapperUnarchiver.h 3 | // MPWXmlKit 4 | // 5 | /* Copyright 2001-2006 Marcel Weiher. All Rights Reserved. 6 | 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | 15 | Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in 17 | the documentation and/or other materials provided with the distribution. 18 | 19 | Neither the name Marcel Weiher nor the names of contributors may 20 | be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 33 | THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | 36 | */ 37 | #import 38 | 39 | 40 | @interface MPWXmlWrapperUnarchiver : MPWXmlUnarchiver { 41 | id datas; 42 | int currentData; 43 | } 44 | 45 | @end 46 | 47 | 48 | @interface XmlWrapperDecoder : XmlDecoder 49 | { 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /MPWXmlWrapperUnarchiver.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPWXmlWrapperUnarchiver.m 3 | // MPWXmlKit 4 | // 5 | // Created by marcel on Wed Aug 15 2001. 6 | /* Copyright (c) 2001 Marcel Weiher. All Rights Reserved. 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in 16 | the documentation and/or other materials provided with the distribution. 17 | 18 | Neither the name Marcel Weiher nor the names of contributors may 19 | be used to endorse or promote products derived from this software 20 | without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 32 | THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | 35 | */ 36 | 37 | #import "MPWXmlWrapperUnarchiver.h" 38 | #import "mpwfoundation_imports.h" 39 | 40 | @implementation XmlWrapperDecoder 41 | 42 | 43 | @end 44 | 45 | 46 | 47 | @implementation MPWXmlWrapperUnarchiver 48 | 49 | +_xmldecoder1 50 | { 51 | return [[XmlWrapperDecoder alloc] init]; 52 | } 53 | 54 | idAccessor( datas, setDatas ) 55 | 56 | -unarchiveObjectWithData:archivedDataArray 57 | { 58 | id mainData; 59 | if ( [archivedDataArray count] >1 ) { 60 | [self setDatas:[archivedDataArray subarrayWithRange:NSMakeRange(1,[archivedDataArray count]-1)]]; 61 | } 62 | // NSLog(@"archivedDatatArray has %d elements",[archivedDataArray count]); 63 | mainData = [archivedDataArray objectAtIndex:0]; 64 | // NSLog(@"got mainData"); 65 | return [super unarchiveObjectWithData:mainData]; 66 | } 67 | 68 | - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)endName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName 69 | { 70 | // NSLog(@"endElement:%@",endName); 71 | if ( [endName isEqual:@"datareference"] ) { 72 | // NSLog(@"got data reference"); 73 | [self setCurrentValue:[datas objectAtIndex:currentData++]]; 74 | [self makeValue:endName]; 75 | dataLen=0; 76 | } else { 77 | [super parser:parser didEndElement:endName namespaceURI:namespaceURI qualifiedName:qName]; 78 | } 79 | } 80 | 81 | 82 | -(void)dealloc 83 | { 84 | [datas release]; 85 | [super dealloc]; 86 | } 87 | +testSelectors 88 | { 89 | return @[ 90 | ]; 91 | } 92 | 93 | 94 | 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /NSString+extras.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | BSD License 4 | 5 | Copyright (c) 2002, Brent Simmons 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * Neither the name of ranchero.com or Brent Simmons nor the names of its 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 24 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 25 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | 32 | */ 33 | 34 | 35 | /* 36 | NSString+extras.h 37 | NetNewsWire 38 | 39 | Created by Brent Simmons on Fri Jun 14 2002. 40 | Copyright (c) 2002 Brent Simmons. All rights reserved. 41 | */ 42 | 43 | 44 | #import 45 | #import 46 | 47 | 48 | @interface NSString (extras) 49 | 50 | 51 | - (NSString *) trimWhiteSpace; 52 | 53 | - (NSString *) stripHTML; 54 | 55 | - (NSString *) ellipsizeAfterNWords: (int) n; 56 | 57 | + (BOOL) stringIsEmpty: (NSString *) s; 58 | 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Objective-XML-Concepts.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf240 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \vieww10680\viewh8400\viewkind0 5 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc 6 | 7 | \f0\b\fs48 \cf0 \ 8 | MPWXmlKit Overview\ 9 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc 10 | 11 | \b0\fs28 \cf0 Marcel Weiher\ 12 | metaobject ltd. 13 | \fs48 \ 14 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 15 | 16 | \fs24 \cf0 \ 17 | 18 | \b \ 19 | 20 | \b0 \ 21 | \ 22 | This is an overview over the concepts and services provided by the framework MPWXmlKit, which is intended to provide various XML-related services including but not limited to parsing and generation of XML documents.\ 23 | \ 24 | 25 | \b Services 26 | \b0 \ 27 | \ 28 | The primary services provided are high performance XML parsing and generation.\ 29 | \ 30 | \ 31 | Possible future extensions include support for transformation + navigation using XSLT, XPath, XPath etc. Parsers for specific XML-based formats will probably not be added to the kit but built on top of it.\ 32 | \ 33 | \ 34 | 35 | \b Goals 36 | \b0 \ 37 | \ 38 | - Suitable not just for applications but also for XML-processors\ 39 | - Suitable for partial processing of documents\ 40 | - 100% bit-fidelity to original document possible\ 41 | - Highest possible performance, with a "pay as you go" policy:\ 42 | - you only pay a cost in performance if you actually use a feature\ 43 | - Simple, fully OO interfaces\ 44 | \ 45 | In order to achieve these goals, full conformance to the XML specification has been sacrificed where necessary. For example, XML-parsers are required to to resolve entity references, which makes reconstructing the exact original input difficult to impossible.\ 46 | \ 47 | 48 | \b Design Overview 49 | \b0 \ 50 | \ 51 | Seen from the bottom up, MPWXmlScanner turns XML-characters into messages sent to self delimiting specific regions of interest within the XML-data using straight C pointers. At the next higher level, the MPWXmlParser subclass of MPWXmlScanner turns these call-backs into SAX-style messages (sent to a delegate) with real objects for the top-level syntactic entities (roughly: tags, data) and checks for proper tag-nesting.\ 52 | \ 53 | The specific parsers (DOM, plist, archiver) provided here act as their own delegates, but this need not be the case, parser-delegates can just as well be different objects. \ 54 | \ 55 | 56 | \b Implementation Notes 57 | \b0 \ 58 | \ 59 | Object-caches are used extensively so real objects can be used in all high-level interfaces without sacrifcing performance. The same idea applies to the extensive use of IMP caching and messaging. \ 60 | \ 61 | 62 | \b Issues/Caveats 63 | \b0 \ 64 | \ 65 | -Currently, only scans/parses a single piece of data, support for stream-data sources is being considered but there are still issues to resolve.\ 66 | -Whitespace detection is presently disabled. \ 67 | -Entity-references are not handled (only detected).\ 68 | - Parsers are MPWStreams, the parsed data has to be retrieved from the NSMutableArray that is their default target\ 69 | } -------------------------------------------------------------------------------- /ObjectiveXML.h: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectiveXML.h 3 | // ObjectiveXML 4 | // 5 | // Created by Marcel Weiher on 9/14/18. 6 | // 7 | 8 | #ifndef ObjectiveXML_h 9 | #define ObjectiveXML_h 10 | 11 | #import "ObjectiveXML/MPWMAXParser.h" 12 | 13 | #endif /* ObjectiveXML_h */ 14 | -------------------------------------------------------------------------------- /ObjectiveXML.map: -------------------------------------------------------------------------------- 1 | 2 | framework module ObjectiveXML { 3 | umbrella header "ObjectiveXML.h" 4 | module * { export * } 5 | export * 6 | 7 | } 8 | 9 | -------------------------------------------------------------------------------- /ObjectiveXML.xcodeproj/xcshareddata/xcschemes/MPWXmlKit (Linux).xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 52 | 53 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /ObjectiveXML.xcodeproj/xcshareddata/xcschemes/ObjectiveXML.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 52 | 53 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /ObjectiveXML.xcodeproj/xcshareddata/xcschemes/masonrunner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ObjectiveXML.xcodeproj/xcuserdata/marcel.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /ObjectiveXML.xcodeproj/xcuserdata/marcel.xcuserdatad/xcschemes/ObjectiveXMLTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ObjectiveXML.xcodeproj/xcuserdata/marcel.xcuserdatad/xcschemes/ObjectiveXMLTouch.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 54 | 55 | 61 | 62 | 63 | 64 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /ObjectiveXML.xcodeproj/xcuserdata/marcel.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MPWXmlKit (Linux).xcscheme_^#shared#^_ 8 | 9 | isShown 10 | 11 | orderHint 12 | 34 13 | 14 | ObjectiveXML.xcscheme_^#shared#^_ 15 | 16 | orderHint 17 | 39 18 | 19 | ObjectiveXMLTests.xcscheme 20 | 21 | isShown 22 | 23 | orderHint 24 | 101 25 | 26 | ObjectiveXMLTouch.xcscheme 27 | 28 | isShown 29 | 30 | orderHint 31 | 67 32 | 33 | masonrunner.xcscheme_^#shared#^_ 34 | 35 | orderHint 36 | 113 37 | 38 | swiftdecoder.xcscheme_^#shared#^_ 39 | 40 | orderHint 41 | 114 42 | 43 | 44 | SuppressBuildableAutocreation 45 | 46 | 1F2553E80D627362007D8DAF 47 | 48 | primary 49 | 50 | 51 | 1F3C7B44136FE2EF009C0697 52 | 53 | primary 54 | 55 | 56 | 1F4B0F610DBEB75A00639DC0 57 | 58 | primary 59 | 60 | 61 | 1F5752D922C3726900EB658E 62 | 63 | primary 64 | 65 | 66 | 1F5752E822C383D200EB658E 67 | 68 | primary 69 | 70 | 71 | 1F5A6CAA1170104300E4A959 72 | 73 | primary 74 | 75 | 76 | 1F5ED2201FDBCDBB001D28FB 77 | 78 | primary 79 | 80 | 81 | 1F81BFF3196992370066DF43 82 | 83 | primary 84 | 85 | 86 | 1F81BFFD196992380066DF43 87 | 88 | primary 89 | 90 | 91 | 1F96E5C409B62F5C0063D669 92 | 93 | primary 94 | 95 | 96 | 1FB43B5510BFB6EF00490AA6 97 | 98 | primary 99 | 100 | 101 | 1FD564AB0E2ECB2D00607D4E 102 | 103 | primary 104 | 105 | 106 | 1FD5DAFF0F2CEDB000F8F769 107 | 108 | primary 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /ObjectiveXMLTests/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ObjectiveXMLTests 4 | // 5 | // Created by Marcel Weiher on 12/9/17. 6 | // 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (strong, nonatomic) UIWindow *window; 13 | 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /ObjectiveXMLTests/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ObjectiveXMLTests 4 | // 5 | // Created by Marcel Weiher on 12/9/17. 6 | // 7 | 8 | #import "AppDelegate.h" 9 | #import 10 | #import 11 | #import 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | int runTests( NSArray *testSuiteNames , NSMutableArray *testTypeNames, BOOL verbose ,BOOL veryVerbose ) { 21 | NSMutableArray *testsuites=[NSMutableArray array]; 22 | MPWTestSuite* test; 23 | MPWLoggingTester* results; 24 | int exitCode=0; 25 | 26 | // if ( [testTypeNames count] == 0 ) { 27 | // testTypeNames=[testTypeNames arrayByAddingObject:@"testSelectors"]; 28 | // } 29 | // for ( id suitename in testSuiteNames ) { 30 | // id suite = [MPWTestSuite testSuiteForLocalFramework:suitename testTypes:testTypeNames]; 31 | // // NSLog(@"suite name= %@",suitename); 32 | // // NSLog(@"suite = %@",suite); 33 | // if ( suite ) { 34 | // [testsuites addObject:suite]; 35 | // } else { 36 | // NSLog(@"couldn't load framework: %@",suitename); 37 | // } 38 | // 39 | // } 40 | NSArray *classNamesToTest= 41 | @[ 42 | @"MPWMAXParser", 43 | @"NSXMLScanner", 44 | @"MPWXMLAttributes", 45 | ]; 46 | NSMutableArray *mirrors=[NSMutableArray array]; 47 | for ( NSString *className in classNamesToTest ) { 48 | [mirrors addObject:[MPWClassMirror mirrorWithClass:NSClassFromString( className)]]; 49 | } 50 | 51 | test=[MPWTestSuite testSuiteWithName:@"all" classMirrors:mirrors testTypes:@[ @"testSelectors"]]; 52 | 53 | 54 | 55 | // test=[MPWTestSuite testSuiteWithName:@"all" testCases:@[]]; 56 | // NSLog(@"test: %@",test); 57 | results=[[MPWLoggingTester alloc] init]; 58 | [results setVerbose:veryVerbose]; 59 | fprintf(stderr,"Will run %d tests\n",[test numberOfTests]); 60 | [results addToTotalTests:[test numberOfTests]]; 61 | [test runTest:results]; 62 | if ( !veryVerbose ){ 63 | if ( verbose) { 64 | [results printAllResults]; 65 | } else { 66 | [results printResults]; 67 | } 68 | } 69 | if ( [results failureCount] >0 ) { 70 | exitCode=1; 71 | } 72 | return exitCode; 73 | } 74 | 75 | 76 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 77 | 78 | runTests( @[ @"MPWFoundation"], @[] , NO, NO); 79 | return YES; 80 | } 81 | 82 | 83 | @end 84 | 85 | -------------------------------------------------------------------------------- /ObjectiveXMLTests/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /ObjectiveXMLTests/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ObjectiveXMLTests/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ObjectiveXMLTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ObjectiveXMLTests/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ObjectiveXMLTests 4 | // 5 | // Created by Marcel Weiher on 12/9/17. 6 | // 7 | 8 | #import 9 | 10 | @interface ViewController : UIViewController 11 | 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /ObjectiveXMLTests/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ObjectiveXMLTests 4 | // 5 | // Created by Marcel Weiher on 12/9/17. 6 | // 7 | 8 | #import "ViewController.h" 9 | 10 | @interface ViewController () 11 | 12 | @end 13 | 14 | @implementation ViewController 15 | 16 | - (void)viewDidLoad { 17 | [super viewDidLoad]; 18 | // Do any additional setup after loading the view, typically from a nib. 19 | } 20 | 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /ObjectiveXMLTests/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ObjectiveXMLTests 4 | // 5 | // Created by Marcel Weiher on 12/9/17. 6 | // 7 | 8 | #import 9 | #import "AppDelegate.h" 10 | 11 | int main(int argc, char * argv[]) { 12 | @autoreleasepool { 13 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ObjectiveXMLTouch/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ObjectiveXMLTouch/ObjectiveXMLTouch.h: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectiveXMLTouch.h 3 | // ObjectiveXMLTouch 4 | // 5 | // Created by Marcel Weiher on 7/6/14. 6 | // 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for ObjectiveXMLTouch. 12 | FOUNDATION_EXPORT double ObjectiveXMLTouchVersionNumber; 13 | 14 | //! Project version string for ObjectiveXMLTouch. 15 | FOUNDATION_EXPORT const unsigned char ObjectiveXMLTouchVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /ObjectiveXMLTouchTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.metaobject.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ObjectiveXMLTouchTests/ObjectiveXMLTouchTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectiveXMLTouchTests.m 3 | // ObjectiveXMLTouchTests 4 | // 5 | // Created by Marcel Weiher on 7/6/14. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface ObjectiveXMLTouchTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ObjectiveXMLTouchTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | XCTAssert(YES, @"Pass"); 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /PBUserInfo/PBUserInfo_marcel.plist: -------------------------------------------------------------------------------- 1 | { 2 | NSMACHOperatingSystem = { 3 | Archs = "18 "; 4 | LauncherSelectedExec = (/usr/local/bin/testlogger); 5 | NonProjectExecutables = ( 6 | { 7 | cla_array = ((/Local/Users/marcel/programming/Projects/htmlscan/NSStandardSubmenus.xml)); 8 | cla_array_index = 0; 9 | exec_class = PBLibExecutable; 10 | exec_path = /Users/marcel/programming/Projects/htmlscan/htmlscan; 11 | }, 12 | { 13 | cla_array = ((MPWFoundation, MPWXmlKit, MPWTemplateKit)); 14 | cla_array_index = 0; 15 | exec_class = PBLibExecutable; 16 | exec_path = /usr/local/bin/testlogger; 17 | } 18 | ); 19 | Target = framework; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Objective-XML 2 | 3 | 4 | This project has been merged into MPWFoundation so is obsolete as a stand-alone project. 5 | 6 | 7 | 8 | Flexible, powerful and *fast* XML tools for Objective-C. Provides a single API that can be NSXMLParser-compatible (just a lot faster) 9 | DOM-compatible (similar to NSXMLDocument) or generate custom objects directly, with the ability to mix-and-match as needed. 10 | 11 | 12 | 13 | 14 | Detailed explanation in Chapter 4 of my book: 15 | 16 | http://blog.metaobject.com/2017/03/so-i-wrote-book-about-performance.html 17 | -------------------------------------------------------------------------------- /TestResources/CricketFeedTest.fi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/CricketFeedTest.fi -------------------------------------------------------------------------------- /TestResources/Dg-duplex.htm: -------------------------------------------------------------------------------- 1 | Duplex Printing & Margin 2 | -------------------------------------------------------------------------------- /TestResources/Faehre-iso.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/Faehre-iso.xml -------------------------------------------------------------------------------- /TestResources/Faehre.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /TestResources/JapTitle.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | iTUNESソフトウェア使用許諾契約 7 | 8 | -------------------------------------------------------------------------------- /TestResources/Package-org.xml.sax.helpers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Package org.xml.sax.helpers 8 | 9 | 10 | 11 | 12 |
All Packages  Class Hierarchy  Index
13 |
14 |

15 | package org.xml.sax.helpers 16 |

17 |

18 | Class Index 19 |

20 | 21 |
  • AttributeListImpl 22 |
  • LocatorImpl 23 |
  • ParserFactory 24 |
  • 25 | 26 | 27 | -------------------------------------------------------------------------------- /TestResources/Package-org.xml.sax.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Package org.xml.sax 8 | 9 | 10 | 11 | 12 |
    All Packages  Class Hierarchy  Index
    13 |
    14 |

    15 | package org.xml.sax 16 |

    17 |

    18 | Interface Index 19 |

    20 | 21 |
  • AttributeList 22 |
  • DTDHandler 23 |
  • DocumentHandler 24 |
  • EntityResolver 25 |
  • ErrorHandler 26 |
  • Locator 27 |
  • Parser 28 |
  • 29 |

    30 | Class Index 31 |

    32 | 33 |
  • HandlerBase 34 |
  • InputSource 35 |
  • 36 |

    37 | Exception Index 38 |

    39 | 40 |
  • SAXException 41 |
  • SAXParseException 42 |
  • 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 | 2 | Download Part 2 3 | 4 | -------------------------------------------------------------------------------- /TestResources/c1qt12.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/c1qt12.html -------------------------------------------------------------------------------- /TestResources/c1qt12.txt: -------------------------------------------------------------------------------- 1 | ÄÖ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/categories.atom: -------------------------------------------------------------------------------- 1 | 2 | 3 | Categories 4 | tag:livescribe.com,2010-12-14:/services/community/pencast/categories 5 | 2010-12-15T01:38:56Z 6 | 7 | Random 8 | 9 | 10 | 11 | Creative 12 | 13 | 14 | 15 | How-Tos 16 | 17 | 18 | 19 | Business 20 | 21 | 22 | 23 | Fun Stuff 24 | 25 | 26 | 27 | Cartoons 28 | 29 | 30 | 31 | Blogs 32 | 33 | 34 | 35 | Academic 36 | 37 | 38 | 39 | Unspecified 40 | 41 | 42 | 43 | Moments 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /TestResources/cdatatest1.xml: -------------------------------------------------------------------------------- 1 | and stuff]]> -------------------------------------------------------------------------------- /TestResources/checkForPenApps_with_ISO8859_claiming_UTF8.xmlrpc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/checkForPenApps_with_ISO8859_claiming_UTF8.xmlrpc -------------------------------------------------------------------------------- /TestResources/close_tag_not_closed.html: -------------------------------------------------------------------------------- 1 | Some textmore bold 2 | -------------------------------------------------------------------------------- /TestResources/close_tag_not_closed.txt: -------------------------------------------------------------------------------- 1 | Some textmore bold 2 | -------------------------------------------------------------------------------- /TestResources/decor.html: -------------------------------------------------------------------------------- 1 | Décor what's -------------------------------------------------------------------------------- /TestResources/decor.txt: -------------------------------------------------------------------------------- 1 | Décor what's -------------------------------------------------------------------------------- /TestResources/dict.json: -------------------------------------------------------------------------------- 1 | { "key": "value" } -------------------------------------------------------------------------------- /TestResources/dictAfterNumber.json: -------------------------------------------------------------------------------- 1 | ["a", 1,{"c":2},"d",3] -------------------------------------------------------------------------------- /TestResources/duplex.htm: -------------------------------------------------------------------------------- 1 | Duplex Printing & Margin 2 | -------------------------------------------------------------------------------- /TestResources/emptyElementWithAttribute.fi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/emptyElementWithAttribute.fi -------------------------------------------------------------------------------- /TestResources/emptyElementWithAttribute.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TestResources/empty_elements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSRequiresCarbon 6 | 7 | LSRequiresNativeExecution 8 | 9 | QuartzGLEnable 10 | 11 | DummyInteger42 12 | 13 | 14 | -------------------------------------------------------------------------------- /TestResources/empty_html.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TestResources/empty_html.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TestResources/emptyelement.fi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/emptyelement.fi -------------------------------------------------------------------------------- /TestResources/emptyelement.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TestResources/emptyelements.json: -------------------------------------------------------------------------------- 1 | [ {}, [], "" ] -------------------------------------------------------------------------------- /TestResources/emptytagwithattribute.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TestResources/entity_runon.html: -------------------------------------------------------------------------------- 1 | Some & entity; 2 | -------------------------------------------------------------------------------- /TestResources/entity_runon.txt: -------------------------------------------------------------------------------- 1 | Some & entity; 2 | -------------------------------------------------------------------------------- /TestResources/getDictRequest.xmlrpc: -------------------------------------------------------------------------------- 1 | 2 | getADict -------------------------------------------------------------------------------- /TestResources/getDictResponse.xmlrpc: -------------------------------------------------------------------------------- 1 | 2 | Some double47.11Some integer42Date20090414T19:12:45Stringhello world -------------------------------------------------------------------------------- /TestResources/getListResponse.xmlrpc: -------------------------------------------------------------------------------- 1 | first string element4220010110T12:59:08 -------------------------------------------------------------------------------- /TestResources/getSimpleDictResponse.xmlrpc: -------------------------------------------------------------------------------- 1 | 2 | Number (double)512.45Number (int)123Stringhello world -------------------------------------------------------------------------------- /TestResources/glossary.json: -------------------------------------------------------------------------------- 1 | { 2 | "glossary": { 3 | "title": "example glossary", 4 | "GlossDiv": { 5 | "title": "S", 6 | "GlossList": { 7 | "GlossEntry": { 8 | "ID": "SGML", 9 | "SortAs": "SGML", 10 | "GlossTerm": "Standard Generalized Markup Language", 11 | "Acronym": "SGML", 12 | "Abbrev": "ISO 8879:1986", 13 | "GlossDef": { 14 | "para": "A meta-markup language, used to create markup languages such as DocBook.", 15 | "GlossSeeAlso": ["GML", "XML"] 16 | }, 17 | "GlossSee": "markup" 18 | } 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /TestResources/hreftest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | content 4 | content 5 | content 6 | content 7 | 8 | -------------------------------------------------------------------------------- /TestResources/html_comment_with_dash.html: -------------------------------------------------------------------------------- 1 | beforemidafter -------------------------------------------------------------------------------- /TestResources/html_comment_with_dash.txt: -------------------------------------------------------------------------------- 1 | beforemidafter -------------------------------------------------------------------------------- /TestResources/html_text_through_tag.html: -------------------------------------------------------------------------------- 1 | Some.method(); 2 | -------------------------------------------------------------------------------- /TestResources/html_text_through_tag.txt: -------------------------------------------------------------------------------- 1 | Some.method(); 2 | -------------------------------------------------------------------------------- /TestResources/html_with_javascript.html: -------------------------------------------------------------------------------- 1 | Some text. 2 | -------------------------------------------------------------------------------- /TestResources/html_with_javascript.txt: -------------------------------------------------------------------------------- 1 | Some text. 2 | -------------------------------------------------------------------------------- /TestResources/htmlfragment_attribute_no_value.html: -------------------------------------------------------------------------------- 1 | abc 2 | -------------------------------------------------------------------------------- /TestResources/htmlfragment_entities.html: -------------------------------------------------------------------------------- 1 | Apple Applications > and more -------------------------------------------------------------------------------- /TestResources/htmlfragment_unquoted_attr_values.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TestResources/iso-encoded.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/iso-encoded.xml -------------------------------------------------------------------------------- /TestResources/jap-pto-other-meta.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/jap-pto-other-meta.html -------------------------------------------------------------------------------- /TestResources/jap-pto-other-meta.txt: -------------------------------------------------------------------------------- 1 | (C)Copyright:2006 特許庁 2 | 3 | -------------------------------------------------------------------------------- /TestResources/jap-pto.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/jap-pto.html -------------------------------------------------------------------------------- /TestResources/jap-pto.html-1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/jap-pto.html-1 -------------------------------------------------------------------------------- /TestResources/jap-pto.txt: -------------------------------------------------------------------------------- 1 | (C)Copyright:2006 特許庁 2 | 3 | -------------------------------------------------------------------------------- /TestResources/jap-pto_all_upcase_meta.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/jap-pto_all_upcase_meta.html -------------------------------------------------------------------------------- /TestResources/jap-pto_all_upcase_meta.txt: -------------------------------------------------------------------------------- 1 | (C)Copyright:2006 特許庁 2 | 3 | -------------------------------------------------------------------------------- /TestResources/jap-pto_upcase_meta.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/jap-pto_upcase_meta.html -------------------------------------------------------------------------------- /TestResources/jap-pto_upcase_meta.txt: -------------------------------------------------------------------------------- 1 | (C)Copyright:2006 特許庁 2 | 3 | -------------------------------------------------------------------------------- /TestResources/literals.json: -------------------------------------------------------------------------------- 1 | [ true, false, null ] -------------------------------------------------------------------------------- /TestResources/loginRequest.xmlrpc: -------------------------------------------------------------------------------- 1 | 2 | loginuserNamepasswordpasswordBla -------------------------------------------------------------------------------- /TestResources/meta_attributes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Test of HTML metadata 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 20 | 21 | 22 |

    Here is a test of HTML with metadata.

    23 | 24 | 25 | -------------------------------------------------------------------------------- /TestResources/metadata_unicode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | وثفشيشفش 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 |

    Here is a test of HTML with metadata.

    16 | 17 | 18 | -------------------------------------------------------------------------------- /TestResources/metadata_unicode_utf16.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/metadata_unicode_utf16.txt -------------------------------------------------------------------------------- /TestResources/mojibake_utf16.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/mojibake_utf16.txt -------------------------------------------------------------------------------- /TestResources/mojibake_utf8.xhtml: -------------------------------------------------------------------------------- 1 | Mac ヘルプ
    Mac ヘルプのアイコン

    Mac ヘルプ

    Leopard の新機能
    重要な新機能について理解します。

    Finder について
    「Finder」は、ファイル、アプリケーション、ディスク、ネットワーク接続、およびプリンタなどの装置を管理する場所です。

    Mac OS X を操作してみる
    Mac OS X をはじめてお使いになり、操作を知りたいユーザは、ここからはじめるとよいでしょう。

    -------------------------------------------------------------------------------- /TestResources/naked_html_fragment.html: -------------------------------------------------------------------------------- 1 | We start with some text. some bold text 2 | -------------------------------------------------------------------------------- /TestResources/naked_html_fragment.txt: -------------------------------------------------------------------------------- 1 | We start with some text. some bold text 2 | -------------------------------------------------------------------------------- /TestResources/nested.xml: -------------------------------------------------------------------------------- 1 | contentcontent1 -------------------------------------------------------------------------------- /TestResources/no_space_between_attributes.html: -------------------------------------------------------------------------------- 1 | beforeafter -------------------------------------------------------------------------------- /TestResources/no_space_between_attributes.txt: -------------------------------------------------------------------------------- 1 | beforeafter -------------------------------------------------------------------------------- /TestResources/numbers.json: -------------------------------------------------------------------------------- 1 | [ 1 2 42 0.0483506434568948 ] -------------------------------------------------------------------------------- /TestResources/numericEntities.xml: -------------------------------------------------------------------------------- 1 | 2 | 01 3 | -------------------------------------------------------------------------------- /TestResources/packages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Package Index 8 | 9 | 10 | 11 | 12 |
    API User's Guide  Class Hierarchy  Index

    13 |

    14 | Package Index 15 |

    16 |

    Other Packages

    17 | 18 |
  • package org.xml.sax 19 |
  • package org.xml.sax.helpers 20 |
  • 21 | 22 | 23 | -------------------------------------------------------------------------------- /TestResources/responseWithAmpersands.xmlrpc: -------------------------------------------------------------------------------- 1 | serverMessageblub0someLinkhttp://www.example.com/cgi-bin/mySuperCGI/pageName?source=asdfasdeiasdgkvMpz10f&data_one=OPOT&data_two=Testing One Two Three -------------------------------------------------------------------------------- /TestResources/session.xml: -------------------------------------------------------------------------------- 1 | 2 | 09.03.2008 02:46:44 PM 3 | 2556834 4 | 10948027285 5 | 10950584119 6 | 1220449604362 7 | 8 | 9 | 10948027575 10 | 10950584119 11 | 12 | 13 | 14 | 15 | 10948027285 16 | 10948027285 17 | 10950584119 18 | 16 19 | 0xc2d51549935cbe60 20 | 0 21 | 0 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /TestResources/simple-xml-with-namespaces.fi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/simple-xml-with-namespaces.fi -------------------------------------------------------------------------------- /TestResources/simple-xml-with-namespaces.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 2920186 6 | API/NSXMLParser: there ought to be an NSXMLParser 7 | 8 | -------------------------------------------------------------------------------- /TestResources/space_before_tag_close.html: -------------------------------------------------------------------------------- 1 | beforeafter -------------------------------------------------------------------------------- /TestResources/space_before_tag_close.txt: -------------------------------------------------------------------------------- 1 | beforeafter -------------------------------------------------------------------------------- /TestResources/states.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /TestResources/string.json: -------------------------------------------------------------------------------- 1 | "A JSON String" -------------------------------------------------------------------------------- /TestResources/stringLengthRequest.xmlrpc: -------------------------------------------------------------------------------- 1 | 2 | lengthOfStringhello world -------------------------------------------------------------------------------- /TestResources/stringLengthResponse.xmlrpc: -------------------------------------------------------------------------------- 1 | 4 -------------------------------------------------------------------------------- /TestResources/stringLengthResponse1.xmlrpc: -------------------------------------------------------------------------------- 1 | 12 -------------------------------------------------------------------------------- /TestResources/stringescapes.json: -------------------------------------------------------------------------------- 1 | [ "\"", "\\" , "\/", "\b", "\f", "\n", "\r", "\t" ] -------------------------------------------------------------------------------- /TestResources/tagconflict_disambiguated_by_namespace.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | First Title 5 | Second Title 6 | 7 | -------------------------------------------------------------------------------- /TestResources/test1.fi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/test1.fi -------------------------------------------------------------------------------- /TestResources/test1.h: -------------------------------------------------------------------------------- 1 | /* test1.h created by marcel on Mon 24-Aug-1998 */ 2 | 3 | #import 4 | 5 | @interface test1 : NSObject 6 | { 7 | 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /TestResources/test1.result: -------------------------------------------------------------------------------- 1 | ( 2 | "", 3 | "\n", 4 | "", 5 | "\n", 6 | "", 7 | "Hello, ", 8 | "&cruel;", 9 | " world!", 10 | "", 11 | "\n" 12 | ) 13 | -------------------------------------------------------------------------------- /TestResources/test1.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TestResources/test1.xml.MPWXmlScanner-result: -------------------------------------------------------------------------------- 1 | ("", "\n", "", "\n") 2 | -------------------------------------------------------------------------------- /TestResources/test2.fi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/test2.fi -------------------------------------------------------------------------------- /TestResources/test2.xml: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /TestResources/test3.fi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/test3.fi -------------------------------------------------------------------------------- /TestResources/test3.xml: -------------------------------------------------------------------------------- 1 | contentcontent1 2 | -------------------------------------------------------------------------------- /TestResources/test3_16bit.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpw/Objective-XML/c2ec5ff57a02127c56571553b315c0b9431a13fc/TestResources/test3_16bit.xml -------------------------------------------------------------------------------- /TestResources/test4.xml: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /TestResources/textwith_br.html: -------------------------------------------------------------------------------- 1 | Some text
    More Text
    2 | -------------------------------------------------------------------------------- /TestResources/textwith_br.txt: -------------------------------------------------------------------------------- 1 | Some text 2 | More Text 3 | 4 | -------------------------------------------------------------------------------- /TestResources/textwith_headings.html: -------------------------------------------------------------------------------- 1 |

    Heading 1

    Heading 2

    Heading 3

    Heading 4

    Heading 5
    Heading 6
    2 | -------------------------------------------------------------------------------- /TestResources/textwith_headings.txt: -------------------------------------------------------------------------------- 1 | Heading 1 2 | Heading 2 3 | Heading 3 4 | Heading 4 5 | Heading 5 6 | Heading 6 7 | 8 | -------------------------------------------------------------------------------- /TestResources/textwith_multiple_body.html: -------------------------------------------------------------------------------- 1 | First segment second segment third segment 2 | -------------------------------------------------------------------------------- /TestResources/textwith_multiple_body.txt: -------------------------------------------------------------------------------- 1 | First segment second segment third segment 2 | -------------------------------------------------------------------------------- /TestResources/textwith_p.html: -------------------------------------------------------------------------------- 1 | Par 1

    Par 2

    After Par2 2 | -------------------------------------------------------------------------------- /TestResources/textwith_p.txt: -------------------------------------------------------------------------------- 1 | Par 1 2 | Par 2 3 | After Par2 4 | -------------------------------------------------------------------------------- /TestResources/textwith_td.html: -------------------------------------------------------------------------------- 1 |
    Row 1Column2
    2 | -------------------------------------------------------------------------------- /TestResources/textwith_td.txt: -------------------------------------------------------------------------------- 1 | Row 1 2 | Column2 3 | 4 | -------------------------------------------------------------------------------- /TestResources/textwith_th.html: -------------------------------------------------------------------------------- 1 |
    Row 1Column2
    2 | -------------------------------------------------------------------------------- /TestResources/textwith_th.txt: -------------------------------------------------------------------------------- 1 | Row 1 2 | Column2 3 | 4 | -------------------------------------------------------------------------------- /TestResources/tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Class Hierarchy 8 | 9 | 10 | 11 | 12 |
    All Packages  Index

    13 |

    14 | Class Hierarchy 15 |

    16 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /TestResources/unicodeescapes.json: -------------------------------------------------------------------------------- 1 | [ "\u1234" , "\u000a" ] -------------------------------------------------------------------------------- /TestResources/utf8xhtml_test.html: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | 7 | XHTML/UTF-8 Test Page 8 | 9 | 10 | 11 |

    XHTML/UTF-8 Test Page

    12 | 13 |

    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 | --------------------------------------------------------------------------------