2010-10-20 17:12:46 +02:00
|
|
|
// Copyright (c) 20010 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef _XML_READER_IMPL_H
|
|
|
|
#define _XML_READER_IMPL_H
|
|
|
|
|
|
|
|
#include "../include/cef.h"
|
|
|
|
#include "base/platform_thread.h"
|
|
|
|
#include <libxml/xmlreader.h>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
// Implementation of CefXmlReader
|
|
|
|
class CefXmlReaderImpl : public CefThreadSafeBase<CefXmlReader>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CefXmlReaderImpl();
|
|
|
|
~CefXmlReaderImpl();
|
|
|
|
|
|
|
|
// Initialize the reader context.
|
|
|
|
bool Initialize(CefRefPtr<CefStreamReader> stream,
|
2010-11-22 18:49:46 +01:00
|
|
|
EncodingType encodingType, const CefString& URI);
|
2010-10-20 17:12:46 +02:00
|
|
|
|
2010-10-21 17:19:43 +02:00
|
|
|
virtual bool MoveToNextNode();
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual bool Close();
|
|
|
|
virtual bool HasError();
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefString GetError();
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual NodeType GetType();
|
|
|
|
virtual int GetDepth();
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefString GetLocalName();
|
|
|
|
virtual CefString GetPrefix();
|
|
|
|
virtual CefString GetQualifiedName();
|
|
|
|
virtual CefString GetNamespaceURI();
|
|
|
|
virtual CefString GetBaseURI();
|
|
|
|
virtual CefString GetXmlLang();
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual bool IsEmptyElement();
|
|
|
|
virtual bool HasValue();
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefString GetValue();
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual bool HasAttributes();
|
|
|
|
virtual size_t GetAttributeCount();
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefString GetAttribute(int index);
|
|
|
|
virtual CefString GetAttribute(const CefString& qualifiedName);
|
|
|
|
virtual CefString GetAttribute(const CefString& localName,
|
|
|
|
const CefString& namespaceURI);
|
|
|
|
virtual CefString GetInnerXml();
|
|
|
|
virtual CefString GetOuterXml();
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual int GetLineNumber();
|
|
|
|
virtual bool MoveToAttribute(int index);
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual bool MoveToAttribute(const CefString& qualifiedName);
|
|
|
|
virtual bool MoveToAttribute(const CefString& localName,
|
|
|
|
const CefString& namespaceURI);
|
2010-10-20 17:12:46 +02:00
|
|
|
virtual bool MoveToFirstAttribute();
|
|
|
|
virtual bool MoveToNextAttribute();
|
|
|
|
virtual bool MoveToCarryingElement();
|
|
|
|
|
|
|
|
// Add another line to the error string.
|
2010-11-22 18:49:46 +01:00
|
|
|
void AppendError(const CefString& error_str);
|
2010-10-20 17:12:46 +02:00
|
|
|
|
|
|
|
// Verify that the reader exists and is being accessed from the correct
|
|
|
|
// thread.
|
|
|
|
bool VerifyContext();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
PlatformThreadId supported_thread_id_;
|
2010-11-09 22:06:39 +01:00
|
|
|
CefRefPtr<CefStreamReader> stream_;
|
2010-10-20 17:12:46 +02:00
|
|
|
xmlTextReaderPtr reader_;
|
2010-11-22 18:49:46 +01:00
|
|
|
std::stringstream error_buf_;
|
2010-10-20 17:12:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _XML_READER_IMPL_H
|