SlideShare une entreprise Scribd logo
1  sur  6
//
//   ProdAttributeAccess.m
//   Office
//

//   Copyright (c) 2012 Sovoia. All rights reserved.
//

//
//   ProdAttributeAccess.m//   Office
//
//   Created by SMonte Developer on 11/16/10.
//   Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "ProdAttributeAccess.h"
//#import "ProdAttribute.h"

@implementation ProdAttributeAccess
@synthesize productLongDesc,productShortDesc,prodBrand;
@synthesize displayURL, prodStyleCode, colourCode,prodWasPrice, prodColour,
prodPrice, imgURLthumb, prodTitle, fullSkuNumber;

- (id) init
{
      if(self = [super init])
      {
            sizesArray = [[NSMutableArray alloc]init];
            skuArray = [[NSMutableArray alloc]init];
            found = YES;
            errorResponse = [[NSString alloc]initWithString:@""];
            displayURL = [[NSString alloc]initWithString:@""];
            prodBrand =[[NSString alloc]initWithString:@""];
            prodStyleCode = [[NSString alloc]initWithString:@""];
            colourCode =@"";
        prodColour = [[NSString alloc]initWithString:@""];
            prodPrice = [[NSString alloc]initWithString:@""];
            prodWasPrice = @"";
            prodTitle = [[NSString alloc]initWithString:@""];
            imgURLthumb = [[NSString alloc]initWithString:@""];
            fullSkuNumber = [[NSString alloc]initWithString:@""];

      }
      return self;
}




- (BOOL)parseXMLFileAtURL:(NSString *)URL
{

     NSURL *xmlURL = [NSURL URLWithString:URL];
       NSXMLParser*parser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL];
     [parser setDelegate:self];
     [parser setShouldProcessNamespaces:YES];
     [parser setShouldReportNamespacePrefixes:YES];
     [parser setShouldResolveExternalEntities:NO];
       BOOL success =[parser parse];
     [parser release];
     return success;

}
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
 qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary
