diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-12-30 21:34:46 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-12-30 21:34:46 +0000 |
commit | c54635b76e51d99d9e3e6c9b16151e2ae3f5f73e (patch) | |
tree | 0a3961d648ab15f269e50010363f28b76e153041 /ACEXML | |
parent | b79c839e37b5132447d394fff209ae9edbdf38f2 (diff) | |
download | ATCD-c54635b76e51d99d9e3e6c9b16151e2ae3f5f73e.tar.gz |
ChangeLogTag:Mon Dec 30 15:25:26 2002 Nanbor Wang <nanbor@cs.wustl.edu>
Diffstat (limited to 'ACEXML')
-rw-r--r-- | ACEXML/common/FileCharStream.cpp | 9 | ||||
-rw-r--r-- | ACEXML/common/StrCharStream.cpp | 3 | ||||
-rw-r--r-- | ACEXML/examples/SAXPrint/main.cpp | 28 | ||||
-rw-r--r-- | ACEXML/examples/SAXPrint/simple.svcconf.xml | 38 |
4 files changed, 63 insertions, 15 deletions
diff --git a/ACEXML/common/FileCharStream.cpp b/ACEXML/common/FileCharStream.cpp index 24f603c9f59..5f3a5952ae9 100644 --- a/ACEXML/common/FileCharStream.cpp +++ b/ACEXML/common/FileCharStream.cpp @@ -33,8 +33,7 @@ ACEXML_FileCharStream::open (const ACEXML_Char *name) this->size_ = statbuf.st_size; this->filename_ = ACE::strnew (name); - if (this->determine_encoding() == -1) - return -1; + this->determine_encoding(); return 0; } @@ -48,6 +47,10 @@ ACEXML_FileCharStream::determine_encoding (void) retval = this->getchar_i(input[i]); if (i < 4) return -1; + + // Rewind the stream + this->rewind(); + const ACEXML_Char* temp = ACEXML_Encoding::get_encoding (input); if (!temp) return -1; @@ -59,8 +62,6 @@ ACEXML_FileCharStream::determine_encoding (void) this->encoding_ = ACE::strnew (temp); ACE_DEBUG ((LM_DEBUG, "File's encoding is %s\n", this->encoding_)); } - // Rewind the stream - this->rewind(); // Move over the byte-order-mark if present. char ch; for (int j = 0; j < 2; ++j) diff --git a/ACEXML/common/StrCharStream.cpp b/ACEXML/common/StrCharStream.cpp index 887fc6a4b7d..26211eeff70 100644 --- a/ACEXML/common/StrCharStream.cpp +++ b/ACEXML/common/StrCharStream.cpp @@ -32,8 +32,7 @@ ACEXML_StrCharStream::open (const ACEXML_Char *str) { this->ptr_ = this->start_; this->end_ = this->start_ + ACE_OS_String::strlen (this->start_); - if (this->determine_encoding() == -1) - return -1; + this->determine_encoding(); return 0; } diff --git a/ACEXML/examples/SAXPrint/main.cpp b/ACEXML/examples/SAXPrint/main.cpp index 771411867b1..64ce0125fe4 100644 --- a/ACEXML/examples/SAXPrint/main.cpp +++ b/ACEXML/examples/SAXPrint/main.cpp @@ -20,6 +20,7 @@ usage (const ACE_TCHAR* program) 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 (" -n: Use the \"Simple\" parsing feature\n") ACE_TEXT (" -u: URL specifying the path to the file\n"), program)); } @@ -30,9 +31,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACEXML_Char* filename = 0; int sax = 0; // Use SAXPrint handler or not. int str = 0; + int simple = 0; ACEXML_Char* url = 0; - ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("sf:lu:")); + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("snf:lu:")); int c; while ((c = get_opt ()) != EOF) @@ -48,6 +50,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) case 'f': filename = get_opt.opt_arg (); break; + case 'n': + simple = 1; + break; case 'u': url = get_opt.opt_arg(); break; @@ -109,16 +114,21 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACEXML_SAXPrint_Handler (name), -1); - ACEXML_Parser parser; - ACEXML_InputSource input(stm); - - parser.setContentHandler (handler); - parser.setDTDHandler (handler); - parser.setErrorHandler (handler); - parser.setEntityResolver (handler); - ACEXML_TRY_NEW_ENV { + ACEXML_Parser parser; + if (simple != 0) + { + parser.setFeature (ACE_TEXT ("Simple"), 1 ACEXML_ENV_ARG_PARAMETER); + ACEXML_TRY_CHECK; + } + ACEXML_InputSource input(stm); + + parser.setContentHandler (handler); + parser.setDTDHandler (handler); + parser.setErrorHandler (handler); + parser.setEntityResolver (handler); + parser.parse (&input ACEXML_ENV_ARG_PARAMETER); ACEXML_TRY_CHECK; } diff --git a/ACEXML/examples/SAXPrint/simple.svcconf.xml b/ACEXML/examples/SAXPrint/simple.svcconf.xml new file mode 100644 index 00000000000..32afe359fdb --- /dev/null +++ b/ACEXML/examples/SAXPrint/simple.svcconf.xml @@ -0,0 +1,38 @@ +<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> + +<streamdef> + <dynamic id="CCM_App" type="stream" status="active"> + <initializer path="CCM_App" init="make_stream"/> + </dynamic> + <module> + <dynamic id="Device_Adapter" type="module"> + <initializer path="CCM_App" init="make_da"/> + </dynamic> + <dynamic id="Event_Analyzer" type="module"> + <initializer path="CCM_App" init="make_ea"/> + </dynamic> + <dynamic id="Multicast_Router" type="module"> + <initializer path="CCM_App" init="make_mr" params="-p 3001"/> + </dynamic> + </module> +</streamdef> + +<stream id="&ccm;"> + <module> + <remove id="Device_Adapter"/> + <!-- <remove id="Event_Analyzer"/> --> + <!-- <remove id="Multicast_Router"/> --> + <![CDATA[Only a text string. +Do you &expect something more? A]]> +<!-- Noticed that the "&" in the above CDATA section can not be escaped. --> + </module> +</stream> + +<!-- remove CCM_App --> +<remove id="Test_&Taskabc"/> +</ACE_Svc_Conf> |