From 4ca83d3630f43c70fcc3cdaddad39c755dee2851 Mon Sep 17 00:00:00 2001 From: "sdv%sparc.spb.su" Date: Wed, 31 Jan 2001 19:05:04 +0000 Subject: [PATCH] initial checking. git-svn-id: svn://10.0.0.236/trunk@85841 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/java/dom/blackconnect/dom/Makefile | 36 ++ mozilla/java/dom/blackconnect/dom/Makefile.in | 30 ++ .../dom/blackconnect/dom/accessor/Makefile.in | 56 ++++ .../dom/accessor/bcDOMAccessor.cpp | 244 ++++++++++++++ .../dom/accessor/bcDOMAccessor.jar.info | 3 + .../dom/accessor/bcDOMAccessor.java | 56 ++++ .../dom/accessor/bcIDOMAccessor.idl | 9 + .../dom/accessor/bcIDOMAccessor.java | 30 ++ .../blackconnect/dom/accessor/makefile.win | 66 ++++ .../dom/blackconnect/dom/accessor/manifest | 1 + .../dom/blackconnect/dom/classes/Makefile.in | 40 +++ .../dom/blackconnect/dom/classes/makefile.win | 35 ++ .../dom/classes/org/mozilla/dom/Attr.java | 42 +++ .../classes/org/mozilla/dom/CDATASection.java | 29 ++ .../org/mozilla/dom/CharacterData.java | 52 +++ .../dom/classes/org/mozilla/dom/Comment.java | 29 ++ .../org/mozilla/dom/DOMImplementation.java | 39 +++ .../org/mozilla/dom/DOMTreeDumper.java | 224 +++++++++++++ .../dom/classes/org/mozilla/dom/Document.java | 81 +++++ .../org/mozilla/dom/DocumentFragment.java | 29 ++ .../classes/org/mozilla/dom/DocumentType.java | 47 +++ .../dom/classes/org/mozilla/dom/Element.java | 78 +++++ .../dom/classes/org/mozilla/dom/Entity.java | 38 +++ .../org/mozilla/dom/EntityReference.java | 29 ++ .../classes/org/mozilla/dom/NamedNodeMap.java | 54 +++ .../dom/classes/org/mozilla/dom/Node.java | 133 ++++++++ .../dom/classes/org/mozilla/dom/NodeList.java | 35 ++ .../dom/classes/org/mozilla/dom/Notation.java | 35 ++ .../mozilla/dom/ProcessingInstruction.java | 36 ++ .../dom/classes/org/mozilla/dom/Text.java | 33 ++ .../dom/classes/org/mozilla/dom/doit.bat | 1 + .../java/dom/blackconnect/dom/makefile.win | 32 ++ mozilla/java/dom/blackconnect/dom/readme | 88 +++++ .../dom/blackconnect/dom/stubs/Makefile.in | 74 +++++ .../dom/blackconnect/dom/stubs/bcAttr.cpp | 56 ++++ .../java/dom/blackconnect/dom/stubs/bcAttr.h | 26 ++ .../blackconnect/dom/stubs/bcCDATASection.cpp | 17 + .../blackconnect/dom/stubs/bcCDATASection.h | 28 ++ .../dom/stubs/bcCharacterData.cpp | 75 +++++ .../blackconnect/dom/stubs/bcCharacterData.h | 26 ++ .../dom/blackconnect/dom/stubs/bcComment.cpp | 17 + .../dom/blackconnect/dom/stubs/bcComment.h | 27 ++ .../dom/stubs/bcDOMImplementation.cpp | 46 +++ .../dom/stubs/bcDOMImplementation.h | 23 ++ .../dom/blackconnect/dom/stubs/bcDocument.cpp | 196 +++++++++++ .../dom/blackconnect/dom/stubs/bcDocument.h | 26 ++ .../dom/stubs/bcDocumentFragment.cpp | 17 + .../dom/stubs/bcDocumentFragment.h | 26 ++ .../blackconnect/dom/stubs/bcDocumentType.cpp | 78 +++++ .../blackconnect/dom/stubs/bcDocumentType.h | 26 ++ .../dom/blackconnect/dom/stubs/bcElement.cpp | 159 +++++++++ .../dom/blackconnect/dom/stubs/bcElement.h | 26 ++ .../dom/blackconnect/dom/stubs/bcEntity.cpp | 47 +++ .../dom/blackconnect/dom/stubs/bcEntity.h | 26 ++ .../dom/stubs/bcEntityReference.cpp | 17 + .../dom/stubs/bcEntityReference.h | 26 ++ .../blackconnect/dom/stubs/bcNamedNodeMap.cpp | 91 +++++ .../blackconnect/dom/stubs/bcNamedNodeMap.h | 23 ++ .../dom/blackconnect/dom/stubs/bcNode.cpp | 224 +++++++++++++ .../java/dom/blackconnect/dom/stubs/bcNode.h | 23 ++ .../dom/blackconnect/dom/stubs/bcNodeList.cpp | 32 ++ .../dom/blackconnect/dom/stubs/bcNodeList.h | 23 ++ .../dom/blackconnect/dom/stubs/bcNotation.cpp | 37 +++ .../dom/blackconnect/dom/stubs/bcNotation.h | 26 ++ .../dom/stubs/bcProcessingInstruction.cpp | 43 +++ .../dom/stubs/bcProcessingInstruction.h | 26 ++ .../dom/blackconnect/dom/stubs/bcText.cpp | 26 ++ .../java/dom/blackconnect/dom/stubs/bcText.h | 27 ++ .../java/dom/blackconnect/dom/stubs/dom.idl | 314 ++++++++++++++++++ .../dom/blackconnect/dom/stubs/makefile.win | 91 +++++ 70 files changed, 3861 insertions(+) create mode 100644 mozilla/java/dom/blackconnect/dom/Makefile create mode 100644 mozilla/java/dom/blackconnect/dom/Makefile.in create mode 100644 mozilla/java/dom/blackconnect/dom/accessor/Makefile.in create mode 100644 mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.jar.info create mode 100644 mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.java create mode 100644 mozilla/java/dom/blackconnect/dom/accessor/bcIDOMAccessor.idl create mode 100644 mozilla/java/dom/blackconnect/dom/accessor/bcIDOMAccessor.java create mode 100644 mozilla/java/dom/blackconnect/dom/accessor/makefile.win create mode 100644 mozilla/java/dom/blackconnect/dom/accessor/manifest create mode 100644 mozilla/java/dom/blackconnect/dom/classes/Makefile.in create mode 100644 mozilla/java/dom/blackconnect/dom/classes/makefile.win create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Attr.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/CDATASection.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/CharacterData.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Comment.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DOMImplementation.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DOMTreeDumper.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Document.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DocumentFragment.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DocumentType.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Element.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Entity.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/EntityReference.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/NamedNodeMap.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Node.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/NodeList.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Notation.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/ProcessingInstruction.java create mode 100644 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Text.java create mode 100755 mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/doit.bat create mode 100644 mozilla/java/dom/blackconnect/dom/makefile.win create mode 100644 mozilla/java/dom/blackconnect/dom/readme create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/Makefile.in create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcAttr.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcAttr.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcCDATASection.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcCDATASection.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcCharacterData.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcCharacterData.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcComment.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcComment.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcDOMImplementation.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcDOMImplementation.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcDocument.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcDocument.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcDocumentFragment.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcDocumentFragment.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcDocumentType.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcDocumentType.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcElement.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcElement.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcEntity.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcEntity.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcEntityReference.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcEntityReference.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcNamedNodeMap.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcNamedNodeMap.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcNode.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcNode.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcNodeList.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcNodeList.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcNotation.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcNotation.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcProcessingInstruction.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcProcessingInstruction.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcText.cpp create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/bcText.h create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/dom.idl create mode 100644 mozilla/java/dom/blackconnect/dom/stubs/makefile.win diff --git a/mozilla/java/dom/blackconnect/dom/Makefile b/mozilla/java/dom/blackconnect/dom/Makefile new file mode 100644 index 00000000000..78848fea6c6 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/Makefile @@ -0,0 +1,36 @@ +#!gmake +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (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.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# Igor Kushnirskiy +# +DEPTH = ../../../.. +topsrcdir = ../../../.. +VPATH = . +srcdir = . + +include $(DEPTH)/config/autoconf.mk + +DIRS= \ + classes \ + stubs \ + accessor \ + $(NULL) + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/java/dom/blackconnect/dom/Makefile.in b/mozilla/java/dom/blackconnect/dom/Makefile.in new file mode 100644 index 00000000000..944e5cbd137 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/Makefile.in @@ -0,0 +1,30 @@ +#!gmake +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (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.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): + +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +DIRS = classes stubs accessor + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/java/dom/blackconnect/dom/accessor/Makefile.in b/mozilla/java/dom/blackconnect/dom/accessor/Makefile.in new file mode 100644 index 00000000000..ae6d0a89844 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/accessor/Makefile.in @@ -0,0 +1,56 @@ +#!gmake +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (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.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# + + +DEPTH = ../../../../.. +topsrcdir = @top_srcdir@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = DOMAccessor +COMPONENT = DOMAccessor +LIBRARY_NAME = DOMAccessor +IS_COMPONENT = 1 +XPIDL_MODULE = DOMAccessor +XPIDLSRCS = bcIDOMAccessor.idl + +CPPSRCS = bcDOMAccessor.cpp \ + $(NULL) + +EXTRA_LIBS = -ljavadomstubs -L$(DIST)/lib + +include $(topsrcdir)/config/rules.mk + +bcDOMAccessor.jar.comp: manifest bcIDOMAccessor.class bcDOMAccessor.class + $(JDKHOME)/bin/jar cvfm bcDOMAccessor.jar.comp manifest *.class +.java.class: + $(JDKHOME)/bin/javac -classpath $(CLASSPATH) $< +install-component: bcDOMAccessor.jar.comp bcDOMAccessor.jar.info + cp bcDOMAccessor.jar.comp bcDOMAccessor.jar.info $(DEPTH)/dist/bin/components/ + +clobber-java: + rm -f *.class *.jar +clobber:: clobber-java +clobber_all:: clobber-java +install:: install-component diff --git a/mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.cpp b/mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.cpp new file mode 100644 index 00000000000..27c6dfe8d66 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.cpp @@ -0,0 +1,244 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are + * Copyright (C) 1999 Sun Microsystems, Inc. All + * Rights Reserved. + * + * Contributor(s): + * Denis Sharypov + */ +#include "bcIDOMAccessor.h" + +#include "nsIGenericFactory.h" +#include "nsIModule.h" +#include "nsIServiceManager.h" +#include "nsCURILoader.h" +#include "nsIURL.h" +#include "nsIChannel.h" +#include "nsIDocument.h" +#include "nsIDocumentLoader.h" +#include "nsIDocumentLoaderObserver.h" +#include "nsIDocumentViewer.h" +#include "nsIDOMDocument.h" +#include "nsIDocShell.h" +#include "bcNode.h" +#include "bcDocument.h" +#include "bcElement.h" + +// #include "nsIEnumerator.h" +// #include "stdlib.h" + +static nsIDOMDocument* GetDocument(nsIDocumentLoader* loader); +#if defined(DEBUG) +#include +#include "nsIDOMElement.h" +#include "nsIDOMNodeList.h" +#include "nsIDOMNamedNodeMap.h" +#endif + +static NS_DEFINE_IID(kIDocShellIID, NS_IDOCSHELL_IID); +static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID); +static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID); +static NS_DEFINE_IID(kIDocumentLoaderObserverIID, NS_IDOCUMENT_LOADER_OBSERVER_IID); + +/* 151dd030-9ed0-11d4-a983-00105ae3801e */ +#define BC_DOM_ACCESSOR_CID \ +{0x151dd030, 0x9ed0, 0x11d4, \ +{0xa9, 0x83, 0x00, 0x10, 0x5a, 0xe3, 0x80, 0x1e}} + +static NS_DEFINE_IID(kDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID); + +class bcDOMAccessor : public bcIDOMAccessor, public nsIDocumentLoaderObserver +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_BCIDOMACCESSOR + NS_DECL_NSIDOCUMENTLOADEROBSERVER + + bcDOMAccessor(bcIDOMAccessor* accessor); + virtual ~bcDOMAccessor(); + /* additional members */ +private: + bcIDOMAccessor* accessor; + +}; + +/* Implementation file */ +NS_IMPL_ISUPPORTS1(bcDOMAccessor, bcIDOMAccessor) + +bcDOMAccessor::bcDOMAccessor(bcIDOMAccessor* accessor) +{ + NS_INIT_ISUPPORTS(); + this->accessor = accessor; + /* member initializers and constructor code */ +} + +bcDOMAccessor::~bcDOMAccessor() +{ + /* destructor code */ +} + +NS_IMETHODIMP bcDOMAccessor::EndDocumentLoad(const char *url, Document* doc) +// NS_IMETHODIMP bcDOMAccessor::EndDocumentLoad(const char *url, Node *node, Element *elem) +{ + // wrap bcDOMDocumentImpl(doc) + // addref(bcDOMDocumentImpl) + if (accessor) + accessor->EndDocumentLoad(url, doc); +// accessor->EndDocumentLoad(url, node, elem); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* void onStartDocumentLoad (in nsIDocumentLoader aLoader, in nsIURI aURL, in string aCommand); */ +NS_IMETHODIMP bcDOMAccessor::OnStartDocumentLoad(nsIDocumentLoader *aLoader, nsIURI *aURL, const char *aCommand) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* void onEndDocumentLoad (in nsIDocumentLoader loader, in nsIChannel aChannel, in unsigned long aStatus); */ +NS_IMETHODIMP bcDOMAccessor::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChannel, PRUint32 aStatus) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* void onStartURLLoad (in nsIDocumentLoader aLoader, in nsIChannel channel); */ +NS_IMETHODIMP bcDOMAccessor::OnStartURLLoad(nsIDocumentLoader *aLoader, nsIChannel *channel) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* void onProgressURLLoad (in nsIDocumentLoader aLoader, in nsIChannel aChannel, in unsigned long aProgress, in unsigned long aProgressMax); */ +NS_IMETHODIMP bcDOMAccessor::OnProgressURLLoad(nsIDocumentLoader *aLoader, nsIChannel *aChannel, PRUint32 aProgress, PRUint32 aProgressMax) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* [noscript] void onStatusURLLoad (in nsIDocumentLoader loader, in nsIChannel channel, in nsStringRef aMsg); */ +NS_IMETHODIMP bcDOMAccessor::OnStatusURLLoad(nsIDocumentLoader *loader, nsIChannel *channel, nsString & aMsg) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + + + +/* void onEndURLLoad (in nsIDocumentLoader aLoader, + in nsIChannel aChannel, + in unsigned long aStatus); */ + +NS_IMETHODIMP bcDOMAccessor::OnEndURLLoad(nsIDocumentLoader *loader, + nsIChannel *channel, + PRUint32 aStatus) +{ + char* urlSpec = (char*) ""; + nsIURI* url = nsnull; + if (channel && NS_SUCCEEDED(channel->GetURI(&url))) + url->GetSpec(&urlSpec); + + nsIDOMDocument* domDoc = GetDocument(loader); + nsIDOMElement* docEl; + domDoc->GetDocumentElement(&docEl); + nsIDOMNode* node = nsnull; + nsresult rv = domDoc->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node); + // nb: error check + EndDocumentLoad(urlSpec, new bcDocument(domDoc)); + return NS_OK; +} + +void test() { + printf("--DOMAccessor test start\n"); + nsresult rv = NS_OK; + bcIDOMAccessor *accessor = NULL; + rv = nsComponentManager::CreateInstance("bcDOMAccessor", + nsnull, + NS_GET_IID(bcIDOMAccessor), + (void**)&accessor); + if (NS_FAILED(rv)) { + printf(" === [debug] can not load bcDOMAccessor\n"); + return; + } + NS_WITH_SERVICE(nsIDocumentLoader, docLoaderService, kDocLoaderServiceCID, &rv); + if (NS_FAILED(rv) || !docLoaderService) { + printf("=== no doc loader found...\n"); + } else { + rv = docLoaderService->AddObserver((nsIDocumentLoaderObserver*)(new bcDOMAccessor(accessor))); + if (NS_FAILED(rv)) { + printf("=== AddObserver(DOMAccessor) failed x\n", rv); + } + } + printf("--DOMAccessor test end\n"); +} + +static int counter = 0; //we do not need to call it on unload time; +extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *compMgr, + nsIFile *location, + nsIModule** result) //I am using it for runnig test *only* +{ + if (counter == 0) { + counter ++; + printf("--DOMAccessor before test\n"); + test(); + printf("--DOMAccessor after test\n"); + } + return NS_ERROR_FAILURE; +} + +static nsIDOMDocument* GetDocument(nsIDocumentLoader* loader) +{ + nsIDocShell* docshell = nsnull; + nsISupports* container = nsnull; + nsIContentViewer* contentv = nsnull; + nsIDocumentViewer* docv = nsnull; + nsIDocument* document = nsnull; + nsIDOMDocument* domDoc = nsnull; + + nsresult rv = loader->GetContainer(&container); + if (NS_SUCCEEDED(rv) && container) { + rv = container->QueryInterface(kIDocShellIID, (void**) &docshell); + container->Release(); + if (NS_SUCCEEDED(rv) && docshell) { + rv = docshell->GetContentViewer(&contentv); + docshell->Release(); + if (NS_SUCCEEDED(rv) && contentv) { + rv = contentv->QueryInterface(kIDocumentViewerIID, (void**) &docv); + contentv->Release(); + if (NS_SUCCEEDED(rv) && docv) { + rv = docv->GetDocument(document); + docv->Release(); + if (NS_SUCCEEDED(rv) && document) { + rv = document->QueryInterface(kIDOMDocumentIID, (void**) &domDoc); + if (NS_SUCCEEDED(rv) && docv) { + return domDoc; + } + } + } + } + } + } + + fprintf(stderr, + "=== GetDocument: failed: " + "container=%x, webshell=%x, contentViewer=%x, " + "documentViewer=%x, document=%x, " + "domDocument=%x, error=%x\n", + (unsigned) (void*) container, + (unsigned) (void*) docshell, + (unsigned) (void*) contentv, + (unsigned) (void*) docv, + (unsigned) (void*) document, + (unsigned) (void*) domDoc, + rv); + return NULL; +} diff --git a/mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.jar.info b/mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.jar.info new file mode 100644 index 00000000000..03a273a90f7 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.jar.info @@ -0,0 +1,3 @@ +6b777772-1dd2-11b2-91bd-d3ab05f89834 +bcDOMAccessor +bcDOMAccessor diff --git a/mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.java b/mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.java new file mode 100644 index 00000000000..b4f37b4589d --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/accessor/bcDOMAccessor.java @@ -0,0 +1,56 @@ + +import org.mozilla.xpcom.*; +import org.mozilla.dom.Attr; +import org.mozilla.dom.Node; +import org.mozilla.dom.Document; +import org.mozilla.dom.Element; +import org.mozilla.dom.DOMTreeDumper; + + +public class bcDOMAccessor implements bcIDOMAccessor { + public bcDOMAccessor() {} + public Object queryInterface(IID iid) { + System.out.println("--[java]::queryInterface iid="+iid); + Object result; + if ( iid.equals(nsISupportsIID) + || iid.equals(bcIDOMAccessorIID)) { + result = this; + } else { + result = null; + } + System.out.println("--[java]::queryInterface result=null "+(result==null)); + return result; + } + + public void endDocumentLoad(String url, Document doc) { + System.out.println("=== GOT URL: " + url); + if (url.startsWith("about")) { + return; + } + new DOMTreeDumper().dumpToStream(System.out, doc); + + } + + static IID bcIDOMAccessorIID = new IID(bcIDOMAccessor.IID); + static IID nsISupportsIID = new IID(nsISupports.IID); + static { + InterfaceRegistry.register("org.mozilla.dom.Attr"); + InterfaceRegistry.register("org.mozilla.dom.CDATASection"); + InterfaceRegistry.register("org.mozilla.dom.CharacterData"); + InterfaceRegistry.register("org.mozilla.dom.Comment"); + InterfaceRegistry.register("org.mozilla.dom.Document"); + InterfaceRegistry.register("org.mozilla.dom.DocumentFragment"); + InterfaceRegistry.register("org.mozilla.dom.DocumentType"); + InterfaceRegistry.register("org.mozilla.dom.DOMImplementation"); + InterfaceRegistry.register("org.mozilla.dom.Element"); + InterfaceRegistry.register("org.mozilla.dom.Entity"); + InterfaceRegistry.register("org.mozilla.dom.EntityReference"); + InterfaceRegistry.register("org.mozilla.dom.NamedNodeMap"); + InterfaceRegistry.register("org.mozilla.dom.Node"); + InterfaceRegistry.register("org.mozilla.dom.NodeList"); + InterfaceRegistry.register("org.mozilla.dom.Notation"); + InterfaceRegistry.register("org.mozilla.dom.ProcessingInstruction"); + InterfaceRegistry.register("org.mozilla.dom.Text"); + } +} + diff --git a/mozilla/java/dom/blackconnect/dom/accessor/bcIDOMAccessor.idl b/mozilla/java/dom/blackconnect/dom/accessor/bcIDOMAccessor.idl new file mode 100644 index 00000000000..dc8005c94f6 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/accessor/bcIDOMAccessor.idl @@ -0,0 +1,9 @@ +#include "nsISupports.idl" +#include "dom.idl" + +#pragma prefix +[scriptable, uuid(d0ee9960-9ecf-11d4-a983-00105ae3801e)] +interface bcIDOMAccessor : nsISupports +{ + void endDocumentLoad(in string url, in Document doc); +}; diff --git a/mozilla/java/dom/blackconnect/dom/accessor/bcIDOMAccessor.java b/mozilla/java/dom/blackconnect/dom/accessor/bcIDOMAccessor.java new file mode 100644 index 00000000000..411256d1600 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/accessor/bcIDOMAccessor.java @@ -0,0 +1,30 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from bcIDOMAccessor.idl. + */ + +import org.mozilla.xpcom.*; +import org.mozilla.dom.*; + + +/** + * Interface bcIDOMAccessor + * + * IID: 0xd0ee9960-9ecf-11d4-a983-00105ae3801e + */ + +public interface bcIDOMAccessor extends nsISupports +{ + public static final String IID = + "d0ee9960-9ecf-11d4-a983-00105ae3801e"; + + + /* void endDocumentLoad (in string url, in Document doc); */ + public void endDocumentLoad(String url, Document doc); + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/accessor/makefile.win b/mozilla/java/dom/blackconnect/dom/accessor/makefile.win new file mode 100644 index 00000000000..e15b40fc83d --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/accessor/makefile.win @@ -0,0 +1,66 @@ +#!gmake +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (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.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1999 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# Denis Sharypov +# + + +DEPTH = ..\..\..\..\.. +topsrcdir = ..\..\..\..\.. +srcdir = . +VPATH = . + +MAKE_OBJ_TYPE=DLL +MODULE=DOMAccessor +COMPONENT=1 +DLLNAME=$(MODULE) +DLL=.\$(OBJDIR)\$(DLLNAME).dll + +XPIDLSRCS = \ + .\bcIDOMAccessor.idl \ + $(NULL) + +OBJS = \ + .\$(OBJDIR)\bcDOMAccessor.obj \ + $(NULL) + +LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib $(DIST)\lib\javadomstubs.lib + +include <$(DEPTH)\config\rules.mak> + +bcDOMAccessor.jar.comp: manifest bcDOMAccessor.class bcDOMAccessor.class + $(JDKHOME)\bin\jar cvfm bcDOMAccessor.jar.comp manifest *.class + +.SUFFIXES: .java .class + +.java.class: + $(JDKHOME)\bin\javac -classpath $(CLASSPATH) $< + +install-component: bcDOMAccessor.jar.comp bcDOMAccessor.jar.info $(DLL) + copy bcDOMAccessor.jar* $(DIST)\bin\components + copy $(DLL) $(DIST)\bin\components + +clobber-java: + -del *.class *.jar.comp +clobber:: clobber-java + rm $(DIST)\bin\components\$(DLLNAME).dll + rm $(DIST)\bin\components\bcDOMAccessor.jar.* +clobber_all:: clobber-java +install:: install-component diff --git a/mozilla/java/dom/blackconnect/dom/accessor/manifest b/mozilla/java/dom/blackconnect/dom/accessor/manifest new file mode 100644 index 00000000000..43c054ddcb9 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/accessor/manifest @@ -0,0 +1 @@ +Component-Class: bcDOMAccessor diff --git a/mozilla/java/dom/blackconnect/dom/classes/Makefile.in b/mozilla/java/dom/blackconnect/dom/classes/Makefile.in new file mode 100644 index 00000000000..2463c03057b --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/Makefile.in @@ -0,0 +1,40 @@ +#!gmake +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (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.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): + +DEPTH = ../../../../.. +topsrcdir = @top_srcdir@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +IGNORE_MANIFEST=1 +JAVA_OR_NSJVM=1 +NO_CAFE=1 + +JDIRS = org/mozilla/dom \ + $(NULL) + + +include $(DEPTH)/config/autoconf.mk +include $(topsrcdir)/config/rules.mk + +JAVAC_PROG = $(JDKHOME)/bin/javac +JAVAC_FLAGS = -classpath $(CLASSPATH) -d $(JAVA_DESTPATH) +JAVAC = $(JAVAC_PROG) $(JAVAC_FLAGS) + diff --git a/mozilla/java/dom/blackconnect/dom/classes/makefile.win b/mozilla/java/dom/blackconnect/dom/classes/makefile.win new file mode 100644 index 00000000000..b41cb58560c --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/makefile.win @@ -0,0 +1,35 @@ +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (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.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Sun Microsystems, +# Inc. Portions created by Sun are +# Copyright (C) 1999 Sun Microsystems, Inc. All +# Rights Reserved. +# +# Contributor(s): + +IGNORE_MANIFEST=1 +DEPTH = ..\..\..\..\.. + +JAVA_OR_NSJVM=1 +NO_CAFE=1 + +include <$(DEPTH)\config\config.mak> + +JDIRS = org\mozilla\dom \ + $(NULL) + +JAVAC_PROG=$(JDKHOME)\bin\javac +JAVAC_FLAGS=-classpath $(CLASSPATH);$(JAVA_DESTPATH) -d $(JAVA_DESTPATH) +include <$(DEPTH)\config\javarules.mak> +include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Attr.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Attr.java new file mode 100644 index 00000000000..30da36b9c76 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Attr.java @@ -0,0 +1,42 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; + + +/** + * Interface Attr + * + * IID: 0x09e31950-9ad5-11d4-a983-00105ae3801e + */ + +public interface Attr extends Node +{ + public static final String IID = + "09e31950-9ad5-11d4-a983-00105ae3801e"; + + + /* readonly attribute DOMString name; */ + public String getName(); + + /* readonly attribute boolean specified; */ + public boolean getSpecified(); + + /* attribute DOMString value; */ + public String getValue(); + public void setValue(String value); + + /* readonly attribute Element ownerElement; */ + public Element getOwnerElement(); + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/CDATASection.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/CDATASection.java new file mode 100644 index 00000000000..863a7e62134 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/CDATASection.java @@ -0,0 +1,29 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; + + +/** + * Interface CDATASection + * + * IID: 0x0b813520-9ad5-11d4-a983-00105ae3801e + */ + +public interface CDATASection extends Text +{ + public static final String IID = + "0b813520-9ad5-11d4-a983-00105ae3801e"; + + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/CharacterData.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/CharacterData.java new file mode 100644 index 00000000000..1479f5b2f6d --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/CharacterData.java @@ -0,0 +1,52 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; +import org.w3c.dom.DOMException; + + +/** + * Interface CharacterData + * + * IID: 0x0965cbf0-9ad5-11d4-a983-00105ae3801e + */ + +public interface CharacterData extends Node +{ + public static final String IID = + "0965cbf0-9ad5-11d4-a983-00105ae3801e"; + + + /* attribute DOMString data; */ + public String getData(); + public void setData(String value); + + /* readonly attribute unsigned long length; */ + public int getLength(); + + /* DOMString substringData (in unsigned long offset, in unsigned long count) raises (DOMException); */ + public String substringData(int offset, int count) throws DOMException; + + /* void appendData (in DOMString arg) raises (DOMException); */ + public void appendData(String arg) throws DOMException; + + /* void insertData (in unsigned long offset, in DOMString arg) raises (DOMException); */ + public void insertData(int offset, String arg) throws DOMException; + + /* void deleteData (in unsigned long offset, in unsigned long count) raises (DOMException); */ + public void deleteData(int offset, int count) throws DOMException; + + /* void replaceData (in unsigned long offset, in unsigned long count, in DOMString arg) raises (DOMException); */ + public void replaceData(int offset, int count, String arg) throws DOMException; + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Comment.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Comment.java new file mode 100644 index 00000000000..bd13384c09d --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Comment.java @@ -0,0 +1,29 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; + + +/** + * Interface Comment + * + * IID: 0x0ae9ed90-9ad5-11d4-a983-00105ae3801e + */ + +public interface Comment extends CharacterData +{ + public static final String IID = + "0ae9ed90-9ad5-11d4-a983-00105ae3801e"; + + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DOMImplementation.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DOMImplementation.java new file mode 100644 index 00000000000..8a4a255f21b --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DOMImplementation.java @@ -0,0 +1,39 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; +import org.w3c.dom.DOMException; + + +/** + * Interface DOMImplementation + * + * IID: 0x0776b330-9ad5-11d4-a983-00105ae3801e + */ + +public interface DOMImplementation extends nsISupports +{ + public static final String IID = + "0776b330-9ad5-11d4-a983-00105ae3801e"; + + + /* boolean hasFeature (in DOMString feature, in DOMString version); */ + public boolean hasFeature(String feature, String version); + + /* DocumentType createDocumentType (in DOMString qualifiedName, in DOMString publicId, in DOMString systemId) raises (DOMException); */ + public DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) throws DOMException; + + /* Document createDocument (in DOMString namespaceURI, in DOMString qualifiedName, in DocumentType doctype) raises (DOMException); */ + public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException; + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DOMTreeDumper.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DOMTreeDumper.java new file mode 100644 index 00000000000..0637bd74778 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DOMTreeDumper.java @@ -0,0 +1,224 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems, + * Inc. All Rights Reserved. + * + * Contributor(s): Denis Sharypov + * + */ + +package org.mozilla.dom; + +import java.io.BufferedOutputStream; +import java.io.PrintStream; +import java.io.FileOutputStream; +import java.io.IOException; + +public class DOMTreeDumper { + + private String name; + private boolean debug; + private PrintStream ps; + private boolean inA; + private final String[] endTagForbiddenNames = {"AREA", + "BASE", + "BASEFONT", + "BR", + "COL", + "FRAME", + "HR", + "IMG", + "INPUT", + "ISINDEX", + "LINK", + "META", + "PARAM"}; + + public DOMTreeDumper() { + this("DOMTreeDumper", true); + } + + public DOMTreeDumper(boolean debug) { + this("DOMTreeDumper", debug); + } + + public DOMTreeDumper(String name) { + this(name, true); + } + + public DOMTreeDumper(String name, boolean debug) { + this.name = name; + this.debug = debug; + } + + private void dumpDocument(Document doc) { + if (doc == null) return; + Element element = doc.getDocumentElement(); + if (element == null) return; + element.normalize(); +// DocumentType dt = doc.getDoctype(); +// dumpNode(dt); + + dumpNode(element); + ps.println(); + ps.flush(); + + element = null; + doc = null; + } + + private void dumpNode(Node node) { + dumpNode(node, false); + } + + private void dumpNode(Node node, boolean isMapNode) { + if (node == null) { + return; + } + + int type = node.getNodeType(); + String name = node.getNodeName(); + String value = node.getNodeValue(); + + switch (type) { + case Node.ELEMENT_NODE: + if (name.equals("A")) inA = true; + if (!(inA || name.equals("BR"))) { + ps.println(); + } + ps.print("<" + name); + dumpAttributes(node); + ps.print(">"); + dumpChildren(node); + if (name.equals("A")) inA = false; + if (!endTagForbidden(name)) { + ps.print(""); + } + break; + case Node.ATTRIBUTE_NODE: + ps.print(" " + name.toUpperCase() + "=\"" + value + "\""); + break; + case Node.TEXT_NODE: + if (!node.getParentNode().getNodeName().equals("PRE")) { + value = value.trim(); + } + if (!value.equals("")) { + if (!inA) { + ps.println(); + } + ps.print(canonicalize(value)); + } + break; + case Node.COMMENT_NODE: + ps.print("\n"); + break; + case Node.CDATA_SECTION_NODE: + case Node.ENTITY_REFERENCE_NODE: + case Node.ENTITY_NODE: + case Node.PROCESSING_INSTRUCTION_NODE: + case Node.DOCUMENT_NODE: + case Node.DOCUMENT_TYPE_NODE: + case Node.DOCUMENT_FRAGMENT_NODE: + case Node.NOTATION_NODE: + ps.println("\n"); + break; + } + } + + private void dumpAttributes(Node node) { + NamedNodeMap map = node.getAttributes(); + if (map == null) return; + int length = map.getLength(); + for (int i=0; i < length; i++) { + Node item = map.item(i); + dumpNode(item, true); + } + } + + private void dumpChildren(Node node) { + NodeList children = node.getChildNodes(); + int length = 0; + boolean hasChildren = ((children != null) && ((length = children.getLength()) > 0)); + if (!hasChildren) { + return; + } + for (int i=0; i < length; i++) { + dumpNode(children.item(i), false); + } + if (!inA) { + ps.println(); + } + } + + private String canonicalize(String str) { + StringBuffer in = new StringBuffer(str); + int length = in.length(); + StringBuffer out = new StringBuffer(length); + char c; + for (int i = 0; i < length; i++) { + switch (c = in.charAt(i)) { + case '&' : + out.append("&"); + break; + case '<': + out.append("<"); + break; + case '>': + out.append(">"); + break; + case '\u00A0': + out.append(" "); + break; + default: + out.append(c); + } + } + return out.toString(); + } + + private boolean endTagForbidden(String name) { + for (int i = 0; i < endTagForbiddenNames.length; i++) { + if (name.equals(endTagForbiddenNames[i])) { + return true; + } + } + return false; + } + + public void dumpToFile(String fileName, Document doc) { + try { + FileOutputStream fos = new FileOutputStream(fileName); + ps = new PrintStream(new BufferedOutputStream(fos, 1024)); + } catch (IOException ex) { + ex.printStackTrace(); + return; + } + dbg("dumping to " + fileName); + dumpDocument(doc); + dbg("finished dumping..."); + } + + public void dumpToStream(PrintStream ps, Document doc) { + this.ps = ps; + dbg("dumping to stream..."); + dumpDocument(doc); + dbg("finished dumping..."); + } + + private void dbg(String str) { + if (debug) { + System.out.println(name + ": " + str); + } + } +} diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Document.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Document.java new file mode 100644 index 00000000000..bd2ed035d79 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Document.java @@ -0,0 +1,81 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; +import org.w3c.dom.DOMException; + + +/** + * Interface Document + * + * IID: 0x0e81d470-9ad5-11d4-a983-00105ae3801e + */ + +public interface Document extends Node +{ + public static final String IID = + "0e81d470-9ad5-11d4-a983-00105ae3801e"; + + + /* readonly attribute DocumentType doctype; */ + public DocumentType getDoctype(); + + /* readonly attribute DOMImplementation implementation; */ + public DOMImplementation getImplementation(); + + /* readonly attribute Element documentElement; */ + public Element getDocumentElement(); + + /* Element createElement (in DOMString tagName) raises (DOMException); */ + public Element createElement(String tagName) throws DOMException; + + /* DocumentFragment createDocumentFragment (); */ + public DocumentFragment createDocumentFragment(); + + /* Text createTextNode (in DOMString data); */ + public Text createTextNode(String data); + + /* Comment createComment (in DOMString data); */ + public Comment createComment(String data); + + /* CDATASection createCDATASection (in DOMString data) raises (DOMException); */ + public CDATASection createCDATASection(String data) throws DOMException; + + /* ProcessingInstruction createProcessingInstruction (in DOMString target, in DOMString data) raises (DOMException); */ + public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException; + + /* Attr createAttribute (in DOMString name) raises (DOMException); */ + public Attr createAttribute(String name) throws DOMException; + + /* EntityReference createEntityReference (in DOMString name) raises (DOMException); */ + public EntityReference createEntityReference(String name) throws DOMException; + + /* NodeList getElementsByTagName (in DOMString tagname); */ + public NodeList getElementsByTagName(String tagname); + + /* Node importNode (in Node importedNode, in boolean deep) raises (DOMException); */ + public Node importNode(Node importedNode, boolean deep) throws DOMException; + + /* Element createElementNS (in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException); */ + public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException; + + /* Attr createAttributeNS (in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException); */ + public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException; + + /* NodeList getElementsByTagNameNS (in DOMString namespaceURI, in DOMString localName); */ + public NodeList getElementsByTagNameNS(String namespaceURI, String localName); + + /* Element getElementById (in DOMString elementId); */ + public Element getElementById(String elementId); + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DocumentFragment.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DocumentFragment.java new file mode 100644 index 00000000000..90b1df8543c --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DocumentFragment.java @@ -0,0 +1,29 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; + + +/** + * Interface DocumentFragment + * + * IID: 0x0e249e00-9ad5-11d4-a983-00105ae3801e + */ + +public interface DocumentFragment extends Node +{ + public static final String IID = + "0e249e00-9ad5-11d4-a983-00105ae3801e"; + + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DocumentType.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DocumentType.java new file mode 100644 index 00000000000..b1aea59e89c --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/DocumentType.java @@ -0,0 +1,47 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; + + +/** + * Interface DocumentType + * + * IID: 0x0c07ada0-9ad5-11d4-a983-00105ae3801e + */ + +public interface DocumentType extends Node +{ + public static final String IID = + "0c07ada0-9ad5-11d4-a983-00105ae3801e"; + + + /* readonly attribute DOMString name; */ + public String getName(); + + /* readonly attribute NamedNodeMap entities; */ + public NamedNodeMap getEntities(); + + /* readonly attribute NamedNodeMap notations; */ + public NamedNodeMap getNotations(); + + /* readonly attribute DOMString publicId; */ + public String getPublicId(); + + /* readonly attribute DOMString systemId; */ + public String getSystemId(); + + /* readonly attribute DOMString internalSubset; */ + public String getInternalSubset(); + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Element.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Element.java new file mode 100644 index 00000000000..12012c40a5a --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Element.java @@ -0,0 +1,78 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; +import org.w3c.dom.DOMException; + + +/** + * Interface Element + * + * IID: 0x0a7d6f40-9ad5-11d4-a983-00105ae3801e + */ + +public interface Element extends Node +{ + public static final String IID = + "0a7d6f40-9ad5-11d4-a983-00105ae3801e"; + + + /* readonly attribute DOMString tagName; */ + public String getTagName(); + + /* DOMString getAttribute (in DOMString name); */ + public String getAttribute(String name); + + /* void setAttribute (in DOMString name, in DOMString value) raises (DOMException); */ + public void setAttribute(String name, String value) throws DOMException; + + /* void removeAttribute (in DOMString name) raises (DOMException); */ + public void removeAttribute(String name) throws DOMException; + + /* Attr getAttributeNode (in DOMString name); */ + public Attr getAttributeNode(String name); + + /* Attr setAttributeNode (in Attr newAttr) raises (DOMException); */ + public Attr setAttributeNode(Attr newAttr) throws DOMException; + + /* Attr removeAttributeNode (in Attr oldAttr) raises (DOMException); */ + public Attr removeAttributeNode(Attr oldAttr) throws DOMException; + + /* NodeList getElementsByTagName (in DOMString name); */ + public NodeList getElementsByTagName(String name); + + /* DOMString getAttributeNS (in DOMString namespaceURI, in DOMString localName); */ + public String getAttributeNS(String namespaceURI, String localName); + + /* void setAttributeNS (in DOMString namespaceURI, in DOMString qualifiedName, in DOMString value) raises (DOMException); */ + public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException; + + /* void removeAttributeNS (in DOMString namespaceURI, in DOMString localName) raises (DOMException); */ + public void removeAttributeNS(String namespaceURI, String localName) throws DOMException; + + /* Attr getAttributeNodeNS (in DOMString namespaceURI, in DOMString localName); */ + public Attr getAttributeNodeNS(String namespaceURI, String localName); + + /* Attr setAttributeNodeNS (in Attr newAttr) raises (DOMException); */ + public Attr setAttributeNodeNS(Attr newAttr) throws DOMException; + + /* NodeList getElementsByTagNameNS (in DOMString namespaceURI, in DOMString localName); */ + public NodeList getElementsByTagNameNS(String namespaceURI, String localName); + + /* boolean hasAttribute (in DOMString name); */ + public boolean hasAttribute(String name); + + /* boolean hasAttributeNS (in DOMString namespaceURI, in DOMString localName); */ + public boolean hasAttributeNS(String namespaceURI, String localName); + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Entity.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Entity.java new file mode 100644 index 00000000000..a350717f284 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Entity.java @@ -0,0 +1,38 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; + + +/** + * Interface Entity + * + * IID: 0x0cf30080-9ad5-11d4-a983-00105ae3801e + */ + +public interface Entity extends Node +{ + public static final String IID = + "0cf30080-9ad5-11d4-a983-00105ae3801e"; + + + /* readonly attribute DOMString publicId; */ + public String getPublicId(); + + /* readonly attribute DOMString systemId; */ + public String getSystemId(); + + /* readonly attribute DOMString notationName; */ + public String getNotationName(); + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/EntityReference.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/EntityReference.java new file mode 100644 index 00000000000..c30c6831134 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/EntityReference.java @@ -0,0 +1,29 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; + + +/** + * Interface EntityReference + * + * IID: 0x0d4eafc0-9ad5-11d4-a983-00105ae3801e + */ + +public interface EntityReference extends Node +{ + public static final String IID = + "0d4eafc0-9ad5-11d4-a983-00105ae3801e"; + + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/NamedNodeMap.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/NamedNodeMap.java new file mode 100644 index 00000000000..9952d476506 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/NamedNodeMap.java @@ -0,0 +1,54 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; +import org.w3c.dom.DOMException; + + +/** + * Interface NamedNodeMap + * + * IID: 0x08f4b810-9ad5-11d4-a983-00105ae3801e + */ + +public interface NamedNodeMap extends nsISupports +{ + public static final String IID = + "08f4b810-9ad5-11d4-a983-00105ae3801e"; + + + /* Node getNamedItem (in DOMString name); */ + public Node getNamedItem(String name); + + /* Node setNamedItem (in Node arg) raises (DOMException); */ + public Node setNamedItem(Node arg) throws DOMException; + + /* Node removeNamedItem (in DOMString name) raises (DOMException); */ + public Node removeNamedItem(String name) throws DOMException; + + /* Node item (in unsigned long index); */ + public Node item(int index); + + /* readonly attribute unsigned long length; */ + public int getLength(); + + /* Node getNamedItemNS (in DOMString namespaceURI, in DOMString localName); */ + public Node getNamedItemNS(String namespaceURI, String localName); + + /* Node setNamedItemNS (in Node arg) raises (DOMException); */ + public Node setNamedItemNS(Node arg) throws DOMException; + + /* Node removeNamedItemNS (in DOMString namespaceURI, in DOMString localName) raises (DOMException); */ + public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException; + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Node.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Node.java new file mode 100644 index 00000000000..19ca9f36c12 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Node.java @@ -0,0 +1,133 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; +import org.w3c.dom.DOMException; + +/** + * Interface Node + * + * IID: 0x082f98e0-9ad5-11d4-a983-00105ae3801e + */ + +public interface Node extends nsISupports +{ + public static final String IID = + "082f98e0-9ad5-11d4-a983-00105ae3801e"; + + + /* const unsigned short ELEMENT_NODE = 1; */ + public static final short ELEMENT_NODE = 1; + + /* const unsigned short ATTRIBUTE_NODE = 2; */ + public static final short ATTRIBUTE_NODE = 2; + + /* const unsigned short TEXT_NODE = 3; */ + public static final short TEXT_NODE = 3; + + /* const unsigned short CDATA_SECTION_NODE = 4; */ + public static final short CDATA_SECTION_NODE = 4; + + /* const unsigned short ENTITY_REFERENCE_NODE = 5; */ + public static final short ENTITY_REFERENCE_NODE = 5; + + /* const unsigned short ENTITY_NODE = 6; */ + public static final short ENTITY_NODE = 6; + + /* const unsigned short PROCESSING_INSTRUCTION_NODE = 7; */ + public static final short PROCESSING_INSTRUCTION_NODE = 7; + + /* const unsigned short COMMENT_NODE = 8; */ + public static final short COMMENT_NODE = 8; + + /* const unsigned short DOCUMENT_NODE = 9; */ + public static final short DOCUMENT_NODE = 9; + + /* const unsigned short DOCUMENT_TYPE_NODE = 10; */ + public static final short DOCUMENT_TYPE_NODE = 10; + + /* const unsigned short DOCUMENT_FRAGMENT_NODE = 11; */ + public static final short DOCUMENT_FRAGMENT_NODE = 11; + + /* const unsigned short NOTATION_NODE = 12; */ + public static final short NOTATION_NODE = 12; + + /* readonly attribute DOMString nodeName; */ + public String getNodeName(); + + /* attribute DOMString nodeValue; */ + public String getNodeValue(); + public void setNodeValue(String value); + + /* readonly attribute unsigned short nodeType; */ + public short getNodeType(); + + /* readonly attribute Node parentNode; */ + public Node getParentNode(); + + /* readonly attribute NodeList childNodes; */ + public NodeList getChildNodes(); + + /* readonly attribute Node firstChild; */ + public Node getFirstChild(); + + /* readonly attribute Node lastChild; */ + public Node getLastChild(); + + /* readonly attribute Node previousSibling; */ + public Node getPreviousSibling(); + + /* readonly attribute Node nextSibling; */ + public Node getNextSibling(); + + /* readonly attribute NamedNodeMap attributes; */ + public NamedNodeMap getAttributes(); + + /* readonly attribute Document ownerDocument; */ + public Document getOwnerDocument(); + + /* Node insertBefore (in Node newChild, in Node refChild) raises (DOMException); */ + public Node insertBefore(Node newChild, Node refChild) throws DOMException; + + /* Node replaceChild (in Node newChild, in Node oldChild) raises (DOMException); */ + public Node replaceChild(Node newChild, Node oldChild) throws DOMException; + + /* Node removeChild (in Node oldChild) raises (DOMException); */ + public Node removeChild(Node oldChild) throws DOMException; + + /* Node appendChild (in Node newChild) raises (DOMException); */ + public Node appendChild(Node newChild) throws DOMException; + + /* boolean hasChildNodes (); */ + public boolean hasChildNodes(); + + /* Node cloneNode (in boolean deep); */ + public Node cloneNode(boolean deep); + + /* void normalize (); */ + public void normalize(); + + /* boolean supports (in DOMString feature, in DOMString version); */ + public boolean supports(String feature, String version); + + /* readonly attribute DOMString namespaceURI; */ + public String getNamespaceURI(); + + /* attribute DOMString prefix; */ + public String getPrefix(); + public void setPrefix(String value); + + /* readonly attribute DOMString localName; */ + public String getLocalName(); + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/NodeList.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/NodeList.java new file mode 100644 index 00000000000..4179eabbb6a --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/NodeList.java @@ -0,0 +1,35 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; + + +/** + * Interface NodeList + * + * IID: 0x0895fa70-9ad5-11d4-a983-00105ae3801e + */ + +public interface NodeList extends nsISupports +{ + public static final String IID = + "0895fa70-9ad5-11d4-a983-00105ae3801e"; + + + /* Node item (in unsigned long index); */ + public Node item(int index); + + /* readonly attribute unsigned long length; */ + public int getLength(); + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Notation.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Notation.java new file mode 100644 index 00000000000..8c6928aed5e --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Notation.java @@ -0,0 +1,35 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; + + +/** + * Interface Notation + * + * IID: 0x0c7a48b0-9ad5-11d4-a983-00105ae3801e + */ + +public interface Notation extends Node +{ + public static final String IID = + "0c7a48b0-9ad5-11d4-a983-00105ae3801e"; + + + /* readonly attribute DOMString publicId; */ + public String getPublicId(); + + /* readonly attribute DOMString systemId; */ + public String getSystemId(); + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/ProcessingInstruction.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/ProcessingInstruction.java new file mode 100644 index 00000000000..62cfe741513 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/ProcessingInstruction.java @@ -0,0 +1,36 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; + + +/** + * Interface ProcessingInstruction + * + * IID: 0x0db69880-9ad5-11d4-a983-00105ae3801e + */ + +public interface ProcessingInstruction extends Node +{ + public static final String IID = + "0db69880-9ad5-11d4-a983-00105ae3801e"; + + + /* readonly attribute DOMString target; */ + public String getTarget(); + + /* attribute DOMString data; */ + public String getData(); + public void setData(String value); + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Text.java b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Text.java new file mode 100644 index 00000000000..7474b42f876 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/Text.java @@ -0,0 +1,33 @@ +/* + * ************* DO NOT EDIT THIS FILE *********** + * + * This file was automatically generated from dom.idl. + */ + + +package org.mozilla.dom; + +import org.mozilla.xpcom.*; +import org.w3c.dom.DOMException; + + +/** + * Interface Text + * + * IID: 0x0eefd9f0-9ad5-11d4-a983-00105ae3801e + */ + +public interface Text extends CharacterData +{ + public static final String IID = + "0eefd9f0-9ad5-11d4-a983-00105ae3801e"; + + + /* Text splitText (in unsigned long offset) raises (DOMException); */ + public Text splitText(int offset) throws DOMException; + +} + +/* + * end + */ diff --git a/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/doit.bat b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/doit.bat new file mode 100755 index 00000000000..9bcfe958145 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/classes/org/mozilla/dom/doit.bat @@ -0,0 +1 @@ +C:\jdk1.3\bin\javac -classpath .;C:\JDK1.3\jre\lib\rt.jar;;C:\JDK1.3\jre\lib\jaws.jar;d:\wrk\mozilla\dist\classes;;d:\wrk\classes;;d:\wrk\mozilla\dist\classes -d d:\wrk\mozilla\dist\classes Attr.java CDATASection.java CharacterData.java Comment.java Document.java DocumentFragment.java DocumentType.java DOMImplementation.java DOMTreeDumper.java Element.java Entity.java EntityReference.java NamedNodeMap.java Node.java NodeList.java Notation.java ProcessingInstruction.java Text.java diff --git a/mozilla/java/dom/blackconnect/dom/makefile.win b/mozilla/java/dom/blackconnect/dom/makefile.win new file mode 100644 index 00000000000..4c12535a0f6 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/makefile.win @@ -0,0 +1,32 @@ +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (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.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Sun Microsystems, +# Inc. Portions created by Sun are +# Copyright (C) 1999 Sun Microsystems, Inc. All +# Rights Reserved. +# +# Contributor(s): + +IGNORE_MANIFEST=1 +#//------------------------------------------------------------------------ +#// +#// Specify the depth of the current directory relative to the +#// root of NS +#// +#//------------------------------------------------------------------------ +DEPTH = ..\..\..\.. + +DIRS = classes stubs accessor + +include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/java/dom/blackconnect/dom/readme b/mozilla/java/dom/blackconnect/dom/readme new file mode 100644 index 00000000000..565746edfa6 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/readme @@ -0,0 +1,88 @@ +About the project +================= + +The goal is to provide access to the DOM API provided +by the mozilla browser using the java to xpcom bridge(Blackconnect). + +The implementation currently consists of stubs between mozilla core DOM +interfaces and core DOM interfaces defined in dom.idl (blackconnect +requires scriptable interfaces), java interfaces generated from +dom.idl and a DOMAccessor as an example of using the DOM API. + + +Sources +======= + +The sources are located in mozilla/java/dom +Subdirectories + + classes - contains classes generated automatically from + idl definition of core DOM interfaces (stubs/dom.idl) + using xpidl compiler (mozilla/java/xpcom/java/xpidl) + and a sample DOMTreeDumper class that dumps an html + document source using its DOM tree. + + stubs - stubs between mozilla core DOM interfaces and + core DOM interfaces defined in dom.idl + + accessor - a sample java component which demonstrates the + use of the DOM API from java via blackconnect + + +Building +======== + Requirenments: + -------------- + - you need to build the blackconnect bridge + mozilla/java/xpcom and to have all the + environment variables set required for + building blackconnect + - mozilla_Netscape_20000922_BRANCH mozilla build + - JDK1.3 + - Perl 5 must be in your path + - JDKHOME environment variable set to your JDK dir + - CLASSPATH environment variable set to contain + mozilla/dist/classes directory and + org.w3c.dom.DOMException class. The source can be found at + http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/java-binding.html + + Solaris and Linux: + ------------------ + goto mozilla/java/dom directory and type "gmake" + + Windows NT: + ----------- + goto mozilla/java/dom directory and type "nmake /f makefile.win" + + +Running +======= + After building a component run a mozilla browser. The document + sources will be dumped into console. + +Using the Java DOM API +====================== + + Directory accessor contains a sample java component which + becomes a document load listener and dumps sources of documents + being displayed in mozilla using their DOM trees. + + if you have a C++ pointer to any core DOM mozilla interface nsIDOM<...> + you need to wrap it into a corresponding scriptable stub interface + bc<...> (e.g. nsIDOMDocument into bcDocument using + bcDocument::bcDocument(nsIDOMDocument* ptr) constructor) and you + can use it to pass to java as a class instance which implements + a org.mozill.dom.Document interface using blackconnect. + + An example works this way: + A C++ implementation of a component gets a call via NSGetModule method, + registrates itself as a document load listener, gets a reference to + a java component and then pass references to all documents being + displayed into a java component. + +Notes: + - Since exception passing mechanism is not yet implemented in blackconnect + no DOMExceptions are raised. + + - The mechanism used in a sample allows to modify any documents in any + way provided by the DOM API, so there are no security restrictions at all. diff --git a/mozilla/java/dom/blackconnect/dom/stubs/Makefile.in b/mozilla/java/dom/blackconnect/dom/stubs/Makefile.in new file mode 100644 index 00000000000..c352e35f1bb --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/Makefile.in @@ -0,0 +1,74 @@ +#!gmake +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (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.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# + + +DEPTH = ../../../../.. +topsrcdir = @top_srcdir@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +LIBRARY_NAME = javadomstubs +MODULE = javadomstubs +XPIDLSRCS = dom.idl + +CPPSRCS = bcNode.cpp \ + bcElement.cpp \ + bcAttr.cpp \ + bcNodeList.cpp \ + bcNamedNodeMap.cpp \ + bcDocument.cpp \ + bcCharacterData.cpp \ + bcText.cpp \ + bcComment.cpp \ + bcCDATASection.cpp \ + bcDocumentFragment.cpp \ + bcEntityReference.cpp \ + bcEntity.cpp \ + bcNotation.cpp \ + bcDocumentType.cpp \ + bcProcessingInstruction.cpp \ + bcDOMImplementation.cpp \ + $(NULL) + +EXPORTS = bcNode.h \ + bcElement.h \ + bcAttr.h \ + bcNodeList.h \ + bcNamedNodeMap.h \ + bcDocument.h \ + bcCharacterData.h \ + bcText.h \ + bcComment.h \ + bcCDATASection.h \ + bcDocumentFragment.h \ + bcEntityReference.h \ + bcEntity.h \ + bcNotation.h \ + bcDocumentType.h \ + bcProcessingInstruction.h \ + bcDOMImplementation.h \ + $(NULL) + + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcAttr.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcAttr.cpp new file mode 100644 index 00000000000..52c9b6de7ba --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcAttr.cpp @@ -0,0 +1,56 @@ +#include "bcAttr.h" +#include "bcElement.h" + +NS_IMPL_ISUPPORTS1(bcAttr, Attr) + +bcAttr::bcAttr(nsIDOMAttr* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + nodePtr = new bcNode(ptr); +} + +bcAttr::~bcAttr() +{ + /* destructor code */ +} + +/* readonly attribute DOMString name; */ +NS_IMETHODIMP bcAttr::GetName(DOMString *aName) +{ + nsString ret; + nsresult rv = domPtr->GetName(ret); + *aName = ret.ToNewUnicode(); + return rv; +} + +/* readonly attribute boolean specified; */ +NS_IMETHODIMP bcAttr::GetSpecified(PRBool *aSpecified) +{ + return domPtr->GetSpecified(aSpecified); +} + +/* attribute DOMString value; */ +NS_IMETHODIMP bcAttr::GetValue(DOMString *aValue) +{ + nsString ret; + nsresult rv = domPtr->GetValue(ret); + *aValue = ret.ToNewUnicode(); + return rv; +} +NS_IMETHODIMP bcAttr::SetValue(DOMString aValue) +{ + nsString val(aValue); + nsresult rv = domPtr->SetValue(val); + return rv; +} + +/* readonly attribute Element ownerElement; */ +NS_IMETHODIMP bcAttr::GetOwnerElement(Element * *aOwnerElement) +{ + nsIDOMElement* ret = nsnull; + nsresult rv = domPtr->GetOwnerElement(&ret); + *aOwnerElement = new bcElement(ret); + return rv; +} diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcAttr.h b/mozilla/java/dom/blackconnect/dom/stubs/bcAttr.h new file mode 100644 index 00000000000..8823ab3fb50 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcAttr.h @@ -0,0 +1,26 @@ +#ifndef __bcAttr_h__ +#define __bcAttr_h__ + +#include "dom.h" +#include "bcNode.h" +#include "nsIDOMAttr.h" + +#define DOM_ATTR_PTR(_attr_) (!_attr_ ? nsnull : ((bcAttr*)_attr_)->domPtr) +#define NEW_BCATTR(_attr_) (!_attr_ ? nsnull : new bcAttr(_attr_)) + +class bcAttr : public Attr +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_ATTR + NS_FORWARD_NODE(nodePtr->) + + bcAttr(nsIDOMAttr* domPtr); + virtual ~bcAttr(); + nsIDOMAttr* domPtr; +private: + bcNode* nodePtr; + /* additional members */ +}; + +#endif // __bcAttr_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcCDATASection.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcCDATASection.cpp new file mode 100644 index 00000000000..2ffded1fb14 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcCDATASection.cpp @@ -0,0 +1,17 @@ +#include "bcCDATASection.h" + +NS_IMPL_ISUPPORTS1(bcCDATASection, CDATASection) + +bcCDATASection::bcCDATASection(nsIDOMCDATASection* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + textPtr = new bcText(ptr); +} + +bcCDATASection::~bcCDATASection() +{ + /* destructor code */ +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcCDATASection.h b/mozilla/java/dom/blackconnect/dom/stubs/bcCDATASection.h new file mode 100644 index 00000000000..151f8e186d3 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcCDATASection.h @@ -0,0 +1,28 @@ +#ifndef __bcCDATASection_h__ +#define __bcCDATASection_h__ + +#include "dom.h" +#include "nsIDOMCDATASection.h" +#include "bcText.h" + +#define DOM_CDATASECTION_PTR(_cdatasection_) (!_cdatasection_ ? nsnull : ((bcCDATASection*)_cdatasection_)->domPtr) +#define NEW_BCCDATASECTION(_cdatasection_) (!_cdatasection_ ? nsnull : new bcCDATASection(_cdatasection_)) + +class bcCDATASection : public CDATASection +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_CDATASECTION + NS_FORWARD_NODE(textPtr->) + NS_FORWARD_CHARACTERDATA(textPtr->) + NS_FORWARD_TEXT(textPtr->) + + bcCDATASection(nsIDOMCDATASection* domPtr); + virtual ~bcCDATASection(); +private: + nsIDOMCDATASection* domPtr; + bcText* textPtr; + /* additional members */ +}; + +#endif // __bcCDATASection_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcCharacterData.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcCharacterData.cpp new file mode 100644 index 00000000000..efdff792e00 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcCharacterData.cpp @@ -0,0 +1,75 @@ +#include "bcCharacterData.h" + +NS_IMPL_ISUPPORTS1(bcCharacterData, CharacterData) + +bcCharacterData::bcCharacterData(nsIDOMCharacterData* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + nodePtr = new bcNode(ptr); +} + +bcCharacterData::~bcCharacterData() +{ + /* destructor code */ +} + +/* attribute DOMString data; */ +NS_IMETHODIMP bcCharacterData::GetData(DOMString *aData) +{ + nsString ret; + nsresult rv = domPtr->GetData(ret); + *aData = ret.ToNewUnicode(); + return rv; +} + +NS_IMETHODIMP bcCharacterData::SetData(DOMString aData) +{ + nsString _aData(aData); + return domPtr->SetData(_aData); +} + + +/* readonly attribute unsigned long length; */ +NS_IMETHODIMP bcCharacterData::GetLength(PRUint32 *aLength) +{ + return domPtr->GetLength(aLength); +} + + +/* DOMString substringData (in unsigned long offset, in unsigned long count) raises (DOMException); */ +NS_IMETHODIMP bcCharacterData::SubstringData(PRUint32 offset, PRUint32 count, DOMString *_retval) +{ + nsString ret; + nsresult rv = domPtr->SubstringData(offset, count, ret); + *_retval = ret.ToNewUnicode(); + return rv; +} + +/* void appendData (in DOMString arg) raises (DOMException); */ +NS_IMETHODIMP bcCharacterData::AppendData(DOMString arg) +{ + nsString _arg(arg); + return domPtr->AppendData(_arg); +} + +/* void insertData (in unsigned long offset, in DOMString arg) raises (DOMException); */ +NS_IMETHODIMP bcCharacterData::InsertData(PRUint32 offset, DOMString arg) +{ + nsString _arg(arg); + return domPtr->InsertData(offset, _arg); +} + +/* void deleteData (in unsigned long offset, in unsigned long count) raises (DOMException); */ +NS_IMETHODIMP bcCharacterData::DeleteData(PRUint32 offset, PRUint32 count) +{ + return domPtr->DeleteData(offset, count); +} + +/* void replaceData (in unsigned long offset, in unsigned long count, in DOMString arg) raises (DOMException); */ +NS_IMETHODIMP bcCharacterData::ReplaceData(PRUint32 offset, PRUint32 count, DOMString arg) +{ + nsString _arg(arg); + return domPtr->ReplaceData(offset, count, _arg); +} diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcCharacterData.h b/mozilla/java/dom/blackconnect/dom/stubs/bcCharacterData.h new file mode 100644 index 00000000000..8f5a98954ae --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcCharacterData.h @@ -0,0 +1,26 @@ +#ifndef __bcCharacterData_h__ +#define __bcCharacterData_h__ + +#include "dom.h" +#include "bcNode.h" +#include "nsIDOMCharacterData.h" + +#define DOM_CHARACTERDATA_PTR(_characterdata_) (!_characterdata_ ? nsnull : ((bcCharacterData*)_characterdata_)->domPtr) +#define NEW_BCCHARACTERDATA(_characterdata_) (!_characterdata_ ? nsnull : new bcCharacterData(_characterdata_)) + +class bcCharacterData : public CharacterData +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_CHARACTERDATA + NS_FORWARD_NODE(nodePtr->) + + bcCharacterData(nsIDOMCharacterData* domPtr); + virtual ~bcCharacterData(); +private: + nsIDOMCharacterData* domPtr; + bcNode* nodePtr; + /* additional members */ +}; + +#endif // __bcCharacterData_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcComment.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcComment.cpp new file mode 100644 index 00000000000..a2c9a046813 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcComment.cpp @@ -0,0 +1,17 @@ +#include "bcComment.h" + +NS_IMPL_ISUPPORTS1(bcComment, Comment) + +bcComment::bcComment(nsIDOMComment* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + dataPtr = new bcCharacterData(ptr); +} + +bcComment::~bcComment() +{ + /* destructor code */ +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcComment.h b/mozilla/java/dom/blackconnect/dom/stubs/bcComment.h new file mode 100644 index 00000000000..279cdf481c9 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcComment.h @@ -0,0 +1,27 @@ +#ifndef __bcComment_h__ +#define __bcComment_h__ + +#include "dom.h" +#include "nsIDOMComment.h" +#include "bcCharacterData.h" + +#define DOM_COMMENT_PTR(_comment_) (!_comment_ ? nsnull : ((bcComment*)_comment_)->domPtr) +#define NEW_BCCOMMENT(_comment_) (!_comment_ ? nsnull : new bcComment(_comment_)) + +class bcComment : public Comment +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_COMMENT + NS_FORWARD_NODE(dataPtr->) + NS_FORWARD_CHARACTERDATA(dataPtr->) + + bcComment(nsIDOMComment* domPtr); + virtual ~bcComment(); +private: + nsIDOMComment* domPtr; + bcCharacterData* dataPtr; + /* additional members */ +}; + +#endif // __bcComment_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcDOMImplementation.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcDOMImplementation.cpp new file mode 100644 index 00000000000..50b239c8fc3 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcDOMImplementation.cpp @@ -0,0 +1,46 @@ +#include "bcDOMImplementation.h" +#include "bcDocumentType.h" +#include "bcDocument.h" + +NS_IMPL_ISUPPORTS1(bcDOMImplementation, DOMImplementation) + +bcDOMImplementation::bcDOMImplementation(nsIDOMDOMImplementation* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; +} + +bcDOMImplementation::~bcDOMImplementation() +{ + /* destructor code */ +} + +/* boolean hasFeature (in DOMString feature, in DOMString version); */ +NS_IMETHODIMP bcDOMImplementation::HasFeature(DOMString feature, DOMString version, PRBool *_retval) +{ + nsString _feature(feature), _version(version); + return domPtr->HasFeature(_feature, _version, _retval); +} + +/* DocumentType createDocumentType (in DOMString qualifiedName, in DOMString publicId, in DOMString systemId) raises (DOMException); */ +NS_IMETHODIMP bcDOMImplementation::CreateDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId, DocumentType **_retval) +{ + nsIDOMDocumentType* ret = nsnull; + nsString _qualifiedName(qualifiedName), _publicId(publicId), _systemId(systemId); + nsresult rv = domPtr->CreateDocumentType(_qualifiedName, _publicId, _systemId, &ret); + *_retval = NEW_BCDOCUMENTTYPE(ret); + return rv; +} + +/* Document createDocument (in DOMString namespaceURI, in DOMString qualifiedName, in DocumentType doctype) raises (DOMException); */ +NS_IMETHODIMP bcDOMImplementation::CreateDocument(DOMString namespaceURI, DOMString qualifiedName, DocumentType *doctype, Document **_retval) +{ + nsIDOMDocument* ret = nsnull; + nsString _namespaceURI(namespaceURI), _qualifiedName(qualifiedName); + nsresult rv = domPtr->CreateDocument(_namespaceURI, _qualifiedName, + DOM_DOCUMENTTYPE_PTR(doctype), &ret); + *_retval = NEW_BCDOCUMENT(ret); + return rv; +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcDOMImplementation.h b/mozilla/java/dom/blackconnect/dom/stubs/bcDOMImplementation.h new file mode 100644 index 00000000000..0300144ef41 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcDOMImplementation.h @@ -0,0 +1,23 @@ +#ifndef __bcDOMImplementation_h__ +#define __bcDOMImplementation_h__ + +#include "dom.h" +#include "nsIDOMDOMImplementation.h" + +#define DOM_DOMIMPLEMENTATION_PTR(_domimplementation_) (!_domimplementation_ ? nsnull : ((bcDOMImplementation*)_domimplementation_)->domPtr) +#define NEW_BCDOMIMPLEMENTATION(_domimplementation_) (!_domimplementation_ ? nsnull : new bcDOMImplementation(_domimplementation_)) + +class bcDOMImplementation : public DOMImplementation +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_DOMIMPLEMENTATION + + bcDOMImplementation(nsIDOMDOMImplementation* domPtr); + virtual ~bcDOMImplementation(); +private: + nsIDOMDOMImplementation* domPtr; + /* additional members */ +}; + +#endif // __bcDOMImplementation_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcDocument.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcDocument.cpp new file mode 100644 index 00000000000..965f02a3e32 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcDocument.cpp @@ -0,0 +1,196 @@ +#include "bcDocument.h" +#include "bcElement.h" +#include "bcNodeList.h" +#include "bcAttr.h" +#include "bcText.h" +#include "bcComment.h" +#include "bcCDATASection.h" +#include "bcEntityReference.h" +#include "bcDocumentType.h" +#include "bcDocumentFragment.h" +#include "bcProcessingInstruction.h" +#include "bcDOMImplementation.h" + +NS_IMPL_ISUPPORTS1(bcDocument, Document) + +bcDocument::bcDocument(nsIDOMDocument* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + nodePtr = new bcNode(ptr); +} + +bcDocument::~bcDocument() +{ + /* destructor code */ +} + +/* readonly attribute DocumentType doctype; */ +NS_IMETHODIMP bcDocument::GetDoctype(DocumentType * *aDoctype) +{ + nsIDOMDocumentType* ret; + nsresult rv = domPtr->GetDoctype(&ret); + *aDoctype = NEW_BCDOCUMENTTYPE(ret); + return rv; +} + + +/* readonly attribute DOMImplementation implementation; */ +NS_IMETHODIMP bcDocument::GetImplementation(DOMImplementation * *aImplementation) +{ + nsIDOMDOMImplementation* ret; + nsresult rv = domPtr->GetImplementation(&ret); + *aImplementation = NEW_BCDOMIMPLEMENTATION(ret); + return rv; +} + + +/* readonly attribute Element documentElement; */ +NS_IMETHODIMP bcDocument::GetDocumentElement(Element * *aDocumentElement) +{ + nsIDOMElement* ret = nsnull; + nsresult rv = domPtr->GetDocumentElement(&ret); + *aDocumentElement = NEW_BCELEMENT(ret); + return rv; +} + + +/* Element createElement (in DOMString tagName) raises (DOMException); */ +NS_IMETHODIMP bcDocument::CreateElement(DOMString tagName, Element **_retval) +{ + nsIDOMElement* ret = nsnull; + nsString _tagName(tagName); + nsresult rv = domPtr->CreateElement(_tagName, &ret); + *_retval = NEW_BCELEMENT(ret); + return rv; +} + +/* DocumentFragment createDocumentFragment (); */ +NS_IMETHODIMP bcDocument::CreateDocumentFragment(DocumentFragment **_retval) +{ + nsIDOMDocumentFragment* ret; + nsresult rv = domPtr->CreateDocumentFragment(&ret); + *_retval = NEW_BCDOCUMENTFRAGMENT(ret); + return rv; +} + +/* Text createTextNode (in DOMString data); */ +NS_IMETHODIMP bcDocument::CreateTextNode(DOMString data, Text **_retval) +{ + nsString _data(data); + nsIDOMText* ret = nsnull; + nsresult rv = domPtr->CreateTextNode(_data, &ret); + *_retval = NEW_BCTEXT(ret); + return rv; +} + +/* Comment createComment (in DOMString data); */ +NS_IMETHODIMP bcDocument::CreateComment(DOMString data, Comment **_retval) +{ + nsString _data(data); + nsIDOMComment* ret = nsnull; + nsresult rv = domPtr->CreateComment(_data, &ret); + *_retval = NEW_BCCOMMENT(ret); + return rv; +} + +/* CDATASection createCDATASection (in DOMString data) raises (DOMException); */ +NS_IMETHODIMP bcDocument::CreateCDATASection(DOMString data, CDATASection **_retval) +{ + nsString _data(data); + nsIDOMCDATASection* ret = nsnull; + nsresult rv = domPtr->CreateCDATASection(_data, &ret); + *_retval = NEW_BCCDATASECTION(ret); + return rv; +} + +/* ProcessingInstruction createProcessingInstruction (in DOMString target, in DOMString data) raises (DOMException); */ +NS_IMETHODIMP bcDocument::CreateProcessingInstruction(DOMString target, DOMString data, ProcessingInstruction **_retval) +{ + nsIDOMProcessingInstruction* ret; + nsString _target(target), _data(data); + nsresult rv = domPtr->CreateProcessingInstruction(_target, _data, &ret); + *_retval = NEW_BCPROCESSINGINSTRUCTION(ret); + return rv; +} + +/* Attr createAttribute (in DOMString name) raises (DOMException); */ +NS_IMETHODIMP bcDocument::CreateAttribute(DOMString name, Attr **_retval) +{ + nsString _name(name); + nsIDOMAttr* ret = nsnull; + nsresult rv = domPtr->CreateAttribute(_name, &ret); + *_retval = NEW_BCATTR(ret); + return rv; +} + +/* EntityReference createEntityReference (in DOMString name) raises (DOMException); */ +NS_IMETHODIMP bcDocument::CreateEntityReference(DOMString name, EntityReference **_retval) +{ + nsString _name(name); + nsIDOMEntityReference* ret = nsnull; + nsresult rv = domPtr->CreateEntityReference(_name, &ret); + *_retval = NEW_BCENTITYREFERENCE(ret); + return rv; +} + +/* NodeList getElementsByTagName (in DOMString tagname); */ +NS_IMETHODIMP bcDocument::GetElementsByTagName(DOMString tagname, NodeList **_retval) +{ + nsString _tagname(tagname); + nsIDOMNodeList* ret = nsnull; + nsresult rv = domPtr->GetElementsByTagName(_tagname, &ret); + *_retval = NEW_BCNODELIST(ret); + return rv; +} + +/* Node importNode (in Node importedNode, in boolean deep) raises (DOMException); */ +NS_IMETHODIMP bcDocument::ImportNode(Node *importedNode, PRBool deep, Node **_retval) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->ImportNode(DOM_NODE_PTR(importedNode), deep, &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* Element createElementNS (in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException); */ +NS_IMETHODIMP bcDocument::CreateElementNS(DOMString namespaceURI, DOMString qualifiedName, Element **_retval) +{ + nsString _namespaceURI(namespaceURI), _qualifiedName(qualifiedName); + nsIDOMElement* ret = nsnull; + nsresult rv = domPtr->CreateElementNS(_namespaceURI, _qualifiedName, &ret); + *_retval = NEW_BCELEMENT(ret); + return rv; +} + +/* Attr createAttributeNS (in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException); */ +NS_IMETHODIMP bcDocument::CreateAttributeNS(DOMString namespaceURI, DOMString qualifiedName, Attr **_retval) +{ + nsString _namespaceURI(namespaceURI), _qualifiedName(qualifiedName); + nsIDOMAttr* ret = nsnull; + nsresult rv = domPtr->CreateAttributeNS(_namespaceURI, _qualifiedName, &ret); + *_retval = NEW_BCATTR(ret); + return rv; +} + +/* NodeList getElementsByTagNameNS (in DOMString namespaceURI, in DOMString localName); */ +NS_IMETHODIMP bcDocument::GetElementsByTagNameNS(DOMString namespaceURI, DOMString localName, NodeList **_retval) +{ + nsString _namespaceURI(namespaceURI), _localName(localName); + nsIDOMNodeList* ret; + nsresult rv = domPtr->GetElementsByTagNameNS(_namespaceURI, _localName, &ret); + *_retval = NEW_BCNODELIST(ret); + return rv; +} + +/* Element getElementById (in DOMString elementId); */ +NS_IMETHODIMP bcDocument::GetElementById(DOMString elementId, Element **_retval) +{ + nsString _elementId(elementId); + nsIDOMElement* ret = nsnull; + nsresult rv = domPtr->GetElementById(_elementId, &ret); + *_retval = NEW_BCELEMENT(ret); + return rv; +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcDocument.h b/mozilla/java/dom/blackconnect/dom/stubs/bcDocument.h new file mode 100644 index 00000000000..1e078fd7da4 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcDocument.h @@ -0,0 +1,26 @@ +#ifndef __bcDocument_h__ +#define __bcDocument_h__ + +#include "dom.h" +#include "bcNode.h" +#include "nsIDOMDocument.h" + +#define DOM_DOCUMENT_PTR(_document_) (!_document_ ? nsnull : ((bcDocument*)_document_)->domPtr) +#define NEW_BCDOCUMENT(_document_) (!_document_ ? nsnull : new bcDocument(_document_)) + +class bcDocument : public Document +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_DOCUMENT + NS_FORWARD_NODE(nodePtr->) + + bcDocument(nsIDOMDocument* domPtr); + virtual ~bcDocument(); +private: + nsIDOMDocument* domPtr; + bcNode* nodePtr; + /* additional members */ +}; + +#endif // __bcDocument_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentFragment.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentFragment.cpp new file mode 100644 index 00000000000..92d1c66c70c --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentFragment.cpp @@ -0,0 +1,17 @@ +#include "bcDocumentFragment.h" + +NS_IMPL_ISUPPORTS1(bcDocumentFragment, DocumentFragment) + +bcDocumentFragment::bcDocumentFragment(nsIDOMDocumentFragment* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + nodePtr = new bcNode(ptr); +} + +bcDocumentFragment::~bcDocumentFragment() +{ + /* destructor code */ +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentFragment.h b/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentFragment.h new file mode 100644 index 00000000000..71008c2823f --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentFragment.h @@ -0,0 +1,26 @@ +#ifndef __bcDocumentFragment_h__ +#define __bcDocumentFragment_h__ + +#include "dom.h" +#include "bcNode.h" +#include "nsIDOMDocumentFragment.h" + +#define DOM_DOCUMENTFRAGMENT_PTR(_documentfragment_) (!_documentfragment_ ? nsnull : ((bcDocumentFragment*)_documentfragment_)->domPtr) +#define NEW_BCDOCUMENTFRAGMENT(_documentfragment_) (!_documentfragment_ ? nsnull : new bcDocumentFragment(_documentfragment_)) + +class bcDocumentFragment : public DocumentFragment +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_DOCUMENTFRAGMENT + NS_FORWARD_NODE(nodePtr->) + + bcDocumentFragment(nsIDOMDocumentFragment* domPtr); + virtual ~bcDocumentFragment(); +private: + nsIDOMDocumentFragment* domPtr; + bcNode* nodePtr; + /* additional members */ +}; + +#endif // __bcDocumentFragment_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentType.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentType.cpp new file mode 100644 index 00000000000..d219e2d46c2 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentType.cpp @@ -0,0 +1,78 @@ +#include "bcDocumentType.h" +#include "bcNamedNodeMap.h" + +NS_IMPL_ISUPPORTS1(bcDocumentType, DocumentType) + +bcDocumentType::bcDocumentType(nsIDOMDocumentType* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + nodePtr = new bcNode(ptr); +} + +bcDocumentType::~bcDocumentType() +{ + /* destructor code */ +} + +/* readonly attribute DOMString name; */ +NS_IMETHODIMP bcDocumentType::GetName(DOMString *aName) +{ + nsString ret; + nsresult rv = domPtr->GetName(ret); + *aName = ret.ToNewUnicode(); + return rv; +} + + +/* readonly attribute NamedNodeMap entities; */ +NS_IMETHODIMP bcDocumentType::GetEntities(NamedNodeMap * *aEntities) +{ + nsIDOMNamedNodeMap* ret = nsnull; + nsresult rv = domPtr->GetEntities(&ret); + *aEntities = NEW_BCNAMEDNODEMAP(ret); + return rv; +} + + +/* readonly attribute NamedNodeMap notations; */ +NS_IMETHODIMP bcDocumentType::GetNotations(NamedNodeMap * *aNotations) +{ + nsIDOMNamedNodeMap* ret = nsnull; + nsresult rv = domPtr->GetNotations(&ret); + *aNotations = NEW_BCNAMEDNODEMAP(ret); + return rv; +} + + +/* readonly attribute DOMString publicId; */ +NS_IMETHODIMP bcDocumentType::GetPublicId(DOMString *aPublicId) +{ + nsString ret; + nsresult rv = domPtr->GetPublicId(ret); + *aPublicId = ret.ToNewUnicode(); + return rv; +} + + +/* readonly attribute DOMString systemId; */ +NS_IMETHODIMP bcDocumentType::GetSystemId(DOMString *aSystemId) +{ + nsString ret; + nsresult rv = domPtr->GetSystemId(ret); + *aSystemId = ret.ToNewUnicode(); + return rv; +} + + +/* readonly attribute DOMString internalSubset; */ +NS_IMETHODIMP bcDocumentType::GetInternalSubset(DOMString *aInternalSubset) +{ + nsString ret; + nsresult rv = domPtr->GetInternalSubset(ret); + *aInternalSubset = ret.ToNewUnicode(); + return rv; +} + + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentType.h b/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentType.h new file mode 100644 index 00000000000..07cfa323c60 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcDocumentType.h @@ -0,0 +1,26 @@ +#ifndef __bcDocumentType_h__ +#define __bcDocumentType_h__ + +#include "dom.h" +#include "bcNode.h" +#include "nsIDOMDocumentType.h" + +#define DOM_DOCUMENTTYPE_PTR(_documenttype_) (!_documenttype_ ? nsnull : ((bcDocumentType*)_documenttype_)->domPtr) +#define NEW_BCDOCUMENTTYPE(_documenttype_) (!_documenttype_ ? nsnull : new bcDocumentType(_documenttype_)) + +class bcDocumentType : public DocumentType +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_DOCUMENTTYPE + NS_FORWARD_NODE(nodePtr->) + + bcDocumentType(nsIDOMDocumentType* domPtr); + virtual ~bcDocumentType(); + nsIDOMDocumentType* domPtr; +private: + bcNode* nodePtr; + /* additional members */ +}; + +#endif // __bcDocumentType_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcElement.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcElement.cpp new file mode 100644 index 00000000000..1024f1db781 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcElement.cpp @@ -0,0 +1,159 @@ +#include "bcElement.h" +#include "bcAttr.h" +#include "bcNodeList.h" + +NS_IMPL_ISUPPORTS1(bcElement, Element) + +bcElement::bcElement(nsIDOMElement* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + nodePtr = new bcNode(ptr); +} + +bcElement::~bcElement() +{ + /* destructor code */ +} + +/* readonly attribute DOMString tagName; */ +NS_IMETHODIMP bcElement::GetTagName(DOMString *aTagName) +{ + nsString ret; + nsresult rv = domPtr->GetTagName(ret); + *aTagName = ret.ToNewUnicode(); + return rv; +} + +/* DOMString getAttribute (in DOMString name); */ +NS_IMETHODIMP bcElement::GetAttribute(DOMString name, DOMString *_retval) +{ + nsString ret, _name(name); + nsresult rv = domPtr->GetAttribute(_name, ret); + *_retval = ret.ToNewUnicode(); + return rv; +} + +/* void setAttribute (in DOMString name, in DOMString value) raises (DOMException); */ +NS_IMETHODIMP bcElement::SetAttribute(DOMString name, DOMString value) +{ + nsString _name(name), _value(value); + nsresult rv = domPtr->SetAttribute(_name, _value); + printf("\n===== setting value (%s) to attr (%s)\n\n", + _value.ToNewCString(), + _name.ToNewCString()); + return rv; +} + +/* void removeAttribute (in DOMString name) raises (DOMException); */ +NS_IMETHODIMP bcElement::RemoveAttribute(DOMString name) +{ + nsString _name(name); + return domPtr->RemoveAttribute(_name); +} + +/* Attr getAttributeNode (in DOMString name); */ +NS_IMETHODIMP bcElement::GetAttributeNode(DOMString name, Attr **_retval) +{ + nsString _name(name); + nsIDOMAttr* ret = nsnull; + nsresult rv = domPtr->GetAttributeNode(_name, &ret); + *_retval = NEW_BCATTR(ret); + return rv; +} + +/* Attr setAttributeNode (in Attr newAttr) raises (DOMException); */ +NS_IMETHODIMP bcElement::SetAttributeNode(Attr *newAttr, Attr **_retval) +{ + nsIDOMAttr* ret = nsnull; + nsresult rv = domPtr->SetAttributeNode(DOM_ATTR_PTR(newAttr), &ret); + *_retval = NEW_BCATTR(ret); + return rv; +} + +/* Attr removeAttributeNode (in Attr oldAttr) raises (DOMException); */ +NS_IMETHODIMP bcElement::RemoveAttributeNode(Attr *oldAttr, Attr **_retval) +{ + nsIDOMAttr* ret = nsnull; + nsresult rv = domPtr->RemoveAttributeNode(DOM_ATTR_PTR(oldAttr), &ret); + *_retval = NEW_BCATTR(ret); + return rv; +} + +/* NodeList getElementsByTagName (in DOMString name); */ +NS_IMETHODIMP bcElement::GetElementsByTagName(DOMString name, NodeList **_retval) +{ + nsIDOMNodeList* ret = nsnull; + nsString _name(name); + nsresult rv = domPtr->GetElementsByTagName(_name, &ret); + *_retval = NEW_BCNODELIST(ret); + return rv; +} + +/* DOMString getAttributeNS (in DOMString namespaceURI, in DOMString localName); */ +NS_IMETHODIMP bcElement::GetAttributeNS(DOMString namespaceURI, DOMString localName, DOMString *_retval) +{ + nsString _namespaceURI(namespaceURI), _localName(localName), ret; + nsresult rv = domPtr->GetAttributeNS(_namespaceURI, _localName, ret); + *_retval = ret.ToNewUnicode(); + return rv; +} + +/* void setAttributeNS (in DOMString namespaceURI, in DOMString qualifiedName, in DOMString value) raises (DOMException); */ +NS_IMETHODIMP bcElement::SetAttributeNS(DOMString namespaceURI, DOMString qualifiedName, DOMString value) +{ + nsString _namespaceURI(namespaceURI), _qualifiedName(qualifiedName), _value(value); + return domPtr->SetAttributeNS(_namespaceURI, _qualifiedName, _value); +} + +/* void removeAttributeNS (in DOMString namespaceURI, in DOMString localName) raises (DOMException); */ +NS_IMETHODIMP bcElement::RemoveAttributeNS(DOMString namespaceURI, DOMString localName) +{ + nsString _namespaceURI(namespaceURI), _localName(localName); + return domPtr->RemoveAttributeNS(_namespaceURI, _localName); +} + +/* Attr getAttributeNodeNS (in DOMString namespaceURI, in DOMString localName); */ +NS_IMETHODIMP bcElement::GetAttributeNodeNS(DOMString namespaceURI, DOMString localName, Attr **_retval) +{ + nsString _namespaceURI(namespaceURI), _localName(localName); + nsIDOMAttr* ret = nsnull; + nsresult rv = domPtr->GetAttributeNodeNS(_namespaceURI, _localName, &ret); + *_retval = NEW_BCATTR(ret); + return rv; +} + +/* Attr setAttributeNodeNS (in Attr newAttr) raises (DOMException); */ +NS_IMETHODIMP bcElement::SetAttributeNodeNS(Attr *newAttr, Attr **_retval) +{ + nsIDOMAttr* ret = nsnull; + nsresult rv = domPtr->SetAttributeNodeNS(DOM_ATTR_PTR(newAttr), &ret); + *_retval = NEW_BCATTR(ret); + return rv; +} + +/* NodeList getElementsByTagNameNS (in DOMString namespaceURI, in DOMString localName); */ +NS_IMETHODIMP bcElement::GetElementsByTagNameNS(DOMString namespaceURI, DOMString localName, NodeList **_retval) +{ + nsIDOMNodeList* ret = nsnull; + nsString _namespaceURI(namespaceURI), _localName(localName); + nsresult rv = domPtr->GetElementsByTagNameNS(_namespaceURI, _localName, &ret); + *_retval = NEW_BCNODELIST(ret); + return rv; +} + +/* boolean hasAttribute (in DOMString name); */ +NS_IMETHODIMP bcElement::HasAttribute(DOMString name, PRBool *_retval) +{ + nsString _name(name); + return domPtr->HasAttribute(_name, _retval); +} + +/* boolean hasAttributeNS (in DOMString namespaceURI, in DOMString localName); */ +NS_IMETHODIMP bcElement::HasAttributeNS(DOMString namespaceURI, DOMString localName, PRBool *_retval) +{ + nsString _namespaceURI(namespaceURI), _localName(localName); + return domPtr->HasAttributeNS(_namespaceURI, _localName, _retval); +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcElement.h b/mozilla/java/dom/blackconnect/dom/stubs/bcElement.h new file mode 100644 index 00000000000..2492027c202 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcElement.h @@ -0,0 +1,26 @@ +#ifndef __bcElement_h__ +#define __bcElement_h__ + +#include "dom.h" +#include "bcNode.h" +#include "nsIDOMElement.h" + +#define DOM_ELEMENT_PTR(_element_) (!_element_ ? nsnull : ((bcElement*)_element_)->domPtr) +#define NEW_BCELEMENT(_element_) (!_element_ ? nsnull : new bcElement(_element_)) + +class bcElement : public Element +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_ELEMENT + NS_FORWARD_NODE(nodePtr->) + + bcElement(nsIDOMElement* domPtr); + virtual ~bcElement(); +private: + nsIDOMElement* domPtr; + bcNode* nodePtr; + /* additional members */ +}; + +#endif // __bcElement_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcEntity.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcEntity.cpp new file mode 100644 index 00000000000..51bf0c3dd1a --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcEntity.cpp @@ -0,0 +1,47 @@ +#include "bcEntity.h" + +NS_IMPL_ISUPPORTS1(bcEntity, Entity) + +bcEntity::bcEntity(nsIDOMEntity* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + nodePtr = new bcNode(ptr); +} + +bcEntity::~bcEntity() +{ + /* destructor code */ +} + +/* readonly attribute DOMString publicId; */ +NS_IMETHODIMP bcEntity::GetPublicId(DOMString *aPublicId) +{ + nsString ret; + nsresult rv = domPtr->GetPublicId(ret); + *aPublicId = ret.ToNewUnicode(); + return rv; +} + + +/* readonly attribute DOMString systemId; */ +NS_IMETHODIMP bcEntity::GetSystemId(DOMString *aSystemId) +{ + nsString ret; + nsresult rv = domPtr->GetSystemId(ret); + *aSystemId = ret.ToNewUnicode(); + return rv; +} + + +/* readonly attribute DOMString notationName; */ +NS_IMETHODIMP bcEntity::GetNotationName(DOMString *aNotationName) +{ + nsString ret; + nsresult rv = domPtr->GetNotationName(ret); + *aNotationName = ret.ToNewUnicode(); + return rv; +} + + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcEntity.h b/mozilla/java/dom/blackconnect/dom/stubs/bcEntity.h new file mode 100644 index 00000000000..841cc40262e --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcEntity.h @@ -0,0 +1,26 @@ +#ifndef __bcEntity_h__ +#define __bcEntity_h__ + +#include "dom.h" +#include "bcNode.h" +#include "nsIDOMEntity.h" + +#define DOM_ENTITY_PTR(_entity_) (!_entity_ ? nsnull : ((bcEntity*)_entity_)->domPtr) +#define NEW_BCENTITY(_entity_) (!_entity_ ? nsnull : new bcEntity(_entity_)) + +class bcEntity : public Entity +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_ENTITY + NS_FORWARD_NODE(nodePtr->) + + bcEntity(nsIDOMEntity* domPtr); + virtual ~bcEntity(); +private: + nsIDOMEntity* domPtr; + bcNode* nodePtr; + /* additional members */ +}; + +#endif // __bcEntity_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcEntityReference.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcEntityReference.cpp new file mode 100644 index 00000000000..ed316322161 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcEntityReference.cpp @@ -0,0 +1,17 @@ +#include "bcEntityReference.h" + +NS_IMPL_ISUPPORTS1(bcEntityReference, EntityReference) + +bcEntityReference::bcEntityReference(nsIDOMEntityReference* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + nodePtr = new bcNode(ptr); +} + +bcEntityReference::~bcEntityReference() +{ + /* destructor code */ +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcEntityReference.h b/mozilla/java/dom/blackconnect/dom/stubs/bcEntityReference.h new file mode 100644 index 00000000000..7e50a83b03a --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcEntityReference.h @@ -0,0 +1,26 @@ +#ifndef __bcEntityReference_h__ +#define __bcEntityReference_h__ + +#include "dom.h" +#include "bcNode.h" +#include "nsIDOMEntityReference.h" + +#define DOM_ENTITYREFERENCE_PTR(_entityreference_) (!_entityreference_ ? nsnull : ((bcEntityReference*)_entityreference_)->domPtr) +#define NEW_BCENTITYREFERENCE(_entityreference_) (!_entityreference_ ? nsnull : new bcEntityReference(_entityreference_)) + +class bcEntityReference : public EntityReference +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_ENTITYREFERENCE + NS_FORWARD_NODE(nodePtr->) + + bcEntityReference(nsIDOMEntityReference* domPtr); + virtual ~bcEntityReference(); +private: + nsIDOMEntityReference* domPtr; + bcNode* nodePtr; + /* additional members */ +}; + +#endif // __bcEntityReference_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcNamedNodeMap.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcNamedNodeMap.cpp new file mode 100644 index 00000000000..2f709f7c0a2 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcNamedNodeMap.cpp @@ -0,0 +1,91 @@ +#include "bcNamedNodeMap.h" +#include "bcNode.h" + +NS_IMPL_ISUPPORTS1(bcNamedNodeMap, NamedNodeMap) + +bcNamedNodeMap::bcNamedNodeMap(nsIDOMNamedNodeMap* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; +} + +bcNamedNodeMap::~bcNamedNodeMap() +{ + /* destructor code */ +} + +/* Node getNamedItem (in DOMString name); */ +NS_IMETHODIMP bcNamedNodeMap::GetNamedItem(DOMString name, Node **_retval) +{ + nsString _name(name); + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->GetNamedItem(_name, &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* Node setNamedItem (in Node arg) raises (DOMException); */ +NS_IMETHODIMP bcNamedNodeMap::SetNamedItem(Node *arg, Node **_retval) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->SetNamedItem(DOM_NODE_PTR(arg), &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* Node removeNamedItem (in DOMString name) raises (DOMException); */ +NS_IMETHODIMP bcNamedNodeMap::RemoveNamedItem(DOMString name, Node **_retval) +{ + nsString _name(name); + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->RemoveNamedItem(_name, &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* Node item (in unsigned long index); */ +NS_IMETHODIMP bcNamedNodeMap::Item(PRUint32 index, Node **_retval) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->Item(index, &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* readonly attribute unsigned long length; */ +NS_IMETHODIMP bcNamedNodeMap::GetLength(PRUint32 *aLength) +{ + return domPtr->GetLength(aLength); +} + + +/* Node getNamedItemNS (in DOMString namespaceURI, in DOMString localName); */ +NS_IMETHODIMP bcNamedNodeMap::GetNamedItemNS(DOMString namespaceURI, DOMString localName, Node **_retval) +{ + nsString _namespaceURI(namespaceURI), _localName(localName); + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->GetNamedItemNS(_namespaceURI, _localName, &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* Node setNamedItemNS (in Node arg) raises (DOMException); */ +NS_IMETHODIMP bcNamedNodeMap::SetNamedItemNS(Node *arg, Node **_retval) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->SetNamedItemNS(DOM_NODE_PTR(arg), &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* Node removeNamedItemNS (in DOMString namespaceURI, in DOMString localName) raises (DOMException); */ +NS_IMETHODIMP bcNamedNodeMap::RemoveNamedItemNS(DOMString namespaceURI, DOMString localName, Node **_retval) +{ + nsString _namespaceURI(namespaceURI), _localName(localName); + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->RemoveNamedItemNS(_namespaceURI, _localName, &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcNamedNodeMap.h b/mozilla/java/dom/blackconnect/dom/stubs/bcNamedNodeMap.h new file mode 100644 index 00000000000..09e44d7218b --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcNamedNodeMap.h @@ -0,0 +1,23 @@ +#ifndef __bcNamedNodeMap_h__ +#define __bcNamedNodeMap_h__ + +#include "dom.h" +#include "nsIDOMNamedNodeMap.h" + +#define DOM_NAMEDNODEMAP_PTR(_namednodemap_) (!_namednodemap_ ? nsnull : ((bcNamedNodeMap*)_namednodemap_)->domPtr) +#define NEW_BCNAMEDNODEMAP(_namednodemap_) (!_namednodemap_ ? nsnull : new bcNamedNodeMap(_namednodemap_)) + +class bcNamedNodeMap : public NamedNodeMap +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NAMEDNODEMAP + + bcNamedNodeMap(nsIDOMNamedNodeMap* domPtr); + virtual ~bcNamedNodeMap(); +private: + nsIDOMNamedNodeMap* domPtr; + /* additional members */ +}; + +#endif // __bcNamedNodeMap_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcNode.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcNode.cpp new file mode 100644 index 00000000000..6dd87c5e332 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcNode.cpp @@ -0,0 +1,224 @@ +#include "bcNode.h" +#include "bcNodeList.h" +#include "bcNamedNodeMap.h" +#include "bcDocument.h" +// #include "nsDOMError.h" +// #include "nsIDOMEventTarget.h" + +/* Implementation file */ +NS_IMPL_ISUPPORTS1(bcNode, Node) + +bcNode::bcNode(nsIDOMNode* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; +} + +bcNode::~bcNode() +{ + /* destructor code */ +} + +/* readonly attribute DOMString nodeName; */ +NS_IMETHODIMP bcNode::GetNodeName(DOMString *aNodeName) +{ + nsString ret; + nsresult rv = domPtr->GetNodeName(ret); + *aNodeName = ret.ToNewUnicode(); + return rv; +} + +/* attribute DOMString nodeValue; */ +NS_IMETHODIMP bcNode::GetNodeValue(DOMString *aNodeValue) +{ + nsString ret; + nsresult rv = domPtr->GetNodeValue(ret); + *aNodeValue = ret.ToNewUnicode(); + return rv; +} +NS_IMETHODIMP bcNode::SetNodeValue(DOMString aNodeValue) +{ + nsString val(aNodeValue); + nsresult rv = domPtr->SetNodeValue(val); + return rv; +} + +/* readonly attribute unsigned short nodeType; */ +NS_IMETHODIMP bcNode::GetNodeType(PRUint16 *aNodeType) +{ + PRUint16 type = 0; + nsresult rv = domPtr->GetNodeType(&type); + *aNodeType = type; + return rv; +} + +/* readonly attribute Node parentNode; */ +NS_IMETHODIMP bcNode::GetParentNode(Node * *aParentNode) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->GetParentNode(&ret); + *aParentNode = NEW_BCNODE(ret); + return rv; +} + +/* readonly attribute NodeList childNodes; */ +NS_IMETHODIMP bcNode::GetChildNodes(NodeList * *aChildNodes) +{ + nsIDOMNodeList* ret = nsnull; + nsresult rv = domPtr->GetChildNodes(&ret); + *aChildNodes = NEW_BCNODELIST(ret); + return rv; +} + +/* readonly attribute Node firstChild; */ +NS_IMETHODIMP bcNode::GetFirstChild(Node * *aFirstChild) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->GetFirstChild(&ret); + *aFirstChild = NEW_BCNODE(ret); + return rv; +} + +/* readonly attribute Node lastChild; */ +NS_IMETHODIMP bcNode::GetLastChild(Node * *aLastChild) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->GetLastChild(&ret); + *aLastChild = NEW_BCNODE(ret); + return rv; +} + +/* readonly attribute Node previousSibling; */ +NS_IMETHODIMP bcNode::GetPreviousSibling(Node * *aPreviousSibling) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->GetPreviousSibling(&ret); + *aPreviousSibling = NEW_BCNODE(ret); + return rv; +} + +/* readonly attribute Node nextSibling; */ +NS_IMETHODIMP bcNode::GetNextSibling(Node * *aNextSibling) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->GetNextSibling(&ret); + *aNextSibling = NEW_BCNODE(ret); + return rv; +} + +/* readonly attribute NamedNodeMap attributes; */ +NS_IMETHODIMP bcNode::GetAttributes(NamedNodeMap * *aAttributes) +{ + nsIDOMNamedNodeMap* ret = nsnull; + nsresult rv = domPtr->GetAttributes(&ret); + *aAttributes = NEW_BCNAMEDNODEMAP(ret); + return rv; +} + +/* readonly attribute Document ownerDocument; */ +NS_IMETHODIMP bcNode::GetOwnerDocument(Document * *aOwnerDocument) +{ + nsIDOMDocument* ret; + nsresult rv = domPtr->GetOwnerDocument(&ret); + *aOwnerDocument = NEW_BCDOCUMENT(ret); + return rv; +} + +/* Node insertBefore (in Node newChild, in Node refChild) raises (DOMException); */ +NS_IMETHODIMP bcNode::InsertBefore(Node *newChild, Node *refChild, Node **_retval) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->InsertBefore(DOM_NODE_PTR(newChild), DOM_NODE_PTR(refChild), &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* Node replaceChild (in Node newChild, in Node oldChild) raises (DOMException); */ +NS_IMETHODIMP bcNode::ReplaceChild(Node *newChild, Node *oldChild, Node **_retval) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->ReplaceChild(DOM_NODE_PTR(newChild), DOM_NODE_PTR(oldChild), &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* Node removeChild (in Node oldChild) raises (DOMException); */ +NS_IMETHODIMP bcNode::RemoveChild(Node *oldChild, Node **_retval) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->RemoveChild(DOM_NODE_PTR(oldChild), &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* Node appendChild (in Node newChild) raises (DOMException); */ +NS_IMETHODIMP bcNode::AppendChild(Node *newChild, Node **_retval) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->AppendChild(DOM_NODE_PTR(newChild), &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* boolean hasChildNodes (); */ +NS_IMETHODIMP bcNode::HasChildNodes(PRBool *_retval) +{ + return domPtr->HasChildNodes(_retval); +} + +/* Node cloneNode (in boolean deep); */ +NS_IMETHODIMP bcNode::CloneNode(PRBool deep, Node **_retval) +{ + nsIDOMNode* ret = nsnull; + nsresult rv = domPtr->CloneNode(deep, &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* void normalize (); */ +NS_IMETHODIMP bcNode::Normalize() +{ + return domPtr->Normalize(); +} + +/* boolean supports (in DOMString feature, in DOMString version); */ +NS_IMETHODIMP bcNode::Supports(DOMString feature, DOMString version, PRBool *_retval) +{ + nsString _feature(feature), _version(version); + return domPtr->IsSupported(_feature, _version, _retval); +} + +/* readonly attribute DOMString namespaceURI; */ +NS_IMETHODIMP bcNode::GetNamespaceURI(DOMString *aNamespaceURI) +{ + nsString ret; + nsresult rv = domPtr->GetNamespaceURI(ret); + *aNamespaceURI = ret.ToNewUnicode(); + return rv; +} + +/* attribute DOMString prefix; */ +NS_IMETHODIMP bcNode::GetPrefix(DOMString *aPrefix) +{ + nsString ret; + nsresult rv = domPtr->GetPrefix(ret); + *aPrefix = ret.ToNewUnicode(); + return rv; +} +NS_IMETHODIMP bcNode::SetPrefix(DOMString aPrefix) +{ + nsString val(aPrefix); + nsresult rv = domPtr->SetPrefix(val); + return rv; +} + +/* readonly attribute DOMString localName; */ +NS_IMETHODIMP bcNode::GetLocalName(DOMString *aLocalName) +{ + nsString ret; + nsresult rv = domPtr->GetPrefix(ret); + *aLocalName = ret.ToNewUnicode(); + return rv; +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcNode.h b/mozilla/java/dom/blackconnect/dom/stubs/bcNode.h new file mode 100644 index 00000000000..1b01ee710a4 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcNode.h @@ -0,0 +1,23 @@ +#ifndef __bcNode_h__ +#define __bcNode_h__ + +#include "dom.h" +#include "nsIDOMNode.h" + +#define DOM_NODE_PTR(_node_) (!_node_ ? nsnull : ((bcNode*)_node_)->domPtr) +#define NEW_BCNODE(_node_) (!_node_ ? nsnull : new bcNode(_node_)) + +class bcNode : public Node +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NODE + + bcNode(nsIDOMNode* domPtr); + virtual ~bcNode(); +/* private: */ + nsIDOMNode* domPtr; + /* additional members */ +}; + +#endif // __bcNode_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcNodeList.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcNodeList.cpp new file mode 100644 index 00000000000..b95f12bdff6 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcNodeList.cpp @@ -0,0 +1,32 @@ +#include "bcNodeList.h" +#include "bcNode.h" + +NS_IMPL_ISUPPORTS1(bcNodeList, NodeList) + +bcNodeList::bcNodeList(nsIDOMNodeList* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; +} + +bcNodeList::~bcNodeList() +{ + /* destructor code */ +} + +/* Node item (in unsigned long index); */ +NS_IMETHODIMP bcNodeList::Item(PRUint32 index, Node **_retval) +{ + nsIDOMNode* ret = NULL; + nsresult rv = domPtr->Item(index, &ret); + *_retval = NEW_BCNODE(ret); + return rv; +} + +/* readonly attribute unsigned long length; */ +NS_IMETHODIMP bcNodeList::GetLength(PRUint32 *aLength) +{ + return domPtr->GetLength(aLength); +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcNodeList.h b/mozilla/java/dom/blackconnect/dom/stubs/bcNodeList.h new file mode 100644 index 00000000000..ba1ef903fb6 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcNodeList.h @@ -0,0 +1,23 @@ +#ifndef __bcNodeList_h__ +#define __bcNodeList_h__ + +#include "dom.h" +#include "nsIDOMNodeList.h" + +#define DOM_NODELIST_PTR(_nodelist_) (!_nodelist_ ? nsnull : ((bcNodeList*)_nodelist_)->domPtr) +#define NEW_BCNODELIST(_nodelist_) (!_nodelist_ ? nsnull : new bcNodeList(_nodelist_)) + +class bcNodeList : public NodeList +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NODELIST + + bcNodeList(nsIDOMNodeList* domPtr); + virtual ~bcNodeList(); +private: + nsIDOMNodeList* domPtr; + /* additional members */ +}; + +#endif // __bcNodeList_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcNotation.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcNotation.cpp new file mode 100644 index 00000000000..56ba47e9f60 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcNotation.cpp @@ -0,0 +1,37 @@ +#include "bcNotation.h" + +NS_IMPL_ISUPPORTS1(bcNotation, Notation) + +bcNotation::bcNotation(nsIDOMNotation* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + nodePtr = new bcNode(ptr); +} + +bcNotation::~bcNotation() +{ + /* destructor code */ +} + +/* readonly attribute DOMString publicId; */ +NS_IMETHODIMP bcNotation::GetPublicId(DOMString *aPublicId) +{ + nsString ret; + nsresult rv = domPtr->GetPublicId(ret); + *aPublicId = ret.ToNewUnicode(); + return rv; +} + + +/* readonly attribute DOMString systemId; */ +NS_IMETHODIMP bcNotation::GetSystemId(DOMString *aSystemId) +{ + nsString ret; + nsresult rv = domPtr->GetSystemId(ret); + *aSystemId = ret.ToNewUnicode(); + return rv; +} + + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcNotation.h b/mozilla/java/dom/blackconnect/dom/stubs/bcNotation.h new file mode 100644 index 00000000000..8ec307a9c03 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcNotation.h @@ -0,0 +1,26 @@ +#ifndef __bcNotation_h__ +#define __bcNotation_h__ + +#include "dom.h" +#include "bcNode.h" +#include "nsIDOMNotation.h" + +#define DOM_NOTATION_PTR(_notation_) (!_notation_ ? nsnull : ((bcNotation*)_notation_)->domPtr) +#define NEW_BCNOTATION(_notation_) (!_notation_ ? nsnull : new bcNotation(_notation_)) + +class bcNotation : public Notation +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NOTATION + NS_FORWARD_NODE(nodePtr->) + + bcNotation(nsIDOMNotation* domPtr); + virtual ~bcNotation(); +private: + nsIDOMNotation* domPtr; + bcNode* nodePtr; + /* additional members */ +}; + +#endif // __bcNotation_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcProcessingInstruction.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcProcessingInstruction.cpp new file mode 100644 index 00000000000..b1e1e1c7c04 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcProcessingInstruction.cpp @@ -0,0 +1,43 @@ +#include "bcProcessingInstruction.h" + +NS_IMPL_ISUPPORTS1(bcProcessingInstruction, ProcessingInstruction) + +bcProcessingInstruction::bcProcessingInstruction(nsIDOMProcessingInstruction* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + nodePtr = new bcNode(ptr); +} + +bcProcessingInstruction::~bcProcessingInstruction() +{ + /* destructor code */ +} + +/* readonly attribute DOMString target; */ +NS_IMETHODIMP bcProcessingInstruction::GetTarget(DOMString *aTarget) +{ + nsString ret; + nsresult rv = domPtr->GetTarget(ret); + *aTarget = ret.ToNewUnicode(); + return rv; +} + + +/* attribute DOMString data; */ +NS_IMETHODIMP bcProcessingInstruction::GetData(DOMString *aData) +{ + nsString ret; + nsresult rv = domPtr->GetData(ret); + *aData = ret.ToNewUnicode(); + return rv; +} + +NS_IMETHODIMP bcProcessingInstruction::SetData(DOMString aData) +{ + nsString _aData(aData); + return domPtr->SetData(_aData); +} + + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcProcessingInstruction.h b/mozilla/java/dom/blackconnect/dom/stubs/bcProcessingInstruction.h new file mode 100644 index 00000000000..a8ef732d7f2 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcProcessingInstruction.h @@ -0,0 +1,26 @@ +#ifndef __bcProcessingInstruction_h__ +#define __bcProcessingInstruction_h__ + +#include "dom.h" +#include "bcNode.h" +#include "nsIDOMProcessingInstruction.h" + +#define DOM_PROCESSINGINSTRUCTION_PTR(_processinginstruction_) (!_processinginstruction_ ? nsnull : ((bcProcessingInstruction*)_processinginstruction_)->domPtr) +#define NEW_BCPROCESSINGINSTRUCTION(_processinginstruction_) (!_processinginstruction_ ? nsnull : new bcProcessingInstruction(_processinginstruction_)) + +class bcProcessingInstruction : public ProcessingInstruction +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_PROCESSINGINSTRUCTION + NS_FORWARD_NODE(nodePtr->) + + bcProcessingInstruction(nsIDOMProcessingInstruction* domPtr); + virtual ~bcProcessingInstruction(); +private: + nsIDOMProcessingInstruction* domPtr; + bcNode* nodePtr; + /* additional members */ +}; + +#endif // __bcProcessingInstruction_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcText.cpp b/mozilla/java/dom/blackconnect/dom/stubs/bcText.cpp new file mode 100644 index 00000000000..c1f7385419a --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcText.cpp @@ -0,0 +1,26 @@ +#include "bcText.h" + +NS_IMPL_ISUPPORTS1(bcText, Text) + +bcText::bcText(nsIDOMText* ptr) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + domPtr = ptr; + dataPtr = new bcCharacterData(ptr); +} + +bcText::~bcText() +{ + /* destructor code */ +} + +/* Text splitText (in unsigned long offset) raises (DOMException); */ +NS_IMETHODIMP bcText::SplitText(PRUint32 offset, Text **_retval) +{ + nsIDOMText* ret = nsnull; + nsresult rv = domPtr->SplitText(offset, &ret); + *_retval = NEW_BCTEXT(ret); + return rv; +} + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/bcText.h b/mozilla/java/dom/blackconnect/dom/stubs/bcText.h new file mode 100644 index 00000000000..14628ee28e3 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/bcText.h @@ -0,0 +1,27 @@ +#ifndef __bcText_h__ +#define __bcText_h__ + +#include "dom.h" +#include "nsIDOMText.h" +#include "bcCharacterData.h" + +#define DOM_TEXT_PTR(_text_) (!_text_ ? nsnull : ((bcText*)_text_)->domPtr) +#define NEW_BCTEXT(_text_) (!_text_ ? nsnull : new bcText(_text_)) + +class bcText : public Text +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_TEXT + NS_FORWARD_NODE(dataPtr->) + NS_FORWARD_CHARACTERDATA(dataPtr->) + + bcText(nsIDOMText* domPtr); + virtual ~bcText(); +private: + nsIDOMText* domPtr; + bcCharacterData* dataPtr; + /* additional members */ +}; + +#endif // __bcText_h__ diff --git a/mozilla/java/dom/blackconnect/dom/stubs/dom.idl b/mozilla/java/dom/blackconnect/dom/stubs/dom.idl new file mode 100644 index 00000000000..f90308e1443 --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/dom.idl @@ -0,0 +1,314 @@ +#include "nsISupports.idl" + +#pragma prefix org.mozilla.dom + + +typedef wstring DOMString; + +interface DocumentType; +interface Document; +interface NodeList; +interface NamedNodeMap; +interface Element; + +exception DOMException { + unsigned short code; +}; + +// ExceptionCode +const unsigned short INDEX_SIZE_ERR = 1; +const unsigned short DOMSTRING_SIZE_ERR = 2; +const unsigned short HIERARCHY_REQUEST_ERR = 3; +const unsigned short WRONG_DOCUMENT_ERR = 4; +const unsigned short INVALID_CHARACTER_ERR = 5; +const unsigned short NO_DATA_ALLOWED_ERR = 6; +const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7; +const unsigned short NOT_FOUND_ERR = 8; +const unsigned short NOT_SUPPORTED_ERR = 9; +const unsigned short INUSE_ATTRIBUTE_ERR = 10; +// Introduced in DOM Level 2: +const unsigned short INVALID_STATE_ERR = 11; +// Introduced in DOM Level 2: +const unsigned short SYNTAX_ERR = 12; +// Introduced in DOM Level 2: +const unsigned short INVALID_MODIFICATION_ERR = 13; +// Introduced in DOM Level 2: +const unsigned short NAMESPACE_ERR = 14; +// Introduced in DOM Level 2: +const unsigned short INVALID_ACCESS_ERR = 15; + + +[scriptable, uuid(0776b330-9ad5-11d4-a983-00105ae3801e)] +interface DOMImplementation : nsISupports { + boolean hasFeature(in DOMString feature, + in DOMString version); + // Introduced in DOM Level 2: + DocumentType createDocumentType(in DOMString qualifiedName, + in DOMString publicId, + in DOMString systemId) + raises(DOMException); + // Introduced in DOM Level 2: + Document createDocument(in DOMString namespaceURI, + in DOMString qualifiedName, + in DocumentType doctype) + raises(DOMException); +}; + +[scriptable, uuid(082f98e0-9ad5-11d4-a983-00105ae3801e)] +interface Node : nsISupports { + // NodeType + const unsigned short ELEMENT_NODE = 1; + const unsigned short ATTRIBUTE_NODE = 2; + const unsigned short TEXT_NODE = 3; + const unsigned short CDATA_SECTION_NODE = 4; + const unsigned short ENTITY_REFERENCE_NODE = 5; + const unsigned short ENTITY_NODE = 6; + const unsigned short PROCESSING_INSTRUCTION_NODE = 7; + const unsigned short COMMENT_NODE = 8; + const unsigned short DOCUMENT_NODE = 9; + const unsigned short DOCUMENT_TYPE_NODE = 10; + const unsigned short DOCUMENT_FRAGMENT_NODE = 11; + const unsigned short NOTATION_NODE = 12; + + readonly attribute DOMString nodeName; + attribute DOMString nodeValue; + // raises(DOMException) on setting + // raises(DOMException) on retrieval + + readonly attribute unsigned short nodeType; + readonly attribute Node parentNode; + readonly attribute NodeList childNodes; + readonly attribute Node firstChild; + readonly attribute Node lastChild; + readonly attribute Node previousSibling; + readonly attribute Node nextSibling; + readonly attribute NamedNodeMap attributes; + // Modified in DOM Level 2: + readonly attribute Document ownerDocument; + Node insertBefore(in Node newChild, + in Node refChild) + raises(DOMException); + Node replaceChild(in Node newChild, + in Node oldChild) + raises(DOMException); + Node removeChild(in Node oldChild) + raises(DOMException); + Node appendChild(in Node newChild) + raises(DOMException); + boolean hasChildNodes(); + Node cloneNode(in boolean deep); + // Introduced in DOM Level 2: + void normalize(); + // Introduced in DOM Level 2: + boolean supports(in DOMString feature, + in DOMString version); + // Introduced in DOM Level 2: + readonly attribute DOMString namespaceURI; + // Introduced in DOM Level 2: + attribute DOMString prefix; + // raises(DOMException) on setting + + // Introduced in DOM Level 2: + readonly attribute DOMString localName; +}; + +[scriptable, uuid(0895fa70-9ad5-11d4-a983-00105ae3801e)] +interface NodeList : nsISupports { + Node item(in unsigned long index); + readonly attribute unsigned long length; +}; + +[scriptable, uuid(08f4b810-9ad5-11d4-a983-00105ae3801e)] +interface NamedNodeMap : nsISupports { + Node getNamedItem(in DOMString name); + Node setNamedItem(in Node arg) + raises(DOMException); + Node removeNamedItem(in DOMString name) + raises(DOMException); + Node item(in unsigned long index); + readonly attribute unsigned long length; + // Introduced in DOM Level 2: + Node getNamedItemNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + Node setNamedItemNS(in Node arg) + raises(DOMException); + // Introduced in DOM Level 2: + Node removeNamedItemNS(in DOMString namespaceURI, + in DOMString localName) + raises(DOMException); +}; + +[scriptable, uuid(0965cbf0-9ad5-11d4-a983-00105ae3801e)] +interface CharacterData : Node { + attribute DOMString data; + // raises(DOMException) on setting + // raises(DOMException) on retrieval + + readonly attribute unsigned long length; + DOMString substringData(in unsigned long offset, + in unsigned long count) + raises(DOMException); + void appendData(in DOMString arg) + raises(DOMException); + void insertData(in unsigned long offset, + in DOMString arg) + raises(DOMException); + void deleteData(in unsigned long offset, + in unsigned long count) + raises(DOMException); + void replaceData(in unsigned long offset, + in unsigned long count, + in DOMString arg) + raises(DOMException); +}; + +[scriptable, uuid(09e31950-9ad5-11d4-a983-00105ae3801e)] +interface Attr : Node { + readonly attribute DOMString name; + readonly attribute boolean specified; + attribute DOMString value; + // raises(DOMException) on setting + + // Introduced in DOM Level 2: + readonly attribute Element ownerElement; +}; + +[scriptable, uuid(0a7d6f40-9ad5-11d4-a983-00105ae3801e)] +interface Element : Node { + readonly attribute DOMString tagName; + DOMString getAttribute(in DOMString name); + void setAttribute(in DOMString name, + in DOMString value) + raises(DOMException); + void removeAttribute(in DOMString name) + raises(DOMException); + Attr getAttributeNode(in DOMString name); + Attr setAttributeNode(in Attr newAttr) + raises(DOMException); + Attr removeAttributeNode(in Attr oldAttr) + raises(DOMException); + NodeList getElementsByTagName(in DOMString name); + // Introduced in DOM Level 2: + DOMString getAttributeNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + void setAttributeNS(in DOMString namespaceURI, + in DOMString qualifiedName, + in DOMString value) + raises(DOMException); + // Introduced in DOM Level 2: + void removeAttributeNS(in DOMString namespaceURI, + in DOMString localName) + raises(DOMException); + // Introduced in DOM Level 2: + Attr getAttributeNodeNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + Attr setAttributeNodeNS(in Attr newAttr) + raises(DOMException); + // Introduced in DOM Level 2: + NodeList getElementsByTagNameNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + boolean hasAttribute(in DOMString name); + // Introduced in DOM Level 2: + boolean hasAttributeNS(in DOMString namespaceURI, + in DOMString localName); +}; + +[scriptable, uuid(0eefd9f0-9ad5-11d4-a983-00105ae3801e)] +interface Text : CharacterData { + Text splitText(in unsigned long offset) + raises(DOMException); +}; + +[scriptable, uuid(0ae9ed90-9ad5-11d4-a983-00105ae3801e)] +interface Comment : CharacterData { +}; + +[scriptable, uuid(0b813520-9ad5-11d4-a983-00105ae3801e)] +interface CDATASection : Text { +}; + +[scriptable, uuid(0c07ada0-9ad5-11d4-a983-00105ae3801e)] +interface DocumentType : Node { + readonly attribute DOMString name; + readonly attribute NamedNodeMap entities; + readonly attribute NamedNodeMap notations; + // Introduced in DOM Level 2: + readonly attribute DOMString publicId; + // Introduced in DOM Level 2: + readonly attribute DOMString systemId; + // Introduced in DOM Level 2: + readonly attribute DOMString internalSubset; +}; + +[scriptable, uuid(0c7a48b0-9ad5-11d4-a983-00105ae3801e)] +interface Notation : Node { + readonly attribute DOMString publicId; + readonly attribute DOMString systemId; +}; + +[scriptable, uuid(0cf30080-9ad5-11d4-a983-00105ae3801e)] +interface Entity : Node { + readonly attribute DOMString publicId; + readonly attribute DOMString systemId; + readonly attribute DOMString notationName; +}; + +[scriptable, uuid(0d4eafc0-9ad5-11d4-a983-00105ae3801e)] +interface EntityReference : Node { +}; + +[scriptable, uuid(0db69880-9ad5-11d4-a983-00105ae3801e)] +interface ProcessingInstruction : Node { + readonly attribute DOMString target; + attribute DOMString data; + // raises(DOMException) on setting + +}; + +[scriptable, uuid(0e249e00-9ad5-11d4-a983-00105ae3801e)] +interface DocumentFragment : Node { +}; + +[scriptable, uuid(0e81d470-9ad5-11d4-a983-00105ae3801e)] +interface Document : Node { + readonly attribute DocumentType doctype; + readonly attribute DOMImplementation implementation; + readonly attribute Element documentElement; + Element createElement(in DOMString tagName) + raises(DOMException); + DocumentFragment createDocumentFragment(); + Text createTextNode(in DOMString data); + Comment createComment(in DOMString data); + CDATASection createCDATASection(in DOMString data) + raises(DOMException); + ProcessingInstruction createProcessingInstruction(in DOMString target, + in DOMString data) + raises(DOMException); + Attr createAttribute(in DOMString name) + raises(DOMException); + EntityReference createEntityReference(in DOMString name) + raises(DOMException); + NodeList getElementsByTagName(in DOMString tagname); + // Introduced in DOM Level 2: + Node importNode(in Node importedNode, + in boolean deep) + raises(DOMException); + // Introduced in DOM Level 2: + Element createElementNS(in DOMString namespaceURI, + in DOMString qualifiedName) + raises(DOMException); + // Introduced in DOM Level 2: + Attr createAttributeNS(in DOMString namespaceURI, + in DOMString qualifiedName) + raises(DOMException); + // Introduced in DOM Level 2: + NodeList getElementsByTagNameNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + Element getElementById(in DOMString elementId); +}; + diff --git a/mozilla/java/dom/blackconnect/dom/stubs/makefile.win b/mozilla/java/dom/blackconnect/dom/stubs/makefile.win new file mode 100644 index 00000000000..93c91af9a0e --- /dev/null +++ b/mozilla/java/dom/blackconnect/dom/stubs/makefile.win @@ -0,0 +1,91 @@ +#!gmake +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (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.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1999 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# Denis Sharypov +# + + +DEPTH = ..\..\..\..\.. +topsrcdir = ..\..\..\..\.. +srcdir = . +VPATH = . + +MAKE_OBJ_TYPE=DLL +MODULE=javadomstubs +COMPONENT=1 +DLLNAME=$(MODULE) +DLL=.\$(OBJDIR)\$(DLLNAME).dll +LIBRARY_NAME=javadomstubs + +XPIDLSRCS = \ + .\dom.idl \ + $(NULL) + +OBJS = \ + .\$(OBJDIR)\bcNode.obj \ + .\$(OBJDIR)\bcElement.obj \ + .\$(OBJDIR)\bcAttr.obj \ + .\$(OBJDIR)\bcNodeList.obj \ + .\$(OBJDIR)\bcNamedNodeMap.obj \ + .\$(OBJDIR)\bcDocument.obj \ + .\$(OBJDIR)\bcCharacterData.obj \ + .\$(OBJDIR)\bcText.obj \ + .\$(OBJDIR)\bcComment.obj \ + .\$(OBJDIR)\bcCDATASection.obj \ + .\$(OBJDIR)\bcDocumentFragment.obj \ + .\$(OBJDIR)\bcEntityReference.obj \ + .\$(OBJDIR)\bcEntity.obj \ + .\$(OBJDIR)\bcNotation.obj \ + .\$(OBJDIR)\bcDocumentType.obj \ + .\$(OBJDIR)\bcProcessingInstruction.obj \ + .\$(OBJDIR)\bcDOMImplementation.obj \ + $(NULL) + +EXPORTS = \ + bcNode.h \ + bcElement.h \ + bcAttr.h \ + bcNodeList.h \ + bcNamedNodeMap.h \ + bcDocument.h \ + bcCharacterData.h \ + bcText.h \ + bcComment.h \ + bcCDATASection.h \ + bcDocumentFragment.h \ + bcEntityReference.h \ + bcEntity.h \ + bcNotation.h \ + bcDocumentType.h \ + bcProcessingInstruction.h \ + bcDOMImplementation.h \ + $(NULL) + +LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib + +include <$(DEPTH)\config\rules.mak> + +install:: $(DLL) + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib + +clobber:: + rm -f $(DIST)\bin\$(DLLNAME).dll + rm -f $(DIST)\lib\$(DLLNAME).lib