Added nmem_text_node_cdata which takes xmlNode CDATA content and
[yaz-moved-to-github.git] / include / yaz / record_conv.h
1 /*
2  * Copyright (C) 2005-2006, Index Data ApS
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and
5  * its documentation, in whole or in part, for any purpose, is hereby granted,
6  * provided that:
7  *
8  * 1. This copyright and permission notice appear in all copies of the
9  * software and its documentation. Notices of copyright or attribution
10  * which appear at the beginning of any file must remain unchanged.
11  *
12  * 2. The name of Index Data or the individual authors may not be used to
13  * endorse or promote products derived from this software without specific
14  * prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
18  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19  * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
20  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
21  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
22  * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24  * OF THIS SOFTWARE.
25  *
26  * $Id: record_conv.h,v 1.1 2006-05-02 20:47:45 adam Exp $
27  */
28 /**
29  * \file record_conv.h
30  * \brief Record Conversions Utility
31  */
32
33 #ifndef YAZ_RECORD_CONV_H
34 #define YAZ_RECORD_CONV_H
35
36 #include <stddef.h>
37 #include <yaz/yconfig.h>
38
39 YAZ_BEGIN_CDECL
40
41 /** record conversion handle  */
42 typedef struct yaz_record_conv_struct *yaz_record_conv_t;
43
44 /** creates record handle
45     \return record handle
46 */
47 YAZ_EXPORT yaz_record_conv_t yaz_record_conv_create(void);
48
49 /** destroys record handle
50     \param p record conversion handle
51 */
52 YAZ_EXPORT void yaz_record_conv_destroy(yaz_record_conv_t p);
53
54
55 /** configures record conversion
56     \param p record conversion handle
57     \param node xmlNode pointer (root element of XML config)
58     \retval 0 success
59     \retval -1 failure
60     
61     \verbatim
62     <convert>
63       <xslt stylesheet="dc2marcxml.xsl"/>
64       <xmltomarc charset="marc-8"/>
65     </convert>
66     \endverbatim
67
68     \verbatim
69     <convert>
70       <marctoxml charset="marc-8"/>
71       <xslt stylesheet="marcxml2mods.xsl"/>
72       <xslt stylesheet="mods2dc.xsl"/>
73     </convert>
74     \endverbatim
75
76     For retrieval (ignore here):
77     \verbatim
78     <retrievalinfo>
79        <retrieval syntax="usmarc" name="marcxml"
80             identifier="info:srw/schema/1/marcxml-v1.1"
81        >
82          <title>MARCXML</title>
83          <backend syntax="xml" name="dc" charset="utf-8"/>
84          <convert>
85            <xslt stylesheet="dc2marcxml.xsl"/>
86            <xmltomarc charset="marc-8"/>
87          </convert>
88        </retrieval>
89     </retrievalinfo>
90     \endverbatim
91 */
92 YAZ_EXPORT
93 int yaz_record_conv_configure(yaz_record_conv_t p, const void *node);
94
95
96 /** returns error string (for last error)
97     \param p record conversion handle
98     \return error string
99 */    
100 YAZ_EXPORT
101 const char *yaz_record_conv_get_error(yaz_record_conv_t p);
102
103 YAZ_END_CDECL
104
105 #endif
106 /*
107  * Local variables:
108  * c-basic-offset: 4
109  * indent-tabs-mode: nil
110  * End:
111  * vim: shiftwidth=4 tabstop=8 expandtab
112  */
113