summaryrefslogtreecommitdiffstats
path: root/sca-cpp/tags/cpp-0.1.incubating-M1-final/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/tags/cpp-0.1.incubating-M1-final/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h')
-rw-r--r--sca-cpp/tags/cpp-0.1.incubating-M1-final/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/sca-cpp/tags/cpp-0.1.incubating-M1-final/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h b/sca-cpp/tags/cpp-0.1.incubating-M1-final/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h
new file mode 100644
index 0000000000..6e81bc98b7
--- /dev/null
+++ b/sca-cpp/tags/cpp-0.1.incubating-M1-final/sdo/runtime/core/src/commonj/sdo/SAX2Parser.h
@@ -0,0 +1,115 @@
+/*
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Rev$ $Date: 2006/04/18 12:33:33 $ */
+
+#ifndef _SAX2PARSER_H_
+#define _SAX2PARSER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLString.h"
+#include "commonj/sdo/SAX2Namespaces.h"
+#include "commonj/sdo/SAX2Attributes.h"
+#include "commonj/sdo/ParserErrorSetter.h"
+
+
+
+#include "sstream"
+namespace commonj
+{
+ namespace sdo
+ {
+
+ class parse_buf_element
+ {
+
+ public:
+ char buf[1000];
+ int len;
+ };
+
+/**
+ * SAX2Parser holds the methods which will be called back.
+ * The implementation uses libxml, which provides callbacks for
+ * errors, warnings , elements etc. These methods correspond to thos
+ * callbacks.
+ * Callbacks from libxml to these C methods are converted into calls
+ * to the C++ equivalent (with some parameter manipulation
+ * In the callback methods the void* ctx is a pointer to 'this' SAX2Parser
+ */
+ class SAX2Parser
+ {
+
+ public:
+
+ SAX2Parser();
+
+ SAX2Parser(ParserErrorSetter* insetter);
+
+ virtual ~SAX2Parser();
+
+ virtual int parse (const char* filename);
+ virtual int parse_twice (const char* filename);
+
+ virtual void startDocument();
+ virtual void endDocument();
+
+ virtual void startElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void endElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI);
+
+ virtual void characters(const SDOXMLString& chars);
+
+ virtual void warning(const char* msg, va_list args);
+
+ virtual void fatalError(const char* msg, va_list args);
+
+ virtual void error(const char* msg, va_list args);
+
+ virtual void stream(std::istream& input);
+ virtual void stream_twice(std::istream& input);
+
+ friend std::istream& operator>>(std::istream& input, SAX2Parser& parser);
+
+ ParserErrorSetter* setter;
+ bool parserError;
+
+ char messageBuffer[1024];
+
+ virtual const char* getCurrentFile() const;
+ virtual void setCurrentFile(const char* filename);
+
+ private:
+
+ char* currentFile;
+
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SAX2PARSER_H_