*)attributeDict{

     if(nil != qualifiedName){
           elementName = qualifiedName;
     }

      if ([elementName isEqualToString:@"msg"]||[elementName
isEqualToString:@"Short_Description"]
        || [elementName isEqualToString:@"Long_Description"]||[elementName
isEqualToString:@"displayurl"]
        ||[elementName isEqualToString:@"title"]||[elementName
isEqualToString:@"imageurlthumb"]
        ||[elementName isEqualToString:@"retailprice"] || [elementName
isEqualToString:@"wasprice"]
        ||[elementName isEqualToString:@"STYLECODE"]||[elementName
isEqualToString:@"BRAND"]||[elementName isEqualToString:@"COLOUR"]||
        [elementName isEqualToString:@"name"])
      {
            productAttrNode = [NSMutableString string];
      }

    else if([elementName isEqualToString:@"value"])
    {
        productAttrNode = [NSMutableString string];
        if ([attributeDict objectForKey:@"sku"]) {
            //skuValue = [NSMutableString stringWithString:[attributeDict
objectForKey:@"sku"]];
            NSString *sku = [attributeDict objectForKey:@"sku"];
            fullSkuNumber = sku;
            [skuArray addObject:sku];
           // NSLog(@"Sku : %@",[attributeDict objectForKey:@"sku"]);
        }
    }
      else
      {
            productAttrNode = nil;
      }
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
      if(nil != qName){
            elementName = qName;
      }
      if([elementName isEqualToString:@"msg"])
      {
            errorResponse = productAttrNode;
      }
      else if([elementName isEqualToString:@"Short_Description"])
      {
            productShortDesc = productAttrNode;

     }
     else if([elementName isEqualToString:@"Long_Description"])
     {
           productLongDesc = productAttrNode;
     }
     else if([elementName isEqualToString:@"title"])
     {
       //        NSLog(@"title in XML: %@",productAttrNode);
prodTitle = productAttrNode;
}
else if([elementName isEqualToString:@"displayurl"])
{
      displayURL = productAttrNode;
}
else if([elementName isEqualToString:@"imageurlthumb"])
{
      imgURLthumb = productAttrNode;
}
else if([elementName isEqualToString:@"retailprice"])
{
      prodPrice = productAttrNode;
}
else if([elementName isEqualToString:@"wasprice"])
{
      prodWasPrice = productAttrNode;
}
else if([elementName isEqualToString:@"name"])
{
      if([productAttrNode isEqualToString:@"SIZE"])
      {
      fullSkufound = YES;
            found = YES;
      }
      else {
      fullSkufound = NO;
            found = NO;
      }
      if([productAttrNode isEqualToString:@"STYLECODE"])
      {
            styleCodeFound = YES;
      }
      else {

           styleCodeFound = NO;
     }
     if([productAttrNode isEqualToString:@"LEGACYCOLOURCODE"])
     {
           colourCodeFound = YES;
     }
     else {

           colourCodeFound = NO;
     }
     if([productAttrNode isEqualToString:@"BRAND"])
     {
           brandFound = YES;
     }
     else {

           brandFound = NO;
     }
     if([productAttrNode isEqualToString:@"COLOUR"])
     {
           colourFound = YES;
     }
     else {

           colourFound = NO;
     }
     if([productAttrNode isEqualToString:@"Price"])
     {
           priceFound = YES;
}
             else {

                  priceFound = NO;
             }
        //        if([productAttrNode isEqualToString:@"FULLSKU"])
        //        {
        //              fullSkufound = YES;
        //        }
        //        else {
        //
        //              fullSkufound = NO;
        //        }

     }
     else if([elementName isEqualToString:@"value"])
     {
           if(found)
           {
                 [sizesArray addObject:productAttrNode];
           //            fullSkuNumber = skuValue;
                 //[skuArray addObject:skuValue];

             //            NSLog(@"size array %@ n sky array %@",sizesArray,
skuArray);
             }
             else if(styleCodeFound)
             {
                   prodStyleCode = productAttrNode;
             }
             else if(colourCodeFound)
             {
                   colourCode = productAttrNode;
             }
             else if(brandFound)
             {
                   prodBrand = productAttrNode;
             }
             else if(colourFound)
             {
                   prodColour = productAttrNode;
             }
             else if(priceFound)
             {
                   prodPrice = productAttrNode;
             }
        /*
         else if(fullSkufound)
         {
         fullSkuNumber = skuValue;
         [skuArray addObject:skuValue];
         //fullSkufound = NO;
         }
         */
     }
     else if ([elementName isEqualToString:@"attribute"])
     {
           /*
        [productAttrArray addObject:prodAttr];
        [prodAttr release];
        */
     }
}
/*
 - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
 {
 if ([string isEqualToString:@"<"] || [string isEqualToString:@">"])
 return;

 if(nil != productAttrNode){

 }
 }
 */

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{   //NSLog(@"found: %@",string);
      if ([string isEqualToString:@"<"] || [string isEqualToString:@">"])
            return;

      if ([[string stringByTrimmingCharactersInSet:[NSCharacterSet
whitespaceAndNewlineCharacterSet]] length] )
      {
        if(nil != productAttrNode)
            {
                  [productAttrNode appendString:[string
stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]];
            }
      }
}


- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError
{
      NSLog(@"Error in Product Accsess Parser: %@", [parseError description] );
}
- (void)parserDidEndDocument:(NSXMLParser *)parser
{

}

- (NSMutableArray*) getsizesArray
{
      return sizesArray;
}
- (NSMutableArray*) getSkuArray
{
      return skuArray;
}
-(NSString*)getErrorResponse
{
      return errorResponse;
}
-(NSString*)getProdBrand{
      return prodBrand;
}
-(NSString*)getProdStyleCode{
      return prodStyleCode;
}
-(NSString*)getColourCode{
      return colourCode;
}
-(NSString*)getProdColour{
      return prodColour;
}
-(NSString*)getProdPrice{
      return prodPrice;
}
-(NSString*)getProdWasPrice {
      return prodWasPrice;
}
-(NSString*)getProdTitle{
      return prodTitle;
}
-(NSString*)getiImgURLthumb{
      return imgURLthumb;
}
-(NSString*)getFullSkuNumber{
      return fullSkuNumber;
}
-(NSString*)getDisplayURL{
      return displayURL;
}
-(void)dealloc {
      [sizesArray release];
      [skuArray release];
      [super dealloc];
}

@end

Contenu connexe

Tendances

Logic Equations Resolver J Script
Logic Equations Resolver   J ScriptLogic Equations Resolver   J Script
Logic Equations Resolver J ScriptRoman Agaev
 
PhpUnit - The most unknown Parts
PhpUnit - The most unknown PartsPhpUnit - The most unknown Parts
PhpUnit - The most unknown PartsBastian Feder
 
6. Generics. Collections. Streams
6. Generics. Collections. Streams6. Generics. Collections. Streams
6. Generics. Collections. StreamsDEVTYPE
 
The Ring programming language version 1.5.2 book - Part 44 of 181
The Ring programming language version 1.5.2 book - Part 44 of 181The Ring programming language version 1.5.2 book - Part 44 of 181
The Ring programming language version 1.5.2 book - Part 44 of 181Mahmoud Samir Fayed
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークTsuyoshi Yamamoto
 
