myio_xml.h

最終更新:2009/11/25

myio_xml.h

001: /* myio_xml.h
002:  * libxml2 / libxslt のサンプルコード
003:  */
004: 
005: #ifndef _MYIO_XML_
006: #define _MYIO_XML_
007: 
008: #ifndef __XML_PARSER_H__
009: #include "libxml/parser.h"
010: #endif
011: 
012: #ifndef __XML_TREE_H__
013: #include "libxml/tree.h"
014: #endif
015: 
016: #ifndef __XML_XPATH_H__
017: #include "libxml/xpath.h"
018: #endif
019: 
020: #ifndef __XML_XPATH_INTERNALS_H__
021: #include "libxml/xpathInternals.h"
022: #endif
023: 
024: #ifndef __XML_XSLT_H__
025: #include "libxslt/xslt.h"
026: #endif
027: 
028: #ifndef __XML_XSLT_INTERNALS_H__
029: #include "libxslt/xsltInternals.h"
030: #endif
031: 
032: #ifndef __XML_XSLT_TRANSFORM_H__
033: #include "libxslt/transform.h"
034: #endif
035: 
036: #ifndef __XML_XSLTUTILS_H__
037: #include "libxslt/xsltutils.h"
038: #endif
039: 
040: #ifndef _MYIO_H_
041: #include "myio.h"
042: #endif
043: 
044: /*
045:  * XML ドキュメントの読み込み
046:  */
047: xmlDocPtr my_xml_read (
048:   MYIO *in
049: );
050: 
051: /*
052:  * XML ドキュメントの書き込み
053:  */
054: int my_xml_write (
055:   MYIO *out
056:   , xmlDocPtr doc
057:   , const char * enc
058: );
059: 
060: /*
061:  * サンプル:属性の表示
062:  */
063: void print_xmlAttrs(MYIO* out, xmlAttrPtr attrs);
064: 
065: /*
066:  * サンプル:ノードセットの表示
067:  */
068: void print_xpath_nodes(MYIO* out, xmlNodeSetPtr nodes);
069: 
070: /*
071:  * サンプル:XPath 検索結果の表示(my_xml_xpath_do 用コールバック関数)
072:  * void func(void *func_ctx, xmlXPathObjectPtr xpathObj);
073:  */
074: void print_xpath_cb (MYIO *out, xmlXPathObjectPtr xpathObj);
075: 
076: /* XPath 検索
077:  * 返り値:
078:  *   1: 成功
079:  *   0: 失敗
080:  */
081: int my_xml_search_do(
082:   xmlDocPtr doc      /* XMLドキュメント */
083:   , const char *expr /* XPath の検索式 */
084:   , void *func       /* 検索結果を処理するコールバック関数 */
085:   , void *func_ctx   /* コールバック関数で使用するコンテクストデータ */
086:   , const char **ns_array
087:   , int ns_size
088: );
089: 
090: /* XSLT 変換
091:  * 返り値:
092:  *   XSLT 変換結果
093:  *   失敗時は NULL
094:  */
095: xmlDocPtr my_xml_transform (
096:   xmlDocPtr doc
097:   , xsltStylesheetPtr style
098: );
099: 
100: /* XSLT 変換結果のストリームへの書き込み
101:  * 返り値:
102:  *   XSLT 変換結果
103:  *   失敗時は NULL
104:  */
105: int MYIO_xslt_write(
106:   MYIO *out
107:   , xmlDocPtr res
108:   , xsltStylesheetPtr style
109: );
110: 
111: /* XSLT 変換結果のファイル保存
112:  * 返り値:
113:  *   XSLT 変換結果
114:  *   失敗時は NULL
115:  */
116: int my_xslt_save(
117:   const char *out_filename
118:   , xmlDocPtr res
119:   , xsltStylesheetPtr style
120: );
121: 
122: /*
123:  * 初期化
124:  */
125: void my_xml_init();
126: 
127: /*
128:  * 終期化
129:  */
130: void my_xml_clear();
131: 
132: #endif  /* _MYIO_XML_ */
Copyright (C) KAKU PROJECT (2009)KAKU PROJECT (2009)