Skip to content

Latest commit

 

History

History
66 lines (51 loc) · 1.56 KB

README.md

File metadata and controls

66 lines (51 loc) · 1.56 KB

FSXmlJsonAnalyze

xml-->NSMutableArray (List<Entity>); json-->NSMutableArray (List<Entity>).

Features

  • Reflection
  • Regular Expression

What you need

How to use

NSMutableArray *retVal = [FSXmlJsonAnalyze jsonToArray:xml class:Entity.class];
    
NSMutableArray *retVal = [FSXmlJsonAnalyze xmlToArray:xml class:Entity.class rowRootName:@"rowRootName"];
    

xml-->NSMutableArray (List)

/**
 * 将标准的xml(实体)转换成NSMutableArray
 * @param xml:(忽略实体属性大小写差异)
    <data xmlns="">
    <row><UserID>ff0f0704</UserID><UserName>fs</UserName></row>
    <row><UserID>ff0f0704</UserID><UserName>fs</UserName></row>
    ......
    </data>
 * @param class:
    User @property userName,userID;
 * @param rowRootName:
    row
 * @return NSMutableArray (List<User>)
 */
+(NSMutableArray*)xmlToArray:(NSString*)xml class:(Class)class rowRootName:rowRootName;

json-->NSMutableArray (List)

/**
 * 将标准的Json(实体)转换成NSMutableArray
 * @param xml:(忽略实体属性大小写差异)
    [{"UserID":"ff0f0704","UserName":"fs"},
    {"UserID":"ff0f0704","UserName":"fs"},...]
 * @param class:
    User @property userName,userID;
 * @return NSMutableArray (List<User>)
 */
+(NSMutableArray*)jsonToArray:(NSString*)json class:(Class)class;