You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jp...@locus.apache.org on 2000/08/10 00:20:45 UTC

cvs commit: xml-xerces/c/samples/SAX2Print SAX2Print.cpp SAX2PrintHandlers.cpp SAX2PrintHandlers.hpp

jpolast     00/08/09 15:20:43

  Modified:    c/samples/SAX2Print SAX2Print.cpp SAX2PrintHandlers.cpp
                        SAX2PrintHandlers.hpp
  Log:
  updates for changes to sax2 core functionality.
  
  Revision  Changes    Path
  1.2       +11 -8     xml-xerces/c/samples/SAX2Print/SAX2Print.cpp
  
  Index: SAX2Print.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/samples/SAX2Print/SAX2Print.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SAX2Print.cpp	2000/08/02 19:16:14	1.1
  +++ SAX2Print.cpp	2000/08/09 22:20:38	1.2
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: SAX2Print.cpp,v $
  + * Revision 1.2  2000/08/09 22:20:38  jpolast
  + * updates for changes to sax2 core functionality.
  + *
    * Revision 1.1  2000/08/02 19:16:14  jpolast
    * initial checkin of SAX2Print
    *
  @@ -94,7 +97,7 @@
   static const char*              encodingName    = "LATIN1";
   static XMLFormatter::UnRepFlags unRepFlags      = XMLFormatter::UnRep_CharRef;
   static char*                    xmlFile         = 0;
  -static SAXParser::ValSchemes    valScheme       = SAXParser::Val_Auto;
  +static SAX2XMLReader::ValSchemes valScheme      = SAX2XMLReader::Val_Auto;
   static bool						expandNamespaces= false ;
   
   
  @@ -170,11 +173,11 @@
               const char* const parm = &argV[parmInd][3];
   
               if (!strcmp(parm, "never"))
  -                valScheme = SAXParser::Val_Never;
  +                valScheme = SAX2XMLReader::Val_Never;
               else if (!strcmp(parm, "auto"))
  -                valScheme = SAXParser::Val_Auto;
  +                valScheme = SAX2XMLReader::Val_Auto;
               else if (!strcmp(parm, "always"))
  -                valScheme = SAXParser::Val_Always;
  +                valScheme = SAX2XMLReader::Val_Always;
               else
               {
                   cerr << "Unknown -v= value: " << parm << endl;
  @@ -232,16 +235,16 @@
       //  the command line, set it to validate or not.
       //
       SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
  -	if (valScheme == SAXParser::Val_Auto)
  +	if (valScheme == SAX2XMLReader::Val_Auto)
   	{
   	  parser->setFeature(XMLString::transcode("http://xml.org/sax/features/validation"), true);
   	  parser->setFeature(XMLString::transcode("http://apache.org/xml/features/validation/dynamic"), true);
   	}
  -    if (valScheme == SAXParser::Val_Never)
  +    if (valScheme == SAX2XMLReader::Val_Never)
   	{
   	  parser->setFeature(XMLString::transcode("http://xml.org/sax/features/validation"), false);
   	}
  -	if (valScheme == SAXParser::Val_Always)
  +	if (valScheme == SAX2XMLReader::Val_Always)
   	{
   	  parser->setFeature(XMLString::transcode("http://xml.org/sax/features/validation"), true);
   	  parser->setFeature(XMLString::transcode("http://apache.org/xml/features/validation/dynamic"), false);
  
  
  
  1.2       +21 -6     xml-xerces/c/samples/SAX2Print/SAX2PrintHandlers.cpp
  
  Index: SAX2PrintHandlers.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/samples/SAX2Print/SAX2PrintHandlers.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SAX2PrintHandlers.cpp	2000/08/02 19:16:14	1.1
  +++ SAX2PrintHandlers.cpp	2000/08/09 22:20:38	1.2
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: SAX2PrintHandlers.cpp,v $
  + * Revision 1.2  2000/08/09 22:20:38  jpolast
  + * updates for changes to sax2 core functionality.
  + *
    * Revision 1.1  2000/08/02 19:16:14  jpolast
    * initial checkin of SAX2Print
    *
  @@ -216,7 +219,11 @@
       // No escapes are legal here
       fFormatter << XMLFormatter::NoEscapes << gEndElement ;
   	if ( fExpandNS )
  -		fFormatter << uri << chColon << localname << chCloseAngle;
  +	{
  +		if (XMLString::compareIString(uri,XMLUni::fgEmptyString) != 0)
  +				fFormatter  << uri << chColon;
  +		fFormatter << localname << chCloseAngle;
  +	}
   	else
   		fFormatter << qname << chCloseAngle;
   }
  @@ -246,13 +253,17 @@
   
   void SAX2PrintHandlers::startElement(const   XMLCh* const    uri,
   									const   XMLCh* const    localname,
  -									const   XMLCh* const    qname
  -                                    ,       Attributes&		attributes)
  +									const   XMLCh* const    qname,
  +                                    const   Attributes&		attributes)
   {
       // The name has to be representable without any escapes
       fFormatter  << XMLFormatter::NoEscapes << chOpenAngle ;
   	if ( fExpandNS )
  -		fFormatter << uri << chColon << localname ;
  +	{
  +		if (XMLString::compareIString(uri,XMLUni::fgEmptyString) != 0)
  +				fFormatter  << uri << chColon;
  +		fFormatter << localname ;
  +	}
   	else
   		fFormatter << qname ;
   
  @@ -266,7 +277,11 @@
           //
           fFormatter  << XMLFormatter::NoEscapes << chSpace ;
   		if ( fExpandNS )
  -			fFormatter  << attributes.getURI(index) << chColon << attributes.getLocalName(index) ;
  +		{
  +			if (XMLString::compareIString(attributes.getURI(index),XMLUni::fgEmptyString) != 0)
  +				fFormatter  << attributes.getURI(index) << chColon;
  +			fFormatter  << attributes.getLocalName(index) ;
  +		}
   		else
   			fFormatter  << attributes.getQName(index) ;
   
  
  
  
  1.2       +6 -3      xml-xerces/c/samples/SAX2Print/SAX2PrintHandlers.hpp
  
  Index: SAX2PrintHandlers.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/samples/SAX2Print/SAX2PrintHandlers.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SAX2PrintHandlers.hpp	2000/08/02 19:16:14	1.1
  +++ SAX2PrintHandlers.hpp	2000/08/09 22:20:39	1.2
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: SAX2PrintHandlers.hpp,v $
  + * Revision 1.2  2000/08/09 22:20:39  jpolast
  + * updates for changes to sax2 core functionality.
  + *
    * Revision 1.1  2000/08/02 19:16:14  jpolast
    * initial checkin of SAX2Print
    *
  @@ -116,8 +119,8 @@
   
       void startElement(	const   XMLCh* const    uri,
   						const   XMLCh* const    localname,
  -						const   XMLCh* const    qname
  -							, Attributes&		attributes);
  +						const   XMLCh* const    qname,
  +					    const   Attributes&		attributes);