//
// LibXmlEx.h
// libXml2Conv
//
// Created by xxxx on 11-11-8.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "iconv.h"
#import <libxml/parser.h>
#import <libxml/xpath.h>
@interface LibXmlEx : NSObject {
NSString *m_strFilePath;
xmlDocPtr m_pDoc;
}
//init
- (id) initXmlWithPath:(NSString*)strFilePath;
- (id) initXmlWithString:(NSString*)strData;
//finder
- (NSString*) getXmlString:(NSString*)strXpath;
//writer
- (BOOL) writeXmlString:(NSString*)strValue withXpath:(NSString*)strXpath;
//save
- (BOOL) saveXmlFile;
//tools
+ (NSString*) DocumentFilePath:(NSString*)strFileName;
@end
//
// LibXmlEx.m
// libXml2Conv
//
// Created by xxxx on 11-11-8.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
/*
Sample:
LibXmlEx* par = [[LibXmlEx alloc]initXmlWithString:xml];
NSString* strupg = [par getXmlString:@"/AuthenticateResp/upgradedomain"];
NSLog(@"======%@=======",strupg);
[par release];
*/
#import "LibXmlEx.h"
#pragma mark -
@interface LibXmlEx (private)
- (int) code_convert:(char*)from_charset to:(char*)to_charset inBuffer:(char*)i