Skip to content

Instantly share code, notes, and snippets.

@brokendish
Created August 25, 2013 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brokendish/6333932 to your computer and use it in GitHub Desktop.
Save brokendish/6333932 to your computer and use it in GitHub Desktop.
xml_CSV_Getlib.h
/* xml_CSV_Get.h */
#ifndef XML_CSV_GETLIB_H
#define XML_CSV_GETLIB_H
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
/* fgetsの指定バイト数 */
#define READ_SIZE 4096
/* content(取得項目のサイズ) */
#define CONTENT_SIZE 4096
/*
----------------------------------------------------------------------
xmlns属性(XML名前空間(ネームスペース))用 構造体
----------------------------------------------------------------------
*/
typedef struct XmlNs_Dat {
char *prefixName; /* プレフィックス */
char *nameSpace; /* ネームスペース */
struct XmlNs_Dat *next;
} XMLNS_DAT;
XMLNS_DAT st_dat; /* 構造体の実態を定義(開始位置用) */
XMLNS_DAT *ns_ptr; /* リスト構築用のポインタ */
XMLNS_DAT *new_ptr; /* メモリーを確保用構造体のポインタ */
/*
----------------------------------------------------------------------
XML Xpath取得用 構造体
----------------------------------------------------------------------
*/
typedef struct XmlXp_Dat {
char *xpathName; /* Xpath */
struct XmlXp_Dat *next;
} XMLXP_DAT;
XMLXP_DAT xptSt_dat; /* 構造体の実態を定義(開始位置用) */
XMLXP_DAT *xpt_ptr; /* リスト構築用のポインタ */
XMLXP_DAT *xptNew_ptr; /* メモリーを確保用構造体のポインタ */
/*
----------------------------------------------------------------------
関数定義
----------------------------------------------------------------------
*/
int xmlCSV_Get_Main(int opt, char *input_file, char *xpat[], char *nmsp[]);
int xml_CSV_Get_execute(int opt, char *input_file);
void replace_char(char *str);
void print_attr(xmlAttrPtr attr, FILE *output);
void print_xpath_nodes(xmlNodeSetPtr nodes, FILE *output);
int execute_xpath_get(xmlDocPtr doc, xmlChar *xpath_expr ,struct XmlNs_Dat *lns);
int execute_xpath_ListGet(xmlDocPtr doc, struct XmlXp_Dat *xpt,struct XmlNs_Dat *lns);
int test(char *aa[]);
int regex_seek(char *str, char *regexstr);
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment