diff options
author | kitty <kitty@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-08-02 17:44:44 +0000 |
---|---|---|
committer | kitty <kitty@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-08-02 17:44:44 +0000 |
commit | 9ffed8614b2c23d2aa31c15c6253830c1e9c80d0 (patch) | |
tree | 30396957a1809aeaf65153396a3b0ba2f0c6c9a7 | |
parent | 01175f0a76e99e99d6338845d41b9da65cc9310b (diff) | |
download | ATCD-9ffed8614b2c23d2aa31c15c6253830c1e9c80d0.tar.gz |
ChangeLogTag: Fri Aug 2 12:31:34 2002 Krishnakumar B <kitty@cs.wustl.edu>
-rw-r--r-- | ACEXML/common/ContentHandler.h | 23 | ||||
-rw-r--r-- | ACEXML/common/HttpCharStream.cpp | 14 | ||||
-rw-r--r-- | ACEXML/common/InputSource.cpp | 1 | ||||
-rw-r--r-- | ACEXML/common/Mem_Map_Stream.cpp | 21 | ||||
-rw-r--r-- | ACEXML/common/Mem_Map_Stream.h | 12 | ||||
-rw-r--r-- | ACEXML/common/NamespaceSupport.cpp | 3 | ||||
-rw-r--r-- | ACEXML/docs/TODO.txt | 22 | ||||
-rw-r--r-- | ACEXML/docs/bugs.txt | 16 | ||||
-rw-r--r-- | ACEXML/docs/guidelines.txt | 4 | ||||
-rw-r--r-- | ACEXML/docs/parser_features.txt | 12 | ||||
-rw-r--r-- | ACEXML/examples/SAXPrint/Print_Handler.cpp | 2 | ||||
-rw-r--r-- | ACEXML/examples/SAXPrint/main.cpp | 30 | ||||
-rw-r--r-- | ACEXML/parser/parser/Entity_Manager.cpp | 2 | ||||
-rw-r--r-- | ACEXML/parser/parser/Parser.cpp | 1385 | ||||
-rw-r--r-- | ACEXML/parser/parser/Parser.h | 68 | ||||
-rw-r--r-- | ChangeLog | 39 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 39 |
17 files changed, 613 insertions, 1080 deletions
diff --git a/ACEXML/common/ContentHandler.h b/ACEXML/common/ContentHandler.h index 42fe7629800..093eb165d60 100644 --- a/ACEXML/common/ContentHandler.h +++ b/ACEXML/common/ContentHandler.h @@ -29,19 +29,18 @@ * * @brief ACEXML_ContentHandler * - * This is the main interface that most SAX applications implement: if - * the application needs to be informed of basic parsing events, it - * implements this interface and registers an instance with the SAX - * parser using the setContentHandler method. The parser uses the - * instance to report basic document-related events like the start and - * end of elements and character data. + * This is the main interface that most SAX applications implement: if the + * application needs to be informed of basic parsing events, it implements + * this interface and registers an instance with the SAX parser using the + * setContentHandler method. The parser uses the instance to report basic + * document-related events like the start and end of elements and character + * data. * - * The order of events in this interface is very important, and - * mirrors the order of information in the document itself. For - * example, all of an element's content (character data, processing - * instructions, and/or subelements) will appear, in order, between - * the startElement event and the corresponding endElement event. - + * The order of events in this interface is very important, and mirrors the + * order of information in the document itself. For example, all of an + * element's content (character data, processing instructions, and/or + * subelements) will appear, in order, between the startElement event and + * the corresponding endElement event. */ class ACEXML_Export ACEXML_ContentHandler { diff --git a/ACEXML/common/HttpCharStream.cpp b/ACEXML/common/HttpCharStream.cpp index c2969fb5260..9abe58fcc5a 100644 --- a/ACEXML/common/HttpCharStream.cpp +++ b/ACEXML/common/HttpCharStream.cpp @@ -78,11 +78,11 @@ ACEXML_HttpCharStream::get_url (size_t& len) int header_state = HDST_LINE1_PROTOCOL; int status = 0; size_t b = 0; - ACEXML_Char* buf = 0; + char* buf = 0; size_t buflen = BUFSIZ; for (;;) { - if ((buf = ACE_const_cast (ACEXML_Char*, + if ((buf = ACE_const_cast (char*, this->stream_->recv (buflen))) == 0) if (buflen <= 0) break; @@ -182,12 +182,12 @@ ACEXML_HttpCharStream::get_url (size_t& len) ++b; // Store the address of the beginning of data. We will use it to seek to // beginning of the data in the URL. - ACEXML_Char* data_beg = buf + b; + char* data_beg = buf + b; buflen = BUFSIZ; // Get all of the data. Since this is backed by file store, we won't lose // any of the data. - while (( buf = ACE_const_cast (ACEXML_Char*, + while (( buf = ACE_const_cast (char*, this->stream_->recv (buflen))) != 0) ; @@ -211,9 +211,9 @@ ACEXML_HttpCharStream::send_request (void) { int commandsize = ACE_OS::strlen (this->url_addr_->get_path_name ()) + ACE_OS::strlen (this->url_addr_->get_host_name ()) - + 20 // Extra - + 1 // NUL byte - + 16; // Protocol filler... + + 20 * sizeof (ACEXML_Char) // Extra + + 1 * sizeof (ACEXML_Char) // NUL byte + + 16 * sizeof (ACEXML_Char); // Protocol filler... ACEXML_Char* command; ACE_NEW_RETURN (command, ACEXML_Char[commandsize], -1); diff --git a/ACEXML/common/InputSource.cpp b/ACEXML/common/InputSource.cpp index 1149643f44a..601efcf4426 100644 --- a/ACEXML/common/InputSource.cpp +++ b/ACEXML/common/InputSource.cpp @@ -34,7 +34,6 @@ ACEXML_InputSource::~ACEXML_InputSource (void) { delete[] this->publicId_; delete[] this->systemId_; - delete this->charStream_; delete[] this->encoding_; } diff --git a/ACEXML/common/Mem_Map_Stream.cpp b/ACEXML/common/Mem_Map_Stream.cpp index 7a255f5f112..88313e76c00 100644 --- a/ACEXML/common/Mem_Map_Stream.cpp +++ b/ACEXML/common/Mem_Map_Stream.cpp @@ -43,7 +43,7 @@ int ACEXML_Mem_Map_Stream::rewind (void) { this->recv_pos_ = - ACE_reinterpret_cast (ACEXML_Char *, + ACE_reinterpret_cast (char *, this->mem_map_.addr ()); this->get_pos_ = this->recv_pos_; this->end_of_mapping_plus1_ = @@ -62,20 +62,19 @@ ACEXML_Mem_Map_Stream::peek_char (size_t offset) return this->get_pos_[offset]; } -const ACEXML_Char * +const char * ACEXML_Mem_Map_Stream::recv (void) const { return this->recv_pos_; } -const ACEXML_Char * +const char * ACEXML_Mem_Map_Stream::recv (size_t &len) { if (this->eof () && this->grow_file_and_remap () == -1) return 0; - - const ACEXML_Char *s = this->recv_pos_; + const char *s = this->recv_pos_; this->seek (len, SEEK_CUR); len = this->get_pos_ - s; return s; @@ -87,7 +86,7 @@ ACEXML_Mem_Map_Stream::recv_len (void) const return this->get_pos_ - this->recv_pos_; } -const ACEXML_Char * +const char * ACEXML_Mem_Map_Stream::peek_str (size_t offset, size_t size) { @@ -106,7 +105,7 @@ ACEXML_Mem_Map_Stream::seek (off_t offset, int whence) { case SEEK_SET: this->get_pos_ = - ACE_reinterpret_cast (ACEXML_Char *, + ACE_reinterpret_cast (char *, this->mem_map_.addr ()) + offset; break; @@ -129,7 +128,7 @@ ACEXML_Mem_Map_Stream::seek (off_t offset, int whence) this->get_pos_ = this->end_of_mapping_plus1_; this->recv_pos_ = this->get_pos_; - return this->recv_pos_ - ACE_reinterpret_cast (ACEXML_Char *, + return this->recv_pos_ - ACE_reinterpret_cast (char *, this->mem_map_.addr ()); } @@ -193,7 +192,7 @@ ACEXML_Mem_Map_Stream::open (Connector *connector, int ACEXML_Mem_Map_Stream::grow_file_and_remap (void) { - ACEXML_Char buf[BUFSIZ + 1]; + char buf[BUFSIZ + 1]; // Copy the next chunk of bytes from the socket into the temporary // file. @@ -225,13 +224,13 @@ ACEXML_Mem_Map_Stream::grow_file_and_remap (void) // MAP_FAILED is used as a "first time in" flag. if (this->recv_pos_ == MAP_FAILED) { - this->recv_pos_ = ACE_reinterpret_cast (ACEXML_Char *, + this->recv_pos_ = ACE_reinterpret_cast (char *, this->mem_map_.addr ()); this->get_pos_ = this->recv_pos_; } this->end_of_mapping_plus1_ = - ACE_reinterpret_cast (ACEXML_Char *, + ACE_reinterpret_cast (char *, this->mem_map_.addr ()) + this->mem_map_.size (); diff --git a/ACEXML/common/Mem_Map_Stream.h b/ACEXML/common/Mem_Map_Stream.h index ebe5e786919..faf35bdb7a1 100644 --- a/ACEXML/common/Mem_Map_Stream.h +++ b/ACEXML/common/Mem_Map_Stream.h @@ -91,13 +91,13 @@ public: * position and the EOF and both the <get> and <recv> positions are * advanced by <len>. Returns 0 if the <recv> position is at the EOF. */ - virtual const ACEXML_Char *recv (size_t &len); + virtual const char *recv (size_t &len); /** * Returns a pointer to array of characters starting at the <recv> * position. */ - virtual const ACEXML_Char *recv (void) const; + virtual const char *recv (void) const; /** * Returns the length in bytes between the <get> position and the <recv> @@ -132,7 +132,7 @@ public: * if necessary. Returns 0 if <offset> or <offset + size> is past the * end of the stream. */ - virtual const ACEXML_Char *peek_str (size_t offset, size_t size); + virtual const char *peek_str (size_t offset, size_t size); /** * Sets the <get> and <recv> positions as follows: @@ -172,16 +172,16 @@ private: ACE_Mem_Map mem_map_; /// Pointer to the address where the next <recv> method will start. - ACEXML_Char *recv_pos_; + char *recv_pos_; /** * Pointer to the address where the next <get_char> method will * start. */ - ACEXML_Char *get_pos_; + char *get_pos_; /// Address at the end of the file mapping. - ACEXML_Char *end_of_mapping_plus1_; + char *end_of_mapping_plus1_; }; diff --git a/ACEXML/common/NamespaceSupport.cpp b/ACEXML/common/NamespaceSupport.cpp index 6a66ff122d0..b28b9d07248 100644 --- a/ACEXML/common/NamespaceSupport.cpp +++ b/ACEXML/common/NamespaceSupport.cpp @@ -7,9 +7,6 @@ const ACEXML_Char *ACEXML_NamespaceSupport::XMLNS_PREFIX = ACEXML_XMLNS_PREFIX_n static const ACEXML_Char ACEXML_DEFAULT_NS_PREFIX[] = {0}; -// Currently unused. -// static const ACEXML_Char ACEXML_NS_SEPARATOR[] = {':', 0}; - static const ACEXML_Char ACEXML_TABOO_NS_PREFIX[] = {'x', 'm', 'l', 0}; static const ACEXML_Char ACEXML_XMLNS_URI_name[] = { diff --git a/ACEXML/docs/TODO.txt b/ACEXML/docs/TODO.txt index 022c75c4fc7..8c41e8b88ad 100644 --- a/ACEXML/docs/TODO.txt +++ b/ACEXML/docs/TODO.txt @@ -3,22 +3,10 @@ <ul> - <li>Make the parser dynamically loadable - - <li>Decouple ACE_Svc_Configurator from ACE Library. Allow users to - load in different configurator/parsers. - - <li>Add Namespace support. The basic supporting mechanisms are - already in place. The parser itself, however, does not take - advantage of them to differentiate the different namespace. - - <li>Add Schema paring ability. It is not clear to me, however, how - to specify which schema a document is associated with. + <li>Add Schema parsing ability. <li>Add support for resolving external entities, such as a - schema/namespace definition located on the web. There should be - a factory object to create various kinds of @ref CharStream - based on the URN or <i>PEReference</i> being parsed. + schema/namespace definition located on the web. <li>Add parameterized entity management class. See above. @@ -29,12 +17,8 @@ <li>Add a class to determine the encoding of an XML file automatically. - <li>Need to support ACEXML_Locator in the parser. There's currently - no way to tell the location where the parser is parsing or where - an error occurred. - <li>Define validator building/calling interfaces. </ul> -*/
\ No newline at end of file +*/ diff --git a/ACEXML/docs/bugs.txt b/ACEXML/docs/bugs.txt index 804a8f7d9fd..ab706be136a 100644 --- a/ACEXML/docs/bugs.txt +++ b/ACEXML/docs/bugs.txt @@ -6,10 +6,9 @@ hooks have not fully integrated into the parser yet. <li>Exception handling is not implemented. Currently, we use a - reference of ACEXML::Env, similar to CORBA::Environment, to - return the status of the execution. We should consider reusing - the ACE CORBA macros to support native exceptions on platforms - that support them. + reference of ACEXML::Env, similar to CORBA::Environment, to return + the status of the execution. ACEXML will reuse the ACE CORBA macros + to support native exceptions on platforms that support them. <li>Need to verify predefined entities are working correctly. Check out the SAXPrint example. @@ -17,16 +16,11 @@ <li>Currently, replacement of parameterized reference (PEReference) is not working. - <li>Although most namespace supporting features/interfaces are - there, the parser currently does not interpret namespace. - - <li>The encoding attributes in xml decl element is ignore. We have + <li>The encoding attributes in xml decl element is ignored. We have no plan to support different character encoding other than UNICODE ones. - <li>I'm sure this list will grow. :) - </ul> -*/
\ No newline at end of file +*/ diff --git a/ACEXML/docs/guidelines.txt b/ACEXML/docs/guidelines.txt index 267a9b89d66..9d084924c2c 100644 --- a/ACEXML/docs/guidelines.txt +++ b/ACEXML/docs/guidelines.txt @@ -18,7 +18,7 @@ <code>wchar_t</code>. Notice that ACEXML assume <code>sizeof (wchar_t)</code> is of 2-byte long. For platforms using 4-byte <code>wchar_t</code>, ACEXML will not work - correctly but it should be trivial to fix.<p> + correctly, but it should be trivial to fix.<p> <li>Currently, there's only an example showing how to use the parser under @c $(ACE_ROOT)/ACEXML/examples/SAXPrint/. @@ -36,4 +36,4 @@ </ul> -*/
\ No newline at end of file +*/ diff --git a/ACEXML/docs/parser_features.txt b/ACEXML/docs/parser_features.txt index 164ecbe55bd..c65930e32a2 100644 --- a/ACEXML/docs/parser_features.txt +++ b/ACEXML/docs/parser_features.txt @@ -12,10 +12,14 @@ has been activated or not can be queried using @c getFeature. Here is a list of supported features: <OL> - <li> None so far. We are integrating a dummy debug validator into - the parser which will use the string "Dummy Debug Validator" to turn - the feature on/off. + <li> namespaces - When this feature is enabled, ACEXML parser allows + access by namespace qualified names. + + <li> namespace_prefixes - Normally the list of attributes returned by the + parser will not contain attributes used as namespace declarations + (xmlns:foo="bar"). When this feature is enabled, the list of attributes + contains the namespace declarations also. </OL> @} -*/
\ No newline at end of file +*/ diff --git a/ACEXML/examples/SAXPrint/Print_Handler.cpp b/ACEXML/examples/SAXPrint/Print_Handler.cpp index 2286fc0ca1e..b1db82d32cc 100644 --- a/ACEXML/examples/SAXPrint/Print_Handler.cpp +++ b/ACEXML/examples/SAXPrint/Print_Handler.cpp @@ -53,7 +53,7 @@ ACEXML_Print_Handler::endElement (const ACEXML_Char *uri, ACE_UNUSED_ARG (xmlenv); ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("* Event endElement (%s, %s, ) ***************\n"), + ACE_LIB_TEXT ("* Event endElement (%s, %s, %s) ***************\n"), uri, name, qName)); } diff --git a/ACEXML/examples/SAXPrint/main.cpp b/ACEXML/examples/SAXPrint/main.cpp index a16dc027d67..1430df1d2a2 100644 --- a/ACEXML/examples/SAXPrint/main.cpp +++ b/ACEXML/examples/SAXPrint/main.cpp @@ -13,14 +13,15 @@ static const ACEXML_Char *test_string = ACE_TEXT ("<?xml version='1.0'?> <ACE_Svc_Conf> <static id=\"ACE_Service_Manager\" params='-d -p 4911'/> <dynamic id=\"Test_Task\" type=\"service_object\"> A & <initializer path=\"CCM_App\" init='_make_Test_Task' params='-p 3000'/> </dynamic> </ACE_Svc_Conf>"); static void -usage () +usage (const ACE_TCHAR* program) { ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Usage: main [-sl] [-f <filename> | -u <url>]\n") - ACE_TEXT (" -s: Use SAXPrint_Handler (Default is Print_Handler\n") - ACE_TEXT (" -l: Parse the internal strings (test the StrCharStream class\n") + ACE_TEXT ("Usage: %s [-sl] [-f <filename> | -u <url>]\n") + ACE_TEXT (" -s: Use SAXPrint_Handler (Default is Print_Handler)\n") + ACE_TEXT (" -l: Parse the internal strings (test the StrCharStream class)\n") ACE_TEXT (" -f: Specify the filename when -l is not specified\n") - ACE_TEXT (" -u: URL specifying the path to the file\n"))); + ACE_TEXT (" -u: URL specifying the path to the file\n"), + program)); } int @@ -32,9 +33,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACEXML_Char* url = 0; ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("sf:lu:")); - ACEXML_Char c; + char c; - while ((c = get_opt ()) != -1) + while ((c = get_opt ()) != EOF) { switch (c) { @@ -51,22 +52,23 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) url = get_opt.opt_arg(); break; default: - usage(); + usage(argv[0]); return -1; } } if (str == 0 && filename == 0 && url == 0) { - usage(); + usage(argv[0]); return -1; } ACEXML_DefaultHandler *handler = 0; + ACEXML_CharStream *stm = 0; + ACEXML_FileCharStream *fstm = 0; + ACEXML_HttpCharStream *ustm = 0; { - ACEXML_CharStream *stm = 0; if (filename != 0) { - ACEXML_FileCharStream *fstm = 0; ACE_NEW_RETURN (fstm, ACEXML_FileCharStream (), -1); @@ -80,7 +82,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) } else if (url != 0) { - ACEXML_HttpCharStream *ustm = 0; + ACE_NEW_RETURN (ustm, ACEXML_HttpCharStream (), -1); @@ -117,9 +119,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACEXML_Env xmlenv; parser.parse (&input, xmlenv); - // if (xmlenv.exception ()) - // xmlenv.exception ()->print (); } delete handler; + delete fstm; + delete ustm; return 0; } diff --git a/ACEXML/parser/parser/Entity_Manager.cpp b/ACEXML/parser/parser/Entity_Manager.cpp index 651742476af..d0c86862805 100644 --- a/ACEXML/parser/parser/Entity_Manager.cpp +++ b/ACEXML/parser/parser/Entity_Manager.cpp @@ -20,7 +20,7 @@ static const ACEXML_Char quot_value[] = {'"', 0}; ACEXML_Entity_Manager::ACEXML_Entity_Manager (void) : entities_ () { - // @@ No way to know if these bindings success or not. + // @@ No way to know if these bindings succeed or not. ACEXML_String ampname (amp_name, 0, 0); ACEXML_String ampvalue (amp_value, 0, 0); diff --git a/ACEXML/parser/parser/Parser.cpp b/ACEXML/parser/parser/Parser.cpp index 57eafaed2de..c968f91a4af 100644 --- a/ACEXML/parser/parser/Parser.cpp +++ b/ACEXML/parser/parser/Parser.cpp @@ -47,17 +47,17 @@ ACEXML_Parser::getFeature (const ACEXML_Char *name, // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException, // ACEXML_SAXNotSupportedException)) { - if (ACE_OS_String::strcmp (name, + if (ACE_OS::strcmp (name, ACEXML_Parser::simple_parsing_feature_) == 0) { return this->simple_parsing_; } - else if (ACE_OS_String::strcmp (name, + else if (ACE_OS::strcmp (name, ACEXML_Parser::namespaces_feature_) == 0) { return this->namespaces_; } - else if (ACE_OS_String::strcmp (name, + else if (ACE_OS::strcmp (name, ACEXML_Parser::namespace_prefixes_feature_) == 0) { return this->namespace_prefixes_; @@ -67,18 +67,7 @@ ACEXML_Parser::getFeature (const ACEXML_Char *name, return -1; } -void * -ACEXML_Parser::getProperty (const ACEXML_Char *name, - ACEXML_Env &xmlenv) - // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException, - // ACEXML_SAXNotSupportedException)) -{ - // @@ Not implemented. - ACE_UNUSED_ARG (name); - xmlenv.exception (new ACEXML_SAXNotSupportedException ()); - return 0; -} void ACEXML_Parser::setFeature (const ACEXML_Char *name, @@ -87,19 +76,19 @@ ACEXML_Parser::setFeature (const ACEXML_Char *name, // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException, // ACEXML_SAXNotSupportedException)) { - if (ACE_OS_String::strcmp (name, + if (ACE_OS::strcmp (name, ACEXML_Parser::simple_parsing_feature_) == 0) { this->simple_parsing_ = (boolean_value == 0 ? 0 : 1); return; } - else if (ACE_OS_String::strcmp (name, + else if (ACE_OS::strcmp (name, ACEXML_Parser::namespaces_feature_) == 0) { this->namespaces_ = (boolean_value == 0 ? 0 : 1); return; } - else if (ACE_OS_String::strcmp (name, + else if (ACE_OS::strcmp (name, ACEXML_Parser::namespace_prefixes_feature_) == 0) { this->namespace_prefixes_ = (boolean_value == 0 ? 0 : 1); @@ -110,6 +99,19 @@ ACEXML_Parser::setFeature (const ACEXML_Char *name, return; } +void * +ACEXML_Parser::getProperty (const ACEXML_Char *name, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException, + // ACEXML_SAXNotSupportedException)) +{ + // @@ Not implemented. + ACE_UNUSED_ARG (name); + + xmlenv.exception (new ACEXML_SAXNotSupportedException ()); + return 0; +} + void ACEXML_Parser::setProperty (const ACEXML_Char *name, void *value, @@ -126,29 +128,41 @@ ACEXML_Parser::setProperty (const ACEXML_Char *name, } void -ACEXML_Parser::report_error (ACEXML_SAXParseException& exception, +ACEXML_Parser::report_error (const ACEXML_Char* message, ACEXML_Env& xmlenv) { + ACEXML_SAXParseException* exception = 0; + ACE_NEW_NORETURN (exception, + ACEXML_SAXParseException (message)); + xmlenv.exception (exception); if (this->error_handler_) - this->error_handler_->error (exception, xmlenv); + this->error_handler_->error (*exception, xmlenv); return; } void -ACEXML_Parser::report_warning (ACEXML_SAXParseException& exception, +ACEXML_Parser::report_warning (const ACEXML_Char* message, ACEXML_Env& xmlenv) { + ACEXML_SAXParseException* exception = 0; + ACE_NEW_NORETURN (exception, + ACEXML_SAXParseException (message)); + xmlenv.exception (exception); if (this->error_handler_) - this->error_handler_->warning (exception, xmlenv); + this->error_handler_->warning (*exception, xmlenv); return; } void -ACEXML_Parser::report_fatal_error (ACEXML_SAXParseException& exception, +ACEXML_Parser::report_fatal_error (const ACEXML_Char* message, ACEXML_Env& xmlenv) { + ACEXML_SAXParseException* exception = 0; + ACE_NEW_NORETURN (exception, + ACEXML_SAXParseException (message)); + xmlenv.exception (exception); if (this->error_handler_) - this->error_handler_->fatalError (exception, xmlenv); + this->error_handler_->fatalError (*exception, xmlenv); return; } @@ -157,15 +171,9 @@ ACEXML_Parser::parse (ACEXML_InputSource *input, ACEXML_Env &xmlenv) // ACE_THROW_SPEC ((ACEXML_SAXException)) { - ACEXML_SAXParseException* exception = 0; // store the exception - if (input == 0 || (this->instream_ = input->getCharStream ()) == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("No valid input source available"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Invalid input source"), xmlenv); return; } @@ -181,15 +189,7 @@ ACEXML_Parser::parse (ACEXML_InputSource *input, this->parse_xml_prolog (xmlenv); ACEXML_CHECK; } - // The nesting of events reported should be as follows: - // startDocument - // startDTD - // .... - // endDTD - // startElement - // .... - // endElement - // endDocument + this->content_handler_->startDocument (xmlenv); ACEXML_CHECK; @@ -199,11 +199,7 @@ ACEXML_Parser::parse (ACEXML_InputSource *input, { if (this->skip_whitespace (0) != '<') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Expecting '<'"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Expecting '<'"), xmlenv); return; } ACEXML_Char fwd = this->peek (); @@ -224,21 +220,14 @@ ACEXML_Parser::parse (ACEXML_InputSource *input, { if (this->grok_comment () < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Invalid comment"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Invalid comment"), + xmlenv); return; } } else { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Duplicate DOCTYPE definitions"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Duplicate DOCTYPE definitions"), xmlenv); return; } break; @@ -247,13 +236,8 @@ ACEXML_Parser::parse (ACEXML_InputSource *input, ACEXML_CHECK; break; case 0: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unexpected EOF"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Unexpected EOF"), xmlenv); return; - break; default: // Root element begins prolog_done = 1; break; @@ -284,86 +268,29 @@ ACEXML_Parser::parse (const ACEXML_Char *systemId, } -ACEXML_Char -ACEXML_Parser::skip_whitespace (ACEXML_Char **whitespace) -{ - ACEXML_Char ch = this->get (); - - if (this->is_whitespace (ch) == 0) - { - if (whitespace != 0) - *whitespace = 0; - return ch; - } - - do - { - if (whitespace != 0) - this->obstack_.grow (ch); - ch = this->get (); - } - while (this->is_whitespace (ch)); - - if (whitespace != 0) - *whitespace = this->obstack_.freeze (); - - return ch; -} - -int -ACEXML_Parser::skip_whitespace_count (ACEXML_Char *peeky) -{ - int wscount = 0; - ACEXML_Char dummy; - ACEXML_Char &forward = (peeky == 0 ? dummy : *peeky); - - for (;this->is_whitespace ((forward = this->peek ())); ++wscount) - this->get (); - - return wscount; -} - void ACEXML_Parser::parse_xml_prolog (ACEXML_Env &xmlenv) // ACE_THROW_SPEC ((ACEXML_SAXException)) { - ACEXML_SAXParseException* exception = 0; - if (this->get () != '<' || - this->get () != '?' || - this->get () != 'x' || - this->get () != 'm' || - this->get () != 'l') + if (this->parse_token (ACE_LIB_TEXT("<?xml")) < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl ('<?xml' ?)"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Invalid XMLDecl ('<?xml' ?)"), + xmlenv); return; } ACEXML_Char *astring; - if (this->skip_whitespace (0) != 'v' || // Discard whitespace - this->get () != 'e' || - this->get () != 'r' || - this->get () != 's' || - this->get () != 'i' || - this->get () != 'o' || - this->get () != 'n' || - this->skip_equal () != 0 || - this->get_quoted_string (astring) != 0) + if (this->skip_whitespace (0) != 'v' // Discard whitespace + || (this->parse_token (ACE_LIB_TEXT("ersion")) < 0) + || this->skip_equal () != 0 + || this->get_quoted_string (astring) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl ('version'?)"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Unrecognized XMLDecl ('version'?)"), + xmlenv); return; } - // @@ Handle version number here. - int xmldecl_state = 0; int seen_encoding = 0; @@ -375,58 +302,32 @@ ACEXML_Parser::parse_xml_prolog (ACEXML_Env &xmlenv) fwd = this->skip_whitespace (0); // Discard whitespace if (fwd == '?') { - // Do nothing. Fall down to consume the '?' - // and wrap up the XML Decl parsing. + // Fall down to consume the '?' and wrap up the XML Decl parsing. } else if (xmldecl_state == 0 && fwd == 'e') { - if (this->get () == 'n' && - this->get () == 'c' && - this->get () == 'o' && - this->get () == 'd' && - this->get () == 'i' && - this->get () == 'n' && - this->get () == 'g' && + if ((this->parse_token (ACE_LIB_TEXT("ncoding")) == 0) && this->skip_equal () == 0 && this->get_quoted_string (astring) == 0) { if (seen_encoding) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Duplicate encoding defined"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Duplicate encoding defined"), + xmlenv); return; } else seen_encoding = 1; // @@ Handle encoding here. We don't handle // various encodings for this parser. - continue; } else - { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl ('encoding'?)"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); - return; - } + break; } else if (xmldecl_state < 2 && fwd == 's') { - if (this->get () == 't' && - this->get () == 'a' && - this->get () == 'n' && - this->get () == 'd' && - this->get () == 'a' && - this->get () == 'l' && - this->get () == 'o' && - this->get () == 'n' && - this->get () == 'e' && + if ((this->parse_token (ACE_LIB_TEXT("tandalone")) == 0) && this->skip_equal () == 0 && this->get_quoted_string (astring) == 0) { @@ -442,37 +343,18 @@ ACEXML_Parser::parse_xml_prolog (ACEXML_Env &xmlenv) continue; } } - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl ('standalone'?)"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); - return; + break; } else - { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl ('standalone'?)"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); - return; - } - } - this->get (); // consume '?' - - if (this->get() != '>') - { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unrecognized XML Decl ('>'?)"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); - return; + break; } + if (this->parse_token (ACE_LIB_TEXT ("?>")) < 0) + break; return; - } - // End parsing XML Decl. + } // End parsing XML Decl. + this->report_fatal_error (ACE_LIB_TEXT ("Unrecognized XML Decl ('standalone'?)"), + xmlenv); + return; } int @@ -501,57 +383,21 @@ ACEXML_Parser::grok_comment (void) return 0; } -ACEXML_Char * -ACEXML_Parser::read_name (ACEXML_Char ch) -{ - if (ch == 0) - { - ch = this->get (); - - if (this->is_whitespace (ch)) - // No white space is allowed here. - return 0; - } - else if (this->is_nonname (ch)) - return 0; - - while (1) - { - this->obstack_.grow (ch); - ch = this->peek (); - if (this->is_nonname (ch)) - break; - ch = this->get (); - }; - - return this->obstack_.freeze (); -} - int ACEXML_Parser::parse_processing_instruction (ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; - if (this->get () != '?') { // How did we get here? - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Internal error"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Internal error"), xmlenv); return -1; } const ACEXML_Char *pitarget = this->read_name (); ACEXML_Char *instruction = 0; - if (ACE_OS_String::strcasecmp (ACE_LIB_TEXT ("xml"), pitarget) != 0) + if (ACE_OS::strcasecmp (ACE_LIB_TEXT ("xml"), pitarget) != 0) { // Invalid PITarget name. - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("PITarget name cannot start with 'xml'"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("PITarget name cannot start with 'xml'"), xmlenv); return -1; } @@ -597,32 +443,18 @@ int ACEXML_Parser::parse_doctypedecl (ACEXML_Env &xmlenv) // ACE_THROW_SPEC ((ACEXML_SAXException)) { - ACEXML_SAXParseException* exception = 0; - - if (this->get () != 'D' || - this->get () != 'O' || - this->get () != 'C' || - this->get () != 'T' || - this->get () != 'Y' || - this->get () != 'P' || - this->get () != 'E') + if (this->parse_token (ACE_LIB_TEXT ("DOCTYPE")) < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Expecting keyword 'DOCTYPE'"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Expecting keyword 'DOCTYPE'"), + xmlenv); return -1; } ACEXML_Char nextch = this->skip_whitespace (0); if (nextch == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Expecting a DOCTYPE name"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Expecting a DOCTYPE name"), + xmlenv); return -1; } @@ -643,14 +475,14 @@ ACEXML_Parser::parse_doctypedecl (ACEXML_Env &xmlenv) this->dtd_system_)); else ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("==> ACEXML Parser got DTD external id: PUBLIC %s %s\n"), + ACE_LIB_TEXT ("ACEXML Parser got DTD external id: PUBLIC %s %s\n"), this->dtd_public_, this->dtd_system_)); } nextch = this->skip_whitespace (0); switch (nextch) { - case '[': // Internal DTD definitionl + case '[': // Internal DTD definition if (this->parse_internal_dtd (xmlenv) < 0) return -1; // Error in markupdecl break; @@ -658,11 +490,7 @@ ACEXML_Parser::parse_doctypedecl (ACEXML_Env &xmlenv) // this is an XML document without a dectypedecl. return 0; case '0': - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unexpected EOF"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Unexpected EOF"), xmlenv); return -1; default: break; @@ -670,11 +498,7 @@ ACEXML_Parser::parse_doctypedecl (ACEXML_Env &xmlenv) if (this->skip_whitespace (0) != '>') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Internal error"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Internal error"), xmlenv); return -1; } return 0; @@ -684,40 +508,26 @@ void ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) // ACE_THROW_SPEC ((ACEXML_SAXException)) { - ACEXML_SAXParseException* exception = 0; - // Parse STag. - const ACEXML_Char *startname = this->read_name (); - if (startname == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unexpected EOF"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Unexpected EOF"), xmlenv); return; } - - if (is_root && - this->doctype_ != 0 && - ACE_OS_String::strcmp (startname, this->doctype_) != 0) + if (is_root && this->doctype_ != 0 + && ACE_OS::strcmp (startname, this->doctype_) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Root element missing."))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Root element missing"), xmlenv); return; } - - const ACEXML_Char *endname = 0; ACEXML_AttributesImpl attributes; ACEXML_Char ch; int new_namespace = 0; + const ACEXML_Char *endname = 0; const ACEXML_Char *ns_uri, *ns_lname; // namespace URI and localName - + ACEXML_Char* prefix = 0; + ACEXML_Char* name = 0; for (int start_element_done = 0; start_element_done == 0;) { ch = this->skip_whitespace (0); @@ -725,57 +535,30 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) switch (ch) { case 0: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Internal error"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Internal error"), xmlenv); return; - case '/': if (this->get () != '>') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT (" Expecting '>'"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Expecting '>'"), xmlenv); return; } else { this->xml_namespace_.processName(startname, ns_uri, ns_lname, 0); - ACEXML_Char* temp = ACE::strnew (startname); - ACE_Auto_Basic_Array_Ptr<ACEXML_Char> cleanup_temp (temp); - ACE_Tokenizer ns_att (temp); - ns_att.delimiter_replace (':', 0); - ACEXML_Char* prefix = ns_att.next (); - ACEXML_Char* name = ns_att.next(); - if (this->namespaces_) - { - if (name == 0) - prefix = 0; - this->content_handler_->startPrefixMapping (prefix, - ns_uri, - xmlenv); + prefix = ACE_const_cast (ACEXML_Char*, + this->xml_namespace_.getPrefix(ns_uri)); + this->report_prefix_mapping (prefix, ns_uri, ns_lname, 1, xmlenv); ACEXML_CHECK; - } - this->content_handler_->startElement (ns_uri, - ns_lname, - startname, - &attributes, + this->content_handler_->startElement (ns_uri, ns_lname, + startname, &attributes, xmlenv); ACEXML_CHECK; - this->content_handler_->endElement (ns_uri, - ns_lname, - startname, + this->content_handler_->endElement (ns_uri, ns_lname, startname, xmlenv); ACEXML_CHECK; - if (this->namespaces_) - { - this->content_handler_->endPrefixMapping (prefix, xmlenv); - ACEXML_CHECK; - } + this->report_prefix_mapping (prefix, ns_uri, ns_lname, 0, xmlenv); + ACEXML_CHECK; } if (new_namespace != 0) this->xml_namespace_.popContext (); @@ -784,26 +567,12 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) case '>': { this->xml_namespace_.processName (startname, ns_uri, ns_lname, 0); - ACEXML_Char* temp = ACE::strnew (startname); - ACE_Auto_Basic_Array_Ptr<ACEXML_Char> cleanup_temp (temp); - ACE_Tokenizer ns_att (temp); - ns_att.delimiter_replace (':', 0); - ACEXML_Char* prefix = ns_att.next (); - ACEXML_Char* name = ns_att.next(); - if (this->namespaces_) - { - if (name == 0) - prefix = 0; - this->content_handler_->startPrefixMapping (prefix, - ns_uri, - xmlenv); - ACEXML_CHECK; - } - this->content_handler_->startElement (ns_uri, - ns_lname, - startname, - &attributes, - xmlenv); + prefix = ACE_const_cast (ACEXML_Char*, + this->xml_namespace_.getPrefix (ns_uri)); + this->report_prefix_mapping (prefix, ns_uri, ns_lname, 1, xmlenv); + ACEXML_CHECK; + this->content_handler_->startElement (ns_uri, ns_lname, startname, + &attributes, xmlenv); ACEXML_CHECK; start_element_done = 1; break; @@ -816,21 +585,13 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) this->skip_equal () != 0 || this->get_quoted_string (attvalue) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Error reading attribute"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Error reading attribute"),xmlenv); return; } // Handling new namespace if any. Notice that the order of // namespace declaration does matter. - if (attname[0] == 'x' && - attname[1] == 'm' && - attname[2] == 'l' && - attname[3] == 'n' && - attname[4] == 's') + if (ACE_OS::strncmp (attname, ACE_LIB_TEXT("xmlns"), 5) == 0) { if (this->namespaces_) { @@ -839,65 +600,30 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) this->xml_namespace_.pushContext (); new_namespace = 1; } - - ACE_Tokenizer ns_att (attname); - ns_att.delimiter_replace (':', 0); - - ACEXML_Char *xmlns_prefix, *ns_name; - xmlns_prefix = ns_att.next (); - ns_name = ns_att.next (); - if (ns_name == 0) - { - if (this->xml_namespace_.declarePrefix (empty_string, - attvalue) == -1) - { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Invalid namespace p ref ix"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); - return; - } - } - else + name = ACE_OS::strchr (attname, ':'); + const ACEXML_Char* ns_name = (name == 0)?empty_string:name+1; + if (this->xml_namespace_.declarePrefix (ns_name, + attvalue) == -1) { - if (this->xml_namespace_.declarePrefix (ns_name, - attvalue) == -1) - { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Duplicate namespace pr efix"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); - return; - } + this->report_fatal_error(ACE_LIB_TEXT ("Duplicate namespace prefix"),xmlenv); + return; } } if (this->namespace_prefixes_) { // Namespace_prefixes_feature_ is required. So add the // xmlns:foo to the list of attributes. - if (attributes.addAttribute (0, - 0, - attname, + if (attributes.addAttribute (0, 0, attname, default_attribute_type, attvalue) == -1) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Duplicate attribute found"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Duplicate attribute found"),xmlenv); return; } } if (!this->namespaces_ && !this->namespace_prefixes_) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Both namespaces feature and namespace_prefixes feature are false. Illegal Mode"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Both namespaces feature and namespace_prefixes feature are false. Illegal Mode"), xmlenv); return; } } @@ -905,17 +631,11 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) { const ACEXML_Char *uri, *lName; this->xml_namespace_.processName (attname, uri, lName, 1); - if (attributes.addAttribute (uri, - lName, - attname, + if (attributes.addAttribute (uri, lName, attname, default_attribute_type, attvalue) == -1) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Duplicate attribute found"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Duplicate attribute found"),xmlenv); return; } } @@ -928,26 +648,19 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) // Parse element contents. while (1) { - ch = this->get (); + ACEXML_Char ch = this->get (); switch (ch) { case 0: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Internal error"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Internal error"), xmlenv); return; - case '<': // Push out old 'characters' event. if (cdata_length != 0) { cdata = this->obstack_.freeze (); - this->content_handler_->characters (cdata, - 0, - cdata_length, + this->content_handler_->characters (cdata, 0, cdata_length, xmlenv); ACEXML_CHECK; cdata_length = 0; @@ -962,11 +675,7 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) { if (this->grok_comment () < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Error parsing comment"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Error parsing comment"), xmlenv); return; } } @@ -977,11 +686,7 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) } else { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unexpected character"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Unexpected character"), xmlenv); return; } break; @@ -994,44 +699,24 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) this->get (); // consume '/' endname = this->read_name (); if (endname == 0 || - ACE_OS_String::strcmp (startname, endname) != 0) + ACE_OS::strcmp (startname, endname) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT - ("Mismatched End-tag encountered"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Mismatched End-tag encountered"), xmlenv); return ; } if (this->skip_whitespace (0) != '>') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT - ("Expecting '>' in an end-tag"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Expecting '>' in an end-tag"), xmlenv); return; } - this->content_handler_->endElement (ns_uri, - ns_lname, - endname, + this->content_handler_->endElement (ns_uri, ns_lname, endname, xmlenv); ACEXML_CHECK; - ACEXML_Char* temp = ACE::strnew (startname); - ACE_Auto_Basic_Array_Ptr<ACEXML_Char> cleanup_temp (temp); - ACE_Tokenizer ns_att (temp); - ns_att.delimiter_replace (':', 0); - ACEXML_Char* prefix = ns_att.next (); - ACEXML_Char* name = ns_att.next(); - if (this->namespaces_) - { - if (name == 0) - prefix = 0; - this->content_handler_->endPrefixMapping (prefix, xmlenv); + prefix = ACE_const_cast (ACEXML_Char*, + this->xml_namespace_.getPrefix(ns_uri)); + this->report_prefix_mapping (prefix, ns_uri, ns_lname, 0, + xmlenv); ACEXML_CHECK; - } if (new_namespace != 0) this->xml_namespace_.popContext (); return; @@ -1063,12 +748,8 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) if (replace == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT - ("Internal Error?"))); - xmlenv.exception (exception); - this->report_fatal_error(*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Internal error"), + xmlenv); return; } if (this->try_grow_cdata (replace->length (), @@ -1103,6 +784,10 @@ ACEXML_Parser::parse_element (int is_root, ACEXML_Env &xmlenv) } } } + // Cleanup the prefix and name +// delete[] prefix; +// delete[] name; + return; } int @@ -1231,21 +916,9 @@ ACEXML_Parser::parse_reference (void) int ACEXML_Parser::parse_cdata (ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; - - if (this->get () != '[' || - this->get () != 'C' || - this->get () != 'D' || - this->get () != 'A' || - this->get () != 'T' || - this->get () != 'A' || - this->get () != '[') + if (this->parse_token (ACE_LIB_TEXT ("[CDATA[")) < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("'[CDATA[' expected"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("'[CDATA[' expected"), xmlenv); return -1; } @@ -1312,8 +985,6 @@ ACEXML_Parser::parse_cdata (ACEXML_Env &xmlenv) int ACEXML_Parser::try_grow_cdata (size_t size, size_t &len, ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; - if (this->obstack_.request (size) != 0) { if (len != 0) @@ -1321,12 +992,7 @@ ACEXML_Parser::try_grow_cdata (size_t size, size_t &len, ACEXML_Env &xmlenv) ACEXML_Char *cdata = this->obstack_.freeze (); if (cdata == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT - ("Internal Error growing CDATA buffer"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Internal Error growing CDATA buffer"), xmlenv); return -1; } this->content_handler_->characters (cdata, @@ -1338,95 +1004,16 @@ ACEXML_Parser::try_grow_cdata (size_t size, size_t &len, ACEXML_Env &xmlenv) if (this->obstack_.request (size) == 0) return 0; } - - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT - ("Internal Error, buffer overflowed"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Internal Error, buffer overflowed"), xmlenv); return -1; } return 0; } -int -ACEXML_Parser::skip_equal (void) -{ - if (this->skip_whitespace (0) != '=') - return -1; - - while (this->is_whitespace (this->peek ())) - this->get (); - return 0; -} - -int -ACEXML_Parser::get_quoted_string (ACEXML_Char *&str) -{ - ACEXML_Char quote = this->get (); - if (quote != '\'' && quote != '"') // Not a quoted string. - return -1; - - while (1) - { - ACEXML_Char ch = this->get (); - - // @@ Deoes not handle buffer overflow yet. - if (ch == quote) - { - str = this->obstack_.freeze (); - return 0; - } - - const ACEXML_String *replace = 0; - ACEXML_String charval; - ACEXML_Char buffer[6]; - size_t i = 0; - - switch (ch) - { - case '&': - if (this->peek () == '#') - { - if (this->parse_char_reference (buffer, 6) != 0) - { - // xmlenv.exception (new ACEXML_SAXParseException - // (ACE_LIB_TEXT ("CharRef does not resolves to a valid character"))); - return -1; - } - charval.set (buffer, 0); - replace = &charval; - } - else - replace = this->parse_reference (); - - if (replace == 0) - { - // xmlenv.exception (new ACEXML_SAXParseException - // (ACE_LIB_TEXT ("Undefined reference"))); - return -1; - } - for (i = 0; i < replace->length (); ++i) - this->obstack_.grow ((*replace)[i]); - // handle reference here. - break; - case 0x0D: // End-of-Line handling - ch = (this->peek () == 0x0A ? this->get () : 0x0A); - // Fall thru... - case 0x0A: - // Fall thru... - default: - this->obstack_.grow (ch); - break; - } - } -} int ACEXML_Parser::parse_internal_dtd (ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; ACEXML_Char nextch = this->skip_whitespace (0); do { @@ -1457,11 +1044,7 @@ ACEXML_Parser::parse_internal_dtd (ACEXML_Env &xmlenv) break; default: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Invalid keyword in decl spec"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Invalid keyword in decl spec"), xmlenv); return -1; } break; @@ -1479,27 +1062,16 @@ ACEXML_Parser::parse_internal_dtd (ACEXML_Env &xmlenv) case '-': // a comment. if (this->grok_comment () < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Error parsing comment"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT ("Error parsing comment"), xmlenv); return -1; } break; case 0: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unexpected EOF"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Unexpected EOF"), + xmlenv); return -1; default: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Invalid char. follows '<!' in markupdecl"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Invalid char. follows '<!' in markupdecl"), xmlenv); return -1; } break; @@ -1510,18 +1082,11 @@ ACEXML_Parser::parse_internal_dtd (ACEXML_Env &xmlenv) break; case 0: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unexpected EOF"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Unexpected EOF"), + xmlenv); return -1; default: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Invalid char. follows '<!' in markupdecl"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Invalid char. follows '<!' in markupdecl"), xmlenv); return -1; } break; @@ -1535,19 +1100,12 @@ ACEXML_Parser::parse_internal_dtd (ACEXML_Env &xmlenv) case 0: // This may not be an error if we decide // to generalize this function to handle both // internal and external DTD definitions. - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unexpected EOF"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Unexpected EOF"), + xmlenv); return -1; default: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Expecting markupdecl or DecSep"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Expecting markupdecl or DecSep"), xmlenv); return -1; }; @@ -1566,31 +1124,18 @@ ACEXML_Parser::parse_internal_dtd (ACEXML_Env &xmlenv) int ACEXML_Parser::parse_element_decl (ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; - if (this->get () != 'L' || - this->get () != 'E' || - this->get () != 'M' || - this->get () != 'E' || - this->get () != 'N' || - this->get () != 'T' || + if ((this->parse_token (ACE_LIB_TEXT ("LEMENT")) < 0) || this->skip_whitespace_count () == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Expecting keyword `ELEMENT'"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Expecting keyword `ELEMENT'"), + xmlenv); return -1; } ACEXML_Char *element_name = this->read_name (); if (element_name == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Error reading element name while defining ELEMENT."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Error reading element name while defining ELEMENT."), xmlenv); return -1; } @@ -1600,53 +1145,30 @@ ACEXML_Parser::parse_element_decl (ACEXML_Env &xmlenv) switch (nextch) { case 'E': // EMPTY - if (this->get () != 'E' || - this->get () != 'M' || - this->get () != 'P' || - this->get () != 'T' || - this->get () != 'Y') + if (this->parse_token (ACE_LIB_TEXT ("EMPTY")) < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Expecting keyword `EMPTY' in ELEMENT definition."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Expecting keyword `EMPTY' in ELEMENT definition."), xmlenv); return -1; } break; case 'A': // ANY - if (this->get () != 'A' || - this->get () != 'N' || - this->get () != 'Y') + if (this->parse_token (ACE_LIB_TEXT ("ANY")) < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Expecting keyword `ANY' in ELEMENT definition."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Expecting keyword `ANY' in ELEMENT definition."), xmlenv); return -1; } break; case '(': // children this->parse_children_definition (xmlenv); - if (xmlenv.exception () != 0) - return -1; + ACEXML_CHECK_RETURN (-1); break; default: // error - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Error reading ELEMENT definition."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Error reading ELEMENT definition."), xmlenv); return -1; } if (this->skip_whitespace (0) != '>') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Expecting '>' in ELEMENT definition."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Expecting '>' in ELEMENT definition."), xmlenv); return -1; } return 0; @@ -1655,22 +1177,13 @@ ACEXML_Parser::parse_element_decl (ACEXML_Env &xmlenv) int ACEXML_Parser::parse_entity_decl (ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; - ACEXML_Char nextch; - if (this->get () != 'N' || - this->get () != 'T' || - this->get () != 'I' || - this->get () != 'T' || - this->get () != 'Y' || + if ((this->parse_token (ACE_LIB_TEXT ("NTITY")) < 0) || this->skip_whitespace_count (&nextch) == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Expecting keyword `ENTITY'"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Expecting keyword `ENTITY'"), + xmlenv); return -1; } @@ -1681,11 +1194,7 @@ ACEXML_Parser::parse_entity_decl (ACEXML_Env &xmlenv) this->get (); // consume the '%' if (this->skip_whitespace_count (&nextch) == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Can't use a reference when defining entity name"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Can't use a reference when defining entity name"), xmlenv); return -1; } } @@ -1693,11 +1202,8 @@ ACEXML_Parser::parse_entity_decl (ACEXML_Env &xmlenv) ACEXML_Char *entity_name = this->read_name (); if (entity_name == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Error reading ENTITY name."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error (ACE_LIB_TEXT ("Error reading ENTITY name."), + xmlenv); return -1; } @@ -1709,11 +1215,8 @@ ACEXML_Parser::parse_entity_decl (ACEXML_Env &xmlenv) if (this->get_quoted_string (entity_value) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Error reading ENTITY value."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error reading ENTITY value."), + xmlenv); return -1; } @@ -1721,11 +1224,7 @@ ACEXML_Parser::parse_entity_decl (ACEXML_Env &xmlenv) { if (this->entities_.add_entity (entity_name, entity_value) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Error storing entity definition (duplicate definition?)"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error storing entity definition (duplicate definition?)"), xmlenv); return -1; } } @@ -1741,44 +1240,26 @@ ACEXML_Parser::parse_entity_decl (ACEXML_Env &xmlenv) ACEXML_Char *systemid, *publicid; this->parse_external_id_and_ref (publicid, systemid, xmlenv); - if (xmlenv.exception () != 0) - return -1; - + ACEXML_CHECK_RETURN (-1); if (systemid == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Invalid ExternalID definition (system ID missing.)"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Invalid ExternalID definition (system ID missing.)"), xmlenv); return -1; } - this->skip_whitespace_count (&nextch); if (nextch == 'N') // NDATA section followed { if (is_GEDecl == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Unexpected keyword NDATA in PEDecl."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Unexpected keyword NDATA in PEDecl."), xmlenv); return -1; } - if (this->get () != 'N' || - this->get () != 'D' || - this->get () != 'A' || - this->get () != 'T' || - this->get () != 'A' || + if ((this->parse_token (ACE_LIB_TEXT ("NDATA")) < 0) || this->skip_whitespace_count (&nextch) == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT ("Expecting keyword NDATA."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword NDATA"), + xmlenv); return -1; } @@ -1788,8 +1269,7 @@ ACEXML_Parser::parse_entity_decl (ACEXML_Env &xmlenv) systemid, ndata, xmlenv); - if (xmlenv.exception () != 0) - return -1; + ACEXML_CHECK_RETURN (-1); } else { @@ -1812,11 +1292,7 @@ ACEXML_Parser::parse_entity_decl (ACEXML_Env &xmlenv) // End of ENTITY definition if (this->skip_whitespace (0) != '>') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting end of ENTITY definition."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting end of ENTITY definition."), xmlenv); return -1; } return 0; @@ -1825,33 +1301,18 @@ ACEXML_Parser::parse_entity_decl (ACEXML_Env &xmlenv) int ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; - - if (this->get () != 'A' || - this->get () != 'T' || - this->get () != 'T' || - this->get () != 'L' || - this->get () != 'I' || - this->get () != 'S' || - this->get () != 'T' || + if ((this->parse_token (ACE_LIB_TEXT ("ATTLIST")) < 0) || this->skip_whitespace_count () == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `ATTLIST'"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `ATTLIST'"), + xmlenv); return -1; } ACEXML_Char *element_name = this->read_name (); if (element_name == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Error reading element name while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error reading element name while defining ATTLIST."), xmlenv); return -1; } @@ -1864,11 +1325,7 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) ACEXML_Char *att_name = this->read_name (nextch); if (att_name == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Error reading attribute name while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error reading attribute name while defining ATTLIST."), xmlenv); return -1; } @@ -1890,17 +1347,10 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) switch (nextch) { case 'C': // CDATA - if (this->get () != 'D' || - this->get () != 'A' || - this->get () != 'T' || - this->get () != 'A' || + if ((this->parse_token (ACE_LIB_TEXT ("DATA")) < 0) || this->skip_whitespace_count () == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `CDATA' while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `CDATA' while defining ATTLIST."), xmlenv); return -1; } // Else, we have successfully identified the type of the @@ -1912,13 +1362,11 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) { if (this->skip_whitespace_count (&nextch) > 0) { - // We have successfully identified the type of the attribute as ID - // @@ Set up validator as such. + // We have successfully identified the type of the + // attribute as ID @@ Set up validator as such. break; } - if (this->get () == 'R' && - this->get () == 'E' && - this->get () == 'F') + if (this->parse_token (ACE_LIB_TEXT ("REF")) == 0) { if (this->skip_whitespace_count (&nextch) > 0) { @@ -1939,17 +1387,10 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) } } // Admittedly, this error message is not precise enough - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `ID', `IDREF', or `IDREFS' while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `ID', `IDREF', or `IDREFS' while defining ATTLIST."), xmlenv); return -1; case 'E': // ENTITY or ENTITIES - if (this->get () == 'N' && - this->get () == 'T' && - this->get () == 'I' && - this->get () == 'T') + if (this->parse_token (ACE_LIB_TEXT ("NTIT")) == 0) { nextch = this->get (); if (nextch == 'Y') @@ -1958,8 +1399,7 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) // the attribute as ENTITY // @@ Set up validator as such. } - else if (nextch == 'I'&& - this->get () == 'E' && + else if (nextch == 'I'&& this->get () == 'E' && this->get () == 'S') { // We have successfully identified the type of @@ -1973,30 +1413,18 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) } } // Admittedly, this error message is not precise enough - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `ENTITY', or `ENTITIES' while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `ENTITY', or `ENTITIES' while defining ATTLIST."), xmlenv); return -1; case 'N': // NMTOKEN, NMTOKENS, or, NOTATION nextch = this->get (); if (nextch != 'M' || nextch != 'O') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `NMTOKEN', `NMTOKENS', or `NOTATION' while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `NMTOKEN', `NMTOKENS', or `NOTATION' while defining ATTLIST."), xmlenv); return -1; } if (nextch == 'M') { - if (this->get () == 'T' && - this->get () == 'O' && - this->get () == 'K' && - this->get () == 'E' && - this->get () == 'N') + if (this->parse_token (ACE_LIB_TEXT ("TOKEN")) == 0) { if (this->skip_whitespace_count (&nextch) > 0) { @@ -2013,38 +1441,21 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) break; } } - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `NMTOKEN' or `NMTOKENS' while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `NMTOKEN' or `NMTOKENS' while defining ATTLIST."), xmlenv); return -1; } else // NOTATION { - if (this->get () != 'T' || - this->get () != 'A' || - this->get () != 'T' || - this->get () != 'I' || - this->get () != 'O' || - this->get () != 'N' || + if ((this->parse_token (ACE_LIB_TEXT ("TATION")) < 0) || this->skip_whitespace_count () == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `NOTATION' while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `NOTATION' while defining ATTLIST."), xmlenv); return -1; } if (this->get () != '(') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting `(' following NOTATION while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting `(' following NOTATION while defining ATTLIST."), xmlenv); return -1; } @@ -2054,11 +1465,7 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) ACEXML_Char *notation_name = this->read_name (); if (notation_name == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Error reading NOTATION name while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error reading NOTATION name while defining ATTLIST."), xmlenv); return -1; } // @@ get another notation name, set up validator as such @@ -2076,11 +1483,7 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) ACEXML_Char *token_name = this->read_name (); // @@ need a special read_nmtoken? if (token_name == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Error reading enumerated nmtoken name while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error reading enumerated nmtoken name while defining ATTLIST."), xmlenv); return -1; } // @@ get another nmtoken, set up validator as such @@ -2092,11 +1495,7 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) break; default: { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Invalid Attribute Type while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Invalid Attribute Type while defining ATTLIST."), xmlenv); return -1; } ACE_NOTREACHED (break); @@ -2117,54 +1516,28 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) switch (this->get ()) { case 'R': - if (this->get () != 'E' || - this->get () != 'Q' || - this->get () != 'U' || - this->get () != 'I' || - this->get () != 'R' || - this->get () != 'E' || - this->get () != 'D') + if (this->parse_token (ACE_LIB_TEXT ("EQUIRED")) < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `#REQUIRED' while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `#REQUIRED' while defining ATTLIST."), xmlenv); return -1; } // We now know this attribute is required // @@ Set up the validator as such. break; case 'I': - if (this->get () != 'M' || - this->get () != 'P' || - this->get () != 'L' || - this->get () != 'I' || - this->get () != 'E' || - this->get () != 'D') + if (this->parse_token (ACE_LIB_TEXT ("MPLIED")) < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `#IMPLIED' while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `#IMPLIED' while defining ATTLIST."), xmlenv); return -1; } // We now know this attribute is impleid. // @@ Set up the validator as such. break; case 'F': - if (this->get () != 'I' || - this->get () != 'X' || - this->get () != 'E' || - this->get () != 'D' || + if (this->parse_token (ACE_LIB_TEXT ("IXED")) < 0 || this->skip_whitespace_count () == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `#FIXED' while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `#FIXED' while defining ATTLIST."), xmlenv); return -1; } // We now know this attribute is fixed. @@ -2172,11 +1545,7 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) ACEXML_Char *fixed_attr; if (this->get_quoted_string (fixed_attr) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Error parsing `#FIXED' attribute value while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error parsing `#FIXED' attribute value while defining ATTLIST."), xmlenv); return -1; } // @@ set up validator @@ -2190,11 +1559,7 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) ACEXML_Char *fixed_attr; if (this->get_quoted_string (fixed_attr) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Error parsing `#FIXED' attribute value while defining ATTLIST."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error parsing `#FIXED' attribute value while defining ATTLIST."), xmlenv); return -1; } // @@ set up validator @@ -2213,34 +1578,18 @@ ACEXML_Parser::parse_attlist_decl (ACEXML_Env &xmlenv) int ACEXML_Parser::parse_notation_decl (ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; - - if (this->get () != 'N' || - this->get () != 'O' || - this->get () != 'T' || - this->get () != 'A' || - this->get () != 'T' || - this->get () != 'I' || - this->get () != 'O' || - this->get () != 'N' || + if (this->parse_token (ACE_LIB_TEXT ("NOTATION")) < 0 || this->skip_whitespace_count () == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `NOTATION'"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `NOTATION'"), + xmlenv); return -1; } ACEXML_Char *notation = this->read_name (); if (notation == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Invalid notation name."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Invalid notation name."), xmlenv); return -1; } @@ -2253,11 +1602,8 @@ ACEXML_Parser::parse_notation_decl (ACEXML_Env &xmlenv) if (this->get () != '>') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting NOTATION closing '>'."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting NOTATION closing '>'."), + xmlenv); return -1; } @@ -2276,61 +1622,36 @@ ACEXML_Parser::parse_external_id_and_ref (ACEXML_Char *&publicId, ACEXML_Char *&systemId, ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; - publicId = systemId = 0; ACEXML_Char nextch = this->get (); switch (nextch) { case 'S': // External SYSTEM id. - if (this->get () != 'Y' || - this->get () != 'S' || - this->get () != 'T' || - this->get () != 'E' || - this->get () != 'M' || + if (this->parse_token (ACE_LIB_TEXT ("YSTEM")) < 0 || this->skip_whitespace_count () == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword 'SYSTEM'"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword 'SYSTEM'"), + xmlenv); return -1; } if (this->get_quoted_string (systemId) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Error while parsing SYSTEM literal for SYSTEM id."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error while parsing SYSTEM literal for SYSTEM id."), xmlenv); return -1; } this->locator_.setSystemId (systemId); break; case 'P': // External PUBLIC id or previously defined PUBLIC id. - if (this->get () != 'U' || - this->get () != 'B' || - this->get () != 'L' || - this->get () != 'I' || - this->get () != 'C' || + if (this->parse_token (ACE_LIB_TEXT ("UBLIC")) < 0 || this->skip_whitespace_count () == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword 'PUBLIC'"))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword 'PUBLIC'"), xmlenv); return -1; } if (this->get_quoted_string (publicId) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Error while parsing public literal for PUBLIC id."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error while parsing public literal for PUBLIC id."), xmlenv); return -1; } this->locator_.setPublicId (publicId); @@ -2340,22 +1661,14 @@ ACEXML_Parser::parse_external_id_and_ref (ACEXML_Char *&publicId, { if (this->get_quoted_string (systemId) != 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Error while parsing system literal for PUBLIC id."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error while parsing system literal for PUBLIC id."), xmlenv); return -1; } this->locator_.setSystemId (systemId); } break; default: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting either keyword `SYSTEM' or `PUBLIC'."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting either keyword `SYSTEM' or `PUBLIC'."), xmlenv); return -1; } return 0; @@ -2364,8 +1677,6 @@ ACEXML_Parser::parse_external_id_and_ref (ACEXML_Char *&publicId, int ACEXML_Parser::parse_children_definition (ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; - this->get (); // consume the '(' ACEXML_Char nextch; @@ -2375,19 +1686,9 @@ ACEXML_Parser::parse_children_definition (ACEXML_Env &xmlenv) switch (nextch) { case '#': // Mixed element, - if (this->get () != '#' || - this->get () != 'P' || - this->get () != 'C' || - this->get () != 'D' || - this->get () != 'A' || - this->get () != 'T' || - this->get () != 'A') + if (this->parse_token (ACE_LIB_TEXT ("#PCDATA")) < 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting keyword `#PCDATA' while defining an element."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting keyword `#PCDATA' while defining an element."), xmlenv); return -1; } @@ -2397,11 +1698,7 @@ ACEXML_Parser::parse_children_definition (ACEXML_Env &xmlenv) { if (this->get () != '|') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting end of Mixed section while defining an element."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting end of Mixed section while defining an element."), xmlenv); return -1; } this->skip_whitespace_count (); @@ -2417,11 +1714,7 @@ ACEXML_Parser::parse_children_definition (ACEXML_Env &xmlenv) if (this->get () != ')' || (subelement_number && this->get () != '*')) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting closing `)*' or ')' while defining an element."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting closing `)*' or ')' while defining an element."), xmlenv); return -1; } // @@ close the element definition in the validator. @@ -2439,17 +1732,11 @@ int ACEXML_Parser::parse_child (int skip_open_paren, ACEXML_Env &xmlenv) { - ACEXML_SAXParseException* exception = 0; - // Conditionally consume the open paren. if (skip_open_paren == 0 && this->get () != '(') { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting opening `(' while defining an element."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting opening `(' while defining an element."), xmlenv); return -1; } @@ -2470,11 +1757,7 @@ ACEXML_Parser::parse_child (int skip_open_paren, ACEXML_Char *subelement = this->read_name (); if (subelement == 0) { - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT(" Error reading sub-element name while defining an element."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Error reading sub-element name while defining an element."), xmlenv); return -1; } // @@ Inform validator of the new element here. @@ -2494,11 +1777,7 @@ ACEXML_Parser::parse_child (int skip_open_paren, case '|': break; default: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting `,', `|', or `)' while defining an element."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting `,', `|', or `)' while defining an element."), xmlenv); return -1; } break; @@ -2512,21 +1791,13 @@ ACEXML_Parser::parse_child (int skip_open_paren, case ',': break; default: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting `,', `|', or `)'while defining an element."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting `,', `|', or `)'while defining an element."), xmlenv); return -1; } case ')': break; default: - ACE_NEW_NORETURN (exception, - ACEXML_SAXParseException - (ACE_LIB_TEXT("Expecting `,', `|', or `)' while defining an element."))); - xmlenv.exception (exception); - this->report_fatal_error (*exception, xmlenv); + this->report_fatal_error(ACE_LIB_TEXT("Expecting `,', `|', or `)' while defining an element."), xmlenv); return -1; } this->get (); // consume , | or ) @@ -2554,3 +1825,195 @@ ACEXML_Parser::parse_child (int skip_open_paren, return 0; } + +ACEXML_Char +ACEXML_Parser::skip_whitespace (ACEXML_Char **whitespace) +{ + ACEXML_Char ch = this->get (); + + if (this->is_whitespace (ch) == 0) + { + if (whitespace != 0) + *whitespace = 0; + return ch; + } + + do + { + if (whitespace != 0) + this->obstack_.grow (ch); + ch = this->get (); + } + while (this->is_whitespace (ch)); + + if (whitespace != 0) + *whitespace = this->obstack_.freeze (); + + return ch; +} + +int +ACEXML_Parser::skip_whitespace_count (ACEXML_Char *peeky) +{ + int wscount = 0; + ACEXML_Char dummy; + ACEXML_Char &forward = (peeky == 0 ? dummy : *peeky); + + for (;this->is_whitespace ((forward = this->peek ())); ++wscount) + this->get (); + + return wscount; +} + +int +ACEXML_Parser::parse_token (const ACEXML_Char* keyword) +{ + if (keyword == 0) + return -1; + const ACEXML_Char* ptr = keyword; + for (; *ptr != 0 && this->get() == *ptr; ++ptr) + ; + if (*ptr == 0) + return 0; + else + return -1; +} + +int +ACEXML_Parser::skip_equal (void) +{ + if (this->skip_whitespace (0) != '=') + return -1; + + while (this->is_whitespace (this->peek ())) + this->get (); + return 0; +} + +int +ACEXML_Parser::get_quoted_string (ACEXML_Char *&str) +{ + ACEXML_Char quote = this->get (); + if (quote != '\'' && quote != '"') // Not a quoted string. + return -1; + + while (1) + { + ACEXML_Char ch = this->get (); + + // @@ Deoes not handle buffer overflow yet. + if (ch == quote) + { + str = this->obstack_.freeze (); + return 0; + } + + const ACEXML_String *replace = 0; + ACEXML_String charval; + ACEXML_Char buffer[6]; + size_t i = 0; + + switch (ch) + { + case '&': + if (this->peek () == '#') + { + if (this->parse_char_reference (buffer, 6) != 0) + { +// xmlenv.exception (new ACEXML_SAXParseException +// (ACE_LIB_TEXT ("CharRef does not resolves to a valid character"))); + return -1; + } + charval.set (buffer, 0); + replace = &charval; + } + else + replace = this->parse_reference (); + + if (replace == 0) + { + // xmlenv.exception (new ACEXML_SAXParseException + // (ACE_LIB_TEXT ("Undefined reference"))); + return -1; + } + for (i = 0; i < replace->length (); ++i) + this->obstack_.grow ((*replace)[i]); + // handle reference here. + break; + case 0x0D: // End-of-Line handling + ch = (this->peek () == 0x0A ? this->get () : 0x0A); + // Fall thru... + case 0x0A: + // Fall thru... + default: + this->obstack_.grow (ch); + break; + } + } +} + +ACEXML_Char * +ACEXML_Parser::read_name (ACEXML_Char ch) +{ + if (ch == 0) + { + ch = this->get (); + + if (this->is_whitespace (ch)) + // No white space is allowed here. + return 0; + } + else if (this->is_nonname (ch)) + return 0; + + while (1) + { + this->obstack_.grow (ch); + ch = this->peek (); + if (this->is_nonname (ch)) + break; + ch = this->get (); + }; + + return this->obstack_.freeze (); +} + +void +ACEXML_Parser::report_prefix_mapping (const ACEXML_Char* prefix, + const ACEXML_Char* uri, + const ACEXML_Char* name, + int start, + ACEXML_Env& xmlenv) +{ + if (this->namespaces_) + { + if (start) + { + if (name == 0) + { + this->content_handler_->startPrefixMapping(empty_string, + uri, + xmlenv); + return; + } + else + { + this->content_handler_->startPrefixMapping (prefix, uri, xmlenv); + return; + } + } + else + { + if (name == 0) + { + this->content_handler_->endPrefixMapping(empty_string, xmlenv); + return; + } + else + { + this->content_handler_->endPrefixMapping (prefix, xmlenv); + return; + } + } + } +} diff --git a/ACEXML/parser/parser/Parser.h b/ACEXML/parser/parser/Parser.h index 7d58d125be8..9516ffb4b94 100644 --- a/ACEXML/parser/parser/Parser.h +++ b/ACEXML/parser/parser/Parser.h @@ -78,6 +78,16 @@ public: // ACEXML_SAXNotSupportedException)) ; + /** + * Activating or deactivating a feature. + */ + virtual void setFeature (const ACEXML_Char *name, + int boolean_value, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException, + // ACEXML_SAXNotSupportedException)) + ; + /* * Look up the value of a property. */ @@ -88,6 +98,16 @@ public: ; /* + * Set the value of a property. + */ + virtual void setProperty (const ACEXML_Char *name, + void *value, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException, + // ACEXML_SAXNotSupportedException)) + ; + + /* * Parse an XML document. */ virtual void parse (ACEXML_InputSource *input, @@ -100,7 +120,6 @@ public: */ virtual void parse (const ACEXML_Char *systemId, ACEXML_Env &xmlenv) - // @@ throw IOException??? // ACE_THROW_SPEC ((ACEXML_SAXException)) ; @@ -124,26 +143,6 @@ public: */ virtual void setErrorHandler (ACEXML_ErrorHandler *handler); - /** - * Activating or deactivating a feature. - */ - virtual void setFeature (const ACEXML_Char *name, - int boolean_value, - ACEXML_Env &xmlenv) - // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException, - // ACEXML_SAXNotSupportedException)) - ; - - /* - * Set the value of a property. - */ - virtual void setProperty (const ACEXML_Char *name, - void *value, - ACEXML_Env &xmlenv) - // ACE_THROW_SPEC ((ACEXML_SAXNotRecognizedException, - // ACEXML_SAXNotSupportedException)) - ; - // *** Helper functions for parsing XML /** @@ -279,8 +278,7 @@ public: * Parse a character reference, i.e., " " or "". The first * character encountered should be the '#' char. * - * @param buf points to a character buffer for - * the result. + * @param buf points to a character buffer for the result. * @param len specifies the capacities of the buffer. * * @retval 0 on success and -1 otherwise. @@ -452,21 +450,37 @@ private: * Dispatch errors to ErrorHandler. * */ - void report_error (ACEXML_SAXParseException& exception, ACEXML_Env& xmlenv); + void report_error (const ACEXML_Char* message, ACEXML_Env& xmlenv); /** * Dispatch warnings to ErrorHandler. * */ - void report_warning (ACEXML_SAXParseException& exception, - ACEXML_Env& xmlenv); + void report_warning (const ACEXML_Char* message, ACEXML_Env& xmlenv); /** * Dispatch fatal errors to ErrorHandler. * */ - void report_fatal_error (ACEXML_SAXParseException& exception, + void report_fatal_error (const ACEXML_Char* message, ACEXML_Env& xmlenv); + + /** + * Dispatch prefix mapping calls to the ContentHandler. + * + * @param prefix Namespace prefix + * @param uri Namespace URI + * @param name Local name + * @param start 1 => startPrefixMapping 0 => endPrefixMapping + */ + void report_prefix_mapping (const ACEXML_Char* prefix, + const ACEXML_Char* uri, + const ACEXML_Char* name, + int start, ACEXML_Env& xmlenv); + /** + * Parse a keyword. + */ + int parse_token (const ACEXML_Char* keyword); /// Keeping track of the handlers. We do not manage the memory for /// handlers. diff --git a/ChangeLog b/ChangeLog index 66cdbc27e38..dc257874a03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Fri Aug 2 12:31:34 2002 Krishnakumar B <kitty@cs.wustl.edu> + + * ACEXML/common/ContentHandler.h: + * ACEXML/parser/parser/Entity_Manager.cpp: + * ACEXML/common/NamespaceSupport.cpp: + + Fixed minor typos in the comments. + + * ACEXML/common/InputSource.cpp: + + Removed an erroneous delete statement. Not sure if this is a + implementation bug or a thinko. + + * ACEXML/common/HttpCharStream.cpp: + * ACEXML/common/Mem_Map_Stream.cpp: + * ACEXML/common/Mem_Map_Stream.h: + + Use char* when sending data on the network. Technically it + should be byte. + + * ACEXML/examples/SAXPrint/Print_Handler.cpp: + * ACEXML/examples/SAXPrint/main.cpp: + + Fixed a bug with getopt() when WCHAR is enabled. Since EOF is + -1, never use a WCHAR in the while loop. + + * ACEXML/parser/parser/Parser.cpp: + * ACEXML/parser/parser/Parser.h: + + Improved Namespace support. Modularized functions in the parser. + + * ACEXML/docs/TODO.txt: + * ACEXML/docs/bugs.txt: + * ACEXML/docs/guidelines.txt: + * ACEXML/docs/parser_features.txt: + + Updated to reflect the current status. People were reading these + old docs and assuming a lot of the features aren't implemented. + Fri Aug 2 16:06:12 UTC 2002 Johnny Willemsen <jwillemsen@remedy.nl> * ace/config-doxygen.h: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 66cdbc27e38..dc257874a03 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,42 @@ +Fri Aug 2 12:31:34 2002 Krishnakumar B <kitty@cs.wustl.edu> + + * ACEXML/common/ContentHandler.h: + * ACEXML/parser/parser/Entity_Manager.cpp: + * ACEXML/common/NamespaceSupport.cpp: + + Fixed minor typos in the comments. + + * ACEXML/common/InputSource.cpp: + + Removed an erroneous delete statement. Not sure if this is a + implementation bug or a thinko. + + * ACEXML/common/HttpCharStream.cpp: + * ACEXML/common/Mem_Map_Stream.cpp: + * ACEXML/common/Mem_Map_Stream.h: + + Use char* when sending data on the network. Technically it + should be byte. + + * ACEXML/examples/SAXPrint/Print_Handler.cpp: + * ACEXML/examples/SAXPrint/main.cpp: + + Fixed a bug with getopt() when WCHAR is enabled. Since EOF is + -1, never use a WCHAR in the while loop. + + * ACEXML/parser/parser/Parser.cpp: + * ACEXML/parser/parser/Parser.h: + + Improved Namespace support. Modularized functions in the parser. + + * ACEXML/docs/TODO.txt: + * ACEXML/docs/bugs.txt: + * ACEXML/docs/guidelines.txt: + * ACEXML/docs/parser_features.txt: + + Updated to reflect the current status. People were reading these + old docs and assuming a lot of the features aren't implemented. + Fri Aug 2 16:06:12 UTC 2002 Johnny Willemsen <jwillemsen@remedy.nl> * ace/config-doxygen.h: |