Implementing CQRS and Event Sourcing with RavenDB
Implementing CQRS and Event Sourcing with RavenDBImplementing CQRS and Event Sourcing with RavenDB
Implementing CQRS and Event Sourcing with RavenDBOren Eini
 
Chaining and function composition with lodash / underscore
Chaining and function composition with lodash / underscoreChaining and function composition with lodash / underscore
Chaining and function composition with lodash / underscoreNicolas Carlo
 
Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8XSolve
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs偉格 高
 
SWP - A Generic Language Parser
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parserkamaelian
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to SwiftGiordano Scalzo
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with PythonHan Lee
 

Tendances (20)

Logic Equations Resolver J Script
Logic Equations Resolver   J ScriptLogic Equations Resolver   J Script
Logic Equations Resolver J Script
 
はじめてのGroovy
はじめてのGroovyはじめてのGroovy
はじめてのGroovy
 
How te bring common UI patterns to ADF
How te bring common UI patterns to ADFHow te bring common UI patterns to ADF
How te bring common UI patterns to ADF
 
PhpUnit - The most unknown Parts
PhpUnit - The most unknown PartsPhpUnit - The most unknown Parts
PhpUnit - The most unknown Parts
 
6. Generics. Collections. Streams
6. Generics. Collections. Streams6. Generics. Collections. Streams
6. Generics. Collections. Streams
 
3 u-mpb2u2na
 3 u-mpb2u2na 3 u-mpb2u2na
3 u-mpb2u2na
 
The Ring programming language version 1.5.2 book - Part 44 of 181
The Ring programming language version 1.5.2 book - Part 44 of 181The Ring programming language version 1.5.2 book - Part 44 of 181
The Ring programming language version 1.5.2 book - Part 44 of 181
 
Functional programming with php7
Functional programming with php7Functional programming with php7
Functional programming with php7
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトーク
 
Implementing CQRS and Event Sourcing with RavenDB
Implementing CQRS and Event Sourcing with RavenDBImplementing CQRS and Event Sourcing with RavenDB
Implementing CQRS and Event Sourcing with RavenDB
 
Chaining and function composition with lodash / underscore
Chaining and function composition with lodash / underscoreChaining and function composition with lodash / underscore
Chaining and function composition with lodash / underscore
 
this
thisthis
this
 
Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8
 
H base programming
H base programmingH base programming
H base programming
 
Pooya Khaloo Presentation on IWMC 2015
Pooya Khaloo Presentation on IWMC 2015Pooya Khaloo Presentation on IWMC 2015
Pooya Khaloo Presentation on IWMC 2015
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
SWP - A Generic Language Parser
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parser
 
Xm lparsers
Xm lparsersXm lparsers
Xm lparsers
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with Python
 

En vedette

Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...
Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...
Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...DevGAMM Conference
 
Prototyping is an attitude
Prototyping is an attitudePrototyping is an attitude
Prototyping is an attitudeWith Company
 
10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer Experience10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer ExperienceYuan Wang
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionIn a Rocket
 
How to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanHow to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanPost Planner
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldabaux singapore
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting PersonalKirsty Hulse
 

En vedette (8)

Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...
Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...
Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...
 
Prototyping is an attitude
Prototyping is an attitudePrototyping is an attitude
Prototyping is an attitude
 
10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer Experience10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer Experience
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 
How to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanHow to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media Plan
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job? Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
 

Similaire à Productaccess m

連邦の白いヤツ 「Objective-C」
連邦の白いヤツ 「Objective-C」連邦の白いヤツ 「Objective-C」
連邦の白いヤツ 「Objective-C」matuura_core
 
Enterprise workflow with Apps Script
Enterprise workflow with Apps ScriptEnterprise workflow with Apps Script
Enterprise workflow with Apps Scriptccherubino
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEDarwin Durand
 
Link.javaLink.javapackage com.bookstore.domain.model;import .docx
Link.javaLink.javapackage com.bookstore.domain.model;import .docxLink.javaLink.javapackage com.bookstore.domain.model;import .docx
Link.javaLink.javapackage com.bookstore.domain.model;import .docxSHIVA101531
 
ios,objective tutorial
ios,objective tutorial ios,objective tutorial
ios,objective tutorial Bhavik Patel
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Seri Moth
 
Scala in practice
Scala in practiceScala in practice
Scala in practicepatforna
 
Ast transformations
Ast transformationsAst transformations
Ast transformationsHamletDRC
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboardsDenis Ristic
 
