XRootD
Loading...
Searching...
No Matches
XrdXmlReader.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* */
3/* X r d X m l R e a d e r . c c */
4/* */
5/* (c) 2015 by the Board of Trustees of the Leland Stanford, Jr., University */
6/* Produced by Andrew Hanushevsky for Stanford University under contract */
7/* DE-AC02-76-SFO0515 with the Department of Energy */
8/* */
9/* This file is part of the XRootD software suite. */
10/* */
11/* XRootD is free software: you can redistribute it and/or modify it under */
12/* the terms of the GNU Lesser General Public License as published by the */
13/* Free Software Foundation, either version 3 of the License, or (at your */
14/* option) any later version. */
15/* */
16/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
17/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
18/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
19/* License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
23/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
24/* */
25/* The copyright holder's institutional names and contributor's names may not */
26/* be used to endorse or promote products derived from this software without */
27/* specific prior written permission of the institution or contributor. */
28/******************************************************************************/
29
30#include <cerrno>
31#include <cstring>
32
34
35#ifdef HAVE_XML2
37#endif
38
39/******************************************************************************/
40/* G e t R e a d e r */
41/******************************************************************************/
42
43XrdXmlReader *XrdXmlReader::GetReader(const char *fname, const char *enc,
44 const char *impl)
45{
46 XrdXmlReader *rP;
47 int rc;
48 bool aOK;
49
50// Check if this is the default implementation
51// c
52 if (!impl || !strcmp(impl, "tinyxml"))
53 {rP = new XrdXmlRdrTiny(aOK, fname, enc);
54 if (aOK) return rP;
55 rP->GetError(rc);
56 delete rP;
57 errno = (rc ? rc : ENOTSUP);
58 return 0;
59 }
60
61// Check for he full blown xml implementation
62//
63#ifdef HAVE_XML2
64 if (!strcmp(impl, "libxml2"))
65 {rP = new XrdXmlRdrXml2(aOK, fname, enc);
66 if (aOK) return rP;
67 rP->GetError(rc);
68 delete rP;
69 errno = (rc ? rc : ENOTSUP);
70 return 0;
71 }
72#endif
73
74// Add additional implementations here
75//
76
77// Not supported
78//
79 errno = ENOTSUP;
80 return 0;
81}
82
83/******************************************************************************/
84/* I n i t */
85/******************************************************************************/
86
87bool XrdXmlReader::Init(const char *impl)
88{
89// Check if this is the default implementation
90//
91 if (!impl || !strcmp(impl, "tinyxml")) return true;
92
93// Check for the whole hog implmenetation
94//
95#ifdef HAVE_XML2
96 if (!strcmp(impl, "libxml2")) {return XrdXmlRdrXml2::Init();}
97#endif
98
99// Add additional implementations here
100//
101
102// Not supported
103//
104 errno = ENOTSUP;
105 return false;
106}
static bool Init()
static XrdXmlReader * GetReader(const char *fname, const char *enc=0, const char *impl=0)
XrdXmlReader()
Constructor & Destructor.
static bool Init(const char *impl=0)
virtual const char * GetError(int &ecode)=0