You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2005/12/03 13:41:31 UTC
svn commit: r351922 - in /xerces/xerces-p/trunk/interface: ./ DOM.i Perl.i
SAX.i SAX2.i callback.i defines.i grammars.i ignore.i input-source.i
parsers.i typemaps-general.i typemaps-xmlch.i typemaps.i util.i
Author: jasons
Date: Sat Dec 3 04:41:11 2005
New Revision: 351922
URL: http://svn.apache.org/viewcvs?rev=351922&view=rev
Log:
new
Added:
xerces/xerces-p/trunk/interface/
xerces/xerces-p/trunk/interface/DOM.i
xerces/xerces-p/trunk/interface/Perl.i
xerces/xerces-p/trunk/interface/SAX.i
xerces/xerces-p/trunk/interface/SAX2.i
xerces/xerces-p/trunk/interface/callback.i
xerces/xerces-p/trunk/interface/defines.i
xerces/xerces-p/trunk/interface/grammars.i
xerces/xerces-p/trunk/interface/ignore.i
xerces/xerces-p/trunk/interface/input-source.i
xerces/xerces-p/trunk/interface/parsers.i
xerces/xerces-p/trunk/interface/typemaps-general.i
xerces/xerces-p/trunk/interface/typemaps-xmlch.i
xerces/xerces-p/trunk/interface/typemaps.i
- copied, changed from r21525, xml/xerces-p/trunk/typemaps.i
xerces/xerces-p/trunk/interface/util.i
Added: xerces/xerces-p/trunk/interface/DOM.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/DOM.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/DOM.i (added)
+++ xerces/xerces-p/trunk/interface/DOM.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2002,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.
+ */
+
+/*
+ * All DOM classes and their related SWIG alterations go in this interface file
+ */
+
+/*
+ * the DOM classes gets a special exception handler
+ * 'goto fail' must be called - either explicitly, or via SWIG_croak()
+ * to ensure that any variable cleanup is done - to avoid memory leaks
+ */
+%exception {
+ try
+ {
+ $action
+ }
+ catch (const XMLException& e)
+ {
+ makeXMLException(e);
+ goto fail;
+ }
+ catch (const DOMException& e)
+ {
+ makeDOMException(e);
+ goto fail;
+ }
+ catch (...)
+ {
+ SWIG_croak("Handling Unknown exception");
+ goto fail;
+ }
+}
+
+// Introduced in DOM Level 1
+%include "xercesc/dom/DOMException.hpp"
+%include "xercesc/dom/DOMNode.hpp"
+%include "xercesc/dom/DOMAttr.hpp"
+%include "xercesc/dom/DOMElement.hpp"
+%include "xercesc/dom/DOMEntity.hpp"
+%include "xercesc/dom/DOMDocumentType.hpp"
+%include "xercesc/dom/DOMCharacterData.hpp"
+%include "xercesc/dom/DOMComment.hpp"
+%include "xercesc/dom/DOMText.hpp"
+%include "xercesc/dom/DOMCDATASection.hpp"
+%include "xercesc/dom/DOMNodeList.hpp"
+%include "xercesc/dom/DOMNamedNodeMap.hpp"
+%include "xercesc/dom/DOMDocumentFragment.hpp"
+%include "xercesc/dom/DOMDocumentType.hpp"
+%include "xercesc/dom/DOMEntityReference.hpp"
+%include "xercesc/dom/DOMNotation.hpp"
+%include "xercesc/dom/DOMProcessingInstruction.hpp"
+
+// Introduced in DOM Level 2
+%include "xercesc/dom/DOMDocumentRange.hpp"
+%include "xercesc/dom/DOMDocumentTraversal.hpp"
+%include "xercesc/dom/DOMNodeIterator.hpp"
+%include "xercesc/dom/DOMNodeFilter.hpp"
+%include "xercesc/dom/DOMRange.hpp"
+%include "xercesc/dom/DOMRangeException.hpp"
+%include "xercesc/dom/DOMTreeWalker.hpp"
+%include "xercesc/dom/DOMDocumentTraversal.hpp"
+
+%ignore XERCES_CPP_NAMESPACE::DOMImplementation::loadDOMExceptionMsg;
+
+/*
+ * Introduced in DOM Level 3
+ */
+%include "xercesc/dom/DOMImplementationLS.hpp"
+%include "xercesc/dom/DOMImplementation.hpp"
+%include "xercesc/dom/DOMImplementationSource.hpp"
+%include "xercesc/dom/DOMImplementationRegistry.hpp"
+
+%include "xercesc/dom/DOMErrorHandler.hpp"
+%include "xercesc/dom/DOMEntityResolver.hpp"
+%include "xercesc/dom/DOMDocument.hpp"
+%include "xercesc/dom/DOMLocator.hpp"
+
+// DOMBuiler
+%include "xercesc/dom/DOMInputSource.hpp"
+%include "xercesc/framework/Wrapper4InputSource.hpp"
+%include "xercesc/framework/Wrapper4DOMInputSource.hpp"
+%include "xercesc/dom/DOMBuilder.hpp"
+
+// DOMWriter
+%import "xercesc/framework/XMLFormatter.hpp"
+%include "xercesc/framework/StdOutFormatTarget.hpp"
+%include "xercesc/framework/LocalFileFormatTarget.hpp"
+%include "xercesc/framework/MemBufFormatTarget.hpp"
+%include "xercesc/dom/DOMWriter.hpp"
+%include "xercesc/dom/DOMWriterFilter.hpp"
+
+%extend XERCES_CPP_NAMESPACE::DOMNode {
+ bool operator==(const DOMNode *other) {
+ return self->isSameNode(other);
+ }
+ bool operator!=(const DOMNode *other) {
+ return !self->isSameNode(other);
+ }
+};
+
Added: xerces/xerces-p/trunk/interface/Perl.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/Perl.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/Perl.i (added)
+++ xerces/xerces-p/trunk/interface/Perl.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,201 @@
+//
+// FOR Perl*Handler MEMBER FUNCTIONS, SO PERL SCALAR DOESN'T GET WRAPPED
+//
+%typemap(in) SV * {
+ $1 = $input;
+}
+
+// The typecheck functions are for use by SWIG's auto-overloading support
+%typemap(typecheck, precedence=60)
+SV*
+{
+ $1 = SvOK($input) ? 1 : 0;
+}
+
+// The typecheck functions are for use by SWIG's auto-overloading support
+%typemap(typecheck, precedence=60)
+SV*
+{
+ $1 = SvOK($input) ? 1 : 0;
+}
+
+// %typemap(typecheck, precedence=70)
+// as long as the SV is not undef, convert it to a string
+%typecheck(SWIG_TYPECHECK_UNISTRING)
+XMLCh*, const XMLCh*
+{
+ $1 = SvOK($input) ? 1 : 0;
+}
+
+
+/*
+ * Handle Callbacks - until directors work in Perl
+ */
+
+// Define a macro to rewrite setErrorHandler() for all classes
+
+%define SET_ERRORHANDLER(class)
+%feature("shadow") XERCES_CPP_NAMESPACE::class::setErrorHandler {
+ sub setErrorHandler {
+ my ($self,$handler) = @_;
+ my $callback = XML::Xerces::PerlErrorCallbackHandler->new($handler);
+ $XML::Xerces::REMEMBER{tied(% {$self})}->{__ERROR_HANDLER} = $callback;
+
+ return XML::Xercesc::class ##_setErrorHandler($self,$callback);
+ }
+}
+%enddef
+
+SET_ERRORHANDLER(Parser)
+SET_ERRORHANDLER(SAX2XMLReader)
+SET_ERRORHANDLER(SAXParser)
+SET_ERRORHANDLER(DOMBuilder)
+SET_ERRORHANDLER(DOMWriter)
+SET_ERRORHANDLER(XercesDOMParser)
+
+// Define a macro to rewrite setEntityResolver() for all classes
+
+%define SET_ENTITYRESOLVER(class)
+%feature("shadow") XERCES_CPP_NAMESPACE::class::setEntityResolver {
+ sub setEntityResolver {
+ my ($self,$handler) = @_;
+ my $callback = XML::Xerces::PerlEntityResolverHandler->new($handler);
+ $XML::Xerces::REMEMBER{tied(% {$self})}->{__ENTITY_RESOLVER} = $callback;
+
+ return XML::Xercesc::class ##_setEntityResolver($self,$callback);
+ }
+}
+%enddef
+
+SET_ENTITYRESOLVER(Parser)
+SET_ENTITYRESOLVER(SAX2XMLReader)
+SET_ENTITYRESOLVER(SAXParser)
+SET_ENTITYRESOLVER(DOMBuilder)
+SET_ENTITYRESOLVER(XercesDOMParser)
+
+// Define a macro to rewrite all methods that return a list of DOMNodes
+
+// we need the "defined ## $result hack because defined is a cpp operator
+%define DOMLIST_METHOD(class,method)
+ %feature("shadow") XERCES_CPP_NAMESPACE::class::method {
+sub method {
+ my $result = XML::Xercesc:: ## class ## _ ## method (@_);
+ unless (defined ## $result) {
+ return () if wantarray;
+ return undef; # if *not* wantarray
+ }
+ return $result->to_list() if wantarray;
+ return $result; # if *not* wantarray
+}
+ }
+%enddef
+
+DOMLIST_METHOD(DOMDocument,getElementsByTagName)
+DOMLIST_METHOD(DOMDocument,getElementsByTagNameNS)
+DOMLIST_METHOD(DOMElement,getElementsByTagName)
+DOMLIST_METHOD(DOMElement,getElementsByTagNameNS)
+DOMLIST_METHOD(DOMNode,getChildNodes)
+
+// Define a macro to rewrite all methods that return a map of DOMNodes
+
+// we need the "defined ## $result hack because defined is a cpp operator
+%define DOMMAP_METHOD(class,method)
+ %feature("shadow") XERCES_CPP_NAMESPACE::class::method {
+sub method {
+ my $result = XML::Xercesc:: ## class ## _ ## method (@_);
+ unless (defined ## $result) {
+ return () if wantarray;
+ return undef; # if *not* wantarray
+ }
+ return $result->to_hash() if wantarray;
+ return $result; # if *not* wantarray
+}
+ }
+%enddef
+
+DOMMAP_METHOD(DOMDocumentType,getEntities)
+DOMMAP_METHOD(DOMDocumentType,getNotations)
+DOMMAP_METHOD(DOMNode,getAttributes)
+
+/*
+ * have the document remember the parser, so that if the parser
+ * goes out of scope before the document, the document will not
+ * be freed
+ */
+%feature("shadow") XERCES_CPP_NAMESPACE::AbstractDOMParser::getDocument %{
+# hold a reference to the parser internally, so that the
+# document can exist after the parser has gone out of scope
+sub getDocument {
+ my ($self) = @_;
+ my $result = XML::Xercesc::AbstractDOMParser_getDocument($self);
+
+ # the DOMDocument destructor will automatically delete this entry if we
+ # store it using the underlying tied() object
+ $XML::Xerces::REMEMBER{tied(% {$result})}->{__PARSER} = $self;
+ return $result;
+}
+%}
+
+%feature("shadowpre") MemBufInputSource %{
+ # SYSTEM ID is *optional*
+ if (scalar @_ == 1) {
+ push(@_,'FAKE_SYSTEM_ID');
+ }
+%}
+
+/*
+ * The Node iterators defined in DOM Level2 must also be remembered
+ */
+%define CREATE_DOMITERATOR(method)
+%feature("shadow") XERCES_CPP_NAMESPACE::DOMDocumentTraversal:: ## method {
+sub method {
+ my ($self,$root,$what,$filter,$expand) = @_;
+ my $callback = XML::Xerces::PerlNodeFilterCallbackHandler->new($filter);
+ $XML::Xerces::REMEMBER{tied(% {$self})}->{__NODE_FILTER} = $callback;
+
+ my @args = ($self,$root,$what,$callback,$expand);
+ if ($args[0]->isa('XML::Xerces::DOMDocument')) {
+# $args[0] = $args[0]->toDOMDocumentTraversal();
+ }
+ return XML::Xercesc::DOMDocumentTraversal_ ## method(@args);
+}
+}
+%enddef
+
+CREATE_DOMITERATOR(createNodeIterator)
+CREATE_DOMITERATOR(createTreeWalker)
+
+%feature("shadow") XERCES_CPP_NAMESPACE::SAXParser::setDocumentHandler %{
+sub setDocumentHandler {
+ my ($self,$handler) = @_;
+ my $callback = XML::Xerces::PerlDocumentCallbackHandler->new($handler);
+ $XML::Xerces::REMEMBER{tied(% {$self})}->{__DOCUMENT_HANDLER} = $callback;
+
+ my @args = ($self,$callback);
+ return XML::Xercesc::SAXParser_setDocumentHandler(@args);
+}
+%}
+
+%feature("shadow") XERCES_CPP_NAMESPACE::SAX2XMLReader::setContentHandler %{
+sub setContentHandler {
+ my ($self,$handler) = @_;
+ my $callback = XML::Xerces::PerlContentCallbackHandler->new($handler);
+ $XML::Xerces::REMEMBER{tied(% {$self})}->{__CONTENT_HANDLER} = $callback;
+
+ my @args = ($self,$callback);
+ return XML::Xercesc::SAX2XMLReader_setContentHandler(@args);
+}
+%}
+
+%feature("shadowpre") Wrapper4InputSource %{
+ # we never handle the memory
+ # so we tell Perl to forget about the InputSource
+ $_[0]->DISOWN();
+%}
+
+%feature("shadowpre") createDocument %{
+ if (UNIVERSAL::isa($_[3],"XML::Xerces::DOMDocumentType")) {
+ # die "createDOMDocument: expected XML::Xerces::DOMDocumentType for arg 3";
+ $_[3]->DISOWN();
+ }
+%}
Added: xerces/xerces-p/trunk/interface/SAX.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/SAX.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/SAX.i (added)
+++ xerces/xerces-p/trunk/interface/SAX.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,9 @@
+%include "xercesc/sax/SAXException.hpp"
+%include "xercesc/sax/SAXParseException.hpp"
+%include "xercesc/sax/ErrorHandler.hpp"
+%include "xercesc/sax/DTDHandler.hpp"
+%include "xercesc/sax/DocumentHandler.hpp"
+%include "xercesc/sax/EntityResolver.hpp"
+%include "xercesc/sax/AttributeList.hpp"
+%include "xercesc/sax/HandlerBase.hpp"
+%include "xercesc/sax/Locator.hpp"
Added: xerces/xerces-p/trunk/interface/SAX2.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/SAX2.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/SAX2.i (added)
+++ xerces/xerces-p/trunk/interface/SAX2.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,6 @@
+%include "xercesc/sax2/Attributes.hpp"
+%include "xercesc/sax2/ContentHandler.hpp"
+%include "xercesc/sax2/LexicalHandler.hpp"
+%include "xercesc/sax2/DeclHandler.hpp"
+%include "xercesc/sax2/DefaultHandler.hpp"
+
Added: xerces/xerces-p/trunk/interface/callback.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/callback.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/callback.i (added)
+++ xerces/xerces-p/trunk/interface/callback.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,7 @@
+%include "PerlCallbackHandler.hpp"
+%include "PerlErrorCallbackHandler.hpp"
+%include "PerlEntityResolverHandler.hpp"
+%include "PerlNodeFilterCallbackHandler.hpp"
+%include "PerlDocumentCallbackHandler.hpp"
+%include "PerlContentCallbackHandler.hpp"
+
Added: xerces/xerces-p/trunk/interface/defines.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/defines.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/defines.i (added)
+++ xerces/xerces-p/trunk/interface/defines.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,328 @@
+/*
+ * Copyright 2002,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.
+ */
+
+/*
+ * defines.i - This file contains all directives included
+ * verbatim into the C++ output file
+ */
+
+%{
+#include "xercesc/sax/InputSource.hpp"
+#include "xercesc/sax/SAXException.hpp"
+#include "xercesc/sax/SAXParseException.hpp"
+#include "xercesc/sax/Locator.hpp"
+#include "xercesc/sax/HandlerBase.hpp"
+#include "xercesc/sax2/Attributes.hpp"
+#include "xercesc/sax2/ContentHandler.hpp"
+#include "xercesc/sax2/LexicalHandler.hpp"
+#include "xercesc/sax2/DefaultHandler.hpp"
+#include "xercesc/sax2/SAX2XMLReader.hpp"
+#include "xercesc/sax2/XMLReaderFactory.hpp"
+#include "xercesc/util/PlatformUtils.hpp"
+#include "xercesc/util/TransService.hpp"
+#include "xercesc/util/XMLString.hpp"
+#include "xercesc/util/XMLUri.hpp"
+#include "xercesc/util/QName.hpp"
+#include "xercesc/util/HexBin.hpp"
+#include "xercesc/util/Base64.hpp"
+#include "xercesc/parsers/AbstractDOMParser.hpp"
+#include "xercesc/parsers/XercesDOMParser.hpp"
+#include "xercesc/parsers/SAXParser.hpp"
+#include "xercesc/dom/DOM.hpp"
+#include "xercesc/framework/LocalFileInputSource.hpp"
+#include "xercesc/framework/MemBufInputSource.hpp"
+#include "xercesc/framework/StdInInputSource.hpp"
+#include "xercesc/framework/URLInputSource.hpp"
+#include "xercesc/framework/XMLGrammarDescription.hpp"
+#include "xercesc/framework/XMLDTDDescription.hpp"
+#include "xercesc/framework/XMLSchemaDescription.hpp"
+#include "xercesc/util/NameIdPool.hpp"
+#include "xercesc/util/XMLEnumerator.hpp"
+#include "xercesc/framework/XMLValidator.hpp"
+#include "xercesc/validators/common/Grammar.hpp"
+#include "xercesc/validators/DTD/DTDAttDef.hpp"
+#include "xercesc/validators/DTD/DTDAttDefList.hpp"
+#include "xercesc/validators/DTD/DTDGrammar.hpp"
+#include "xercesc/validators/DTD/DTDValidator.hpp"
+#include "xercesc/validators/schema/SchemaGrammar.hpp"
+#include "xercesc/validators/schema/SchemaValidator.hpp"
+#include "xercesc/validators/schema/SchemaAttDefList.hpp"
+#include "xercesc/validators/schema/SchemaAttDef.hpp"
+#include "xercesc/framework/XMLFormatter.hpp"
+#include "xercesc/framework/MemBufFormatTarget.hpp"
+#include "xercesc/framework/LocalFileFormatTarget.hpp"
+#include "xercesc/framework/StdOutFormatTarget.hpp"
+#include "xercesc/framework/Wrapper4InputSource.hpp"
+#include "xercesc/framework/Wrapper4DOMInputSource.hpp"
+#include "xercesc/framework/psvi/PSVIHandler.hpp"
+
+// for resolving XMLExceptions
+#include "xercesc/util/ArrayIndexOutOfBoundsException.hpp"
+#include "xercesc/util/EmptyStackException.hpp"
+#include "xercesc/util/IllegalArgumentException.hpp"
+#include "xercesc/util/InvalidCastException.hpp"
+#include "xercesc/util/IOException.hpp"
+#include "xercesc/util/NoSuchElementException.hpp"
+#include "xercesc/util/NullPointerException.hpp"
+#include "xercesc/util/NumberFormatException.hpp"
+#include "xercesc/util/ParseException.hpp"
+#include "xercesc/util/RuntimeException.hpp"
+#include "xercesc/util/SchemaDateTimeException.hpp"
+#include "xercesc/util/TranscodingException.hpp"
+#include "xercesc/util/UnexpectedEOFException.hpp"
+#include "xercesc/util/UnsupportedEncodingException.hpp"
+#include "xercesc/util/UTFDataFormatException.hpp"
+#include "xercesc/util/XMLNetAccessor.hpp"
+#include "xercesc/internal/XSerializationException.hpp"
+#include "xercesc/validators/datatype/InvalidDatatypeFacetException.hpp"
+#include "xercesc/validators/datatype/InvalidDatatypeValueException.hpp"
+#include "xercesc/validators/schema/identity/XPathException.hpp"
+
+#include "PerlCallbackHandler.hpp"
+#include "PerlErrorCallbackHandler.hpp"
+#include "PerlDocumentCallbackHandler.hpp"
+#include "PerlContentCallbackHandler.hpp"
+#include "PerlEntityResolverHandler.i"
+#include "PerlNodeFilterCallbackHandler.i"
+
+XERCES_CPP_NAMESPACE_USE
+
+// we initialize the static UTF-8 transcoding info
+// these are used by the typemaps to convert between
+// Xerces internal UTF-16 and Perl's internal UTF-8
+static XMLCh* UTF8_ENCODING = NULL;
+static XMLTranscoder* UTF8_TRANSCODER = NULL;
+
+static bool DEBUG_UTF8_OUT = 0;
+static bool DEBUG_UTF8_IN = 0;
+
+SV*
+XMLString2Perl(const XMLCh* input) {
+ SV *output;
+ unsigned int charsEaten = 0;
+ int length = XMLString::stringLen(input); // string length
+ XMLByte* res = new XMLByte[length * UTF8_MAXLEN]; // output string
+ unsigned int total_chars =
+ UTF8_TRANSCODER->transcodeTo((const XMLCh*) input,
+ (unsigned int) length,
+ (XMLByte*) res,
+ (unsigned int) (length*UTF8_MAXLEN)+1,
+ charsEaten,
+ XMLTranscoder::UnRep_Throw
+ );
+ res[total_chars] = '\0';
+
+#if (0)
+ if (DEBUG_UTF8_OUT) {
+ printf("Xerces out length = %d: ",total_chars);
+ for (int i=0;i<length;i++){
+ printf("<0x%.4X>",res[i]);
+ }
+ printf("\n");
+ }
+#endif
+
+ output = sv_newmortal();
+ sv_setpv((SV*)output, (char *)res );
+ SvUTF8_on((SV*)output);
+ delete[] res;
+ return output;
+}
+
+XMLCh*
+Perl2XMLString(SV* input){
+ XMLCh* output;
+
+ STRLEN length;
+ char *ptr = (char *)SvPVutf8(input,length);
+
+#if (0)
+ if (DEBUG_UTF8_IN) {
+ printf("Perl in length = %d: ",length);
+ for (unsigned int i=0;i<length;i++){
+ printf("<0x%.4X>",ptr[i]);
+ }
+ printf("\n");
+ }
+#endif
+
+ if (SvUTF8(input)) {
+ unsigned int charsEaten = 0;
+ unsigned char* sizes = new unsigned char[length+1];
+ output = new XMLCh[length+1];
+ unsigned int chars_stored =
+ UTF8_TRANSCODER->transcodeFrom((const XMLByte*) ptr,
+ (unsigned int) length,
+ (XMLCh*) output,
+ (unsigned int) length,
+ charsEaten,
+ (unsigned char*)sizes
+ );
+ delete [] sizes;
+
+#if (0)
+ if (DEBUG_UTF8_IN) {
+ printf("Xerces in length = %d: ",chars_stored);
+ for (unsigned int i=0;i<chars_stored;i++){
+ printf("<0x%.4X>",output[i]);
+ }
+ printf("\n");
+ }
+#endif
+
+ // indicate the end of the string
+ output[chars_stored] = '\0';
+ } else {
+ output = XMLString::transcode(ptr);
+
+#if (0)
+ if (DEBUG_UTF8_IN) {
+ printf("Xerces: ");
+ for (int i=0;output[i];i++){
+ printf("<0x%.4X>",output[i]);
+ }
+ printf("\n");
+ }
+#endif
+
+ }
+ return(output);
+}
+
+XMLException*
+copyXMLException(XMLException& e)
+{
+ if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgArrayIndexOutOfBoundsException_Name)
+ {
+ return (XMLException*)((ArrayIndexOutOfBoundsException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgEmptyStackException_Name)
+ {
+ return (XMLException*)((EmptyStackException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgIllegalArgumentException_Name)
+ {
+ return (XMLException*)((IllegalArgumentException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgInvalidCastException_Name)
+ {
+ return (XMLException*)((InvalidCastException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgIOException_Name)
+ {
+ return (XMLException*)((IOException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgNoSuchElementException_Name)
+ {
+ return (XMLException*)((NoSuchElementException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgNullPointerException_Name)
+ {
+ return (XMLException*)((NullPointerException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgNumberFormatException_Name)
+ {
+ return (XMLException*)((NumberFormatException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgParseException_Name)
+ {
+ return (XMLException*)((ParseException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgXMLPlatformUtilsException_Name)
+ {
+ return (XMLException*)((XMLPlatformUtilsException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgRuntimeException_Name)
+ {
+ return (XMLException*)((RuntimeException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgSchemaDateTimeException_Name)
+ {
+ return (XMLException*)((SchemaDateTimeException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgTranscodingException_Name)
+ {
+ return (XMLException*)((TranscodingException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgUnexpectedEOFException_Name)
+ {
+ return (XMLException*)((UnexpectedEOFException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgUnsupportedEncodingException_Name)
+ {
+ return (XMLException*)((UnsupportedEncodingException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgUTFDataFormatException_Name)
+ {
+ return (XMLException*)((UTFDataFormatException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgNetAccessorException_Name)
+ {
+ return (XMLException*)((NetAccessorException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgMalformedURLException_Name)
+ {
+ return (XMLException*)((MalformedURLException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgXSerializationException_Name)
+ {
+ return (XMLException*)((XSerializationException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgInvalidDatatypeFacetException_Name)
+ {
+ return (XMLException*)((InvalidDatatypeFacetException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgInvalidDatatypeValueException_Name)
+ {
+ return (XMLException*)((InvalidDatatypeValueException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgXPathException_Name)
+ {
+ return (XMLException*)((XPathException*)&e)->duplicate();
+ }
+}
+
+// These exception creation methods make the Xerces.cpp code *much* smaller
+void
+makeXMLException(const XMLException& e){
+ SV *error = ERRSV;
+ SWIG_MakePtr(error, (void *) copyXMLException(e), SWIGTYPE_p_XERCES_CPP_NAMESPACE__XMLException, SWIG_SHADOW|0);
+}
+
+void
+makeDOMException(const DOMException& e){
+ SV *error = ERRSV;
+ SWIG_MakePtr(error, (void *) new DOMException(e), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, SWIG_SHADOW|0);
+}
+
+void
+makeSAXNotRecognizedException(const SAXNotRecognizedException& e){
+ SV *error = ERRSV;
+ SWIG_MakePtr(error, (void *) new SAXNotRecognizedException(e), SWIGTYPE_p_XERCES_CPP_NAMESPACE__SAXNotRecognizedException, SWIG_SHADOW|0);
+}
+
+void
+makeSAXNotSupportedException(const SAXNotSupportedException& e){
+ SV *error = ERRSV;
+ SWIG_MakePtr(error, (void *) new SAXNotSupportedException(e), SWIGTYPE_p_XERCES_CPP_NAMESPACE__SAXNotSupportedException, SWIG_SHADOW|0);
+}
+
+%}
+
+// These get wrapped by SWIG so that we can modify them within Perl
+bool DEBUG_UTF8_OUT;
+bool DEBUG_UTF8_IN;
+
Added: xerces/xerces-p/trunk/interface/grammars.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/grammars.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/grammars.i (added)
+++ xerces/xerces-p/trunk/interface/grammars.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,67 @@
+/*
+ * XML Schema Grammar support (DTD and W3C XML Schema)
+ */
+
+// for now these have no methods we need, and are only imported
+%import "xercesc/framework/XMLContentModel.hpp"
+
+// these are abstract classes for both DTD and Schema
+// they have getter methods and must be included
+%include "xercesc/framework/XMLElementDecl.hpp"
+%include "xercesc/framework/XMLEntityDecl.hpp"
+%include "xercesc/framework/XMLNotationDecl.hpp"
+%include "xercesc/framework/XMLAttDefList.hpp"
+%include "xercesc/framework/XMLAttDef.hpp"
+%include "xercesc/framework/XMLValidator.hpp"
+%include "xercesc/validators/common/Grammar.hpp"
+%include "xercesc/framework/XMLGrammarDescription.hpp"
+%include "xercesc/framework/XMLDTDDescription.hpp"
+%include "xercesc/framework/XMLSchemaDescription.hpp"
+
+// these are needed for both the DTD and Schema templates
+%import "xercesc/util/XMLEnumerator.hpp"
+
+/*
+ * DTD Support
+ */
+// these are needed for the DTD templates
+%import "xercesc/util/NameIdPool.hpp"
+
+%include "xercesc/validators/DTD/DTDElementDecl.hpp"
+namespace XERCES_CPP_NAMESPACE {
+ %template() XMLEnumerator<DTDElementDecl>;
+ %template() NameIdPool<DTDElementDecl>;
+ %template(DTDElementDeclEnumerator) NameIdPoolEnumerator<DTDElementDecl>;
+}
+
+%include "xercesc/validators/DTD/DTDEntityDecl.hpp"
+namespace XERCES_CPP_NAMESPACE {
+ %template() XMLEnumerator<DTDEntityDecl>;
+ %template() NameIdPool<DTDEntityDecl>;
+ %template(DTDEntityDeclEnumerator) NameIdPoolEnumerator<DTDEntityDecl>;
+}
+
+%include "xercesc/validators/DTD/DTDAttDefList.hpp"
+%include "xercesc/validators/DTD/DTDAttDef.hpp"
+%include "xercesc/validators/DTD/DTDGrammar.hpp"
+%include "xercesc/validators/DTD/DTDValidator.hpp"
+
+/*
+ * W3C XML Schema support
+ */
+// these are needed for the templates for schema
+%import "xercesc/util/RefHash3KeysIdPool.hpp"
+
+%include "xercesc/validators/schema/SchemaElementDecl.hpp"
+namespace XERCES_CPP_NAMESPACE {
+ %template() XMLEnumerator<SchemaElementDecl>;
+ %template() RefHash3KeysTableBucketElem<SchemaElementDecl>;
+ %template() RefHash3KeysIdPool<SchemaElementDecl>;
+ %template(SchemaElementDeclEnumerator) RefHash3KeysIdPoolEnumerator<SchemaElementDecl>;
+}
+
+%include "xercesc/validators/schema/SchemaGrammar.hpp"
+%include "xercesc/validators/schema/SchemaValidator.hpp"
+%include "xercesc/validators/schema/SchemaAttDefList.hpp"
+%include "xercesc/validators/schema/SchemaAttDef.hpp"
+
Added: xerces/xerces-p/trunk/interface/ignore.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/ignore.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/ignore.i (added)
+++ xerces/xerces-p/trunk/interface/ignore.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,392 @@
+// Operators we don't want to wrap
+%ignore operator =;
+%ignore operator new;
+%ignore operator delete;
+%ignore operator <<;
+
+
+// both of these static variables cause trouble
+// the transcoding service is only useful to C++ anyway.
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgTransService;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgNetAccessor;
+
+// these are other static variables that are useless to Perl
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgUserPanicHandler;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgDefaultPanicHandler;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgMemoryManager;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgDefaulPanicHandler;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgArrayMemoryManager;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgAtomicMutex;
+
+// these are methods that are useless in Perl
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::curFilePos;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::closeFile;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fileSize;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::openFile;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::openFileToWrite;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::openStdInHandle;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::readFileBuffer;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::writeBufferToFile;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::resetFile;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::getFullPath;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::getCurrentDirectory;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::isAnySlash;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::removeDotSlash;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::removeDotDotSlash;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::isRelative;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::weavePaths;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::getCurrentMillis;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::closeMutex;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::lockMutex;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::makeMutex;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::unlockMutex;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::loadMsgSet;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::compareAndSwap;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::atomicIncrement;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::atomicDecrement;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::recognizeNEL;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::isNELRecognized;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::strictIANAEncoding;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::isStrictIANAEncoding;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::alignPointerForNewBlockAllocation;
+
+%ignore PerlErrorCallbackHandler::warning(const SAXParseException&);
+%ignore PerlErrorCallbackHandler::error(const SAXParseException&);
+%ignore PerlErrorCallbackHandler::fatalError(const SAXParseException&);
+
+// ignore the char* versions of ALL constructors
+%ignore XERCES_CPP_NAMESPACE::DOMBuilder::parseURI(const char *const );
+%ignore MemBufInputSource(const XMLByte* const, const unsigned int, const char* const,
+ const bool foo=false,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+
+%ignore XMLURL(const XMLURL&,const char* const,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+%ignore XMLURL(const char* const,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+%ignore XMLURL(const XMLCh* const, const char* const,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+%ignore URLInputSource(const XMLCh* const, const char* const,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+%ignore URLInputSource(const XMLCh* const, const char* const, const char* const,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+%ignore XMLFormatter(
+ const char* const outEncoding
+ , const char* const docVersion
+ , XMLFormatTarget* const target
+ , const EscapeFlags escapeFlags = NoEscapes
+ , const UnRepFlags unrepFlags = UnRep_Fail
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
+%ignore XMLFormatter(
+ const char* const outEncoding
+ , XMLFormatTarget* const target
+ , const EscapeFlags escapeFlags = NoEscapes
+ , const UnRepFlags unrepFlags = UnRep_Fail
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
+%ignore XERCES_CPP_NAMESPACE::AttributeList::getValue(const char* const) const;
+%ignore setExternalSchemaLocation(const char* const);
+%ignore setExternalNoNamespaceSchemaLocation(const char* const);
+
+/*
+ * Ignore these char* methods for all Parsers
+ */
+%ignore loadGrammar(const char* const systemId,
+ const short grammarType,
+ const bool toCache = false);
+
+
+%ignore parse(const char* const);
+%ignore parseFirst(const char *const,XMLPScanToken&,const bool);
+
+/*
+ * We need these constructors to always adopt the input strings
+ * unfortunately, the default is set to FALSE, so we must ignore
+ * all constructors that use the default, and explicitly set it
+ * in a typemap. While we are at it, we also ignore the constructor
+ * that sets the MemoryManager
+ */
+%ignore MemBufInputSource(const XMLByte* const, const unsigned int, const XMLCh* const);
+%ignore MemBufInputSource(const XMLByte* const, const unsigned int, const XMLCh* const,
+ const bool, MemoryManager *const);
+%ignore Wrapper4InputSource(InputSource* const);
+%ignore Wrapper4InputSource(InputSource* const, const bool adoptFlag
+ , MemoryManager* const);
+%ignore Wrapper4DOMInputSource(
+ DOMInputSource* const inputSource
+ , const bool
+ , MemoryManager* const);
+%ignore Wrapper4DOMInputSource(
+ DOMInputSource* const inputSource);
+
+// These are odd cases. We want access to skip the method with the
+// memory manager argument, but we want access to the optional argument
+// *after* the memory manager. So we just ignore the method that doesn't
+// include the memory manager - since our typemap defaults that argument
+// they are redundant
+%ignore createDOMBuilder(short const,const XMLCh* const);
+%ignore SAXParser(XMLValidator* const);
+%ignore createXMLReader();
+
+/*
+ * ignore the constructors which set the MemoryManager
+ */
+%ignore createDocument(const XMLCh *,const XMLCh *,DOMDocumentType *,MemoryManager *const);
+%ignore createDocument(MemoryManager *const);
+%ignore createDOMWriter(MemoryManager *const);
+%ignore XMLFormatter(
+ const XMLCh* const
+ , const XMLCh* const
+ , XMLFormatTarget* const
+ , const EscapeFlags
+ , const UnRepFlags
+ , MemoryManager* const);
+%ignore XMLFormatter(
+ const XMLCh* const
+ , XMLFormatTarget* const
+ , const EscapeFlags
+ , const UnRepFlags
+ , MemoryManager* const);
+%ignore LocalFileFormatTarget(const XMLCh* const, MemoryManager* const);
+%ignore LocalFileFormatTarget(const char* const,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+%ignore MemBufFormatTarget(int, MemoryManager* const);
+%ignore XercesDOMParser(XMLValidator* const, MemoryManager* const);
+%ignore URLInputSource(const XMLURL&, MemoryManager *const);
+%ignore URLInputSource(const XMLCh* const, MemoryManager *const);
+%ignore URLInputSource(const XMLCh* const, const XMLCh* const,MemoryManager *const);
+%ignore URLInputSource(const XMLCh* const, const XMLCh* const, const XMLCh* const,MemoryManager *const);
+%ignore StdInInputSource(MemoryManager* const);
+%ignore LocalFileInputSource(const XMLCh* const,MemoryManager* const);
+%ignore LocalFileInputSource(const XMLCh* const,const XMLCh* const,MemoryManager* const);
+%ignore XMLUri(MemoryManager* const);
+%ignore XMLUri(const XMLCh* const,MemoryManager* const);
+%ignore XMLUri(const XMLUri* const,const XMLCh* const,MemoryManager* const);
+%ignore XMLURL(MemoryManager* const);
+%ignore XMLURL(const XMLCh* const,MemoryManager* const);
+%ignore XMLURL(const XMLCh* const,const XMLCh* const,MemoryManager* const);
+%ignore XMLNotationDecl(MemoryManager* const);
+%ignore XMLNotationDecl(
+ const XMLCh* const
+ , const XMLCh* const
+ , const XMLCh* const
+ , const XMLCh* const
+ , MemoryManager* const
+ );
+%ignore getAttTypeString(const AttTypes
+ , MemoryManager* const);
+%ignore getDefAttTypeString(const DefAttTypes
+ , MemoryManager* const);
+
+%ignore DTDGrammar(MemoryManager *const);
+%ignore SchemaValidator(XMLErrorReporter *const,MemoryManager *const);
+%ignore SchemaGrammar(MemoryManager *const);
+%ignore QName(MemoryManager* const);
+%ignore QName
+ (
+ const XMLCh* const prefix
+ , const XMLCh* const localPart
+ , const unsigned int uriId
+ , MemoryManager* const
+ );
+%ignore QName
+ (
+ const XMLCh* const rawName
+ , const unsigned int uriId
+ , MemoryManager* const
+ );
+
+
+// changing the locale and the NLS home is probably useful
+// but changing the panic manager and memory manager is not
+%ignore Initialize(const char* const
+ , const char* const
+ , PanicHandler* const
+ , MemoryManager* const);
+%ignore Initialize(const char* const
+ , const char* const
+ , PanicHandler* const);
+
+// this constructor has a single XMLCh that interfers with another bool constructor
+%ignore DTDEntityDecl(
+ const XMLCh* const
+ , const XMLCh
+ , const bool fromIntSubset = false
+ , const bool specialChar = false);
+
+/*
+ * Perl won't need to create exceptions
+ */
+
+%ignore DOMException();
+%ignore DOMException(
+ short code
+ , const XMLCh* message
+ , MemoryManager* const memoryManager = XMLPlatformUtils::fgMemoryManager
+ );
+
+%ignore DOMException(const DOMException &other);
+
+%ignore DOMRangeException();
+%ignore DOMRangeException(
+ RangeExceptionCode code
+ , const XMLCh* message
+ , MemoryManager* const memoryManager
+ );
+%ignore DOMRangeException(const DOMRangeException &other);
+
+%ignore SAXException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXException(const XMLCh* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXException(const char* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXException(const SAXException& toCopy) ;
+
+%ignore SAXNotSupportedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXNotSupportedException(const XMLCh* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXNotSupportedException(const char* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+
+%ignore SAXNotRecognizedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXNotRecognizedException(const XMLCh* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXNotRecognizedException(const char* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+
+%ignore SAXParseException(const XMLCh* const message, const Locator& locator,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+%ignore SAXParseException
+ (
+ const XMLCh* const message
+ , const XMLCh* const publicId
+ , const XMLCh* const systemId
+ , const XMLSSize_t lineNumber
+ , const XMLSSize_t columnNumber
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+%ignore SAXParseException(const SAXParseException& toCopy);
+
+/*
+ * methods not needed by the XMLValidator interfaces
+ */
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::emitError;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::checkRootElement;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::reinitMsgMutex;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::reinitMsgLoader;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::setErrorReporter;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::setScannerInfo;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::handlesSchema;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::handlesDTD;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::validateElement;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::validateAttrValue;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::requiresNamespaces;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::reset;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::postParseValidation;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::preContentValidation;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::faultInAttr;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::checkContent;
+
+// ignore all the constructors for the Grammar components
+%ignore XERCES_CPP_NAMESPACE::DTDAttDef::DTDAttDef;
+%ignore XERCES_CPP_NAMESPACE::DTDElementDecl::DTDElementDecl;
+%ignore XERCES_CPP_NAMESPACE::DTDEntityDecl::DTDEntityDecl;
+%ignore XERCES_CPP_NAMESPACE::SchemaElementDecl::SchemaElementDecl;
+%ignore XERCES_CPP_NAMESPACE::SchemaAttDef::SchemaAttDef;
+%ignore XERCES_CPP_NAMESPACE::DTDAttDefList::DTDAttDefList;
+%ignore XERCES_CPP_NAMESPACE::SchemaAttDefList::SchemaAttDefList;
+
+// desperate attempt to get this working
+// FIXME
+%ignore SchemaAttDefList
+ (
+ RefHash2KeysTableOf<SchemaAttDef>* const listToUse,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+
+%ignore DTDAttDefList
+ (
+ RefHashTableOf<DTDAttDef>* const listToUse,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+
+/*
+ * methods not needed by the public Parser interfaces
+ *
+ * this is probably because I'm not using AdvDocHandlers and things
+ * that want to control the parsing process, but until someone asks
+ * for them, I'm going to leave them out.
+ */
+
+// XMLEntityHandler interface
+%ignore endInputSource;
+%ignore expandSystemId;
+%ignore resetEntities;
+%ignore resolveEntity;
+%ignore startInputSource;
+
+// XMLDocumentHandler interface.
+%ignore docCharacters;
+%ignore docComment;
+%ignore docPI;
+%ignore endDocument;
+%ignore endElement;
+%ignore endEntityReference;
+%ignore ignorableWhitespace;
+%ignore resetDocument;
+%ignore startDocument;
+%ignore startElement;
+%ignore startEntityReference;
+%ignore XMLDecl;
+
+// depricated methods - don't ask me to include these
+%ignore getDoValidation;
+%ignore setDoValidation;
+%ignore attDef;
+%ignore doctypeComment;
+%ignore doctypeDecl;
+%ignore doctypePI;
+%ignore doctypeWhitespace;
+%ignore elementDecl;
+%ignore endAttList;
+%ignore endIntSubset;
+%ignore endExtSubset;
+%ignore entityDecl;
+%ignore resetDocType;
+%ignore notationDecl;
+%ignore startAttList;
+%ignore startIntSubset;
+%ignore startExtSubset;
+%ignore TextDecl;
+
+// const methods
+%ignore getDocumentHandler() const;
+%ignore getErrorHandler() const;
+%ignore getEntityResolver() const;
+%ignore getXMLEntityResolver() const;
+%ignore getPSVIHandler() const;
+
+%ignore getContentSpec() const;
+%ignore getBaseName() const;
+%ignore getElementName() const;
+%ignore findAttDef(unsigned long const,XMLCh const *const) const;
+%ignore findAttDef(XMLCh const *const,XMLCh const *const) const;
+%ignore getAttDef(unsigned int) const;
+%ignore getAttDef(XMLCh const *const) const;
+%ignore getAttDef(XMLCh const *const,int const) const;
+%ignore getElemDecl(unsigned int const) const;
+%ignore getElemDecl(unsigned int const,XMLCh const *const,XMLCh const *const,unsigned int) const;
+%ignore getNotationDecl(XMLCh const *const) const;
+%ignore getEntityDecl(XMLCh const *const) const;
+%ignore getEntityDeclPool() const;
+%ignore getAttWildCard() const;
+%ignore getAnnotation() const;
+%ignore getAnnotation(void const *const) const;
+%ignore getAnnotations() const;
+%ignore findAttDefLocalPart(unsigned long const,XMLCh const *const) const;
+%ignore getBaseAttDecl() const;
+%ignore getFilter() const;
+%ignore getPrefix() const;
+%ignore getLocalPart() const;
+%ignore getRawName() const;
Added: xerces/xerces-p/trunk/interface/input-source.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/input-source.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/input-source.i (added)
+++ xerces/xerces-p/trunk/interface/input-source.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,6 @@
+%include "xercesc/sax/InputSource.hpp"
+%include "xercesc/framework/LocalFileInputSource.hpp"
+%include "xercesc/framework/StdInInputSource.hpp"
+%include "xercesc/framework/URLInputSource.hpp"
+%include "xercesc/framework/MemBufInputSource.hpp"
+
Added: xerces/xerces-p/trunk/interface/parsers.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/parsers.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/parsers.i (added)
+++ xerces/xerces-p/trunk/interface/parsers.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,48 @@
+// scan token helper class for progressive parsing
+%include "xercesc/framework/XMLPScanToken.hpp"
+%include "xercesc/framework/psvi/PSVIHandler.hpp"
+
+%include "xercesc/sax/Parser.hpp"
+%include "xercesc/parsers/AbstractDOMParser.hpp"
+%include "xercesc/parsers/XercesDOMParser.hpp"
+%include "xercesc/parsers/SAXParser.hpp"
+
+//
+// define the exceptions for SAX2XMLReader
+//
+%define SAXEXCEPTION(method)
+%exception method {
+ try {
+ $action
+ }
+ catch (const XMLException& e)
+ {
+ makeXMLException(e);
+ goto fail;
+ }
+ catch (const SAXNotSupportedException& e)
+ {
+ makeSAXNotSupportedException(e);
+ goto fail;
+ }
+ catch (const SAXNotRecognizedException& e)
+ {
+ makeSAXNotRecognizedException(e);
+ goto fail;
+ }
+ catch (...)
+ {
+ SWIG_croak("Handling Unknown exception");
+ goto fail;
+ }
+}
+%enddef
+
+SAXEXCEPTION(XERCES_CPP_NAMESPACE::SAX2XMLReader::getFeature)
+SAXEXCEPTION(XERCES_CPP_NAMESPACE::SAX2XMLReader::setFeature)
+SAXEXCEPTION(XERCES_CPP_NAMESPACE::SAX2XMLReader::setProperty)
+SAXEXCEPTION(XERCES_CPP_NAMESPACE::SAX2XMLReader::getProperty)
+
+%include "xercesc/sax2/SAX2XMLReader.hpp"
+%include "xercesc/sax2/XMLReaderFactory.hpp"
+
Added: xerces/xerces-p/trunk/interface/typemaps-general.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/typemaps-general.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/typemaps-general.i (added)
+++ xerces/xerces-p/trunk/interface/typemaps-general.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2002,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.
+ */
+
+/*
+ * MemBufInputSource::MemBufInputSource()
+ *
+ *
+ *
+ * ALWAYS ADOPT BUFFER (I.E. MAKE A COPY OF IT) SINCE IT IS TAKEN FROM
+ * PERL, AND WHO KNOWS WHAT WILL HAPPEN TO IT AFTER IT IS GIVEN TO THE
+ * CONSTRUCTOR
+ */
+
+//
+// Perl should ignore these arguments
+//
+
+// %typemap(in,numinputs=0) (unsigned int byteCount) "$1 = 0;"
+
+/*
+ * These arguments are used to indicate that Xerces-C should
+ * adopt a resource being passed as an argument. We should
+ * *always* tell Xerces-C to adopt.
+ */
+%typemap(in,numinputs=0) const bool adoptFlag "$1 = true;" // for Wrapper4InputSource
+ // and Wrapper4DOMInputSource
+%typemap(in,numinputs=0) const bool adoptBuffer "$1 = true;" // for MemBufInputSource
+
+/*
+ * Scripting languages are not going to change the default memory manager
+ * so we always default this argument
+ */
+%typemap(in,numinputs=0) XERCES_CPP_NAMESPACE::MemoryManager* const manager "$1 = XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgMemoryManager;"
+
+%typemap(in) (const XMLByte* const srcDocBytes,
+ unsigned int byteCount) {
+ if (SvPOK($input)||SvIOK($input)||SvNOK($input)) {
+ STRLEN len;
+ XMLByte *xmlbytes = (XMLByte *)SvPV($input, len);
+ $2 = len;
+ $1 = new XMLByte[len];
+ memcpy($1, xmlbytes, len);
+ } else {
+ SWIG_croak("Type error in argument 2 of $symname, Expected perl-string.");
+ }
+}
+
+// XMLByte arrays are just char*'s
+%apply char * { XMLByte * }
+
+/*
+ * Adopting a validator
+ *
+ * we have to disown the validator, because Xerces will adopt it
+ * first we create a temp variable to store it's value in the
+ * 'in' typemap, and the after all conversion has succeeded
+ * the 'check' typemap will disown it.
+ */
+%typemap(in) XERCES_CPP_NAMESPACE::XMLValidator* valToAdopt (SV *temp)
+{
+ temp = $input;
+ if (SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0) < 0) {
+ SWIG_type_error("$1_mangle",$argnum,"$symname")
+ }
+}
+%typemap(check) XERCES_CPP_NAMESPACE::XMLValidator* valToAdopt
+{
+ SWIG_Disown(temp$argnum);
+}
+
+/*
+ * Dynamic Casts
+ *
+ * This very cool SWIG feature enables use to return the correct object
+ * type to Perl when a C++ method is defined as returning a base class
+ * object. We define a method that tells what type subclass the object
+ * is in.
+ */
+
+/*
+ * Grammar*
+ */
+
+%typemap(out) XERCES_CPP_NAMESPACE::Grammar * = SWIGTYPE *DYNAMIC;
+
+DYNAMIC_CAST(SWIGTYPE_p_XERCES_CPP_NAMESPACE__Grammar, Grammar_dynamic_cast);
+
+%{
+static swig_type_info *
+Grammar_dynamic_cast(void **ptr) {
+ Grammar **nptr = (Grammar **) ptr;
+ if (*nptr == NULL) {
+ return NULL;
+ }
+ short int type = (*nptr)->getGrammarType();
+ if (type == Grammar::DTDGrammarType) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DTDGrammar;
+ }
+ if (type == Grammar::SchemaGrammarType) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__SchemaGrammar;
+ }
+ return NULL;
+}
+%}
+
+
+/*
+ * PerlCallbackHandler* - this is broken and useless
+ */
+
+%typemap(out) XERCES_CPP_NAMESPACE::PerlCallbackHandler * = SWIGTYPE *DYNAMIC;
+
+DYNAMIC_CAST(SWIGTYPE_p_PerlCallbackHandler, PerlCallbackHandler_dynamic_cast);
+
+%{
+static swig_type_info *
+PerlCallbackHandler_dynamic_cast(void **ptr) {
+ PerlCallbackHandler **nptr = (PerlCallbackHandler **) ptr;
+ if (*nptr == NULL) {
+ return NULL;
+ }
+ short int type = (*nptr)->type();
+ if (type == PERLCALLBACKHANDLER_BASE_TYPE) {
+ die("Can't cast a PerlCallbackHandler base type node\n");
+ }
+ if (type == PERLCALLBACKHANDLER_ERROR_TYPE) {
+ return SWIGTYPE_p_PerlErrorCallbackHandler;
+ }
+ if (type == PERLCALLBACKHANDLER_ENTITY_TYPE) {
+ return SWIGTYPE_p_PerlEntityResolverHandler;
+ }
+ if (type == PERLCALLBACKHANDLER_CONTENT_TYPE) {
+ return SWIGTYPE_p_PerlContentCallbackHandler;
+ }
+ if (type == PERLCALLBACKHANDLER_DOCUMENT_TYPE) {
+ return SWIGTYPE_p_PerlDocumentCallbackHandler;
+ }
+ if (type == PERLCALLBACKHANDLER_NODE_TYPE) {
+ return SWIGTYPE_p_PerlNodeFilterCallbackHandler;
+ }
+ return NULL;
+}
+%}
+
+/*
+ * DOM_Node*
+ */
+
+%typemap(out) XERCES_CPP_NAMESPACE::DOMNode * = SWIGTYPE *DYNAMIC;
+
+DYNAMIC_CAST(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, DOMNode_dynamic_cast);
+
+%{
+static swig_type_info *
+DOMNode_dynamic_cast(void **ptr) {
+ DOMNode **nptr = (DOMNode **) ptr;
+ if (*nptr == NULL) {
+ return NULL;
+ }
+ short int type = (*nptr)->getNodeType();
+ if (type == DOMNode::TEXT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText;
+ }
+ if (type == DOMNode::PROCESSING_INSTRUCTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction;
+ }
+ if (type == DOMNode::DOCUMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument;
+ }
+ if (type == DOMNode::ELEMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement;
+ }
+ if (type == DOMNode::ENTITY_REFERENCE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference;
+ }
+ if (type == DOMNode::CDATA_SECTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
+ }
+ if (type == DOMNode::CDATA_SECTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
+ }
+ if (type == DOMNode::COMMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment;
+ }
+ if (type == DOMNode::DOCUMENT_TYPE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType;
+ }
+ if (type == DOMNode::ENTITY_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity;
+ }
+ if (type == DOMNode::ATTRIBUTE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr;
+ }
+ if (type == DOMNode::NOTATION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation;
+ }
+ return NULL;
+}
+%}
+
Added: xerces/xerces-p/trunk/interface/typemaps-xmlch.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/typemaps-xmlch.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/typemaps-xmlch.i (added)
+++ xerces/xerces-p/trunk/interface/typemaps-xmlch.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2002,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.
+ */
+
+/***********/
+/* */
+/* XMLCh * */
+/* */
+/***********/
+
+/************************************************************************/
+/* */
+/* FOR FUNCTIONS TAKING XMLCh * (I.E AN XMLCh STRING) AS AN ARGUMENT -- */
+/* NOW YOU CAN JUST SUPPLY A STRING. THIS TYPEMAP CONVERTS */
+/* PERL-STRINGS TO XMLCh STRINGS AUTOMATICALLY */
+/* */
+/************************************************************************/
+
+/************************************************************************/
+/* */
+/* CAVEAT: */
+/* TO CONVERT STRINGS TO XMLCh STRINGS, A TEMPORARY POINTER MUST BE */
+/* CREATED IN THE in TYPEMAP TO POINT TO MEMORY THAT HOLDS THE */
+/* CONVERSION. THE MEMORY IS DYNAMIC, SO IT MUST BE FREED AFTER THE C */
+/* FUNCTION THAT USES IT IS CALLED. THIS IS DONE VIA A "freearg" */
+/* TYPEMAP. */
+/* */
+/************************************************************************/
+
+// in typemap
+%typemap(in) XMLCh * %{
+ if ($input == &PL_sv_undef) {
+ SWIG_Perl_NullRef("perl-string",$argnum,"$symname");
+ goto fail;
+ } else {
+ // we convert *everything* into a string that isn't undef
+ $1 = Perl2XMLString($input);
+ }
+%}
+
+%typemap(freearg) XMLCh * %{
+ delete[] $1;
+%}
+
+// out typemap
+%typemap(out) XMLCh * %{
+ $result = XMLString2Perl($1);
+ ++argvi;
+%}
+
+// varout typemap (for global variables)
+%typemap(varout) XMLCh[] %{
+ sv_setsv((SV*)$result, XMLString2Perl($1));
+%}
+
Copied: xerces/xerces-p/trunk/interface/typemaps.i (from r21525, xml/xerces-p/trunk/typemaps.i)
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/typemaps.i?p2=xerces/xerces-p/trunk/interface/typemaps.i&p1=xml/xerces-p/trunk/typemaps.i&r1=21525&r2=351922&rev=351922&view=diff
==============================================================================
--- xml/xerces-p/trunk/typemaps.i (original)
+++ xerces/xerces-p/trunk/interface/typemaps.i Sat Dec 3 04:41:11 2005
@@ -1,303 +1,25 @@
-/***********/
-/* */
-/* XMLCh * */
-/* */
-/***********/
+/*
+ * Copyright 2002,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.
+ */
+
+/**************/
+/* */
+/* TYPEMAPS */
+/* */
+/**************/
-/************************************************************************/
-/* */
-/* FOR FUNCTIONS TAKING XMLCh * (I.E AN XMLCh STRING) AS AN ARGUMENT -- */
-/* NOW YOU CAN JUST SUPPLY A STRING. THIS TYPEMAP CONVERTS */
-/* PERL-STRINGS TO XMLCh STRINGS AUTOMATICALLY */
-/* */
-/************************************************************************/
-
-/************************************************************************/
-/* */
-/* CAVEAT: */
-/* TO CONVERT STRINGS TO XMLCh STRINGS, A TEMPORARY POINTER MUST BE */
-/* CREATED IN THE in TYPEMAP TO POINT TO MEMORY THAT HOLDS THE */
-/* CONVERSION. THE MEMORY IS DYNAMIC, SO IT MUST BE FREED AFTER THE C */
-/* FUNCTION THAT USES IT IS CALLED. THIS IS DONE VIA A "freearg" */
-/* TYPEMAP. */
-/* */
-/************************************************************************/
-
-%{
-SV*
-XMLString2Perl(const XMLCh* input) {
- SV *output;
- unsigned int charsEaten = 0;
- int length = XMLString::stringLen(input); // string length
- XMLByte* res = new XMLByte[length * UTF8_MAXLEN]; // output string
- unsigned int total_chars =
- UTF8_TRANSCODER->transcodeTo((const XMLCh*) input,
- (unsigned int) length,
- (XMLByte*) res,
- (unsigned int) length*UTF8_MAXLEN,
- charsEaten,
- XMLTranscoder::UnRep_Throw
- );
- res[total_chars] = '\0';
- if (DEBUG_UTF8_OUT) {
- printf("Xerces out length = %d: ",total_chars);
- for (int i=0;i<length;i++){
- printf("<0x%.4X>",res[i]);
- }
- printf("\n");
- }
- output = sv_newmortal();
- sv_setpv((SV*)output, (char *)res );
- SvUTF8_on((SV*)output);
- delete[] res;
- return output;
-}
-
-XMLCh*
-Perl2XMLString(SV* input){
- XMLCh* output;
-
- STRLEN length;
- char *ptr = (char *)SvPV(input,length);
- if (DEBUG_UTF8_IN) {
- printf("Perl in length = %d: ",length);
- for (unsigned int i=0;i<length;i++){
- printf("<0x%.4X>",ptr[i]);
- }
- printf("\n");
- }
- if (SvUTF8(input)) {
- unsigned int charsEaten = 0;
- unsigned char* sizes = new unsigned char[length+1];
- output = new XMLCh[length+1];
- unsigned int chars_stored =
- UTF8_TRANSCODER->transcodeFrom((const XMLByte*) ptr,
- (unsigned int) length,
- (XMLCh*) output,
- (unsigned int) length,
- charsEaten,
- (unsigned char*)sizes
- );
- delete [] sizes;
- if (DEBUG_UTF8_IN) {
- printf("Xerces in length = %d: ",chars_stored);
- for (unsigned int i=0;i<chars_stored;i++){
- printf("<0x%.4X>",output[i]);
- }
- printf("\n");
- }
- // indicate the end of the string
- output[chars_stored] = '\0';
- } else {
- output = XMLString::transcode(ptr);
- if (DEBUG_UTF8_IN) {
- printf("Xerces: ");
- for (int i=0;output[i];i++){
- printf("<0x%.4X>",output[i]);
- }
- printf("\n");
- }
- }
- return(output);
-}
-%}
-
-// in typemap
-%typemap(in) XMLCh * {
- if (SvPOK($input)||SvIOK($input)||SvNOK($input)) {
- $1 = Perl2XMLString($input);
- } else {
- croak("Type error in argument 2 of $symname, Expected perl-string.");
- XSRETURN(1);
- }
-}
-
-%typemap(freearg) XMLCh * {
- delete[] $1;
-}
-
-// out typemap
-%typemap(out) XMLCh * {
- $result = XMLString2Perl($1);
- ++argvi;
-}
-
-// varout typemap (for global variables)
-%typemap(varout) XMLCh[] {
- sv_setsv((SV*)$result, XMLString2Perl($1));
-}
-
-//
-// MemBufInputSource::MemBufInputSource()
-//
-
-//
-// ALWAYS ADOPT BUFFER (I.E. MAKE A COPY OF IT) SINCE IT IS TAKEN FROM
-// PERL, AND WHO KNOWS WHAT WILL HAPPEN TO IT AFTER IT IS GIVEN TO THE
-// CONSTRUCTOR
-//
-
-// PERL SHOULD IGNORE THIS ARGUMENT
-// %typemap(in,numinputs=0) (unsigned int byteCount) "$1 = 0;"
-%typemap(in,numinputs=0) (const bool adoptBuffer) "$1 = true;"
-
-%typemap(in) (const XMLByte* const srcDocBytes,
- unsigned int byteCount) {
- if (SvPOK($input)||SvIOK($input)||SvNOK($input)) {
- STRLEN len;
- XMLByte *xmlbytes = (XMLByte *)SvPV($input, len);
- $2 = len;
- $1 = new XMLByte[len];
- memcpy($1, xmlbytes, len);
- } else {
- croak("Type error in argument 2 of $symname, Expected perl-string.");
- XSRETURN(1);
- }
-}
-
-//
-// FOR Perl*Handler MEMBER FUNCTIONS, SO PERL SCALAR DOESN'T GET WRAPPED
-//
-%typemap(in) SV * {
- $1 = $input;
-}
-
-// XMLByte arrays are just char*'s
-%apply char * { XMLByte * }
-
-
-// The typecheck functions are for use by SWIG's auto-overloading support
-%typemap(typecheck, precedence=60)
-SV*
-{
- $1 = SvOK($input) ? 1 : 0;
-}
-
-// %typemap(typecheck, precedence=70)
-%typecheck(SWIG_TYPECHECK_UNISTRING)
-XMLCh*, const XMLCh*
-{
- $1 = SvPOK($input)||SvIOK($input)||SvNOK($input) ? 1 : 0;
-}
-
-
-//
-// Grammar*
-//
-
-%typemap(out) XERCES_CPP_NAMESPACE::Grammar * = SWIGTYPE *DYNAMIC;
-
-DYNAMIC_CAST(SWIGTYPE_p_XERCES_CPP_NAMESPACE__Grammar, Grammar_dynamic_cast);
-
-%{
-static swig_type_info *
-Grammar_dynamic_cast(void **ptr) {
- Grammar **nptr = (Grammar **) ptr;
- if (*nptr == NULL) {
- return NULL;
- }
- short int type = (*nptr)->getGrammarType();
- if (type == Grammar::DTDGrammarType) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DTDGrammar;
- }
- if (type == Grammar::SchemaGrammarType) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__SchemaGrammar;
- }
- return NULL;
-}
-%}
-
-//
-// PerlCallbackHandler*
-//
-
-%typemap(out) XERCES_CPP_NAMESPACE::PerlCallbackHandler * = SWIGTYPE *DYNAMIC;
-
-DYNAMIC_CAST(SWIGTYPE_p_PerlCallbackHandler, PerlCallbackHandler_dynamic_cast);
-
-%{
-static swig_type_info *
-PerlCallbackHandler_dynamic_cast(void **ptr) {
- PerlCallbackHandler **nptr = (PerlCallbackHandler **) ptr;
- if (*nptr == NULL) {
- return NULL;
- }
- short int type = (*nptr)->type();
- if (type == PERLCALLBACKHANDLER_BASE_TYPE) {
- die("Can't cast a PerlCallbackHandler base type node\n");
- }
- if (type == PERLCALLBACKHANDLER_ERROR_TYPE) {
- return SWIGTYPE_p_PerlErrorCallbackHandler;
- }
- if (type == PERLCALLBACKHANDLER_ENTITY_TYPE) {
- return SWIGTYPE_p_PerlEntityResolverHandler;
- }
- if (type == PERLCALLBACKHANDLER_CONTENT_TYPE) {
- return SWIGTYPE_p_PerlContentCallbackHandler;
- }
- if (type == PERLCALLBACKHANDLER_DOCUMENT_TYPE) {
- return SWIGTYPE_p_PerlDocumentCallbackHandler;
- }
- if (type == PERLCALLBACKHANDLER_NODE_TYPE) {
- return SWIGTYPE_p_PerlNodeFilterCallbackHandler;
- }
- return NULL;
-}
-%}
-
-//
-// DOM_Node*
-//
-
-%typemap(out) XERCES_CPP_NAMESPACE::DOMNode * = SWIGTYPE *DYNAMIC;
-
-DYNAMIC_CAST(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, DOMNode_dynamic_cast);
-
-%{
-static swig_type_info *
-DOMNode_dynamic_cast(void **ptr) {
- DOMNode **nptr = (DOMNode **) ptr;
- if (*nptr == NULL) {
- return NULL;
- }
- short int type = (*nptr)->getNodeType();
- if (type == DOMNode::TEXT_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText;
- }
- if (type == DOMNode::PROCESSING_INSTRUCTION_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction;
- }
- if (type == DOMNode::DOCUMENT_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument;
- }
- if (type == DOMNode::ELEMENT_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement;
- }
- if (type == DOMNode::ENTITY_REFERENCE_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference;
- }
- if (type == DOMNode::CDATA_SECTION_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
- }
- if (type == DOMNode::CDATA_SECTION_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
- }
- if (type == DOMNode::COMMENT_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment;
- }
- if (type == DOMNode::DOCUMENT_TYPE_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType;
- }
- if (type == DOMNode::ENTITY_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity;
- }
- if (type == DOMNode::ATTRIBUTE_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr;
- }
- if (type == DOMNode::NOTATION_NODE) {
- return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation;
- }
- return NULL;
-}
-%}
+%include typemaps-general.i
+%include typemaps-xmlch.i
Added: xerces/xerces-p/trunk/interface/util.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/util.i?rev=351922&view=auto
==============================================================================
--- xerces/xerces-p/trunk/interface/util.i (added)
+++ xerces/xerces-p/trunk/interface/util.i Sat Dec 3 04:41:11 2005
@@ -0,0 +1,20 @@
+// we remove this macro for PlatformUtils and XMLURL
+#define MakeXMLException(theType, expKeyword)
+
+%include "xercesc/util/PlatformUtils.hpp"
+%import "xercesc/util/XMemory.hpp"
+%include "xercesc/util/XMLURL.hpp"
+
+#define DECL_XSERIALIZABLE(XMLUri)
+%include "xercesc/util/XMLUri.hpp"
+
+// this macro will get redefined and SWIG 1.3 thinks that's an error
+#undef MakeXMLException
+%include "xercesc/util/XMLExceptMsgs.hpp"
+%include "xercesc/util/XMLException.hpp"
+
+// Unicode string constants for XML Formatter
+%include "xercesc/util/XMLUni.hpp"
+
+%include "xercesc/util/QName.hpp"
+
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org