Less ismorewithcoffeescript webdirectionsfeb2012
Less ismorewithcoffeescript webdirectionsfeb2012Less ismorewithcoffeescript webdirectionsfeb2012
Less ismorewithcoffeescript webdirectionsfeb2012Jo Cranford
 
jQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journeyjQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journeyHuiyi Yan
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScriptJulie Iskander
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone DevelopmentGiordano Scalzo
 
Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)HamletDRC
 
[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)croquiscom
 

Similaire à Productaccess m (20)

連邦の白いヤツ 「Objective-C」
連邦の白いヤツ 「Objective-C」連邦の白いヤツ 「Objective-C」
連邦の白いヤツ 「Objective-C」
 
Enterprise workflow with Apps Script
Enterprise workflow with Apps ScriptEnterprise workflow with Apps Script
Enterprise workflow with Apps Script
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
Link.javaLink.javapackage com.bookstore.domain.model;import .docx
Link.javaLink.javapackage com.bookstore.domain.model;import .docxLink.javaLink.javapackage com.bookstore.domain.model;import .docx
Link.javaLink.javapackage com.bookstore.domain.model;import .docx
 
ios,objective tutorial
ios,objective tutorial ios,objective tutorial
ios,objective tutorial
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Ast transformations
Ast transformationsAst transformations
Ast transformations
 
Practica n° 7
Practica n° 7Practica n° 7
Practica n° 7
 
J slider
J sliderJ slider
J slider
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards
 
Less ismorewithcoffeescript webdirectionsfeb2012
Less ismorewithcoffeescript webdirectionsfeb2012Less ismorewithcoffeescript webdirectionsfeb2012
Less ismorewithcoffeescript webdirectionsfeb2012
 
jQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journeyjQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journey
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone Development
 
Js hacks
Js hacksJs hacks
Js hacks
 
Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
Writing Good Tests
Writing Good TestsWriting Good Tests
Writing Good Tests
 
[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)
 

