2009-11-06 18:06:12 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2005-2007 Gerald Schmidt.
|
|
|
|
*
|
|
|
|
* This file is part of Xml Copy Editor.
|
|
|
|
*
|
|
|
|
* Xml Copy Editor is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* Xml Copy Editor is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Xml Copy Editor; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WRAPLIBXML_H
|
|
|
|
#define WRAPLIBXML_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
#include <libxml/parser.h>
|
|
|
|
#include <libxml/tree.h>
|
|
|
|
#include <libxml/xmlschemas.h>
|
|
|
|
#include <libxml/xpath.h>
|
|
|
|
#include <libxml/xpathInternals.h>
|
|
|
|
#include <libxml/catalog.h>
|
|
|
|
#include <libxml/xmlreader.h>
|
|
|
|
#include <libxml/xmlmemory.h>
|
|
|
|
#include <libxslt/xslt.h>
|
|
|
|
#include <libxslt/xsltInternals.h>
|
|
|
|
#include <libxslt/transform.h>
|
|
|
|
#include <libxslt/xsltutils.h>
|
2013-10-19 02:44:17 +02:00
|
|
|
#include <wx/wx.h>
|
2009-11-06 18:06:12 +01:00
|
|
|
|
|
|
|
class WrapLibxml
|
|
|
|
{
|
|
|
|
public:
|
2013-10-19 02:44:17 +02:00
|
|
|
static void Init ( const wxString &catalogPath = _T ( "catalog" ) ) throw();
|
2012-08-30 16:37:01 +02:00
|
|
|
|
|
|
|
WrapLibxml ( bool netAccessParameter = false );
|
2009-11-06 18:06:12 +01:00
|
|
|
virtual ~WrapLibxml();
|
2014-03-25 16:14:45 +01:00
|
|
|
bool validate (
|
|
|
|
const std::string &utf8DocBuf,
|
|
|
|
const wxString &docFileName );
|
2009-11-06 18:06:12 +01:00
|
|
|
bool validateRelaxNG (
|
2013-12-15 15:19:08 +01:00
|
|
|
const wxString &schemaFileName,
|
|
|
|
const std::string &utf8DocBuf,
|
2014-03-25 16:14:45 +01:00
|
|
|
const wxString &docFileName );
|
2009-11-06 18:06:12 +01:00
|
|
|
bool validateW3CSchema (
|
2013-12-15 15:19:08 +01:00
|
|
|
const wxString &schemaFileName,
|
|
|
|
const std::string &utf8DocBuf,
|
2014-03-25 16:14:45 +01:00
|
|
|
const wxString &docFileName );
|
2009-11-06 18:06:12 +01:00
|
|
|
bool parse (
|
2013-12-15 15:19:08 +01:00
|
|
|
const std::string &utf8DocBuf,
|
2014-03-25 16:14:45 +01:00
|
|
|
const wxString &docFileName,
|
2013-12-15 15:19:08 +01:00
|
|
|
bool indent = false,
|
|
|
|
bool resolveEntities = false );
|
|
|
|
bool parse (
|
|
|
|
const wxString &fileName,
|
|
|
|
bool indent = false,
|
|
|
|
bool resolveEntities = false );
|
|
|
|
bool parse (
|
|
|
|
const char *utf8DocBuf,
|
|
|
|
size_t utf8DocBufSize,
|
|
|
|
const wxString &fileName,
|
2009-11-06 18:06:12 +01:00
|
|
|
bool indent = false,
|
|
|
|
bool resolveEntities = false );
|
2013-12-15 15:19:08 +01:00
|
|
|
bool bufferWellFormed ( const std::string& utf8Buffer );
|
2014-03-25 16:14:45 +01:00
|
|
|
bool xpath (
|
|
|
|
const wxString &xpath,
|
|
|
|
const std::string &utf8DocBuf,
|
|
|
|
const wxString &docFileName );
|
|
|
|
bool xslt (
|
|
|
|
const wxString &styleFileName,
|
2013-12-15 15:19:08 +01:00
|
|
|
const std::string &utf8DocBuf,
|
2014-03-25 16:14:45 +01:00
|
|
|
const wxString &docFileName );
|
|
|
|
bool xslt (
|
|
|
|
const wxString &styleFileName,
|
|
|
|
const wxString &docFileName );
|
|
|
|
bool xslt (
|
|
|
|
const wxString &styleFileName,
|
2013-12-15 15:19:08 +01:00
|
|
|
const char *utf8DocBuf,
|
|
|
|
size_t utf8DocBufSize,
|
2014-03-25 16:14:45 +01:00
|
|
|
const wxString &docFileName );
|
2013-12-15 15:21:31 +01:00
|
|
|
wxString getLastError();
|
2009-11-06 18:06:12 +01:00
|
|
|
std::pair<int, int> getErrorPosition();
|
|
|
|
std::string getOutput();
|
|
|
|
int saveEncoding (
|
2013-12-16 04:45:20 +01:00
|
|
|
const std::string &utf8Buffer,
|
|
|
|
const wxString &fileNameSource,
|
|
|
|
const wxString &fileNameDestination,
|
|
|
|
wxMemoryBuffer *outputBuffer, /* Override fileNameDestination*/
|
|
|
|
const wxString &encoding );
|
|
|
|
int saveEncoding (
|
|
|
|
const wxString &fileNameSource,
|
|
|
|
const wxString &fileNameDestination,
|
|
|
|
const wxString &encoding );
|
|
|
|
int saveEncoding (
|
|
|
|
const char *utf8Buffer,
|
|
|
|
size_t utf8BufferSize,
|
|
|
|
const wxString &fileNameSource,
|
|
|
|
const wxString &fileNameDestination,
|
|
|
|
wxMemoryBuffer *outputBuffer, /* Override fileNameDestination*/
|
|
|
|
const wxString &encoding );
|
2013-10-26 15:15:42 +02:00
|
|
|
wxString catalogResolve (
|
|
|
|
const wxString &publicId,
|
|
|
|
const wxString &systemId );
|
2009-11-06 18:06:12 +01:00
|
|
|
private:
|
|
|
|
bool netAccess;
|
2013-12-15 15:21:31 +01:00
|
|
|
std::string output;
|
|
|
|
wxString nonParserError;
|
2009-11-06 18:06:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|