+2001-07-10 Anthony Green <green@redhat.com>
+
+ * Makefile.in: Rebuilt.
+ * Makefile.am: Add new files.
+ * org/w3c/dom/Attr.java, org/w3c/dom/CDATASection.java,
+ org/w3c/dom/CharacterData.java, org/w3c/dom/Comment.java,
+ org/w3c/dom/DOMException.java, org/w3c/dom/DOMImplementation.java,
+ org/w3c/dom/Document.java, org/w3c/dom/DocumentFragment.java,
+ org/w3c/dom/DocumentType.java, org/w3c/dom/Element.java,
+ org/w3c/dom/Entity.java, org/w3c/dom/EntityReference.java,
+ org/w3c/dom/NamedNodeMap.java, org/w3c/dom/Node.java,
+ org/w3c/dom/NodeList.java, org/w3c/dom/Notation.java,
+ org/w3c/dom/ProcessingInstruction.java, org/w3c/dom/Text.java,
+ org/w3c/dom/ranges/DocumentRange.java,
+ org/w3c/dom/ranges/Range.java,
+ org/w3c/dom/ranges/RangeException.java,
+ org/w3c/dom/traversal/DocumentTraversal.java,
+ org/w3c/dom/traversal/NodeFilter.java,
+ org/w3c/dom/traversal/NodeIterator.java,
+ org/w3c/dom/traversal/TreeWalker.java,
+ org/xml/sax/ext/DeclHandler.java,
+ org/xml/sax/ext/LexicalHandler.java,
+ org/xml/sax/helpers/AttributeListImpl.java,
+ org/xml/sax/helpers/AttributesImpl.java,
+ org/xml/sax/helpers/DefaultHandler.java,
+ org/xml/sax/helpers/LocatorImpl.java,
+ org/xml/sax/helpers/NamespaceSupport.java,
+ org/xml/sax/helpers/ParserAdapter.java,
+ org/xml/sax/helpers/ParserFactory.java,
+ org/xml/sax/helpers/XMLFilterImpl.java,
+ org/xml/sax/helpers/XMLReaderAdapter.java,
+ org/xml/sax/helpers/XMLReaderFactory.java,
+ org/xml/sax/AttributeList.java, org/xml/sax/Attributes.java,
+ org/xml/sax/ContentHandler.java, org/xml/sax/DTDHandler.java,
+ org/xml/sax/DocumentHandler.java, org/xml/sax/EntityResolver.java,
+ org/xml/sax/ErrorHandler.java, org/xml/sax/HandlerBase.java,
+ org/xml/sax/InputSource.java, org/xml/sax/Locator.java,
+ org/xml/sax/Parser.java, org/xml/sax/SAXException.java,
+ org/xml/sax/SAXNotRecognizedException.java,
+ org/xml/sax/SAXNotSupportedException.java,
+ org/xml/sax/SAXParseException.java, org/xml/sax/XMLFilter.java,
+ org/xml/sax/XMLReader.java: New files.
+
2001-07-10 Alexandre Petit-Bianco <apbianco@redhat.com>
* Makefile.am: Added `java/lang/ThreadLocal.java'.
test "$$fail" = no
-@rm -f tmp-list libgcj.jar
## Note that we explicitly want to include directory information.
- find java gnu -type d -o -type f -name '*.class' | \
+ find java gnu org -type d -o -type f -name '*.class' | \
sed -e '/\/\./d' -e '/\/xlib/d' | \
$(ZIP) cfM0E@ $@
java/util/Vector.java \
java/util/WeakHashMap.java
-
## List of all .java files to be compiled. Please keep this list
## alphabetical. Please put files from java/lang, java/io, and java/util
## into core_java_source_files. Please put files from gnu/gcj/convert
java/util/zip/ZipFile.java \
java/util/zip/ZipInputStream.java \
java/util/zip/ZipOutputStream.java \
+org/w3c/dom/Attr.java \
+org/w3c/dom/CDATASection.java \
+org/w3c/dom/CharacterData.java \
+org/w3c/dom/Comment.java \
+org/w3c/dom/DOMException.java \
+org/w3c/dom/DOMImplementation.java \
+org/w3c/dom/Document.java \
+org/w3c/dom/DocumentFragment.java \
+org/w3c/dom/DocumentType.java \
+org/w3c/dom/Element.java \
+org/w3c/dom/Entity.java \
+org/w3c/dom/EntityReference.java \
+org/w3c/dom/NamedNodeMap.java \
+org/w3c/dom/Node.java \
+org/w3c/dom/NodeList.java \
+org/w3c/dom/Notation.java \
+org/w3c/dom/ProcessingInstruction.java \
+org/w3c/dom/Text.java \
+org/w3c/dom/ranges/DocumentRange.java \
+org/w3c/dom/ranges/Range.java \
+org/w3c/dom/ranges/RangeException.java \
+org/w3c/dom/traversal/DocumentTraversal.java \
+org/w3c/dom/traversal/NodeFilter.java \
+org/w3c/dom/traversal/NodeIterator.java \
+org/w3c/dom/traversal/TreeWalker.java \
+org/xml/sax/ext/DeclHandler.java \
+org/xml/sax/ext/LexicalHandler.java \
+org/xml/sax/helpers/AttributeListImpl.java \
+org/xml/sax/helpers/AttributesImpl.java \
+org/xml/sax/helpers/DefaultHandler.java \
+org/xml/sax/helpers/LocatorImpl.java \
+org/xml/sax/helpers/NamespaceSupport.java \
+org/xml/sax/helpers/ParserAdapter.java \
+org/xml/sax/helpers/ParserFactory.java \
+org/xml/sax/helpers/XMLFilterImpl.java \
+org/xml/sax/helpers/XMLReaderAdapter.java \
+org/xml/sax/helpers/XMLReaderFactory.java \
+org/xml/sax/AttributeList.java \
+org/xml/sax/Attributes.java \
+org/xml/sax/ContentHandler.java \
+org/xml/sax/DTDHandler.java \
+org/xml/sax/DocumentHandler.java \
+org/xml/sax/EntityResolver.java \
+org/xml/sax/ErrorHandler.java \
+org/xml/sax/HandlerBase.java \
+org/xml/sax/InputSource.java \
+org/xml/sax/Locator.java \
+org/xml/sax/Parser.java \
+org/xml/sax/SAXException.java \
+org/xml/sax/SAXNotRecognizedException.java \
+org/xml/sax/SAXNotSupportedException.java \
+org/xml/sax/SAXParseException.java \
+org/xml/sax/XMLFilter.java \
+org/xml/sax/XMLReader.java \
$(awt_java_source_files) \
$(convert_source_files)
-# Makefile.in generated automatically by automake 1.4a from Makefile.am
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_FLAG =
transform = @program_transform_name@
NORMAL_INSTALL = :
mkinstalldirs = @mkinstalldirs@
AUTOMAKE_OPTIONS = foreign
-@TESTSUBDIR_TRUE@SUBDIRS = $(DIRLTDL) testsuite gcj include
-@TESTSUBDIR_FALSE@SUBDIRS = $(DIRLTDL) gcj include
-@USE_LIBDIR_TRUE@toolexeclibdir = $(libdir)$(MULTISUBDIR)
-@USE_LIBDIR_FALSE@toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
-@USE_LIBDIR_FALSE@toolexecdir = $(exec_prefix)/$(target_alias)
-@XLIB_AWT_TRUE@cond_x_ltlibrary = libgcjx.la
+@TESTSUBDIR_TRUE@SUBDIRS = @TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
+@TESTSUBDIR_FALSE@SUBDIRS = @TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
+@USE_LIBDIR_TRUE@toolexeclibdir = @USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexeclibdir = @USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexecdir = @USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
+@XLIB_AWT_TRUE@cond_x_ltlibrary = @XLIB_AWT_TRUE@libgcjx.la
@XLIB_AWT_FALSE@cond_x_ltlibrary =
toolexeclib_LTLIBRARIES = libgcj.la $(cond_x_ltlibrary)
toolexeclib_DATA = libgcj.spec
data_DATA = libgcj.jar
-@NATIVE_TRUE@bin_PROGRAMS = jv-convert gij
+@NATIVE_TRUE@bin_PROGRAMS = @NATIVE_TRUE@jv-convert gij
bin_SCRIPTS = addr2name.awk
-@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = $(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
-@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = jar
-@CANADIAN_FALSE@ZIP = $(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
-@CANADIAN_TRUE@GCJH = gcjh
-@CANADIAN_FALSE@GCJH = $(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
+@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
+@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_FALSE@jar
+@CANADIAN_FALSE@ZIP = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
+@CANADIAN_TRUE@GCJH = @CANADIAN_TRUE@gcjh
+@CANADIAN_FALSE@GCJH = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8
GCC_UNWIND_INCLUDE = @GCC_UNWIND_INCLUDE@
WARNINGS = -W -Wall
-AM_CXXFLAGS = -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers @LIBGCJ_CXXFLAGS@ @X_CFLAGS@ $(WARNINGS) -D_GNU_SOURCE -DPREFIX="\"$(prefix)\""
+AM_CXXFLAGS = -fno-rtti -fnon-call-exceptions \
+ -fdollars-in-identifiers \
+ @LIBGCJ_CXXFLAGS@ @X_CFLAGS@ $(WARNINGS) -D_GNU_SOURCE \
+ -DPREFIX="\"$(prefix)\""
-@USING_GCC_TRUE@AM_CFLAGS = @LIBGCJ_CFLAGS@ $(WARNINGS)
-@USING_GCC_FALSE@AM_CFLAGS = @LIBGCJ_CFLAGS@
+@USING_GCC_TRUE@AM_CFLAGS = @USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
+@USING_GCC_FALSE@AM_CFLAGS = @USING_GCC_FALSE@@LIBGCJ_CFLAGS@
JCFLAGS = -g
JC1FLAGS = @LIBGCJ_JAVAFLAGS@ $(GCJFLAGS)
LIBFFIINCS = @LIBFFIINCS@
-INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include $(GCINCS) $(THREADINCS) $(INCLTDL) $(GCC_UNWIND_INCLUDE) $(ZINCS) $(LIBFFIINCS)
+INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \
+ $(GCINCS) $(THREADINCS) $(INCLTDL) \
+ $(GCC_UNWIND_INCLUDE) $(ZINCS) $(LIBFFIINCS)
nat_files = $(nat_source_files:.cc=.lo)
x_nat_files = $(x_nat_source_files:.cc=.lo)
c_files = $(c_source_files:.c=.lo)
-javao_files = $(java_source_files:.java=.lo) $(built_java_source_files:.java=.lo)
+javao_files = $(java_source_files:.java=.lo) \
+ $(built_java_source_files:.java=.lo)
x_javao_files = $(x_java_source_files:.java=.lo)
-libgcj_la_SOURCES = prims.cc posix.cc jni.cc exception.cc resolve.cc defineclass.cc interpret.cc name-finder.cc $(nat_source_files)
+libgcj_la_SOURCES = prims.cc posix.cc jni.cc exception.cc \
+ resolve.cc defineclass.cc interpret.cc name-finder.cc \
+ $(nat_source_files)
-EXTRA_libgcj_la_SOURCES = boehm.cc nogc.cc posix-threads.cc no-threads.cc $(c_source_files) $(java_source_files) $(built_java_source_files)
+EXTRA_libgcj_la_SOURCES = boehm.cc nogc.cc posix-threads.cc no-threads.cc \
+ $(c_source_files) $(java_source_files) $(built_java_source_files)
-libgcj_la_DEPENDENCIES = libgcj.jar $(javao_files) $(c_files) $(GCOBJS) $(THREADOBJS) $(LIBLTDL)
+libgcj_la_DEPENDENCIES = libgcj.jar $(javao_files) \
+ $(c_files) $(GCOBJS) $(THREADOBJS) $(LIBLTDL)
-libgcj_la_LIBADD = $(javao_files) $(c_files) $(GCOBJS) $(THREADOBJS)
+libgcj_la_LIBADD = $(javao_files) $(c_files) $(GCOBJS) \
+ $(THREADOBJS)
# Include THREADLIBS here to ensure that the correct version of
# certain linuxthread functions get linked:
-libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLIBS) $(LIBLTDL) -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLIBS) $(LIBLTDL) \
+ -version-info `grep -v '^\#' $(srcdir)/libtool-version`
libgcj_la_LINK = $(LIBLINK)
EXTRA_libgcjx_la_SOURCES = $(x_java_source_files)
libgcjx_la_DEPENDENCIES = libgcj.jar $(x_javao_files)
libgcjx_la_LIBADD = $(x_javao_files)
-libgcjx_la_LDFLAGS = @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ -rpath $(toolexeclibdir) -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+libgcjx_la_LDFLAGS = @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
+ -rpath $(toolexeclibdir) \
+ -version-info `grep -v '^\#' $(srcdir)/libtool-version`
libgcjx_la_LINK = $(LIBLINK)
SUFFIXES = .class .java .h
-nat_headers = $(ordinary_java_source_files:.java=.h) $(built_java_source_files:.java=.h) java/io/ObjectOutputStream$$PutField.h java/io/ObjectInputStream$$GetField.h
+nat_headers = $(ordinary_java_source_files:.java=.h) \
+ $(built_java_source_files:.java=.h) \
+ java/io/ObjectOutputStream$$PutField.h \
+ java/io/ObjectInputStream$$GetField.h
x_nat_headers = $(x_java_source_files:.java=.h)
NM = nm
-@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = gen-from-JIS
+@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = @NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
CONVERT_DIR = gnu/gcj/convert
jv_convert_SOURCES =
EXTRA_jv_convert_SOURCES = $(convert_source_files)
-jv_convert_LDFLAGS = --main=gnu.gcj.convert.Convert -rpath $(toolexeclibdir) -shared-libgcc
+jv_convert_LDFLAGS = --main=gnu.gcj.convert.Convert \
+ -rpath $(toolexeclibdir) -shared-libgcc
jv_convert_LINK = $(GCJLINK)
-jv_convert_LDADD = $(convert_source_files:.java=.lo) libgcj.la $(GCLIBS) $(THREADLIBS) $(ZLIBS) -L$(here)/.libs
+jv_convert_LDADD = $(convert_source_files:.java=.lo) libgcj.la \
+ $(GCLIBS) $(THREADLIBS) $(ZLIBS) -L$(here)/.libs
-jv_convert_DEPENDENCIES = $(convert_source_files:.java=.lo) $(GCDEPS) $(THREADDEPS) $(ZDEPS) libgcj.la libgcj.spec
+jv_convert_DEPENDENCIES = $(convert_source_files:.java=.lo) \
+ $(GCDEPS) $(THREADDEPS) $(ZDEPS) libgcj.la libgcj.spec
gij_SOURCES = gij.cc
gij_DEPENDENCIES = $(GCDEPS) $(THREADDEPS) $(ZDEPS) libgcj.la libgcj.spec
gen_from_JIS_SOURCES =
-EXTRA_gen_from_JIS_SOURCES = $(srcdir)/$(CONVERT_DIR)/gen-from-JIS.c $(srcdir)/$(CONVERT_DIR)/make-trie.c $(srcdir)/$(CONVERT_DIR)/JIS0201.h $(srcdir)/$(CONVERT_DIR)/JIS0208.h $(srcdir)/$(CONVERT_DIR)/JIS0212.h
+EXTRA_gen_from_JIS_SOURCES = $(srcdir)/$(CONVERT_DIR)/gen-from-JIS.c \
+ $(srcdir)/$(CONVERT_DIR)/make-trie.c \
+ $(srcdir)/$(CONVERT_DIR)/JIS0201.h \
+ $(srcdir)/$(CONVERT_DIR)/JIS0208.h \
+ $(srcdir)/$(CONVERT_DIR)/JIS0212.h
gen_from_JIS_LDADD = $(CONVERT_DIR)/gen-from-JIS.o $(CONVERT_DIR)/make-trie.o
-gen_from_JIS_DEPENDENCIES = $(CONVERT_DIR)/gen-from-JIS.o $(CONVERT_DIR)/make-trie.o
-
-
-convert_source_files = gnu/gcj/convert/BytesToUnicode.java gnu/gcj/convert/Convert.java gnu/gcj/convert/Input_8859_1.java gnu/gcj/convert/Input_ASCII.java gnu/gcj/convert/Input_EUCJIS.java gnu/gcj/convert/Input_JavaSrc.java gnu/gcj/convert/Input_SJIS.java gnu/gcj/convert/Input_UTF8.java gnu/gcj/convert/Input_iconv.java gnu/gcj/convert/IOConverter.java gnu/gcj/convert/Output_8859_1.java gnu/gcj/convert/Output_ASCII.java gnu/gcj/convert/Output_EUCJIS.java gnu/gcj/convert/Output_JavaSrc.java gnu/gcj/convert/Output_SJIS.java gnu/gcj/convert/Output_UTF8.java gnu/gcj/convert/Output_iconv.java gnu/gcj/convert/UnicodeToBytes.java
+gen_from_JIS_DEPENDENCIES = $(CONVERT_DIR)/gen-from-JIS.o \
+ $(CONVERT_DIR)/make-trie.o
+
+
+convert_source_files = \
+gnu/gcj/convert/BytesToUnicode.java \
+gnu/gcj/convert/Convert.java \
+gnu/gcj/convert/Input_8859_1.java \
+gnu/gcj/convert/Input_ASCII.java \
+gnu/gcj/convert/Input_EUCJIS.java \
+gnu/gcj/convert/Input_JavaSrc.java \
+gnu/gcj/convert/Input_SJIS.java \
+gnu/gcj/convert/Input_UTF8.java \
+gnu/gcj/convert/Input_iconv.java \
+gnu/gcj/convert/IOConverter.java \
+gnu/gcj/convert/Output_8859_1.java \
+gnu/gcj/convert/Output_ASCII.java \
+gnu/gcj/convert/Output_EUCJIS.java \
+gnu/gcj/convert/Output_JavaSrc.java \
+gnu/gcj/convert/Output_SJIS.java \
+gnu/gcj/convert/Output_UTF8.java \
+gnu/gcj/convert/Output_iconv.java \
+gnu/gcj/convert/UnicodeToBytes.java
special_java_source_files = java/lang/Class.java java/lang/Object.java
-awt_java_source_files = gnu/awt/LightweightRedirector.java gnu/awt/j2d/AbstractGraphicsState.java gnu/awt/j2d/DirectRasterGraphics.java gnu/awt/j2d/Graphics2DImpl.java gnu/awt/j2d/IntegerGraphicsState.java gnu/awt/j2d/MappedRaster.java gnu/gcj/awt/BitMaskExtent.java gnu/gcj/awt/Buffers.java gnu/gcj/awt/ComponentDataBlitOp.java gnu/gcj/awt/GLightweightPeer.java gnu/java/beans/editors/ColorEditor.java gnu/java/beans/editors/FontEditor.java gnu/java/beans/editors/NativeBooleanEditor.java gnu/java/beans/editors/NativeByteEditor.java gnu/java/beans/editors/NativeDoubleEditor.java gnu/java/beans/editors/NativeFloatEditor.java gnu/java/beans/editors/NativeIntEditor.java gnu/java/beans/editors/NativeLongEditor.java gnu/java/beans/editors/NativeShortEditor.java gnu/java/beans/editors/StringEditor.java gnu/java/beans/info/ComponentBeanInfo.java gnu/java/beans/BeanInfoEmbryo.java gnu/java/beans/EmptyBeanInfo.java gnu/java/beans/ExplicitBeanInfo.java gnu/java/beans/IntrospectionIncubator.java java/applet/Applet.java java/applet/AppletStub.java java/applet/AppletContext.java java/applet/AudioClip.java java/awt/AWTError.java java/awt/AWTEvent.java java/awt/AWTEventMulticaster.java java/awt/AWTException.java java/awt/AWTPermission.java java/awt/ActiveEvent.java java/awt/Adjustable.java java/awt/BorderLayout.java java/awt/Button.java java/awt/Canvas.java java/awt/CardLayout.java java/awt/Checkbox.java java/awt/CheckboxGroup.java java/awt/CheckboxMenuItem.java java/awt/Choice.java java/awt/Color.java java/awt/Component.java java/awt/ComponentOrientation.java java/awt/Container.java java/awt/Cursor.java java/awt/Dialog.java java/awt/Dimension.java java/awt/Event.java java/awt/EventDispatchThread.java java/awt/EventQueue.java java/awt/FileDialog.java java/awt/FlowLayout.java java/awt/Font.java java/awt/FontMetrics.java java/awt/Frame.java java/awt/Graphics.java java/awt/Graphics2D.java java/awt/GraphicsConfiguration.java java/awt/GridBagConstraints.java java/awt/GridLayout.java java/awt/IllegalComponentStateException.java java/awt/Image.java java/awt/Insets.java java/awt/ItemSelectable.java java/awt/Label.java java/awt/LayoutManager.java java/awt/LayoutManager2.java java/awt/List.java java/awt/Menu.java java/awt/MenuBar.java java/awt/MenuComponent.java java/awt/MenuContainer.java java/awt/MenuItem.java java/awt/MenuShortcut.java java/awt/Paint.java java/awt/PaintContext.java java/awt/Panel.java java/awt/Point.java java/awt/Polygon.java java/awt/PopupMenu.java java/awt/Rectangle.java java/awt/RenderingHints.java java/awt/ScrollPane.java java/awt/Scrollbar.java java/awt/Shape.java java/awt/SystemColor.java java/awt/TextArea.java java/awt/TextComponent.java java/awt/TextField.java java/awt/Toolkit.java java/awt/Transparency.java java/awt/Window.java java/awt/color/ColorSpace.java java/awt/color/ICC_ColorSpace.java java/awt/color/ICC_Profile.java java/awt/datatransfer/Clipboard.java java/awt/event/AWTEventListener.java java/awt/event/ActionEvent.java java/awt/event/ActionListener.java java/awt/event/AdjustmentEvent.java java/awt/event/AdjustmentListener.java java/awt/event/ComponentAdapter.java java/awt/event/ComponentEvent.java java/awt/event/ComponentListener.java java/awt/event/ContainerAdapter.java java/awt/event/ContainerEvent.java java/awt/event/ContainerListener.java java/awt/event/FocusAdapter.java java/awt/event/FocusEvent.java java/awt/event/FocusListener.java java/awt/event/HierarchyBoundsAdapter.java java/awt/event/HierarchyBoundsListener.java java/awt/event/HierarchyEvent.java java/awt/event/HierarchyListener.java java/awt/event/InputEvent.java java/awt/event/InputMethodEvent.java java/awt/event/InputMethodListener.java java/awt/event/InvocationEvent.java java/awt/event/ItemEvent.java java/awt/event/ItemListener.java java/awt/event/KeyAdapter.java java/awt/event/KeyEvent.java java/awt/event/KeyListener.java java/awt/event/MouseAdapter.java java/awt/event/MouseEvent.java java/awt/event/MouseListener.java java/awt/event/MouseMotionAdapter.java java/awt/event/MouseMotionListener.java java/awt/event/PaintEvent.java java/awt/event/TextEvent.java java/awt/event/TextListener.java java/awt/event/WindowAdapter.java java/awt/event/WindowEvent.java java/awt/event/WindowListener.java java/awt/geom/AffineTransform.java java/awt/geom/Dimension2D.java java/awt/geom/Ellipse2D.java java/awt/geom/IllegalPathStateException.java java/awt/geom/Line2D.java java/awt/geom/NoninvertibleTransformException.java java/awt/geom/PathIterator.java java/awt/geom/Point2D.java java/awt/geom/Rectangle2D.java java/awt/geom/RectangularShape.java java/awt/geom/RoundRectangle2D.java java/awt/image/BufferedImage.java java/awt/image/ColorModel.java java/awt/image/ComponentColorModel.java java/awt/image/ComponentSampleModel.java java/awt/image/DataBuffer.java java/awt/image/DataBufferByte.java java/awt/image/DataBufferInt.java java/awt/image/DataBufferUShort.java java/awt/image/DirectColorModel.java java/awt/image/ImageConsumer.java java/awt/image/ImageObserver.java java/awt/image/ImageProducer.java java/awt/image/IndexColorModel.java java/awt/image/PackedColorModel.java java/awt/image/Raster.java java/awt/image/RasterOp.java java/awt/image/SampleModel.java java/awt/image/SinglePixelPackedSampleModel.java java/awt/image/WritableRaster.java java/awt/peer/ButtonPeer.java java/awt/peer/CanvasPeer.java java/awt/peer/CheckboxMenuItemPeer.java java/awt/peer/CheckboxPeer.java java/awt/peer/ChoicePeer.java java/awt/peer/ComponentPeer.java java/awt/peer/ContainerPeer.java java/awt/peer/DialogPeer.java java/awt/peer/FileDialogPeer.java java/awt/peer/FontPeer.java java/awt/peer/FramePeer.java java/awt/peer/LabelPeer.java java/awt/peer/LightweightPeer.java java/awt/peer/ListPeer.java java/awt/peer/MenuBarPeer.java java/awt/peer/MenuComponentPeer.java java/awt/peer/MenuItemPeer.java java/awt/peer/MenuPeer.java java/awt/peer/PanelPeer.java java/awt/peer/PopupMenuPeer.java java/awt/peer/ScrollPanePeer.java java/awt/peer/ScrollbarPeer.java java/awt/peer/TextAreaPeer.java java/awt/peer/TextComponentPeer.java java/awt/peer/TextFieldPeer.java java/awt/peer/WindowPeer.java java/beans/beancontext/BeanContext.java java/beans/beancontext/BeanContextChild.java java/beans/beancontext/BeanContextChildComponentProxy.java java/beans/beancontext/BeanContextChildSupport.java java/beans/beancontext/BeanContextContainerProxy.java java/beans/beancontext/BeanContextEvent.java java/beans/beancontext/BeanContextMembershipEvent.java java/beans/beancontext/BeanContextMembershipListener.java java/beans/beancontext/BeanContextProxy.java java/beans/beancontext/BeanContextServiceAvailableEvent.java java/beans/beancontext/BeanContextServiceProvider.java java/beans/beancontext/BeanContextServiceProviderBeanInfo.java java/beans/beancontext/BeanContextServiceRevokedEvent.java java/beans/beancontext/BeanContextServiceRevokedListener.java java/beans/beancontext/BeanContextServices.java java/beans/beancontext/BeanContextServicesListener.java java/beans/BeanDescriptor.java java/beans/BeanInfo.java java/beans/Beans.java java/beans/Customizer.java java/beans/DesignMode.java java/beans/EventSetDescriptor.java java/beans/FeatureDescriptor.java java/beans/IndexedPropertyDescriptor.java java/beans/IntrospectionException.java java/beans/Introspector.java java/beans/MethodDescriptor.java java/beans/ParameterDescriptor.java java/beans/PropertyChangeEvent.java java/beans/PropertyChangeListener.java java/beans/PropertyChangeSupport.java java/beans/PropertyDescriptor.java java/beans/PropertyEditor.java java/beans/PropertyEditorManager.java java/beans/PropertyEditorSupport.java java/beans/PropertyVetoException.java java/beans/SimpleBeanInfo.java java/beans/VetoableChangeListener.java java/beans/VetoableChangeSupport.java java/beans/Visibility.java
-
-
-built_java_source_files = java/lang/ConcreteProcess.java gnu/classpath/Configuration.java
-
-
-core_java_source_files = java/lang/AbstractMethodError.java java/lang/ArithmeticException.java java/lang/ArrayIndexOutOfBoundsException.java java/lang/ArrayStoreException.java java/lang/Boolean.java java/lang/Byte.java java/lang/Character.java java/lang/ClassCastException.java java/lang/ClassCircularityError.java java/lang/ClassFormatError.java java/lang/ClassLoader.java java/lang/ClassNotFoundException.java java/lang/CloneNotSupportedException.java java/lang/Cloneable.java java/lang/Comparable.java java/lang/Compiler.java java/lang/Double.java java/lang/Error.java java/lang/Exception.java java/lang/ExceptionInInitializerError.java java/lang/Float.java java/lang/IllegalAccessError.java java/lang/IllegalAccessException.java java/lang/IllegalArgumentException.java java/lang/IllegalMonitorStateException.java java/lang/IllegalStateException.java java/lang/IllegalThreadStateException.java java/lang/IncompatibleClassChangeError.java java/lang/IndexOutOfBoundsException.java java/lang/InstantiationError.java java/lang/InstantiationException.java java/lang/Integer.java java/lang/InternalError.java java/lang/InterruptedException.java java/lang/LinkageError.java java/lang/Long.java java/lang/Math.java java/lang/NegativeArraySizeException.java java/lang/NoClassDefFoundError.java java/lang/NoSuchFieldError.java java/lang/NoSuchFieldException.java java/lang/NoSuchMethodError.java java/lang/NoSuchMethodException.java java/lang/NullPointerException.java java/lang/Number.java java/lang/NumberFormatException.java java/lang/OutOfMemoryError.java java/lang/Package.java java/lang/Process.java java/lang/Runnable.java java/lang/Runtime.java java/lang/RuntimeException.java java/lang/RuntimePermission.java java/lang/SecurityException.java java/lang/SecurityManager.java java/lang/Short.java java/lang/StackOverflowError.java java/lang/String.java java/lang/StringBuffer.java java/lang/StringIndexOutOfBoundsException.java java/lang/System.java java/lang/Thread.java java/lang/ThreadDeath.java java/lang/ThreadGroup.java java/lang/ThreadLocal.java java/lang/Throwable.java java/lang/UnknownError.java java/lang/UnsatisfiedLinkError.java java/lang/UnsupportedOperationException.java java/lang/VerifyError.java java/lang/VirtualMachineError.java java/lang/Void.java java/io/BufferedInputStream.java java/io/BufferedOutputStream.java java/io/BufferedReader.java java/io/BufferedWriter.java java/io/ByteArrayInputStream.java java/io/ByteArrayOutputStream.java java/io/CharArrayReader.java java/io/CharArrayWriter.java java/io/CharConversionException.java java/io/DataInput.java java/io/DataInputStream.java java/io/DataOutput.java java/io/DataOutputStream.java java/io/EOFException.java java/io/Externalizable.java java/io/File.java java/io/FileDescriptor.java java/io/FileFilter.java java/io/FileInputStream.java java/io/FileNotFoundException.java java/io/FileOutputStream.java java/io/FilePermission.java java/io/FileReader.java java/io/FileWriter.java java/io/FilenameFilter.java java/io/FilterInputStream.java java/io/FilterOutputStream.java java/io/FilterReader.java java/io/FilterWriter.java java/io/IOException.java java/io/InputStream.java java/io/InputStreamReader.java java/io/InterruptedIOException.java java/io/InvalidClassException.java java/io/InvalidObjectException.java java/io/LineNumberInputStream.java java/io/LineNumberReader.java java/io/NotActiveException.java java/io/NotSerializableException.java java/io/ObjectInput.java java/io/ObjectInputStream.java java/io/ObjectInputValidation.java java/io/ObjectOutput.java java/io/ObjectOutputStream.java java/io/ObjectStreamClass.java java/io/ObjectStreamConstants.java java/io/ObjectStreamException.java java/io/ObjectStreamField.java java/io/OptionalDataException.java java/io/OutputStream.java java/io/OutputStreamWriter.java java/io/PipedInputStream.java java/io/PipedOutputStream.java java/io/PipedReader.java java/io/PipedWriter.java java/io/PrintStream.java java/io/PrintWriter.java java/io/PushbackInputStream.java java/io/PushbackReader.java java/io/RandomAccessFile.java java/io/Reader.java java/io/SequenceInputStream.java java/io/Serializable.java java/io/SerializablePermission.java java/io/StreamCorruptedException.java java/io/StreamTokenizer.java java/io/StringBufferInputStream.java java/io/StringReader.java java/io/StringWriter.java java/io/SyncFailedException.java java/io/UTFDataFormatException.java java/io/UnsupportedEncodingException.java java/io/WriteAbortedException.java java/io/Writer.java java/util/AbstractCollection.java java/util/AbstractList.java java/util/AbstractMap.java java/util/AbstractSequentialList.java java/util/AbstractSet.java java/util/ArrayList.java java/util/Arrays.java java/util/BasicMapEntry.java java/util/BitSet.java java/util/Calendar.java java/util/Collection.java java/util/Collections.java java/util/Comparator.java java/util/ConcurrentModificationException.java java/util/Date.java java/util/Dictionary.java java/util/EmptyStackException.java java/util/Enumeration.java java/util/EventListener.java java/util/EventObject.java java/util/GregorianCalendar.java java/util/HashMap.java java/util/HashSet.java java/util/Hashtable.java java/util/Iterator.java java/util/LinkedList.java java/util/List.java java/util/ListIterator.java java/util/ListResourceBundle.java java/util/Locale.java java/util/Map.java java/util/MissingResourceException.java java/util/NoSuchElementException.java java/util/Observable.java java/util/Observer.java java/util/Properties.java java/util/PropertyPermission.java java/util/PropertyResourceBundle.java java/util/Random.java java/util/ResourceBundle.java java/util/Set.java java/util/SimpleTimeZone.java java/util/SortedMap.java java/util/SortedSet.java java/util/Stack.java java/util/StringTokenizer.java java/util/TimeZone.java java/util/Timer.java java/util/TimerTask.java java/util/TreeMap.java java/util/TreeSet.java java/util/TooManyListenersException.java java/util/Vector.java java/util/WeakHashMap.java
-
-
-ordinary_java_source_files = $(core_java_source_files) gnu/gcj/RawData.java gnu/gcj/io/DefaultMimeTypes.java gnu/gcj/io/MimeTypes.java gnu/gcj/io/SimpleSHSStream.java gnu/gcj/math/MPN.java gnu/gcj/protocol/file/Connection.java gnu/gcj/protocol/file/Handler.java gnu/gcj/protocol/http/Connection.java gnu/gcj/protocol/http/Handler.java gnu/gcj/protocol/jar/Connection.java gnu/gcj/protocol/jar/Handler.java gnu/gcj/runtime/FileDeleter.java gnu/gcj/runtime/FirstThread.java gnu/gcj/runtime/VMClassLoader.java gnu/gcj/text/BaseBreakIterator.java gnu/gcj/text/CharacterBreakIterator.java gnu/gcj/text/LineBreakIterator.java gnu/gcj/text/LocaleData_en.java gnu/gcj/text/LocaleData_en_US.java gnu/gcj/text/SentenceBreakIterator.java gnu/gcj/text/WordBreakIterator.java gnu/gcj/util/EnumerationChain.java gnu/java/io/ClassLoaderObjectInputStream.java gnu/java/io/NullOutputStream.java gnu/java/io/ObjectIdentityWrapper.java gnu/java/lang/ArrayHelper.java gnu/java/lang/ClassHelper.java gnu/java/lang/reflect/TypeSignature.java gnu/java/locale/Calendar.java gnu/java/locale/Calendar_de.java gnu/java/locale/Calendar_en.java gnu/java/locale/Calendar_nl.java gnu/java/security/provider/DefaultPolicy.java gnu/java/security/provider/Gnu.java gnu/java/security/provider/SHA.java gnu/java/security/provider/SHA1PRNG.java java/lang/ref/PhantomReference.java java/lang/ref/Reference.java java/lang/ref/ReferenceQueue.java java/lang/ref/SoftReference.java java/lang/ref/WeakReference.java java/lang/reflect/AccessibleObject.java java/lang/reflect/Array.java java/lang/reflect/Constructor.java java/lang/reflect/Field.java java/lang/reflect/InvocationTargetException.java java/lang/reflect/Member.java java/lang/reflect/Method.java java/lang/reflect/Modifier.java java/lang/reflect/ReflectPermission.java java/math/BigDecimal.java java/math/BigInteger.java java/net/BindException.java java/net/ConnectException.java java/net/ContentHandler.java java/net/ContentHandlerFactory.java java/net/DatagramPacket.java java/net/DatagramSocket.java java/net/DatagramSocketImpl.java java/net/FileNameMap.java java/net/HttpURLConnection.java java/net/InetAddress.java java/net/JarURLConnection.java java/net/MalformedURLException.java java/net/MulticastSocket.java java/net/NetPermission.java java/net/NoRouteToHostException.java java/net/PlainDatagramSocketImpl.java java/net/PlainSocketImpl.java java/net/ProtocolException.java java/net/ServerSocket.java java/net/Socket.java java/net/SocketException.java java/net/SocketImpl.java java/net/SocketImplFactory.java java/net/SocketOptions.java java/net/SocketPermission.java java/net/URL.java java/net/URLClassLoader.java java/net/URLConnection.java java/net/URLDecoder.java java/net/URLEncoder.java java/net/URLStreamHandler.java java/net/URLStreamHandlerFactory.java java/net/UnknownHostException.java java/net/UnknownServiceException.java java/security/AccessControlContext.java java/security/AccessControlException.java java/security/AccessController.java java/security/AlgorithmParameterGenerator.java java/security/AlgorithmParameters.java java/security/AlgorithmParameterGeneratorSpi.java java/security/AlgorithmParametersSpi.java java/security/AllPermission.java java/security/BasicPermission.java java/security/Certificate.java java/security/CodeSource.java java/security/DigestException.java java/security/DigestOutputStream.java java/security/DummyKeyPairGenerator.java java/security/DummySignature.java java/security/DigestInputStream.java java/security/DomainCombiner.java java/security/DummyMessageDigest.java java/security/GeneralSecurityException.java java/security/Guard.java java/security/GuardedObject.java java/security/Identity.java java/security/IdentityScope.java java/security/InvalidAlgorithmParameterException.java java/security/InvalidKeyException.java java/security/InvalidParameterException.java java/security/Key.java java/security/KeyFactorySpi.java java/security/KeyPairGenerator.java java/security/KeyStoreException.java java/security/KeyException.java java/security/KeyManagementException.java java/security/KeyPairGeneratorSpi.java java/security/KeyStoreSpi.java java/security/KeyFactory.java java/security/KeyPair.java java/security/KeyStore.java java/security/MessageDigest.java java/security/MessageDigestSpi.java java/security/NoSuchAlgorithmException.java java/security/NoSuchProviderException.java java/security/Permission.java java/security/Principal.java java/security/PrivilegedExceptionAction.java java/security/PublicKey.java java/security/PermissionCollection.java java/security/PrivateKey.java java/security/ProtectionDomain.java java/security/Permissions.java java/security/PrivilegedAction.java java/security/Provider.java java/security/Policy.java java/security/PrivilegedActionException.java java/security/ProviderException.java java/security/SecureClassLoader.java java/security/SecureRandomSpi.java java/security/SecurityPermission.java java/security/SignatureException.java java/security/SignedObject.java java/security/SecureRandom.java java/security/Security.java java/security/Signature.java java/security/SignatureSpi.java java/security/Signer.java java/security/UnrecoverableKeyException.java java/security/UnresolvedPermission.java java/security/acl/Acl.java java/security/acl/AclNotFoundException.java java/security/acl/LastOwnerException.java java/security/acl/Owner.java java/security/acl/AclEntry.java java/security/acl/Group.java java/security/acl/NotOwnerException.java java/security/acl/Permission.java java/security/cert/CRL.java java/security/cert/CRLException.java java/security/cert/Certificate.java java/security/cert/CertificateEncodingException.java java/security/cert/CertificateException.java java/security/cert/CertificateExpiredException.java java/security/cert/CertificateFactory.java java/security/cert/CertificateFactorySpi.java java/security/cert/CertificateNotYetValidException.java java/security/cert/CertificateParsingException.java java/security/cert/X509CRL.java java/security/cert/X509CRLEntry.java java/security/cert/X509Certificate.java java/security/cert/X509Extension.java java/security/interfaces/DSAKey.java java/security/interfaces/DSAKeyPairGenerator.java java/security/interfaces/DSAParams.java java/security/interfaces/DSAPrivateKey.java java/security/interfaces/DSAPublicKey.java java/security/interfaces/RSAKey.java java/security/interfaces/RSAPrivateCrtKey.java java/security/interfaces/RSAPrivateKey.java java/security/interfaces/RSAPublicKey.java java/security/spec/AlgorithmParameterSpec.java java/security/spec/DSAParameterSpec.java java/security/spec/DSAPrivateKeySpec.java java/security/spec/DSAPublicKeySpec.java java/security/spec/EncodedKeySpec.java java/security/spec/InvalidKeySpecException.java java/security/spec/InvalidParameterSpecException.java java/security/spec/KeySpec.java java/security/spec/PKCS8EncodedKeySpec.java java/security/spec/RSAKeyGenParameterSpec.java java/security/spec/RSAPrivateCrtKeySpec.java java/security/spec/RSAPrivateKeySpec.java java/security/spec/RSAPublicKeySpec.java java/security/spec/X509EncodedKeySpec.java java/sql/Array.java java/sql/BatchUpdateException.java java/sql/Blob.java java/sql/CallableStatement.java java/sql/Clob.java java/sql/Connection.java java/sql/DataTruncation.java java/sql/DatabaseMetaData.java java/sql/Date.java java/sql/Driver.java java/sql/DriverManager.java java/sql/DriverPropertyInfo.java java/sql/PreparedStatement.java java/sql/Ref.java java/sql/ResultSet.java java/sql/ResultSetMetaData.java java/sql/SQLData.java java/sql/SQLException.java java/sql/SQLInput.java java/sql/SQLOutput.java java/sql/SQLWarning.java java/sql/Statement.java java/sql/Struct.java java/sql/Time.java java/sql/Timestamp.java java/sql/Types.java java/text/BreakIterator.java java/text/CharacterIterator.java java/text/ChoiceFormat.java java/text/CollationElementIterator.java java/text/CollationKey.java java/text/Collator.java java/text/DateFormat.java java/text/DateFormatSymbols.java java/text/DecimalFormat.java java/text/DecimalFormatSymbols.java java/text/FieldPosition.java java/text/Format.java java/text/MessageFormat.java java/text/NumberFormat.java java/text/ParseException.java java/text/ParsePosition.java java/text/RuleBasedCollator.java java/text/SimpleDateFormat.java java/text/StringCharacterIterator.java java/util/jar/Attributes.java java/util/jar/JarEntry.java java/util/jar/JarException.java java/util/jar/JarFile.java java/util/jar/JarInputStream.java java/util/jar/JarOutputStream.java java/util/jar/Manifest.java java/util/zip/Adler32.java java/util/zip/CRC32.java java/util/zip/CheckedInputStream.java java/util/zip/CheckedOutputStream.java java/util/zip/Checksum.java java/util/zip/DataFormatException.java java/util/zip/Deflater.java java/util/zip/DeflaterOutputStream.java java/util/zip/GZIPInputStream.java java/util/zip/GZIPOutputStream.java java/util/zip/Inflater.java java/util/zip/InflaterInputStream.java java/util/zip/ZipConstants.java java/util/zip/ZipEntry.java java/util/zip/ZipException.java java/util/zip/ZipFile.java java/util/zip/ZipInputStream.java java/util/zip/ZipOutputStream.java $(awt_java_source_files) $(convert_source_files)
+awt_java_source_files = \
+gnu/awt/LightweightRedirector.java \
+gnu/awt/j2d/AbstractGraphicsState.java \
+gnu/awt/j2d/DirectRasterGraphics.java \
+gnu/awt/j2d/Graphics2DImpl.java \
+gnu/awt/j2d/IntegerGraphicsState.java \
+gnu/awt/j2d/MappedRaster.java \
+gnu/gcj/awt/BitMaskExtent.java \
+gnu/gcj/awt/Buffers.java \
+gnu/gcj/awt/ComponentDataBlitOp.java \
+gnu/gcj/awt/GLightweightPeer.java \
+gnu/java/beans/editors/ColorEditor.java \
+gnu/java/beans/editors/FontEditor.java \
+gnu/java/beans/editors/NativeBooleanEditor.java \
+gnu/java/beans/editors/NativeByteEditor.java \
+gnu/java/beans/editors/NativeDoubleEditor.java \
+gnu/java/beans/editors/NativeFloatEditor.java \
+gnu/java/beans/editors/NativeIntEditor.java \
+gnu/java/beans/editors/NativeLongEditor.java \
+gnu/java/beans/editors/NativeShortEditor.java \
+gnu/java/beans/editors/StringEditor.java \
+gnu/java/beans/info/ComponentBeanInfo.java \
+gnu/java/beans/BeanInfoEmbryo.java \
+gnu/java/beans/EmptyBeanInfo.java \
+gnu/java/beans/ExplicitBeanInfo.java \
+gnu/java/beans/IntrospectionIncubator.java \
+java/applet/Applet.java \
+java/applet/AppletStub.java \
+java/applet/AppletContext.java \
+java/applet/AudioClip.java \
+java/awt/AWTError.java \
+java/awt/AWTEvent.java \
+java/awt/AWTEventMulticaster.java \
+java/awt/AWTException.java \
+java/awt/AWTPermission.java \
+java/awt/ActiveEvent.java \
+java/awt/Adjustable.java \
+java/awt/BorderLayout.java \
+java/awt/Button.java \
+java/awt/Canvas.java \
+java/awt/CardLayout.java \
+java/awt/Checkbox.java \
+java/awt/CheckboxGroup.java \
+java/awt/CheckboxMenuItem.java \
+java/awt/Choice.java \
+java/awt/Color.java \
+java/awt/Component.java \
+java/awt/ComponentOrientation.java \
+java/awt/Container.java \
+java/awt/Cursor.java \
+java/awt/Dialog.java \
+java/awt/Dimension.java \
+java/awt/Event.java \
+java/awt/EventDispatchThread.java \
+java/awt/EventQueue.java \
+java/awt/FileDialog.java \
+java/awt/FlowLayout.java \
+java/awt/Font.java \
+java/awt/FontMetrics.java \
+java/awt/Frame.java \
+java/awt/Graphics.java \
+java/awt/Graphics2D.java \
+java/awt/GraphicsConfiguration.java \
+java/awt/GridBagConstraints.java \
+java/awt/GridLayout.java \
+java/awt/IllegalComponentStateException.java \
+java/awt/Image.java \
+java/awt/Insets.java \
+java/awt/ItemSelectable.java \
+java/awt/Label.java \
+java/awt/LayoutManager.java \
+java/awt/LayoutManager2.java \
+java/awt/List.java \
+java/awt/Menu.java \
+java/awt/MenuBar.java \
+java/awt/MenuComponent.java \
+java/awt/MenuContainer.java \
+java/awt/MenuItem.java \
+java/awt/MenuShortcut.java \
+java/awt/Paint.java \
+java/awt/PaintContext.java \
+java/awt/Panel.java \
+java/awt/Point.java \
+java/awt/Polygon.java \
+java/awt/PopupMenu.java \
+java/awt/Rectangle.java \
+java/awt/RenderingHints.java \
+java/awt/ScrollPane.java \
+java/awt/Scrollbar.java \
+java/awt/Shape.java \
+java/awt/SystemColor.java \
+java/awt/TextArea.java \
+java/awt/TextComponent.java \
+java/awt/TextField.java \
+java/awt/Toolkit.java \
+java/awt/Transparency.java \
+java/awt/Window.java \
+java/awt/color/ColorSpace.java \
+java/awt/color/ICC_ColorSpace.java \
+java/awt/color/ICC_Profile.java \
+java/awt/datatransfer/Clipboard.java \
+java/awt/event/AWTEventListener.java \
+java/awt/event/ActionEvent.java \
+java/awt/event/ActionListener.java \
+java/awt/event/AdjustmentEvent.java \
+java/awt/event/AdjustmentListener.java \
+java/awt/event/ComponentAdapter.java \
+java/awt/event/ComponentEvent.java \
+java/awt/event/ComponentListener.java \
+java/awt/event/ContainerAdapter.java \
+java/awt/event/ContainerEvent.java \
+java/awt/event/ContainerListener.java \
+java/awt/event/FocusAdapter.java \
+java/awt/event/FocusEvent.java \
+java/awt/event/FocusListener.java \
+java/awt/event/HierarchyBoundsAdapter.java \
+java/awt/event/HierarchyBoundsListener.java \
+java/awt/event/HierarchyEvent.java \
+java/awt/event/HierarchyListener.java \
+java/awt/event/InputEvent.java \
+java/awt/event/InputMethodEvent.java \
+java/awt/event/InputMethodListener.java \
+java/awt/event/InvocationEvent.java \
+java/awt/event/ItemEvent.java \
+java/awt/event/ItemListener.java \
+java/awt/event/KeyAdapter.java \
+java/awt/event/KeyEvent.java \
+java/awt/event/KeyListener.java \
+java/awt/event/MouseAdapter.java \
+java/awt/event/MouseEvent.java \
+java/awt/event/MouseListener.java \
+java/awt/event/MouseMotionAdapter.java \
+java/awt/event/MouseMotionListener.java \
+java/awt/event/PaintEvent.java \
+java/awt/event/TextEvent.java \
+java/awt/event/TextListener.java \
+java/awt/event/WindowAdapter.java \
+java/awt/event/WindowEvent.java \
+java/awt/event/WindowListener.java \
+java/awt/geom/AffineTransform.java \
+java/awt/geom/Dimension2D.java \
+java/awt/geom/Ellipse2D.java \
+java/awt/geom/IllegalPathStateException.java \
+java/awt/geom/Line2D.java \
+java/awt/geom/NoninvertibleTransformException.java \
+java/awt/geom/PathIterator.java \
+java/awt/geom/Point2D.java \
+java/awt/geom/Rectangle2D.java \
+java/awt/geom/RectangularShape.java \
+java/awt/geom/RoundRectangle2D.java \
+java/awt/image/BufferedImage.java \
+java/awt/image/ColorModel.java \
+java/awt/image/ComponentColorModel.java \
+java/awt/image/ComponentSampleModel.java \
+java/awt/image/DataBuffer.java \
+java/awt/image/DataBufferByte.java \
+java/awt/image/DataBufferInt.java \
+java/awt/image/DataBufferUShort.java \
+java/awt/image/DirectColorModel.java \
+java/awt/image/ImageConsumer.java \
+java/awt/image/ImageObserver.java \
+java/awt/image/ImageProducer.java \
+java/awt/image/IndexColorModel.java \
+java/awt/image/PackedColorModel.java \
+java/awt/image/Raster.java \
+java/awt/image/RasterOp.java \
+java/awt/image/SampleModel.java \
+java/awt/image/SinglePixelPackedSampleModel.java \
+java/awt/image/WritableRaster.java \
+java/awt/peer/ButtonPeer.java \
+java/awt/peer/CanvasPeer.java \
+java/awt/peer/CheckboxMenuItemPeer.java \
+java/awt/peer/CheckboxPeer.java \
+java/awt/peer/ChoicePeer.java \
+java/awt/peer/ComponentPeer.java \
+java/awt/peer/ContainerPeer.java \
+java/awt/peer/DialogPeer.java \
+java/awt/peer/FileDialogPeer.java \
+java/awt/peer/FontPeer.java \
+java/awt/peer/FramePeer.java \
+java/awt/peer/LabelPeer.java \
+java/awt/peer/LightweightPeer.java \
+java/awt/peer/ListPeer.java \
+java/awt/peer/MenuBarPeer.java \
+java/awt/peer/MenuComponentPeer.java \
+java/awt/peer/MenuItemPeer.java \
+java/awt/peer/MenuPeer.java \
+java/awt/peer/PanelPeer.java \
+java/awt/peer/PopupMenuPeer.java \
+java/awt/peer/ScrollPanePeer.java \
+java/awt/peer/ScrollbarPeer.java \
+java/awt/peer/TextAreaPeer.java \
+java/awt/peer/TextComponentPeer.java \
+java/awt/peer/TextFieldPeer.java \
+java/awt/peer/WindowPeer.java \
+java/beans/beancontext/BeanContext.java \
+java/beans/beancontext/BeanContextChild.java \
+java/beans/beancontext/BeanContextChildComponentProxy.java \
+java/beans/beancontext/BeanContextChildSupport.java \
+java/beans/beancontext/BeanContextContainerProxy.java \
+java/beans/beancontext/BeanContextEvent.java \
+java/beans/beancontext/BeanContextMembershipEvent.java \
+java/beans/beancontext/BeanContextMembershipListener.java \
+java/beans/beancontext/BeanContextProxy.java \
+java/beans/beancontext/BeanContextServiceAvailableEvent.java \
+java/beans/beancontext/BeanContextServiceProvider.java \
+java/beans/beancontext/BeanContextServiceProviderBeanInfo.java \
+java/beans/beancontext/BeanContextServiceRevokedEvent.java \
+java/beans/beancontext/BeanContextServiceRevokedListener.java \
+java/beans/beancontext/BeanContextServices.java \
+java/beans/beancontext/BeanContextServicesListener.java \
+java/beans/BeanDescriptor.java \
+java/beans/BeanInfo.java \
+java/beans/Beans.java \
+java/beans/Customizer.java \
+java/beans/DesignMode.java \
+java/beans/EventSetDescriptor.java \
+java/beans/FeatureDescriptor.java \
+java/beans/IndexedPropertyDescriptor.java \
+java/beans/IntrospectionException.java \
+java/beans/Introspector.java \
+java/beans/MethodDescriptor.java \
+java/beans/ParameterDescriptor.java \
+java/beans/PropertyChangeEvent.java \
+java/beans/PropertyChangeListener.java \
+java/beans/PropertyChangeSupport.java \
+java/beans/PropertyDescriptor.java \
+java/beans/PropertyEditor.java \
+java/beans/PropertyEditorManager.java \
+java/beans/PropertyEditorSupport.java \
+java/beans/PropertyVetoException.java \
+java/beans/SimpleBeanInfo.java \
+java/beans/VetoableChangeListener.java \
+java/beans/VetoableChangeSupport.java \
+java/beans/Visibility.java
+
+
+built_java_source_files = java/lang/ConcreteProcess.java \
+ gnu/classpath/Configuration.java
+
+
+core_java_source_files = \
+java/lang/AbstractMethodError.java \
+java/lang/ArithmeticException.java \
+java/lang/ArrayIndexOutOfBoundsException.java \
+java/lang/ArrayStoreException.java \
+java/lang/Boolean.java \
+java/lang/Byte.java \
+java/lang/Character.java \
+java/lang/ClassCastException.java \
+java/lang/ClassCircularityError.java \
+java/lang/ClassFormatError.java \
+java/lang/ClassLoader.java \
+java/lang/ClassNotFoundException.java \
+java/lang/CloneNotSupportedException.java \
+java/lang/Cloneable.java \
+java/lang/Comparable.java \
+java/lang/Compiler.java \
+java/lang/Double.java \
+java/lang/Error.java \
+java/lang/Exception.java \
+java/lang/ExceptionInInitializerError.java \
+java/lang/Float.java \
+java/lang/IllegalAccessError.java \
+java/lang/IllegalAccessException.java \
+java/lang/IllegalArgumentException.java \
+java/lang/IllegalMonitorStateException.java \
+java/lang/IllegalStateException.java \
+java/lang/IllegalThreadStateException.java \
+java/lang/IncompatibleClassChangeError.java \
+java/lang/IndexOutOfBoundsException.java \
+java/lang/InstantiationError.java \
+java/lang/InstantiationException.java \
+java/lang/Integer.java \
+java/lang/InternalError.java \
+java/lang/InterruptedException.java \
+java/lang/LinkageError.java \
+java/lang/Long.java \
+java/lang/Math.java \
+java/lang/NegativeArraySizeException.java \
+java/lang/NoClassDefFoundError.java \
+java/lang/NoSuchFieldError.java \
+java/lang/NoSuchFieldException.java \
+java/lang/NoSuchMethodError.java \
+java/lang/NoSuchMethodException.java \
+java/lang/NullPointerException.java \
+java/lang/Number.java \
+java/lang/NumberFormatException.java \
+java/lang/OutOfMemoryError.java \
+java/lang/Package.java \
+java/lang/Process.java \
+java/lang/Runnable.java \
+java/lang/Runtime.java \
+java/lang/RuntimeException.java \
+java/lang/RuntimePermission.java \
+java/lang/SecurityException.java \
+java/lang/SecurityManager.java \
+java/lang/Short.java \
+java/lang/StackOverflowError.java \
+java/lang/String.java \
+java/lang/StringBuffer.java \
+java/lang/StringIndexOutOfBoundsException.java \
+java/lang/System.java \
+java/lang/Thread.java \
+java/lang/ThreadDeath.java \
+java/lang/ThreadGroup.java \
+java/lang/ThreadLocal.java \
+java/lang/Throwable.java \
+java/lang/UnknownError.java \
+java/lang/UnsatisfiedLinkError.java \
+java/lang/UnsupportedOperationException.java \
+java/lang/VerifyError.java \
+java/lang/VirtualMachineError.java \
+java/lang/Void.java \
+java/io/BufferedInputStream.java \
+java/io/BufferedOutputStream.java \
+java/io/BufferedReader.java \
+java/io/BufferedWriter.java \
+java/io/ByteArrayInputStream.java \
+java/io/ByteArrayOutputStream.java \
+java/io/CharArrayReader.java \
+java/io/CharArrayWriter.java \
+java/io/CharConversionException.java \
+java/io/DataInput.java \
+java/io/DataInputStream.java \
+java/io/DataOutput.java \
+java/io/DataOutputStream.java \
+java/io/EOFException.java \
+java/io/Externalizable.java \
+java/io/File.java \
+java/io/FileDescriptor.java \
+java/io/FileFilter.java \
+java/io/FileInputStream.java \
+java/io/FileNotFoundException.java \
+java/io/FileOutputStream.java \
+java/io/FilePermission.java \
+java/io/FileReader.java \
+java/io/FileWriter.java \
+java/io/FilenameFilter.java \
+java/io/FilterInputStream.java \
+java/io/FilterOutputStream.java \
+java/io/FilterReader.java \
+java/io/FilterWriter.java \
+java/io/IOException.java \
+java/io/InputStream.java \
+java/io/InputStreamReader.java \
+java/io/InterruptedIOException.java \
+java/io/InvalidClassException.java \
+java/io/InvalidObjectException.java \
+java/io/LineNumberInputStream.java \
+java/io/LineNumberReader.java \
+java/io/NotActiveException.java \
+java/io/NotSerializableException.java \
+java/io/ObjectInput.java \
+java/io/ObjectInputStream.java \
+java/io/ObjectInputValidation.java \
+java/io/ObjectOutput.java \
+java/io/ObjectOutputStream.java \
+java/io/ObjectStreamClass.java \
+java/io/ObjectStreamConstants.java \
+java/io/ObjectStreamException.java \
+java/io/ObjectStreamField.java \
+java/io/OptionalDataException.java \
+java/io/OutputStream.java \
+java/io/OutputStreamWriter.java \
+java/io/PipedInputStream.java \
+java/io/PipedOutputStream.java \
+java/io/PipedReader.java \
+java/io/PipedWriter.java \
+java/io/PrintStream.java \
+java/io/PrintWriter.java \
+java/io/PushbackInputStream.java \
+java/io/PushbackReader.java \
+java/io/RandomAccessFile.java \
+java/io/Reader.java \
+java/io/SequenceInputStream.java \
+java/io/Serializable.java \
+java/io/SerializablePermission.java \
+java/io/StreamCorruptedException.java \
+java/io/StreamTokenizer.java \
+java/io/StringBufferInputStream.java \
+java/io/StringReader.java \
+java/io/StringWriter.java \
+java/io/SyncFailedException.java \
+java/io/UTFDataFormatException.java \
+java/io/UnsupportedEncodingException.java \
+java/io/WriteAbortedException.java \
+java/io/Writer.java \
+java/util/AbstractCollection.java \
+java/util/AbstractList.java \
+java/util/AbstractMap.java \
+java/util/AbstractSequentialList.java \
+java/util/AbstractSet.java \
+java/util/ArrayList.java \
+java/util/Arrays.java \
+java/util/BasicMapEntry.java \
+java/util/BitSet.java \
+java/util/Calendar.java \
+java/util/Collection.java \
+java/util/Collections.java \
+java/util/Comparator.java \
+java/util/ConcurrentModificationException.java \
+java/util/Date.java \
+java/util/Dictionary.java \
+java/util/EmptyStackException.java \
+java/util/Enumeration.java \
+java/util/EventListener.java \
+java/util/EventObject.java \
+java/util/GregorianCalendar.java \
+java/util/HashMap.java \
+java/util/HashSet.java \
+java/util/Hashtable.java \
+java/util/Iterator.java \
+java/util/LinkedList.java \
+java/util/List.java \
+java/util/ListIterator.java \
+java/util/ListResourceBundle.java \
+java/util/Locale.java \
+java/util/Map.java \
+java/util/MissingResourceException.java \
+java/util/NoSuchElementException.java \
+java/util/Observable.java \
+java/util/Observer.java \
+java/util/Properties.java \
+java/util/PropertyPermission.java \
+java/util/PropertyResourceBundle.java \
+java/util/Random.java \
+java/util/ResourceBundle.java \
+java/util/Set.java \
+java/util/SimpleTimeZone.java \
+java/util/SortedMap.java \
+java/util/SortedSet.java \
+java/util/Stack.java \
+java/util/StringTokenizer.java \
+java/util/TimeZone.java \
+java/util/Timer.java \
+java/util/TimerTask.java \
+java/util/TreeMap.java \
+java/util/TreeSet.java \
+java/util/TooManyListenersException.java \
+java/util/Vector.java \
+java/util/WeakHashMap.java
+
+
+ordinary_java_source_files = $(core_java_source_files) \
+gnu/gcj/RawData.java \
+gnu/gcj/io/DefaultMimeTypes.java \
+gnu/gcj/io/MimeTypes.java \
+gnu/gcj/io/SimpleSHSStream.java \
+gnu/gcj/math/MPN.java \
+gnu/gcj/protocol/file/Connection.java \
+gnu/gcj/protocol/file/Handler.java \
+gnu/gcj/protocol/http/Connection.java \
+gnu/gcj/protocol/http/Handler.java \
+gnu/gcj/protocol/jar/Connection.java \
+gnu/gcj/protocol/jar/Handler.java \
+gnu/gcj/runtime/FileDeleter.java \
+gnu/gcj/runtime/FirstThread.java \
+gnu/gcj/runtime/VMClassLoader.java \
+gnu/gcj/text/BaseBreakIterator.java \
+gnu/gcj/text/CharacterBreakIterator.java \
+gnu/gcj/text/LineBreakIterator.java \
+gnu/gcj/text/LocaleData_en.java \
+gnu/gcj/text/LocaleData_en_US.java \
+gnu/gcj/text/SentenceBreakIterator.java \
+gnu/gcj/text/WordBreakIterator.java \
+gnu/gcj/util/EnumerationChain.java \
+gnu/java/io/ClassLoaderObjectInputStream.java \
+gnu/java/io/NullOutputStream.java \
+gnu/java/io/ObjectIdentityWrapper.java \
+gnu/java/lang/ArrayHelper.java \
+gnu/java/lang/ClassHelper.java \
+gnu/java/lang/reflect/TypeSignature.java \
+gnu/java/locale/Calendar.java \
+gnu/java/locale/Calendar_de.java \
+gnu/java/locale/Calendar_en.java \
+gnu/java/locale/Calendar_nl.java \
+gnu/java/security/provider/DefaultPolicy.java \
+gnu/java/security/provider/Gnu.java \
+gnu/java/security/provider/SHA.java \
+gnu/java/security/provider/SHA1PRNG.java \
+java/lang/ref/PhantomReference.java \
+java/lang/ref/Reference.java \
+java/lang/ref/ReferenceQueue.java \
+java/lang/ref/SoftReference.java \
+java/lang/ref/WeakReference.java \
+java/lang/reflect/AccessibleObject.java \
+java/lang/reflect/Array.java \
+java/lang/reflect/Constructor.java \
+java/lang/reflect/Field.java \
+java/lang/reflect/InvocationTargetException.java \
+java/lang/reflect/Member.java \
+java/lang/reflect/Method.java \
+java/lang/reflect/Modifier.java \
+java/lang/reflect/ReflectPermission.java \
+java/math/BigDecimal.java \
+java/math/BigInteger.java \
+java/net/BindException.java \
+java/net/ConnectException.java \
+java/net/ContentHandler.java \
+java/net/ContentHandlerFactory.java \
+java/net/DatagramPacket.java \
+java/net/DatagramSocket.java \
+java/net/DatagramSocketImpl.java \
+java/net/FileNameMap.java \
+java/net/HttpURLConnection.java \
+java/net/InetAddress.java \
+java/net/JarURLConnection.java \
+java/net/MalformedURLException.java \
+java/net/MulticastSocket.java \
+java/net/NetPermission.java \
+java/net/NoRouteToHostException.java \
+java/net/PlainDatagramSocketImpl.java \
+java/net/PlainSocketImpl.java \
+java/net/ProtocolException.java \
+java/net/ServerSocket.java \
+java/net/Socket.java \
+java/net/SocketException.java \
+java/net/SocketImpl.java \
+java/net/SocketImplFactory.java \
+java/net/SocketOptions.java \
+java/net/SocketPermission.java \
+java/net/URL.java \
+java/net/URLClassLoader.java \
+java/net/URLConnection.java \
+java/net/URLDecoder.java \
+java/net/URLEncoder.java \
+java/net/URLStreamHandler.java \
+java/net/URLStreamHandlerFactory.java \
+java/net/UnknownHostException.java \
+java/net/UnknownServiceException.java \
+java/security/AccessControlContext.java \
+java/security/AccessControlException.java \
+java/security/AccessController.java \
+java/security/AlgorithmParameterGenerator.java \
+java/security/AlgorithmParameters.java \
+java/security/AlgorithmParameterGeneratorSpi.java \
+java/security/AlgorithmParametersSpi.java \
+java/security/AllPermission.java \
+java/security/BasicPermission.java \
+java/security/Certificate.java \
+java/security/CodeSource.java \
+java/security/DigestException.java \
+java/security/DigestOutputStream.java \
+java/security/DummyKeyPairGenerator.java \
+java/security/DummySignature.java \
+java/security/DigestInputStream.java \
+java/security/DomainCombiner.java \
+java/security/DummyMessageDigest.java \
+java/security/GeneralSecurityException.java \
+java/security/Guard.java \
+java/security/GuardedObject.java \
+java/security/Identity.java \
+java/security/IdentityScope.java \
+java/security/InvalidAlgorithmParameterException.java \
+java/security/InvalidKeyException.java \
+java/security/InvalidParameterException.java \
+java/security/Key.java \
+java/security/KeyFactorySpi.java \
+java/security/KeyPairGenerator.java \
+java/security/KeyStoreException.java \
+java/security/KeyException.java \
+java/security/KeyManagementException.java \
+java/security/KeyPairGeneratorSpi.java \
+java/security/KeyStoreSpi.java \
+java/security/KeyFactory.java \
+java/security/KeyPair.java \
+java/security/KeyStore.java \
+java/security/MessageDigest.java \
+java/security/MessageDigestSpi.java \
+java/security/NoSuchAlgorithmException.java \
+java/security/NoSuchProviderException.java \
+java/security/Permission.java \
+java/security/Principal.java \
+java/security/PrivilegedExceptionAction.java \
+java/security/PublicKey.java \
+java/security/PermissionCollection.java \
+java/security/PrivateKey.java \
+java/security/ProtectionDomain.java \
+java/security/Permissions.java \
+java/security/PrivilegedAction.java \
+java/security/Provider.java \
+java/security/Policy.java \
+java/security/PrivilegedActionException.java \
+java/security/ProviderException.java \
+java/security/SecureClassLoader.java \
+java/security/SecureRandomSpi.java \
+java/security/SecurityPermission.java \
+java/security/SignatureException.java \
+java/security/SignedObject.java \
+java/security/SecureRandom.java \
+java/security/Security.java \
+java/security/Signature.java \
+java/security/SignatureSpi.java \
+java/security/Signer.java \
+java/security/UnrecoverableKeyException.java \
+java/security/UnresolvedPermission.java \
+java/security/acl/Acl.java \
+java/security/acl/AclNotFoundException.java \
+java/security/acl/LastOwnerException.java \
+java/security/acl/Owner.java \
+java/security/acl/AclEntry.java \
+java/security/acl/Group.java \
+java/security/acl/NotOwnerException.java \
+java/security/acl/Permission.java \
+java/security/cert/CRL.java \
+java/security/cert/CRLException.java \
+java/security/cert/Certificate.java \
+java/security/cert/CertificateEncodingException.java \
+java/security/cert/CertificateException.java \
+java/security/cert/CertificateExpiredException.java \
+java/security/cert/CertificateFactory.java \
+java/security/cert/CertificateFactorySpi.java \
+java/security/cert/CertificateNotYetValidException.java \
+java/security/cert/CertificateParsingException.java \
+java/security/cert/X509CRL.java \
+java/security/cert/X509CRLEntry.java \
+java/security/cert/X509Certificate.java \
+java/security/cert/X509Extension.java \
+java/security/interfaces/DSAKey.java \
+java/security/interfaces/DSAKeyPairGenerator.java \
+java/security/interfaces/DSAParams.java \
+java/security/interfaces/DSAPrivateKey.java \
+java/security/interfaces/DSAPublicKey.java \
+java/security/interfaces/RSAKey.java \
+java/security/interfaces/RSAPrivateCrtKey.java \
+java/security/interfaces/RSAPrivateKey.java \
+java/security/interfaces/RSAPublicKey.java \
+java/security/spec/AlgorithmParameterSpec.java \
+java/security/spec/DSAParameterSpec.java \
+java/security/spec/DSAPrivateKeySpec.java \
+java/security/spec/DSAPublicKeySpec.java \
+java/security/spec/EncodedKeySpec.java \
+java/security/spec/InvalidKeySpecException.java \
+java/security/spec/InvalidParameterSpecException.java \
+java/security/spec/KeySpec.java \
+java/security/spec/PKCS8EncodedKeySpec.java \
+java/security/spec/RSAKeyGenParameterSpec.java \
+java/security/spec/RSAPrivateCrtKeySpec.java \
+java/security/spec/RSAPrivateKeySpec.java \
+java/security/spec/RSAPublicKeySpec.java \
+java/security/spec/X509EncodedKeySpec.java \
+java/sql/Array.java \
+java/sql/BatchUpdateException.java \
+java/sql/Blob.java \
+java/sql/CallableStatement.java \
+java/sql/Clob.java \
+java/sql/Connection.java \
+java/sql/DataTruncation.java \
+java/sql/DatabaseMetaData.java \
+java/sql/Date.java \
+java/sql/Driver.java \
+java/sql/DriverManager.java \
+java/sql/DriverPropertyInfo.java \
+java/sql/PreparedStatement.java \
+java/sql/Ref.java \
+java/sql/ResultSet.java \
+java/sql/ResultSetMetaData.java \
+java/sql/SQLData.java \
+java/sql/SQLException.java \
+java/sql/SQLInput.java \
+java/sql/SQLOutput.java \
+java/sql/SQLWarning.java \
+java/sql/Statement.java \
+java/sql/Struct.java \
+java/sql/Time.java \
+java/sql/Timestamp.java \
+java/sql/Types.java \
+java/text/BreakIterator.java \
+java/text/CharacterIterator.java \
+java/text/ChoiceFormat.java \
+java/text/CollationElementIterator.java \
+java/text/CollationKey.java \
+java/text/Collator.java \
+java/text/DateFormat.java \
+java/text/DateFormatSymbols.java \
+java/text/DecimalFormat.java \
+java/text/DecimalFormatSymbols.java \
+java/text/FieldPosition.java \
+java/text/Format.java \
+java/text/MessageFormat.java \
+java/text/NumberFormat.java \
+java/text/ParseException.java \
+java/text/ParsePosition.java \
+java/text/RuleBasedCollator.java \
+java/text/SimpleDateFormat.java \
+java/text/StringCharacterIterator.java \
+java/util/jar/Attributes.java \
+java/util/jar/JarEntry.java \
+java/util/jar/JarException.java \
+java/util/jar/JarFile.java \
+java/util/jar/JarInputStream.java \
+java/util/jar/JarOutputStream.java \
+java/util/jar/Manifest.java \
+java/util/zip/Adler32.java \
+java/util/zip/CRC32.java \
+java/util/zip/CheckedInputStream.java \
+java/util/zip/CheckedOutputStream.java \
+java/util/zip/Checksum.java \
+java/util/zip/DataFormatException.java \
+java/util/zip/Deflater.java \
+java/util/zip/DeflaterOutputStream.java \
+java/util/zip/GZIPInputStream.java \
+java/util/zip/GZIPOutputStream.java \
+java/util/zip/Inflater.java \
+java/util/zip/InflaterInputStream.java \
+java/util/zip/ZipConstants.java \
+java/util/zip/ZipEntry.java \
+java/util/zip/ZipException.java \
+java/util/zip/ZipFile.java \
+java/util/zip/ZipInputStream.java \
+java/util/zip/ZipOutputStream.java \
+org/w3c/dom/Attr.java \
+org/w3c/dom/CDATASection.java \
+org/w3c/dom/CharacterData.java \
+org/w3c/dom/Comment.java \
+org/w3c/dom/DOMException.java \
+org/w3c/dom/DOMImplementation.java \
+org/w3c/dom/Document.java \
+org/w3c/dom/DocumentFragment.java \
+org/w3c/dom/DocumentType.java \
+org/w3c/dom/Element.java \
+org/w3c/dom/Entity.java \
+org/w3c/dom/EntityReference.java \
+org/w3c/dom/NamedNodeMap.java \
+org/w3c/dom/Node.java \
+org/w3c/dom/NodeList.java \
+org/w3c/dom/Notation.java \
+org/w3c/dom/ProcessingInstruction.java \
+org/w3c/dom/Text.java \
+org/w3c/dom/ranges/DocumentRange.java \
+org/w3c/dom/ranges/Range.java \
+org/w3c/dom/ranges/RangeException.java \
+org/w3c/dom/traversal/DocumentTraversal.java \
+org/w3c/dom/traversal/NodeFilter.java \
+org/w3c/dom/traversal/NodeIterator.java \
+org/w3c/dom/traversal/TreeWalker.java \
+org/xml/sax/ext/DeclHandler.java \
+org/xml/sax/ext/LexicalHandler.java \
+org/xml/sax/helpers/AttributeListImpl.java \
+org/xml/sax/helpers/AttributesImpl.java \
+org/xml/sax/helpers/DefaultHandler.java \
+org/xml/sax/helpers/LocatorImpl.java \
+org/xml/sax/helpers/NamespaceSupport.java \
+org/xml/sax/helpers/ParserAdapter.java \
+org/xml/sax/helpers/ParserFactory.java \
+org/xml/sax/helpers/XMLFilterImpl.java \
+org/xml/sax/helpers/XMLReaderAdapter.java \
+org/xml/sax/helpers/XMLReaderFactory.java \
+org/xml/sax/AttributeList.java \
+org/xml/sax/Attributes.java \
+org/xml/sax/ContentHandler.java \
+org/xml/sax/DTDHandler.java \
+org/xml/sax/DocumentHandler.java \
+org/xml/sax/EntityResolver.java \
+org/xml/sax/ErrorHandler.java \
+org/xml/sax/HandlerBase.java \
+org/xml/sax/InputSource.java \
+org/xml/sax/Locator.java \
+org/xml/sax/Parser.java \
+org/xml/sax/SAXException.java \
+org/xml/sax/SAXNotRecognizedException.java \
+org/xml/sax/SAXNotSupportedException.java \
+org/xml/sax/SAXParseException.java \
+org/xml/sax/XMLFilter.java \
+org/xml/sax/XMLReader.java \
+$(awt_java_source_files) \
+$(convert_source_files)
java_source_files = $(special_java_source_files) $(ordinary_java_source_files)
-c_source_files = java/lang/dtoa.c java/lang/k_rem_pio2.c java/lang/s_tan.c java/lang/e_acos.c java/lang/k_sin.c java/lang/strtod.c java/lang/e_asin.c java/lang/k_tan.c java/lang/w_acos.c java/lang/e_atan2.c java/lang/mprec.c java/lang/w_asin.c java/lang/e_exp.c java/lang/s_atan.c java/lang/w_atan2.c java/lang/e_fmod.c java/lang/s_ceil.c java/lang/w_exp.c java/lang/e_log.c java/lang/s_copysign.c java/lang/w_fmod.c java/lang/e_pow.c java/lang/s_cos.c java/lang/w_log.c java/lang/e_rem_pio2.c java/lang/s_fabs.c java/lang/w_pow.c java/lang/e_remainder.c java/lang/s_floor.c java/lang/w_remainder.c java/lang/e_scalb.c java/lang/s_rint.c java/lang/w_sqrt.c java/lang/e_sqrt.c java/lang/s_scalbn.c java/lang/sf_rint.c java/lang/k_cos.c java/lang/s_sin.c java/lang/sf_fabs.c
+c_source_files = \
+ java/lang/dtoa.c java/lang/k_rem_pio2.c java/lang/s_tan.c \
+ java/lang/e_acos.c java/lang/k_sin.c java/lang/strtod.c \
+ java/lang/e_asin.c java/lang/k_tan.c java/lang/w_acos.c \
+ java/lang/e_atan2.c java/lang/mprec.c java/lang/w_asin.c \
+ java/lang/e_exp.c java/lang/s_atan.c java/lang/w_atan2.c \
+ java/lang/e_fmod.c java/lang/s_ceil.c java/lang/w_exp.c \
+ java/lang/e_log.c java/lang/s_copysign.c java/lang/w_fmod.c \
+ java/lang/e_pow.c java/lang/s_cos.c java/lang/w_log.c \
+ java/lang/e_rem_pio2.c java/lang/s_fabs.c java/lang/w_pow.c \
+ java/lang/e_remainder.c java/lang/s_floor.c java/lang/w_remainder.c \
+ java/lang/e_scalb.c java/lang/s_rint.c java/lang/w_sqrt.c \
+ java/lang/e_sqrt.c java/lang/s_scalbn.c java/lang/sf_rint.c \
+ java/lang/k_cos.c java/lang/s_sin.c java/lang/sf_fabs.c
#java/awt/natToolkit.cc
-nat_source_files = gnu/gcj/convert/JIS0208_to_Unicode.cc gnu/gcj/convert/JIS0212_to_Unicode.cc gnu/gcj/convert/Unicode_to_JIS.cc gnu/gcj/convert/natIconv.cc gnu/gcj/convert/natInput_EUCJIS.cc gnu/gcj/convert/natInput_SJIS.cc gnu/gcj/convert/natOutput_EUCJIS.cc gnu/gcj/convert/natOutput_SJIS.cc gnu/gcj/io/natSimpleSHSStream.cc gnu/gcj/io/shs.cc java/io/natFile.cc java/io/natFileDescriptor.cc java/io/natObjectInputStream.cc java/io/natObjectOutputStream.cc java/lang/natCharacter.cc java/lang/natClass.cc java/lang/natClassLoader.cc java/lang/natConcreteProcess.cc java/lang/natDouble.cc java/lang/natFloat.cc java/lang/natMath.cc java/lang/natObject.cc java/lang/natRuntime.cc java/lang/natString.cc java/lang/natStringBuffer.cc java/lang/natSystem.cc java/lang/natThread.cc java/lang/natThrowable.cc java/lang/reflect/natArray.cc java/lang/reflect/natConstructor.cc java/lang/reflect/natField.cc java/lang/reflect/natMethod.cc java/net/natInetAddress.cc java/net/natPlainDatagramSocketImpl.cc java/net/natPlainSocketImpl.cc java/text/natCollator.cc java/util/zip/natDeflater.cc java/util/zip/natInflater.cc
-
-
-x_java_source_files = gnu/gcj/xlib/Clip.java gnu/gcj/xlib/Colormap.java gnu/gcj/xlib/Display.java gnu/gcj/xlib/Drawable.java gnu/gcj/xlib/Font.java gnu/gcj/xlib/GC.java gnu/gcj/xlib/Pixmap.java gnu/gcj/xlib/Screen.java gnu/gcj/xlib/Visual.java gnu/gcj/xlib/WMSizeHints.java gnu/gcj/xlib/Window.java gnu/gcj/xlib/WindowAttributes.java gnu/gcj/xlib/XAnyEvent.java gnu/gcj/xlib/XButtonEvent.java gnu/gcj/xlib/XColor.java gnu/gcj/xlib/XConfigureEvent.java gnu/gcj/xlib/XConnectException.java gnu/gcj/xlib/XEvent.java gnu/gcj/xlib/XException.java gnu/gcj/xlib/XExposeEvent.java gnu/gcj/xlib/XID.java gnu/gcj/xlib/XImage.java gnu/gcj/xlib/XUnmapEvent.java gnu/awt/xlib/XCanvasPeer.java gnu/awt/xlib/XEventLoop.java gnu/awt/xlib/XEventQueue.java gnu/awt/xlib/XFontMetrics.java gnu/awt/xlib/XFramePeer.java gnu/awt/xlib/XGraphics.java gnu/awt/xlib/XGraphicsConfiguration.java gnu/awt/xlib/XPanelPeer.java gnu/awt/xlib/XToolkit.java
-
-
-x_nat_source_files = gnu/gcj/xlib/natClip.cc gnu/gcj/xlib/natColormap.cc gnu/gcj/xlib/natDisplay.cc gnu/gcj/xlib/natDrawable.cc gnu/gcj/xlib/natFont.cc gnu/gcj/xlib/natGC.cc gnu/gcj/xlib/natPixmap.cc gnu/gcj/xlib/natScreen.cc gnu/gcj/xlib/natVisual.cc gnu/gcj/xlib/natWMSizeHints.cc gnu/gcj/xlib/natWindow.cc gnu/gcj/xlib/natWindowAttributes.cc gnu/gcj/xlib/natXAnyEvent.cc gnu/gcj/xlib/natXButtonEvent.cc gnu/gcj/xlib/natXColor.cc gnu/gcj/xlib/natXConfigureEvent.cc gnu/gcj/xlib/natXException.cc gnu/gcj/xlib/natXExposeEvent.cc gnu/gcj/xlib/natXImage.cc gnu/gcj/xlib/natXUnmapEvent.cc
+nat_source_files = \
+gnu/gcj/convert/JIS0208_to_Unicode.cc \
+gnu/gcj/convert/JIS0212_to_Unicode.cc \
+gnu/gcj/convert/Unicode_to_JIS.cc \
+gnu/gcj/convert/natIconv.cc \
+gnu/gcj/convert/natInput_EUCJIS.cc \
+gnu/gcj/convert/natInput_SJIS.cc \
+gnu/gcj/convert/natOutput_EUCJIS.cc \
+gnu/gcj/convert/natOutput_SJIS.cc \
+gnu/gcj/io/natSimpleSHSStream.cc \
+gnu/gcj/io/shs.cc \
+java/io/natFile.cc \
+java/io/natFileDescriptor.cc \
+java/io/natObjectInputStream.cc \
+java/io/natObjectOutputStream.cc \
+java/lang/natCharacter.cc \
+java/lang/natClass.cc \
+java/lang/natClassLoader.cc \
+java/lang/natConcreteProcess.cc \
+java/lang/natDouble.cc \
+java/lang/natFloat.cc \
+java/lang/natMath.cc \
+java/lang/natObject.cc \
+java/lang/natRuntime.cc \
+java/lang/natString.cc \
+java/lang/natStringBuffer.cc \
+java/lang/natSystem.cc \
+java/lang/natThread.cc \
+java/lang/natThrowable.cc \
+java/lang/reflect/natArray.cc \
+java/lang/reflect/natConstructor.cc \
+java/lang/reflect/natField.cc \
+java/lang/reflect/natMethod.cc \
+java/net/natInetAddress.cc \
+java/net/natPlainDatagramSocketImpl.cc \
+java/net/natPlainSocketImpl.cc \
+java/text/natCollator.cc \
+java/util/zip/natDeflater.cc \
+java/util/zip/natInflater.cc
+
+
+x_java_source_files = \
+gnu/gcj/xlib/Clip.java \
+gnu/gcj/xlib/Colormap.java \
+gnu/gcj/xlib/Display.java \
+gnu/gcj/xlib/Drawable.java \
+gnu/gcj/xlib/Font.java \
+gnu/gcj/xlib/GC.java \
+gnu/gcj/xlib/Pixmap.java \
+gnu/gcj/xlib/Screen.java \
+gnu/gcj/xlib/Visual.java \
+gnu/gcj/xlib/WMSizeHints.java \
+gnu/gcj/xlib/Window.java \
+gnu/gcj/xlib/WindowAttributes.java \
+gnu/gcj/xlib/XAnyEvent.java \
+gnu/gcj/xlib/XButtonEvent.java \
+gnu/gcj/xlib/XColor.java \
+gnu/gcj/xlib/XConfigureEvent.java \
+gnu/gcj/xlib/XConnectException.java \
+gnu/gcj/xlib/XEvent.java \
+gnu/gcj/xlib/XException.java \
+gnu/gcj/xlib/XExposeEvent.java \
+gnu/gcj/xlib/XID.java \
+gnu/gcj/xlib/XImage.java \
+gnu/gcj/xlib/XUnmapEvent.java \
+gnu/awt/xlib/XCanvasPeer.java \
+gnu/awt/xlib/XEventLoop.java \
+gnu/awt/xlib/XEventQueue.java \
+gnu/awt/xlib/XFontMetrics.java \
+gnu/awt/xlib/XFramePeer.java \
+gnu/awt/xlib/XGraphics.java \
+gnu/awt/xlib/XGraphicsConfiguration.java \
+gnu/awt/xlib/XPanelPeer.java \
+gnu/awt/xlib/XToolkit.java
+
+
+x_nat_source_files = \
+gnu/gcj/xlib/natClip.cc \
+gnu/gcj/xlib/natColormap.cc \
+gnu/gcj/xlib/natDisplay.cc \
+gnu/gcj/xlib/natDrawable.cc \
+gnu/gcj/xlib/natFont.cc \
+gnu/gcj/xlib/natGC.cc \
+gnu/gcj/xlib/natPixmap.cc \
+gnu/gcj/xlib/natScreen.cc \
+gnu/gcj/xlib/natVisual.cc \
+gnu/gcj/xlib/natWMSizeHints.cc \
+gnu/gcj/xlib/natWindow.cc \
+gnu/gcj/xlib/natWindowAttributes.cc \
+gnu/gcj/xlib/natXAnyEvent.cc \
+gnu/gcj/xlib/natXButtonEvent.cc \
+gnu/gcj/xlib/natXColor.cc \
+gnu/gcj/xlib/natXConfigureEvent.cc \
+gnu/gcj/xlib/natXException.cc \
+gnu/gcj/xlib/natXExposeEvent.cc \
+gnu/gcj/xlib/natXImage.cc \
+gnu/gcj/xlib/natXUnmapEvent.cc
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
-AM_MAKEFLAGS = "AR_FLAGS=$(AR_FLAGS)" "CC_FOR_BUILD=$(CC_FOR_BUILD)" "CFLAGS=$(CFLAGS)" "CXXFLAGS=$(CXXFLAGS)" "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" "INSTALL=$(INSTALL)" "INSTALL_DATA=$(INSTALL_DATA)" "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" "JC1FLAGS=$(JC1FLAGS)" "LDFLAGS=$(LDFLAGS)" "LIBCFLAGS=$(LIBCFLAGS)" "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" "MAKE=$(MAKE)" "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" "PICFLAG=$(PICFLAG)" "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" "SHELL=$(SHELL)" "exec_prefix=$(exec_prefix)" "infodir=$(infodir)" "libdir=$(libdir)" "prefix=$(prefix)" "AR=$(AR)" "AS=$(AS)" "CC=$(CC)" "CXX=$(CXX)" "LD=$(LD)" "LIBCFLAGS=$(LIBCFLAGS)" "NM=$(NM)" "PICFLAG=$(PICFLAG)" "RANLIB=$(RANLIB)" "DESTDIR=$(DESTDIR)"
+AM_MAKEFLAGS = \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
+ "JC1FLAGS=$(JC1FLAGS)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
+ "MAKE=$(MAKE)" \
+ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
+ "SHELL=$(SHELL)" \
+ "exec_prefix=$(exec_prefix)" \
+ "infodir=$(infodir)" \
+ "libdir=$(libdir)" \
+ "prefix=$(prefix)" \
+ "AR=$(AR)" \
+ "AS=$(AS)" \
+ "CC=$(CC)" \
+ "CXX=$(CXX)" \
+ "LD=$(LD)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "NM=$(NM)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "DESTDIR=$(DESTDIR)"
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host
.deps/java/lang/StringIndexOutOfBoundsException.P \
.deps/java/lang/System.P .deps/java/lang/Thread.P \
.deps/java/lang/ThreadDeath.P .deps/java/lang/ThreadGroup.P \
-.deps/java/lang/Throwable.P .deps/java/lang/UnknownError.P \
-.deps/java/lang/UnsatisfiedLinkError.P \
+.deps/java/lang/ThreadLocal.P .deps/java/lang/Throwable.P \
+.deps/java/lang/UnknownError.P .deps/java/lang/UnsatisfiedLinkError.P \
.deps/java/lang/UnsupportedOperationException.P \
.deps/java/lang/VerifyError.P .deps/java/lang/VirtualMachineError.P \
.deps/java/lang/Void.P .deps/java/lang/dtoa.P .deps/java/lang/e_acos.P \
.deps/java/util/zip/ZipInputStream.P \
.deps/java/util/zip/ZipOutputStream.P .deps/java/util/zip/natDeflater.P \
.deps/java/util/zip/natInflater.P .deps/jni.P .deps/name-finder.P \
-.deps/no-threads.P .deps/nogc.P .deps/posix-threads.P .deps/posix.P \
-.deps/prims.P .deps/resolve.P
+.deps/no-threads.P .deps/nogc.P .deps/org/w3c/dom/Attr.P \
+.deps/org/w3c/dom/CDATASection.P .deps/org/w3c/dom/CharacterData.P \
+.deps/org/w3c/dom/Comment.P .deps/org/w3c/dom/DOMException.P \
+.deps/org/w3c/dom/DOMImplementation.P .deps/org/w3c/dom/Document.P \
+.deps/org/w3c/dom/DocumentFragment.P .deps/org/w3c/dom/DocumentType.P \
+.deps/org/w3c/dom/Element.P .deps/org/w3c/dom/Entity.P \
+.deps/org/w3c/dom/EntityReference.P .deps/org/w3c/dom/NamedNodeMap.P \
+.deps/org/w3c/dom/Node.P .deps/org/w3c/dom/NodeList.P \
+.deps/org/w3c/dom/Notation.P .deps/org/w3c/dom/ProcessingInstruction.P \
+.deps/org/w3c/dom/Text.P .deps/org/w3c/dom/ranges/DocumentRange.P \
+.deps/org/w3c/dom/ranges/Range.P \
+.deps/org/w3c/dom/ranges/RangeException.P \
+.deps/org/w3c/dom/traversal/DocumentTraversal.P \
+.deps/org/w3c/dom/traversal/NodeFilter.P \
+.deps/org/w3c/dom/traversal/NodeIterator.P \
+.deps/org/w3c/dom/traversal/TreeWalker.P \
+.deps/org/xml/sax/AttributeList.P .deps/org/xml/sax/Attributes.P \
+.deps/org/xml/sax/ContentHandler.P .deps/org/xml/sax/DTDHandler.P \
+.deps/org/xml/sax/DocumentHandler.P .deps/org/xml/sax/EntityResolver.P \
+.deps/org/xml/sax/ErrorHandler.P .deps/org/xml/sax/HandlerBase.P \
+.deps/org/xml/sax/InputSource.P .deps/org/xml/sax/Locator.P \
+.deps/org/xml/sax/Parser.P .deps/org/xml/sax/SAXException.P \
+.deps/org/xml/sax/SAXNotRecognizedException.P \
+.deps/org/xml/sax/SAXNotSupportedException.P \
+.deps/org/xml/sax/SAXParseException.P .deps/org/xml/sax/XMLFilter.P \
+.deps/org/xml/sax/XMLReader.P .deps/org/xml/sax/ext/DeclHandler.P \
+.deps/org/xml/sax/ext/LexicalHandler.P \
+.deps/org/xml/sax/helpers/AttributeListImpl.P \
+.deps/org/xml/sax/helpers/AttributesImpl.P \
+.deps/org/xml/sax/helpers/DefaultHandler.P \
+.deps/org/xml/sax/helpers/LocatorImpl.P \
+.deps/org/xml/sax/helpers/NamespaceSupport.P \
+.deps/org/xml/sax/helpers/ParserAdapter.P \
+.deps/org/xml/sax/helpers/ParserFactory.P \
+.deps/org/xml/sax/helpers/XMLFilterImpl.P \
+.deps/org/xml/sax/helpers/XMLReaderAdapter.P \
+.deps/org/xml/sax/helpers/XMLReaderFactory.P .deps/posix-threads.P \
+.deps/posix.P .deps/prims.P .deps/resolve.P
SOURCES = $(libgcj_la_SOURCES) $(EXTRA_libgcj_la_SOURCES) $(libgcjx_la_SOURCES) $(EXTRA_libgcjx_la_SOURCES) $(jv_convert_SOURCES) $(EXTRA_jv_convert_SOURCES) $(gij_SOURCES) $(gen_from_JIS_SOURCES) $(EXTRA_gen_from_JIS_SOURCES)
OBJECTS = $(libgcj_la_OBJECTS) $(libgcjx_la_OBJECTS) $(jv_convert_OBJECTS) $(gij_OBJECTS) $(gen_from_JIS_OBJECTS)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
- echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
- $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA)
all-redirect: all-recursive
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive
installdirs-am:
$(mkinstalldirs) $(DESTDIR)$(toolexeclibdir) $(DESTDIR)$(bindir) \
done; \
test "$$fail" = no
-@rm -f tmp-list libgcj.jar
- find java gnu -type d -o -type f -name '*.class' | \
+ find java gnu org -type d -o -type f -name '*.class' | \
sed -e '/\/\./d' -e '/\/xlib/d' | \
$(ZIP) cfM0E@ $@
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * The <code>Attr</code> interface represents an attribute in an \r
+ * <code>Element</code> object. Typically the allowable values for the \r
+ * attribute are defined in a document type definition.\r
+ * <p><code>Attr</code> objects inherit the <code>Node</code> interface, but \r
+ * since they are not actually child nodes of the element they describe, the \r
+ * DOM does not consider them part of the document tree. Thus, the \r
+ * <code>Node</code> attributes <code>parentNode</code>, \r
+ * <code>previousSibling</code>, and <code>nextSibling</code> have a \r
+ * <code>null</code> value for <code>Attr</code> objects. The DOM takes the \r
+ * view that attributes are properties of elements rather than having a \r
+ * separate identity from the elements they are associated with; this should \r
+ * make it more efficient to implement such features as default attributes \r
+ * associated with all elements of a given type. Furthermore, \r
+ * <code>Attr</code> nodes may not be immediate children of a \r
+ * <code>DocumentFragment</code>. However, they can be associated with \r
+ * <code>Element</code> nodes contained within a \r
+ * <code>DocumentFragment</code>. In short, users and implementors of the \r
+ * DOM need to be aware that <code>Attr</code> nodes have some things in \r
+ * common with other objects inheriting the <code>Node</code> interface, but \r
+ * they also are quite distinct.\r
+ * <p> The attribute's effective value is determined as follows: if this \r
+ * attribute has been explicitly assigned any value, that value is the \r
+ * attribute's effective value; otherwise, if there is a declaration for \r
+ * this attribute, and that declaration includes a default value, then that \r
+ * default value is the attribute's effective value; otherwise, the \r
+ * attribute does not exist on this element in the structure model until it \r
+ * has been explicitly added. Note that the <code>nodeValue</code> attribute \r
+ * on the <code>Attr</code> instance can also be used to retrieve the string \r
+ * version of the attribute's value(s). \r
+ * <p>In XML, where the value of an attribute can contain entity references, \r
+ * the child nodes of the <code>Attr</code> node may be either \r
+ * <code>Text</code> or <code>EntityReference</code> nodes (when these are \r
+ * in use; see the description of <code>EntityReference</code> for \r
+ * discussion). Because the DOM Core is not aware of attribute types, it \r
+ * treats all attribute values as simple strings, even if the DTD or schema \r
+ * declares them as having tokenized types. \r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface Attr extends Node {\r
+ /**\r
+ * Returns the name of this attribute. \r
+ */\r
+ public String getName();\r
+\r
+ /**\r
+ * If this attribute was explicitly given a value in the original \r
+ * document, this is <code>true</code>; otherwise, it is \r
+ * <code>false</code>. Note that the implementation is in charge of this \r
+ * attribute, not the user. If the user changes the value of the \r
+ * attribute (even if it ends up having the same value as the default \r
+ * value) then the <code>specified</code> flag is automatically flipped \r
+ * to <code>true</code>. To re-specify the attribute as the default \r
+ * value from the DTD, the user must delete the attribute. The \r
+ * implementation will then make a new attribute available with \r
+ * <code>specified</code> set to <code>false</code> and the default \r
+ * value (if one exists).\r
+ * <br>In summary: If the attribute has an assigned value in the document \r
+ * then <code>specified</code> is <code>true</code>, and the value is \r
+ * the assigned value. If the attribute has no assigned value in the \r
+ * document and has a default value in the DTD, then \r
+ * <code>specified</code> is <code>false</code>, and the value is the \r
+ * default value in the DTD. If the attribute has no assigned value in \r
+ * the document and has a value of #IMPLIED in the DTD, then the \r
+ * attribute does not appear in the structure model of the document. If \r
+ * the <code>ownerElement</code> attribute is <code>null</code> (i.e. \r
+ * because it was just created or was set to <code>null</code> by the \r
+ * various removal and cloning operations) <code>specified</code> is \r
+ * <code>true</code>. \r
+ */\r
+ public boolean getSpecified();\r
+\r
+ /**\r
+ * On retrieval, the value of the attribute is returned as a string. \r
+ * Character and general entity references are replaced with their \r
+ * values. See also the method <code>getAttribute</code> on the \r
+ * <code>Element</code> interface.\r
+ * <br>On setting, this creates a <code>Text</code> node with the unparsed \r
+ * contents of the string. I.e. any characters that an XML processor \r
+ * would recognize as markup are instead treated as literal text. See \r
+ * also the method <code>setAttribute</code> on the <code>Element</code> \r
+ * interface.\r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.\r
+ */\r
+ public String getValue();\r
+ public void setValue(String value)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * The <code>Element</code> node this attribute is attached to or \r
+ * <code>null</code> if this attribute is not in use.\r
+ * @since DOM Level 2\r
+ */\r
+ public Element getOwnerElement();\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * CDATA sections are used to escape blocks of text containing characters that \r
+ * would otherwise be regarded as markup. The only delimiter that is \r
+ * recognized in a CDATA section is the "]]>" string that ends the CDATA \r
+ * section. CDATA sections cannot be nested. Their primary purpose is for \r
+ * including material such as XML fragments, without needing to escape all \r
+ * the delimiters.\r
+ * <p>The <code>DOMString</code> attribute of the <code>Text</code> node holds \r
+ * the text that is contained by the CDATA section. Note that this may \r
+ * contain characters that need to be escaped outside of CDATA sections and \r
+ * that, depending on the character encoding ("charset") chosen for \r
+ * serialization, it may be impossible to write out some characters as part \r
+ * of a CDATA section. \r
+ * <p> The <code>CDATASection</code> interface inherits from the \r
+ * <code>CharacterData</code> interface through the <code>Text</code> \r
+ * interface. Adjacent <code>CDATASection</code> nodes are not merged by use \r
+ * of the <code>normalize</code> method of the <code>Node</code> interface.\r
+ * Because no markup is recognized within a <code>CDATASection</code>, \r
+ * character numeric references cannot be used as an escape mechanism when \r
+ * serializing. Therefore, action needs to be taken when serializing a \r
+ * <code>CDATASection</code> with a character encoding where some of the \r
+ * contained characters cannot be represented. Failure to do so would not \r
+ * produce well-formed XML.One potential solution in the serialization \r
+ * process is to end the CDATA section before the character, output the \r
+ * character using a character reference or entity reference, and open a new \r
+ * CDATA section for any further characters in the text node. Note, however, \r
+ * that some code conversion libraries at the time of writing do not return \r
+ * an error or exception when a character is missing from the encoding, \r
+ * making the task of ensuring that data is not corrupted on serialization \r
+ * more difficult.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface CDATASection extends Text {\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * The <code>CharacterData</code> interface extends Node with a set of \r
+ * attributes and methods for accessing character data in the DOM. For \r
+ * clarity this set is defined here rather than on each object that uses \r
+ * these attributes and methods. No DOM objects correspond directly to \r
+ * <code>CharacterData</code>, though <code>Text</code> and others do \r
+ * inherit the interface from it. All <code>offsets</code> in this interface \r
+ * start from <code>0</code>.\r
+ * <p>As explained in the <code>DOMString</code> interface, text strings in \r
+ * the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In \r
+ * the following, the term 16-bit units is used whenever necessary to \r
+ * indicate that indexing on CharacterData is done in 16-bit units.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface CharacterData extends Node {\r
+ /**\r
+ * The character data of the node that implements this interface. The DOM \r
+ * implementation may not put arbitrary limits on the amount of data \r
+ * that may be stored in a <code>CharacterData</code> node. However, \r
+ * implementation limits may mean that the entirety of a node's data may \r
+ * not fit into a single <code>DOMString</code>. In such cases, the user \r
+ * may call <code>substringData</code> to retrieve the data in \r
+ * appropriately sized pieces.\r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.\r
+ * @exception DOMException\r
+ * DOMSTRING_SIZE_ERR: Raised when it would return more characters than \r
+ * fit in a <code>DOMString</code> variable on the implementation \r
+ * platform.\r
+ */\r
+ public String getData()\r
+ throws DOMException;\r
+ public void setData(String data)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * The number of 16-bit units that are available through <code>data</code> \r
+ * and the <code>substringData</code> method below. This may have the \r
+ * value zero, i.e., <code>CharacterData</code> nodes may be empty.\r
+ */\r
+ public int getLength();\r
+\r
+ /**\r
+ * Extracts a range of data from the node.\r
+ * @param offsetStart offset of substring to extract.\r
+ * @param countThe number of 16-bit units to extract.\r
+ * @return The specified substring. If the sum of <code>offset</code> and \r
+ * <code>count</code> exceeds the <code>length</code>, then all 16-bit \r
+ * units to the end of the data are returned.\r
+ * @exception DOMException\r
+ * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is \r
+ * negative or greater than the number of 16-bit units in \r
+ * <code>data</code>, or if the specified <code>count</code> is \r
+ * negative.\r
+ * <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does \r
+ * not fit into a <code>DOMString</code>.\r
+ */\r
+ public String substringData(int offset, \r
+ int count)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Append the string to the end of the character data of the node. Upon \r
+ * success, <code>data</code> provides access to the concatenation of \r
+ * <code>data</code> and the <code>DOMString</code> specified.\r
+ * @param argThe <code>DOMString</code> to append.\r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ */\r
+ public void appendData(String arg)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Insert a string at the specified 16-bit unit offset.\r
+ * @param offsetThe character offset at which to insert.\r
+ * @param argThe <code>DOMString</code> to insert.\r
+ * @exception DOMException\r
+ * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is \r
+ * negative or greater than the number of 16-bit units in \r
+ * <code>data</code>.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ */\r
+ public void insertData(int offset, \r
+ String arg)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Remove a range of 16-bit units from the node. Upon success, \r
+ * <code>data</code> and <code>length</code> reflect the change.\r
+ * @param offsetThe offset from which to start removing.\r
+ * @param countThe number of 16-bit units to delete. If the sum of \r
+ * <code>offset</code> and <code>count</code> exceeds \r
+ * <code>length</code> then all 16-bit units from <code>offset</code> \r
+ * to the end of the data are deleted.\r
+ * @exception DOMException\r
+ * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is \r
+ * negative or greater than the number of 16-bit units in \r
+ * <code>data</code>, or if the specified <code>count</code> is \r
+ * negative.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ */\r
+ public void deleteData(int offset, \r
+ int count)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Replace the characters starting at the specified 16-bit unit offset \r
+ * with the specified string.\r
+ * @param offsetThe offset from which to start replacing.\r
+ * @param countThe number of 16-bit units to replace. If the sum of \r
+ * <code>offset</code> and <code>count</code> exceeds \r
+ * <code>length</code>, then all 16-bit units to the end of the data \r
+ * are replaced; (i.e., the effect is the same as a <code>remove</code>\r
+ * method call with the same range, followed by an <code>append</code>\r
+ * method invocation).\r
+ * @param argThe <code>DOMString</code> with which the range must be \r
+ * replaced.\r
+ * @exception DOMException\r
+ * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is \r
+ * negative or greater than the number of 16-bit units in \r
+ * <code>data</code>, or if the specified <code>count</code> is \r
+ * negative.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ */\r
+ public void replaceData(int offset, \r
+ int count, \r
+ String arg)\r
+ throws DOMException;\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * This interface inherits from <code>CharacterData</code> and represents the \r
+ * content of a comment, i.e., all the characters between the starting '\r
+ * <code><!--</code>' and ending '<code>--></code>'. Note that this is \r
+ * the definition of a comment in XML, and, in practice, HTML, although some \r
+ * HTML tools may implement the full SGML comment structure.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface Comment extends CharacterData {\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * DOM operations only raise exceptions in "exceptional" circumstances, i.e., \r
+ * when an operation is impossible to perform (either for logical reasons, \r
+ * because data is lost, or because the implementation has become unstable). \r
+ * In general, DOM methods return specific error values in ordinary \r
+ * processing situations, such as out-of-bound errors when using \r
+ * <code>NodeList</code>. \r
+ * <p>Implementations should raise other exceptions under other circumstances. \r
+ * For example, implementations should raise an implementation-dependent \r
+ * exception if a <code>null</code> argument is passed. \r
+ * <p>Some languages and object systems do not support the concept of \r
+ * exceptions. For such systems, error conditions may be indicated using \r
+ * native error reporting mechanisms. For some bindings, for example, \r
+ * methods may return error codes similar to those listed in the \r
+ * corresponding method descriptions.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public class DOMException extends RuntimeException {\r
+ public DOMException(short code, String message) {\r
+ super(message);\r
+ this.code = code;\r
+ }\r
+ /** @serial */\r
+ public short code;\r
+ // ExceptionCode\r
+ /**\r
+ * If index or size is negative, or greater than the allowed value\r
+ */\r
+ public static final short INDEX_SIZE_ERR = 1;\r
+ /**\r
+ * If the specified range of text does not fit into a DOMString\r
+ */\r
+ public static final short DOMSTRING_SIZE_ERR = 2;\r
+ /**\r
+ * If any node is inserted somewhere it doesn't belong\r
+ */\r
+ public static final short HIERARCHY_REQUEST_ERR = 3;\r
+ /**\r
+ * If a node is used in a different document than the one that created it \r
+ * (that doesn't support it)\r
+ */\r
+ public static final short WRONG_DOCUMENT_ERR = 4;\r
+ /**\r
+ * If an invalid or illegal character is specified, such as in a name. See \r
+ * production 2 in the XML specification for the definition of a legal \r
+ * character, and production 5 for the definition of a legal name \r
+ * character.\r
+ */\r
+ public static final short INVALID_CHARACTER_ERR = 5;\r
+ /**\r
+ * If data is specified for a node which does not support data\r
+ */\r
+ public static final short NO_DATA_ALLOWED_ERR = 6;\r
+ /**\r
+ * If an attempt is made to modify an object where modifications are not \r
+ * allowed\r
+ */\r
+ public static final short NO_MODIFICATION_ALLOWED_ERR = 7;\r
+ /**\r
+ * If an attempt is made to reference a node in a context where it does \r
+ * not exist\r
+ */\r
+ public static final short NOT_FOUND_ERR = 8;\r
+ /**\r
+ * If the implementation does not support the requested type of object or \r
+ * operation.\r
+ */\r
+ public static final short NOT_SUPPORTED_ERR = 9;\r
+ /**\r
+ * If an attempt is made to add an attribute that is already in use \r
+ * elsewhere\r
+ */\r
+ public static final short INUSE_ATTRIBUTE_ERR = 10;\r
+ /**\r
+ * If an attempt is made to use an object that is not, or is no longer, \r
+ * usable.\r
+ * @since DOM Level 2\r
+ */\r
+ public static final short INVALID_STATE_ERR = 11;\r
+ /**\r
+ * If an invalid or illegal string is specified.\r
+ * @since DOM Level 2\r
+ */\r
+ public static final short SYNTAX_ERR = 12;\r
+ /**\r
+ * If an attempt is made to modify the type of the underlying object.\r
+ * @since DOM Level 2\r
+ */\r
+ public static final short INVALID_MODIFICATION_ERR = 13;\r
+ /**\r
+ * If an attempt is made to create or change an object in a way which is \r
+ * incorrect with regard to namespaces.\r
+ * @since DOM Level 2\r
+ */\r
+ public static final short NAMESPACE_ERR = 14;\r
+ /**\r
+ * If a parameter or an operation is not supported by the underlying \r
+ * object.\r
+ * @since DOM Level 2\r
+ */\r
+ public static final short INVALID_ACCESS_ERR = 15;\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * The <code>DOMImplementation</code> interface provides a number of methods \r
+ * for performing operations that are independent of any particular instance \r
+ * of the document object model.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface DOMImplementation {\r
+ /**\r
+ * Test if the DOM implementation implements a specific feature.\r
+ * @param featureThe name of the feature to test (case-insensitive). The \r
+ * values used by DOM features are defined throughout the DOM Level 2 \r
+ * specifications and listed in the section. The name must be an XML \r
+ * name. To avoid possible conflicts, as a convention, names referring \r
+ * to features defined outside the DOM specification should be made \r
+ * unique by reversing the name of the Internet domain name of the \r
+ * person (or the organization that the person belongs to) who defines \r
+ * the feature, component by component, and using this as a prefix. \r
+ * For instance, the W3C SVG Working Group defines the feature \r
+ * "org.w3c.dom.svg".\r
+ * @param versionThis is the version number of the feature to test. In \r
+ * Level 2, the string can be either "2.0" or "1.0". If the version is \r
+ * not specified, supporting any version of the feature causes the \r
+ * method to return <code>true</code>.\r
+ * @return <code>true</code> if the feature is implemented in the \r
+ * specified version, <code>false</code> otherwise.\r
+ */\r
+ public boolean hasFeature(String feature, \r
+ String version);\r
+\r
+ /**\r
+ * Creates an empty <code>DocumentType</code> node. Entity declarations \r
+ * and notations are not made available. Entity reference expansions and \r
+ * default attribute additions do not occur. It is expected that a \r
+ * future version of the DOM will provide a way for populating a \r
+ * <code>DocumentType</code>.\r
+ * <br>HTML-only DOM implementations do not need to implement this method.\r
+ * @param qualifiedNameThe qualified name of the document type to be \r
+ * created. \r
+ * @param publicIdThe external subset public identifier.\r
+ * @param systemIdThe external subset system identifier.\r
+ * @return A new <code>DocumentType</code> node with \r
+ * <code>Node.ownerDocument</code> set to <code>null</code>.\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name \r
+ * contains an illegal character.\r
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is \r
+ * malformed.\r
+ * @since DOM Level 2\r
+ */\r
+ public DocumentType createDocumentType(String qualifiedName, \r
+ String publicId, \r
+ String systemId)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Creates an XML <code>Document</code> object of the specified type with \r
+ * its document element. HTML-only DOM implementations do not need to \r
+ * implement this method.\r
+ * @param namespaceURIThe namespace URI of the document element to create.\r
+ * @param qualifiedNameThe qualified name of the document element to be \r
+ * created.\r
+ * @param doctypeThe type of document to be created or <code>null</code>.\r
+ * When <code>doctype</code> is not <code>null</code>, its \r
+ * <code>Node.ownerDocument</code> attribute is set to the document \r
+ * being created.\r
+ * @return A new <code>Document</code> object.\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name \r
+ * contains an illegal character.\r
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is \r
+ * malformed, if the <code>qualifiedName</code> has a prefix and the \r
+ * <code>namespaceURI</code> is <code>null</code>, or if the \r
+ * <code>qualifiedName</code> has a prefix that is "xml" and the \r
+ * <code>namespaceURI</code> is different from "\r
+ * http://www.w3.org/XML/1998/namespace" .\r
+ * <br>WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already \r
+ * been used with a different document or was created from a different \r
+ * implementation.\r
+ * @since DOM Level 2\r
+ */\r
+ public Document createDocument(String namespaceURI, \r
+ String qualifiedName, \r
+ DocumentType doctype)\r
+ throws DOMException;\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * The <code>Document</code> interface represents the entire HTML or XML \r
+ * document. Conceptually, it is the root of the document tree, and provides \r
+ * the primary access to the document's data.\r
+ * <p>Since elements, text nodes, comments, processing instructions, etc. \r
+ * cannot exist outside the context of a <code>Document</code>, the \r
+ * <code>Document</code> interface also contains the factory methods needed \r
+ * to create these objects. The <code>Node</code> objects created have a \r
+ * <code>ownerDocument</code> attribute which associates them with the \r
+ * <code>Document</code> within whose context they were created.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface Document extends Node {\r
+ /**\r
+ * The Document Type Declaration (see <code>DocumentType</code>) \r
+ * associated with this document. For HTML documents as well as XML \r
+ * documents without a document type declaration this returns \r
+ * <code>null</code>. The DOM Level 2 does not support editing the \r
+ * Document Type Declaration. <code>docType</code> cannot be altered in \r
+ * any way, including through the use of methods inherited from the \r
+ * <code>Node</code> interface, such as <code>insertNode</code> or \r
+ * <code>removeNode</code>.\r
+ */\r
+ public DocumentType getDoctype();\r
+\r
+ /**\r
+ * The <code>DOMImplementation</code> object that handles this document. A \r
+ * DOM application may use objects from multiple implementations.\r
+ */\r
+ public DOMImplementation getImplementation();\r
+\r
+ /**\r
+ * This is a convenience attribute that allows direct access to the child \r
+ * node that is the root element of the document. For HTML documents, \r
+ * this is the element with the tagName "HTML".\r
+ */\r
+ public Element getDocumentElement();\r
+\r
+ /**\r
+ * Creates an element of the type specified. Note that the instance \r
+ * returned implements the <code>Element</code> interface, so attributes \r
+ * can be specified directly on the returned object.\r
+ * <br>In addition, if there are known attributes with default values, \r
+ * <code>Attr</code> nodes representing them are automatically created \r
+ * and attached to the element.\r
+ * <br>To create an element with a qualified name and namespace URI, use \r
+ * the <code>createElementNS</code> method.\r
+ * @param tagNameThe name of the element type to instantiate. For XML, \r
+ * this is case-sensitive. For HTML, the <code>tagName</code> \r
+ * parameter may be provided in any case, but it must be mapped to the \r
+ * canonical uppercase form by the DOM implementation. \r
+ * @return A new <code>Element</code> object with the \r
+ * <code>nodeName</code> attribute set to <code>tagName</code>, and \r
+ * <code>localName</code>, <code>prefix</code>, and \r
+ * <code>namespaceURI</code> set to <code>null</code>.\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified name contains an \r
+ * illegal character.\r
+ */\r
+ public Element createElement(String tagName)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Creates an empty <code>DocumentFragment</code> object. \r
+ * @return A new <code>DocumentFragment</code>.\r
+ */\r
+ public DocumentFragment createDocumentFragment();\r
+\r
+ /**\r
+ * Creates a <code>Text</code> node given the specified string.\r
+ * @param dataThe data for the node.\r
+ * @return The new <code>Text</code> object.\r
+ */\r
+ public Text createTextNode(String data);\r
+\r
+ /**\r
+ * Creates a <code>Comment</code> node given the specified string.\r
+ * @param dataThe data for the node.\r
+ * @return The new <code>Comment</code> object.\r
+ */\r
+ public Comment createComment(String data);\r
+\r
+ /**\r
+ * Creates a <code>CDATASection</code> node whose value is the specified \r
+ * string.\r
+ * @param dataThe data for the <code>CDATASection</code> contents.\r
+ * @return The new <code>CDATASection</code> object.\r
+ * @exception DOMException\r
+ * NOT_SUPPORTED_ERR: Raised if this document is an HTML document.\r
+ */\r
+ public CDATASection createCDATASection(String data)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Creates a <code>ProcessingInstruction</code> node given the specified \r
+ * name and data strings.\r
+ * @param targetThe target part of the processing instruction.\r
+ * @param dataThe data for the node.\r
+ * @return The new <code>ProcessingInstruction</code> object.\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified target contains an \r
+ * illegal character.\r
+ * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.\r
+ */\r
+ public ProcessingInstruction createProcessingInstruction(String target, \r
+ String data)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Creates an <code>Attr</code> of the given name. Note that the \r
+ * <code>Attr</code> instance can then be set on an <code>Element</code> \r
+ * using the <code>setAttributeNode</code> method. \r
+ * <br>To create an attribute with a qualified name and namespace URI, use \r
+ * the <code>createAttributeNS</code> method.\r
+ * @param nameThe name of the attribute.\r
+ * @return A new <code>Attr</code> object with the <code>nodeName</code> \r
+ * attribute set to <code>name</code>, and <code>localName</code>, \r
+ * <code>prefix</code>, and <code>namespaceURI</code> set to \r
+ * <code>null</code>. The value of the attribute is the empty string.\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified name contains an \r
+ * illegal character.\r
+ */\r
+ public Attr createAttribute(String name)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Creates an <code>EntityReference</code> object. In addition, if the \r
+ * referenced entity is known, the child list of the \r
+ * <code>EntityReference</code> node is made the same as that of the \r
+ * corresponding <code>Entity</code> node.If any descendant of the \r
+ * <code>Entity</code> node has an unbound namespace prefix, the \r
+ * corresponding descendant of the created <code>EntityReference</code> \r
+ * node is also unbound; (its <code>namespaceURI</code> is \r
+ * <code>null</code>). The DOM Level 2 does not support any mechanism to \r
+ * resolve namespace prefixes.\r
+ * @param nameThe name of the entity to reference. \r
+ * @return The new <code>EntityReference</code> object.\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified name contains an \r
+ * illegal character.\r
+ * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.\r
+ */\r
+ public EntityReference createEntityReference(String name)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Returns a <code>NodeList</code> of all the <code>Elements</code> with a \r
+ * given tag name in the order in which they are encountered in a \r
+ * preorder traversal of the <code>Document</code> tree. \r
+ * @param tagnameThe name of the tag to match on. The special value "*" \r
+ * matches all tags.\r
+ * @return A new <code>NodeList</code> object containing all the matched \r
+ * <code>Elements</code>.\r
+ */\r
+ public NodeList getElementsByTagName(String tagname);\r
+\r
+ /**\r
+ * Imports a node from another document to this document. The returned \r
+ * node has no parent; (<code>parentNode</code> is <code>null</code>). \r
+ * The source node is not altered or removed from the original document; \r
+ * this method creates a new copy of the source node.\r
+ * <br>For all nodes, importing a node creates a node object owned by the \r
+ * importing document, with attribute values identical to the source \r
+ * node's <code>nodeName</code> and <code>nodeType</code>, plus the \r
+ * attributes related to namespaces (<code>prefix</code>, \r
+ * <code>localName</code>, and <code>namespaceURI</code>). As in the \r
+ * <code>cloneNode</code> operation on a <code>Node</code>, the source \r
+ * node is not altered.\r
+ * <br>Additional information is copied as appropriate to the \r
+ * <code>nodeType</code>, attempting to mirror the behavior expected if \r
+ * a fragment of XML or HTML source was copied from one document to \r
+ * another, recognizing that the two documents may have different DTDs \r
+ * in the XML case. The following list describes the specifics for each \r
+ * type of node. \r
+ * <dl>\r
+ * <dt>ATTRIBUTE_NODE</dt>\r
+ * <dd>The <code>ownerElement</code> attribute \r
+ * is set to <code>null</code> and the <code>specified</code> flag is \r
+ * set to <code>true</code> on the generated <code>Attr</code>. The \r
+ * descendants of the source <code>Attr</code> are recursively imported \r
+ * and the resulting nodes reassembled to form the corresponding subtree.\r
+ * Note that the <code>deep</code> parameter has no effect on \r
+ * <code>Attr</code> nodes; they always carry their children with them \r
+ * when imported.</dd>\r
+ * <dt>DOCUMENT_FRAGMENT_NODE</dt>\r
+ * <dd>If the <code>deep</code> option \r
+ * was set to <code>true</code>, the descendants of the source element \r
+ * are recursively imported and the resulting nodes reassembled to form \r
+ * the corresponding subtree. Otherwise, this simply generates an empty \r
+ * <code>DocumentFragment</code>.</dd>\r
+ * <dt>DOCUMENT_NODE</dt>\r
+ * <dd><code>Document</code> \r
+ * nodes cannot be imported.</dd>\r
+ * <dt>DOCUMENT_TYPE_NODE</dt>\r
+ * <dd><code>DocumentType</code> \r
+ * nodes cannot be imported.</dd>\r
+ * <dt>ELEMENT_NODE</dt>\r
+ * <dd>Specified attribute nodes of the \r
+ * source element are imported, and the generated <code>Attr</code> \r
+ * nodes are attached to the generated <code>Element</code>. Default \r
+ * attributes are not copied, though if the document being imported into \r
+ * defines default attributes for this element name, those are assigned. \r
+ * If the <code>importNode</code> <code>deep</code> parameter was set to \r
+ * <code>true</code>, the descendants of the source element are \r
+ * recursively imported and the resulting nodes reassembled to form the \r
+ * corresponding subtree.</dd>\r
+ * <dt>ENTITY_NODE</dt>\r
+ * <dd><code>Entity</code> nodes can be \r
+ * imported, however in the current release of the DOM the \r
+ * <code>DocumentType</code> is readonly. Ability to add these imported \r
+ * nodes to a <code>DocumentType</code> will be considered for addition \r
+ * to a future release of the DOM.On import, the <code>publicId</code>, \r
+ * <code>systemId</code>, and <code>notationName</code> attributes are \r
+ * copied. If a <code>deep</code> import is requested, the descendants \r
+ * of the the source <code>Entity</code> are recursively imported and \r
+ * the resulting nodes reassembled to form the corresponding subtree.</dd>\r
+ * <dt>\r
+ * ENTITY_REFERENCE_NODE</dt>\r
+ * <dd>Only the <code>EntityReference</code> itself is \r
+ * copied, even if a <code>deep</code> import is requested, since the \r
+ * source and destination documents might have defined the entity \r
+ * differently. If the document being imported into provides a \r
+ * definition for this entity name, its value is assigned.</dd>\r
+ * <dt>NOTATION_NODE</dt>\r
+ * <dd>\r
+ * <code>Notation</code> nodes can be imported, however in the current \r
+ * release of the DOM the <code>DocumentType</code> is readonly. Ability \r
+ * to add these imported nodes to a <code>DocumentType</code> will be \r
+ * considered for addition to a future release of the DOM.On import, the \r
+ * <code>publicId</code> and <code>systemId</code> attributes are copied.\r
+ * Note that the <code>deep</code> parameter has no effect on \r
+ * <code>Notation</code> nodes since they never have any children.</dd>\r
+ * <dt>\r
+ * PROCESSING_INSTRUCTION_NODE</dt>\r
+ * <dd>The imported node copies its \r
+ * <code>target</code> and <code>data</code> values from those of the \r
+ * source node.</dd>\r
+ * <dt>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE</dt>\r
+ * <dd>These three \r
+ * types of nodes inheriting from <code>CharacterData</code> copy their \r
+ * <code>data</code> and <code>length</code> attributes from those of \r
+ * the source node.</dd>\r
+ * \r
+ * @param importedNodeThe node to import.\r
+ * @param deepIf <code>true</code>, recursively import the subtree under \r
+ * the specified node; if <code>false</code>, import only the node \r
+ * itself, as explained above. This has no effect on <code>Attr</code>\r
+ * , <code>EntityReference</code>, and <code>Notation</code> nodes.\r
+ * @return The imported node that belongs to this <code>Document</code>.\r
+ * @exception DOMException\r
+ * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not \r
+ * supported.\r
+ * @since DOM Level 2\r
+ */\r
+ public Node importNode(Node importedNode, \r
+ boolean deep)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Creates an element of the given qualified name and namespace URI. \r
+ * HTML-only DOM implementations do not need to implement this method.\r
+ * @param namespaceURIThe namespace URI of the element to create.\r
+ * @param qualifiedNameThe qualified name of the element type to \r
+ * instantiate.\r
+ * @return A new <code>Element</code> object with the following \r
+ * attributes:AttributeValue<code>Node.nodeName</code>\r
+ * <code>qualifiedName</code><code>Node.namespaceURI</code>\r
+ * <code>namespaceURI</code><code>Node.prefix</code>prefix, extracted \r
+ * from <code>qualifiedName</code>, or <code>null</code> if there is \r
+ * no prefix<code>Node.localName</code>local name, extracted from \r
+ * <code>qualifiedName</code><code>Element.tagName</code>\r
+ * <code>qualifiedName</code>\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name \r
+ * contains an illegal character.\r
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is \r
+ * malformed, if the <code>qualifiedName</code> has a prefix and the \r
+ * <code>namespaceURI</code> is <code>null</code>, or if the \r
+ * <code>qualifiedName</code> has a prefix that is "xml" and the \r
+ * <code>namespaceURI</code> is different from "\r
+ * http://www.w3.org/XML/1998/namespace" .\r
+ * @since DOM Level 2\r
+ */\r
+ public Element createElementNS(String namespaceURI, \r
+ String qualifiedName)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Creates an attribute of the given qualified name and namespace URI. \r
+ * HTML-only DOM implementations do not need to implement this method.\r
+ * @param namespaceURIThe namespace URI of the attribute to create.\r
+ * @param qualifiedNameThe qualified name of the attribute to instantiate.\r
+ * @return A new <code>Attr</code> object with the following attributes:\r
+ * AttributeValue<code>Node.nodeName</code>qualifiedName\r
+ * <code>Node.namespaceURI</code><code>namespaceURI</code>\r
+ * <code>Node.prefix</code>prefix, extracted from \r
+ * <code>qualifiedName</code>, or <code>null</code> if there is no \r
+ * prefix<code>Node.localName</code>local name, extracted from \r
+ * <code>qualifiedName</code><code>Attr.name</code>\r
+ * <code>qualifiedName</code><code>Node.nodeValue</code>the empty \r
+ * string\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name \r
+ * contains an illegal character.\r
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is \r
+ * malformed, if the <code>qualifiedName</code> has a prefix and the \r
+ * <code>namespaceURI</code> is <code>null</code>, if the \r
+ * <code>qualifiedName</code> has a prefix that is "xml" and the \r
+ * <code>namespaceURI</code> is different from "\r
+ * http://www.w3.org/XML/1998/namespace", or if the \r
+ * <code>qualifiedName</code> is "xmlns" and the \r
+ * <code>namespaceURI</code> is different from "\r
+ * http://www.w3.org/2000/xmlns/".\r
+ * @since DOM Level 2\r
+ */\r
+ public Attr createAttributeNS(String namespaceURI, \r
+ String qualifiedName)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Returns a <code>NodeList</code> of all the <code>Elements</code> with a \r
+ * given local name and namespace URI in the order in which they are \r
+ * encountered in a preorder traversal of the <code>Document</code> tree.\r
+ * @param namespaceURIThe namespace URI of the elements to match on. The \r
+ * special value "*" matches all namespaces.\r
+ * @param localNameThe local name of the elements to match on. The \r
+ * special value "*" matches all local names.\r
+ * @return A new <code>NodeList</code> object containing all the matched \r
+ * <code>Elements</code>.\r
+ * @since DOM Level 2\r
+ */\r
+ public NodeList getElementsByTagNameNS(String namespaceURI, \r
+ String localName);\r
+\r
+ /**\r
+ * Returns the <code>Element</code> whose <code>ID</code> is given by \r
+ * <code>elementId</code>. If no such element exists, returns \r
+ * <code>null</code>. Behavior is not defined if more than one element \r
+ * has this <code>ID</code>. The DOM implementation must have \r
+ * information that says which attributes are of type ID. Attributes \r
+ * with the name "ID" are not of type ID unless so defined. \r
+ * Implementations that do not know whether attributes are of type ID or \r
+ * not are expected to return <code>null</code>.\r
+ * @param elementIdThe unique <code>id</code> value for an element.\r
+ * @return The matching element.\r
+ * @since DOM Level 2\r
+ */\r
+ public Element getElementById(String elementId);\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * <code>DocumentFragment</code> is a "lightweight" or "minimal" \r
+ * <code>Document</code> object. It is very common to want to be able to \r
+ * extract a portion of a document's tree or to create a new fragment of a \r
+ * document. Imagine implementing a user command like cut or rearranging a \r
+ * document by moving fragments around. It is desirable to have an object \r
+ * which can hold such fragments and it is quite natural to use a Node for \r
+ * this purpose. While it is true that a <code>Document</code> object could \r
+ * fulfill this role, a <code>Document</code> object can potentially be a \r
+ * heavyweight object, depending on the underlying implementation. What is \r
+ * really needed for this is a very lightweight object. \r
+ * <code>DocumentFragment</code> is such an object.\r
+ * <p>Furthermore, various operations -- such as inserting nodes as children \r
+ * of another <code>Node</code> -- may take <code>DocumentFragment</code> \r
+ * objects as arguments; this results in all the child nodes of the \r
+ * <code>DocumentFragment</code> being moved to the child list of this node.\r
+ * <p>The children of a <code>DocumentFragment</code> node are zero or more \r
+ * nodes representing the tops of any sub-trees defining the structure of \r
+ * the document. <code>DocumentFragment</code> nodes do not need to be \r
+ * well-formed XML documents (although they do need to follow the rules \r
+ * imposed upon well-formed XML parsed entities, which can have multiple top \r
+ * nodes). For example, a <code>DocumentFragment</code> might have only one \r
+ * child and that child node could be a <code>Text</code> node. Such a \r
+ * structure model represents neither an HTML document nor a well-formed XML \r
+ * document.\r
+ * <p>When a <code>DocumentFragment</code> is inserted into a \r
+ * <code>Document</code> (or indeed any other <code>Node</code> that may \r
+ * take children) the children of the <code>DocumentFragment</code> and not \r
+ * the <code>DocumentFragment</code> itself are inserted into the \r
+ * <code>Node</code>. This makes the <code>DocumentFragment</code> very \r
+ * useful when the user wishes to create nodes that are siblings; the \r
+ * <code>DocumentFragment</code> acts as the parent of these nodes so that \r
+ * the user can use the standard methods from the <code>Node</code> \r
+ * interface, such as <code>insertBefore</code> and <code>appendChild</code>.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface DocumentFragment extends Node {\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * Each <code>Document</code> has a <code>doctype</code> attribute whose value \r
+ * is either <code>null</code> or a <code>DocumentType</code> object. The \r
+ * <code>DocumentType</code> interface in the DOM Core provides an interface \r
+ * to the list of entities that are defined for the document, and little \r
+ * else because the effect of namespaces and the various XML schema efforts \r
+ * on DTD representation are not clearly understood as of this writing.\r
+ * <p>The DOM Level 2 doesn't support editing <code>DocumentType</code> nodes.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface DocumentType extends Node {\r
+ /**\r
+ * The name of DTD; i.e., the name immediately following the \r
+ * <code>DOCTYPE</code> keyword.\r
+ */\r
+ public String getName();\r
+\r
+ /**\r
+ * A <code>NamedNodeMap</code> containing the general entities, both \r
+ * external and internal, declared in the DTD. Parameter entities are \r
+ * not contained. Duplicates are discarded. For example in: \r
+ * <pre><!DOCTYPE \r
+ * ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar \r
+ * "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz"> \r
+ * ]> <ex/></pre>\r
+ * the interface provides access to <code>foo</code> \r
+ * and the first declaration of <code>bar</code> but not the second \r
+ * declaration of <code>bar</code> or <code>baz</code>. Every node in \r
+ * this map also implements the <code>Entity</code> interface.\r
+ * <br>The DOM Level 2 does not support editing entities, therefore \r
+ * <code>entities</code> cannot be altered in any way.\r
+ */\r
+ public NamedNodeMap getEntities();\r
+\r
+ /**\r
+ * A <code>NamedNodeMap</code> containing the notations declared in the \r
+ * DTD. Duplicates are discarded. Every node in this map also implements \r
+ * the <code>Notation</code> interface.\r
+ * <br>The DOM Level 2 does not support editing notations, therefore \r
+ * <code>notations</code> cannot be altered in any way.\r
+ */\r
+ public NamedNodeMap getNotations();\r
+\r
+ /**\r
+ * The public identifier of the external subset.\r
+ * @since DOM Level 2\r
+ */\r
+ public String getPublicId();\r
+\r
+ /**\r
+ * The system identifier of the external subset.\r
+ * @since DOM Level 2\r
+ */\r
+ public String getSystemId();\r
+\r
+ /**\r
+ * The internal subset as a string.The actual content returned depends on \r
+ * how much information is available to the implementation. This may \r
+ * vary depending on various parameters, including the XML processor \r
+ * used to build the document.\r
+ * @since DOM Level 2\r
+ */\r
+ public String getInternalSubset();\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * The <code>Element</code> interface represents an element in an HTML or XML \r
+ * document. Elements may have attributes associated with them; since the \r
+ * <code>Element</code> interface inherits from <code>Node</code>, the \r
+ * generic <code>Node</code> interface attribute <code>attributes</code> may \r
+ * be used to retrieve the set of all attributes for an element. There are \r
+ * methods on the <code>Element</code> interface to retrieve either an \r
+ * <code>Attr</code> object by name or an attribute value by name. In XML, \r
+ * where an attribute value may contain entity references, an \r
+ * <code>Attr</code> object should be retrieved to examine the possibly \r
+ * fairly complex sub-tree representing the attribute value. On the other \r
+ * hand, in HTML, where all attributes have simple string values, methods to \r
+ * directly access an attribute value can safely be used as a convenience.In \r
+ * DOM Level 2, the method <code>normalize</code> is inherited from the \r
+ * <code>Node</code> interface where it was moved.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface Element extends Node {\r
+ /**\r
+ * The name of the element. For example, in: \r
+ * <pre> <elementExample \r
+ * id="demo"> ... </elementExample> , </pre>\r
+ * <code>tagName</code> has \r
+ * the value <code>"elementExample"</code>. Note that this is \r
+ * case-preserving in XML, as are all of the operations of the DOM. The \r
+ * HTML DOM returns the <code>tagName</code> of an HTML element in the \r
+ * canonical uppercase form, regardless of the case in the source HTML \r
+ * document. \r
+ */\r
+ public String getTagName();\r
+\r
+ /**\r
+ * Retrieves an attribute value by name.\r
+ * @param nameThe name of the attribute to retrieve.\r
+ * @return The <code>Attr</code> value as a string, or the empty string \r
+ * if that attribute does not have a specified or default value.\r
+ */\r
+ public String getAttribute(String name);\r
+\r
+ /**\r
+ * Adds a new attribute. If an attribute with that name is already present \r
+ * in the element, its value is changed to be that of the value \r
+ * parameter. This value is a simple string; it is not parsed as it is \r
+ * being set. So any markup (such as syntax to be recognized as an \r
+ * entity reference) is treated as literal text, and needs to be \r
+ * appropriately escaped by the implementation when it is written out. \r
+ * In order to assign an attribute value that contains entity \r
+ * references, the user must create an <code>Attr</code> node plus any \r
+ * <code>Text</code> and <code>EntityReference</code> nodes, build the \r
+ * appropriate subtree, and use <code>setAttributeNode</code> to assign \r
+ * it as the value of an attribute.\r
+ * <br>To set an attribute with a qualified name and namespace URI, use \r
+ * the <code>setAttributeNS</code> method.\r
+ * @param nameThe name of the attribute to create or alter.\r
+ * @param valueValue to set in string form.\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified name contains an \r
+ * illegal character.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ */\r
+ public void setAttribute(String name, \r
+ String value)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Removes an attribute by name. If the removed attribute is known to have \r
+ * a default value, an attribute immediately appears containing the \r
+ * default value as well as the corresponding namespace URI, local name, \r
+ * and prefix when applicable.\r
+ * <br>To remove an attribute by local name and namespace URI, use the \r
+ * <code>removeAttributeNS</code> method.\r
+ * @param nameThe name of the attribute to remove.\r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ */\r
+ public void removeAttribute(String name)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Retrieves an attribute node by name.\r
+ * <br>To retrieve an attribute node by qualified name and namespace URI, \r
+ * use the <code>getAttributeNodeNS</code> method.\r
+ * @param nameThe name (<code>nodeName</code>) of the attribute to \r
+ * retrieve.\r
+ * @return The <code>Attr</code> node with the specified name (\r
+ * <code>nodeName</code>) or <code>null</code> if there is no such \r
+ * attribute.\r
+ */\r
+ public Attr getAttributeNode(String name);\r
+\r
+ /**\r
+ * Adds a new attribute node. If an attribute with that name (\r
+ * <code>nodeName</code>) is already present in the element, it is \r
+ * replaced by the new one.\r
+ * <br>To add a new attribute node with a qualified name and namespace \r
+ * URI, use the <code>setAttributeNodeNS</code> method.\r
+ * @param newAttrThe <code>Attr</code> node to add to the attribute list.\r
+ * @return If the <code>newAttr</code> attribute replaces an existing \r
+ * attribute, the replaced <code>Attr</code> node is returned, \r
+ * otherwise <code>null</code> is returned.\r
+ * @exception DOMException\r
+ * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a \r
+ * different document than the one that created the element.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an \r
+ * attribute of another <code>Element</code> object. The DOM user must \r
+ * explicitly clone <code>Attr</code> nodes to re-use them in other \r
+ * elements.\r
+ */\r
+ public Attr setAttributeNode(Attr newAttr)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Removes the specified attribute node. If the removed <code>Attr</code> \r
+ * has a default value it is immediately replaced. The replacing \r
+ * attribute has the same namespace URI and local name, as well as the \r
+ * original prefix, when applicable.\r
+ * @param oldAttrThe <code>Attr</code> node to remove from the attribute \r
+ * list.\r
+ * @return The <code>Attr</code> node that was removed.\r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ * <br>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an attribute \r
+ * of the element.\r
+ */\r
+ public Attr removeAttributeNode(Attr oldAttr)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Returns a <code>NodeList</code> of all descendant <code>Elements</code> \r
+ * with a given tag name, in the order in which they are encountered in \r
+ * a preorder traversal of this <code>Element</code> tree.\r
+ * @param nameThe name of the tag to match on. The special value "*" \r
+ * matches all tags.\r
+ * @return A list of matching <code>Element</code> nodes.\r
+ */\r
+ public NodeList getElementsByTagName(String name);\r
+\r
+ /**\r
+ * Retrieves an attribute value by local name and namespace URI. HTML-only \r
+ * DOM implementations do not need to implement this method.\r
+ * @param namespaceURIThe namespace URI of the attribute to retrieve.\r
+ * @param localNameThe local name of the attribute to retrieve.\r
+ * @return The <code>Attr</code> value as a string, or the empty string \r
+ * if that attribute does not have a specified or default value.\r
+ * @since DOM Level 2\r
+ */\r
+ public String getAttributeNS(String namespaceURI, \r
+ String localName);\r
+\r
+ /**\r
+ * Adds a new attribute. If an attribute with the same local name and \r
+ * namespace URI is already present on the element, its prefix is \r
+ * changed to be the prefix part of the <code>qualifiedName</code>, and \r
+ * its value is changed to be the <code>value</code> parameter. This \r
+ * value is a simple string; it is not parsed as it is being set. So any \r
+ * markup (such as syntax to be recognized as an entity reference) is \r
+ * treated as literal text, and needs to be appropriately escaped by the \r
+ * implementation when it is written out. In order to assign an \r
+ * attribute value that contains entity references, the user must create \r
+ * an <code>Attr</code> node plus any <code>Text</code> and \r
+ * <code>EntityReference</code> nodes, build the appropriate subtree, \r
+ * and use <code>setAttributeNodeNS</code> or \r
+ * <code>setAttributeNode</code> to assign it as the value of an \r
+ * attribute.\r
+ * <br>HTML-only DOM implementations do not need to implement this method.\r
+ * @param namespaceURIThe namespace URI of the attribute to create or \r
+ * alter.\r
+ * @param qualifiedNameThe qualified name of the attribute to create or \r
+ * alter.\r
+ * @param valueThe value to set in string form.\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name \r
+ * contains an illegal character.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is \r
+ * malformed, if the <code>qualifiedName</code> has a prefix and the \r
+ * <code>namespaceURI</code> is <code>null</code>, if the \r
+ * <code>qualifiedName</code> has a prefix that is "xml" and the \r
+ * <code>namespaceURI</code> is different from "\r
+ * http://www.w3.org/XML/1998/namespace", or if the \r
+ * <code>qualifiedName</code> is "xmlns" and the \r
+ * <code>namespaceURI</code> is different from "\r
+ * http://www.w3.org/2000/xmlns/".\r
+ * @since DOM Level 2\r
+ */\r
+ public void setAttributeNS(String namespaceURI, \r
+ String qualifiedName, \r
+ String value)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Removes an attribute by local name and namespace URI. If the removed \r
+ * attribute has a default value it is immediately replaced. The \r
+ * replacing attribute has the same namespace URI and local name, as \r
+ * well as the original prefix.\r
+ * <br>HTML-only DOM implementations do not need to implement this method.\r
+ * @param namespaceURIThe namespace URI of the attribute to remove.\r
+ * @param localNameThe local name of the attribute to remove.\r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ * @since DOM Level 2\r
+ */\r
+ public void removeAttributeNS(String namespaceURI, \r
+ String localName)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Retrieves an <code>Attr</code> node by local name and namespace URI. \r
+ * HTML-only DOM implementations do not need to implement this method.\r
+ * @param namespaceURIThe namespace URI of the attribute to retrieve.\r
+ * @param localNameThe local name of the attribute to retrieve.\r
+ * @return The <code>Attr</code> node with the specified attribute local \r
+ * name and namespace URI or <code>null</code> if there is no such \r
+ * attribute.\r
+ * @since DOM Level 2\r
+ */\r
+ public Attr getAttributeNodeNS(String namespaceURI, \r
+ String localName);\r
+\r
+ /**\r
+ * Adds a new attribute. If an attribute with that local name and that \r
+ * namespace URI is already present in the element, it is replaced by \r
+ * the new one.\r
+ * <br>HTML-only DOM implementations do not need to implement this method.\r
+ * @param newAttrThe <code>Attr</code> node to add to the attribute list.\r
+ * @return If the <code>newAttr</code> attribute replaces an existing \r
+ * attribute with the same local name and namespace URI, the replaced \r
+ * <code>Attr</code> node is returned, otherwise <code>null</code> is \r
+ * returned.\r
+ * @exception DOMException\r
+ * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a \r
+ * different document than the one that created the element.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an \r
+ * attribute of another <code>Element</code> object. The DOM user must \r
+ * explicitly clone <code>Attr</code> nodes to re-use them in other \r
+ * elements.\r
+ * @since DOM Level 2\r
+ */\r
+ public Attr setAttributeNodeNS(Attr newAttr)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Returns a <code>NodeList</code> of all the descendant \r
+ * <code>Elements</code> with a given local name and namespace URI in \r
+ * the order in which they are encountered in a preorder traversal of \r
+ * this <code>Element</code> tree.\r
+ * <br>HTML-only DOM implementations do not need to implement this method.\r
+ * @param namespaceURIThe namespace URI of the elements to match on. The \r
+ * special value "*" matches all namespaces.\r
+ * @param localNameThe local name of the elements to match on. The \r
+ * special value "*" matches all local names.\r
+ * @return A new <code>NodeList</code> object containing all the matched \r
+ * <code>Elements</code>.\r
+ * @since DOM Level 2\r
+ */\r
+ public NodeList getElementsByTagNameNS(String namespaceURI, \r
+ String localName);\r
+\r
+ /**\r
+ * Returns <code>true</code> when an attribute with a given name is \r
+ * specified on this element or has a default value, <code>false</code> \r
+ * otherwise.\r
+ * @param nameThe name of the attribute to look for.\r
+ * @return <code>true</code> if an attribute with the given name is \r
+ * specified on this element or has a default value, <code>false</code>\r
+ * otherwise.\r
+ * @since DOM Level 2\r
+ */\r
+ public boolean hasAttribute(String name);\r
+\r
+ /**\r
+ * Returns <code>true</code> when an attribute with a given local name and \r
+ * namespace URI is specified on this element or has a default value, \r
+ * <code>false</code> otherwise. HTML-only DOM implementations do not \r
+ * need to implement this method.\r
+ * @param namespaceURIThe namespace URI of the attribute to look for.\r
+ * @param localNameThe local name of the attribute to look for.\r
+ * @return <code>true</code> if an attribute with the given local name \r
+ * and namespace URI is specified or has a default value on this \r
+ * element, <code>false</code> otherwise.\r
+ * @since DOM Level 2\r
+ */\r
+ public boolean hasAttributeNS(String namespaceURI, \r
+ String localName);\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * This interface represents an entity, either parsed or unparsed, in an XML \r
+ * document. Note that this models the entity itself not the entity \r
+ * declaration. <code>Entity</code> declaration modeling has been left for a \r
+ * later Level of the DOM specification.\r
+ * <p>The <code>nodeName</code> attribute that is inherited from \r
+ * <code>Node</code> contains the name of the entity.\r
+ * <p>An XML processor may choose to completely expand entities before the \r
+ * structure model is passed to the DOM; in this case there will be no \r
+ * <code>EntityReference</code> nodes in the document tree.\r
+ * <p>XML does not mandate that a non-validating XML processor read and \r
+ * process entity declarations made in the external subset or declared in \r
+ * external parameter entities. This means that parsed entities declared in \r
+ * the external subset need not be expanded by some classes of applications, \r
+ * and that the replacement value of the entity may not be available. When \r
+ * the replacement value is available, the corresponding <code>Entity</code> \r
+ * node's child list represents the structure of that replacement text. \r
+ * Otherwise, the child list is empty.\r
+ * <p>The DOM Level 2 does not support editing <code>Entity</code> nodes; if a \r
+ * user wants to make changes to the contents of an <code>Entity</code>, \r
+ * every related <code>EntityReference</code> node has to be replaced in the \r
+ * structure model by a clone of the <code>Entity</code>'s contents, and \r
+ * then the desired changes must be made to each of those clones instead. \r
+ * <code>Entity</code> nodes and all their descendants are readonly.\r
+ * <p>An <code>Entity</code> node does not have any parent.If the entity \r
+ * contains an unbound namespace prefix, the <code>namespaceURI</code> of \r
+ * the corresponding node in the <code>Entity</code> node subtree is \r
+ * <code>null</code>. The same is true for <code>EntityReference</code> \r
+ * nodes that refer to this entity, when they are created using the \r
+ * <code>createEntityReference</code> method of the <code>Document</code> \r
+ * interface. The DOM Level 2 does not support any mechanism to resolve \r
+ * namespace prefixes.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface Entity extends Node {\r
+ /**\r
+ * The public identifier associated with the entity, if specified. If the \r
+ * public identifier was not specified, this is <code>null</code>.\r
+ */\r
+ public String getPublicId();\r
+\r
+ /**\r
+ * The system identifier associated with the entity, if specified. If the \r
+ * system identifier was not specified, this is <code>null</code>.\r
+ */\r
+ public String getSystemId();\r
+\r
+ /**\r
+ * For unparsed entities, the name of the notation for the entity. For \r
+ * parsed entities, this is <code>null</code>. \r
+ */\r
+ public String getNotationName();\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * <code>EntityReference</code> objects may be inserted into the structure \r
+ * model when an entity reference is in the source document, or when the \r
+ * user wishes to insert an entity reference. Note that character references \r
+ * and references to predefined entities are considered to be expanded by \r
+ * the HTML or XML processor so that characters are represented by their \r
+ * Unicode equivalent rather than by an entity reference. Moreover, the XML \r
+ * processor may completely expand references to entities while building the \r
+ * structure model, instead of providing <code>EntityReference</code> \r
+ * objects. If it does provide such objects, then for a given \r
+ * <code>EntityReference</code> node, it may be that there is no \r
+ * <code>Entity</code> node representing the referenced entity. If such an \r
+ * <code>Entity</code> exists, then the subtree of the \r
+ * <code>EntityReference</code> node is in general a copy of the \r
+ * <code>Entity</code> node subtree. However, this may not be true when an \r
+ * entity contains an unbound namespace prefix. In such a case, because the \r
+ * namespace prefix resolution depends on where the entity reference is, the \r
+ * descendants of the <code>EntityReference</code> node may be bound to \r
+ * different namespace URIs.\r
+ * <p>As for <code>Entity</code> nodes, <code>EntityReference</code> nodes and \r
+ * all their descendants are readonly.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface EntityReference extends Node {\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * Objects implementing the <code>NamedNodeMap</code> interface are used to \r
+ * represent collections of nodes that can be accessed by name. Note that \r
+ * <code>NamedNodeMap</code> does not inherit from <code>NodeList</code>; \r
+ * <code>NamedNodeMaps</code> are not maintained in any particular order. \r
+ * Objects contained in an object implementing <code>NamedNodeMap</code> may \r
+ * also be accessed by an ordinal index, but this is simply to allow \r
+ * convenient enumeration of the contents of a <code>NamedNodeMap</code>, \r
+ * and does not imply that the DOM specifies an order to these Nodes. \r
+ * <p><code>NamedNodeMap</code> objects in the DOM are live.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface NamedNodeMap {\r
+ /**\r
+ * Retrieves a node specified by name.\r
+ * @param nameThe <code>nodeName</code> of a node to retrieve.\r
+ * @return A <code>Node</code> (of any type) with the specified \r
+ * <code>nodeName</code>, or <code>null</code> if it does not identify \r
+ * any node in this map.\r
+ */\r
+ public Node getNamedItem(String name);\r
+\r
+ /**\r
+ * Adds a node using its <code>nodeName</code> attribute. If a node with \r
+ * that name is already present in this map, it is replaced by the new \r
+ * one.\r
+ * <br>As the <code>nodeName</code> attribute is used to derive the name \r
+ * which the node must be stored under, multiple nodes of certain types \r
+ * (those that have a "special" string value) cannot be stored as the \r
+ * names would clash. This is seen as preferable to allowing nodes to be \r
+ * aliased.\r
+ * @param argA node to store in this map. The node will later be \r
+ * accessible using the value of its <code>nodeName</code> attribute.\r
+ * @return If the new <code>Node</code> replaces an existing node the \r
+ * replaced <code>Node</code> is returned, otherwise <code>null</code> \r
+ * is returned.\r
+ * @exception DOMException\r
+ * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a \r
+ * different document than the one that created this map.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.\r
+ * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an \r
+ * <code>Attr</code> that is already an attribute of another \r
+ * <code>Element</code> object. The DOM user must explicitly clone \r
+ * <code>Attr</code> nodes to re-use them in other elements.\r
+ */\r
+ public Node setNamedItem(Node arg)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Removes a node specified by name. When this map contains the attributes \r
+ * attached to an element, if the removed attribute is known to have a \r
+ * default value, an attribute immediately appears containing the \r
+ * default value as well as the corresponding namespace URI, local name, \r
+ * and prefix when applicable.\r
+ * @param nameThe <code>nodeName</code> of the node to remove.\r
+ * @return The node removed from this map if a node with such a name \r
+ * exists.\r
+ * @exception DOMException\r
+ * NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in \r
+ * this map.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.\r
+ */\r
+ public Node removeNamedItem(String name)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Returns the <code>index</code>th item in the map. If <code>index</code> \r
+ * is greater than or equal to the number of nodes in this map, this \r
+ * returns <code>null</code>.\r
+ * @param indexIndex into this map.\r
+ * @return The node at the <code>index</code>th position in the map, or \r
+ * <code>null</code> if that is not a valid index.\r
+ */\r
+ public Node item(int index);\r
+\r
+ /**\r
+ * The number of nodes in this map. The range of valid child node indices \r
+ * is <code>0</code> to <code>length-1</code> inclusive. \r
+ */\r
+ public int getLength();\r
+\r
+ /**\r
+ * Retrieves a node specified by local name and namespace URI. HTML-only \r
+ * DOM implementations do not need to implement this method.\r
+ * @param namespaceURIThe namespace URI of the node to retrieve.\r
+ * @param localNameThe local name of the node to retrieve.\r
+ * @return A <code>Node</code> (of any type) with the specified local \r
+ * name and namespace URI, or <code>null</code> if they do not \r
+ * identify any node in this map.\r
+ * @since DOM Level 2\r
+ */\r
+ public Node getNamedItemNS(String namespaceURI, \r
+ String localName);\r
+\r
+ /**\r
+ * Adds a node using its <code>namespaceURI</code> and \r
+ * <code>localName</code>. If a node with that namespace URI and that \r
+ * local name is already present in this map, it is replaced by the new \r
+ * one.\r
+ * <br>HTML-only DOM implementations do not need to implement this method.\r
+ * @param argA node to store in this map. The node will later be \r
+ * accessible using the value of its <code>namespaceURI</code> and \r
+ * <code>localName</code> attributes.\r
+ * @return If the new <code>Node</code> replaces an existing node the \r
+ * replaced <code>Node</code> is returned, otherwise <code>null</code> \r
+ * is returned.\r
+ * @exception DOMException\r
+ * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a \r
+ * different document than the one that created this map.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.\r
+ * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an \r
+ * <code>Attr</code> that is already an attribute of another \r
+ * <code>Element</code> object. The DOM user must explicitly clone \r
+ * <code>Attr</code> nodes to re-use them in other elements.\r
+ * @since DOM Level 2\r
+ */\r
+ public Node setNamedItemNS(Node arg)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Removes a node specified by local name and namespace URI. A removed \r
+ * attribute may be known to have a default value when this map contains \r
+ * the attributes attached to an element, as returned by the attributes \r
+ * attribute of the <code>Node</code> interface. If so, an attribute \r
+ * immediately appears containing the default value as well as the \r
+ * corresponding namespace URI, local name, and prefix when applicable.\r
+ * <br>HTML-only DOM implementations do not need to implement this method.\r
+ * @param namespaceURIThe namespace URI of the node to remove.\r
+ * @param localNameThe local name of the node to remove.\r
+ * @return The node removed from this map if a node with such a local \r
+ * name and namespace URI exists.\r
+ * @exception DOMException\r
+ * NOT_FOUND_ERR: Raised if there is no node with the specified \r
+ * <code>namespaceURI</code> and <code>localName</code> in this map.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.\r
+ * @since DOM Level 2\r
+ */\r
+ public Node removeNamedItemNS(String namespaceURI, \r
+ String localName)\r
+ throws DOMException;\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * The <code>Node</code> interface is the primary datatype for the entire \r
+ * Document Object Model. It represents a single node in the document tree. \r
+ * While all objects implementing the <code>Node</code> interface expose \r
+ * methods for dealing with children, not all objects implementing the \r
+ * <code>Node</code> interface may have children. For example, \r
+ * <code>Text</code> nodes may not have children, and adding children to \r
+ * such nodes results in a <code>DOMException</code> being raised.\r
+ * <p>The attributes <code>nodeName</code>, <code>nodeValue</code> and \r
+ * <code>attributes</code> are included as a mechanism to get at node \r
+ * information without casting down to the specific derived interface. In \r
+ * cases where there is no obvious mapping of these attributes for a \r
+ * specific <code>nodeType</code> (e.g., <code>nodeValue</code> for an \r
+ * <code>Element</code> or <code>attributes</code> for a <code>Comment</code>\r
+ * ), this returns <code>null</code>. Note that the specialized interfaces \r
+ * may contain additional and more convenient mechanisms to get and set the \r
+ * relevant information.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface Node {\r
+ // NodeType\r
+ /**\r
+ * The node is an <code>Element</code>.\r
+ */\r
+ public static final short ELEMENT_NODE = 1;\r
+ /**\r
+ * The node is an <code>Attr</code>.\r
+ */\r
+ public static final short ATTRIBUTE_NODE = 2;\r
+ /**\r
+ * The node is a <code>Text</code> node.\r
+ */\r
+ public static final short TEXT_NODE = 3;\r
+ /**\r
+ * The node is a <code>CDATASection</code>.\r
+ */\r
+ public static final short CDATA_SECTION_NODE = 4;\r
+ /**\r
+ * The node is an <code>EntityReference</code>.\r
+ */\r
+ public static final short ENTITY_REFERENCE_NODE = 5;\r
+ /**\r
+ * The node is an <code>Entity</code>.\r
+ */\r
+ public static final short ENTITY_NODE = 6;\r
+ /**\r
+ * The node is a <code>ProcessingInstruction</code>.\r
+ */\r
+ public static final short PROCESSING_INSTRUCTION_NODE = 7;\r
+ /**\r
+ * The node is a <code>Comment</code>.\r
+ */\r
+ public static final short COMMENT_NODE = 8;\r
+ /**\r
+ * The node is a <code>Document</code>.\r
+ */\r
+ public static final short DOCUMENT_NODE = 9;\r
+ /**\r
+ * The node is a <code>DocumentType</code>.\r
+ */\r
+ public static final short DOCUMENT_TYPE_NODE = 10;\r
+ /**\r
+ * The node is a <code>DocumentFragment</code>.\r
+ */\r
+ public static final short DOCUMENT_FRAGMENT_NODE = 11;\r
+ /**\r
+ * The node is a <code>Notation</code>.\r
+ */\r
+ public static final short NOTATION_NODE = 12;\r
+\r
+ /**\r
+ * The name of this node, depending on its type; see the table above. \r
+ */\r
+ public String getNodeName();\r
+\r
+ /**\r
+ * The value of this node, depending on its type; see the table above. \r
+ * When it is defined to be <code>null</code>, setting it has no effect.\r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.\r
+ * @exception DOMException\r
+ * DOMSTRING_SIZE_ERR: Raised when it would return more characters than \r
+ * fit in a <code>DOMString</code> variable on the implementation \r
+ * platform.\r
+ */\r
+ public String getNodeValue()\r
+ throws DOMException;\r
+ public void setNodeValue(String nodeValue)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * A code representing the type of the underlying object, as defined above.\r
+ */\r
+ public short getNodeType();\r
+\r
+ /**\r
+ * The parent of this node. All nodes, except <code>Attr</code>, \r
+ * <code>Document</code>, <code>DocumentFragment</code>, \r
+ * <code>Entity</code>, and <code>Notation</code> may have a parent. \r
+ * However, if a node has just been created and not yet added to the \r
+ * tree, or if it has been removed from the tree, this is \r
+ * <code>null</code>.\r
+ */\r
+ public Node getParentNode();\r
+\r
+ /**\r
+ * A <code>NodeList</code> that contains all children of this node. If \r
+ * there are no children, this is a <code>NodeList</code> containing no \r
+ * nodes.\r
+ */\r
+ public NodeList getChildNodes();\r
+\r
+ /**\r
+ * The first child of this node. If there is no such node, this returns \r
+ * <code>null</code>.\r
+ */\r
+ public Node getFirstChild();\r
+\r
+ /**\r
+ * The last child of this node. If there is no such node, this returns \r
+ * <code>null</code>.\r
+ */\r
+ public Node getLastChild();\r
+\r
+ /**\r
+ * The node immediately preceding this node. If there is no such node, \r
+ * this returns <code>null</code>.\r
+ */\r
+ public Node getPreviousSibling();\r
+\r
+ /**\r
+ * The node immediately following this node. If there is no such node, \r
+ * this returns <code>null</code>.\r
+ */\r
+ public Node getNextSibling();\r
+\r
+ /**\r
+ * A <code>NamedNodeMap</code> containing the attributes of this node (if \r
+ * it is an <code>Element</code>) or <code>null</code> otherwise. \r
+ */\r
+ public NamedNodeMap getAttributes();\r
+\r
+ /**\r
+ * The <code>Document</code> object associated with this node. This is \r
+ * also the <code>Document</code> object used to create new nodes. When \r
+ * this node is a <code>Document</code> or a <code>DocumentType</code> \r
+ * which is not used with any <code>Document</code> yet, this is \r
+ * <code>null</code>.\r
+ * @version DOM Level 2\r
+ */\r
+ public Document getOwnerDocument();\r
+\r
+ /**\r
+ * Inserts the node <code>newChild</code> before the existing child node \r
+ * <code>refChild</code>. If <code>refChild</code> is <code>null</code>, \r
+ * insert <code>newChild</code> at the end of the list of children.\r
+ * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object, \r
+ * all of its children are inserted, in the same order, before \r
+ * <code>refChild</code>. If the <code>newChild</code> is already in the \r
+ * tree, it is first removed.\r
+ * @param newChildThe node to insert.\r
+ * @param refChildThe reference node, i.e., the node before which the new \r
+ * node must be inserted.\r
+ * @return The node being inserted.\r
+ * @exception DOMException\r
+ * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not \r
+ * allow children of the type of the <code>newChild</code> node, or if \r
+ * the node to insert is one of this node's ancestors.\r
+ * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created \r
+ * from a different document than the one that created this node.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or \r
+ * if the parent of the node being inserted is readonly.\r
+ * <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of \r
+ * this node.\r
+ */\r
+ public Node insertBefore(Node newChild, \r
+ Node refChild)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Replaces the child node <code>oldChild</code> with <code>newChild</code>\r
+ * in the list of children, and returns the <code>oldChild</code> node.\r
+ * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object, \r
+ * <code>oldChild</code> is replaced by all of the \r
+ * <code>DocumentFragment</code> children, which are inserted in the \r
+ * same order. If the <code>newChild</code> is already in the tree, it \r
+ * is first removed.\r
+ * @param newChildThe new node to put in the child list.\r
+ * @param oldChildThe node being replaced in the list.\r
+ * @return The node replaced.\r
+ * @exception DOMException\r
+ * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not \r
+ * allow children of the type of the <code>newChild</code> node, or if \r
+ * the node to put in is one of this node's ancestors.\r
+ * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created \r
+ * from a different document than the one that created this node.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of \r
+ * the new node is readonly.\r
+ * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of \r
+ * this node.\r
+ */\r
+ public Node replaceChild(Node newChild, \r
+ Node oldChild)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Removes the child node indicated by <code>oldChild</code> from the list \r
+ * of children, and returns it.\r
+ * @param oldChildThe node being removed.\r
+ * @return The node removed.\r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of \r
+ * this node.\r
+ */\r
+ public Node removeChild(Node oldChild)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Adds the node <code>newChild</code> to the end of the list of children \r
+ * of this node. If the <code>newChild</code> is already in the tree, it \r
+ * is first removed.\r
+ * @param newChildThe node to add.If it is a <code>DocumentFragment</code>\r
+ * object, the entire contents of the document fragment are moved \r
+ * into the child list of this node\r
+ * @return The node added.\r
+ * @exception DOMException\r
+ * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not \r
+ * allow children of the type of the <code>newChild</code> node, or if \r
+ * the node to append is one of this node's ancestors.\r
+ * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created \r
+ * from a different document than the one that created this node.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ */\r
+ public Node appendChild(Node newChild)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Returns whether this node has any children.\r
+ * @return <code>true</code> if this node has any children, \r
+ * <code>false</code> otherwise.\r
+ */\r
+ public boolean hasChildNodes();\r
+\r
+ /**\r
+ * Returns a duplicate of this node, i.e., serves as a generic copy \r
+ * constructor for nodes. The duplicate node has no parent; (\r
+ * <code>parentNode</code> is <code>null</code>.).\r
+ * <br>Cloning an <code>Element</code> copies all attributes and their \r
+ * values, including those generated by the XML processor to represent \r
+ * defaulted attributes, but this method does not copy any text it \r
+ * contains unless it is a deep clone, since the text is contained in a \r
+ * child <code>Text</code> node. Cloning an <code>Attribute</code> \r
+ * directly, as opposed to be cloned as part of an <code>Element</code> \r
+ * cloning operation, returns a specified attribute (\r
+ * <code>specified</code> is <code>true</code>). Cloning any other type \r
+ * of node simply returns a copy of this node.\r
+ * <br>Note that cloning an immutable subtree results in a mutable copy, \r
+ * but the children of an <code>EntityReference</code> clone are readonly\r
+ * . In addition, clones of unspecified <code>Attr</code> nodes are \r
+ * specified. And, cloning <code>Document</code>, \r
+ * <code>DocumentType</code>, <code>Entity</code>, and \r
+ * <code>Notation</code> nodes is implementation dependent.\r
+ * @param deepIf <code>true</code>, recursively clone the subtree under \r
+ * the specified node; if <code>false</code>, clone only the node \r
+ * itself (and its attributes, if it is an <code>Element</code>). \r
+ * @return The duplicate node.\r
+ */\r
+ public Node cloneNode(boolean deep);\r
+\r
+ /**\r
+ * Puts all <code>Text</code> nodes in the full depth of the sub-tree \r
+ * underneath this <code>Node</code>, including attribute nodes, into a \r
+ * "normal" form where only structure (e.g., elements, comments, \r
+ * processing instructions, CDATA sections, and entity references) \r
+ * separates <code>Text</code> nodes, i.e., there are neither adjacent \r
+ * <code>Text</code> nodes nor empty <code>Text</code> nodes. This can \r
+ * be used to ensure that the DOM view of a document is the same as if \r
+ * it were saved and re-loaded, and is useful when operations (such as \r
+ * XPointer lookups) that depend on a particular document tree \r
+ * structure are to be used.In cases where the document contains \r
+ * <code>CDATASections</code>, the normalize operation alone may not be \r
+ * sufficient, since XPointers do not differentiate between \r
+ * <code>Text</code> nodes and <code>CDATASection</code> nodes.\r
+ * @version DOM Level 2\r
+ */\r
+ public void normalize();\r
+\r
+ /**\r
+ * Tests whether the DOM implementation implements a specific feature and \r
+ * that feature is supported by this node.\r
+ * @param featureThe name of the feature to test. This is the same name \r
+ * which can be passed to the method <code>hasFeature</code> on \r
+ * <code>DOMImplementation</code>.\r
+ * @param versionThis is the version number of the feature to test. In \r
+ * Level 2, version 1, this is the string "2.0". If the version is not \r
+ * specified, supporting any version of the feature will cause the \r
+ * method to return <code>true</code>.\r
+ * @return Returns <code>true</code> if the specified feature is \r
+ * supported on this node, <code>false</code> otherwise.\r
+ * @since DOM Level 2\r
+ */\r
+ public boolean isSupported(String feature, \r
+ String version);\r
+\r
+ /**\r
+ * The namespace URI of this node, or <code>null</code> if it is \r
+ * unspecified.\r
+ * <br>This is not a computed value that is the result of a namespace \r
+ * lookup based on an examination of the namespace declarations in \r
+ * scope. It is merely the namespace URI given at creation time.\r
+ * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and \r
+ * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1 \r
+ * method, such as <code>createElement</code> from the \r
+ * <code>Document</code> interface, this is always <code>null</code>.Per \r
+ * the Namespaces in XML Specification an attribute does not inherit \r
+ * its namespace from the element it is attached to. If an attribute is \r
+ * not explicitly given a namespace, it simply has no namespace.\r
+ * @since DOM Level 2\r
+ */\r
+ public String getNamespaceURI();\r
+\r
+ /**\r
+ * The namespace prefix of this node, or <code>null</code> if it is \r
+ * unspecified.\r
+ * <br>Note that setting this attribute, when permitted, changes the \r
+ * <code>nodeName</code> attribute, which holds the qualified name, as \r
+ * well as the <code>tagName</code> and <code>name</code> attributes of \r
+ * the <code>Element</code> and <code>Attr</code> interfaces, when \r
+ * applicable.\r
+ * <br>Note also that changing the prefix of an attribute that is known to \r
+ * have a default value, does not make a new attribute with the default \r
+ * value and the original prefix appear, since the \r
+ * <code>namespaceURI</code> and <code>localName</code> do not change.\r
+ * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and \r
+ * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1 \r
+ * method, such as <code>createElement</code> from the \r
+ * <code>Document</code> interface, this is always <code>null</code>.\r
+ * @exception DOMException\r
+ * INVALID_CHARACTER_ERR: Raised if the specified prefix contains an \r
+ * illegal character.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ * <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is \r
+ * malformed, if the <code>namespaceURI</code> of this node is \r
+ * <code>null</code>, if the specified prefix is "xml" and the \r
+ * <code>namespaceURI</code> of this node is different from "\r
+ * http://www.w3.org/XML/1998/namespace", if this node is an attribute \r
+ * and the specified prefix is "xmlns" and the \r
+ * <code>namespaceURI</code> of this node is different from "\r
+ * http://www.w3.org/2000/xmlns/", or if this node is an attribute and \r
+ * the <code>qualifiedName</code> of this node is "xmlns" .\r
+ * @since DOM Level 2\r
+ */\r
+ public String getPrefix();\r
+ public void setPrefix(String prefix)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Returns the local part of the qualified name of this node.\r
+ * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and \r
+ * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1 \r
+ * method, such as <code>createElement</code> from the \r
+ * <code>Document</code> interface, this is always <code>null</code>.\r
+ * @since DOM Level 2\r
+ */\r
+ public String getLocalName();\r
+\r
+ /**\r
+ * Returns whether this node (if it is an element) has any attributes.\r
+ * @return <code>true</code> if this node has any attributes, \r
+ * <code>false</code> otherwise.\r
+ * @since DOM Level 2\r
+ */\r
+ public boolean hasAttributes();\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * The <code>NodeList</code> interface provides the abstraction of an ordered \r
+ * collection of nodes, without defining or constraining how this collection \r
+ * is implemented. <code>NodeList</code> objects in the DOM are live.\r
+ * <p>The items in the <code>NodeList</code> are accessible via an integral \r
+ * index, starting from 0.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface NodeList {\r
+ /**\r
+ * Returns the <code>index</code>th item in the collection. If \r
+ * <code>index</code> is greater than or equal to the number of nodes in \r
+ * the list, this returns <code>null</code>.\r
+ * @param indexIndex into the collection.\r
+ * @return The node at the <code>index</code>th position in the \r
+ * <code>NodeList</code>, or <code>null</code> if that is not a valid \r
+ * index.\r
+ */\r
+ public Node item(int index);\r
+\r
+ /**\r
+ * The number of nodes in the list. The range of valid child node indices \r
+ * is 0 to <code>length-1</code> inclusive. \r
+ */\r
+ public int getLength();\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * This interface represents a notation declared in the DTD. A notation either \r
+ * declares, by name, the format of an unparsed entity (see section 4.7 of \r
+ * the XML 1.0 specification ), or is used for formal declaration of \r
+ * processing instruction targets (see section 2.6 of the XML 1.0 \r
+ * specification ). The <code>nodeName</code> attribute inherited from \r
+ * <code>Node</code> is set to the declared name of the notation.\r
+ * <p>The DOM Level 1 does not support editing <code>Notation</code> nodes; \r
+ * they are therefore readonly.\r
+ * <p>A <code>Notation</code> node does not have any parent.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface Notation extends Node {\r
+ /**\r
+ * The public identifier of this notation. If the public identifier was \r
+ * not specified, this is <code>null</code>.\r
+ */\r
+ public String getPublicId();\r
+\r
+ /**\r
+ * The system identifier of this notation. If the system identifier was \r
+ * not specified, this is <code>null</code>.\r
+ */\r
+ public String getSystemId();\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * The <code>ProcessingInstruction</code> interface represents a "processing \r
+ * instruction", used in XML as a way to keep processor-specific information \r
+ * in the text of the document.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface ProcessingInstruction extends Node {\r
+ /**\r
+ * The target of this processing instruction. XML defines this as being \r
+ * the first token following the markup that begins the processing \r
+ * instruction.\r
+ */\r
+ public String getTarget();\r
+\r
+ /**\r
+ * The content of this processing instruction. This is from the first non \r
+ * white space character after the target to the character immediately \r
+ * preceding the <code>?></code>.\r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.\r
+ */\r
+ public String getData();\r
+ public void setData(String data)\r
+ throws DOMException;\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom;\r
+\r
+/**\r
+ * The <code>Text</code> interface inherits from <code>CharacterData</code> \r
+ * and represents the textual content (termed character data in XML) of an \r
+ * <code>Element</code> or <code>Attr</code>. If there is no markup inside \r
+ * an element's content, the text is contained in a single object \r
+ * implementing the <code>Text</code> interface that is the only child of \r
+ * the element. If there is markup, it is parsed into the information items \r
+ * (elements, comments, etc.) and <code>Text</code> nodes that form the list \r
+ * of children of the element.\r
+ * <p>When a document is first made available via the DOM, there is only one \r
+ * <code>Text</code> node for each block of text. Users may create adjacent \r
+ * <code>Text</code> nodes that represent the contents of a given element \r
+ * without any intervening markup, but should be aware that there is no way \r
+ * to represent the separations between these nodes in XML or HTML, so they \r
+ * will not (in general) persist between DOM editing sessions. The \r
+ * <code>normalize()</code> method on <code>Node</code> merges any such \r
+ * adjacent <code>Text</code> objects into a single node for each block of \r
+ * text.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
+ */\r
+public interface Text extends CharacterData {\r
+ /**\r
+ * Breaks this node into two nodes at the specified <code>offset</code>, \r
+ * keeping both in the tree as siblings. After being split, this node \r
+ * will contain all the content up to the <code>offset</code> point. A \r
+ * new node of the same type, which contains all the content at and \r
+ * after the <code>offset</code> point, is returned. If the original \r
+ * node had a parent node, the new node is inserted as the next sibling \r
+ * of the original node. When the <code>offset</code> is equal to the \r
+ * length of this node, the new node has no data.\r
+ * @param offsetThe 16-bit unit offset at which to split, starting from \r
+ * <code>0</code>.\r
+ * @return The new node, of the same type as this node.\r
+ * @exception DOMException\r
+ * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater \r
+ * than the number of 16-bit units in <code>data</code>.\r
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
+ */\r
+ public Text splitText(int offset)\r
+ throws DOMException;\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom.ranges;\r
+\r
+/**\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.\r
+ * @since DOM Level 2\r
+ */\r
+public interface DocumentRange {\r
+ /**\r
+ * This interface can be obtained from the object implementing the \r
+ * <code>Document</code> interface using binding-specific casting \r
+ * methods.\r
+ * @return The initial state of the Range returned from this method is \r
+ * such that both of its boundary-points are positioned at the \r
+ * beginning of the corresponding Document, before any content. The \r
+ * Range returned can only be used to select content associated with \r
+ * this Document, or with DocumentFragments and Attrs for which this \r
+ * Document is the <code>ownerDocument</code>.\r
+ */\r
+ public Range createRange();\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom.ranges;\r
+\r
+import org.w3c.dom.Node;\r
+import org.w3c.dom.DocumentFragment;\r
+import org.w3c.dom.DOMException;\r
+\r
+/**\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.\r
+ * @since DOM Level 2\r
+ */\r
+public interface Range {\r
+ /**\r
+ * Node within which the Range begins \r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public Node getStartContainer()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Offset within the starting node of the Range. \r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public int getStartOffset()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Node within which the Range ends \r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public Node getEndContainer()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Offset within the ending node of the Range. \r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public int getEndOffset()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * TRUE if the Range is collapsed \r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public boolean getCollapsed()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * The deepest common ancestor container of the Range's two \r
+ * boundary-points.\r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public Node getCommonAncestorContainer()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Sets the attributes describing the start of the Range. \r
+ * @param refNodeThe <code>refNode</code> value. This parameter must be \r
+ * different from <code>null</code>.\r
+ * @param offsetThe <code>startOffset</code> value. \r
+ * @exception RangeException\r
+ * INVALID_NODE_TYPE_ERR: Raised if <code>refNode</code> or an ancestor \r
+ * of <code>refNode</code> is an Entity, Notation, or DocumentType \r
+ * node.\r
+ * @exception DOMException\r
+ * INDEX_SIZE_ERR: Raised if <code>offset</code> is negative or greater \r
+ * than the number of child units in <code>refNode</code>. Child units \r
+ * are 16-bit units if <code>refNode</code> is a type of CharacterData \r
+ * node (e.g., a Text or Comment node) or a ProcessingInstruction \r
+ * node. Child units are Nodes in all other cases.\r
+ * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already \r
+ * been invoked on this object.\r
+ */\r
+ public void setStart(Node refNode, \r
+ int offset)\r
+ throws RangeException, DOMException;\r
+\r
+ /**\r
+ * Sets the attributes describing the end of a Range.\r
+ * @param refNodeThe <code>refNode</code> value. This parameter must be \r
+ * different from <code>null</code>.\r
+ * @param offsetThe <code>endOffset</code> value. \r
+ * @exception RangeException\r
+ * INVALID_NODE_TYPE_ERR: Raised if <code>refNode</code> or an ancestor \r
+ * of <code>refNode</code> is an Entity, Notation, or DocumentType \r
+ * node.\r
+ * @exception DOMException\r
+ * INDEX_SIZE_ERR: Raised if <code>offset</code> is negative or greater \r
+ * than the number of child units in <code>refNode</code>. Child units \r
+ * are 16-bit units if <code>refNode</code> is a type of CharacterData \r
+ * node (e.g., a Text or Comment node) or a ProcessingInstruction \r
+ * node. Child units are Nodes in all other cases.\r
+ * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already \r
+ * been invoked on this object.\r
+ */\r
+ public void setEnd(Node refNode, \r
+ int offset)\r
+ throws RangeException, DOMException;\r
+\r
+ /**\r
+ * Sets the start position to be before a node\r
+ * @param refNodeRange starts before <code>refNode</code> \r
+ * @exception RangeException\r
+ * INVALID_NODE_TYPE_ERR: Raised if the root container of \r
+ * <code>refNode</code> is not an Attr, Document, or DocumentFragment \r
+ * node or if <code>refNode</code> is a Document, DocumentFragment, \r
+ * Attr, Entity, or Notation node.\r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public void setStartBefore(Node refNode)\r
+ throws RangeException, DOMException;\r
+\r
+ /**\r
+ * Sets the start position to be after a node\r
+ * @param refNodeRange starts after <code>refNode</code> \r
+ * @exception RangeException\r
+ * INVALID_NODE_TYPE_ERR: Raised if the root container of \r
+ * <code>refNode</code> is not an Attr, Document, or DocumentFragment \r
+ * node or if <code>refNode</code> is a Document, DocumentFragment, \r
+ * Attr, Entity, or Notation node.\r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public void setStartAfter(Node refNode)\r
+ throws RangeException, DOMException;\r
+\r
+ /**\r
+ * Sets the end position to be before a node. \r
+ * @param refNodeRange ends before <code>refNode</code> \r
+ * @exception RangeException\r
+ * INVALID_NODE_TYPE_ERR: Raised if the root container of \r
+ * <code>refNode</code> is not an Attr, Document, or DocumentFragment \r
+ * node or if <code>refNode</code> is a Document, DocumentFragment, \r
+ * Attr, Entity, or Notation node.\r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public void setEndBefore(Node refNode)\r
+ throws RangeException, DOMException;\r
+\r
+ /**\r
+ * Sets the end of a Range to be after a node \r
+ * @param refNodeRange ends after <code>refNode</code>. \r
+ * @exception RangeException\r
+ * INVALID_NODE_TYPE_ERR: Raised if the root container of \r
+ * <code>refNode</code> is not an Attr, Document or DocumentFragment \r
+ * node or if <code>refNode</code> is a Document, DocumentFragment, \r
+ * Attr, Entity, or Notation node.\r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public void setEndAfter(Node refNode)\r
+ throws RangeException, DOMException;\r
+\r
+ /**\r
+ * Collapse a Range onto one of its boundary-points \r
+ * @param toStartIf TRUE, collapses the Range onto its start; if FALSE, \r
+ * collapses it onto its end. \r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public void collapse(boolean toStart)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Select a node and its contents \r
+ * @param refNodeThe node to select. \r
+ * @exception RangeException\r
+ * INVALID_NODE_TYPE_ERR: Raised if an ancestor of <code>refNode</code> \r
+ * is an Entity, Notation or DocumentType node or if \r
+ * <code>refNode</code> is a Document, DocumentFragment, Attr, Entity, \r
+ * or Notation node.\r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public void selectNode(Node refNode)\r
+ throws RangeException, DOMException;\r
+\r
+ /**\r
+ * Select the contents within a node \r
+ * @param refNodeNode to select from \r
+ * @exception RangeException\r
+ * INVALID_NODE_TYPE_ERR: Raised if <code>refNode</code> or an ancestor \r
+ * of <code>refNode</code> is an Entity, Notation or DocumentType node.\r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public void selectNodeContents(Node refNode)\r
+ throws RangeException, DOMException;\r
+\r
+ // CompareHow\r
+ /**\r
+ * Compare start boundary-point of <code>sourceRange</code> to start \r
+ * boundary-point of Range on which <code>compareBoundaryPoints</code> \r
+ * is invoked.\r
+ */\r
+ public static final short START_TO_START = 0;\r
+ /**\r
+ * Compare start boundary-point of <code>sourceRange</code> to end \r
+ * boundary-point of Range on which <code>compareBoundaryPoints</code> \r
+ * is invoked.\r
+ */\r
+ public static final short START_TO_END = 1;\r
+ /**\r
+ * Compare end boundary-point of <code>sourceRange</code> to end \r
+ * boundary-point of Range on which <code>compareBoundaryPoints</code> \r
+ * is invoked.\r
+ */\r
+ public static final short END_TO_END = 2;\r
+ /**\r
+ * Compare end boundary-point of <code>sourceRange</code> to start \r
+ * boundary-point of Range on which <code>compareBoundaryPoints</code> \r
+ * is invoked.\r
+ */\r
+ public static final short END_TO_START = 3;\r
+\r
+ /**\r
+ * Compare the boundary-points of two Ranges in a document.\r
+ * @param howA code representing the type of comparison, as defined above.\r
+ * @param sourceRangeThe <code>Range</code> on which this current \r
+ * <code>Range</code> is compared to.\r
+ * @return -1, 0 or 1 depending on whether the corresponding \r
+ * boundary-point of the Range is respectively before, equal to, or \r
+ * after the corresponding boundary-point of <code>sourceRange</code>. \r
+ * @exception DOMException\r
+ * WRONG_DOCUMENT_ERR: Raised if the two Ranges are not in the same \r
+ * Document or DocumentFragment.\r
+ * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already \r
+ * been invoked on this object.\r
+ */\r
+ public short compareBoundaryPoints(short how, \r
+ Range sourceRange)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Removes the contents of a Range from the containing document or \r
+ * document fragment without returning a reference to the removed \r
+ * content. \r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of \r
+ * the Range is read-only or any of the nodes that contain any of the \r
+ * content of the Range are read-only.\r
+ * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already \r
+ * been invoked on this object.\r
+ */\r
+ public void deleteContents()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Moves the contents of a Range from the containing document or document \r
+ * fragment to a new DocumentFragment. \r
+ * @return A DocumentFragment containing the extracted contents. \r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of \r
+ * the Range is read-only or any of the nodes which contain any of the \r
+ * content of the Range are read-only.\r
+ * <br>HIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be \r
+ * extracted into the new DocumentFragment.\r
+ * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already \r
+ * been invoked on this object.\r
+ */\r
+ public DocumentFragment extractContents()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Duplicates the contents of a Range \r
+ * @return A DocumentFragment that contains content equivalent to this \r
+ * Range.\r
+ * @exception DOMException\r
+ * HIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be \r
+ * extracted into the new DocumentFragment.\r
+ * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already \r
+ * been invoked on this object.\r
+ */\r
+ public DocumentFragment cloneContents()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Inserts a node into the Document or DocumentFragment at the start of \r
+ * the Range. If the container is a Text node, this will be split at the \r
+ * start of the Range (as if the Text node's splitText method was \r
+ * performed at the insertion point) and the insertion will occur \r
+ * between the two resulting Text nodes. Adjacent Text nodes will not be \r
+ * automatically merged. If the node to be inserted is a \r
+ * DocumentFragment node, the children will be inserted rather than the \r
+ * DocumentFragment node itself.\r
+ * @param newNodeThe node to insert at the start of the Range \r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of the \r
+ * start of the Range is read-only.\r
+ * <br>WRONG_DOCUMENT_ERR: Raised if <code>newNode</code> and the \r
+ * container of the start of the Range were not created from the same \r
+ * document.\r
+ * <br>HIERARCHY_REQUEST_ERR: Raised if the container of the start of \r
+ * the Range is of a type that does not allow children of the type of \r
+ * <code>newNode</code> or if <code>newNode</code> is an ancestor of \r
+ * the container.\r
+ * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already \r
+ * been invoked on this object.\r
+ * @exception RangeException\r
+ * INVALID_NODE_TYPE_ERR: Raised if <code>newNode</code> is an Attr, \r
+ * Entity, Notation, or Document node.\r
+ */\r
+ public void insertNode(Node newNode)\r
+ throws DOMException, RangeException;\r
+\r
+ /**\r
+ * Reparents the contents of the Range to the given node and inserts the \r
+ * node at the position of the start of the Range. \r
+ * @param newParentThe node to surround the contents with. \r
+ * @exception DOMException\r
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of \r
+ * either boundary-point of the Range is read-only.\r
+ * <br>WRONG_DOCUMENT_ERR: Raised if <code> newParent</code> and the \r
+ * container of the start of the Range were not created from the same \r
+ * document.\r
+ * <br>HIERARCHY_REQUEST_ERR: Raised if the container of the start of \r
+ * the Range is of a type that does not allow children of the type of \r
+ * <code>newParent</code> or if <code>newParent</code> is an ancestor \r
+ * of the container or if <code>node</code> would end up with a child \r
+ * node of a type not allowed by the type of <code>node</code>.\r
+ * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already \r
+ * been invoked on this object.\r
+ * @exception RangeException\r
+ * BAD_BOUNDARYPOINTS_ERR: Raised if the Range partially selects a \r
+ * non-text node.\r
+ * <br>INVALID_NODE_TYPE_ERR: Raised if <code> node</code> is an Attr, \r
+ * Entity, DocumentType, Notation, Document, or DocumentFragment node.\r
+ */\r
+ public void surroundContents(Node newParent)\r
+ throws DOMException, RangeException;\r
+\r
+ /**\r
+ * Produces a new Range whose boundary-points are equal to the \r
+ * boundary-points of the Range. \r
+ * @return The duplicated Range. \r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public Range cloneRange()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Returns the contents of a Range as a string. This string contains only \r
+ * the data characters, not any markup. \r
+ * @return The contents of the Range.\r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public String toString()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Called to indicate that the Range is no longer in use and that the \r
+ * implementation may relinquish any resources associated with this \r
+ * Range. Subsequent calls to any methods or attribute getters on this \r
+ * Range will result in a <code>DOMException</code> being thrown with an \r
+ * error code of <code>INVALID_STATE_ERR</code>.\r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been \r
+ * invoked on this object.\r
+ */\r
+ public void detach()\r
+ throws DOMException;\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom.ranges;\r
+\r
+/**\r
+ * Range operations may throw a <code>RangeException</code> as specified in \r
+ * their method descriptions.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.\r
+ * @since DOM Level 2\r
+ */\r
+public class RangeException extends RuntimeException {\r
+ public RangeException(short code, String message) {\r
+ super(message);\r
+ this.code = code;\r
+ }\r
+ public short code;\r
+ // RangeExceptionCode\r
+ /**\r
+ * If the boundary-points of a Range do not meet specific requirements.\r
+ */\r
+ public static final short BAD_BOUNDARYPOINTS_ERR = 1;\r
+ /**\r
+ * If the container of an boundary-point of a Range is being set to either \r
+ * a node of an invalid type or a node with an ancestor of an invalid \r
+ * type.\r
+ */\r
+ public static final short INVALID_NODE_TYPE_ERR = 2;\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom.traversal;\r
+\r
+import org.w3c.dom.Node;\r
+import org.w3c.dom.DOMException;\r
+\r
+/**\r
+ * <code>DocumentTraversal</code> contains methods that create iterators and \r
+ * tree-walkers to traverse a node and its children in document order (depth \r
+ * first, pre-order traversal, which is equivalent to the order in which the \r
+ * start tags occur in the text representation of the document). In DOMs \r
+ * which support the Traversal feature, <code>DocumentTraversal</code> will \r
+ * be implemented by the same objects that implement the Document interface.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.\r
+ * @since DOM Level 2\r
+ */\r
+public interface DocumentTraversal {\r
+ /**\r
+ * Create a new <code>NodeIterator</code> over the subtree rooted at the \r
+ * specified node.\r
+ * @param rootThe node which will be iterated together with its children. \r
+ * The iterator is initially positioned just before this node. The \r
+ * <code>whatToShow</code> flags and the filter, if any, are not \r
+ * considered when setting this position. The root must not be \r
+ * <code>null</code>.\r
+ * @param whatToShowThis flag specifies which node types may appear in \r
+ * the logical view of the tree presented by the iterator. See the \r
+ * description of <code>NodeFilter</code> for the set of possible \r
+ * <code>SHOW_</code> values.These flags can be combined using \r
+ * <code>OR</code>.\r
+ * @param filterThe <code>NodeFilter</code> to be used with this \r
+ * <code>TreeWalker</code>, or <code>null</code> to indicate no filter.\r
+ * @param entityReferenceExpansionThe value of this flag determines \r
+ * whether entity reference nodes are expanded.\r
+ * @return The newly created <code>NodeIterator</code>.\r
+ * @exception DOMException\r
+ * NOT_SUPPORTED_ERR: Raised if the specified <code>root</code> is \r
+ * <code>null</code>.\r
+ */\r
+ public NodeIterator createNodeIterator(Node root, \r
+ int whatToShow, \r
+ NodeFilter filter, \r
+ boolean entityReferenceExpansion)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Create a new <code>TreeWalker</code> over the subtree rooted at the \r
+ * specified node.\r
+ * @param rootThe node which will serve as the <code>root</code> for the \r
+ * <code>TreeWalker</code>. The <code>whatToShow</code> flags and the \r
+ * <code>NodeFilter</code> are not considered when setting this value; \r
+ * any node type will be accepted as the <code>root</code>. The \r
+ * <code>currentNode</code> of the <code>TreeWalker</code> is \r
+ * initialized to this node, whether or not it is visible. The \r
+ * <code>root</code> functions as a stopping point for traversal \r
+ * methods that look upward in the document structure, such as \r
+ * <code>parentNode</code> and nextNode. The <code>root</code> must \r
+ * not be <code>null</code>.\r
+ * @param whatToShowThis flag specifies which node types may appear in \r
+ * the logical view of the tree presented by the tree-walker. See the \r
+ * description of <code>NodeFilter</code> for the set of possible \r
+ * SHOW_ values.These flags can be combined using <code>OR</code>.\r
+ * @param filterThe <code>NodeFilter</code> to be used with this \r
+ * <code>TreeWalker</code>, or <code>null</code> to indicate no filter.\r
+ * @param entityReferenceExpansionIf this flag is false, the contents of \r
+ * <code>EntityReference</code> nodes are not presented in the logical \r
+ * view.\r
+ * @return The newly created <code>TreeWalker</code>.\r
+ * @exception DOMException\r
+ * NOT_SUPPORTED_ERR: Raised if the specified <code>root</code> is \r
+ * <code>null</code>.\r
+ */\r
+ public TreeWalker createTreeWalker(Node root, \r
+ int whatToShow, \r
+ NodeFilter filter, \r
+ boolean entityReferenceExpansion)\r
+ throws DOMException;\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom.traversal;\r
+\r
+import org.w3c.dom.Node;\r
+\r
+/**\r
+ * Filters are objects that know how to "filter out" nodes. If a \r
+ * <code>NodeIterator</code> or <code>TreeWalker</code> is given a \r
+ * <code>NodeFilter</code>, it applies the filter before it returns the next \r
+ * node. If the filter says to accept the node, the traversal logic returns \r
+ * it; otherwise, traversal looks for the next node and pretends that the \r
+ * node that was rejected was not there.\r
+ * <p>The DOM does not provide any filters. <code>NodeFilter</code> is just an \r
+ * interface that users can implement to provide their own filters. \r
+ * <p><code>NodeFilters</code> do not need to know how to traverse from node \r
+ * to node, nor do they need to know anything about the data structure that \r
+ * is being traversed. This makes it very easy to write filters, since the \r
+ * only thing they have to know how to do is evaluate a single node. One \r
+ * filter may be used with a number of different kinds of traversals, \r
+ * encouraging code reuse.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.\r
+ * @since DOM Level 2\r
+ */\r
+public interface NodeFilter {\r
+ // Constants returned by acceptNode\r
+ /**\r
+ * Accept the node. Navigation methods defined for \r
+ * <code>NodeIterator</code> or <code>TreeWalker</code> will return this \r
+ * node.\r
+ */\r
+ public static final short FILTER_ACCEPT = 1;\r
+ /**\r
+ * Reject the node. Navigation methods defined for \r
+ * <code>NodeIterator</code> or <code>TreeWalker</code> will not return \r
+ * this node. For <code>TreeWalker</code>, the children of this node \r
+ * will also be rejected. <code>NodeIterators</code> treat this as a \r
+ * synonym for <code>FILTER_SKIP</code>.\r
+ */\r
+ public static final short FILTER_REJECT = 2;\r
+ /**\r
+ * Skip this single node. Navigation methods defined for \r
+ * <code>NodeIterator</code> or <code>TreeWalker</code> will not return \r
+ * this node. For both <code>NodeIterator</code> and \r
+ * <code>TreeWalker</code>, the children of this node will still be \r
+ * considered. \r
+ */\r
+ public static final short FILTER_SKIP = 3;\r
+\r
+ // Constants for whatToShow\r
+ /**\r
+ * Show all <code>Nodes</code>.\r
+ */\r
+ public static final int SHOW_ALL = 0xFFFFFFFF;\r
+ /**\r
+ * Show <code>Element</code> nodes.\r
+ */\r
+ public static final int SHOW_ELEMENT = 0x00000001;\r
+ /**\r
+ * Show <code>Attr</code> nodes. This is meaningful only when creating an \r
+ * iterator or tree-walker with an attribute node as its \r
+ * <code>root</code>; in this case, it means that the attribute node \r
+ * will appear in the first position of the iteration or traversal. \r
+ * Since attributes are never children of other nodes, they do not \r
+ * appear when traversing over the document tree.\r
+ */\r
+ public static final int SHOW_ATTRIBUTE = 0x00000002;\r
+ /**\r
+ * Show <code>Text</code> nodes.\r
+ */\r
+ public static final int SHOW_TEXT = 0x00000004;\r
+ /**\r
+ * Show <code>CDATASection</code> nodes.\r
+ */\r
+ public static final int SHOW_CDATA_SECTION = 0x00000008;\r
+ /**\r
+ * Show <code>EntityReference</code> nodes.\r
+ */\r
+ public static final int SHOW_ENTITY_REFERENCE = 0x00000010;\r
+ /**\r
+ * Show <code>Entity</code> nodes. This is meaningful only when creating \r
+ * an iterator or tree-walker with an<code> Entity</code> node as its \r
+ * <code>root</code>; in this case, it means that the <code>Entity</code>\r
+ * node will appear in the first position of the traversal. Since \r
+ * entities are not part of the document tree, they do not appear when \r
+ * traversing over the document tree.\r
+ */\r
+ public static final int SHOW_ENTITY = 0x00000020;\r
+ /**\r
+ * Show <code>ProcessingInstruction</code> nodes.\r
+ */\r
+ public static final int SHOW_PROCESSING_INSTRUCTION = 0x00000040;\r
+ /**\r
+ * Show <code>Comment</code> nodes.\r
+ */\r
+ public static final int SHOW_COMMENT = 0x00000080;\r
+ /**\r
+ * Show <code>Document</code> nodes.\r
+ */\r
+ public static final int SHOW_DOCUMENT = 0x00000100;\r
+ /**\r
+ * Show <code>DocumentType</code> nodes.\r
+ */\r
+ public static final int SHOW_DOCUMENT_TYPE = 0x00000200;\r
+ /**\r
+ * Show <code>DocumentFragment</code> nodes.\r
+ */\r
+ public static final int SHOW_DOCUMENT_FRAGMENT = 0x00000400;\r
+ /**\r
+ * Show <code>Notation</code> nodes. This is meaningful only when creating \r
+ * an iterator or tree-walker with a <code>Notation</code> node as its \r
+ * <code>root</code>; in this case, it means that the \r
+ * <code>Notation</code> node will appear in the first position of the \r
+ * traversal. Since notations are not part of the document tree, they do \r
+ * not appear when traversing over the document tree.\r
+ */\r
+ public static final int SHOW_NOTATION = 0x00000800;\r
+\r
+ /**\r
+ * Test whether a specified node is visible in the logical view of a \r
+ * <code>TreeWalker</code> or <code>NodeIterator</code>. This function \r
+ * will be called by the implementation of <code>TreeWalker</code> and \r
+ * <code>NodeIterator</code>; it is not normally called directly from \r
+ * user code. (Though you could do so if you wanted to use the same \r
+ * filter to guide your own application logic.)\r
+ * @param nThe node to check to see if it passes the filter or not.\r
+ * @return a constant to determine whether the node is accepted, \r
+ * rejected, or skipped, as defined above.\r
+ */\r
+ public short acceptNode(Node n);\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom.traversal;\r
+\r
+import org.w3c.dom.Node;\r
+import org.w3c.dom.DOMException;\r
+\r
+/**\r
+ * <code>Iterators</code> are used to step through a set of nodes, e.g. the \r
+ * set of nodes in a <code>NodeList</code>, the document subtree governed by \r
+ * a particular <code>Node</code>, the results of a query, or any other set \r
+ * of nodes. The set of nodes to be iterated is determined by the \r
+ * implementation of the <code>NodeIterator</code>. DOM Level 2 specifies a \r
+ * single <code>NodeIterator</code> implementation for document-order \r
+ * traversal of a document subtree. Instances of these iterators are created \r
+ * by calling <code>DocumentTraversal</code>\r
+ * <code>.createNodeIterator()</code>.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.\r
+ * @since DOM Level 2\r
+ */\r
+public interface NodeIterator {\r
+ /**\r
+ * The root node of the <code>NodeIterator</code>, as specified when it \r
+ * was created.\r
+ */\r
+ public Node getRoot();\r
+\r
+ /**\r
+ * This attribute determines which node types are presented via the \r
+ * iterator. The available set of constants is defined in the \r
+ * <code>NodeFilter</code> interface. Nodes not accepted by \r
+ * <code>whatToShow</code> will be skipped, but their children may still \r
+ * be considered. Note that this skip takes precedence over the filter, \r
+ * if any. \r
+ */\r
+ public int getWhatToShow();\r
+\r
+ /**\r
+ * The <code>NodeFilter</code> used to screen nodes.\r
+ */\r
+ public NodeFilter getFilter();\r
+\r
+ /**\r
+ * The value of this flag determines whether the children of entity \r
+ * reference nodes are visible to the iterator. If false, they and \r
+ * their descendants will be rejected. Note that this rejection takes \r
+ * precedence over <code>whatToShow</code> and the filter. Also note \r
+ * that this is currently the only situation where \r
+ * <code>NodeIterators</code> may reject a complete subtree rather than \r
+ * skipping individual nodes. \r
+ * <br>\r
+ * <br> To produce a view of the document that has entity references \r
+ * expanded and does not expose the entity reference node itself, use \r
+ * the <code>whatToShow</code> flags to hide the entity reference node \r
+ * and set <code>expandEntityReferences</code> to true when creating the \r
+ * iterator. To produce a view of the document that has entity reference \r
+ * nodes but no entity expansion, use the <code>whatToShow</code> flags \r
+ * to show the entity reference node and set \r
+ * <code>expandEntityReferences</code> to false.\r
+ */\r
+ public boolean getExpandEntityReferences();\r
+\r
+ /**\r
+ * Returns the next node in the set and advances the position of the \r
+ * iterator in the set. After a <code>NodeIterator</code> is created, \r
+ * the first call to <code>nextNode()</code> returns the first node in \r
+ * the set.\r
+ * @return The next <code>Node</code> in the set being iterated over, or \r
+ * <code>null</code> if there are no more members in that set.\r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if this method is called after the \r
+ * <code>detach</code> method was invoked.\r
+ */\r
+ public Node nextNode()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Returns the previous node in the set and moves the position of the \r
+ * <code>NodeIterator</code> backwards in the set.\r
+ * @return The previous <code>Node</code> in the set being iterated over, \r
+ * or <code>null</code> if there are no more members in that set. \r
+ * @exception DOMException\r
+ * INVALID_STATE_ERR: Raised if this method is called after the \r
+ * <code>detach</code> method was invoked.\r
+ */\r
+ public Node previousNode()\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Detaches the <code>NodeIterator</code> from the set which it iterated \r
+ * over, releasing any computational resources and placing the iterator \r
+ * in the INVALID state. After <code>detach</code> has been invoked, \r
+ * calls to <code>nextNode</code> or <code>previousNode</code> will \r
+ * raise the exception INVALID_STATE_ERR.\r
+ */\r
+ public void detach();\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2000 World Wide Web Consortium,\r
+ * (Massachusetts Institute of Technology, Institut National de\r
+ * Recherche en Informatique et en Automatique, Keio University). All\r
+ * Rights Reserved. This program is distributed under the W3C's Software\r
+ * Intellectual Property License. This program is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE.\r
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
+ */\r
+\r
+package org.w3c.dom.traversal;\r
+\r
+import org.w3c.dom.Node;\r
+import org.w3c.dom.DOMException;\r
+\r
+/**\r
+ * <code>TreeWalker</code> objects are used to navigate a document tree or \r
+ * subtree using the view of the document defined by their \r
+ * <code>whatToShow</code> flags and filter (if any). Any function which \r
+ * performs navigation using a <code>TreeWalker</code> will automatically \r
+ * support any view defined by a <code>TreeWalker</code>.\r
+ * <p>Omitting nodes from the logical view of a subtree can result in a \r
+ * structure that is substantially different from the same subtree in the \r
+ * complete, unfiltered document. Nodes that are siblings in the \r
+ * <code>TreeWalker</code> view may be children of different, widely \r
+ * separated nodes in the original view. For instance, consider a \r
+ * <code>NodeFilter</code> that skips all nodes except for Text nodes and \r
+ * the root node of a document. In the logical view that results, all text \r
+ * nodes will be siblings and appear as direct children of the root node, no \r
+ * matter how deeply nested the structure of the original document.\r
+ * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.\r
+ * @since DOM Level 2\r
+ */\r
+public interface TreeWalker {\r
+ /**\r
+ * The <code>root</code> node of the <code>TreeWalker</code>, as specified \r
+ * when it was created.\r
+ */\r
+ public Node getRoot();\r
+\r
+ /**\r
+ * This attribute determines which node types are presented via the \r
+ * <code>TreeWalker</code>. The available set of constants is defined in \r
+ * the <code>NodeFilter</code> interface. Nodes not accepted by \r
+ * <code>whatToShow</code> will be skipped, but their children may still \r
+ * be considered. Note that this skip takes precedence over the filter, \r
+ * if any. \r
+ */\r
+ public int getWhatToShow();\r
+\r
+ /**\r
+ * The filter used to screen nodes.\r
+ */\r
+ public NodeFilter getFilter();\r
+\r
+ /**\r
+ * The value of this flag determines whether the children of entity \r
+ * reference nodes are visible to the <code>TreeWalker</code>. If false, \r
+ * they and their descendants will be rejected. Note that this \r
+ * rejection takes precedence over <code>whatToShow</code> and the \r
+ * filter, if any. \r
+ * <br> To produce a view of the document that has entity references \r
+ * expanded and does not expose the entity reference node itself, use \r
+ * the <code>whatToShow</code> flags to hide the entity reference node \r
+ * and set <code>expandEntityReferences</code> to true when creating the \r
+ * <code>TreeWalker</code>. To produce a view of the document that has \r
+ * entity reference nodes but no entity expansion, use the \r
+ * <code>whatToShow</code> flags to show the entity reference node and \r
+ * set <code>expandEntityReferences</code> to false.\r
+ */\r
+ public boolean getExpandEntityReferences();\r
+\r
+ /**\r
+ * The node at which the <code>TreeWalker</code> is currently positioned.\r
+ * <br>Alterations to the DOM tree may cause the current node to no longer \r
+ * be accepted by the <code>TreeWalker</code>'s associated filter. \r
+ * <code>currentNode</code> may also be explicitly set to any node, \r
+ * whether or not it is within the subtree specified by the \r
+ * <code>root</code> node or would be accepted by the filter and \r
+ * <code>whatToShow</code> flags. Further traversal occurs relative to \r
+ * <code>currentNode</code> even if it is not part of the current view, \r
+ * by applying the filters in the requested direction; if no traversal \r
+ * is possible, <code>currentNode</code> is not changed. \r
+ * @exception DOMException\r
+ * NOT_SUPPORTED_ERR: Raised if an attempt is made to set \r
+ * <code>currentNode</code> to <code>null</code>.\r
+ */\r
+ public Node getCurrentNode();\r
+ public void setCurrentNode(Node currentNode)\r
+ throws DOMException;\r
+\r
+ /**\r
+ * Moves to and returns the closest visible ancestor node of the current \r
+ * node. If the search for <code>parentNode</code> attempts to step \r
+ * upward from the <code>TreeWalker</code>'s <code>root</code> node, or \r
+ * if it fails to find a visible ancestor node, this method retains the \r
+ * current position and returns <code>null</code>.\r
+ * @return The new parent node, or <code>null</code> if the current node \r
+ * has no parent in the <code>TreeWalker</code>'s logical view. \r
+ */\r
+ public Node parentNode();\r
+\r
+ /**\r
+ * Moves the <code>TreeWalker</code> to the first visible child of the \r
+ * current node, and returns the new node. If the current node has no \r
+ * visible children, returns <code>null</code>, and retains the current \r
+ * node.\r
+ * @return The new node, or <code>null</code> if the current node has no \r
+ * visible children in the <code>TreeWalker</code>'s logical view. \r
+ */\r
+ public Node firstChild();\r
+\r
+ /**\r
+ * Moves the <code>TreeWalker</code> to the last visible child of the \r
+ * current node, and returns the new node. If the current node has no \r
+ * visible children, returns <code>null</code>, and retains the current \r
+ * node.\r
+ * @return The new node, or <code>null</code> if the current node has no \r
+ * children in the <code>TreeWalker</code>'s logical view. \r
+ */\r
+ public Node lastChild();\r
+\r
+ /**\r
+ * Moves the <code>TreeWalker</code> to the previous sibling of the \r
+ * current node, and returns the new node. If the current node has no \r
+ * visible previous sibling, returns <code>null</code>, and retains the \r
+ * current node.\r
+ * @return The new node, or <code>null</code> if the current node has no \r
+ * previous sibling. in the <code>TreeWalker</code>'s logical view. \r
+ */\r
+ public Node previousSibling();\r
+\r
+ /**\r
+ * Moves the <code>TreeWalker</code> to the next sibling of the current \r
+ * node, and returns the new node. If the current node has no visible \r
+ * next sibling, returns <code>null</code>, and retains the current node.\r
+ * @return The new node, or <code>null</code> if the current node has no \r
+ * next sibling. in the <code>TreeWalker</code>'s logical view. \r
+ */\r
+ public Node nextSibling();\r
+\r
+ /**\r
+ * Moves the <code>TreeWalker</code> to the previous visible node in \r
+ * document order relative to the current node, and returns the new \r
+ * node. If the current node has no previous node, or if the search for \r
+ * <code>previousNode</code> attempts to step upward from the \r
+ * <code>TreeWalker</code>'s <code>root</code> node, returns \r
+ * <code>null</code>, and retains the current node. \r
+ * @return The new node, or <code>null</code> if the current node has no \r
+ * previous node in the <code>TreeWalker</code>'s logical view. \r
+ */\r
+ public Node previousNode();\r
+\r
+ /**\r
+ * Moves the <code>TreeWalker</code> to the next visible node in document \r
+ * order relative to the current node, and returns the new node. If the \r
+ * current node has no next node, or if the search for nextNode attempts \r
+ * to step upward from the <code>TreeWalker</code>'s <code>root</code> \r
+ * node, returns <code>null</code>, and retains the current node.\r
+ * @return The new node, or <code>null</code> if the current node has no \r
+ * next node in the <code>TreeWalker</code>'s logical view. \r
+ */\r
+ public Node nextNode();\r
+\r
+}\r
--- /dev/null
+// SAX Attribute List Interface.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: AttributeList.java,v 1.1 2000/10/02 02:43:16 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+/**\r
+ * Interface for an element's attribute specifications.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This is the original SAX1 interface for reporting an element's\r
+ * attributes. Unlike the new {@link org.xml.sax.Attributes Attributes}\r
+ * interface, it does not support Namespace-related information.</p>\r
+ *\r
+ * <p>When an attribute list is supplied as part of a\r
+ * {@link org.xml.sax.DocumentHandler#startElement startElement}\r
+ * event, the list will return valid results only during the\r
+ * scope of the event; once the event handler returns control\r
+ * to the parser, the attribute list is invalid. To save a\r
+ * persistent copy of the attribute list, use the SAX1\r
+ * {@link org.xml.sax.helpers.AttributeListImpl AttributeListImpl}\r
+ * helper class.</p>\r
+ *\r
+ * <p>An attribute list includes only attributes that have been\r
+ * specified or defaulted: #IMPLIED attributes will not be included.</p>\r
+ *\r
+ * <p>There are two ways for the SAX application to obtain information\r
+ * from the AttributeList. First, it can iterate through the entire\r
+ * list:</p>\r
+ *\r
+ * <pre>\r
+ * public void startElement (String name, AttributeList atts) {\r
+ * for (int i = 0; i < atts.getLength(); i++) {\r
+ * String name = atts.getName(i);\r
+ * String type = atts.getType(i);\r
+ * String value = atts.getValue(i);\r
+ * [...]\r
+ * }\r
+ * }\r
+ * </pre>\r
+ *\r
+ * <p>(Note that the result of getLength() will be zero if there\r
+ * are no attributes.)\r
+ *\r
+ * <p>As an alternative, the application can request the value or\r
+ * type of specific attributes:</p>\r
+ *\r
+ * <pre>\r
+ * public void startElement (String name, AttributeList atts) {\r
+ * String identifier = atts.getValue("id");\r
+ * String label = atts.getValue("label");\r
+ * [...]\r
+ * }\r
+ * </pre>\r
+ *\r
+ * @deprecated This interface has been replaced by the SAX2\r
+ * {@link org.xml.sax.Attributes Attributes}\r
+ * interface, which includes Namespace support.\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.DocumentHandler#startElement startElement\r
+ * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl\r
+ */\r
+public interface AttributeList {\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Iteration methods.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+\r
+ /**\r
+ * Return the number of attributes in this list.\r
+ *\r
+ * <p>The SAX parser may provide attributes in any\r
+ * arbitrary order, regardless of the order in which they were\r
+ * declared or specified. The number of attributes may be\r
+ * zero.</p>\r
+ *\r
+ * @return The number of attributes in the list. \r
+ */\r
+ public abstract int getLength ();\r
+ \r
+ \r
+ /**\r
+ * Return the name of an attribute in this list (by position).\r
+ *\r
+ * <p>The names must be unique: the SAX parser shall not include the\r
+ * same attribute twice. Attributes without values (those declared\r
+ * #IMPLIED without a value specified in the start tag) will be\r
+ * omitted from the list.</p>\r
+ *\r
+ * <p>If the attribute name has a namespace prefix, the prefix\r
+ * will still be attached.</p>\r
+ *\r
+ * @param i The index of the attribute in the list (starting at 0).\r
+ * @return The name of the indexed attribute, or null\r
+ * if the index is out of range.\r
+ * @see #getLength \r
+ */\r
+ public abstract String getName (int i);\r
+ \r
+ \r
+ /**\r
+ * Return the type of an attribute in the list (by position).\r
+ *\r
+ * <p>The attribute type is one of the strings "CDATA", "ID",\r
+ * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",\r
+ * or "NOTATION" (always in upper case).</p>\r
+ *\r
+ * <p>If the parser has not read a declaration for the attribute,\r
+ * or if the parser does not report attribute types, then it must\r
+ * return the value "CDATA" as stated in the XML 1.0 Recommentation\r
+ * (clause 3.3.3, "Attribute-Value Normalization").</p>\r
+ *\r
+ * <p>For an enumerated attribute that is not a notation, the\r
+ * parser will report the type as "NMTOKEN".</p>\r
+ *\r
+ * @param i The index of the attribute in the list (starting at 0).\r
+ * @return The attribute type as a string, or\r
+ * null if the index is out of range.\r
+ * @see #getLength \r
+ * @see #getType(java.lang.String)\r
+ */\r
+ public abstract String getType (int i);\r
+ \r
+ \r
+ /**\r
+ * Return the value of an attribute in the list (by position).\r
+ *\r
+ * <p>If the attribute value is a list of tokens (IDREFS,\r
+ * ENTITIES, or NMTOKENS), the tokens will be concatenated\r
+ * into a single string separated by whitespace.</p>\r
+ *\r
+ * @param i The index of the attribute in the list (starting at 0).\r
+ * @return The attribute value as a string, or\r
+ * null if the index is out of range.\r
+ * @see #getLength\r
+ * @see #getValue(java.lang.String)\r
+ */\r
+ public abstract String getValue (int i);\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Lookup methods.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Return the type of an attribute in the list (by name).\r
+ *\r
+ * <p>The return value is the same as the return value for\r
+ * getType(int).</p>\r
+ *\r
+ * <p>If the attribute name has a namespace prefix in the document,\r
+ * the application must include the prefix here.</p>\r
+ *\r
+ * @param name The name of the attribute.\r
+ * @return The attribute type as a string, or null if no\r
+ * such attribute exists.\r
+ * @see #getType(int)\r
+ */\r
+ public abstract String getType (String name);\r
+ \r
+ \r
+ /**\r
+ * Return the value of an attribute in the list (by name).\r
+ *\r
+ * <p>The return value is the same as the return value for\r
+ * getValue(int).</p>\r
+ *\r
+ * <p>If the attribute name has a namespace prefix in the document,\r
+ * the application must include the prefix here.</p>\r
+ *\r
+ * @param i The index of the attribute in the list.\r
+ * @return The attribute value as a string, or null if\r
+ * no such attribute exists.\r
+ * @see #getValue(int)\r
+ */\r
+ public abstract String getValue (String name);\r
+ \r
+}\r
+\r
+// end of AttributeList.java\r
--- /dev/null
+// Attributes.java - attribute list with Namespace support\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the public domain.\r
+\r
+// $Id: Attributes.java,v 1.1 2000/10/02 02:43:16 sboag Exp $\r
+\r
+\r
+package org.xml.sax;\r
+\r
+\r
+/**\r
+ * Interface for a list of XML attributes.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This interface allows access to a list of attributes in\r
+ * three different ways:</p>\r
+ *\r
+ * <ol>\r
+ * <li>by attribute index;</li>\r
+ * <li>by Namespace-qualified name; or</li>\r
+ * <li>by qualified (prefixed) name.</li>\r
+ * </ol>\r
+ *\r
+ * <p>The list will not contain attributes that were declared\r
+ * #IMPLIED but not specified in the start tag. It will also not\r
+ * contain attributes used as Namespace declarations (xmlns*) unless\r
+ * the <code>http://xml.org/sax/features/namespace-prefixes</code> \r
+ * feature is set to <var>true</var> (it is <var>false</var> by \r
+ * default).</p>\r
+ *\r
+ * <p>If the namespace-prefixes feature (see above) is <var>false</var>, \r
+ * access by qualified name may not be available; if the \r
+ * <code>http://xml.org/sax/features/namespaces</code>\r
+ * feature is <var>false</var>, access by Namespace-qualified names \r
+ * may not be available.</p>\r
+ *\r
+ * <p>This interface replaces the now-deprecated SAX1 {@link\r
+ * org.xml.sax.AttributeList AttributeList} interface, which does not \r
+ * contain Namespace support. In addition to Namespace support, it \r
+ * adds the <var>getIndex</var> methods (below).</p>\r
+ *\r
+ * <p>The order of attributes in the list is unspecified, and will\r
+ * vary from implementation to implementation.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.helpers.AttributeListImpl\r
+ */\r
+public interface Attributes\r
+{\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Indexed access.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Return the number of attributes in the list.\r
+ *\r
+ * <p>Once you know the number of attributes, you can iterate\r
+ * through the list.</p>\r
+ *\r
+ * @return The number of attributes in the list.\r
+ * @see #getURI(int)\r
+ * @see #getLocalName(int)\r
+ * @see #getQName(int)\r
+ * @see #getType(int)\r
+ * @see #getValue(int)\r
+ */\r
+ public abstract int getLength ();\r
+\r
+\r
+ /**\r
+ * Look up an attribute's Namespace URI by index.\r
+ *\r
+ * @param index The attribute index (zero-based).\r
+ * @return The Namespace URI, or the empty string if none\r
+ * is available, or null if the index is out of\r
+ * range.\r
+ * @see #getLength\r
+ */\r
+ public abstract String getURI (int index);\r
+\r
+\r
+ /**\r
+ * Look up an attribute's local name by index.\r
+ *\r
+ * @param index The attribute index (zero-based).\r
+ * @return The local name, or the empty string if Namespace\r
+ * processing is not being performed, or null\r
+ * if the index is out of range.\r
+ * @see #getLength\r
+ */\r
+ public abstract String getLocalName (int index);\r
+\r
+\r
+ /**\r
+ * Look up an attribute's XML 1.0 qualified name by index.\r
+ *\r
+ * @param index The attribute index (zero-based).\r
+ * @return The XML 1.0 qualified name, or the empty string\r
+ * if none is available, or null if the index\r
+ * is out of range.\r
+ * @see #getLength\r
+ */\r
+ public abstract String getQName (int index);\r
+\r
+\r
+ /**\r
+ * Look up an attribute's type by index.\r
+ *\r
+ * <p>The attribute type is one of the strings "CDATA", "ID",\r
+ * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",\r
+ * or "NOTATION" (always in upper case).</p>\r
+ *\r
+ * <p>If the parser has not read a declaration for the attribute,\r
+ * or if the parser does not report attribute types, then it must\r
+ * return the value "CDATA" as stated in the XML 1.0 Recommentation\r
+ * (clause 3.3.3, "Attribute-Value Normalization").</p>\r
+ *\r
+ * <p>For an enumerated attribute that is not a notation, the\r
+ * parser will report the type as "NMTOKEN".</p>\r
+ *\r
+ * @param index The attribute index (zero-based).\r
+ * @return The attribute's type as a string, or null if the\r
+ * index is out of range.\r
+ * @see #getLength\r
+ */\r
+ public abstract String getType (int index);\r
+\r
+\r
+ /**\r
+ * Look up an attribute's value by index.\r
+ *\r
+ * <p>If the attribute value is a list of tokens (IDREFS,\r
+ * ENTITIES, or NMTOKENS), the tokens will be concatenated\r
+ * into a single string with each token separated by a\r
+ * single space.</p>\r
+ *\r
+ * @param index The attribute index (zero-based).\r
+ * @return The attribute's value as a string, or null if the\r
+ * index is out of range.\r
+ * @see #getLength\r
+ */\r
+ public abstract String getValue (int index);\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Name-based query.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Look up the index of an attribute by Namespace name.\r
+ *\r
+ * @param uri The Namespace URI, or the empty string if\r
+ * the name has no Namespace URI.\r
+ * @param localName The attribute's local name.\r
+ * @return The index of the attribute, or -1 if it does not\r
+ * appear in the list.\r
+ */\r
+ public int getIndex (String uri, String localPart);\r
+\r
+\r
+ /**\r
+ * Look up the index of an attribute by XML 1.0 qualified name.\r
+ *\r
+ * @param qName The qualified (prefixed) name.\r
+ * @return The index of the attribute, or -1 if it does not\r
+ * appear in the list.\r
+ */\r
+ public int getIndex (String qName);\r
+\r
+\r
+ /**\r
+ * Look up an attribute's type by Namespace name.\r
+ *\r
+ * <p>See {@link #getType(int) getType(int)} for a description\r
+ * of the possible types.</p>\r
+ *\r
+ * @param uri The Namespace URI, or the empty String if the\r
+ * name has no Namespace URI.\r
+ * @param localName The local name of the attribute.\r
+ * @return The attribute type as a string, or null if the\r
+ * attribute is not in the list or if Namespace\r
+ * processing is not being performed.\r
+ */\r
+ public abstract String getType (String uri, String localName);\r
+\r
+\r
+ /**\r
+ * Look up an attribute's type by XML 1.0 qualified name.\r
+ *\r
+ * <p>See {@link #getType(int) getType(int)} for a description\r
+ * of the possible types.</p>\r
+ *\r
+ * @param qName The XML 1.0 qualified name.\r
+ * @return The attribute type as a string, or null if the\r
+ * attribute is not in the list or if qualified names\r
+ * are not available.\r
+ */\r
+ public abstract String getType (String qName);\r
+\r
+\r
+ /**\r
+ * Look up an attribute's value by Namespace name.\r
+ *\r
+ * <p>See {@link #getValue(int) getValue(int)} for a description\r
+ * of the possible values.</p>\r
+ *\r
+ * @param uri The Namespace URI, or the empty String if the\r
+ * name has no Namespace URI.\r
+ * @param localName The local name of the attribute.\r
+ * @return The attribute value as a string, or null if the\r
+ * attribute is not in the list.\r
+ */\r
+ public abstract String getValue (String uri, String localName);\r
+\r
+\r
+ /**\r
+ * Look up an attribute's value by XML 1.0 qualified name.\r
+ *\r
+ * <p>See {@link #getValue(int) getValue(int)} for a description\r
+ * of the possible values.</p>\r
+ *\r
+ * @param qName The XML 1.0 qualified name.\r
+ * @return The attribute value as a string, or null if the\r
+ * attribute is not in the list or if qualified names\r
+ * are not available.\r
+ */\r
+ public abstract String getValue (String qName);\r
+\r
+}\r
+\r
+// end of Attributes.java\r
--- /dev/null
+// ContentHandler.java - handle main document content.\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the public domain.\r
+\r
+// $Id: ContentHandler.java,v 1.1 2000/10/02 02:43:16 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+\r
+/**\r
+ * Receive notification of the logical content of a document.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This is the main interface that most SAX applications\r
+ * implement: if the application needs to be informed of basic parsing \r
+ * events, it implements this interface and registers an instance with \r
+ * the SAX parser using the {@link org.xml.sax.XMLReader#setContentHandler \r
+ * setContentHandler} method. The parser uses the instance to report \r
+ * basic document-related events like the start and end of elements \r
+ * and character data.</p>\r
+ *\r
+ * <p>The order of events in this interface is very important, and\r
+ * mirrors the order of information in the document itself. For\r
+ * example, all of an element's content (character data, processing\r
+ * instructions, and/or subelements) will appear, in order, between\r
+ * the startElement event and the corresponding endElement event.</p>\r
+ *\r
+ * <p>This interface is similar to the now-deprecated SAX 1.0\r
+ * DocumentHandler interface, but it adds support for Namespaces\r
+ * and for reporting skipped entities (in non-validating XML\r
+ * processors).</p>\r
+ *\r
+ * <p>Implementors should note that there is also a Java class\r
+ * {@link java.net.ContentHandler ContentHandler} in the java.net\r
+ * package; that means that it's probably a bad idea to do</p>\r
+ *\r
+ * <blockquote>\r
+ * import java.net.*;\r
+ * import org.xml.sax.*;\r
+ * </blockquote>\r
+ *\r
+ * <p>In fact, "import ...*" is usually a sign of sloppy programming\r
+ * anyway, so the user should consider this a feature rather than a\r
+ * bug.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.XMLReader\r
+ * @see org.xml.sax.DTDHandler\r
+ * @see org.xml.sax.ErrorHandler\r
+ */\r
+public interface ContentHandler\r
+{\r
+\r
+ /**\r
+ * Receive an object for locating the origin of SAX document events.\r
+ *\r
+ * <p>SAX parsers are strongly encouraged (though not absolutely\r
+ * required) to supply a locator: if it does so, it must supply\r
+ * the locator to the application by invoking this method before\r
+ * invoking any of the other methods in the ContentHandler\r
+ * interface.</p>\r
+ *\r
+ * <p>The locator allows the application to determine the end\r
+ * position of any document-related event, even if the parser is\r
+ * not reporting an error. Typically, the application will\r
+ * use this information for reporting its own errors (such as\r
+ * character content that does not match an application's\r
+ * business rules). The information returned by the locator\r
+ * is probably not sufficient for use with a search engine.</p>\r
+ *\r
+ * <p>Note that the locator will return correct information only\r
+ * during the invocation of the events in this interface. The\r
+ * application should not attempt to use it at any other time.</p>\r
+ *\r
+ * @param locator An object that can return the location of\r
+ * any SAX document event.\r
+ * @see org.xml.sax.Locator\r
+ */\r
+ public void setDocumentLocator (Locator locator);\r
+\r
+\r
+ /**\r
+ * Receive notification of the beginning of a document.\r
+ *\r
+ * <p>The SAX parser will invoke this method only once, before any\r
+ * other methods in this interface or in {@link org.xml.sax.DTDHandler\r
+ * DTDHandler} (except for {@link #setDocumentLocator \r
+ * setDocumentLocator}).</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see #endDocument\r
+ */\r
+ public void startDocument ()\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Receive notification of the end of a document.\r
+ *\r
+ * <p>The SAX parser will invoke this method only once, and it will\r
+ * be the last method invoked during the parse. The parser shall\r
+ * not invoke this method until it has either abandoned parsing\r
+ * (because of an unrecoverable error) or reached the end of\r
+ * input.</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see #startDocument\r
+ */\r
+ public void endDocument()\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Begin the scope of a prefix-URI Namespace mapping.\r
+ *\r
+ * <p>The information from this event is not necessary for\r
+ * normal Namespace processing: the SAX XML reader will \r
+ * automatically replace prefixes for element and attribute\r
+ * names when the <code>http://xml.org/sax/features/namespaces</code>\r
+ * feature is <var>true</var> (the default).</p>\r
+ *\r
+ * <p>There are cases, however, when applications need to\r
+ * use prefixes in character data or in attribute values,\r
+ * where they cannot safely be expanded automatically; the\r
+ * start/endPrefixMapping event supplies the information\r
+ * to the application to expand prefixes in those contexts\r
+ * itself, if necessary.</p>\r
+ *\r
+ * <p>Note that start/endPrefixMapping events are not\r
+ * guaranteed to be properly nested relative to each-other:\r
+ * all startPrefixMapping events will occur before the\r
+ * corresponding {@link #startElement startElement} event, \r
+ * and all {@link #endPrefixMapping endPrefixMapping}\r
+ * events will occur after the corresponding {@link #endElement\r
+ * endElement} event, but their order is not otherwise \r
+ * guaranteed.</p>\r
+ *\r
+ * <p>There should never be start/endPrefixMapping events for the\r
+ * "xml" prefix, since it is predeclared and immutable.</p>\r
+ *\r
+ * @param prefix The Namespace prefix being declared.\r
+ * @param uri The Namespace URI the prefix is mapped to.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see #endPrefixMapping\r
+ * @see #startElement\r
+ */\r
+ public void startPrefixMapping (String prefix, String uri)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * End the scope of a prefix-URI mapping.\r
+ *\r
+ * <p>See {@link #startPrefixMapping startPrefixMapping} for \r
+ * details. This event will always occur after the corresponding \r
+ * {@link #endElement endElement} event, but the order of \r
+ * {@link #endPrefixMapping endPrefixMapping} events is not otherwise\r
+ * guaranteed.</p>\r
+ *\r
+ * @param prefix The prefix that was being mapping.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see #startPrefixMapping\r
+ * @see #endElement\r
+ */\r
+ public void endPrefixMapping (String prefix)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Receive notification of the beginning of an element.\r
+ *\r
+ * <p>The Parser will invoke this method at the beginning of every\r
+ * element in the XML document; there will be a corresponding\r
+ * {@link #endElement endElement} event for every startElement event\r
+ * (even when the element is empty). All of the element's content will be\r
+ * reported, in order, before the corresponding endElement\r
+ * event.</p>\r
+ *\r
+ * <p>This event allows up to three name components for each\r
+ * element:</p>\r
+ *\r
+ * <ol>\r
+ * <li>the Namespace URI;</li>\r
+ * <li>the local name; and</li>\r
+ * <li>the qualified (prefixed) name.</li>\r
+ * </ol>\r
+ *\r
+ * <p>Any or all of these may be provided, depending on the\r
+ * values of the <var>http://xml.org/sax/features/namespaces</var>\r
+ * and the <var>http://xml.org/sax/features/namespace-prefixes</var>\r
+ * properties:</p>\r
+ *\r
+ * <ul>\r
+ * <li>the Namespace URI and local name are required when \r
+ * the namespaces property is <var>true</var> (the default), and are\r
+ * optional when the namespaces property is <var>false</var> (if one is\r
+ * specified, both must be);</li>\r
+ * <li>the qualified name is required when the namespace-prefixes property\r
+ * is <var>true</var>, and is optional when the namespace-prefixes property\r
+ * is <var>false</var> (the default).</li>\r
+ * </ul>\r
+ *\r
+ * <p>Note that the attribute list provided will contain only\r
+ * attributes with explicit values (specified or defaulted):\r
+ * #IMPLIED attributes will be omitted. The attribute list\r
+ * will contain attributes used for Namespace declarations\r
+ * (xmlns* attributes) only if the\r
+ * <code>http://xml.org/sax/features/namespace-prefixes</code>\r
+ * property is true (it is false by default, and support for a \r
+ * true value is optional).</p>\r
+ *\r
+ * @param uri The Namespace URI, or the empty string if the\r
+ * element has no Namespace URI or if Namespace\r
+ * processing is not being performed.\r
+ * @param localName The local name (without prefix), or the\r
+ * empty string if Namespace processing is not being\r
+ * performed.\r
+ * @param qName The qualified name (with prefix), or the\r
+ * empty string if qualified names are not available.\r
+ * @param atts The attributes attached to the element. If\r
+ * there are no attributes, it shall be an empty\r
+ * Attributes object.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see #endElement\r
+ * @see org.xml.sax.Attributes\r
+ */\r
+ public void startElement (String namespaceURI, String localName,\r
+ String qName, Attributes atts)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Receive notification of the end of an element.\r
+ *\r
+ * <p>The SAX parser will invoke this method at the end of every\r
+ * element in the XML document; there will be a corresponding\r
+ * {@link #startElement startElement} event for every endElement \r
+ * event (even when the element is empty).</p>\r
+ *\r
+ * <p>For information on the names, see startElement.</p>\r
+ *\r
+ * @param uri The Namespace URI, or the empty string if the\r
+ * element has no Namespace URI or if Namespace\r
+ * processing is not being performed.\r
+ * @param localName The local name (without prefix), or the\r
+ * empty string if Namespace processing is not being\r
+ * performed.\r
+ * @param qName The qualified XML 1.0 name (with prefix), or the\r
+ * empty string if qualified names are not available.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ */\r
+ public void endElement (String namespaceURI, String localName,\r
+ String qName)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Receive notification of character data.\r
+ *\r
+ * <p>The Parser will call this method to report each chunk of\r
+ * character data. SAX parsers may return all contiguous character\r
+ * data in a single chunk, or they may split it into several\r
+ * chunks; however, all of the characters in any single event\r
+ * must come from the same external entity so that the Locator\r
+ * provides useful information.</p>\r
+ *\r
+ * <p>The application must not attempt to read from the array\r
+ * outside of the specified range.</p>\r
+ *\r
+ * <p>Note that some parsers will report whitespace in element\r
+ * content using the {@link #ignorableWhitespace ignorableWhitespace}\r
+ * method rather than this one (validating parsers <em>must</em> \r
+ * do so).</p>\r
+ *\r
+ * @param ch The characters from the XML document.\r
+ * @param start The start position in the array.\r
+ * @param length The number of characters to read from the array.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see #ignorableWhitespace \r
+ * @see org.xml.sax.Locator\r
+ */\r
+ public void characters (char ch[], int start, int length)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Receive notification of ignorable whitespace in element content.\r
+ *\r
+ * <p>Validating Parsers must use this method to report each chunk\r
+ * of whitespace in element content (see the W3C XML 1.0 recommendation,\r
+ * section 2.10): non-validating parsers may also use this method\r
+ * if they are capable of parsing and using content models.</p>\r
+ *\r
+ * <p>SAX parsers may return all contiguous whitespace in a single\r
+ * chunk, or they may split it into several chunks; however, all of\r
+ * the characters in any single event must come from the same\r
+ * external entity, so that the Locator provides useful\r
+ * information.</p>\r
+ *\r
+ * <p>The application must not attempt to read from the array\r
+ * outside of the specified range.</p>\r
+ *\r
+ * @param ch The characters from the XML document.\r
+ * @param start The start position in the array.\r
+ * @param length The number of characters to read from the array.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see #characters\r
+ */\r
+ public void ignorableWhitespace (char ch[], int start, int length)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Receive notification of a processing instruction.\r
+ *\r
+ * <p>The Parser will invoke this method once for each processing\r
+ * instruction found: note that processing instructions may occur\r
+ * before or after the main document element.</p>\r
+ *\r
+ * <p>A SAX parser must never report an XML declaration (XML 1.0,\r
+ * section 2.8) or a text declaration (XML 1.0, section 4.3.1)\r
+ * using this method.</p>\r
+ *\r
+ * @param target The processing instruction target.\r
+ * @param data The processing instruction data, or null if\r
+ * none was supplied. The data does not include any\r
+ * whitespace separating it from the target.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ */\r
+ public void processingInstruction (String target, String data)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Receive notification of a skipped entity.\r
+ *\r
+ * <p>The Parser will invoke this method once for each entity\r
+ * skipped. Non-validating processors may skip entities if they\r
+ * have not seen the declarations (because, for example, the\r
+ * entity was declared in an external DTD subset). All processors\r
+ * may skip external entities, depending on the values of the\r
+ * <code>http://xml.org/sax/features/external-general-entities</code>\r
+ * and the\r
+ * <code>http://xml.org/sax/features/external-parameter-entities</code>\r
+ * properties.</p>\r
+ *\r
+ * @param name The name of the skipped entity. If it is a \r
+ * parameter entity, the name will begin with '%', and if\r
+ * it is the external DTD subset, it will be the string\r
+ * "[dtd]".\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ */\r
+ public void skippedEntity (String name)\r
+ throws SAXException;\r
+}\r
+\r
+// end of ContentHandler.java\r
--- /dev/null
+// SAX DTD handler.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: DTDHandler.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+/**\r
+ * Receive notification of basic DTD-related events.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>If a SAX application needs information about notations and\r
+ * unparsed entities, then the application implements this \r
+ * interface and registers an instance with the SAX parser using \r
+ * the parser's setDTDHandler method. The parser uses the \r
+ * instance to report notation and unparsed entity declarations to \r
+ * the application.</p>\r
+ *\r
+ * <p>Note that this interface includes only those DTD events that\r
+ * the XML recommendation <em>requires</em> processors to report:\r
+ * notation and unparsed entity declarations.</p>\r
+ *\r
+ * <p>The SAX parser may report these events in any order, regardless\r
+ * of the order in which the notations and unparsed entities were\r
+ * declared; however, all DTD events must be reported after the\r
+ * document handler's startDocument event, and before the first\r
+ * startElement event.</p>\r
+ *\r
+ * <p>It is up to the application to store the information for \r
+ * future use (perhaps in a hash table or object tree).\r
+ * If the application encounters attributes of type "NOTATION",\r
+ * "ENTITY", or "ENTITIES", it can use the information that it\r
+ * obtained through this interface to find the entity and/or\r
+ * notation corresponding with the attribute value.</p>\r
+ *\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.Parser#setDTDHandler\r
+ * @see org.xml.sax.HandlerBase \r
+ */\r
+public interface DTDHandler {\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a notation declaration event.\r
+ *\r
+ * <p>It is up to the application to record the notation for later\r
+ * reference, if necessary.</p>\r
+ *\r
+ * <p>At least one of publicId and systemId must be non-null.\r
+ * If a system identifier is present, and it is a URL, the SAX\r
+ * parser must resolve it fully before passing it to the\r
+ * application through this event.</p>\r
+ *\r
+ * <p>There is no guarantee that the notation declaration will be\r
+ * reported before any unparsed entities that use it.</p>\r
+ *\r
+ * @param name The notation name.\r
+ * @param publicId The notation's public identifier, or null if\r
+ * none was given.\r
+ * @param systemId The notation's system identifier, or null if\r
+ * none was given.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see #unparsedEntityDecl\r
+ * @see org.xml.sax.AttributeList\r
+ */\r
+ public abstract void notationDecl (String name,\r
+ String publicId,\r
+ String systemId)\r
+ throws SAXException;\r
+ \r
+ \r
+ /**\r
+ * Receive notification of an unparsed entity declaration event.\r
+ *\r
+ * <p>Note that the notation name corresponds to a notation\r
+ * reported by the {@link #notationDecl notationDecl} event. \r
+ * It is up to the application to record the entity for later \r
+ * reference, if necessary.</p>\r
+ *\r
+ * <p>If the system identifier is a URL, the parser must resolve it\r
+ * fully before passing it to the application.</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @param name The unparsed entity's name.\r
+ * @param publicId The entity's public identifier, or null if none\r
+ * was given.\r
+ * @param systemId The entity's system identifier.\r
+ * @param notation name The name of the associated notation.\r
+ * @see #notationDecl\r
+ * @see org.xml.sax.AttributeList\r
+ */\r
+ public abstract void unparsedEntityDecl (String name,\r
+ String publicId,\r
+ String systemId,\r
+ String notationName)\r
+ throws SAXException;\r
+ \r
+}\r
+\r
+// end of DTDHandler.java\r
--- /dev/null
+// SAX document handler.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: DocumentHandler.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+/**\r
+ * Receive notification of general document events.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This was the main event-handling interface for SAX1; in\r
+ * SAX2, it has been replaced by {@link org.xml.sax.ContentHandler\r
+ * ContentHandler}, which provides Namespace support and reporting\r
+ * of skipped entities. This interface is included in SAX2 only\r
+ * to support legacy SAX1 applications.</p>\r
+ *\r
+ * <p>The order of events in this interface is very important, and\r
+ * mirrors the order of information in the document itself. For\r
+ * example, all of an element's content (character data, processing\r
+ * instructions, and/or subelements) will appear, in order, between\r
+ * the startElement event and the corresponding endElement event.</p>\r
+ *\r
+ * <p>Application writers who do not want to implement the entire\r
+ * interface can derive a class from HandlerBase, which implements\r
+ * the default functionality; parser writers can instantiate\r
+ * HandlerBase to obtain a default handler. The application can find\r
+ * the location of any document event using the Locator interface\r
+ * supplied by the Parser through the setDocumentLocator method.</p>\r
+ *\r
+ * @deprecated This interface has been replaced by the SAX2\r
+ * {@link org.xml.sax.ContentHandler ContentHandler}\r
+ * interface, which includes Namespace support.\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.Parser#setDocumentHandler\r
+ * @see org.xml.sax.Locator\r
+ * @see org.xml.sax.HandlerBase\r
+ */\r
+public interface DocumentHandler {\r
+ \r
+ \r
+ /**\r
+ * Receive an object for locating the origin of SAX document events.\r
+ *\r
+ * <p>SAX parsers are strongly encouraged (though not absolutely\r
+ * required) to supply a locator: if it does so, it must supply\r
+ * the locator to the application by invoking this method before\r
+ * invoking any of the other methods in the DocumentHandler\r
+ * interface.</p>\r
+ *\r
+ * <p>The locator allows the application to determine the end\r
+ * position of any document-related event, even if the parser is\r
+ * not reporting an error. Typically, the application will\r
+ * use this information for reporting its own errors (such as\r
+ * character content that does not match an application's\r
+ * business rules). The information returned by the locator\r
+ * is probably not sufficient for use with a search engine.</p>\r
+ *\r
+ * <p>Note that the locator will return correct information only\r
+ * during the invocation of the events in this interface. The\r
+ * application should not attempt to use it at any other time.</p>\r
+ *\r
+ * @param locator An object that can return the location of\r
+ * any SAX document event.\r
+ * @see org.xml.sax.Locator\r
+ */\r
+ public abstract void setDocumentLocator (Locator locator);\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the beginning of a document.\r
+ *\r
+ * <p>The SAX parser will invoke this method only once, before any\r
+ * other methods in this interface or in DTDHandler (except for\r
+ * setDocumentLocator).</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ */\r
+ public abstract void startDocument ()\r
+ throws SAXException;\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the end of a document.\r
+ *\r
+ * <p>The SAX parser will invoke this method only once, and it will\r
+ * be the last method invoked during the parse. The parser shall\r
+ * not invoke this method until it has either abandoned parsing\r
+ * (because of an unrecoverable error) or reached the end of\r
+ * input.</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ */\r
+ public abstract void endDocument ()\r
+ throws SAXException;\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the beginning of an element.\r
+ *\r
+ * <p>The Parser will invoke this method at the beginning of every\r
+ * element in the XML document; there will be a corresponding\r
+ * endElement() event for every startElement() event (even when the\r
+ * element is empty). All of the element's content will be\r
+ * reported, in order, before the corresponding endElement()\r
+ * event.</p>\r
+ *\r
+ * <p>If the element name has a namespace prefix, the prefix will\r
+ * still be attached. Note that the attribute list provided will\r
+ * contain only attributes with explicit values (specified or\r
+ * defaulted): #IMPLIED attributes will be omitted.</p>\r
+ *\r
+ * @param name The element type name.\r
+ * @param atts The attributes attached to the element, if any.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see #endElement\r
+ * @see org.xml.sax.AttributeList \r
+ */\r
+ public abstract void startElement (String name, AttributeList atts)\r
+ throws SAXException;\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the end of an element.\r
+ *\r
+ * <p>The SAX parser will invoke this method at the end of every\r
+ * element in the XML document; there will be a corresponding\r
+ * startElement() event for every endElement() event (even when the\r
+ * element is empty).</p>\r
+ *\r
+ * <p>If the element name has a namespace prefix, the prefix will\r
+ * still be attached to the name.</p>\r
+ *\r
+ * @param name The element type name\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ */\r
+ public abstract void endElement (String name)\r
+ throws SAXException;\r
+ \r
+ \r
+ /**\r
+ * Receive notification of character data.\r
+ *\r
+ * <p>The Parser will call this method to report each chunk of\r
+ * character data. SAX parsers may return all contiguous character\r
+ * data in a single chunk, or they may split it into several\r
+ * chunks; however, all of the characters in any single event\r
+ * must come from the same external entity, so that the Locator\r
+ * provides useful information.</p>\r
+ *\r
+ * <p>The application must not attempt to read from the array\r
+ * outside of the specified range.</p>\r
+ *\r
+ * <p>Note that some parsers will report whitespace using the\r
+ * ignorableWhitespace() method rather than this one (validating\r
+ * parsers must do so).</p>\r
+ *\r
+ * @param ch The characters from the XML document.\r
+ * @param start The start position in the array.\r
+ * @param length The number of characters to read from the array.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see #ignorableWhitespace \r
+ * @see org.xml.sax.Locator\r
+ */\r
+ public abstract void characters (char ch[], int start, int length)\r
+ throws SAXException;\r
+ \r
+ \r
+ /**\r
+ * Receive notification of ignorable whitespace in element content.\r
+ *\r
+ * <p>Validating Parsers must use this method to report each chunk\r
+ * of ignorable whitespace (see the W3C XML 1.0 recommendation,\r
+ * section 2.10): non-validating parsers may also use this method\r
+ * if they are capable of parsing and using content models.</p>\r
+ *\r
+ * <p>SAX parsers may return all contiguous whitespace in a single\r
+ * chunk, or they may split it into several chunks; however, all of\r
+ * the characters in any single event must come from the same\r
+ * external entity, so that the Locator provides useful\r
+ * information.</p>\r
+ *\r
+ * <p>The application must not attempt to read from the array\r
+ * outside of the specified range.</p>\r
+ *\r
+ * @param ch The characters from the XML document.\r
+ * @param start The start position in the array.\r
+ * @param length The number of characters to read from the array.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see #characters\r
+ */\r
+ public abstract void ignorableWhitespace (char ch[], int start, int length)\r
+ throws SAXException;\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a processing instruction.\r
+ *\r
+ * <p>The Parser will invoke this method once for each processing\r
+ * instruction found: note that processing instructions may occur\r
+ * before or after the main document element.</p>\r
+ *\r
+ * <p>A SAX parser should never report an XML declaration (XML 1.0,\r
+ * section 2.8) or a text declaration (XML 1.0, section 4.3.1)\r
+ * using this method.</p>\r
+ *\r
+ * @param target The processing instruction target.\r
+ * @param data The processing instruction data, or null if\r
+ * none was supplied.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ */\r
+ public abstract void processingInstruction (String target, String data)\r
+ throws SAXException;\r
+ \r
+}\r
+\r
+// end of DocumentHandler.java\r
--- /dev/null
+// SAX entity resolver.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: EntityResolver.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+import java.io.IOException;\r
+\r
+\r
+/**\r
+ * Basic interface for resolving entities.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>If a SAX application needs to implement customized handling\r
+ * for external entities, it must implement this interface and\r
+ * register an instance with the SAX driver using the\r
+ * {@link org.xml.sax.XMLReader#setEntityResolver setEntityResolver}\r
+ * method.</p>\r
+ *\r
+ * <p>The XML reader will then allow the application to intercept any\r
+ * external entities (including the external DTD subset and external\r
+ * parameter entities, if any) before including them.</p>\r
+ *\r
+ * <p>Many SAX applications will not need to implement this interface,\r
+ * but it will be especially useful for applications that build\r
+ * XML documents from databases or other specialised input sources,\r
+ * or for applications that use URI types other than URLs.</p>\r
+ *\r
+ * <p>The following resolver would provide the application\r
+ * with a special character stream for the entity with the system\r
+ * identifier "http://www.myhost.com/today":</p>\r
+ *\r
+ * <pre>\r
+ * import org.xml.sax.EntityResolver;\r
+ * import org.xml.sax.InputSource;\r
+ *\r
+ * public class MyResolver implements EntityResolver {\r
+ * public InputSource resolveEntity (String publicId, String systemId)\r
+ * {\r
+ * if (systemId.equals("http://www.myhost.com/today")) {\r
+ * // return a special input source\r
+ * MyReader reader = new MyReader();\r
+ * return new InputSource(reader);\r
+ * } else {\r
+ * // use the default behaviour\r
+ * return null;\r
+ * }\r
+ * }\r
+ * }\r
+ * </pre>\r
+ *\r
+ * <p>The application can also use this interface to redirect system\r
+ * identifiers to local URIs or to look up replacements in a catalog\r
+ * (possibly by using the public identifier).</p>\r
+ *\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.Parser#setEntityResolver\r
+ * @see org.xml.sax.InputSource\r
+ */\r
+public interface EntityResolver {\r
+ \r
+ \r
+ /**\r
+ * Allow the application to resolve external entities.\r
+ *\r
+ * <p>The Parser will call this method before opening any external\r
+ * entity except the top-level document entity (including the\r
+ * external DTD subset, external entities referenced within the\r
+ * DTD, and external entities referenced within the document\r
+ * element): the application may request that the parser resolve\r
+ * the entity itself, that it use an alternative URI, or that it\r
+ * use an entirely different input source.</p>\r
+ *\r
+ * <p>Application writers can use this method to redirect external\r
+ * system identifiers to secure and/or local URIs, to look up\r
+ * public identifiers in a catalogue, or to read an entity from a\r
+ * database or other input source (including, for example, a dialog\r
+ * box).</p>\r
+ *\r
+ * <p>If the system identifier is a URL, the SAX parser must\r
+ * resolve it fully before reporting it to the application.</p>\r
+ *\r
+ * @param publicId The public identifier of the external entity\r
+ * being referenced, or null if none was supplied.\r
+ * @param systemId The system identifier of the external entity\r
+ * being referenced.\r
+ * @return An InputSource object describing the new input source,\r
+ * or null to request that the parser open a regular\r
+ * URI connection to the system identifier.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @exception java.io.IOException A Java-specific IO exception,\r
+ * possibly the result of creating a new InputStream\r
+ * or Reader for the InputSource.\r
+ * @see org.xml.sax.InputSource\r
+ */\r
+ public abstract InputSource resolveEntity (String publicId,\r
+ String systemId)\r
+ throws SAXException, IOException;\r
+ \r
+}\r
+\r
+// end of EntityResolver.java\r
--- /dev/null
+// SAX error handler.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: ErrorHandler.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+\r
+/**\r
+ * Basic interface for SAX error handlers.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>If a SAX application needs to implement customized error\r
+ * handling, it must implement this interface and then register an\r
+ * instance with the XML reader using the\r
+ * {@link org.xml.sax.XMLReader#setErrorHandler setErrorHandler}\r
+ * method. The parser will then report all errors and warnings\r
+ * through this interface.</p>\r
+ *\r
+ * <p><strong>WARNING:</strong> If an application does <em>not</em>\r
+ * register an ErrorHandler, XML parsing errors will go unreported\r
+ * and bizarre behaviour may result.</p>\r
+ *\r
+ * <p>For XML processing errors, a SAX driver must use this interface \r
+ * instead of throwing an exception: it is up to the application \r
+ * to decide whether to throw an exception for different types of \r
+ * errors and warnings. Note, however, that there is no requirement that \r
+ * the parser continue to provide useful information after a call to \r
+ * {@link #fatalError fatalError} (in other words, a SAX driver class \r
+ * could catch an exception and report a fatalError).</p>\r
+ *\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.Parser#setErrorHandler\r
+ * @see org.xml.sax.SAXParseException \r
+ */\r
+public interface ErrorHandler {\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a warning.\r
+ *\r
+ * <p>SAX parsers will use this method to report conditions that\r
+ * are not errors or fatal errors as defined by the XML 1.0\r
+ * recommendation. The default behaviour is to take no action.</p>\r
+ *\r
+ * <p>The SAX parser must continue to provide normal parsing events\r
+ * after invoking this method: it should still be possible for the\r
+ * application to process the document through to the end.</p>\r
+ *\r
+ * <p>Filters may use this method to report other, non-XML warnings\r
+ * as well.</p>\r
+ *\r
+ * @param exception The warning information encapsulated in a\r
+ * SAX parse exception.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.SAXParseException \r
+ */\r
+ public abstract void warning (SAXParseException exception)\r
+ throws SAXException;\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a recoverable error.\r
+ *\r
+ * <p>This corresponds to the definition of "error" in section 1.2\r
+ * of the W3C XML 1.0 Recommendation. For example, a validating\r
+ * parser would use this callback to report the violation of a\r
+ * validity constraint. The default behaviour is to take no\r
+ * action.</p>\r
+ *\r
+ * <p>The SAX parser must continue to provide normal parsing events\r
+ * after invoking this method: it should still be possible for the\r
+ * application to process the document through to the end. If the\r
+ * application cannot do so, then the parser should report a fatal\r
+ * error even if the XML 1.0 recommendation does not require it to\r
+ * do so.</p>\r
+ *\r
+ * <p>Filters may use this method to report other, non-XML errors\r
+ * as well.</p>\r
+ *\r
+ * @param exception The error information encapsulated in a\r
+ * SAX parse exception.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.SAXParseException \r
+ */\r
+ public abstract void error (SAXParseException exception)\r
+ throws SAXException;\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a non-recoverable error.\r
+ *\r
+ * <p>This corresponds to the definition of "fatal error" in\r
+ * section 1.2 of the W3C XML 1.0 Recommendation. For example, a\r
+ * parser would use this callback to report the violation of a\r
+ * well-formedness constraint.</p>\r
+ *\r
+ * <p>The application must assume that the document is unusable\r
+ * after the parser has invoked this method, and should continue\r
+ * (if at all) only for the sake of collecting addition error\r
+ * messages: in fact, SAX parsers are free to stop reporting any\r
+ * other events once this method has been invoked.</p>\r
+ *\r
+ * @param exception The error information encapsulated in a\r
+ * SAX parse exception. \r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.SAXParseException\r
+ */\r
+ public abstract void fatalError (SAXParseException exception)\r
+ throws SAXException;\r
+ \r
+}\r
+\r
+// end of ErrorHandler.java\r
--- /dev/null
+// SAX default handler base class.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: HandlerBase.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+/**\r
+ * Default base class for handlers.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class implements the default behaviour for four SAX1\r
+ * interfaces: EntityResolver, DTDHandler, DocumentHandler,\r
+ * and ErrorHandler. It is now obsolete, but is included in SAX2 to\r
+ * support legacy SAX1 applications. SAX2 applications should use\r
+ * the {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}\r
+ * class instead.</p>\r
+ *\r
+ * <p>Application writers can extend this class when they need to\r
+ * implement only part of an interface; parser writers can\r
+ * instantiate this class to provide default handlers when the\r
+ * application has not supplied its own.</p>\r
+ *\r
+ * <p>Note that the use of this class is optional.</p>\r
+ *\r
+ * @deprecated This class works with the deprecated\r
+ * {@link org.xml.sax.DocumentHandler DocumentHandler}\r
+ * interface. It has been replaced by the SAX2\r
+ * {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}\r
+ * class.\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.EntityResolver\r
+ * @see org.xml.sax.DTDHandler\r
+ * @see org.xml.sax.DocumentHandler\r
+ * @see org.xml.sax.ErrorHandler\r
+ */\r
+public class HandlerBase\r
+ implements EntityResolver, DTDHandler, DocumentHandler, ErrorHandler\r
+{\r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Default implementation of the EntityResolver interface.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ /**\r
+ * Resolve an external entity.\r
+ *\r
+ * <p>Always return null, so that the parser will use the system\r
+ * identifier provided in the XML document. This method implements\r
+ * the SAX default behaviour: application writers can override it\r
+ * in a subclass to do special translations such as catalog lookups\r
+ * or URI redirection.</p>\r
+ *\r
+ * @param publicId The public identifer, or null if none is\r
+ * available.\r
+ * @param systemId The system identifier provided in the XML \r
+ * document.\r
+ * @return The new input source, or null to require the\r
+ * default behaviour.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.EntityResolver#resolveEntity\r
+ */\r
+ public InputSource resolveEntity (String publicId, String systemId)\r
+ throws SAXException\r
+ {\r
+ return null;\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Default implementation of DTDHandler interface.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a notation declaration.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass if they wish to keep track of the notations\r
+ * declared in a document.</p>\r
+ *\r
+ * @param name The notation name.\r
+ * @param publicId The notation public identifier, or null if not\r
+ * available.\r
+ * @param systemId The notation system identifier.\r
+ * @see org.xml.sax.DTDHandler#notationDecl\r
+ */\r
+ public void notationDecl (String name, String publicId, String systemId)\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of an unparsed entity declaration.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to keep track of the unparsed entities\r
+ * declared in a document.</p>\r
+ *\r
+ * @param name The entity name.\r
+ * @param publicId The entity public identifier, or null if not\r
+ * available.\r
+ * @param systemId The entity system identifier.\r
+ * @param notationName The name of the associated notation.\r
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl\r
+ */\r
+ public void unparsedEntityDecl (String name, String publicId,\r
+ String systemId, String notationName)\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Default implementation of DocumentHandler interface.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Receive a Locator object for document events.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass if they wish to store the locator for use\r
+ * with other document events.</p>\r
+ *\r
+ * @param locator A locator for all SAX document events.\r
+ * @see org.xml.sax.DocumentHandler#setDocumentLocator\r
+ * @see org.xml.sax.Locator\r
+ */\r
+ public void setDocumentLocator (Locator locator)\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the beginning of the document.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions at the beginning\r
+ * of a document (such as allocating the root node of a tree or\r
+ * creating an output file).</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.DocumentHandler#startDocument\r
+ */\r
+ public void startDocument ()\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the end of the document.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions at the beginning\r
+ * of a document (such as finalising a tree or closing an output\r
+ * file).</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.DocumentHandler#endDocument\r
+ */\r
+ public void endDocument ()\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the start of an element.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions at the start of\r
+ * each element (such as allocating a new tree node or writing\r
+ * output to a file).</p>\r
+ *\r
+ * @param name The element type name.\r
+ * @param attributes The specified or defaulted attributes.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.DocumentHandler#startElement\r
+ */\r
+ public void startElement (String name, AttributeList attributes)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the end of an element.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions at the end of\r
+ * each element (such as finalising a tree node or writing\r
+ * output to a file).</p>\r
+ *\r
+ * @param name The element type name.\r
+ * @param attributes The specified or defaulted attributes.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.DocumentHandler#endElement\r
+ */\r
+ public void endElement (String name)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of character data inside an element.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method to take specific actions for each chunk of character data\r
+ * (such as adding the data to a node or buffer, or printing it to\r
+ * a file).</p>\r
+ *\r
+ * @param ch The characters.\r
+ * @param start The start position in the character array.\r
+ * @param length The number of characters to use from the\r
+ * character array.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.DocumentHandler#characters\r
+ */\r
+ public void characters (char ch[], int start, int length)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of ignorable whitespace in element content.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method to take specific actions for each chunk of ignorable\r
+ * whitespace (such as adding data to a node or buffer, or printing\r
+ * it to a file).</p>\r
+ *\r
+ * @param ch The whitespace characters.\r
+ * @param start The start position in the character array.\r
+ * @param length The number of characters to use from the\r
+ * character array.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.DocumentHandler#ignorableWhitespace\r
+ */\r
+ public void ignorableWhitespace (char ch[], int start, int length)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a processing instruction.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions for each\r
+ * processing instruction, such as setting status variables or\r
+ * invoking other methods.</p>\r
+ *\r
+ * @param target The processing instruction target.\r
+ * @param data The processing instruction data, or null if\r
+ * none is supplied.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.DocumentHandler#processingInstruction\r
+ */\r
+ public void processingInstruction (String target, String data)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Default implementation of the ErrorHandler interface.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a parser warning.\r
+ *\r
+ * <p>The default implementation does nothing. Application writers\r
+ * may override this method in a subclass to take specific actions\r
+ * for each warning, such as inserting the message in a log file or\r
+ * printing it to the console.</p>\r
+ *\r
+ * @param e The warning information encoded as an exception.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ErrorHandler#warning\r
+ * @see org.xml.sax.SAXParseException\r
+ */\r
+ public void warning (SAXParseException e)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a recoverable parser error.\r
+ *\r
+ * <p>The default implementation does nothing. Application writers\r
+ * may override this method in a subclass to take specific actions\r
+ * for each error, such as inserting the message in a log file or\r
+ * printing it to the console.</p>\r
+ *\r
+ * @param e The warning information encoded as an exception.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ErrorHandler#warning\r
+ * @see org.xml.sax.SAXParseException\r
+ */\r
+ public void error (SAXParseException e)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Report a fatal XML parsing error.\r
+ *\r
+ * <p>The default implementation throws a SAXParseException.\r
+ * Application writers may override this method in a subclass if\r
+ * they need to take specific actions for each fatal error (such as\r
+ * collecting all of the errors into a single report): in any case,\r
+ * the application must stop all regular processing when this\r
+ * method is invoked, since the document is no longer reliable, and\r
+ * the parser may no longer report parsing events.</p>\r
+ *\r
+ * @param e The error information encoded as an exception.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ErrorHandler#fatalError\r
+ * @see org.xml.sax.SAXParseException\r
+ */\r
+ public void fatalError (SAXParseException e)\r
+ throws SAXException\r
+ {\r
+ throw e;\r
+ }\r
+ \r
+}\r
+\r
+// end of HandlerBase.java\r
--- /dev/null
+// SAX input source.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: InputSource.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+import java.io.Reader;\r
+import java.io.InputStream;\r
+\r
+/**\r
+ * A single input source for an XML entity.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class allows a SAX application to encapsulate information\r
+ * about an input source in a single object, which may include\r
+ * a public identifier, a system identifier, a byte stream (possibly\r
+ * with a specified encoding), and/or a character stream.</p>\r
+ *\r
+ * <p>There are two places that the application will deliver this\r
+ * input source to the parser: as the argument to the Parser.parse\r
+ * method, or as the return value of the EntityResolver.resolveEntity\r
+ * method.</p>\r
+ *\r
+ * <p>The SAX parser will use the InputSource object to determine how\r
+ * to read XML input. If there is a character stream available, the\r
+ * parser will read that stream directly; if not, the parser will use\r
+ * a byte stream, if available; if neither a character stream nor a\r
+ * byte stream is available, the parser will attempt to open a URI\r
+ * connection to the resource identified by the system\r
+ * identifier.</p>\r
+ *\r
+ * <p>An InputSource object belongs to the application: the SAX parser\r
+ * shall never modify it in any way (it may modify a copy if \r
+ * necessary).</p>\r
+ *\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.Parser#parse\r
+ * @see org.xml.sax.EntityResolver#resolveEntity\r
+ * @see java.io.InputStream\r
+ * @see java.io.Reader\r
+ */\r
+public class InputSource {\r
+ \r
+ /**\r
+ * Zero-argument default constructor.\r
+ *\r
+ * @see #setPublicId\r
+ * @see #setSystemId\r
+ * @see #setByteStream\r
+ * @see #setCharacterStream\r
+ * @see #setEncoding\r
+ */\r
+ public InputSource ()\r
+ {\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Create a new input source with a system identifier.\r
+ *\r
+ * <p>Applications may use setPublicId to include a \r
+ * public identifier as well, or setEncoding to specify\r
+ * the character encoding, if known.</p>\r
+ *\r
+ * <p>If the system identifier is a URL, it must be full resolved.</p>\r
+ *\r
+ * @param systemId The system identifier (URI).\r
+ * @see #setPublicId\r
+ * @see #setSystemId\r
+ * @see #setByteStream\r
+ * @see #setEncoding\r
+ * @see #setCharacterStream\r
+ */\r
+ public InputSource (String systemId)\r
+ {\r
+ setSystemId(systemId);\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Create a new input source with a byte stream.\r
+ *\r
+ * <p>Application writers may use setSystemId to provide a base \r
+ * for resolving relative URIs, setPublicId to include a \r
+ * public identifier, and/or setEncoding to specify the object's\r
+ * character encoding.</p>\r
+ *\r
+ * @param byteStream The raw byte stream containing the document.\r
+ * @see #setPublicId\r
+ * @see #setSystemId\r
+ * @see #setEncoding\r
+ * @see #setByteStream\r
+ * @see #setCharacterStream\r
+ */\r
+ public InputSource (InputStream byteStream)\r
+ {\r
+ setByteStream(byteStream);\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Create a new input source with a character stream.\r
+ *\r
+ * <p>Application writers may use setSystemId() to provide a base \r
+ * for resolving relative URIs, and setPublicId to include a \r
+ * public identifier.</p>\r
+ *\r
+ * <p>The character stream shall not include a byte order mark.</p>\r
+ *\r
+ * @see #setPublicId\r
+ * @see #setSystemId\r
+ * @see #setByteStream\r
+ * @see #setCharacterStream\r
+ */\r
+ public InputSource (Reader characterStream)\r
+ {\r
+ setCharacterStream(characterStream);\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Set the public identifier for this input source.\r
+ *\r
+ * <p>The public identifier is always optional: if the application\r
+ * writer includes one, it will be provided as part of the\r
+ * location information.</p>\r
+ *\r
+ * @param publicId The public identifier as a string.\r
+ * @see #getPublicId\r
+ * @see org.xml.sax.Locator#getPublicId\r
+ * @see org.xml.sax.SAXParseException#getPublicId\r
+ */\r
+ public void setPublicId (String publicId)\r
+ {\r
+ this.publicId = publicId;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the public identifier for this input source.\r
+ *\r
+ * @return The public identifier, or null if none was supplied.\r
+ * @see #setPublicId\r
+ */\r
+ public String getPublicId ()\r
+ {\r
+ return publicId;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Set the system identifier for this input source.\r
+ *\r
+ * <p>The system identifier is optional if there is a byte stream\r
+ * or a character stream, but it is still useful to provide one,\r
+ * since the application can use it to resolve relative URIs\r
+ * and can include it in error messages and warnings (the parser\r
+ * will attempt to open a connection to the URI only if\r
+ * there is no byte stream or character stream specified).</p>\r
+ *\r
+ * <p>If the application knows the character encoding of the\r
+ * object pointed to by the system identifier, it can register\r
+ * the encoding using the setEncoding method.</p>\r
+ *\r
+ * <p>If the system ID is a URL, it must be fully resolved.</p>\r
+ *\r
+ * @param systemId The system identifier as a string.\r
+ * @see #setEncoding\r
+ * @see #getSystemId\r
+ * @see org.xml.sax.Locator#getSystemId\r
+ * @see org.xml.sax.SAXParseException#getSystemId\r
+ */\r
+ public void setSystemId (String systemId)\r
+ {\r
+ this.systemId = systemId;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the system identifier for this input source.\r
+ *\r
+ * <p>The getEncoding method will return the character encoding\r
+ * of the object pointed to, or null if unknown.</p>\r
+ *\r
+ * <p>If the system ID is a URL, it will be fully resolved.</p>\r
+ *\r
+ * @return The system identifier.\r
+ * @see #setSystemId\r
+ * @see #getEncoding\r
+ */\r
+ public String getSystemId ()\r
+ {\r
+ return systemId;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Set the byte stream for this input source.\r
+ *\r
+ * <p>The SAX parser will ignore this if there is also a character\r
+ * stream specified, but it will use a byte stream in preference\r
+ * to opening a URI connection itself.</p>\r
+ *\r
+ * <p>If the application knows the character encoding of the\r
+ * byte stream, it should set it with the setEncoding method.</p>\r
+ *\r
+ * @param byteStream A byte stream containing an XML document or\r
+ * other entity.\r
+ * @see #setEncoding\r
+ * @see #getByteStream\r
+ * @see #getEncoding\r
+ * @see java.io.InputStream\r
+ */\r
+ public void setByteStream (InputStream byteStream)\r
+ {\r
+ this.byteStream = byteStream;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the byte stream for this input source.\r
+ *\r
+ * <p>The getEncoding method will return the character\r
+ * encoding for this byte stream, or null if unknown.</p>\r
+ *\r
+ * @return The byte stream, or null if none was supplied.\r
+ * @see #getEncoding\r
+ * @see #setByteStream\r
+ */\r
+ public InputStream getByteStream ()\r
+ {\r
+ return byteStream;\r
+ }\r
+ \r
+ \r
+ /** \r
+ * Set the character encoding, if known.\r
+ *\r
+ * <p>The encoding must be a string acceptable for an\r
+ * XML encoding declaration (see section 4.3.3 of the XML 1.0\r
+ * recommendation).</p>\r
+ *\r
+ * <p>This method has no effect when the application provides a\r
+ * character stream.</p>\r
+ *\r
+ * @param encoding A string describing the character encoding.\r
+ * @see #setSystemId\r
+ * @see #setByteStream\r
+ * @see #getEncoding\r
+ */\r
+ public void setEncoding (String encoding)\r
+ {\r
+ this.encoding = encoding;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the character encoding for a byte stream or URI.\r
+ *\r
+ * @return The encoding, or null if none was supplied.\r
+ * @see #setByteStream\r
+ * @see #getSystemId\r
+ * @see #getByteStream\r
+ */\r
+ public String getEncoding ()\r
+ {\r
+ return encoding;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Set the character stream for this input source.\r
+ *\r
+ * <p>If there is a character stream specified, the SAX parser\r
+ * will ignore any byte stream and will not attempt to open\r
+ * a URI connection to the system identifier.</p>\r
+ *\r
+ * @param characterStream The character stream containing the\r
+ * XML document or other entity.\r
+ * @see #getCharacterStream\r
+ * @see java.io.Reader\r
+ */\r
+ public void setCharacterStream (Reader characterStream)\r
+ {\r
+ this.characterStream = characterStream;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the character stream for this input source.\r
+ *\r
+ * @return The character stream, or null if none was supplied.\r
+ * @see #setCharacterStream\r
+ */\r
+ public Reader getCharacterStream ()\r
+ {\r
+ return characterStream;\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ private String publicId;\r
+ private String systemId;\r
+ private InputStream byteStream;\r
+ private String encoding;\r
+ private Reader characterStream;\r
+ \r
+}\r
+\r
+// end of InputSource.java\r
--- /dev/null
+// SAX locator interface for document events.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: Locator.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+\r
+/**\r
+ * Interface for associating a SAX event with a document location.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>If a SAX parser provides location information to the SAX\r
+ * application, it does so by implementing this interface and then\r
+ * passing an instance to the application using the content\r
+ * handler's {@link org.xml.sax.ContentHandler#setDocumentLocator\r
+ * setDocumentLocator} method. The application can use the\r
+ * object to obtain the location of any other content handler event\r
+ * in the XML source document.</p>\r
+ *\r
+ * <p>Note that the results returned by the object will be valid only\r
+ * during the scope of each content handler method: the application\r
+ * will receive unpredictable results if it attempts to use the\r
+ * locator at any other time.</p>\r
+ *\r
+ * <p>SAX parsers are not required to supply a locator, but they are\r
+ * very strongly encouraged to do so. If the parser supplies a\r
+ * locator, it must do so before reporting any other document events.\r
+ * If no locator has been set by the time the application receives\r
+ * the {@link org.xml.sax.ContentHandler#startDocument startDocument}\r
+ * event, the application should assume that a locator is not \r
+ * available.</p>\r
+ *\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.ContentHandler#setDocumentLocator \r
+ */\r
+public interface Locator {\r
+ \r
+ \r
+ /**\r
+ * Return the public identifier for the current document event.\r
+ *\r
+ * <p>The return value is the public identifier of the document\r
+ * entity or of the external parsed entity in which the markup\r
+ * triggering the event appears.</p>\r
+ *\r
+ * @return A string containing the public identifier, or\r
+ * null if none is available.\r
+ * @see #getSystemId\r
+ */\r
+ public abstract String getPublicId ();\r
+ \r
+ \r
+ /**\r
+ * Return the system identifier for the current document event.\r
+ *\r
+ * <p>The return value is the system identifier of the document\r
+ * entity or of the external parsed entity in which the markup\r
+ * triggering the event appears.</p>\r
+ *\r
+ * <p>If the system identifier is a URL, the parser must resolve it\r
+ * fully before passing it to the application.</p>\r
+ *\r
+ * @return A string containing the system identifier, or null\r
+ * if none is available.\r
+ * @see #getPublicId\r
+ */\r
+ public abstract String getSystemId ();\r
+ \r
+ \r
+ /**\r
+ * Return the line number where the current document event ends.\r
+ *\r
+ * <p><strong>Warning:</strong> The return value from the method\r
+ * is intended only as an approximation for the sake of error\r
+ * reporting; it is not intended to provide sufficient information\r
+ * to edit the character content of the original XML document.</p>\r
+ *\r
+ * <p>The return value is an approximation of the line number\r
+ * in the document entity or external parsed entity where the\r
+ * markup triggering the event appears.</p>\r
+ *\r
+ * <p>If possible, the SAX driver should provide the line position \r
+ * of the first character after the text associated with the document \r
+ * event. The first line in the document is line 1.</p>\r
+ *\r
+ * @return The line number, or -1 if none is available.\r
+ * @see #getColumnNumber\r
+ */\r
+ public abstract int getLineNumber ();\r
+ \r
+ \r
+ /**\r
+ * Return the column number where the current document event ends.\r
+ *\r
+ * <p><strong>Warning:</strong> The return value from the method\r
+ * is intended only as an approximation for the sake of error\r
+ * reporting; it is not intended to provide sufficient information\r
+ * to edit the character content of the original XML document.</p>\r
+ *\r
+ * <p>The return value is an approximation of the column number\r
+ * in the document entity or external parsed entity where the\r
+ * markup triggering the event appears.</p>\r
+ *\r
+ * <p>If possible, the SAX driver should provide the line position \r
+ * of the first character after the text associated with the document \r
+ * event.</p>\r
+ *\r
+ * <p>If possible, the SAX driver should provide the line position \r
+ * of the first character after the text associated with the document \r
+ * event. The first column in each line is column 1.</p>\r
+ *\r
+ * @return The column number, or -1 if none is available.\r
+ * @see #getLineNumber\r
+ */\r
+ public abstract int getColumnNumber ();\r
+ \r
+}\r
+\r
+// end of Locator.java\r
--- /dev/null
+// SAX parser interface.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: Parser.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+import java.io.IOException;\r
+import java.util.Locale;\r
+\r
+\r
+/**\r
+ * Basic interface for SAX (Simple API for XML) parsers.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This was the main event supplier interface for SAX1; it has\r
+ * been replaced in SAX2 by {@link org.xml.sax.XMLReader XMLReader},\r
+ * which includes Namespace support and sophisticated configurability\r
+ * and extensibility.</p>\r
+ *\r
+ * <p>All SAX1 parsers must implement this basic interface: it allows\r
+ * applications to register handlers for different types of events\r
+ * and to initiate a parse from a URI, or a character stream.</p>\r
+ *\r
+ * <p>All SAX1 parsers must also implement a zero-argument constructor\r
+ * (though other constructors are also allowed).</p>\r
+ *\r
+ * <p>SAX1 parsers are reusable but not re-entrant: the application\r
+ * may reuse a parser object (possibly with a different input source)\r
+ * once the first parse has completed successfully, but it may not\r
+ * invoke the parse() methods recursively within a parse.</p>\r
+ *\r
+ * @deprecated This interface has been replaced by the SAX2\r
+ * {@link org.xml.sax.XMLReader XMLReader}\r
+ * interface, which includes Namespace support.\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.EntityResolver\r
+ * @see org.xml.sax.DTDHandler\r
+ * @see org.xml.sax.DocumentHandler\r
+ * @see org.xml.sax.ErrorHandler\r
+ * @see org.xml.sax.HandlerBase\r
+ * @see org.xml.sax.InputSource\r
+ */\r
+public interface Parser \r
+{\r
+ \r
+ /**\r
+ * Allow an application to request a locale for errors and warnings.\r
+ *\r
+ * <p>SAX parsers are not required to provide localisation for errors\r
+ * and warnings; if they cannot support the requested locale,\r
+ * however, they must throw a SAX exception. Applications may\r
+ * not request a locale change in the middle of a parse.</p>\r
+ *\r
+ * @param locale A Java Locale object.\r
+ * @exception org.xml.sax.SAXException Throws an exception\r
+ * (using the previous or default locale) if the \r
+ * requested locale is not supported.\r
+ * @see org.xml.sax.SAXException\r
+ * @see org.xml.sax.SAXParseException\r
+ */\r
+ public abstract void setLocale (Locale locale)\r
+ throws SAXException;\r
+ \r
+ \r
+ /**\r
+ * Allow an application to register a custom entity resolver.\r
+ *\r
+ * <p>If the application does not register an entity resolver, the\r
+ * SAX parser will resolve system identifiers and open connections\r
+ * to entities itself (this is the default behaviour implemented in\r
+ * HandlerBase).</p>\r
+ *\r
+ * <p>Applications may register a new or different entity resolver\r
+ * in the middle of a parse, and the SAX parser must begin using\r
+ * the new resolver immediately.</p>\r
+ *\r
+ * @param resolver The object for resolving entities.\r
+ * @see EntityResolver\r
+ * @see HandlerBase\r
+ */\r
+ public abstract void setEntityResolver (EntityResolver resolver);\r
+ \r
+ \r
+ /**\r
+ * Allow an application to register a DTD event handler.\r
+ *\r
+ * <p>If the application does not register a DTD handler, all DTD\r
+ * events reported by the SAX parser will be silently\r
+ * ignored (this is the default behaviour implemented by\r
+ * HandlerBase).</p>\r
+ *\r
+ * <p>Applications may register a new or different\r
+ * handler in the middle of a parse, and the SAX parser must\r
+ * begin using the new handler immediately.</p>\r
+ *\r
+ * @param handler The DTD handler.\r
+ * @see DTDHandler\r
+ * @see HandlerBase\r
+ */\r
+ public abstract void setDTDHandler (DTDHandler handler);\r
+ \r
+ \r
+ /**\r
+ * Allow an application to register a document event handler.\r
+ *\r
+ * <p>If the application does not register a document handler, all\r
+ * document events reported by the SAX parser will be silently\r
+ * ignored (this is the default behaviour implemented by\r
+ * HandlerBase).</p>\r
+ *\r
+ * <p>Applications may register a new or different handler in the\r
+ * middle of a parse, and the SAX parser must begin using the new\r
+ * handler immediately.</p>\r
+ *\r
+ * @param handler The document handler.\r
+ * @see DocumentHandler\r
+ * @see HandlerBase\r
+ */\r
+ public abstract void setDocumentHandler (DocumentHandler handler);\r
+ \r
+ \r
+ /**\r
+ * Allow an application to register an error event handler.\r
+ *\r
+ * <p>If the application does not register an error event handler,\r
+ * all error events reported by the SAX parser will be silently\r
+ * ignored, except for fatalError, which will throw a SAXException\r
+ * (this is the default behaviour implemented by HandlerBase).</p>\r
+ *\r
+ * <p>Applications may register a new or different handler in the\r
+ * middle of a parse, and the SAX parser must begin using the new\r
+ * handler immediately.</p>\r
+ *\r
+ * @param handler The error handler.\r
+ * @see ErrorHandler\r
+ * @see SAXException\r
+ * @see HandlerBase\r
+ */\r
+ public abstract void setErrorHandler (ErrorHandler handler);\r
+ \r
+ \r
+ /**\r
+ * Parse an XML document.\r
+ *\r
+ * <p>The application can use this method to instruct the SAX parser\r
+ * to begin parsing an XML document from any valid input\r
+ * source (a character stream, a byte stream, or a URI).</p>\r
+ *\r
+ * <p>Applications may not invoke this method while a parse is in\r
+ * progress (they should create a new Parser instead for each\r
+ * additional XML document). Once a parse is complete, an\r
+ * application may reuse the same Parser object, possibly with a\r
+ * different input source.</p>\r
+ *\r
+ * @param source The input source for the top-level of the\r
+ * XML document.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @exception java.io.IOException An IO exception from the parser,\r
+ * possibly from a byte stream or character stream\r
+ * supplied by the application.\r
+ * @see org.xml.sax.InputSource\r
+ * @see #parse(java.lang.String)\r
+ * @see #setEntityResolver\r
+ * @see #setDTDHandler\r
+ * @see #setDocumentHandler\r
+ * @see #setErrorHandler\r
+ */\r
+ public abstract void parse (InputSource source)\r
+ throws SAXException, IOException;\r
+ \r
+ \r
+ /**\r
+ * Parse an XML document from a system identifier (URI).\r
+ *\r
+ * <p>This method is a shortcut for the common case of reading a\r
+ * document from a system identifier. It is the exact\r
+ * equivalent of the following:</p>\r
+ *\r
+ * <pre>\r
+ * parse(new InputSource(systemId));\r
+ * </pre>\r
+ *\r
+ * <p>If the system identifier is a URL, it must be fully resolved\r
+ * by the application before it is passed to the parser.</p>\r
+ *\r
+ * @param systemId The system identifier (URI).\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @exception java.io.IOException An IO exception from the parser,\r
+ * possibly from a byte stream or character stream\r
+ * supplied by the application.\r
+ * @see #parse(org.xml.sax.InputSource)\r
+ */\r
+ public abstract void parse (String systemId)\r
+ throws SAXException, IOException;\r
+ \r
+}\r
+\r
+// end of Parser.java\r
--- /dev/null
+// SAX exception class.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: SAXException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+/**\r
+ * Encapsulate a general SAX error or warning.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class can contain basic error or warning information from\r
+ * either the XML parser or the application: a parser writer or\r
+ * application writer can subclass it to provide additional\r
+ * functionality. SAX handlers may throw this exception or\r
+ * any exception subclassed from it.</p>\r
+ *\r
+ * <p>If the application needs to pass through other types of\r
+ * exceptions, it must wrap those exceptions in a SAXException\r
+ * or an exception derived from a SAXException.</p>\r
+ *\r
+ * <p>If the parser or application needs to include information about a\r
+ * specific location in an XML document, it should use the\r
+ * {@link org.xml.sax.SAXParseException SAXParseException} subclass.</p>\r
+ *\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.SAXParseException\r
+ */\r
+public class SAXException extends Exception {\r
+ \r
+ \r
+ /**\r
+ * Create a new SAXException.\r
+ *\r
+ * @param message The error or warning message.\r
+ * @see org.xml.sax.Parser#setLocale\r
+ */\r
+ public SAXException (String message) {\r
+ super(message);\r
+ this.exception = null;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Create a new SAXException wrapping an existing exception.\r
+ *\r
+ * <p>The existing exception will be embedded in the new\r
+ * one, and its message will become the default message for\r
+ * the SAXException.</p>\r
+ *\r
+ * @param e The exception to be wrapped in a SAXException.\r
+ */\r
+ public SAXException (Exception e)\r
+ {\r
+ super();\r
+ this.exception = e;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Create a new SAXException from an existing exception.\r
+ *\r
+ * <p>The existing exception will be embedded in the new\r
+ * one, but the new exception will have its own message.</p>\r
+ *\r
+ * @param message The detail message.\r
+ * @param e The exception to be wrapped in a SAXException.\r
+ * @see org.xml.sax.Parser#setLocale\r
+ */\r
+ public SAXException (String message, Exception e)\r
+ {\r
+ super(message);\r
+ this.exception = e;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Return a detail message for this exception.\r
+ *\r
+ * <p>If there is an embedded exception, and if the SAXException\r
+ * has no detail message of its own, this method will return\r
+ * the detail message from the embedded exception.</p>\r
+ *\r
+ * @return The error or warning message.\r
+ * @see org.xml.sax.Parser#setLocale\r
+ */\r
+ public String getMessage ()\r
+ {\r
+ String message = super.getMessage();\r
+ \r
+ if (message == null && exception != null) {\r
+ return exception.getMessage();\r
+ } else {\r
+ return message;\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Return the embedded exception, if any.\r
+ *\r
+ * @return The embedded exception, or null if there is none.\r
+ */\r
+ public Exception getException ()\r
+ {\r
+ return exception;\r
+ }\r
+\r
+\r
+ /**\r
+ * Override toString to pick up any embedded exception.\r
+ *\r
+ * @return A string representation of this exception.\r
+ */\r
+ public String toString ()\r
+ {\r
+ if (exception != null) {\r
+ return exception.toString();\r
+ } else {\r
+ return super.toString();\r
+ }\r
+ }\r
+ \r
+ \r
+ \f\r
+ //////////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ //////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * @serial The embedded exception if tunnelling, or null.\r
+ */ \r
+ private Exception exception;\r
+ \r
+}\r
+\r
+// end of SAXException.java\r
--- /dev/null
+// SAXNotRecognizedException.java - unrecognized feature or value.\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the Public Domain.\r
+\r
+// $Id: SAXNotRecognizedException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+\r
+package org.xml.sax;\r
+\r
+\r
+/**\r
+ * Exception class for an unrecognized identifier.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>An XMLReader will throw this exception when it finds an\r
+ * unrecognized feature or property identifier; SAX applications and\r
+ * extensions may use this class for other, similar purposes.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.SAXNotSupportedException\r
+ */\r
+public class SAXNotRecognizedException extends SAXException\r
+{\r
+\r
+ /**\r
+ * Construct a new exception with the given message.\r
+ *\r
+ * @param message The text message of the exception.\r
+ */\r
+ public SAXNotRecognizedException (String message)\r
+ {\r
+ super(message);\r
+ }\r
+\r
+}\r
+\r
+// end of SAXNotRecognizedException.java\r
--- /dev/null
+// SAXNotSupportedException.java - unsupported feature or value.\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the Public Domain.\r
+\r
+// $Id: SAXNotSupportedException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+\r
+package org.xml.sax;\r
+\r
+/**\r
+ * Exception class for an unsupported operation.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>An XMLReader will throw this exception when it recognizes a\r
+ * feature or property identifier, but cannot perform the requested\r
+ * operation (setting a state or value). Other SAX2 applications and\r
+ * extensions may use this class for similar purposes.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.SAXNotRecognizedException \r
+ */\r
+public class SAXNotSupportedException extends SAXException\r
+{\r
+\r
+ /**\r
+ * Construct a new exception with the given message.\r
+ *\r
+ * @param message The text message of the exception.\r
+ */\r
+ public SAXNotSupportedException (String message)\r
+ {\r
+ super(message);\r
+ }\r
+\r
+}\r
+\r
+// end of SAXNotSupportedException.java\r
--- /dev/null
+// SAX exception class.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: SAXParseException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+/**\r
+ * Encapsulate an XML parse error or warning.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This exception will include information for locating the error\r
+ * in the original XML document. Note that although the application\r
+ * will receive a SAXParseException as the argument to the handlers\r
+ * in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface, \r
+ * the application is not actually required to throw the exception; \r
+ * instead, it can simply read the information in it and take a \r
+ * different action.</p>\r
+ *\r
+ * <p>Since this exception is a subclass of {@link org.xml.sax.SAXException \r
+ * SAXException}, it inherits the ability to wrap another exception.</p>\r
+ *\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.SAXException\r
+ * @see org.xml.sax.Locator\r
+ * @see org.xml.sax.ErrorHandler\r
+ */\r
+public class SAXParseException extends SAXException {\r
+ \r
+ \f\r
+ //////////////////////////////////////////////////////////////////////\r
+ // Constructors.\r
+ //////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Create a new SAXParseException from a message and a Locator.\r
+ *\r
+ * <p>This constructor is especially useful when an application is\r
+ * creating its own exception from within a {@link org.xml.sax.ContentHandler\r
+ * ContentHandler} callback.</p>\r
+ *\r
+ * @param message The error or warning message.\r
+ * @param locator The locator object for the error or warning (may be\r
+ * null).\r
+ * @see org.xml.sax.Locator\r
+ * @see org.xml.sax.Parser#setLocale \r
+ */\r
+ public SAXParseException (String message, Locator locator) {\r
+ super(message);\r
+ if (locator != null) {\r
+ init(locator.getPublicId(), locator.getSystemId(),\r
+ locator.getLineNumber(), locator.getColumnNumber());\r
+ } else {\r
+ init(null, null, -1, -1);\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Wrap an existing exception in a SAXParseException.\r
+ *\r
+ * <p>This constructor is especially useful when an application is\r
+ * creating its own exception from within a {@link org.xml.sax.ContentHandler\r
+ * ContentHandler} callback, and needs to wrap an existing exception that is not a\r
+ * subclass of {@link org.xml.sax.SAXException SAXException}.</p>\r
+ *\r
+ * @param message The error or warning message, or null to\r
+ * use the message from the embedded exception.\r
+ * @param locator The locator object for the error or warning (may be\r
+ * null).\r
+ * @param e Any exception.\r
+ * @see org.xml.sax.Locator\r
+ * @see org.xml.sax.Parser#setLocale\r
+ */\r
+ public SAXParseException (String message, Locator locator,\r
+ Exception e) {\r
+ super(message, e);\r
+ if (locator != null) {\r
+ init(locator.getPublicId(), locator.getSystemId(),\r
+ locator.getLineNumber(), locator.getColumnNumber());\r
+ } else {\r
+ init(null, null, -1, -1);\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Create a new SAXParseException.\r
+ *\r
+ * <p>This constructor is most useful for parser writers.</p>\r
+ *\r
+ * <p>If the system identifier is a URL, the parser must resolve it\r
+ * fully before creating the exception.</p>\r
+ *\r
+ * @param message The error or warning message.\r
+ * @param publicId The public identifer of the entity that generated\r
+ * the error or warning.\r
+ * @param systemId The system identifer of the entity that generated\r
+ * the error or warning.\r
+ * @param lineNumber The line number of the end of the text that\r
+ * caused the error or warning.\r
+ * @param columnNumber The column number of the end of the text that\r
+ * cause the error or warning.\r
+ * @see org.xml.sax.Parser#setLocale\r
+ */\r
+ public SAXParseException (String message, String publicId, String systemId,\r
+ int lineNumber, int columnNumber)\r
+ {\r
+ super(message);\r
+ init(publicId, systemId, lineNumber, columnNumber);\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Create a new SAXParseException with an embedded exception.\r
+ *\r
+ * <p>This constructor is most useful for parser writers who\r
+ * need to wrap an exception that is not a subclass of\r
+ * {@link org.xml.sax.SAXException SAXException}.</p>\r
+ *\r
+ * <p>If the system identifier is a URL, the parser must resolve it\r
+ * fully before creating the exception.</p>\r
+ *\r
+ * @param message The error or warning message, or null to use\r
+ * the message from the embedded exception.\r
+ * @param publicId The public identifer of the entity that generated\r
+ * the error or warning.\r
+ * @param systemId The system identifer of the entity that generated\r
+ * the error or warning.\r
+ * @param lineNumber The line number of the end of the text that\r
+ * caused the error or warning.\r
+ * @param columnNumber The column number of the end of the text that\r
+ * cause the error or warning.\r
+ * @param e Another exception to embed in this one.\r
+ * @see org.xml.sax.Parser#setLocale\r
+ */\r
+ public SAXParseException (String message, String publicId, String systemId,\r
+ int lineNumber, int columnNumber, Exception e)\r
+ {\r
+ super(message, e);\r
+ init(publicId, systemId, lineNumber, columnNumber);\r
+ }\r
+\r
+\r
+ /**\r
+ * Internal initialization method.\r
+ *\r
+ * @param publicId The public identifier of the entity which generated the exception,\r
+ * or null.\r
+ * @param systemId The system identifier of the entity which generated the exception,\r
+ * or null.\r
+ * @param lineNumber The line number of the error, or -1.\r
+ * @param columnNumber The column number of the error, or -1.\r
+ */\r
+ private void init (String publicId, String systemId,\r
+ int lineNumber, int columnNumber)\r
+ {\r
+ this.publicId = publicId;\r
+ this.systemId = systemId;\r
+ this.lineNumber = lineNumber;\r
+ this.columnNumber = columnNumber;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the public identifier of the entity where the exception occurred.\r
+ *\r
+ * @return A string containing the public identifier, or null\r
+ * if none is available.\r
+ * @see org.xml.sax.Locator#getPublicId\r
+ */\r
+ public String getPublicId ()\r
+ {\r
+ return this.publicId;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the system identifier of the entity where the exception occurred.\r
+ *\r
+ * <p>If the system identifier is a URL, it will be resolved\r
+ * fully.</p>\r
+ *\r
+ * @return A string containing the system identifier, or null\r
+ * if none is available.\r
+ * @see org.xml.sax.Locator#getSystemId\r
+ */\r
+ public String getSystemId ()\r
+ {\r
+ return this.systemId;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * The line number of the end of the text where the exception occurred.\r
+ *\r
+ * @return An integer representing the line number, or -1\r
+ * if none is available.\r
+ * @see org.xml.sax.Locator#getLineNumber\r
+ */\r
+ public int getLineNumber ()\r
+ {\r
+ return this.lineNumber;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * The column number of the end of the text where the exception occurred.\r
+ *\r
+ * <p>The first column in a line is position 1.</p>\r
+ *\r
+ * @return An integer representing the column number, or -1\r
+ * if none is available.\r
+ * @see org.xml.sax.Locator#getColumnNumber\r
+ */\r
+ public int getColumnNumber ()\r
+ {\r
+ return this.columnNumber;\r
+ }\r
+ \r
+ \r
+ \f\r
+ //////////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ //////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * @serial The public identifier, or null.\r
+ * @see #getPublicId\r
+ */ \r
+ private String publicId;\r
+\r
+\r
+ /**\r
+ * @serial The system identifier, or null.\r
+ * @see #getSystemId\r
+ */\r
+ private String systemId;\r
+\r
+\r
+ /**\r
+ * @serial The line number, or -1.\r
+ * @see #getLineNumber\r
+ */\r
+ private int lineNumber;\r
+\r
+\r
+ /**\r
+ * @serial The column number, or -1.\r
+ * @see #getColumnNumber\r
+ */\r
+ private int columnNumber;\r
+ \r
+}\r
+\r
+// end of SAXParseException.java\r
--- /dev/null
+// XMLFilter.java - filter SAX2 events.\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the Public Domain.\r
+\r
+// $Id: XMLFilter.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+\r
+package org.xml.sax;\r
+\r
+\r
+/**\r
+ * Interface for an XML filter.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>An XML filter is like an XML reader, except that it obtains its\r
+ * events from another XML reader rather than a primary source like\r
+ * an XML document or database. Filters can modify a stream of\r
+ * events as they pass on to the final application.</p>\r
+ *\r
+ * <p>The XMLFilterImpl helper class provides a convenient base\r
+ * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver\r
+ * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler},\r
+ * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler\r
+ * ErrorHandler} events automatically.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.helpers.XMLFilterImpl\r
+ */\r
+public interface XMLFilter extends XMLReader\r
+{\r
+\r
+ /**\r
+ * Set the parent reader.\r
+ *\r
+ * <p>This method allows the application to link the filter to\r
+ * a parent reader (which may be another filter). The argument\r
+ * may not be null.</p>\r
+ *\r
+ * @param parent The parent reader.\r
+ */\r
+ public abstract void setParent (XMLReader parent);\r
+\r
+\r
+ /**\r
+ * Get the parent reader.\r
+ *\r
+ * <p>This method allows the application to query the parent\r
+ * reader (which may be another filter). It is generally a\r
+ * bad idea to perform any operations on the parent reader\r
+ * directly: they should all pass through this filter.</p>\r
+ *\r
+ * @return The parent filter, or null if none has been set.\r
+ */\r
+ public abstract XMLReader getParent ();\r
+\r
+}\r
+\r
+// end of XMLFilter.java\r
--- /dev/null
+// XMLReader.java - read an XML document.\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the Public Domain.\r
+\r
+// $Id: XMLReader.java,v 1.1 2000/10/02 02:43:17 sboag Exp $\r
+\r
+package org.xml.sax;\r
+\r
+import java.io.IOException;\r
+\r
+\r
+/**\r
+ * Interface for reading an XML document using callbacks.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p><strong>Note:</strong> despite its name, this interface does \r
+ * <em>not</em> extend the standard Java {@link java.io.Reader Reader} \r
+ * interface, because reading XML is a fundamentally different activity \r
+ * than reading character data.</p>\r
+ *\r
+ * <p>XMLReader is the interface that an XML parser's SAX2 driver must\r
+ * implement. This interface allows an application to set and\r
+ * query features and properties in the parser, to register\r
+ * event handlers for document processing, and to initiate\r
+ * a document parse.</p>\r
+ *\r
+ * <p>All SAX interfaces are assumed to be synchronous: the\r
+ * {@link #parse parse} methods must not return until parsing\r
+ * is complete, and readers must wait for an event-handler callback\r
+ * to return before reporting the next event.</p>\r
+ *\r
+ * <p>This interface replaces the (now deprecated) SAX 1.0 {@link\r
+ * org.xml.sax.Parser Parser} interface. The XMLReader interface\r
+ * contains two important enhancements over the old Parser\r
+ * interface:</p>\r
+ *\r
+ * <ol>\r
+ * <li>it adds a standard way to query and set features and \r
+ * properties; and</li>\r
+ * <li>it adds Namespace support, which is required for many\r
+ * higher-level XML standards.</li>\r
+ * </ol>\r
+ *\r
+ * <p>There are adapters available to convert a SAX1 Parser to\r
+ * a SAX2 XMLReader and vice-versa.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.XMLFilter\r
+ * @see org.xml.sax.helpers.ParserAdapter\r
+ * @see org.xml.sax.helpers.XMLReaderAdapter \r
+ */\r
+public interface XMLReader\r
+{\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Configuration.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Look up the value of a feature.\r
+ *\r
+ * <p>The feature name is any fully-qualified URI. It is\r
+ * possible for an XMLReader to recognize a feature name but\r
+ * to be unable to return its value; this is especially true\r
+ * in the case of an adapter for a SAX1 Parser, which has\r
+ * no way of knowing whether the underlying parser is\r
+ * performing validation or expanding external entities.</p>\r
+ *\r
+ * <p>All XMLReaders are required to recognize the\r
+ * http://xml.org/sax/features/namespaces and the\r
+ * http://xml.org/sax/features/namespace-prefixes feature names.</p>\r
+ *\r
+ * <p>Some feature values may be available only in specific\r
+ * contexts, such as before, during, or after a parse.</p>\r
+ *\r
+ * <p>Typical usage is something like this:</p>\r
+ *\r
+ * <pre>\r
+ * XMLReader r = new MySAXDriver();\r
+ *\r
+ * // try to activate validation\r
+ * try {\r
+ * r.setFeature("http://xml.org/sax/features/validation", true);\r
+ * } catch (SAXException e) {\r
+ * System.err.println("Cannot activate validation."); \r
+ * }\r
+ *\r
+ * // register event handlers\r
+ * r.setContentHandler(new MyContentHandler());\r
+ * r.setErrorHandler(new MyErrorHandler());\r
+ *\r
+ * // parse the first document\r
+ * try {\r
+ * r.parse("http://www.foo.com/mydoc.xml");\r
+ * } catch (IOException e) {\r
+ * System.err.println("I/O exception reading XML document");\r
+ * } catch (SAXException e) {\r
+ * System.err.println("XML exception reading document.");\r
+ * }\r
+ * </pre>\r
+ *\r
+ * <p>Implementors are free (and encouraged) to invent their own features,\r
+ * using names built on their own URIs.</p>\r
+ *\r
+ * @param name The feature name, which is a fully-qualified URI.\r
+ * @return The current state of the feature (true or false).\r
+ * @exception org.xml.sax.SAXNotRecognizedException When the\r
+ * XMLReader does not recognize the feature name.\r
+ * @exception org.xml.sax.SAXNotSupportedException When the\r
+ * XMLReader recognizes the feature name but \r
+ * cannot determine its value at this time.\r
+ * @see #setFeature\r
+ */\r
+ public boolean getFeature (String name)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException;\r
+\r
+\r
+ /**\r
+ * Set the state of a feature.\r
+ *\r
+ * <p>The feature name is any fully-qualified URI. It is\r
+ * possible for an XMLReader to recognize a feature name but\r
+ * to be unable to set its value; this is especially true\r
+ * in the case of an adapter for a SAX1 {@link org.xml.sax.Parser Parser},\r
+ * which has no way of affecting whether the underlying parser is\r
+ * validating, for example.</p>\r
+ *\r
+ * <p>All XMLReaders are required to support setting\r
+ * http://xml.org/sax/features/namespaces to true and\r
+ * http://xml.org/sax/features/namespace-prefixes to false.</p>\r
+ *\r
+ * <p>Some feature values may be immutable or mutable only \r
+ * in specific contexts, such as before, during, or after \r
+ * a parse.</p>\r
+ *\r
+ * @param name The feature name, which is a fully-qualified URI.\r
+ * @param state The requested state of the feature (true or false).\r
+ * @exception org.xml.sax.SAXNotRecognizedException When the\r
+ * XMLReader does not recognize the feature name.\r
+ * @exception org.xml.sax.SAXNotSupportedException When the\r
+ * XMLReader recognizes the feature name but \r
+ * cannot set the requested value.\r
+ * @see #getFeature\r
+ */\r
+ public void setFeature (String name, boolean value)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException;\r
+\r
+\r
+ /**\r
+ * Look up the value of a property.\r
+ *\r
+ * <p>The property name is any fully-qualified URI. It is\r
+ * possible for an XMLReader to recognize a property name but\r
+ * to be unable to return its state; this is especially true\r
+ * in the case of an adapter for a SAX1 {@link org.xml.sax.Parser\r
+ * Parser}.</p>\r
+ *\r
+ * <p>XMLReaders are not required to recognize any specific\r
+ * property names, though an initial core set is documented for\r
+ * SAX2.</p>\r
+ *\r
+ * <p>Some property values may be available only in specific\r
+ * contexts, such as before, during, or after a parse.</p>\r
+ *\r
+ * <p>Implementors are free (and encouraged) to invent their own properties,\r
+ * using names built on their own URIs.</p>\r
+ *\r
+ * @param name The property name, which is a fully-qualified URI.\r
+ * @return The current value of the property.\r
+ * @exception org.xml.sax.SAXNotRecognizedException When the\r
+ * XMLReader does not recognize the property name.\r
+ * @exception org.xml.sax.SAXNotSupportedException When the\r
+ * XMLReader recognizes the property name but \r
+ * cannot determine its value at this time.\r
+ * @see #setProperty\r
+ */\r
+ public Object getProperty (String name)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException;\r
+\r
+\r
+ /**\r
+ * Set the value of a property.\r
+ *\r
+ * <p>The property name is any fully-qualified URI. It is\r
+ * possible for an XMLReader to recognize a property name but\r
+ * to be unable to set its value; this is especially true\r
+ * in the case of an adapter for a SAX1 {@link org.xml.sax.Parser\r
+ * Parser}.</p>\r
+ *\r
+ * <p>XMLReaders are not required to recognize setting\r
+ * any specific property names, though a core set is provided with \r
+ * SAX2.</p>\r
+ *\r
+ * <p>Some property values may be immutable or mutable only \r
+ * in specific contexts, such as before, during, or after \r
+ * a parse.</p>\r
+ *\r
+ * <p>This method is also the standard mechanism for setting\r
+ * extended handlers.</p>\r
+ *\r
+ * @param name The property name, which is a fully-qualified URI.\r
+ * @param state The requested value for the property.\r
+ * @exception org.xml.sax.SAXNotRecognizedException When the\r
+ * XMLReader does not recognize the property name.\r
+ * @exception org.xml.sax.SAXNotSupportedException When the\r
+ * XMLReader recognizes the property name but \r
+ * cannot set the requested value.\r
+ */\r
+ public void setProperty (String name, Object value)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException;\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Event handlers.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Allow an application to register an entity resolver.\r
+ *\r
+ * <p>If the application does not register an entity resolver,\r
+ * the XMLReader will perform its own default resolution.</p>\r
+ *\r
+ * <p>Applications may register a new or different resolver in the\r
+ * middle of a parse, and the SAX parser must begin using the new\r
+ * resolver immediately.</p>\r
+ *\r
+ * @param resolver The entity resolver.\r
+ * @exception java.lang.NullPointerException If the resolver \r
+ * argument is null.\r
+ * @see #getEntityResolver\r
+ */\r
+ public void setEntityResolver (EntityResolver resolver);\r
+\r
+\r
+ /**\r
+ * Return the current entity resolver.\r
+ *\r
+ * @return The current entity resolver, or null if none\r
+ * has been registered.\r
+ * @see #setEntityResolver\r
+ */\r
+ public EntityResolver getEntityResolver ();\r
+\r
+\r
+ /**\r
+ * Allow an application to register a DTD event handler.\r
+ *\r
+ * <p>If the application does not register a DTD handler, all DTD\r
+ * events reported by the SAX parser will be silently ignored.</p>\r
+ *\r
+ * <p>Applications may register a new or different handler in the\r
+ * middle of a parse, and the SAX parser must begin using the new\r
+ * handler immediately.</p>\r
+ *\r
+ * @param handler The DTD handler.\r
+ * @exception java.lang.NullPointerException If the handler \r
+ * argument is null.\r
+ * @see #getDTDHandler\r
+ */\r
+ public void setDTDHandler (DTDHandler handler);\r
+\r
+\r
+ /**\r
+ * Return the current DTD handler.\r
+ *\r
+ * @return The current DTD handler, or null if none\r
+ * has been registered.\r
+ * @see #setDTDHandler\r
+ */\r
+ public DTDHandler getDTDHandler ();\r
+\r
+\r
+ /**\r
+ * Allow an application to register a content event handler.\r
+ *\r
+ * <p>If the application does not register a content handler, all\r
+ * content events reported by the SAX parser will be silently\r
+ * ignored.</p>\r
+ *\r
+ * <p>Applications may register a new or different handler in the\r
+ * middle of a parse, and the SAX parser must begin using the new\r
+ * handler immediately.</p>\r
+ *\r
+ * @param handler The content handler.\r
+ * @exception java.lang.NullPointerException If the handler \r
+ * argument is null.\r
+ * @see #getContentHandler\r
+ */\r
+ public void setContentHandler (ContentHandler handler);\r
+\r
+\r
+ /**\r
+ * Return the current content handler.\r
+ *\r
+ * @return The current content handler, or null if none\r
+ * has been registered.\r
+ * @see #setContentHandler\r
+ */\r
+ public ContentHandler getContentHandler ();\r
+\r
+\r
+ /**\r
+ * Allow an application to register an error event handler.\r
+ *\r
+ * <p>If the application does not register an error handler, all\r
+ * error events reported by the SAX parser will be silently\r
+ * ignored; however, normal processing may not continue. It is\r
+ * highly recommended that all SAX applications implement an\r
+ * error handler to avoid unexpected bugs.</p>\r
+ *\r
+ * <p>Applications may register a new or different handler in the\r
+ * middle of a parse, and the SAX parser must begin using the new\r
+ * handler immediately.</p>\r
+ *\r
+ * @param handler The error handler.\r
+ * @exception java.lang.NullPointerException If the handler \r
+ * argument is null.\r
+ * @see #getErrorHandler\r
+ */\r
+ public void setErrorHandler (ErrorHandler handler);\r
+\r
+\r
+ /**\r
+ * Return the current error handler.\r
+ *\r
+ * @return The current error handler, or null if none\r
+ * has been registered.\r
+ * @see #setErrorHandler\r
+ */\r
+ public ErrorHandler getErrorHandler ();\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Parsing.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+ /**\r
+ * Parse an XML document.\r
+ *\r
+ * <p>The application can use this method to instruct the XML\r
+ * reader to begin parsing an XML document from any valid input\r
+ * source (a character stream, a byte stream, or a URI).</p>\r
+ *\r
+ * <p>Applications may not invoke this method while a parse is in\r
+ * progress (they should create a new XMLReader instead for each\r
+ * nested XML document). Once a parse is complete, an\r
+ * application may reuse the same XMLReader object, possibly with a\r
+ * different input source.</p>\r
+ *\r
+ * <p>During the parse, the XMLReader will provide information\r
+ * about the XML document through the registered event\r
+ * handlers.</p>\r
+ *\r
+ * <p>This method is synchronous: it will not return until parsing\r
+ * has ended. If a client application wants to terminate \r
+ * parsing early, it should throw an exception.</p>\r
+ *\r
+ * @param source The input source for the top-level of the\r
+ * XML document.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @exception java.io.IOException An IO exception from the parser,\r
+ * possibly from a byte stream or character stream\r
+ * supplied by the application.\r
+ * @see org.xml.sax.InputSource\r
+ * @see #parse(java.lang.String)\r
+ * @see #setEntityResolver\r
+ * @see #setDTDHandler\r
+ * @see #setContentHandler\r
+ * @see #setErrorHandler \r
+ */\r
+ public void parse (InputSource input)\r
+ throws IOException, SAXException;\r
+\r
+\r
+ /**\r
+ * Parse an XML document from a system identifier (URI).\r
+ *\r
+ * <p>This method is a shortcut for the common case of reading a\r
+ * document from a system identifier. It is the exact\r
+ * equivalent of the following:</p>\r
+ *\r
+ * <pre>\r
+ * parse(new InputSource(systemId));\r
+ * </pre>\r
+ *\r
+ * <p>If the system identifier is a URL, it must be fully resolved\r
+ * by the application before it is passed to the parser.</p>\r
+ *\r
+ * @param systemId The system identifier (URI).\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @exception java.io.IOException An IO exception from the parser,\r
+ * possibly from a byte stream or character stream\r
+ * supplied by the application.\r
+ * @see #parse(org.xml.sax.InputSource)\r
+ */\r
+ public void parse (String systemId)\r
+ throws IOException, SAXException;\r
+\r
+}\r
+\r
+// end of XMLReader.java\r
--- /dev/null
+// DeclHandler.java - Optional handler for DTD declaration events.\r
+// Public Domain: no warranty.\r
+// $Id: DeclHandler.java,v 1.1 2000/10/02 02:43:19 sboag Exp $\r
+\r
+package org.xml.sax.ext;\r
+\r
+import org.xml.sax.SAXException;\r
+\r
+\r
+/**\r
+ * SAX2 extension handler for DTD declaration events.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This is an optional extension handler for SAX2 to provide\r
+ * information about DTD declarations in an XML document. XML\r
+ * readers are not required to support this handler.</p>\r
+ *\r
+ * <p>Note that data-related DTD declarations (unparsed entities and\r
+ * notations) are already reported through the {@link\r
+ * org.xml.sax.DTDHandler DTDHandler} interface.</p>\r
+ *\r
+ * <p>If you are using the declaration handler together with a lexical\r
+ * handler, all of the events will occur between the\r
+ * {@link org.xml.sax.ext.LexicalHandler#startDTD startDTD} and the\r
+ * {@link org.xml.sax.ext.LexicalHandler#endDTD endDTD} events.</p>\r
+ *\r
+ * <p>To set the DeclHandler for an XML reader, use the\r
+ * {@link org.xml.sax.XMLReader#setProperty setProperty} method\r
+ * with the propertyId "http://xml.org/sax/handlers/DeclHandler".\r
+ * If the reader does not support declaration events, it will throw a\r
+ * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}\r
+ * or a\r
+ * {@link org.xml.sax.SAXNotSupportedException SAXNotSupportedException}\r
+ * when you attempt to register the handler.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0beta\r
+ * @see org.xml.sax.XMLReader\r
+ */\r
+public interface DeclHandler\r
+{\r
+\r
+ /**\r
+ * Report an element type declaration.\r
+ *\r
+ * <p>The content model will consist of the string "EMPTY", the\r
+ * string "ANY", or a parenthesised group, optionally followed\r
+ * by an occurrence indicator. The model will be normalized so\r
+ * that all whitespace is removed,and will include the enclosing\r
+ * parentheses.</p>\r
+ *\r
+ * @param name The element type name.\r
+ * @param model The content model as a normalized string.\r
+ * @exception SAXException The application may raise an exception.\r
+ */\r
+ public abstract void elementDecl (String name, String model)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Report an attribute type declaration.\r
+ *\r
+ * <p>Only the effective (first) declaration for an attribute will\r
+ * be reported. The type will be one of the strings "CDATA",\r
+ * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",\r
+ * "ENTITIES", or "NOTATION", or a parenthesized token group with \r
+ * the separator "|" and all whitespace removed.</p>\r
+ *\r
+ * @param eName The name of the associated element.\r
+ * @param aName The name of the attribute.\r
+ * @param type A string representing the attribute type.\r
+ * @param valueDefault A string representing the attribute default\r
+ * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if\r
+ * none of these applies.\r
+ * @param value A string representing the attribute's default value,\r
+ * or null if there is none.\r
+ * @exception SAXException The application may raise an exception.\r
+ */\r
+ public abstract void attributeDecl (String eName,\r
+ String aName,\r
+ String type,\r
+ String valueDefault,\r
+ String value)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Report an internal entity declaration.\r
+ *\r
+ * <p>Only the effective (first) declaration for each entity\r
+ * will be reported.</p>\r
+ *\r
+ * @param name The name of the entity. If it is a parameter\r
+ * entity, the name will begin with '%'.\r
+ * @param value The replacement text of the entity.\r
+ * @exception SAXException The application may raise an exception.\r
+ * @see #externalEntityDecl\r
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl\r
+ */\r
+ public abstract void internalEntityDecl (String name, String value)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Report a parsed external entity declaration.\r
+ *\r
+ * <p>Only the effective (first) declaration for each entity\r
+ * will be reported.</p>\r
+ *\r
+ * @param name The name of the entity. If it is a parameter\r
+ * entity, the name will begin with '%'.\r
+ * @param publicId The declared public identifier of the entity, or\r
+ * null if none was declared.\r
+ * @param systemId The declared system identifier of the entity.\r
+ * @exception SAXException The application may raise an exception.\r
+ * @see #internalEntityDecl\r
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl\r
+ */\r
+ public abstract void externalEntityDecl (String name, String publicId,\r
+ String systemId)\r
+ throws SAXException;\r
+\r
+}\r
+\r
+// end of DeclHandler.java\r
--- /dev/null
+// LexicalHandler.java - optional handler for lexical parse events.\r
+// Public Domain: no warranty.\r
+// $Id: LexicalHandler.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
+\r
+package org.xml.sax.ext;\r
+\r
+import org.xml.sax.SAXException;\r
+\r
+/**\r
+ * SAX2 extension handler for lexical events.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This is an optional extension handler for SAX2 to provide\r
+ * lexical information about an XML document, such as comments\r
+ * and CDATA section boundaries; XML readers are not required to \r
+ * support this handler.</p>\r
+ *\r
+ * <p>The events in the lexical handler apply to the entire document,\r
+ * not just to the document element, and all lexical handler events\r
+ * must appear between the content handler's startDocument and\r
+ * endDocument events.</p>\r
+ *\r
+ * <p>To set the LexicalHandler for an XML reader, use the\r
+ * {@link org.xml.sax.XMLReader#setProperty setProperty} method\r
+ * with the propertyId "http://xml.org/sax/handlers/LexicalHandler".\r
+ * If the reader does not support lexical events, it will throw a\r
+ * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}\r
+ * or a\r
+ * {@link org.xml.sax.SAXNotSupportedException SAXNotSupportedException}\r
+ * when you attempt to register the handler.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0beta\r
+ * @see org.xml.sax.XMLReader#setProperty\r
+ * @see org.xml.sax.SAXNotRecognizedException\r
+ * @see org.xml.sax.SAXNotSupportedException\r
+ */\r
+public interface LexicalHandler\r
+{\r
+\r
+ /**\r
+ * Report the start of DTD declarations, if any.\r
+ *\r
+ * <p>Any declarations are assumed to be in the internal subset\r
+ * unless otherwise indicated by a {@link #startEntity startEntity}\r
+ * event.</p>\r
+ *\r
+ * <p>Note that the start/endDTD events will appear within\r
+ * the start/endDocument events from ContentHandler and\r
+ * before the first startElement event.</p>\r
+ *\r
+ * @param name The document type name.\r
+ * @param publicId The declared public identifier for the\r
+ * external DTD subset, or null if none was declared.\r
+ * @param systemId The declared system identifier for the\r
+ * external DTD subset, or null if none was declared.\r
+ * @exception SAXException The application may raise an\r
+ * exception.\r
+ * @see #endDTD\r
+ * @see #startEntity\r
+ */\r
+ public abstract void startDTD (String name, String publicId,\r
+ String systemId)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Report the end of DTD declarations.\r
+ *\r
+ * @exception SAXException The application may raise an exception.\r
+ * @see #startDTD\r
+ */\r
+ public abstract void endDTD ()\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Report the beginning of an entity in content.\r
+ *\r
+ * <p><strong>NOTE:</entity> entity references in attribute\r
+ * values -- and the start and end of the document entity --\r
+ * are never reported.</p>\r
+ *\r
+ * <p>The start and end of the external DTD subset are reported\r
+ * using the pseudo-name "[dtd]". All other events must be\r
+ * properly nested within start/end entity events.</p>\r
+ *\r
+ * <p>Note that skipped entities will be reported through the\r
+ * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity}\r
+ * event, which is part of the ContentHandler interface.</p>\r
+ *\r
+ * @param name The name of the entity. If it is a parameter\r
+ * entity, the name will begin with '%'.\r
+ * @exception SAXException The application may raise an exception.\r
+ * @see #endEntity\r
+ * @see org.xml.sax.ext.DeclHandler#internalEntityDecl\r
+ * @see org.xml.sax.ext.DeclHandler#externalEntityDecl\r
+ */\r
+ public abstract void startEntity (String name)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Report the end of an entity.\r
+ *\r
+ * @param name The name of the entity that is ending.\r
+ * @exception SAXException The application may raise an exception.\r
+ * @see #startEntity\r
+ */\r
+ public abstract void endEntity (String name)\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Report the start of a CDATA section.\r
+ *\r
+ * <p>The contents of the CDATA section will be reported through\r
+ * the regular {@link org.xml.sax.ContentHandler#characters\r
+ * characters} event.</p>\r
+ *\r
+ * @exception SAXException The application may raise an exception.\r
+ * @see #endCDATA\r
+ */\r
+ public abstract void startCDATA ()\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Report the end of a CDATA section.\r
+ *\r
+ * @exception SAXException The application may raise an exception.\r
+ * @see #startCDATA\r
+ */\r
+ public abstract void endCDATA ()\r
+ throws SAXException;\r
+\r
+\r
+ /**\r
+ * Report an XML comment anywhere in the document.\r
+ *\r
+ * <p>This callback will be used for comments inside or outside the\r
+ * document element, including comments in the external DTD\r
+ * subset (if read).</p>\r
+ *\r
+ * @param ch An array holding the characters in the comment.\r
+ * @param start The starting position in the array.\r
+ * @param length The number of characters to use from the array.\r
+ * @exception SAXException The application may raise an exception.\r
+ */\r
+ public abstract void comment (char ch[], int start, int length)\r
+ throws SAXException;\r
+\r
+}\r
+\r
+// end of LexicalHandler.java\r
--- /dev/null
+// SAX default implementation for AttributeList.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: AttributeListImpl.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
+\r
+package org.xml.sax.helpers;\r
+\r
+import org.xml.sax.AttributeList;\r
+\r
+import java.util.Vector;\r
+\r
+\r
+/**\r
+ * Default implementation for AttributeList.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>AttributeList implements the deprecated SAX1 {@link\r
+ * org.xml.sax.AttributeList AttributeList} interface, and has been\r
+ * replaced by the new SAX2 {@link org.xml.sax.helpers.AttributesImpl\r
+ * AttributesImpl} interface.</p>\r
+ *\r
+ * <p>This class provides a convenience implementation of the SAX\r
+ * {@link org.xml.sax.AttributeList AttributeList} interface. This \r
+ * implementation is useful both for SAX parser writers, who can use \r
+ * it to provide attributes to the application, and for SAX application \r
+ * writers, who can use it to create a persistent copy of an element's \r
+ * attribute specifications:</p>\r
+ *\r
+ * <pre>\r
+ * private AttributeList myatts;\r
+ *\r
+ * public void startElement (String name, AttributeList atts)\r
+ * {\r
+ * // create a persistent copy of the attribute list\r
+ * // for use outside this method\r
+ * myatts = new AttributeListImpl(atts);\r
+ * [...]\r
+ * }\r
+ * </pre>\r
+ *\r
+ * <p>Please note that SAX parsers are not required to use this\r
+ * class to provide an implementation of AttributeList; it is\r
+ * supplied only as an optional convenience. In particular, \r
+ * parser writers are encouraged to invent more efficient\r
+ * implementations.</p>\r
+ *\r
+ * @deprecated This class implements a deprecated interface,\r
+ * {@link org.xml.sax.AttributeList AttributeList};\r
+ * that interface has been replaced by\r
+ * {@link org.xml.sax.Attributes Attributes},\r
+ * which is implemented in the\r
+ * {@link org.xml.sax.helpers.AttributesImpl \r
+ * AttributesImpl} helper class.\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.AttributeList\r
+ * @see org.xml.sax.DocumentHandler#startElement \r
+ */\r
+public class AttributeListImpl implements AttributeList\r
+{\r
+ \r
+ /**\r
+ * Create an empty attribute list.\r
+ *\r
+ * <p>This constructor is most useful for parser writers, who\r
+ * will use it to create a single, reusable attribute list that\r
+ * can be reset with the clear method between elements.</p>\r
+ *\r
+ * @see #addAttribute\r
+ * @see #clear\r
+ */\r
+ public AttributeListImpl ()\r
+ {\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Construct a persistent copy of an existing attribute list.\r
+ *\r
+ * <p>This constructor is most useful for application writers,\r
+ * who will use it to create a persistent copy of an existing\r
+ * attribute list.</p>\r
+ *\r
+ * @param atts The attribute list to copy\r
+ * @see org.xml.sax.DocumentHandler#startElement\r
+ */\r
+ public AttributeListImpl (AttributeList atts)\r
+ {\r
+ setAttributeList(atts);\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Methods specific to this class.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Set the attribute list, discarding previous contents.\r
+ *\r
+ * <p>This method allows an application writer to reuse an\r
+ * attribute list easily.</p>\r
+ *\r
+ * @param atts The attribute list to copy.\r
+ */\r
+ public void setAttributeList (AttributeList atts)\r
+ {\r
+ int count = atts.getLength();\r
+ \r
+ clear();\r
+ \r
+ for (int i = 0; i < count; i++) {\r
+ addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Add an attribute to an attribute list.\r
+ *\r
+ * <p>This method is provided for SAX parser writers, to allow them\r
+ * to build up an attribute list incrementally before delivering\r
+ * it to the application.</p>\r
+ *\r
+ * @param name The attribute name.\r
+ * @param type The attribute type ("NMTOKEN" for an enumeration).\r
+ * @param value The attribute value (must not be null).\r
+ * @see #removeAttribute\r
+ * @see org.xml.sax.DocumentHandler#startElement\r
+ */\r
+ public void addAttribute (String name, String type, String value)\r
+ {\r
+ names.addElement(name);\r
+ types.addElement(type);\r
+ values.addElement(value);\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Remove an attribute from the list.\r
+ *\r
+ * <p>SAX application writers can use this method to filter an\r
+ * attribute out of an AttributeList. Note that invoking this\r
+ * method will change the length of the attribute list and\r
+ * some of the attribute's indices.</p>\r
+ *\r
+ * <p>If the requested attribute is not in the list, this is\r
+ * a no-op.</p>\r
+ *\r
+ * @param name The attribute name.\r
+ * @see #addAttribute\r
+ */\r
+ public void removeAttribute (String name)\r
+ {\r
+ int i = names.indexOf(name);\r
+ \r
+ if (i >= 0) {\r
+ names.removeElementAt(i);\r
+ types.removeElementAt(i);\r
+ values.removeElementAt(i);\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Clear the attribute list.\r
+ *\r
+ * <p>SAX parser writers can use this method to reset the attribute\r
+ * list between DocumentHandler.startElement events. Normally,\r
+ * it will make sense to reuse the same AttributeListImpl object\r
+ * rather than allocating a new one each time.</p>\r
+ *\r
+ * @see org.xml.sax.DocumentHandler#startElement\r
+ */\r
+ public void clear ()\r
+ {\r
+ names.removeAllElements();\r
+ types.removeAllElements();\r
+ values.removeAllElements();\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.AttributeList\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Return the number of attributes in the list.\r
+ *\r
+ * @return The number of attributes in the list.\r
+ * @see org.xml.sax.AttributeList#getLength\r
+ */\r
+ public int getLength ()\r
+ {\r
+ return names.size();\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the name of an attribute (by position).\r
+ *\r
+ * @param i The position of the attribute in the list.\r
+ * @return The attribute name as a string, or null if there\r
+ * is no attribute at that position.\r
+ * @see org.xml.sax.AttributeList#getName(int)\r
+ */\r
+ public String getName (int i)\r
+ {\r
+ if (i < 0) {\r
+ return null;\r
+ }\r
+ try {\r
+ return (String)names.elementAt(i);\r
+ } catch (ArrayIndexOutOfBoundsException e) {\r
+ return null;\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the type of an attribute (by position).\r
+ *\r
+ * @param i The position of the attribute in the list.\r
+ * @return The attribute type as a string ("NMTOKEN" for an\r
+ * enumeration, and "CDATA" if no declaration was\r
+ * read), or null if there is no attribute at\r
+ * that position.\r
+ * @see org.xml.sax.AttributeList#getType(int)\r
+ */\r
+ public String getType (int i)\r
+ {\r
+ if (i < 0) {\r
+ return null;\r
+ }\r
+ try {\r
+ return (String)types.elementAt(i);\r
+ } catch (ArrayIndexOutOfBoundsException e) {\r
+ return null;\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the value of an attribute (by position).\r
+ *\r
+ * @param i The position of the attribute in the list.\r
+ * @return The attribute value as a string, or null if\r
+ * there is no attribute at that position.\r
+ * @see org.xml.sax.AttributeList#getValue(int)\r
+ */\r
+ public String getValue (int i)\r
+ {\r
+ if (i < 0) {\r
+ return null;\r
+ }\r
+ try {\r
+ return (String)values.elementAt(i);\r
+ } catch (ArrayIndexOutOfBoundsException e) {\r
+ return null;\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the type of an attribute (by name).\r
+ *\r
+ * @param name The attribute name.\r
+ * @return The attribute type as a string ("NMTOKEN" for an\r
+ * enumeration, and "CDATA" if no declaration was\r
+ * read).\r
+ * @see org.xml.sax.AttributeList#getType(java.lang.String)\r
+ */\r
+ public String getType (String name)\r
+ {\r
+ return getType(names.indexOf(name));\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Get the value of an attribute (by name).\r
+ *\r
+ * @param name The attribute name.\r
+ * @see org.xml.sax.AttributeList#getValue(java.lang.String)\r
+ */\r
+ public String getValue (String name)\r
+ {\r
+ return getValue(names.indexOf(name));\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+ Vector names = new Vector();\r
+ Vector types = new Vector();\r
+ Vector values = new Vector();\r
+\r
+}\r
+\r
+// end of AttributeListImpl.java\r
--- /dev/null
+// AttributesImpl.java - default implementation of Attributes.\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the public domain.\r
+\r
+// $Id: AttributesImpl.java,v 1.2 2001/05/31 16:03:17 garyp Exp $\r
+\r
+\r
+package org.xml.sax.helpers;\r
+\r
+import org.xml.sax.Attributes;\r
+\r
+\r
+/**\r
+ * Default implementation of the Attributes interface.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class provides a default implementation of the SAX2\r
+ * {@link org.xml.sax.Attributes Attributes} interface, with the \r
+ * addition of manipulators so that the list can be modified or \r
+ * reused.</p>\r
+ *\r
+ * <p>There are two typical uses of this class:</p>\r
+ *\r
+ * <ol>\r
+ * <li>to take a persistent snapshot of an Attributes object\r
+ * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or</li>\r
+ * <li>to construct or modify an Attributes object in a SAX2 driver or filter.</li>\r
+ * </ol>\r
+ *\r
+ * <p>This class replaces the now-deprecated SAX1 {@link \r
+ * org.xml.sax.helpers.AttributeListImpl AttributeListImpl}\r
+ * class; in addition to supporting the updated Attributes\r
+ * interface rather than the deprecated {@link org.xml.sax.AttributeList\r
+ * AttributeList} interface, it also includes a much more efficient \r
+ * implementation using a single array rather than a set of Vectors.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ */\r
+public class AttributesImpl implements Attributes\r
+{\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Constructors.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Construct a new, empty AttributesImpl object.\r
+ */\r
+ public AttributesImpl ()\r
+ {\r
+ length = 0;\r
+ data = null;\r
+ }\r
+\r
+\r
+ /**\r
+ * Copy an existing Attributes object.\r
+ *\r
+ * <p>This constructor is especially useful inside a\r
+ * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p>\r
+ *\r
+ * @param atts The existing Attributes object.\r
+ */\r
+ public AttributesImpl (Attributes atts)\r
+ {\r
+ setAttributes(atts);\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.Attributes.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Return the number of attributes in the list.\r
+ *\r
+ * @return The number of attributes in the list.\r
+ * @see org.xml.sax.Attributes#getLength\r
+ */\r
+ public int getLength ()\r
+ {\r
+ return length;\r
+ }\r
+\r
+\r
+ /**\r
+ * Return an attribute's Namespace URI.\r
+ *\r
+ * @param index The attribute's index (zero-based).\r
+ * @return The Namespace URI, the empty string if none is\r
+ * available, or null if the index is out of range.\r
+ * @see org.xml.sax.Attributes#getURI\r
+ */\r
+ public String getURI (int index)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ return data[index*5];\r
+ } else {\r
+ return null;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Return an attribute's local name.\r
+ *\r
+ * @param index The attribute's index (zero-based).\r
+ * @return The attribute's local name, the empty string if \r
+ * none is available, or null if the index if out of range.\r
+ * @see org.xml.sax.Attributes#getLocalName\r
+ */\r
+ public String getLocalName (int index)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ return data[index*5+1];\r
+ } else {\r
+ return null;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Return an attribute's qualified (prefixed) name.\r
+ *\r
+ * @param index The attribute's index (zero-based).\r
+ * @return The attribute's qualified name, the empty string if \r
+ * none is available, or null if the index is out of bounds.\r
+ * @see org.xml.sax.Attributes#getQName\r
+ */\r
+ public String getQName (int index)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ return data[index*5+2];\r
+ } else {\r
+ return null;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Return an attribute's type by index.\r
+ *\r
+ * @param index The attribute's index (zero-based).\r
+ * @return The attribute's type, "CDATA" if the type is unknown, or null\r
+ * if the index is out of bounds.\r
+ * @see org.xml.sax.Attributes#getType(int)\r
+ */\r
+ public String getType (int index)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ return data[index*5+3];\r
+ } else {\r
+ return null;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Return an attribute's value by index.\r
+ *\r
+ * @param index The attribute's index (zero-based).\r
+ * @return The attribute's value or null if the index is out of bounds.\r
+ * @see org.xml.sax.Attributes#getValue(int)\r
+ */\r
+ public String getValue (int index)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ return data[index*5+4];\r
+ } else {\r
+ return null;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up an attribute's index by Namespace name.\r
+ *\r
+ * <p>In many cases, it will be more efficient to look up the name once and\r
+ * use the index query methods rather than using the name query methods\r
+ * repeatedly.</p>\r
+ *\r
+ * @param uri The attribute's Namespace URI, or the empty\r
+ * string if none is available.\r
+ * @param localName The attribute's local name.\r
+ * @return The attribute's index, or -1 if none matches.\r
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)\r
+ */\r
+ public int getIndex (String uri, String localName)\r
+ {\r
+ int max = length * 5;\r
+ for (int i = 0; i < max; i += 5) {\r
+ if (data[i].equals(uri) && data[i+1].equals(localName)) {\r
+ return i / 5;\r
+ }\r
+ } \r
+ return -1;\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up an attribute's index by qualified (prefixed) name.\r
+ *\r
+ * @param qName The qualified name.\r
+ * @return The attribute's index, or -1 if none matches.\r
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String)\r
+ */\r
+ public int getIndex (String qName)\r
+ {\r
+ int max = length * 5;\r
+ for (int i = 0; i < max; i += 5) {\r
+ if (data[i+2].equals(qName)) {\r
+ return i / 5;\r
+ }\r
+ } \r
+ return -1;\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up an attribute's type by Namespace-qualified name.\r
+ *\r
+ * @param uri The Namespace URI, or the empty string for a name\r
+ * with no explicit Namespace URI.\r
+ * @param localName The local name.\r
+ * @return The attribute's type, or null if there is no\r
+ * matching attribute.\r
+ * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String)\r
+ */\r
+ public String getType (String uri, String localName)\r
+ {\r
+ int max = length * 5;\r
+ for (int i = 0; i < max; i += 5) {\r
+ if (data[i].equals(uri) && data[i+1].equals(localName)) {\r
+ return data[i+3];\r
+ }\r
+ } \r
+ return null;\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up an attribute's type by qualified (prefixed) name.\r
+ *\r
+ * @param qName The qualified name.\r
+ * @return The attribute's type, or null if there is no\r
+ * matching attribute.\r
+ * @see org.xml.sax.Attributes#getType(java.lang.String)\r
+ */\r
+ public String getType (String qName)\r
+ {\r
+ int max = length * 5;\r
+ for (int i = 0; i < max; i += 5) {\r
+ if (data[i+2].equals(qName)) {\r
+ return data[i+3];\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up an attribute's value by Namespace-qualified name.\r
+ *\r
+ * @param uri The Namespace URI, or the empty string for a name\r
+ * with no explicit Namespace URI.\r
+ * @param localName The local name.\r
+ * @return The attribute's value, or null if there is no\r
+ * matching attribute.\r
+ * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String)\r
+ */\r
+ public String getValue (String uri, String localName)\r
+ {\r
+ int max = length * 5;\r
+ for (int i = 0; i < max; i += 5) {\r
+ if (data[i].equals(uri) && data[i+1].equals(localName)) {\r
+ return data[i+4];\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up an attribute's value by qualified (prefixed) name.\r
+ *\r
+ * @param qName The qualified name.\r
+ * @return The attribute's value, or null if there is no\r
+ * matching attribute.\r
+ * @see org.xml.sax.Attributes#getValue(java.lang.String)\r
+ */\r
+ public String getValue (String qName)\r
+ {\r
+ int max = length * 5;\r
+ for (int i = 0; i < max; i += 5) {\r
+ if (data[i+2].equals(qName)) {\r
+ return data[i+4];\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Manipulators.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Clear the attribute list for reuse.\r
+ *\r
+ * <p>Note that no memory is actually freed by this call:\r
+ * the current arrays are kept so that they can be \r
+ * reused.</p>\r
+ */\r
+ public void clear ()\r
+ {\r
+ length = 0;\r
+ }\r
+\r
+\r
+ /**\r
+ * Copy an entire Attributes object.\r
+ *\r
+ * <p>It may be more efficient to reuse an existing object\r
+ * rather than constantly allocating new ones.</p>\r
+ * \r
+ * @param atts The attributes to copy.\r
+ */\r
+ public void setAttributes (Attributes atts)\r
+ {\r
+ clear();\r
+ length = atts.getLength();\r
+ data = new String[length*5]; \r
+ for (int i = 0; i < length; i++) {\r
+ data[i*5] = atts.getURI(i);\r
+ data[i*5+1] = atts.getLocalName(i);\r
+ data[i*5+2] = atts.getQName(i);\r
+ data[i*5+3] = atts.getType(i);\r
+ data[i*5+4] = atts.getValue(i);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Add an attribute to the end of the list.\r
+ *\r
+ * <p>For the sake of speed, this method does no checking\r
+ * to see if the attribute is already in the list: that is\r
+ * the responsibility of the application.</p>\r
+ *\r
+ * @param uri The Namespace URI, or the empty string if\r
+ * none is available or Namespace processing is not\r
+ * being performed.\r
+ * @param localName The local name, or the empty string if\r
+ * Namespace processing is not being performed.\r
+ * @param qName The qualified (prefixed) name, or the empty string\r
+ * if qualified names are not available.\r
+ * @param type The attribute type as a string.\r
+ * @param value The attribute value.\r
+ */\r
+ public void addAttribute (String uri, String localName, String qName,\r
+ String type, String value)\r
+ {\r
+ ensureCapacity(length+1);\r
+ data[length*5] = uri;\r
+ data[length*5+1] = localName;\r
+ data[length*5+2] = qName;\r
+ data[length*5+3] = type;\r
+ data[length*5+4] = value;\r
+ length++;\r
+ }\r
+\r
+\r
+ /**\r
+ * Set an attribute in the list.\r
+ *\r
+ * <p>For the sake of speed, this method does no checking\r
+ * for name conflicts or well-formedness: such checks are the\r
+ * responsibility of the application.</p>\r
+ *\r
+ * @param index The index of the attribute (zero-based).\r
+ * @param uri The Namespace URI, or the empty string if\r
+ * none is available or Namespace processing is not\r
+ * being performed.\r
+ * @param localName The local name, or the empty string if\r
+ * Namespace processing is not being performed.\r
+ * @param qName The qualified name, or the empty string\r
+ * if qualified names are not available.\r
+ * @param type The attribute type as a string.\r
+ * @param value The attribute value.\r
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the\r
+ * supplied index does not point to an attribute\r
+ * in the list.\r
+ */\r
+ public void setAttribute (int index, String uri, String localName,\r
+ String qName, String type, String value)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ data[index*5] = uri;\r
+ data[index*5+1] = localName;\r
+ data[index*5+2] = qName;\r
+ data[index*5+3] = type;\r
+ data[index*5+4] = value;\r
+ } else {\r
+ badIndex(index);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Remove an attribute from the list.\r
+ *\r
+ * @param index The index of the attribute (zero-based).\r
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the\r
+ * supplied index does not point to an attribute\r
+ * in the list.\r
+ */\r
+ public void removeAttribute (int index)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ data[index*5] = null;\r
+ data[index*5+1] = null;\r
+ data[index*5+2] = null;\r
+ data[index*5+3] = null;\r
+ data[index*5+4] = null;\r
+ if (index < length - 1) {\r
+ System.arraycopy(data, (index+1)*5, data, index*5,\r
+ (length-index-1)*5);\r
+ }\r
+ length--;\r
+ } else {\r
+ badIndex(index);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the Namespace URI of a specific attribute.\r
+ *\r
+ * @param index The index of the attribute (zero-based).\r
+ * @param uri The attribute's Namespace URI, or the empty\r
+ * string for none.\r
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the\r
+ * supplied index does not point to an attribute\r
+ * in the list.\r
+ */\r
+ public void setURI (int index, String uri)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ data[index*5] = uri;\r
+ } else {\r
+ badIndex(index);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the local name of a specific attribute.\r
+ *\r
+ * @param index The index of the attribute (zero-based).\r
+ * @param localName The attribute's local name, or the empty\r
+ * string for none.\r
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the\r
+ * supplied index does not point to an attribute\r
+ * in the list.\r
+ */\r
+ public void setLocalName (int index, String localName)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ data[index*5+1] = localName;\r
+ } else {\r
+ badIndex(index);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the qualified name of a specific attribute.\r
+ *\r
+ * @param index The index of the attribute (zero-based).\r
+ * @param qName The attribute's qualified name, or the empty\r
+ * string for none.\r
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the\r
+ * supplied index does not point to an attribute\r
+ * in the list.\r
+ */\r
+ public void setQName (int index, String qName)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ data[index*5+2] = qName;\r
+ } else {\r
+ badIndex(index);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the type of a specific attribute.\r
+ *\r
+ * @param index The index of the attribute (zero-based).\r
+ * @param type The attribute's type.\r
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the\r
+ * supplied index does not point to an attribute\r
+ * in the list.\r
+ */\r
+ public void setType (int index, String type)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ data[index*5+3] = type;\r
+ } else {\r
+ badIndex(index);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the value of a specific attribute.\r
+ *\r
+ * @param index The index of the attribute (zero-based).\r
+ * @param value The attribute's value.\r
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the\r
+ * supplied index does not point to an attribute\r
+ * in the list.\r
+ */\r
+ public void setValue (int index, String value)\r
+ {\r
+ if (index >= 0 && index < length) {\r
+ data[index*5+4] = value;\r
+ } else {\r
+ badIndex(index);\r
+ }\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal methods.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Ensure the internal array's capacity.\r
+ *\r
+ * @param n The minimum number of attributes that the array must\r
+ * be able to hold.\r
+ */\r
+ private void ensureCapacity (int n)\r
+ {\r
+ if (n > 0 && data == null) {\r
+ data = new String[25];\r
+ }\r
+\r
+ int max = data.length;\r
+ if (max >= n * 5) {\r
+ return;\r
+ }\r
+\r
+\r
+ while (max < n * 5) {\r
+ max *= 2;\r
+ }\r
+ String newData[] = new String[max];\r
+ System.arraycopy(data, 0, newData, 0, length*5);\r
+ data = newData;\r
+ }\r
+\r
+\r
+ /**\r
+ * Report a bad array index in a manipulator.\r
+ *\r
+ * @param index The index to report.\r
+ * @exception java.lang.ArrayIndexOutOfBoundsException Always.\r
+ */\r
+ private void badIndex (int index)\r
+ throws ArrayIndexOutOfBoundsException\r
+ {\r
+ String msg =\r
+ "Attempt to modify attribute at illegal index: " + index;\r
+ throw new ArrayIndexOutOfBoundsException(msg);\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+ int length;\r
+ String data [];\r
+\r
+}\r
+\r
+// end of AttributesImpl.java\r
+\r
--- /dev/null
+// DefaultHandler.java - default implementation of the core handlers.\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the public domain.\r
+\r
+// $Id: DefaultHandler.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
+\r
+package org.xml.sax.helpers;\r
+\r
+import org.xml.sax.InputSource;\r
+import org.xml.sax.Locator;\r
+import org.xml.sax.Attributes;\r
+import org.xml.sax.EntityResolver;\r
+import org.xml.sax.DTDHandler;\r
+import org.xml.sax.ContentHandler;\r
+import org.xml.sax.ErrorHandler;\r
+import org.xml.sax.SAXException;\r
+import org.xml.sax.SAXParseException;\r
+\r
+\r
+/**\r
+ * Default base class for SAX2 event handlers.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class is available as a convenience base class for SAX2\r
+ * applications: it provides default implementations for all of the\r
+ * callbacks in the four core SAX2 handler classes:</p>\r
+ *\r
+ * <ul>\r
+ * <li>{@link org.xml.sax.EntityResolver EntityResolver}</li>\r
+ * <li>{@link org.xml.sax.DTDHandler DTDHandler}</li>\r
+ * <li>{@link org.xml.sax.ContentHandler ContentHandler}</li>\r
+ * <li>{@link org.xml.sax.ErrorHandler ErrorHandler}</li>\r
+ * </ul>\r
+ *\r
+ * <p>Application writers can extend this class when they need to\r
+ * implement only part of an interface; parser writers can\r
+ * instantiate this class to provide default handlers when the\r
+ * application has not supplied its own.</p>\r
+ *\r
+ * <p>This class replaces the deprecated SAX1\r
+ * {@link org.xml.sax.HandlerBase HandlerBase} class.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.EntityResolver\r
+ * @see org.xml.sax.DTDHandler\r
+ * @see org.xml.sax.ContentHandler\r
+ * @see org.xml.sax.ErrorHandler\r
+ */\r
+public class DefaultHandler\r
+ implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler\r
+{\r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Default implementation of the EntityResolver interface.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ /**\r
+ * Resolve an external entity.\r
+ *\r
+ * <p>Always return null, so that the parser will use the system\r
+ * identifier provided in the XML document. This method implements\r
+ * the SAX default behaviour: application writers can override it\r
+ * in a subclass to do special translations such as catalog lookups\r
+ * or URI redirection.</p>\r
+ *\r
+ * @param publicId The public identifer, or null if none is\r
+ * available.\r
+ * @param systemId The system identifier provided in the XML \r
+ * document.\r
+ * @return The new input source, or null to require the\r
+ * default behaviour.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.EntityResolver#resolveEntity\r
+ */\r
+ public InputSource resolveEntity (String publicId, String systemId)\r
+ throws SAXException\r
+ {\r
+ return null;\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Default implementation of DTDHandler interface.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a notation declaration.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass if they wish to keep track of the notations\r
+ * declared in a document.</p>\r
+ *\r
+ * @param name The notation name.\r
+ * @param publicId The notation public identifier, or null if not\r
+ * available.\r
+ * @param systemId The notation system identifier.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.DTDHandler#notationDecl\r
+ */\r
+ public void notationDecl (String name, String publicId, String systemId)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of an unparsed entity declaration.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to keep track of the unparsed entities\r
+ * declared in a document.</p>\r
+ *\r
+ * @param name The entity name.\r
+ * @param publicId The entity public identifier, or null if not\r
+ * available.\r
+ * @param systemId The entity system identifier.\r
+ * @param notationName The name of the associated notation.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl\r
+ */\r
+ public void unparsedEntityDecl (String name, String publicId,\r
+ String systemId, String notationName)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Default implementation of ContentHandler interface.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Receive a Locator object for document events.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass if they wish to store the locator for use\r
+ * with other document events.</p>\r
+ *\r
+ * @param locator A locator for all SAX document events.\r
+ * @see org.xml.sax.ContentHandler#setDocumentLocator\r
+ * @see org.xml.sax.Locator\r
+ */\r
+ public void setDocumentLocator (Locator locator)\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the beginning of the document.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions at the beginning\r
+ * of a document (such as allocating the root node of a tree or\r
+ * creating an output file).</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ContentHandler#startDocument\r
+ */\r
+ public void startDocument ()\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the end of the document.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions at the end\r
+ * of a document (such as finalising a tree or closing an output\r
+ * file).</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ContentHandler#endDocument\r
+ */\r
+ public void endDocument ()\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+\r
+\r
+ /**\r
+ * Receive notification of the start of a Namespace mapping.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions at the start of\r
+ * each Namespace prefix scope (such as storing the prefix mapping).</p>\r
+ *\r
+ * @param prefix The Namespace prefix being declared.\r
+ * @param uri The Namespace URI mapped to the prefix.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ContentHandler#startPrefixMapping\r
+ */\r
+ public void startPrefixMapping (String prefix, String uri)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+\r
+\r
+ /**\r
+ * Receive notification of the end of a Namespace mapping.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions at the end of\r
+ * each prefix mapping.</p>\r
+ *\r
+ * @param prefix The Namespace prefix being declared.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ContentHandler#endPrefixMapping\r
+ */\r
+ public void endPrefixMapping (String prefix)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the start of an element.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions at the start of\r
+ * each element (such as allocating a new tree node or writing\r
+ * output to a file).</p>\r
+ *\r
+ * @param name The element type name.\r
+ * @param attributes The specified or defaulted attributes.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ContentHandler#startElement\r
+ */\r
+ public void startElement (String uri, String localName,\r
+ String qName, Attributes attributes)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of the end of an element.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions at the end of\r
+ * each element (such as finalising a tree node or writing\r
+ * output to a file).</p>\r
+ *\r
+ * @param name The element type name.\r
+ * @param attributes The specified or defaulted attributes.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ContentHandler#endElement\r
+ */\r
+ public void endElement (String uri, String localName, String qName)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of character data inside an element.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method to take specific actions for each chunk of character data\r
+ * (such as adding the data to a node or buffer, or printing it to\r
+ * a file).</p>\r
+ *\r
+ * @param ch The characters.\r
+ * @param start The start position in the character array.\r
+ * @param length The number of characters to use from the\r
+ * character array.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ContentHandler#characters\r
+ */\r
+ public void characters (char ch[], int start, int length)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of ignorable whitespace in element content.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method to take specific actions for each chunk of ignorable\r
+ * whitespace (such as adding data to a node or buffer, or printing\r
+ * it to a file).</p>\r
+ *\r
+ * @param ch The whitespace characters.\r
+ * @param start The start position in the character array.\r
+ * @param length The number of characters to use from the\r
+ * character array.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ContentHandler#ignorableWhitespace\r
+ */\r
+ public void ignorableWhitespace (char ch[], int start, int length)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a processing instruction.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions for each\r
+ * processing instruction, such as setting status variables or\r
+ * invoking other methods.</p>\r
+ *\r
+ * @param target The processing instruction target.\r
+ * @param data The processing instruction data, or null if\r
+ * none is supplied.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ContentHandler#processingInstruction\r
+ */\r
+ public void processingInstruction (String target, String data)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+\r
+\r
+ /**\r
+ * Receive notification of a skipped entity.\r
+ *\r
+ * <p>By default, do nothing. Application writers may override this\r
+ * method in a subclass to take specific actions for each\r
+ * processing instruction, such as setting status variables or\r
+ * invoking other methods.</p>\r
+ *\r
+ * @param name The name of the skipped entity.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ContentHandler#processingInstruction\r
+ */\r
+ public void skippedEntity (String name)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Default implementation of the ErrorHandler interface.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a parser warning.\r
+ *\r
+ * <p>The default implementation does nothing. Application writers\r
+ * may override this method in a subclass to take specific actions\r
+ * for each warning, such as inserting the message in a log file or\r
+ * printing it to the console.</p>\r
+ *\r
+ * @param e The warning information encoded as an exception.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ErrorHandler#warning\r
+ * @see org.xml.sax.SAXParseException\r
+ */\r
+ public void warning (SAXParseException e)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Receive notification of a recoverable parser error.\r
+ *\r
+ * <p>The default implementation does nothing. Application writers\r
+ * may override this method in a subclass to take specific actions\r
+ * for each error, such as inserting the message in a log file or\r
+ * printing it to the console.</p>\r
+ *\r
+ * @param e The warning information encoded as an exception.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ErrorHandler#warning\r
+ * @see org.xml.sax.SAXParseException\r
+ */\r
+ public void error (SAXParseException e)\r
+ throws SAXException\r
+ {\r
+ // no op\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Report a fatal XML parsing error.\r
+ *\r
+ * <p>The default implementation throws a SAXParseException.\r
+ * Application writers may override this method in a subclass if\r
+ * they need to take specific actions for each fatal error (such as\r
+ * collecting all of the errors into a single report): in any case,\r
+ * the application must stop all regular processing when this\r
+ * method is invoked, since the document is no longer reliable, and\r
+ * the parser may no longer report parsing events.</p>\r
+ *\r
+ * @param e The error information encoded as an exception.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @see org.xml.sax.ErrorHandler#fatalError\r
+ * @see org.xml.sax.SAXParseException\r
+ */\r
+ public void fatalError (SAXParseException e)\r
+ throws SAXException\r
+ {\r
+ throw e;\r
+ }\r
+ \r
+}\r
+\r
+// end of DefaultHandler.java\r
--- /dev/null
+// SAX default implementation for Locator.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: LocatorImpl.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
+\r
+package org.xml.sax.helpers;\r
+\r
+import org.xml.sax.Locator;\r
+\r
+\r
+/**\r
+ * Provide an optional convenience implementation of Locator.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class is available mainly for application writers, who\r
+ * can use it to make a persistent snapshot of a locator at any\r
+ * point during a document parse:</p>\r
+ *\r
+ * <pre>\r
+ * Locator locator;\r
+ * Locator startloc;\r
+ *\r
+ * public void setLocator (Locator locator)\r
+ * {\r
+ * // note the locator\r
+ * this.locator = locator;\r
+ * }\r
+ *\r
+ * public void startDocument ()\r
+ * {\r
+ * // save the location of the start of the document\r
+ * // for future use.\r
+ * Locator startloc = new LocatorImpl(locator);\r
+ * }\r
+ *</pre>\r
+ *\r
+ * <p>Normally, parser writers will not use this class, since it\r
+ * is more efficient to provide location information only when\r
+ * requested, rather than constantly updating a Locator object.</p>\r
+ *\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.Locator Locator\r
+ */\r
+public class LocatorImpl implements Locator\r
+{\r
+ \r
+ \r
+ /**\r
+ * Zero-argument constructor.\r
+ *\r
+ * <p>This will not normally be useful, since the main purpose\r
+ * of this class is to make a snapshot of an existing Locator.</p>\r
+ */\r
+ public LocatorImpl ()\r
+ {\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Copy constructor.\r
+ *\r
+ * <p>Create a persistent copy of the current state of a locator.\r
+ * When the original locator changes, this copy will still keep\r
+ * the original values (and it can be used outside the scope of\r
+ * DocumentHandler methods).</p>\r
+ *\r
+ * @param locator The locator to copy.\r
+ */\r
+ public LocatorImpl (Locator locator)\r
+ {\r
+ setPublicId(locator.getPublicId());\r
+ setSystemId(locator.getSystemId());\r
+ setLineNumber(locator.getLineNumber());\r
+ setColumnNumber(locator.getColumnNumber());\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.Locator\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Return the saved public identifier.\r
+ *\r
+ * @return The public identifier as a string, or null if none\r
+ * is available.\r
+ * @see org.xml.sax.Locator#getPublicId\r
+ * @see #setPublicId\r
+ */\r
+ public String getPublicId ()\r
+ {\r
+ return publicId;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Return the saved system identifier.\r
+ *\r
+ * @return The system identifier as a string, or null if none\r
+ * is available.\r
+ * @see org.xml.sax.Locator#getSystemId\r
+ * @see #setSystemId\r
+ */\r
+ public String getSystemId ()\r
+ {\r
+ return systemId;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Return the saved line number (1-based).\r
+ *\r
+ * @return The line number as an integer, or -1 if none is available.\r
+ * @see org.xml.sax.Locator#getLineNumber\r
+ * @see #setLineNumber\r
+ */\r
+ public int getLineNumber ()\r
+ {\r
+ return lineNumber;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Return the saved column number (1-based).\r
+ *\r
+ * @return The column number as an integer, or -1 if none is available.\r
+ * @see org.xml.sax.Locator#getColumnNumber\r
+ * @see #setColumnNumber\r
+ */\r
+ public int getColumnNumber ()\r
+ {\r
+ return columnNumber;\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Setters for the properties (not in org.xml.sax.Locator)\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ \r
+ /**\r
+ * Set the public identifier for this locator.\r
+ *\r
+ * @param publicId The new public identifier, or null \r
+ * if none is available.\r
+ * @see #getPublicId\r
+ */\r
+ public void setPublicId (String publicId)\r
+ {\r
+ this.publicId = publicId;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Set the system identifier for this locator.\r
+ *\r
+ * @param systemId The new system identifier, or null \r
+ * if none is available.\r
+ * @see #getSystemId\r
+ */\r
+ public void setSystemId (String systemId)\r
+ {\r
+ this.systemId = systemId;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Set the line number for this locator (1-based).\r
+ *\r
+ * @param lineNumber The line number, or -1 if none is available.\r
+ * @see #getLineNumber\r
+ */\r
+ public void setLineNumber (int lineNumber)\r
+ {\r
+ this.lineNumber = lineNumber;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Set the column number for this locator (1-based).\r
+ *\r
+ * @param columnNumber The column number, or -1 if none is available.\r
+ * @see #getColumnNumber\r
+ */\r
+ public void setColumnNumber (int columnNumber)\r
+ {\r
+ this.columnNumber = columnNumber;\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ ////////////////////////////////////////////////////////////////////\r
+ \r
+ private String publicId;\r
+ private String systemId;\r
+ private int lineNumber;\r
+ private int columnNumber;\r
+ \r
+}\r
+\r
+// end of LocatorImpl.java\r
--- /dev/null
+// NamespaceSupport.java - generic Namespace support for SAX.\r
+// Written by David Megginson, sax@megginson.com\r
+// This class is in the Public Domain. NO WARRANTY!\r
+\r
+// $Id: NamespaceSupport.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
+\r
+package org.xml.sax.helpers;\r
+\r
+import java.util.EmptyStackException;\r
+import java.util.Enumeration;\r
+import java.util.Hashtable;\r
+import java.util.Vector;\r
+\r
+\r
+/**\r
+ * Encapsulate Namespace logic for use by SAX drivers.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class encapsulates the logic of Namespace processing:\r
+ * it tracks the declarations currently in force for each context\r
+ * and automatically processes qualified XML 1.0 names into their\r
+ * Namespace parts; it can also be used in reverse for generating\r
+ * XML 1.0 from Namespaces.</p>\r
+ *\r
+ * <p>Namespace support objects are reusable, but the reset method\r
+ * must be invoked between each session.</p>\r
+ *\r
+ * <p>Here is a simple session:</p>\r
+ *\r
+ * <pre>\r
+ * String parts[] = new String[3];\r
+ * NamespaceSupport support = new NamespaceSupport();\r
+ *\r
+ * support.pushContext();\r
+ * support.declarePrefix("", "http://www.w3.org/1999/xhtml");\r
+ * support.declarePrefix("dc", "http://www.purl.org/dc#");\r
+ *\r
+ * String parts[] = support.processName("p", parts, false);\r
+ * System.out.println("Namespace URI: " + parts[0]);\r
+ * System.out.println("Local name: " + parts[1]);\r
+ * System.out.println("Raw name: " + parts[2]);\r
+\r
+ * String parts[] = support.processName("dc:title", parts, false);\r
+ * System.out.println("Namespace URI: " + parts[0]);\r
+ * System.out.println("Local name: " + parts[1]);\r
+ * System.out.println("Raw name: " + parts[2]);\r
+\r
+ * support.popContext();\r
+ * </pre>\r
+ *\r
+ * <p>Note that this class is optimized for the use case where most\r
+ * elements do not contain Namespace declarations: if the same\r
+ * prefix/URI mapping is repeated for each context (for example), this\r
+ * class will be somewhat less efficient.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ */\r
+public class NamespaceSupport\r
+{\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Constants.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * The XML Namespace as a constant.\r
+ *\r
+ * <p>This is the Namespace URI that is automatically mapped\r
+ * to the "xml" prefix.</p>\r
+ */\r
+ public final static String XMLNS =\r
+ "http://www.w3.org/XML/1998/namespace";\r
+\r
+\r
+ /**\r
+ * An empty enumeration.\r
+ */\r
+ private final static Enumeration EMPTY_ENUMERATION =\r
+ new Vector().elements();\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Constructor.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Create a new Namespace support object.\r
+ */\r
+ public NamespaceSupport ()\r
+ {\r
+ reset();\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Context management.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Reset this Namespace support object for reuse.\r
+ *\r
+ * <p>It is necessary to invoke this method before reusing the\r
+ * Namespace support object for a new session.</p>\r
+ */\r
+ public void reset ()\r
+ {\r
+ contexts = new Context[32];\r
+ contextPos = 0;\r
+ contexts[contextPos] = currentContext = new Context();\r
+ currentContext.declarePrefix("xml", XMLNS);\r
+ }\r
+\r
+\r
+ /**\r
+ * Start a new Namespace context.\r
+ *\r
+ * <p>Normally, you should push a new context at the beginning\r
+ * of each XML element: the new context will automatically inherit\r
+ * the declarations of its parent context, but it will also keep\r
+ * track of which declarations were made within this context.</p>\r
+ *\r
+ * <p>The Namespace support object always starts with a base context\r
+ * already in force: in this context, only the "xml" prefix is\r
+ * declared.</p>\r
+ *\r
+ * @see #popContext\r
+ */\r
+ public void pushContext ()\r
+ {\r
+ int max = contexts.length;\r
+ contextPos++;\r
+\r
+ // Extend the array if necessary\r
+ if (contextPos >= max) {\r
+ Context newContexts[] = new Context[max*2];\r
+ System.arraycopy(contexts, 0, newContexts, 0, max);\r
+ max *= 2;\r
+ contexts = newContexts;\r
+ }\r
+\r
+ // Allocate the context if necessary.\r
+ currentContext = contexts[contextPos];\r
+ if (currentContext == null) {\r
+ contexts[contextPos] = currentContext = new Context();\r
+ }\r
+\r
+ // Set the parent, if any.\r
+ if (contextPos > 0) {\r
+ currentContext.setParent(contexts[contextPos - 1]);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Revert to the previous Namespace context.\r
+ *\r
+ * <p>Normally, you should pop the context at the end of each\r
+ * XML element. After popping the context, all Namespace prefix\r
+ * mappings that were previously in force are restored.</p>\r
+ *\r
+ * <p>You must not attempt to declare additional Namespace\r
+ * prefixes after popping a context, unless you push another\r
+ * context first.</p>\r
+ *\r
+ * @see #pushContext\r
+ */\r
+ public void popContext ()\r
+ {\r
+ contextPos--;\r
+ if (contextPos < 0) {\r
+ throw new EmptyStackException();\r
+ }\r
+ currentContext = contexts[contextPos];\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Operations within a context.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Declare a Namespace prefix.\r
+ *\r
+ * <p>This method declares a prefix in the current Namespace\r
+ * context; the prefix will remain in force until this context\r
+ * is popped, unless it is shadowed in a descendant context.</p>\r
+ *\r
+ * <p>To declare a default Namespace, use the empty string. The\r
+ * prefix must not be "xml" or "xmlns".</p>\r
+ *\r
+ * <p>Note that you must <em>not</em> declare a prefix after\r
+ * you've pushed and popped another Namespace.</p>\r
+ *\r
+ * <p>Note that there is an asymmetry in this library: while {@link\r
+ * #getPrefix getPrefix} will not return the default "" prefix,\r
+ * even if you have declared one; to check for a default prefix,\r
+ * you have to look it up explicitly using {@link #getURI getURI}.\r
+ * This asymmetry exists to make it easier to look up prefixes\r
+ * for attribute names, where the default prefix is not allowed.</p>\r
+ *\r
+ * @param prefix The prefix to declare, or null for the empty\r
+ * string.\r
+ * @param uri The Namespace URI to associate with the prefix.\r
+ * @return true if the prefix was legal, false otherwise\r
+ * @see #processName\r
+ * @see #getURI\r
+ * @see #getPrefix\r
+ */\r
+ public boolean declarePrefix (String prefix, String uri)\r
+ {\r
+ if (prefix.equals("xml") || prefix.equals("xmlns")) {\r
+ return false;\r
+ } else {\r
+ currentContext.declarePrefix(prefix, uri);\r
+ return true;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Process a raw XML 1.0 name.\r
+ *\r
+ * <p>This method processes a raw XML 1.0 name in the current\r
+ * context by removing the prefix and looking it up among the\r
+ * prefixes currently declared. The return value will be the\r
+ * array supplied by the caller, filled in as follows:</p>\r
+ *\r
+ * <dl>\r
+ * <dt>parts[0]</dt>\r
+ * <dd>The Namespace URI, or an empty string if none is\r
+ * in use.</dd>\r
+ * <dt>parts[1]</dt>\r
+ * <dd>The local name (without prefix).</dd>\r
+ * <dt>parts[2]</dt>\r
+ * <dd>The original raw name.</dd>\r
+ * </dl>\r
+ *\r
+ * <p>All of the strings in the array will be internalized. If\r
+ * the raw name has a prefix that has not been declared, then\r
+ * the return value will be null.</p>\r
+ *\r
+ * <p>Note that attribute names are processed differently than\r
+ * element names: an unprefixed element name will received the\r
+ * default Namespace (if any), while an unprefixed element name\r
+ * will not.</p>\r
+ *\r
+ * @param qName The raw XML 1.0 name to be processed.\r
+ * @param parts An array supplied by the caller, capable of\r
+ * holding at least three members.\r
+ * @param isAttribute A flag indicating whether this is an\r
+ * attribute name (true) or an element name (false).\r
+ * @return The supplied array holding three internalized strings \r
+ * representing the Namespace URI (or empty string), the\r
+ * local name, and the raw XML 1.0 name; or null if there\r
+ * is an undeclared prefix.\r
+ * @see #declarePrefix\r
+ * @see java.lang.String#intern */\r
+ public String [] processName (String qName, String parts[],\r
+ boolean isAttribute)\r
+ {\r
+ String myParts[] = currentContext.processName(qName, isAttribute);\r
+ if (myParts == null) {\r
+ return null;\r
+ } else {\r
+ parts[0] = myParts[0];\r
+ parts[1] = myParts[1];\r
+ parts[2] = myParts[2];\r
+ return parts;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up a prefix and get the currently-mapped Namespace URI.\r
+ *\r
+ * <p>This method looks up the prefix in the current context.\r
+ * Use the empty string ("") for the default Namespace.</p>\r
+ *\r
+ * @param prefix The prefix to look up.\r
+ * @return The associated Namespace URI, or null if the prefix\r
+ * is undeclared in this context.\r
+ * @see #getPrefix\r
+ * @see #getPrefixes\r
+ */\r
+ public String getURI (String prefix)\r
+ {\r
+ return currentContext.getURI(prefix);\r
+ }\r
+\r
+\r
+ /**\r
+ * Return an enumeration of all prefixes currently declared.\r
+ *\r
+ * <p><strong>Note:</strong> if there is a default prefix, it will not be\r
+ * returned in this enumeration; check for the default prefix\r
+ * using the {@link #getURI getURI} with an argument of "".</p>\r
+ *\r
+ * @return An enumeration of all prefixes declared in the\r
+ * current context except for the empty (default)\r
+ * prefix.\r
+ * @see #getDeclaredPrefixes\r
+ * @see #getURI\r
+ */\r
+ public Enumeration getPrefixes ()\r
+ {\r
+ return currentContext.getPrefixes();\r
+ }\r
+\r
+\r
+ /**\r
+ * Return one of the prefixes mapped to a Namespace URI.\r
+ *\r
+ * <p>If more than one prefix is currently mapped to the same\r
+ * URI, this method will make an arbitrary selection; if you\r
+ * want all of the prefixes, use the {@link #getPrefixes}\r
+ * method instead.</p>\r
+ *\r
+ * <p><strong>Note:</strong> this will never return the empty (default) prefix;\r
+ * to check for a default prefix, use the {@link #getURI getURI}\r
+ * method with an argument of "".</p>\r
+ *\r
+ * @param uri The Namespace URI.\r
+ * @param isAttribute true if this prefix is for an attribute\r
+ * (and the default Namespace is not allowed).\r
+ * @return One of the prefixes currently mapped to the URI supplied,\r
+ * or null if none is mapped or if the URI is assigned to\r
+ * the default Namespace.\r
+ * @see #getPrefixes(java.lang.String)\r
+ * @see #getURI\r
+ */\r
+ public String getPrefix (String uri)\r
+ {\r
+ return currentContext.getPrefix(uri);\r
+ }\r
+\r
+\r
+ /**\r
+ * Return an enumeration of all prefixes currently declared for a URI.\r
+ *\r
+ * <p>This method returns prefixes mapped to a specific Namespace\r
+ * URI. The xml: prefix will be included. If you want only one\r
+ * prefix that's mapped to the Namespace URI, and you don't care \r
+ * which one you get, use the {@link #getPrefix getPrefix}\r
+ * method instead.</p>\r
+ *\r
+ * <p><strong>Note:</strong> the empty (default) prefix is <em>never</em> included\r
+ * in this enumeration; to check for the presence of a default\r
+ * Namespace, use the {@link #getURI getURI} method with an\r
+ * argument of "".</p>\r
+ *\r
+ * @param uri The Namespace URI.\r
+ * @return An enumeration of all prefixes declared in the\r
+ * current context.\r
+ * @see #getPrefix\r
+ * @see #getDeclaredPrefixes\r
+ * @see #getURI\r
+ */\r
+ public Enumeration getPrefixes (String uri)\r
+ {\r
+ Vector prefixes = new Vector();\r
+ Enumeration allPrefixes = getPrefixes();\r
+ while (allPrefixes.hasMoreElements()) {\r
+ String prefix = (String)allPrefixes.nextElement();\r
+ if (uri.equals(getURI(prefix))) {\r
+ prefixes.addElement(prefix);\r
+ }\r
+ }\r
+ return prefixes.elements();\r
+ }\r
+\r
+\r
+ /**\r
+ * Return an enumeration of all prefixes declared in this context.\r
+ *\r
+ * <p>The empty (default) prefix will be included in this \r
+ * enumeration; note that this behaviour differs from that of\r
+ * {@link #getPrefix} and {@link #getPrefixes}.</p>\r
+ *\r
+ * @return An enumeration of all prefixes declared in this\r
+ * context.\r
+ * @see #getPrefixes\r
+ * @see #getURI\r
+ */\r
+ public Enumeration getDeclaredPrefixes ()\r
+ {\r
+ return currentContext.getDeclaredPrefixes();\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+ private Context contexts[];\r
+ private Context currentContext;\r
+ private int contextPos;\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal classes.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+ /**\r
+ * Internal class for a single Namespace context.\r
+ *\r
+ * <p>This module caches and reuses Namespace contexts, so the number allocated\r
+ * will be equal to the element depth of the document, not to the total\r
+ * number of elements (i.e. 5-10 rather than tens of thousands).</p>\r
+ */\r
+ final class Context {\r
+\r
+ /**\r
+ * Create the root-level Namespace context.\r
+ */\r
+ Context ()\r
+ {\r
+ copyTables();\r
+ }\r
+ \r
+ \r
+ /**\r
+ * (Re)set the parent of this Namespace context.\r
+ *\r
+ * @param context The parent Namespace context object.\r
+ */\r
+ void setParent (Context parent)\r
+ {\r
+ this.parent = parent;\r
+ declarations = null;\r
+ prefixTable = parent.prefixTable;\r
+ uriTable = parent.uriTable;\r
+ elementNameTable = parent.elementNameTable;\r
+ attributeNameTable = parent.attributeNameTable;\r
+ defaultNS = parent.defaultNS;\r
+ tablesDirty = false;\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Declare a Namespace prefix for this context.\r
+ *\r
+ * @param prefix The prefix to declare.\r
+ * @param uri The associated Namespace URI.\r
+ * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix\r
+ */\r
+ void declarePrefix (String prefix, String uri)\r
+ {\r
+ // Lazy processing...\r
+ if (!tablesDirty) {\r
+ copyTables();\r
+ }\r
+ if (declarations == null) {\r
+ declarations = new Vector();\r
+ }\r
+ \r
+ prefix = prefix.intern();\r
+ uri = uri.intern();\r
+ if ("".equals(prefix)) {\r
+ if ("".equals(uri)) {\r
+ defaultNS = null;\r
+ } else {\r
+ defaultNS = uri;\r
+ }\r
+ } else {\r
+ prefixTable.put(prefix, uri);\r
+ uriTable.put(uri, prefix); // may wipe out another prefix\r
+ }\r
+ declarations.addElement(prefix);\r
+ }\r
+\r
+\r
+ /**\r
+ * Process a raw XML 1.0 name in this context.\r
+ *\r
+ * @param qName The raw XML 1.0 name.\r
+ * @param isAttribute true if this is an attribute name.\r
+ * @return An array of three strings containing the\r
+ * URI part (or empty string), the local part,\r
+ * and the raw name, all internalized, or null\r
+ * if there is an undeclared prefix.\r
+ * @see org.xml.sax.helpers.NamespaceSupport#processName\r
+ */\r
+ String [] processName (String qName, boolean isAttribute)\r
+ {\r
+ String name[];\r
+ Hashtable table;\r
+ \r
+ // Select the appropriate table.\r
+ if (isAttribute) {\r
+ table = elementNameTable;\r
+ } else {\r
+ table = attributeNameTable;\r
+ }\r
+ \r
+ // Start by looking in the cache, and\r
+ // return immediately if the name\r
+ // is already known in this content\r
+ name = (String[])table.get(qName);\r
+ if (name != null) {\r
+ return name;\r
+ }\r
+ \r
+ // We haven't seen this name in this\r
+ // context before.\r
+ name = new String[3];\r
+ int index = qName.indexOf(':');\r
+ \r
+ \r
+ // No prefix.\r
+ if (index == -1) {\r
+ if (isAttribute || defaultNS == null) {\r
+ name[0] = "";\r
+ } else {\r
+ name[0] = defaultNS;\r
+ }\r
+ name[1] = qName.intern();\r
+ name[2] = name[1];\r
+ }\r
+ \r
+ // Prefix\r
+ else {\r
+ String prefix = qName.substring(0, index);\r
+ String local = qName.substring(index+1);\r
+ String uri;\r
+ if ("".equals(prefix)) {\r
+ uri = defaultNS;\r
+ } else {\r
+ uri = (String)prefixTable.get(prefix);\r
+ }\r
+ if (uri == null) {\r
+ return null;\r
+ }\r
+ name[0] = uri;\r
+ name[1] = local.intern();\r
+ name[2] = qName.intern();\r
+ }\r
+ \r
+ // Save in the cache for future use.\r
+ table.put(name[2], name);\r
+ tablesDirty = true;\r
+ return name;\r
+ }\r
+ \r
+\r
+ /**\r
+ * Look up the URI associated with a prefix in this context.\r
+ *\r
+ * @param prefix The prefix to look up.\r
+ * @return The associated Namespace URI, or null if none is\r
+ * declared. \r
+ * @see org.xml.sax.helpers.NamespaceSupport#getURI\r
+ */\r
+ String getURI (String prefix)\r
+ {\r
+ if ("".equals(prefix)) {\r
+ return defaultNS;\r
+ } else if (prefixTable == null) {\r
+ return null;\r
+ } else {\r
+ return (String)prefixTable.get(prefix);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up one of the prefixes associated with a URI in this context.\r
+ *\r
+ * <p>Since many prefixes may be mapped to the same URI,\r
+ * the return value may be unreliable.</p>\r
+ *\r
+ * @param uri The URI to look up.\r
+ * @return The associated prefix, or null if none is declared.\r
+ * @see org.xml.sax.helpers.NamespaceSupport#getPrefix\r
+ */\r
+ String getPrefix (String uri)\r
+ {\r
+ if (uriTable == null) {\r
+ return null;\r
+ } else {\r
+ return (String)uriTable.get(uri);\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Return an enumeration of prefixes declared in this context.\r
+ *\r
+ * @return An enumeration of prefixes (possibly empty).\r
+ * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes\r
+ */\r
+ Enumeration getDeclaredPrefixes ()\r
+ {\r
+ if (declarations == null) {\r
+ return EMPTY_ENUMERATION;\r
+ } else {\r
+ return declarations.elements();\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Return an enumeration of all prefixes currently in force.\r
+ *\r
+ * <p>The default prefix, if in force, is <em>not</em>\r
+ * returned, and will have to be checked for separately.</p>\r
+ *\r
+ * @return An enumeration of prefixes (never empty).\r
+ * @see org.xml.sax.helpers.NamespaceSupport#getPrefixes\r
+ */\r
+ Enumeration getPrefixes ()\r
+ {\r
+ if (prefixTable == null) {\r
+ return EMPTY_ENUMERATION;\r
+ } else {\r
+ return prefixTable.keys();\r
+ }\r
+ }\r
+ \r
+ \r
+\f\r
+ ////////////////////////////////////////////////////////////////\r
+ // Internal methods.\r
+ ////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Copy on write for the internal tables in this context.\r
+ *\r
+ * <p>This class is optimized for the normal case where most\r
+ * elements do not contain Namespace declarations.</p>\r
+ */ \r
+ private void copyTables ()\r
+ {\r
+ if (prefixTable != null) {\r
+ prefixTable = (Hashtable)prefixTable.clone();\r
+ } else {\r
+ prefixTable = new Hashtable();\r
+ }\r
+ if (uriTable != null) {\r
+ uriTable = (Hashtable)uriTable.clone();\r
+ } else {\r
+ uriTable = new Hashtable();\r
+ }\r
+ elementNameTable = new Hashtable();\r
+ attributeNameTable = new Hashtable();\r
+ tablesDirty = true;\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////\r
+ // Protected state.\r
+ ////////////////////////////////////////////////////////////////\r
+ \r
+ Hashtable prefixTable;\r
+ Hashtable uriTable;\r
+ Hashtable elementNameTable;\r
+ Hashtable attributeNameTable;\r
+ String defaultNS = null;\r
+ \r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ ////////////////////////////////////////////////////////////////\r
+ \r
+ private Vector declarations = null;\r
+ private boolean tablesDirty = false;\r
+ private Context parent = null;\r
+ }\r
+}\r
+\r
+// end of NamespaceSupport.java\r
--- /dev/null
+// ParserAdapter.java - adapt a SAX1 Parser to a SAX2 XMLReader.\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the public domain.\r
+\r
+// $Id: ParserAdapter.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
+\r
+package org.xml.sax.helpers;\r
+\r
+import java.io.IOException;\r
+import java.util.Enumeration;\r
+\r
+import org.xml.sax.Parser; // deprecated\r
+import org.xml.sax.InputSource;\r
+import org.xml.sax.Locator;\r
+import org.xml.sax.AttributeList; // deprecated\r
+import org.xml.sax.EntityResolver;\r
+import org.xml.sax.DTDHandler;\r
+import org.xml.sax.DocumentHandler; // deprecated\r
+import org.xml.sax.ErrorHandler;\r
+import org.xml.sax.SAXException;\r
+import org.xml.sax.SAXParseException;\r
+\r
+import org.xml.sax.XMLReader;\r
+import org.xml.sax.Attributes;\r
+import org.xml.sax.ContentHandler;\r
+import org.xml.sax.SAXNotRecognizedException;\r
+import org.xml.sax.SAXNotSupportedException;\r
+\r
+\r
+/**\r
+ * Adapt a SAX1 Parser as a SAX2 XMLReader.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class wraps a SAX1 {@link org.xml.sax.Parser Parser}\r
+ * and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader},\r
+ * with feature, property, and Namespace support. Note\r
+ * that it is not possible to report {@link org.xml.sax.ContentHandler#skippedEntity\r
+ * skippedEntity} events, since SAX1 does not make that information available.</p>\r
+ *\r
+ * <p>This adapter does not test for duplicate Namespace-qualified\r
+ * attribute names.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.helpers.XMLReaderAdapter\r
+ * @see org.xml.sax.XMLReader\r
+ * @see org.xml.sax.Parser\r
+ */\r
+public class ParserAdapter implements XMLReader, DocumentHandler\r
+{\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Constructors.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Construct a new parser adapter.\r
+ *\r
+ * <p>Use the "org.xml.sax.parser" property to locate the\r
+ * embedded SAX1 driver.</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException If the embedded driver\r
+ * cannot be instantiated or if the\r
+ * org.xml.sax.parser property is not specified.\r
+ */\r
+ public ParserAdapter ()\r
+ throws SAXException\r
+ {\r
+ super();\r
+\r
+ String driver = System.getProperty("org.xml.sax.parser");\r
+\r
+ try {\r
+ setup(ParserFactory.makeParser());\r
+ } catch (ClassNotFoundException e1) {\r
+ throw new\r
+ SAXException("Cannot find SAX1 driver class " +\r
+ driver, e1);\r
+ } catch (IllegalAccessException e2) {\r
+ throw new\r
+ SAXException("SAX1 driver class " +\r
+ driver +\r
+ " found but cannot be loaded", e2);\r
+ } catch (InstantiationException e3) {\r
+ throw new\r
+ SAXException("SAX1 driver class " +\r
+ driver +\r
+ " loaded but cannot be instantiated", e3);\r
+ } catch (ClassCastException e4) {\r
+ throw new\r
+ SAXException("SAX1 driver class " +\r
+ driver +\r
+ " does not implement org.xml.sax.Parser");\r
+ } catch (NullPointerException e5) {\r
+ throw new \r
+ SAXException("System property org.xml.sax.parser not specified");\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Construct a new parser adapter.\r
+ *\r
+ * <p>Note that the embedded parser cannot be changed once the\r
+ * adapter is created; to embed a different parser, allocate\r
+ * a new ParserAdapter.</p>\r
+ *\r
+ * @param parser The SAX1 parser to embed.\r
+ * @exception java.lang.NullPointerException If the parser parameter\r
+ * is null.\r
+ */\r
+ public ParserAdapter (Parser parser)\r
+ {\r
+ super();\r
+ setup(parser);\r
+ }\r
+\r
+\r
+ /**\r
+ * Internal setup method.\r
+ *\r
+ * @param parser The embedded parser.\r
+ * @exception java.lang.NullPointerException If the parser parameter\r
+ * is null.\r
+ */\r
+ private void setup (Parser parser)\r
+ {\r
+ if (parser == null) {\r
+ throw new\r
+ NullPointerException("Parser argument must not be null");\r
+ }\r
+ this.parser = parser;\r
+ atts = new AttributesImpl();\r
+ nsSupport = new NamespaceSupport();\r
+ attAdapter = new AttributeListAdapter();\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.XMLReader.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ //\r
+ // Internal constants for the sake of convenience.\r
+ //\r
+ private final static String FEATURES = "http://xml.org/sax/features/";\r
+ private final static String NAMESPACES = FEATURES + "namespaces";\r
+ private final static String NAMESPACE_PREFIXES = FEATURES + "namespace-prefixes";\r
+ private final static String VALIDATION = FEATURES + "validation";\r
+ private final static String EXTERNAL_GENERAL =\r
+ FEATURES + "external-general-entities";\r
+ private final static String EXTERNAL_PARAMETER =\r
+ FEATURES + "external-parameter-entities";\r
+\r
+\r
+ /**\r
+ * Set a feature for the parser.\r
+ *\r
+ * <p>The only features supported are namespaces and \r
+ * namespace-prefixes.</p>\r
+ *\r
+ * @param name The feature name, as a complete URI.\r
+ * @param state The requested feature state.\r
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature\r
+ * name is not known.\r
+ * @exception org.xml.sax.SAXNotSupportedException If the feature\r
+ * state is not supported.\r
+ * @see org.xml.sax.XMLReader#setFeature\r
+ */\r
+ public void setFeature (String name, boolean state)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException\r
+ {\r
+ if (name.equals(NAMESPACES)) {\r
+ checkNotParsing("feature", name);\r
+ namespaces = state;\r
+ if (!namespaces && !prefixes) {\r
+ prefixes = true;\r
+ }\r
+ } else if (name.equals(NAMESPACE_PREFIXES)) {\r
+ checkNotParsing("feature", name);\r
+ prefixes = state;\r
+ if (!prefixes && !namespaces) {\r
+ namespaces = true;\r
+ }\r
+ } else if (name.equals(VALIDATION) ||\r
+ name.equals(EXTERNAL_GENERAL) ||\r
+ name.equals(EXTERNAL_PARAMETER)) {\r
+ throw new SAXNotSupportedException("Feature: " + name);\r
+ } else {\r
+ throw new SAXNotRecognizedException("Feature: " + name);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Check a parser feature.\r
+ *\r
+ * <p>The only features supported are namespaces and \r
+ * namespace-prefixes.</p>\r
+ *\r
+ * @param name The feature name, as a complete URI.\r
+ * @return The current feature state.\r
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature\r
+ * name is not known.\r
+ * @exception org.xml.sax.SAXNotSupportedException If querying the\r
+ * feature state is not supported.\r
+ * @see org.xml.sax.XMLReader#setFeature\r
+ */\r
+ public boolean getFeature (String name)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException\r
+ {\r
+ if (name.equals(NAMESPACES)) {\r
+ return namespaces;\r
+ } else if (name.equals(NAMESPACE_PREFIXES)) {\r
+ return prefixes;\r
+ } else if (name.equals(VALIDATION) ||\r
+ name.equals(EXTERNAL_GENERAL) ||\r
+ name.equals(EXTERNAL_PARAMETER)) {\r
+ throw new SAXNotSupportedException("Feature: " + name);\r
+ } else {\r
+ throw new SAXNotRecognizedException("Feature: " + name);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Set a parser property.\r
+ *\r
+ * <p>No special properties are currently supported.</p>\r
+ *\r
+ * @param name The property name.\r
+ * @param value The property value.\r
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature\r
+ * name is not known.\r
+ * @exception org.xml.sax.SAXNotSupportedException If the feature\r
+ * state is not supported.\r
+ * @see org.xml.sax.XMLReader#setProperty\r
+ */\r
+ public void setProperty (String name, Object value)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException\r
+ {\r
+ throw new SAXNotRecognizedException("Property: " + name);\r
+ }\r
+\r
+\r
+ /**\r
+ * Get a parser property.\r
+ *\r
+ * <p>No special properties are currently supported.</p>\r
+ *\r
+ * @param name The property name.\r
+ * @return The property value.\r
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature\r
+ * name is not known.\r
+ * @exception org.xml.sax.SAXNotSupportedException If the feature\r
+ * state is not supported.\r
+ * @see org.xml.sax.XMLReader#getProperty\r
+ */\r
+ public Object getProperty (String name)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException\r
+ {\r
+ throw new SAXNotRecognizedException("Property: " + name);\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the entity resolver.\r
+ *\r
+ * @param resolver The new entity resolver.\r
+ * @exception java.lang.NullPointerException If the entity resolver\r
+ * parameter is null.\r
+ * @see org.xml.sax.XMLReader#setEntityResolver\r
+ */\r
+ public void setEntityResolver (EntityResolver resolver)\r
+ {\r
+ if (resolver == null) {\r
+ throw new NullPointerException("Null entity resolver");\r
+ }\r
+ entityResolver = resolver;\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the current entity resolver.\r
+ *\r
+ * @return The current entity resolver, or null if none was supplied.\r
+ * @see org.xml.sax.XMLReader#getEntityResolver\r
+ */\r
+ public EntityResolver getEntityResolver ()\r
+ {\r
+ return entityResolver;\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the DTD handler.\r
+ *\r
+ * @param resolver The new DTD handler.\r
+ * @exception java.lang.NullPointerException If the DTD handler\r
+ * parameter is null.\r
+ * @see org.xml.sax.XMLReader#setEntityResolver\r
+ */\r
+ public void setDTDHandler (DTDHandler handler)\r
+ {\r
+ if (handler == null) {\r
+ throw new NullPointerException("Null DTD handler");\r
+ }\r
+ dtdHandler = handler;\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the current DTD handler.\r
+ *\r
+ * @return The current DTD handler, or null if none was supplied.\r
+ * @see org.xml.sax.XMLReader#getEntityResolver\r
+ */\r
+ public DTDHandler getDTDHandler ()\r
+ {\r
+ return dtdHandler;\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the content handler.\r
+ *\r
+ * @param resolver The new content handler.\r
+ * @exception java.lang.NullPointerException If the content handler\r
+ * parameter is null.\r
+ * @see org.xml.sax.XMLReader#setEntityResolver\r
+ */\r
+ public void setContentHandler (ContentHandler handler)\r
+ {\r
+ if (handler == null) {\r
+ throw new NullPointerException("Null content handler");\r
+ }\r
+ contentHandler = handler;\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the current content handler.\r
+ *\r
+ * @return The current content handler, or null if none was supplied.\r
+ * @see org.xml.sax.XMLReader#getEntityResolver\r
+ */\r
+ public ContentHandler getContentHandler ()\r
+ {\r
+ return contentHandler;\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the error handler.\r
+ *\r
+ * @param resolver The new error handler.\r
+ * @exception java.lang.NullPointerException If the error handler\r
+ * parameter is null.\r
+ * @see org.xml.sax.XMLReader#setEntityResolver\r
+ */\r
+ public void setErrorHandler (ErrorHandler handler)\r
+ {\r
+ if (handler == null) {\r
+ throw new NullPointerException("Null error handler");\r
+ }\r
+ errorHandler = handler;\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the current error handler.\r
+ *\r
+ * @return The current error handler, or null if none was supplied.\r
+ * @see org.xml.sax.XMLReader#getEntityResolver\r
+ */\r
+ public ErrorHandler getErrorHandler ()\r
+ {\r
+ return errorHandler;\r
+ }\r
+\r
+\r
+ /**\r
+ * Parse an XML document.\r
+ *\r
+ * @param systemId The absolute URL of the document.\r
+ * @exception java.io.IOException If there is a problem reading\r
+ * the raw content of the document.\r
+ * @exception org.xml.sax.SAXException If there is a problem\r
+ * processing the document.\r
+ * @see #parse(org.xml.sax.InputSource)\r
+ * @see org.xml.sax.Parser#parse(java.lang.String)\r
+ */\r
+ public void parse (String systemId)\r
+ throws IOException, SAXException\r
+ {\r
+ parse(new InputSource(systemId));\r
+ }\r
+\r
+\r
+ /**\r
+ * Parse an XML document.\r
+ *\r
+ * @param input An input source for the document.\r
+ * @exception java.io.IOException If there is a problem reading\r
+ * the raw content of the document.\r
+ * @exception org.xml.sax.SAXException If there is a problem\r
+ * processing the document.\r
+ * @see #parse(java.lang.String)\r
+ * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource)\r
+ */\r
+ public void parse (InputSource input)\r
+ throws IOException, SAXException\r
+ {\r
+ if (parsing) {\r
+ throw new SAXException("Parser is already in use");\r
+ }\r
+ setupParser();\r
+ parsing = true;\r
+ try {\r
+ parser.parse(input);\r
+ } finally {\r
+ parsing = false;\r
+ }\r
+ parsing = false;\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.DocumentHandler.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Adapt a SAX1 document locator event.\r
+ *\r
+ * @param locator A document locator.\r
+ * @see org.xml.sax.ContentHandler#setDocumentLocator\r
+ */\r
+ public void setDocumentLocator (Locator locator)\r
+ {\r
+ this.locator = locator;\r
+ if (contentHandler != null) {\r
+ contentHandler.setDocumentLocator(locator);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX1 start document event.\r
+ *\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.DocumentHandler#startDocument\r
+ */\r
+ public void startDocument ()\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.startDocument();\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX1 end document event.\r
+ *\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.DocumentHandler#endDocument\r
+ */\r
+ public void endDocument ()\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.endDocument();\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX1 startElement event.\r
+ *\r
+ * <p>If necessary, perform Namespace processing.</p>\r
+ *\r
+ * @param qName The qualified (prefixed) name.\r
+ * @param qAtts The XML 1.0 attribute list (with qnames).\r
+ */\r
+ public void startElement (String qName, AttributeList qAtts)\r
+ throws SAXException\r
+ {\r
+ // If we're not doing Namespace\r
+ // processing, dispatch this quickly.\r
+ if (!namespaces) {\r
+ if (contentHandler != null) {\r
+ attAdapter.setAttributeList(qAtts);\r
+ contentHandler.startElement("", "", qName.intern(),\r
+ attAdapter);\r
+ }\r
+ return;\r
+ }\r
+\r
+\r
+ // OK, we're doing Namespace processing.\r
+ nsSupport.pushContext();\r
+ boolean seenDecl = false;\r
+ atts.clear();\r
+ \r
+ // Take a first pass and copy all\r
+ // attributes into the SAX2 attribute\r
+ // list, noting any Namespace \r
+ // declarations.\r
+ int length = qAtts.getLength();\r
+ for (int i = 0; i < length; i++) {\r
+ String attQName = qAtts.getName(i);\r
+ String type = qAtts.getType(i);\r
+ String value = qAtts.getValue(i);\r
+\r
+ // Found a declaration...\r
+ if (attQName.startsWith("xmlns")) {\r
+ String prefix;\r
+ int n = attQName.indexOf(':');\r
+ if (n == -1) {\r
+ prefix = "";\r
+ } else {\r
+ prefix = attQName.substring(n+1);\r
+ }\r
+ if (!nsSupport.declarePrefix(prefix, value)) {\r
+ reportError("Illegal Namespace prefix: " + prefix);\r
+ }\r
+ if (contentHandler != null) {\r
+ contentHandler.startPrefixMapping(prefix, value);\r
+ }\r
+ // We may still have to add this to\r
+ // the list.\r
+ if (prefixes) {\r
+ atts.addAttribute("", "", attQName.intern(),\r
+ type, value);\r
+ }\r
+ seenDecl = true;\r
+\r
+ // This isn't a declaration.\r
+ } else {\r
+ String attName[] = processName(attQName, true);\r
+ atts.addAttribute(attName[0], attName[1], attName[2],\r
+ type, value);\r
+ }\r
+ }\r
+ \r
+ // If there was a Namespace declaration,\r
+ // we have to make a second pass just\r
+ // to be safe -- this will happen very\r
+ // rarely, possibly only once for each\r
+ // document.\r
+ if (seenDecl) {\r
+ length = atts.getLength();\r
+ for (int i = 0; i < length; i++) {\r
+ String attQName = atts.getQName(i);\r
+ if (!attQName.startsWith("xmlns")) {\r
+ String attName[] = processName(attQName, true);\r
+ atts.setURI(i, attName[0]);\r
+ atts.setLocalName(i, attName[1]);\r
+ }\r
+ }\r
+ }\r
+\r
+ // OK, finally report the event.\r
+ if (contentHandler != null) {\r
+ String name[] = processName(qName, false);\r
+ contentHandler.startElement(name[0], name[1], name[2], atts);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX1 end element event.\r
+ *\r
+ * @param qName The qualified (prefixed) name.\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.DocumentHandler#endElement\r
+ */\r
+ public void endElement (String qName)\r
+ throws SAXException\r
+ {\r
+ // If we're not doing Namespace\r
+ // processing, dispatch this quickly.\r
+ if (!namespaces) {\r
+ if (contentHandler != null) {\r
+ contentHandler.endElement("", "", qName.intern());\r
+ }\r
+ return;\r
+ }\r
+\r
+ // Split the name.\r
+ String names[] = processName(qName, false);\r
+ if (contentHandler != null) {\r
+ contentHandler.endElement(names[0], names[1], names[2]);\r
+ Enumeration prefixes = nsSupport.getDeclaredPrefixes();\r
+ while (prefixes.hasMoreElements()) {\r
+ String prefix = (String)prefixes.nextElement();\r
+ contentHandler.endPrefixMapping(prefix);\r
+ }\r
+ }\r
+ nsSupport.popContext();\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX1 characters event.\r
+ *\r
+ * @param ch An array of characters.\r
+ * @param start The starting position in the array.\r
+ * @param length The number of characters to use.\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.DocumentHandler#characters\r
+ */\r
+ public void characters (char ch[], int start, int length)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.characters(ch, start, length);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX1 ignorable whitespace event.\r
+ *\r
+ * @param ch An array of characters.\r
+ * @param start The starting position in the array.\r
+ * @param length The number of characters to use.\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.DocumentHandler#ignorableWhitespace\r
+ */\r
+ public void ignorableWhitespace (char ch[], int start, int length)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.ignorableWhitespace(ch, start, length);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX1 processing instruction event.\r
+ *\r
+ * @param target The processing instruction target.\r
+ * @param data The remainder of the processing instruction\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.DocumentHandler#processingInstruction\r
+ */\r
+ public void processingInstruction (String target, String data)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.processingInstruction(target, data);\r
+ }\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal utility methods.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Initialize the parser before each run.\r
+ */\r
+ private void setupParser ()\r
+ {\r
+ nsSupport.reset();\r
+\r
+ if (entityResolver != null) {\r
+ parser.setEntityResolver(entityResolver);\r
+ }\r
+ if (dtdHandler != null) {\r
+ parser.setDTDHandler(dtdHandler);\r
+ }\r
+ if (errorHandler != null) {\r
+ parser.setErrorHandler(errorHandler);\r
+ }\r
+ parser.setDocumentHandler(this);\r
+ locator = null;\r
+ }\r
+\r
+\r
+ /**\r
+ * Process a qualified (prefixed) name.\r
+ *\r
+ * <p>If the name has an undeclared prefix, use only the qname\r
+ * and make an ErrorHandler.error callback in case the app is\r
+ * interested.</p>\r
+ *\r
+ * @param qName The qualified (prefixed) name.\r
+ * @param isAttribute true if this is an attribute name.\r
+ * @return The name split into three parts.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception if there is an error callback.\r
+ */\r
+ private String [] processName (String qName, boolean isAttribute)\r
+ throws SAXException\r
+ {\r
+ String parts[] = nsSupport.processName(qName, nameParts,\r
+ isAttribute);\r
+ if (parts == null) {\r
+ parts = new String[3];\r
+ parts[2] = qName.intern();\r
+ reportError("Undeclared prefix: " + qName);\r
+ }\r
+ return parts;\r
+ }\r
+\r
+\r
+ /**\r
+ * Report a non-fatal error.\r
+ *\r
+ * @param message The error message.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception.\r
+ */\r
+ void reportError (String message)\r
+ throws SAXException\r
+ {\r
+ if (errorHandler == null) {\r
+ return;\r
+ }\r
+\r
+ SAXParseException e;\r
+ if (locator != null) {\r
+ e = new SAXParseException(message, locator);\r
+ } else {\r
+ e = new SAXParseException(message, null, null, -1, -1);\r
+ }\r
+ errorHandler.error(e);\r
+ }\r
+\r
+\r
+ /**\r
+ * Throw an exception if we are parsing.\r
+ *\r
+ * <p>Use this method to detect illegal feature or\r
+ * property changes.</p>\r
+ *\r
+ * @param type The type of thing (feature or property).\r
+ * @param name The feature or property name.\r
+ * @exception org.xml.sax.SAXNotSupportedException If a\r
+ * document is currently being parsed.\r
+ */\r
+ private void checkNotParsing (String type, String name)\r
+ throws SAXNotSupportedException\r
+ {\r
+ if (parsing) {\r
+ throw new SAXNotSupportedException("Cannot change " +\r
+ type + ' ' +\r
+ name + " while parsing");\r
+ \r
+ }\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+ private NamespaceSupport nsSupport;\r
+ private AttributeListAdapter attAdapter;\r
+\r
+ private boolean parsing = false;\r
+ private String nameParts[] = new String[3];\r
+\r
+ private Parser parser = null;\r
+\r
+ private AttributesImpl atts = null;\r
+\r
+ // Features\r
+ private boolean namespaces = true;\r
+ private boolean prefixes = false;\r
+\r
+ // Properties\r
+\r
+ // Handlers\r
+ Locator locator;\r
+\r
+ EntityResolver entityResolver = null;\r
+ DTDHandler dtdHandler = null;\r
+ ContentHandler contentHandler = null;\r
+ ErrorHandler errorHandler = null;\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Inner class to wrap an AttributeList when not doing NS proc.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Adapt a SAX1 AttributeList as a SAX2 Attributes object.\r
+ *\r
+ * <p>This class is in the Public Domain, and comes with NO\r
+ * WARRANTY of any kind.</p>\r
+ *\r
+ * <p>This wrapper class is used only when Namespace support\r
+ * is disabled -- it provides pretty much a direct mapping\r
+ * from SAX1 to SAX2, except that names and types are \r
+ * interned whenever requested.</p>\r
+ */\r
+ final class AttributeListAdapter implements Attributes\r
+ {\r
+\r
+ /**\r
+ * Construct a new adapter.\r
+ */\r
+ AttributeListAdapter ()\r
+ {\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the embedded AttributeList.\r
+ *\r
+ * <p>This method must be invoked before any of the others\r
+ * can be used.</p>\r
+ *\r
+ * @param The SAX1 attribute list (with qnames).\r
+ */\r
+ void setAttributeList (AttributeList qAtts)\r
+ {\r
+ this.qAtts = qAtts;\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the length of the attribute list.\r
+ *\r
+ * @return The number of attributes in the list.\r
+ * @see org.xml.sax.Attributes#getLength\r
+ */\r
+ public int getLength ()\r
+ {\r
+ return qAtts.getLength();\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the Namespace URI of the specified attribute.\r
+ *\r
+ * @param The attribute's index.\r
+ * @return Always the empty string.\r
+ * @see org.xml.sax.Attributes#getURI\r
+ */\r
+ public String getURI (int i)\r
+ {\r
+ return "";\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the local name of the specified attribute.\r
+ *\r
+ * @param The attribute's index.\r
+ * @return Always the empty string.\r
+ * @see org.xml.sax.Attributes#getLocalName\r
+ */\r
+ public String getLocalName (int i)\r
+ {\r
+ return "";\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the qualified (prefixed) name of the specified attribute.\r
+ *\r
+ * @param The attribute's index.\r
+ * @return The attribute's qualified name, internalized.\r
+ */\r
+ public String getQName (int i)\r
+ {\r
+ return qAtts.getName(i).intern();\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the type of the specified attribute.\r
+ *\r
+ * @param The attribute's index.\r
+ * @return The attribute's type as an internalized string.\r
+ */\r
+ public String getType (int i)\r
+ {\r
+ return qAtts.getType(i).intern();\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the value of the specified attribute.\r
+ *\r
+ * @param The attribute's index.\r
+ * @return The attribute's value.\r
+ */\r
+ public String getValue (int i)\r
+ {\r
+ return qAtts.getValue(i);\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up an attribute index by Namespace name.\r
+ *\r
+ * @param uri The Namespace URI or the empty string.\r
+ * @param localName The local name.\r
+ * @return The attributes index, or -1 if none was found.\r
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)\r
+ */\r
+ public int getIndex (String uri, String localName)\r
+ {\r
+ return -1;\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up an attribute index by qualified (prefixed) name.\r
+ *\r
+ * @param qName The qualified name.\r
+ * @return The attributes index, or -1 if none was found.\r
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String)\r
+ */\r
+ public int getIndex (String qName)\r
+ {\r
+ int max = atts.getLength();\r
+ for (int i = 0; i < max; i++) {\r
+ if (qAtts.getName(i).equals(qName)) {\r
+ return i;\r
+ }\r
+ }\r
+ return -1;\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up the type of an attribute by Namespace name.\r
+ *\r
+ * @param uri The Namespace URI\r
+ * @param localName The local name.\r
+ * @return The attribute's type as an internalized string.\r
+ */\r
+ public String getType (String uri, String localName)\r
+ {\r
+ return null;\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up the type of an attribute by qualified (prefixed) name.\r
+ *\r
+ * @param qName The qualified name.\r
+ * @return The attribute's type as an internalized string.\r
+ */\r
+ public String getType (String qName)\r
+ {\r
+ return qAtts.getType(qName).intern();\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up the value of an attribute by Namespace name.\r
+ *\r
+ * @param uri The Namespace URI\r
+ * @param localName The local name.\r
+ * @return The attribute's value.\r
+ */\r
+ public String getValue (String uri, String localName)\r
+ {\r
+ return null;\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up the value of an attribute by qualified (prefixed) name.\r
+ *\r
+ * @param qName The qualified name.\r
+ * @return The attribute's value.\r
+ */\r
+ public String getValue (String qName)\r
+ {\r
+ return qAtts.getValue(qName);\r
+ }\r
+\r
+ private AttributeList qAtts;\r
+ }\r
+}\r
+\r
+// end of ParserAdapter.java\r
--- /dev/null
+// SAX parser factory.\r
+// No warranty; no copyright -- use this as you will.\r
+// $Id: ParserFactory.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
+\r
+package org.xml.sax.helpers;\r
+\r
+import java.lang.ClassNotFoundException;\r
+import java.lang.IllegalAccessException;\r
+import java.lang.InstantiationException;\r
+import java.lang.SecurityException;\r
+import java.lang.ClassCastException;\r
+\r
+import org.xml.sax.Parser;\r
+\r
+\r
+/**\r
+ * Java-specific class for dynamically loading SAX parsers.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p><strong>Note:</strong> This class is designed to work with the now-deprecated\r
+ * SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use\r
+ * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.</p>\r
+ *\r
+ * <p>ParserFactory is not part of the platform-independent definition\r
+ * of SAX; it is an additional convenience class designed\r
+ * specifically for Java XML application writers. SAX applications\r
+ * can use the static methods in this class to allocate a SAX parser\r
+ * dynamically at run-time based either on the value of the\r
+ * `org.xml.sax.parser' system property or on a string containing the class\r
+ * name.</p>\r
+ *\r
+ * <p>Note that the application still requires an XML parser that\r
+ * implements SAX1.</p>\r
+ *\r
+ * @deprecated This class works with the deprecated\r
+ * {@link org.xml.sax.Parser Parser}\r
+ * interface.\r
+ * @since SAX 1.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.Parser\r
+ * @see java.lang.Class\r
+ */\r
+public class ParserFactory {\r
+ \r
+ \r
+ /**\r
+ * Private null constructor.\r
+ */\r
+ private ParserFactory ()\r
+ {\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Create a new SAX parser using the `org.xml.sax.parser' system property.\r
+ *\r
+ * <p>The named class must exist and must implement the\r
+ * {@link org.xml.sax.Parser Parser} interface.</p>\r
+ *\r
+ * @exception java.lang.NullPointerException There is no value\r
+ * for the `org.xml.sax.parser' system property.\r
+ * @exception java.lang.ClassNotFoundException The SAX parser\r
+ * class was not found (check your CLASSPATH).\r
+ * @exception IllegalAccessException The SAX parser class was\r
+ * found, but you do not have permission to load\r
+ * it.\r
+ * @exception InstantiationException The SAX parser class was\r
+ * found but could not be instantiated.\r
+ * @exception java.lang.ClassCastException The SAX parser class\r
+ * was found and instantiated, but does not implement\r
+ * org.xml.sax.Parser.\r
+ * @see #makeParser(java.lang.String)\r
+ * @see org.xml.sax.Parser\r
+ */\r
+ public static Parser makeParser ()\r
+ throws ClassNotFoundException,\r
+ IllegalAccessException, \r
+ InstantiationException,\r
+ NullPointerException,\r
+ ClassCastException\r
+ {\r
+ String className = System.getProperty("org.xml.sax.parser");\r
+ if (className == null) {\r
+ throw new NullPointerException("No value for sax.parser property");\r
+ } else {\r
+ return makeParser(className);\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Create a new SAX parser object using the class name provided.\r
+ *\r
+ * <p>The named class must exist and must implement the\r
+ * {@link org.xml.sax.Parser Parser} interface.</p>\r
+ *\r
+ * @param className A string containing the name of the\r
+ * SAX parser class.\r
+ * @exception java.lang.ClassNotFoundException The SAX parser\r
+ * class was not found (check your CLASSPATH).\r
+ * @exception IllegalAccessException The SAX parser class was\r
+ * found, but you do not have permission to load\r
+ * it.\r
+ * @exception InstantiationException The SAX parser class was\r
+ * found but could not be instantiated.\r
+ * @exception java.lang.ClassCastException The SAX parser class\r
+ * was found and instantiated, but does not implement\r
+ * org.xml.sax.Parser.\r
+ * @see #makeParser()\r
+ * @see org.xml.sax.Parser\r
+ */\r
+ public static Parser makeParser (String className)\r
+ throws ClassNotFoundException,\r
+ IllegalAccessException, \r
+ InstantiationException,\r
+ ClassCastException\r
+ {\r
+ return (Parser)(Class.forName(className).newInstance());\r
+ }\r
+ \r
+}\r
+\r
+// end of ParserFactory.java\r
--- /dev/null
+// XMLFilterImpl.java - base SAX2 filter implementation.\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the Public Domain.\r
+\r
+// $Id: XMLFilterImpl.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
+\r
+package org.xml.sax.helpers;\r
+\r
+import java.io.IOException;\r
+\r
+import org.xml.sax.XMLReader;\r
+import org.xml.sax.XMLFilter;\r
+import org.xml.sax.InputSource;\r
+import org.xml.sax.Locator;\r
+import org.xml.sax.Attributes;\r
+import org.xml.sax.EntityResolver;\r
+import org.xml.sax.DTDHandler;\r
+import org.xml.sax.ContentHandler;\r
+import org.xml.sax.ErrorHandler;\r
+import org.xml.sax.SAXException;\r
+import org.xml.sax.SAXParseException;\r
+import org.xml.sax.SAXNotSupportedException;\r
+import org.xml.sax.SAXNotRecognizedException;\r
+\r
+\r
+/**\r
+ * Base class for deriving an XML filter.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class is designed to sit between an {@link org.xml.sax.XMLReader\r
+ * XMLReader} and the client application's event handlers. By default, it\r
+ * does nothing but pass requests up to the reader and events\r
+ * on to the handlers unmodified, but subclasses can override\r
+ * specific methods to modify the event stream or the configuration\r
+ * requests as they pass through.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.XMLFilter\r
+ * @see org.xml.sax.XMLReader\r
+ * @see org.xml.sax.EntityResolver\r
+ * @see org.xml.sax.DTDHandler\r
+ * @see org.xml.sax.ContentHandler\r
+ * @see org.xml.sax.ErrorHandler\r
+ */\r
+public class XMLFilterImpl\r
+ implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler\r
+{\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Constructors.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Construct an empty XML filter, with no parent.\r
+ *\r
+ * <p>This filter will have no parent: you must assign a parent\r
+ * before you start a parse or do any configuration with\r
+ * setFeature or setProperty.</p>\r
+ *\r
+ * @see org.xml.sax.XMLReader#setFeature\r
+ * @see org.xml.sax.XMLReader#setProperty\r
+ */\r
+ public XMLFilterImpl ()\r
+ {\r
+ super();\r
+ }\r
+\r
+\r
+ /**\r
+ * Construct an XML filter with the specified parent.\r
+ *\r
+ * @see #setParent\r
+ * @see #getParent\r
+ */\r
+ public XMLFilterImpl (XMLReader parent)\r
+ {\r
+ super();\r
+ setParent(parent);\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.XMLFilter.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Set the parent reader.\r
+ *\r
+ * <p>This is the {@link org.xml.sax.XMLReader XMLReader} from which \r
+ * this filter will obtain its events and to which it will pass its \r
+ * configuration requests. The parent may itself be another filter.</p>\r
+ *\r
+ * <p>If there is no parent reader set, any attempt to parse\r
+ * or to set or get a feature or property will fail.</p>\r
+ *\r
+ * @param parent The parent XML reader.\r
+ * @exception java.lang.NullPointerException If the parent is null.\r
+ * @see #getParent\r
+ */\r
+ public void setParent (XMLReader parent)\r
+ {\r
+ if (parent == null) {\r
+ throw new NullPointerException("Null parent");\r
+ }\r
+ this.parent = parent;\r
+ }\r
+\r
+\r
+ /**\r
+ * Get the parent reader.\r
+ *\r
+ * @return The parent XML reader, or null if none is set.\r
+ * @see #setParent\r
+ */\r
+ public XMLReader getParent ()\r
+ {\r
+ return parent;\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.XMLReader.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Set the state of a feature.\r
+ *\r
+ * <p>This will always fail if the parent is null.</p>\r
+ *\r
+ * @param name The feature name.\r
+ * @param state The requested feature state.\r
+ * @exception org.xml.sax.SAXNotRecognizedException When the\r
+ * XMLReader does not recognize the feature name.\r
+ * @exception org.xml.sax.SAXNotSupportedException When the\r
+ * XMLReader recognizes the feature name but \r
+ * cannot set the requested value.\r
+ * @see org.xml.sax.XMLReader#setFeature\r
+ */\r
+ public void setFeature (String name, boolean state)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException\r
+ {\r
+ if (parent != null) {\r
+ parent.setFeature(name, state);\r
+ } else {\r
+ throw new SAXNotRecognizedException("Feature: " + name);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up the state of a feature.\r
+ *\r
+ * <p>This will always fail if the parent is null.</p>\r
+ *\r
+ * @param name The feature name.\r
+ * @return The current state of the feature.\r
+ * @exception org.xml.sax.SAXNotRecognizedException When the\r
+ * XMLReader does not recognize the feature name.\r
+ * @exception org.xml.sax.SAXNotSupportedException When the\r
+ * XMLReader recognizes the feature name but \r
+ * cannot determine its state at this time.\r
+ * @see org.xml.sax.XMLReader#getFeature\r
+ */\r
+ public boolean getFeature (String name)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException\r
+ {\r
+ if (parent != null) {\r
+ return parent.getFeature(name);\r
+ } else {\r
+ throw new SAXNotRecognizedException("Feature: " + name);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the value of a property.\r
+ *\r
+ * <p>This will always fail if the parent is null.</p>\r
+ *\r
+ * @param name The property name.\r
+ * @param state The requested property value.\r
+ * @exception org.xml.sax.SAXNotRecognizedException When the\r
+ * XMLReader does not recognize the property name.\r
+ * @exception org.xml.sax.SAXNotSupportedException When the\r
+ * XMLReader recognizes the property name but \r
+ * cannot set the requested value.\r
+ * @see org.xml.sax.XMLReader#setProperty\r
+ */\r
+ public void setProperty (String name, Object value)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException\r
+ {\r
+ if (parent != null) {\r
+ parent.setProperty(name, value);\r
+ } else {\r
+ throw new SAXNotRecognizedException("Property: " + name);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Look up the value of a property.\r
+ *\r
+ * @param name The property name.\r
+ * @return The current value of the property.\r
+ * @exception org.xml.sax.SAXNotRecognizedException When the\r
+ * XMLReader does not recognize the feature name.\r
+ * @exception org.xml.sax.SAXNotSupportedException When the\r
+ * XMLReader recognizes the property name but \r
+ * cannot determine its value at this time.\r
+ * @see org.xml.sax.XMLReader#setFeature\r
+ */\r
+ public Object getProperty (String name)\r
+ throws SAXNotRecognizedException, SAXNotSupportedException\r
+ {\r
+ if (parent != null) {\r
+ return parent.getProperty(name);\r
+ } else {\r
+ throw new SAXNotRecognizedException("Property: " + name);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the entity resolver.\r
+ *\r
+ * @param resolver The new entity resolver.\r
+ * @exception java.lang.NullPointerException If the resolver\r
+ * is null.\r
+ * @see org.xml.sax.XMLReader#setEntityResolver\r
+ */\r
+ public void setEntityResolver (EntityResolver resolver)\r
+ {\r
+ if (resolver == null) {\r
+ throw new NullPointerException("Null entity resolver");\r
+ } else {\r
+ entityResolver = resolver;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Get the current entity resolver.\r
+ *\r
+ * @return The current entity resolver, or null if none was set.\r
+ * @see org.xml.sax.XMLReader#getEntityResolver\r
+ */\r
+ public EntityResolver getEntityResolver ()\r
+ {\r
+ return entityResolver;\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the DTD event handler.\r
+ *\r
+ * @param resolver The new DTD handler.\r
+ * @exception java.lang.NullPointerException If the handler\r
+ * is null.\r
+ * @see org.xml.sax.XMLReader#setDTDHandler\r
+ */\r
+ public void setDTDHandler (DTDHandler handler)\r
+ {\r
+ if (handler == null) {\r
+ throw new NullPointerException("Null DTD handler");\r
+ } else {\r
+ dtdHandler = handler;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Get the current DTD event handler.\r
+ *\r
+ * @return The current DTD handler, or null if none was set.\r
+ * @see org.xml.sax.XMLReader#getDTDHandler\r
+ */\r
+ public DTDHandler getDTDHandler ()\r
+ {\r
+ return dtdHandler;\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the content event handler.\r
+ *\r
+ * @param resolver The new content handler.\r
+ * @exception java.lang.NullPointerException If the handler\r
+ * is null.\r
+ * @see org.xml.sax.XMLReader#setContentHandler\r
+ */\r
+ public void setContentHandler (ContentHandler handler)\r
+ {\r
+ if (handler == null) {\r
+ throw new NullPointerException("Null content handler");\r
+ } else {\r
+ contentHandler = handler;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Get the content event handler.\r
+ *\r
+ * @return The current content handler, or null if none was set.\r
+ * @see org.xml.sax.XMLReader#getContentHandler\r
+ */\r
+ public ContentHandler getContentHandler ()\r
+ {\r
+ return contentHandler;\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the error event handler.\r
+ *\r
+ * @param handle The new error handler.\r
+ * @exception java.lang.NullPointerException If the handler\r
+ * is null.\r
+ * @see org.xml.sax.XMLReader#setErrorHandler\r
+ */\r
+ public void setErrorHandler (ErrorHandler handler)\r
+ {\r
+ if (handler == null) {\r
+ throw new NullPointerException("Null error handler");\r
+ } else {\r
+ errorHandler = handler;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Get the current error event handler.\r
+ *\r
+ * @return The current error handler, or null if none was set.\r
+ * @see org.xml.sax.XMLReader#getErrorHandler\r
+ */\r
+ public ErrorHandler getErrorHandler ()\r
+ {\r
+ return errorHandler;\r
+ }\r
+\r
+\r
+ /**\r
+ * Parse a document.\r
+ *\r
+ * @param input The input source for the document entity.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @exception java.io.IOException An IO exception from the parser,\r
+ * possibly from a byte stream or character stream\r
+ * supplied by the application.\r
+ * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource)\r
+ */\r
+ public void parse (InputSource input)\r
+ throws SAXException, IOException\r
+ {\r
+ setupParse();\r
+ parent.parse(input);\r
+ }\r
+\r
+\r
+ /**\r
+ * Parse a document.\r
+ *\r
+ * @param systemId The system identifier as a fully-qualified URI.\r
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly\r
+ * wrapping another exception.\r
+ * @exception java.io.IOException An IO exception from the parser,\r
+ * possibly from a byte stream or character stream\r
+ * supplied by the application.\r
+ * @see org.xml.sax.XMLReader#parse(java.lang.String)\r
+ */\r
+ public void parse (String systemId)\r
+ throws SAXException, IOException\r
+ {\r
+ parse(new InputSource(systemId));\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.EntityResolver.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Filter an external entity resolution.\r
+ *\r
+ * @param publicId The entity's public identifier, or null.\r
+ * @param systemId The entity's system identifier.\r
+ * @return A new InputSource or null for the default.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @exception java.io.IOException The client may throw an\r
+ * I/O-related exception while obtaining the\r
+ * new InputSource.\r
+ * @see org.xml.sax.EntityResolver#resolveEntity\r
+ */\r
+ public InputSource resolveEntity (String publicId, String systemId)\r
+ throws SAXException, IOException\r
+ {\r
+ if (entityResolver != null) {\r
+ return entityResolver.resolveEntity(publicId, systemId);\r
+ } else {\r
+ return null;\r
+ }\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.DTDHandler.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+ \r
+ /**\r
+ * Filter a notation declaration event.\r
+ *\r
+ * @param name The notation name.\r
+ * @param publicId The notation's public identifier, or null.\r
+ * @param systemId The notation's system identifier, or null.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.DTDHandler#notationDecl\r
+ */\r
+ public void notationDecl (String name, String publicId, String systemId)\r
+ throws SAXException\r
+ {\r
+ if (dtdHandler != null) {\r
+ dtdHandler.notationDecl(name, publicId, systemId);\r
+ }\r
+ }\r
+\r
+ \r
+ /**\r
+ * Filter an unparsed entity declaration event.\r
+ *\r
+ * @param name The entity name.\r
+ * @param publicId The entity's public identifier, or null.\r
+ * @param systemId The entity's system identifier, or null.\r
+ * @param notationName The name of the associated notation.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl\r
+ */\r
+ public void unparsedEntityDecl (String name, String publicId,\r
+ String systemId, String notationName)\r
+ throws SAXException\r
+ {\r
+ if (dtdHandler != null) {\r
+ dtdHandler.unparsedEntityDecl(name, publicId, systemId,\r
+ notationName);\r
+ }\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.ContentHandler.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Filter a new document locator event.\r
+ *\r
+ * @param locator The document locator.\r
+ * @see org.xml.sax.ContentHandler#setDocumentLocator\r
+ */\r
+ public void setDocumentLocator (Locator locator)\r
+ {\r
+ this.locator = locator;\r
+ if (contentHandler != null) {\r
+ contentHandler.setDocumentLocator(locator);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter a start document event.\r
+ *\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ContentHandler#startDocument\r
+ */\r
+ public void startDocument ()\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.startDocument();\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter an end document event.\r
+ *\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ContentHandler#endDocument\r
+ */\r
+ public void endDocument ()\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.endDocument();\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter a start Namespace prefix mapping event.\r
+ *\r
+ * @param prefix The Namespace prefix.\r
+ * @param uri The Namespace URI.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ContentHandler#startPrefixMapping\r
+ */\r
+ public void startPrefixMapping (String prefix, String uri)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.startPrefixMapping(prefix, uri);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter an end Namespace prefix mapping event.\r
+ *\r
+ * @param prefix The Namespace prefix.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ContentHandler#endPrefixMapping\r
+ */\r
+ public void endPrefixMapping (String prefix)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.endPrefixMapping(prefix);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter a start element event.\r
+ *\r
+ * @param uri The element's Namespace URI, or the empty string.\r
+ * @param localName The element's local name, or the empty string.\r
+ * @param qName The element's qualified (prefixed) name, or the empty\r
+ * string.\r
+ * @param atts The element's attributes.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ContentHandler#startElement\r
+ */\r
+ public void startElement (String uri, String localName, String qName,\r
+ Attributes atts)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.startElement(uri, localName, qName, atts);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter an end element event.\r
+ *\r
+ * @param uri The element's Namespace URI, or the empty string.\r
+ * @param localName The element's local name, or the empty string.\r
+ * @param qName The element's qualified (prefixed) name, or the empty\r
+ * string.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ContentHandler#endElement\r
+ */\r
+ public void endElement (String uri, String localName, String qName)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.endElement(uri, localName, qName);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter a character data event.\r
+ *\r
+ * @param ch An array of characters.\r
+ * @param start The starting position in the array.\r
+ * @param length The number of characters to use from the array.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ContentHandler#characters\r
+ */\r
+ public void characters (char ch[], int start, int length)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.characters(ch, start, length);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter an ignorable whitespace event.\r
+ *\r
+ * @param ch An array of characters.\r
+ * @param start The starting position in the array.\r
+ * @param length The number of characters to use from the array.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ContentHandler#ignorableWhitespace\r
+ */\r
+ public void ignorableWhitespace (char ch[], int start, int length)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.ignorableWhitespace(ch, start, length);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter a processing instruction event.\r
+ *\r
+ * @param target The processing instruction target.\r
+ * @param data The text following the target.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ContentHandler#processingInstruction\r
+ */\r
+ public void processingInstruction (String target, String data)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.processingInstruction(target, data);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter a skipped entity event.\r
+ *\r
+ * @param name The name of the skipped entity.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ContentHandler#skippedEntity\r
+ */\r
+ public void skippedEntity (String name)\r
+ throws SAXException\r
+ {\r
+ if (contentHandler != null) {\r
+ contentHandler.skippedEntity(name);\r
+ }\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.ErrorHandler.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Filter a warning event.\r
+ *\r
+ * @param e The nwarning as an exception.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ErrorHandler#warning\r
+ */\r
+ public void warning (SAXParseException e)\r
+ throws SAXException\r
+ {\r
+ if (errorHandler != null) {\r
+ errorHandler.warning(e);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter an error event.\r
+ *\r
+ * @param e The error as an exception.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ErrorHandler#error\r
+ */\r
+ public void error (SAXParseException e)\r
+ throws SAXException\r
+ {\r
+ if (errorHandler != null) {\r
+ errorHandler.error(e);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Filter a fatal error event.\r
+ *\r
+ * @param e The error as an exception.\r
+ * @exception org.xml.sax.SAXException The client may throw\r
+ * an exception during processing.\r
+ * @see org.xml.sax.ErrorHandler#fatalError\r
+ */\r
+ public void fatalError (SAXParseException e)\r
+ throws SAXException\r
+ {\r
+ if (errorHandler != null) {\r
+ errorHandler.fatalError(e);\r
+ }\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal methods.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Set up before a parse.\r
+ *\r
+ * <p>Before every parse, check whether the parent is\r
+ * non-null, and re-register the filter for all of the \r
+ * events.</p>\r
+ */\r
+ private void setupParse ()\r
+ {\r
+ if (parent == null) {\r
+ throw new NullPointerException("No parent for filter");\r
+ }\r
+ parent.setEntityResolver(this);\r
+ parent.setDTDHandler(this);\r
+ parent.setContentHandler(this);\r
+ parent.setErrorHandler(this);\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+ private XMLReader parent = null;\r
+ private Locator locator = null;\r
+ private EntityResolver entityResolver = null;\r
+ private DTDHandler dtdHandler = null;\r
+ private ContentHandler contentHandler = null;\r
+ private ErrorHandler errorHandler = null;\r
+\r
+}\r
+\r
+// end of XMLFilterImpl.java\r
--- /dev/null
+// XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the public domain.\r
+\r
+// $Id: XMLReaderAdapter.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
+\r
+package org.xml.sax.helpers;\r
+\r
+import java.io.IOException;\r
+import java.util.Locale;\r
+\r
+import org.xml.sax.Parser; // deprecated\r
+import org.xml.sax.Locator;\r
+import org.xml.sax.InputSource;\r
+import org.xml.sax.AttributeList; // deprecated\r
+import org.xml.sax.EntityResolver;\r
+import org.xml.sax.DTDHandler;\r
+import org.xml.sax.DocumentHandler; // deprecated\r
+import org.xml.sax.ErrorHandler;\r
+import org.xml.sax.SAXException;\r
+\r
+import org.xml.sax.XMLReader;\r
+import org.xml.sax.Attributes;\r
+import org.xml.sax.ContentHandler;\r
+import org.xml.sax.SAXNotSupportedException;\r
+\r
+\r
+/**\r
+ * Adapt a SAX2 XMLReader as a SAX1 Parser.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader}\r
+ * and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}. The XMLReader \r
+ * must support a true value for the \r
+ * http://xml.org/sax/features/namespace-prefixes property or parsing will fail\r
+ * with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader \r
+ * supports a false value for the http://xml.org/sax/features/namespaces \r
+ * property, that will also be used to improve efficiency.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.Parser\r
+ * @see org.xml.sax.XMLReader\r
+ */\r
+public class XMLReaderAdapter implements Parser, ContentHandler\r
+{\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Constructor.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Create a new adapter.\r
+ *\r
+ * <p>Use the "org.xml.sax.driver" property to locate the SAX2\r
+ * driver to embed.</p>\r
+ *\r
+ * @exception org.xml.sax.SAXException If the embedded driver\r
+ * cannot be instantiated or if the\r
+ * org.xml.sax.driver property is not specified.\r
+ */\r
+ public XMLReaderAdapter ()\r
+ throws SAXException\r
+ {\r
+ setup(XMLReaderFactory.createXMLReader());\r
+ }\r
+\r
+\r
+ /**\r
+ * Create a new adapter.\r
+ *\r
+ * <p>Create a new adapter, wrapped around a SAX2 XMLReader.\r
+ * The adapter will make the XMLReader act like a SAX1\r
+ * Parser.</p>\r
+ *\r
+ * @param xmlReader The SAX2 XMLReader to wrap.\r
+ * @exception java.lang.NullPointerException If the argument is null.\r
+ */\r
+ public XMLReaderAdapter (XMLReader xmlReader)\r
+ {\r
+ setup(xmlReader);\r
+ }\r
+\r
+\r
+\r
+ /**\r
+ * Internal setup.\r
+ *\r
+ * @param xmlReader The embedded XMLReader.\r
+ */\r
+ private void setup (XMLReader xmlReader)\r
+ {\r
+ if (xmlReader == null) {\r
+ throw new NullPointerException("XMLReader must not be null");\r
+ }\r
+ this.xmlReader = xmlReader;\r
+ qAtts = new AttributesAdapter();\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.Parser.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Set the locale for error reporting.\r
+ *\r
+ * <p>This is not supported in SAX2, and will always throw\r
+ * an exception.</p>\r
+ *\r
+ * @param The locale for error reporting.\r
+ * @see org.xml.sax.Parser#setLocale\r
+ */\r
+ public void setLocale (Locale locale)\r
+ throws SAXException\r
+ {\r
+ throw new SAXNotSupportedException("setLocale not supported");\r
+ }\r
+\r
+\r
+ /**\r
+ * Register the entity resolver.\r
+ *\r
+ * @param resolver The new resolver.\r
+ * @see org.xml.sax.Parser#setEntityResolver\r
+ */\r
+ public void setEntityResolver (EntityResolver resolver)\r
+ {\r
+ xmlReader.setEntityResolver(resolver);\r
+ }\r
+\r
+\r
+ /**\r
+ * Register the DTD event handler.\r
+ *\r
+ * @param handler The new DTD event handler.\r
+ * @see org.xml.sax.Parser#setDTDHandler\r
+ */\r
+ public void setDTDHandler (DTDHandler handler)\r
+ {\r
+ xmlReader.setDTDHandler(handler);\r
+ }\r
+\r
+\r
+ /**\r
+ * Register the SAX1 document event handler.\r
+ *\r
+ * <p>Note that the SAX1 document handler has no Namespace\r
+ * support.</p>\r
+ *\r
+ * @param handler The new SAX1 document event handler.\r
+ * @see org.xml.sax.Parser#setDocumentHandler\r
+ */\r
+ public void setDocumentHandler (DocumentHandler handler)\r
+ {\r
+ documentHandler = handler;\r
+ }\r
+\r
+\r
+ /**\r
+ * Register the error event handler.\r
+ *\r
+ * @param handler The new error event handler.\r
+ * @see org.xml.sax.Parser#setErrorHandler\r
+ */\r
+ public void setErrorHandler (ErrorHandler handler)\r
+ {\r
+ xmlReader.setErrorHandler(handler);\r
+ }\r
+\r
+\r
+ /**\r
+ * Parse the document.\r
+ *\r
+ * <p>This method will throw an exception if the embedded\r
+ * XMLReader does not support the \r
+ * http://xml.org/sax/features/namespace-prefixes property.</p>\r
+ *\r
+ * @param systemId The absolute URL of the document.\r
+ * @exception java.io.IOException If there is a problem reading\r
+ * the raw content of the document.\r
+ * @exception org.xml.sax.SAXException If there is a problem\r
+ * processing the document.\r
+ * @see #parse(org.xml.sax.InputSource)\r
+ * @see org.xml.sax.Parser#parse(java.lang.String)\r
+ */\r
+ public void parse (String systemId)\r
+ throws IOException, SAXException\r
+ {\r
+ parse(new InputSource(systemId));\r
+ }\r
+\r
+\r
+ /**\r
+ * Parse the document.\r
+ *\r
+ * <p>This method will throw an exception if the embedded\r
+ * XMLReader does not support the \r
+ * http://xml.org/sax/features/namespace-prefixes property.</p>\r
+ *\r
+ * @param input An input source for the document.\r
+ * @exception java.io.IOException If there is a problem reading\r
+ * the raw content of the document.\r
+ * @exception org.xml.sax.SAXException If there is a problem\r
+ * processing the document.\r
+ * @see #parse(java.lang.String)\r
+ * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource)\r
+ */\r
+ public void parse (InputSource input)\r
+ throws IOException, SAXException\r
+ {\r
+ setupXMLReader();\r
+ xmlReader.parse(input);\r
+ }\r
+\r
+\r
+ /**\r
+ * Set up the XML reader.\r
+ */\r
+ private void setupXMLReader ()\r
+ throws SAXException\r
+ {\r
+ xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);\r
+ try {\r
+ xmlReader.setFeature("http://xml.org/sax/features/namespaces",\r
+ false);\r
+ } catch (SAXException e) {\r
+ // NO OP: it's just extra information, and we can ignore it\r
+ }\r
+ xmlReader.setContentHandler(this);\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Implementation of org.xml.sax.ContentHandler.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Set a document locator.\r
+ *\r
+ * @param locator The document locator.\r
+ * @see org.xml.sax.ContentHandler#setDocumentLocator\r
+ */\r
+ public void setDocumentLocator (Locator locator)\r
+ {\r
+ documentHandler.setDocumentLocator(locator);\r
+ }\r
+\r
+\r
+ /**\r
+ * Start document event.\r
+ *\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.ContentHandler#startDocument\r
+ */\r
+ public void startDocument ()\r
+ throws SAXException\r
+ {\r
+ documentHandler.startDocument();\r
+ }\r
+\r
+\r
+ /**\r
+ * End document event.\r
+ *\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.ContentHandler#endDocument\r
+ */\r
+ public void endDocument ()\r
+ throws SAXException\r
+ {\r
+ documentHandler.endDocument();\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX2 start prefix mapping event.\r
+ *\r
+ * @param prefix The prefix being mapped.\r
+ * @param uri The Namespace URI being mapped to.\r
+ * @see org.xml.sax.ContentHandler#startPrefixMapping\r
+ */\r
+ public void startPrefixMapping (String prefix, String uri)\r
+ {\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX2 end prefix mapping event.\r
+ *\r
+ * @param prefix The prefix being mapped.\r
+ * @see org.xml.sax.ContentHandler#endPrefixMapping\r
+ */\r
+ public void endPrefixMapping (String prefix)\r
+ {\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX2 start element event.\r
+ *\r
+ * @param uri The Namespace URI.\r
+ * @param localName The Namespace local name.\r
+ * @param qName The qualified (prefixed) name.\r
+ * @param atts The SAX2 attributes.\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.ContentHandler#endDocument\r
+ */\r
+ public void startElement (String uri, String localName,\r
+ String qName, Attributes atts)\r
+ throws SAXException\r
+ {\r
+ qAtts.setAttributes(atts);\r
+ documentHandler.startElement(qName, qAtts);\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX2 end element event.\r
+ *\r
+ * @param uri The Namespace URI.\r
+ * @param localName The Namespace local name.\r
+ * @param qName The qualified (prefixed) name.\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.ContentHandler#endElement\r
+ */\r
+ public void endElement (String uri, String localName,\r
+ String qName)\r
+ throws SAXException\r
+ {\r
+ documentHandler.endElement(qName);\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX2 characters event.\r
+ *\r
+ * @param ch An array of characters.\r
+ * @param start The starting position in the array.\r
+ * @param length The number of characters to use.\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.ContentHandler#characters\r
+ */\r
+ public void characters (char ch[], int start, int length)\r
+ throws SAXException\r
+ {\r
+ documentHandler.characters(ch, start, length);\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX2 ignorable whitespace event.\r
+ *\r
+ * @param ch An array of characters.\r
+ * @param start The starting position in the array.\r
+ * @param length The number of characters to use.\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.ContentHandler#ignorableWhitespace\r
+ */\r
+ public void ignorableWhitespace (char ch[], int start, int length)\r
+ throws SAXException\r
+ {\r
+ documentHandler.ignorableWhitespace(ch, start, length);\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX2 processing instruction event.\r
+ *\r
+ * @param target The processing instruction target.\r
+ * @param data The remainder of the processing instruction\r
+ * @exception org.xml.sax.SAXException The client may raise a\r
+ * processing exception.\r
+ * @see org.xml.sax.ContentHandler#processingInstruction\r
+ */\r
+ public void processingInstruction (String target, String data)\r
+ throws SAXException\r
+ {\r
+ documentHandler.processingInstruction(target, data);\r
+ }\r
+\r
+\r
+ /**\r
+ * Adapt a SAX2 skipped entity event.\r
+ *\r
+ * @param name The name of the skipped entity.\r
+ * @see org.xml.sax.ContentHandler#skippedEntity\r
+ */\r
+ public void skippedEntity (String name)\r
+ throws SAXException\r
+ {\r
+ }\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal state.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+ XMLReader xmlReader;\r
+ DocumentHandler documentHandler;\r
+ AttributesAdapter qAtts;\r
+\r
+\r
+\f\r
+ ////////////////////////////////////////////////////////////////////\r
+ // Internal class.\r
+ ////////////////////////////////////////////////////////////////////\r
+\r
+\r
+ /**\r
+ * Internal class to wrap a SAX2 Attributes object for SAX1.\r
+ */\r
+ final class AttributesAdapter implements AttributeList\r
+ {\r
+ AttributesAdapter ()\r
+ {\r
+ }\r
+\r
+\r
+ /**\r
+ * Set the embedded Attributes object.\r
+ *\r
+ * @param The embedded SAX2 Attributes.\r
+ */ \r
+ void setAttributes (Attributes attributes)\r
+ {\r
+ this.attributes = attributes;\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the number of attributes.\r
+ *\r
+ * @return The length of the attribute list.\r
+ * @see org.xml.sax.AttributeList#getLength\r
+ */\r
+ public int getLength ()\r
+ {\r
+ return attributes.getLength();\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the qualified (prefixed) name of an attribute by position.\r
+ *\r
+ * @return The qualified name.\r
+ * @see org.xml.sax.AttributeList#getName\r
+ */\r
+ public String getName (int i)\r
+ {\r
+ return attributes.getQName(i);\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the type of an attribute by position.\r
+ *\r
+ * @return The type.\r
+ * @see org.xml.sax.AttributeList#getType(int)\r
+ */\r
+ public String getType (int i)\r
+ {\r
+ return attributes.getType(i);\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the value of an attribute by position.\r
+ *\r
+ * @return The value.\r
+ * @see org.xml.sax.AttributeList#getValue(int)\r
+ */\r
+ public String getValue (int i)\r
+ {\r
+ return attributes.getValue(i);\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the type of an attribute by qualified (prefixed) name.\r
+ *\r
+ * @return The type.\r
+ * @see org.xml.sax.AttributeList#getType(java.lang.String)\r
+ */\r
+ public String getType (String qName)\r
+ {\r
+ return attributes.getType(qName);\r
+ }\r
+\r
+\r
+ /**\r
+ * Return the value of an attribute by qualified (prefixed) name.\r
+ *\r
+ * @return The value.\r
+ * @see org.xml.sax.AttributeList#getValue(java.lang.String)\r
+ */\r
+ public String getValue (String qName)\r
+ {\r
+ return attributes.getValue(qName);\r
+ }\r
+\r
+ private Attributes attributes;\r
+ }\r
+\r
+}\r
+\r
+// end of XMLReaderAdapter.java\r
--- /dev/null
+// XMLReaderFactory.java - factory for creating a new reader.\r
+// Written by David Megginson, sax@megginson.com\r
+// NO WARRANTY! This class is in the Public Domain.\r
+\r
+// $Id: XMLReaderFactory.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
+\r
+package org.xml.sax.helpers;\r
+import org.xml.sax.Parser;\r
+import org.xml.sax.XMLReader;\r
+import org.xml.sax.SAXException;\r
+\r
+\r
+/**\r
+ * Factory for creating an XML reader.\r
+ *\r
+ * <blockquote>\r
+ * <em>This module, both source code and documentation, is in the\r
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
+ * </blockquote>\r
+ *\r
+ * <p>This class contains static methods for creating an XML reader\r
+ * from an explicit class name, or for creating an XML reader based\r
+ * on the value of the <code>org.xml.sax.driver</code> system \r
+ * property:</p>\r
+ *\r
+ * <pre>\r
+ * try {\r
+ * XMLReader myReader = XMLReaderFactory.createXMLReader();\r
+ * } catch (SAXException e) {\r
+ * System.err.println(e.getMessage());\r
+ * }\r
+ * </pre>\r
+ *\r
+ * <p>Note that these methods will not be usable in environments where\r
+ * system properties are not accessible or where the application or\r
+ * applet is not permitted to load classes dynamically.</p>\r
+ *\r
+ * <p><strong>Note to implementors:</strong> SAX implementations in specialized\r
+ * environments may replace this class with a different one optimized for the\r
+ * environment, as long as its method signatures remain the same.</p>\r
+ *\r
+ * @since SAX 2.0\r
+ * @author David Megginson, \r
+ * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
+ * @version 2.0\r
+ * @see org.xml.sax.XMLReader\r
+ */\r
+final public class XMLReaderFactory\r
+{\r
+\r
+ /**\r
+ * Private constructor.\r
+ *\r
+ * <p>This constructor prevents the class from being instantiated.</p>\r
+ */\r
+ private XMLReaderFactory ()\r
+ {\r
+ }\r
+\r
+\r
+ /**\r
+ * Attempt to create an XML reader from a system property.\r
+ *\r
+ * <p>This method uses the value of the system property\r
+ * "org.xml.sax.driver" as the full name of a Java class\r
+ * and tries to instantiate that class as a SAX2 \r
+ * XMLReader.</p>\r
+ *\r
+ * <p>Note that many Java interpreters allow system properties\r
+ * to be specified on the command line.</p>\r
+ *\r
+ * @return A new XMLReader.\r
+ * @exception org.xml.sax.SAXException If the value of the\r
+ * "org.xml.sax.driver" system property is null,\r
+ * or if the class cannot be loaded and instantiated.\r
+ * @see #createXMLReader(java.lang.String)\r
+ */\r
+ public static XMLReader createXMLReader ()\r
+ throws SAXException\r
+ {\r
+ String className = System.getProperty("org.xml.sax.driver");\r
+ if (className == null) {\r
+ Parser parser;\r
+ try {\r
+ parser = ParserFactory.makeParser();\r
+ } catch (Exception e) {\r
+ parser = null;\r
+ }\r
+ if (parser == null) {\r
+ throw new\r
+ SAXException("System property org.xml.sax.driver not specified");\r
+ } else {\r
+ return new ParserAdapter(parser);\r
+ }\r
+ } else {\r
+ return createXMLReader(className);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Attempt to create an XML reader from a class name.\r
+ *\r
+ * <p>Given a class name, this method attempts to load\r
+ * and instantiate the class as an XML reader.</p>\r
+ *\r
+ * @return A new XML reader.\r
+ * @exception org.xml.sax.SAXException If the class cannot be\r
+ * loaded, instantiated, and cast to XMLReader.\r
+ * @see #createXMLReader()\r
+ */\r
+ public static XMLReader createXMLReader (String className)\r
+ throws SAXException\r
+ {\r
+ try {\r
+ return (XMLReader)(Class.forName(className).newInstance());\r
+ } catch (ClassNotFoundException e1) {\r
+ throw new SAXException("SAX2 driver class " + className +\r
+ " not found", e1);\r
+ } catch (IllegalAccessException e2) {\r
+ throw new SAXException("SAX2 driver class " + className +\r
+ " found but cannot be loaded", e2);\r
+ } catch (InstantiationException e3) {\r
+ throw new SAXException("SAX2 driver class " + className +\r
+ " loaded but cannot be instantiated (no empty public constructor?)",\r
+ e3);\r
+ } catch (ClassCastException e4) {\r
+ throw new SAXException("SAX2 driver class " + className +\r
+ " does not implement XMLReader", e4);\r
+ }\r
+ \r
+ }\r
+\r
+}\r
+\r
+// end of XMLReaderFactory.java\r