Dernier

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Dernier (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Productaccess m

  • 1. // // ProdAttributeAccess.m // Office // // Copyright (c) 2012 Sovoia. All rights reserved. // // // ProdAttributeAccess.m// Office // // Created by SMonte Developer on 11/16/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import "ProdAttributeAccess.h" //#import "ProdAttribute.h" @implementation ProdAttributeAccess @synthesize productLongDesc,productShortDesc,prodBrand; @synthesize displayURL, prodStyleCode, colourCode,prodWasPrice, prodColour, prodPrice, imgURLthumb, prodTitle, fullSkuNumber; - (id) init { if(self = [super init]) { sizesArray = [[NSMutableArray alloc]init]; skuArray = [[NSMutableArray alloc]init]; found = YES; errorResponse = [[NSString alloc]initWithString:@""]; displayURL = [[NSString alloc]initWithString:@""]; prodBrand =[[NSString alloc]initWithString:@""]; prodStyleCode = [[NSString alloc]initWithString:@""]; colourCode =@""; prodColour = [[NSString alloc]initWithString:@""]; prodPrice = [[NSString alloc]initWithString:@""]; prodWasPrice = @""; prodTitle = [[NSString alloc]initWithString:@""]; imgURLthumb = [[NSString alloc]initWithString:@""]; fullSkuNumber = [[NSString alloc]initWithString:@""]; } return self; } - (BOOL)parseXMLFileAtURL:(NSString *)URL { NSURL *xmlURL = [NSURL URLWithString:URL]; NSXMLParser*parser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL]; [parser setDelegate:self]; [parser setShouldProcessNamespaces:YES]; [parser setShouldReportNamespacePrefixes:YES]; [parser setShouldResolveExternalEntities:NO]; BOOL success =[parser parse]; [parser release]; return success; }
  • 2. - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict{ if(nil != qualifiedName){ elementName = qualifiedName; } if ([elementName isEqualToString:@"msg"]||[elementName isEqualToString:@"Short_Description"] || [elementName isEqualToString:@"Long_Description"]||[elementName isEqualToString:@"displayurl"] ||[elementName isEqualToString:@"title"]||[elementName isEqualToString:@"imageurlthumb"] ||[elementName isEqualToString:@"retailprice"] || [elementName isEqualToString:@"wasprice"] ||[elementName isEqualToString:@"STYLECODE"]||[elementName isEqualToString:@"BRAND"]||[elementName isEqualToString:@"COLOUR"]|| [elementName isEqualToString:@"name"]) { productAttrNode = [NSMutableString string]; } else if([elementName isEqualToString:@"value"]) { productAttrNode = [NSMutableString string]; if ([attributeDict objectForKey:@"sku"]) { //skuValue = [NSMutableString stringWithString:[attributeDict objectForKey:@"sku"]]; NSString *sku = [attributeDict objectForKey:@"sku"]; fullSkuNumber = sku; [skuArray addObject:sku]; // NSLog(@"Sku : %@",[attributeDict objectForKey:@"sku"]); } } else { productAttrNode = nil; } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if(nil != qName){ elementName = qName; } if([elementName isEqualToString:@"msg"]) { errorResponse = productAttrNode; } else if([elementName isEqualToString:@"Short_Description"]) { productShortDesc = productAttrNode; } else if([elementName isEqualToString:@"Long_Description"]) { productLongDesc = productAttrNode; } else if([elementName isEqualToString:@"title"]) { // NSLog(@"title in XML: %@",productAttrNode);
  • 3. prodTitle = productAttrNode; } else if([elementName isEqualToString:@"displayurl"]) { displayURL = productAttrNode; } else if([elementName isEqualToString:@"imageurlthumb"]) { imgURLthumb = productAttrNode; } else if([elementName isEqualToString:@"retailprice"]) { prodPrice = productAttrNode; } else if([elementName isEqualToString:@"wasprice"]) { prodWasPrice = productAttrNode; } else if([elementName isEqualToString:@"name"]) { if([productAttrNode isEqualToString:@"SIZE"]) { fullSkufound = YES; found = YES; } else { fullSkufound = NO; found = NO; } if([productAttrNode isEqualToString:@"STYLECODE"]) { styleCodeFound = YES; } else { styleCodeFound = NO; } if([productAttrNode isEqualToString:@"LEGACYCOLOURCODE"]) { colourCodeFound = YES; } else { colourCodeFound = NO; } if([productAttrNode isEqualToString:@"BRAND"]) { brandFound = YES; } else { brandFound = NO; } if([productAttrNode isEqualToString:@"COLOUR"]) { colourFound = YES; } else { colourFound = NO; } if([productAttrNode isEqualToString:@"Price"]) { priceFound = YES;
  • 4. } else { priceFound = NO; } // if([productAttrNode isEqualToString:@"FULLSKU"]) // { // fullSkufound = YES; // } // else { // // fullSkufound = NO; // } } else if([elementName isEqualToString:@"value"]) { if(found) { [sizesArray addObject:productAttrNode]; // fullSkuNumber = skuValue; //[skuArray addObject:skuValue]; // NSLog(@"size array %@ n sky array %@",sizesArray, skuArray); } else if(styleCodeFound) { prodStyleCode = productAttrNode; } else if(colourCodeFound) { colourCode = productAttrNode; } else if(brandFound) { prodBrand = productAttrNode; } else if(colourFound) { prodColour = productAttrNode; } else if(priceFound) { prodPrice = productAttrNode; } /* else if(fullSkufound) { fullSkuNumber = skuValue; [skuArray addObject:skuValue]; //fullSkufound = NO; } */ } else if ([elementName isEqualToString:@"attribute"]) { /* [productAttrArray addObject:prodAttr]; [prodAttr release]; */ } }
  • 5. /* - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if ([string isEqualToString:@"<"] || [string isEqualToString:@">"]) return; if(nil != productAttrNode){ } } */ - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { //NSLog(@"found: %@",string); if ([string isEqualToString:@"<"] || [string isEqualToString:@">"]) return; if ([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] ) { if(nil != productAttrNode) { [productAttrNode appendString:[string stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]]; } } } - (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError { NSLog(@"Error in Product Accsess Parser: %@", [parseError description] ); } - (void)parserDidEndDocument:(NSXMLParser *)parser { } - (NSMutableArray*) getsizesArray { return sizesArray; } - (NSMutableArray*) getSkuArray { return skuArray; } -(NSString*)getErrorResponse { return errorResponse; } -(NSString*)getProdBrand{ return prodBrand; } -(NSString*)getProdStyleCode{ return prodStyleCode; } -(NSString*)getColourCode{ return colourCode; } -(NSString*)getProdColour{ return prodColour; } -(NSString*)getProdPrice{ return prodPrice;
  • 6. } -(NSString*)getProdWasPrice { return prodWasPrice; } -(NSString*)getProdTitle{ return prodTitle; } -(NSString*)getiImgURLthumb{ return imgURLthumb; } -(NSString*)getFullSkuNumber{ return fullSkuNumber; } -(NSString*)getDisplayURL{ return displayURL; } -(void)dealloc { [sizesArray release]; [skuArray release]; [super dealloc]; } @end