You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by su...@apache.org on 2004/05/27 07:02:05 UTC
cvs commit: ws-axis/c/src/xml/xerces ParserLoader.cpp XMLParserXerces.cpp XMLParserXerces.h Makefile.am
susantha 2004/05/26 22:02:05
Modified: c/src/xml/xerces Makefile.am
Added: c/src/xml/xerces ParserLoader.cpp XMLParserXerces.cpp
XMLParserXerces.h
Log:
Renaminng of Some classes in Parser Libraries
Revision Changes Path
1.3 +2 -1 ws-axis/c/src/xml/xerces/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/ws-axis/c/src/xml/xerces/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.am 19 May 2004 09:34:57 -0000 1.2
+++ Makefile.am 27 May 2004 05:02:05 -0000 1.3
@@ -2,7 +2,8 @@
AM_CPPFLAGS = $(CPPFLAGS)
libaxis_xercesc_la_SOURCES = SoapBinInputStream.cpp \
SoapInputSource.cpp \
- SoapParserXerces.cpp \
+ XMLParserXerces.cpp \
+ ParserLoader.cpp \
XercesHandler.cpp
libaxis_xercesc_la_LIBADD = -L$(XERCESC_HOME)/lib -lxerces-c -lstdc++
1.1 ws-axis/c/src/xml/xerces/ParserLoader.cpp
Index: ParserLoader.cpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @author Susantha Kumara (skumara@virtusa.com)
*
*/
#include "XMLParserXerces.h"
#include <xercesc/util/PlatformUtils.hpp>
#ifdef WIN32
#define STORAGE_CLASS_INFO __declspec(dllexport)
#else
#define STORAGE_CLASS_INFO
#endif
extern "C" {
STORAGE_CLASS_INFO
int CreateInstance(XMLParser **inst)
{
/* TODO : Following initialization should be done within a function
called by the library loader at loading time */
XMLPlatformUtils::Initialize();
*inst = new XMLParserXerces();
if (*inst)
{
return AXIS_SUCCESS;
}
return AXIS_FAIL;
}
STORAGE_CLASS_INFO
int DestroyInstance(XMLParser *inst)
{
if (inst)
{
delete inst;
/* TODO : Following uninitialization should be done within a function
called by the library loader at unloading time */
XMLPlatformUtils::Terminate ();
return AXIS_SUCCESS;
}
return AXIS_FAIL;
}
}
1.1 ws-axis/c/src/xml/xerces/XMLParserXerces.cpp
Index: XMLParserXerces.cpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @author sanjaya singharage (sanjayas@opensource.lk)
*/
#ifdef WIN32
#pragma warning (disable : 4786)
#endif
#include "XMLParserXerces.h"
#include <xercesc/sax2/XMLReaderFactory.hpp>
XERCES_CPP_NAMESPACE_USE
XMLParserXerces::XMLParserXerces()
{
m_bFirstParsed = false;
m_pParser = XMLReaderFactory::createXMLReader();
m_pInputSource = NULL;
}
XMLParserXerces::~XMLParserXerces()
{
if(m_pInputSource)
delete m_pInputSource;
delete m_pParser;
}
int XMLParserXerces::setInputStream(AxisIOStream* pInputStream)
{
m_pInputStream = pInputStream;
//check if memeory is already allocated for is
if(m_pInputSource)
delete m_pInputSource;
m_pInputSource = new SoapInputSource(pInputStream);
/* SoapInputSource is(m_pInputStream->transport.pGetFunct,
m_pInputStream->str.ip_stream); */
m_pParser->setContentHandler(&m_Xhandler);
if (m_bFirstParsed)
{
m_pParser->parseReset(m_ScanToken);
m_bFirstParsed = false;
}
/* return m_pHandler->Success(); */
return AXIS_SUCCESS;
}
const XML_Ch* XMLParserXerces::getNS4Prefix(const XML_Ch* prefix)
{
return m_Xhandler.ns4Prefix(prefix);
}
int XMLParserXerces::getStatus()
{
return m_Xhandler.getStatus();
}
const AnyElement* XMLParserXerces::next(bool isCharData)
{
bool bCanParseMore = false;
if(!m_bFirstParsed)
{
m_pParser->parseFirst(*m_pInputSource, m_ScanToken);
m_bFirstParsed = true;
}
m_Xhandler.freeElement();
while (true)
{
AnyElement* elem = m_Xhandler.getAnyElement();
if (!elem)
{
bCanParseMore = m_pParser->parseNext(m_ScanToken);
elem = m_Xhandler.getAnyElement();
}
if (elem)
{
if (!isCharData && (CHARACTER_ELEMENT == elem->m_type))
{ /* ignorable white space */
m_Xhandler.freeElement();
continue;
}
return elem;
}
else if (AXIS_FAIL == m_Xhandler.getStatus()) return NULL;
else if (!bCanParseMore) return NULL;
}
}
1.1 ws-axis/c/src/xml/xerces/XMLParserXerces.h
Index: XMLParserXerces.h
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @author sanjaya singharage (sanjayas@opensource.lk)
*/
#ifdef WIN32
#pragma warning (disable : 4786)
#endif
#if !defined(__XMLPARSERXERCES_H_OF_AXIS_INCLUDED__)
#define __XMLPARSERXERCES_H_OF_AXIS_INCLUDED__
#include <axis/server/Packet.h>
#include "../QName.h"
#include "../Event.h"
#include <axis/server/AnyElement.h>
#include <axis/server/XMLParser.h>
#include "XercesHandler.h"
#include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/parsers/SAXParser.hpp>
#include <xercesc/framework/XMLPScanToken.hpp>
#include "SoapInputSource.h"
XERCES_CPP_NAMESPACE_USE
class XMLParserXerces: public XMLParser
{
public:
XMLParserXerces();
~XMLParserXerces();
int setInputStream(AxisIOStream* pInputStream);
const XML_Ch* getNS4Prefix(const XML_Ch* pcPrefix);
int getStatus();
const AnyElement* next(bool bIsCharData=false);
private:
SAX2XMLReader* m_pParser;
XMLPScanToken m_ScanToken;
XercesHandler m_Xhandler;
bool m_bFirstParsed;
SoapInputSource* m_pInputSource;
};
#endif