本文整理汇总了C++中UT_XML类的典型用法代码示例。如果您正苦于以下问题:C++ UT_XML类的具体用法?C++ UT_XML怎么用?C++ UT_XML使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UT_XML类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: UT_DEBUGMSG
bool IE_Imp_XML::pasteFromBuffer(PD_DocumentRange * pDocRange, const unsigned char * pData,
UT_uint32 lenData, const char * /*szEncoding*/)
{
UT_DEBUGMSG(("IE_Imp_XML::pasteFromBuffer\n"));
UT_return_val_if_fail(pDocRange && pDocRange->m_pDoc,false);
setClipboard(pDocRange->m_pos1);
UT_XML default_xml;
UT_XML * parser = &default_xml;
if (m_pParser) parser = m_pParser;
parser->setListener (this);
if (m_pReader) parser->setReader (m_pReader);
UT_Error err = parser->parse ((const char*)pData, lenData);
if ((err != UT_OK) && (err != UT_IE_SKIPINVALID))
m_error = UT_IE_BOGUSDOCUMENT;
if (m_error != UT_OK)
{
UT_DEBUGMSG(("Problem reading document\n"));
return false;
}
return true;
}
开发者ID:,项目名称:,代码行数:26,代码来源:
示例2: _cdata
static void _cdata (void * userData, const gchar * buffer, int length)
{
UT_XML * pXML = reinterpret_cast<UT_XML *>(userData);
pXML->cdataSection (true);
pXML->charData (reinterpret_cast<const char *>(buffer), length);
pXML->cdataSection (false);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:7,代码来源:ut_xml_libxml2.cpp
示例3: importFile
UT_Error IE_Imp_XML::importFile(const char * data, UT_uint32 length)
{
m_szFileName = 0;
UT_XML default_xml;
UT_XML * parser = &default_xml;
if (m_pParser) parser = m_pParser;
parser->setListener (this);
if (m_pReader) parser->setReader (m_pReader);
UT_Error err = parser->parse (data, length);
if ((err != UT_OK) && (err != UT_IE_SKIPINVALID))
m_error = UT_IE_BOGUSDOCUMENT;
if (m_error != UT_OK)
{
UT_DEBUGMSG(("Problem reading document\n"));
if(m_error != UT_IE_SKIPINVALID)
m_szFileName = 0;
}
return m_error;
}
开发者ID:,项目名称:,代码行数:25,代码来源:
示例4: gsf_input_name
UT_Error IE_Imp_XML::_loadFile(GsfInput * input)
{
m_szFileName = gsf_input_name (input);
UT_XML default_xml;
UT_XML * parser = &default_xml;
if (m_pParser) parser = m_pParser;
parser->setListener (this);
if (m_pReader) parser->setReader (m_pReader);
// hack!!!
size_t num_bytes = gsf_input_size(input);
char * bytes = (char *)gsf_input_read(input, num_bytes, NULL);
UT_Error err = parser->parse (bytes, num_bytes);
if ((err != UT_OK) && (err != UT_IE_SKIPINVALID))
m_error = UT_IE_BOGUSDOCUMENT;
if (m_error != UT_OK)
{
UT_DEBUGMSG(("Problem reading document\n"));
if(m_error != UT_IE_SKIPINVALID)
m_szFileName = 0;
}
return m_error;
}
开发者ID:,项目名称:,代码行数:29,代码来源:
示例5: _startElement
static void _startElement (void * userData, const gchar * name, const gchar ** atts)
{
UT_XML * pXML = reinterpret_cast<UT_XML *>(userData);
/* libxml2 can supply atts == 0, which is a little at variance to what is expected...
*/
static const gchar * ptr = 0;
const gchar ** new_atts = atts;
if (atts == 0) new_atts = &ptr;
pXML->startElement (reinterpret_cast<const char *>(name), reinterpret_cast<const char **>(new_atts));
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:12,代码来源:ut_xml_libxml2.cpp
示例6: gsf_infile_child_by_name
UT_Error IE_Imp_EPUB::readMetadata()
{
GsfInput* metaInf = gsf_infile_child_by_name(m_epub, "META-INF");
if (metaInf == NULL)
{
UT_DEBUGMSG(("Can`t open container META-INF dir\n"));
return UT_ERROR;
}
GsfInput* meta = gsf_infile_child_by_name(GSF_INFILE(metaInf),
"container.xml");
if (meta == NULL)
{
UT_DEBUGMSG(("Can`t open container metadata\n"));
return UT_ERROR;
}
size_t metaSize = gsf_input_size(meta);
if (metaSize == 0)
{
UT_DEBUGMSG(("Container metadata file is empty\n"));
return UT_ERROR;
}
gchar* metaXml = (gchar*) gsf_input_read(meta, metaSize, NULL);
std::string rootfilePath;
UT_XML metaParser;
ContainerListener containerListener;
metaParser.setListener(&containerListener);
if (metaParser.sniff(metaXml, metaSize, "container"))
{
UT_DEBUGMSG(("Parsing container.xml file\n"));
metaParser.parse(metaXml, metaSize);
}
else
{
UT_DEBUGMSG(("Incorrect container.xml file\n"));
return UT_ERROR;
}
m_rootfilePath = containerListener.getRootFilePath();
g_object_unref(G_OBJECT(meta));
g_object_unref(G_OBJECT(metaInf));
return UT_OK;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:52,代码来源:ie_imp_EPUB.cpp
示例7: _parseStream
/**
* Static utility method to read a file/stream embedded inside of the
* zipfile into an xml parser
*/
UT_Error IE_Imp_OpenDocument::_parseStream (GsfInput* pInput, UT_XML & parser)
{
guint8 const *data = NULL;
size_t len = 0;
UT_Error ret = UT_OK;
UT_return_val_if_fail(pInput, UT_ERROR);
if (gsf_input_size (pInput) > 0) {
while ((len = gsf_input_remaining (pInput)) > 0) {
// FIXME: we want to pass the stream in chunks, but libXML2 finds this disagreeable.
// we probably need to pass some magic to our XML parser?
// len = UT_MIN (len, BUF_SZ);
if (NULL == (data = gsf_input_read (pInput, len, NULL))) {
g_object_unref (G_OBJECT (pInput));
return UT_ERROR;
}
ret = parser.parse ((const char *)data, len);
}
// if there is an error we think we can recover.
if(ret != UT_OK) {
ret = UT_IE_TRY_RECOVER;
}
}
return ret;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:31,代码来源:ie_imp_OpenDocument.cpp
示例8: _recognizeContent
static bool _recognizeContent(const char* buffer,UT_uint32 buflen,UT_svg* data)
{
data->m_bSVG = false;
data->m_bContinue = true;
data->m_bIsText = false;
data->m_bIsTSpan = false;
data->m_bHasTSpan = false;
UT_XML parser;
parser.setListener (data);
if (parser.parse (buffer,buflen) != UT_OK) data->m_bSVG = false;
return data->m_bSVG;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:16,代码来源:ut_svg.cpp
示例9: _fatalErrorSAXFunc
static void _fatalErrorSAXFunc(void *xmlp,
const char *msg,
...)
{
va_list args;
va_start (args, msg);
UT_String errorMessage(UT_String_vprintf (msg, args));
va_end (args);
UT_DEBUGMSG((" fatal SAX function error here \n"));
UT_DEBUGMSG(("%s", errorMessage.c_str()));
UT_XML * pXML = reinterpret_cast<UT_XML *>(xmlp);
UT_DEBUGMSG((" userData pointer is %p \n",pXML));
UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
pXML->stop();
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:17,代码来源:ut_xml_libxml2.cpp
示例10: g_strsplit
UT_Error IE_Imp_EPUB::readPackage()
{
gchar **aname = g_strsplit(m_rootfilePath.c_str(), G_DIR_SEPARATOR_S, 0);
GsfInput* opf = gsf_infile_child_by_aname(m_epub, (const char**) aname);
UT_DEBUGMSG(("Getting parent\n"));
GsfInfile* opfParent = gsf_input_container(opf);
m_opsDir = std::string(gsf_input_name(GSF_INPUT(opfParent)));
UT_DEBUGMSG(("OPS dir: %s\n", m_opsDir.c_str()));
if (opf == NULL)
{
UT_DEBUGMSG(("Can`t open .opf file\n"));
return UT_ERROR;
}
size_t opfSize = gsf_input_size(opf);
gchar* opfXml = (gchar*) gsf_input_read(opf, opfSize, NULL);
UT_XML opfParser;
OpfListener opfListener;
opfParser.setListener(&opfListener);
if (opfParser.sniff(opfXml, opfSize, "package"))
{
UT_DEBUGMSG(("Parsing opf file\n"));
opfParser.parse(opfXml, opfSize);
}
else
{
UT_DEBUGMSG(("Incorrect opf file found \n"));
return UT_ERROR;
}
g_strfreev(aname);
g_object_unref(G_OBJECT(opf));
//g_object_unref(G_OBJECT(opfParent));
m_spine = opfListener.getSpine();
m_manifestItems = opfListener.getManifestItems();
return UT_OK;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:43,代码来源:ie_imp_EPUB.cpp
示例11: UT_return_val_if_fail
UT_Error OXMLi_PackageManager::_parseStream( GsfInput * stream, OXMLi_StreamListener * pListener)
{
UT_return_val_if_fail(stream != NULL && pListener != NULL , UT_ERROR);
//First, we check if this stream has already been parsed before
std::string part_name = gsf_input_name(stream); //TODO: determine if part names are truly unique
std::map<std::string, bool>::iterator it;
it = m_parsedParts.find(part_name);
if (it != m_parsedParts.end() && it->second) {
//this stream has already been parsed successfully
return UT_OK;
}
UT_Error ret = UT_OK;
guint8 const *data = NULL;
const char * cdata = NULL;
size_t len = 0;
UT_XML reader;
reader.setListener(pListener);
if (gsf_input_size (stream) > 0) {
len = gsf_input_remaining (stream);
if (len > 0) {
data = gsf_input_read (stream, len, NULL);
if (NULL == data) {
g_object_unref (G_OBJECT (stream));
return UT_ERROR;
}
cdata = (const char *)data;
ret = reader.parse (cdata, len);
}
}
//There are two error codes to check here.
if (ret == UT_OK && pListener->getStatus() == UT_OK)
m_parsedParts[part_name] = true;
//We prioritize the one from UT_XML when returning.
return ret == UT_OK ? pListener->getStatus() : ret;
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:41,代码来源:OXMLi_PackageManager.cpp
示例12: _errorSAXFunc
static void _errorSAXFunc(void *xmlp,
const char *msg,
...)
{
va_list args;
va_start (args, msg);
UT_String errorMessage;
UT_String_vprintf (errorMessage,msg, args);
va_end (args);
// Handle 'nbsp' here
UT_XML * pXML = reinterpret_cast<UT_XML *>(xmlp);
pXML->incMinorErrors();
char * szErr = g_strdup(errorMessage.c_str() );
if(strstr(szErr,"'nbsp' not defined") != NULL)
{
UT_DEBUGMSG(("nbsp found in stream errs %d \n",pXML->getNumMinorErrors()));
pXML->incRecoveredErrors();
const char buffer []= { (char)0xa0};
pXML->charData(buffer,1);
}
else if(strstr(szErr,"not defined") != NULL)
{
pXML->incRecoveredErrors();
}
else
{
UT_DEBUGMSG(("SAX function error here \n"));
UT_DEBUGMSG(("%s", errorMessage.c_str()));
// This is a runtime error, an ASSERT is out of place.
// UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
}
FREEP(szErr);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:33,代码来源:ut_xml_libxml2.cpp
示例13: gsf_infile_child_by_name
/**
* Handle the stream @stream using the listener @listener.
* Tries to abstract away how we're actually going to handle
* how we read the stream, so that the underlying implementation
* can easily adapt or change
*/
UT_Error IE_Imp_OpenDocument::_handleStream ( GsfInfile* pGsfInfile,
const char * pStream, UT_XML::Listener& rListener)
{
GsfInput* pInput = gsf_infile_child_by_name(pGsfInfile, pStream);
UT_return_val_if_fail(pInput, UT_ERROR);
// check if the stream is encrypted, and if so, decrypt it
std::map<std::string, ODc_CryptoInfo>::iterator pos = m_cryptoInfo.find(pStream);
if (pos != m_cryptoInfo.end())
{
UT_DEBUGMSG(("Running decrypt on stream %s\n", pStream));
#ifndef HAVE_GCRYPT
UT_DEBUGMSG(("Can not decrypt files because of how abiword is compiled!\n"));
return UT_ERROR;
#endif
GsfInput* pDecryptedInput = NULL;
UT_Error err = ODc_Crypto::decrypt(pInput, (*pos).second, m_sPassword.utf8_str(), &pDecryptedInput);
g_object_unref (G_OBJECT (pInput));
if (err != UT_OK) {
UT_DEBUGMSG(("Decryption failed!\n"));
return err;
}
UT_DEBUGMSG(("Stream %s decrypted\n", pStream));
pInput = pDecryptedInput;
}
// parse the XML stream
UT_XML reader;
reader.setListener ( &rListener );
UT_Error err = _parseStream (pInput, reader);
g_object_unref (G_OBJECT (pInput));
return err;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:46,代码来源:ie_imp_OpenDocument.cpp
示例14: _comment
static void _comment (void * userData, const gchar * data)
{
UT_XML * pXML = reinterpret_cast<UT_XML *>(userData);
pXML->comment (reinterpret_cast<const char *>(data));
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:5,代码来源:ut_xml_libxml2.cpp
示例15: _processingInstruction
static void _processingInstruction (void * userData, const gchar * target, const gchar * data)
{
UT_XML * pXML = reinterpret_cast<UT_XML *>(userData);
pXML->processingInstruction (reinterpret_cast<const char *>(target), reinterpret_cast<const char *>(data));
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:5,代码来源:ut_xml_libxml2.cpp
示例16: _endElement
static void _endElement (void * userData, const gchar * name)
{
UT_XML * pXML = reinterpret_cast<UT_XML *>(userData);
pXML->endElement (reinterpret_cast<const char *>(name));
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:5,代码来源:ut_xml_libxml2.cpp
注:本文中的UT_XML类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论