You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@apache.org on 2001/08/23 02:35:40 UTC
cvs commit: xml-xerces/java/tools style-apachexml-Makefile
lehors 01/08/22 17:35:39
Modified: java LICENSE README Readme.html STATUS build.xml
java/docs api.xml docs-book.xml faq-build.xml faq-common.xml
faq-general.xml faq-performance.xml faq-write.xml
features.xml install.xml properties.xml readme.xml
releases.xml samples.xml
java/docs/dtd blocks.ent book.dtd characters.ent
document.dtd entities.ent faqs.dtd links.ent
markup.ent
java/samples/dom DOMAddLines.java DOMGenerate.java
java/samples/dom/traversal IteratorView.java
NameNodeFilter.java TreeWalkerView.java
java/samples/sax DocumentTracer.java
java/samples/sax/helpers AttributesImpl.java
java/samples/ui DOMParserSaveEncoding.java DOMTree.java
DOMTreeFull.java DefaultImages.java TreeView.java
TreeViewer.java
java/src/org/apache/xerces/dom CoreDocumentImpl.java
DocumentImpl.java
java/src/org/apache/xerces/parsers DOMParser.java
SAXParser.java
java/tests/dom/events EventReporter.java
java/tests/dom/range Test.java
java/tests/dom/serialize TestSerializeDOMIn.java
TestSerializeDOMOut.java
java/tests/io UTF8.java
Added: java ISSUES TODO
java/design architecture.html coding.html crimson.html
design.html design.xsl design.zip entities.html
index.html issues.html schedule.html validation.htm
xerces.html
java/design/css design.css diagram.css index.css site.css
java/design/images arrow-right.gif pipeline.gif table.gif
java/design/src DesignDoc$IndentingWriter.class
DesignDoc.class DesignDoc.java Stylesheet.class
Stylesheet.java
java/design/xml design-all.xml design-datatypes.ent
design-grammars.ent design-identity.ent
design-impl.ent design-models.ent
design-parsers.ent design-util.ent
design-validation.ent design-xni.ent design.dtd
design.xml issues.dtd issues.xml people.ent
person.dtd schedule.dtd schedule.xml types-dom.ent
types-java.ent types-sax.ent
java/design/xsl design.xsl issues.xsl schedule.xsl
java/docs limitations.xml samples-dom.xml samples-sax.xml
samples-socket.xml samples-ui.xml samples-xni.xml
xni-components-dependence.gif
xni-components-overview.gif xni-config.xml
xni-core.xml xni-design.xml xni-entity-manager.gif
xni-parser-configuration.gif xni-pipeline-basic.gif
xni-pipeline-detailed.gif xni-xerces2.xml xni.xml
java/docs/dtd design.dtd releases.dtd settings.dtd
java/docs/style loader.xml
java/docs/style/graphics button-a.gif button-b.gif
java/docs/style/resources bottom.gif button-asf-hi.gif
button-asf-lo.gif button-w3c-hi.gif
button-w3c-lo.gif button-xml-hi.gif
button-xml-lo.gif changes-add.jpg changes-fix.jpg
changes-remove.jpg changes-update.jpg close.gif
dot.gif join.gif line.gif logo.gif note.gif
right.gif script.js separator.gif void.gif
java/docs/style/stylesheets any2header.xsl any2project.xsl
book2group.xsl book2project.xsl
changes2document.xsl context2footer.xsl
context2label.xsl design2document.xsl
design2html.xsl directory2project.xsl
document2html.xsl faqs2document.xsl
group2document.xsl releases2document.xsl
settings2document.xsl
java/samples/dom Counter.java GetElementsByTagName.java
ParserWrapper.java Writer.java
java/samples/dom/wrappers Xerces.java
java/samples/sax Counter.java Writer.java
java/samples/socket DelayedInput.java KeepSocketOpen.java
java/samples/socket/io WrappedInputStream.java
WrappedOutputStream.java
java/samples/xni Counter.java DocumentTracer.java
PassThroughFilter.java UpperCaseFilter.java
Writer.java
java/samples/xni/parser AbstractConfiguration.java
CSVConfiguration.java CSVParser.java
NonValidatingParserConfiguration.java
java/src/org/apache/xerces/impl Constants.java Version.java
XMLDTDScannerImpl.java XMLDTDValidator.java
XMLDocumentScannerImpl.java XMLEntityHandler.java
XMLEntityManager.java XMLEntityScanner.java
XMLErrorReporter.java XMLNamespaceBinder.java
XMLScanner.java
java/src/org/apache/xerces/impl/io ASCIIReader.java
UTF8Reader.java
java/src/org/apache/xerces/impl/msg DatatypeMessages.java
ExceptionMessages.java
ExceptionMessagesLocalizer.java
ImplementationMessages.java SchemaMessages.java
XMLMessageFormatter.java XMLMessages.properties
java/src/org/apache/xerces/impl/v1 AllContentModel.java
CMAny.java CMBinOp.java CMException.java
CMLeaf.java CMNode.java CMStateSet.java
CMUniOp.java ContentLeafNameTypeVector.java
DFAContentModel.java ElementWildcard.java
Grammar.java GrammarResolver.java
GrammarResolverImpl.java
InsertableElementsInfo.java MixedContentModel.java
SimpleContentModel.java
StandardParserConfiguration.java
XMLAttributeDecl.java XMLContentModel.java
XMLContentSpec.java XMLElementDecl.java
XMLValidator.java
java/src/org/apache/xerces/impl/v1/datatype
AbstractDatatypeValidator.java
AbstractNumericFacetValidator.java
AbstractNumericValidator.java
AbstractStringValidator.java
AnyURIDatatypeValidator.java
Base64BinaryDatatypeValidator.java
BooleanDatatypeValidator.java
DatatypeMessageProvider.java DatatypeValidator.java
DatatypeValidatorFactory.java
DatatypeValidatorFactoryImpl.java
DateDatatypeValidator.java
DateTimeDatatypeValidator.java
DateTimeValidator.java DayDatatypeValidator.java
DecimalDatatypeValidator.java
DoubleDatatypeValidator.java
DurationDatatypeValidator.java
ENTITYDatatypeValidator.java
FloatDatatypeValidator.java
HexBinaryDatatypeValidator.java
IDDatatypeValidator.java
IDREFDatatypeValidator.java
InvalidDatatypeFacetException.java
InvalidDatatypeValueException.java
ListDatatypeValidator.java
MonthDatatypeValidator.java
MonthDayDatatypeValidator.java
NOTATIONDatatypeValidator.java
QNameDatatypeValidator.java
SchemaDateTimeException.java
StateMessageDatatype.java
StringDatatypeValidator.java
TimeDatatypeValidator.java
UnionDatatypeValidator.java XMLException.java
YearDatatypeValidator.java
YearMonthDatatypeValidator.java
java/src/org/apache/xerces/impl/v1/dtd DTDGrammar.java
java/src/org/apache/xerces/impl/v1/msg DatatypeMessages.java
ExceptionMessages.java
ExceptionMessagesLocalizer.java Implementation.java
ImplementationMessages.java SchemaMessages.java
XML.java XMLMessageProvider.java XMLMessages.java
java/src/org/apache/xerces/impl/v1/schema
GeneralAttrCheck.java SchemaGrammar.java
SchemaMessageProvider.java SchemaSymbols.java
SubstitutionGroupComparator.java
TraverseSchema.java XUtil.java datatypes.dtd
structures.dtd versionInfo.ent
java/src/org/apache/xerces/impl/v1/schema/identity
Field.java FieldActivator.java IDValue.java
IdentityConstraint.java Key.java KeyRef.java
Selector.java Unique.java ValueStore.java
XPath.java XPathException.java XPathMatcher.java
java/src/org/apache/xerces/impl/v1/util Base64.java
Hash2intTable.java HexBin.java IntStack.java
java/src/org/apache/xerces/impl/v1/util/regex BMPattern.java
Match.java Op.java ParseException.java
ParserForXMLSchema.java REUtil.java RangeToken.java
RegexParser.java RegularExpression.java Token.java
message.properties message_fr.properties
message_ja.properties
java/src/org/apache/xerces/impl/validation
ContentModelValidator.java DatatypeValidator.java
DatatypeValidatorFactory.java Grammar.java
GrammarPool.java InvalidDatatypeFacetException.java
InvalidDatatypeValueException.java
XMLAttributeDecl.java XMLContentSpec.java
XMLElementDecl.java XMLEntityDecl.java
XMLNotationDecl.java XMLSimpleType.java
java/src/org/apache/xerces/impl/validation/datatypes
AbstractDatatypeValidator.java
DatatypeMessageProvider.java
DatatypeValidatorFactoryImpl.java
ENTITYDatatypeValidator.java
IDDatatypeValidator.java
IDREFDatatypeValidator.java
ListDatatypeValidator.java
NMTOKENDatatypeValidator.java
NOTATIONDatatypeValidator.java
StatefullDatatypeValidator.java
StringDatatypeValidator.java
java/src/org/apache/xerces/impl/validation/grammars
DTDGrammar.java
java/src/org/apache/xerces/impl/validation/models CMAny.java
CMBinOp.java CMLeaf.java CMNode.java
CMStateSet.java CMUniOp.java DFAContentModel.java
MixedContentModel.java SimpleContentModel.java
java/src/org/apache/xerces/parsers AbstractDOMParser.java
AbstractSAXParser.java
AbstractXMLDocumentParser.java
BasicParserConfiguration.java
CachingParserPool.java DTDParser.java
StandardParserConfiguration.java
XMLDocumentParser.java XMLGrammarParser.java
XMLParser.java
java/src/org/apache/xerces/util DefaultErrorHandler.java
EncodingMap.java EntityResolverWrapper.java
ErrorHandlerWrapper.java MessageFormatter.java
NamespaceSupport.java SymbolTable.java URI.java
XMLAttributesImpl.java XMLChar.java
XMLStringBuffer.java
java/src/org/apache/xerces/xni NamespaceContext.java
QName.java XMLAttributes.java
XMLDTDContentModelHandler.java XMLDTDHandler.java
XMLDocumentFragmentHandler.java
XMLDocumentHandler.java XMLLocator.java
XMLString.java XNIException.java
java/src/org/apache/xerces/xni/parser XMLComponent.java
XMLComponentManager.java
XMLConfigurationException.java
XMLDTDContentModelSource.java XMLDTDScanner.java
XMLDTDSource.java XMLDocumentScanner.java
XMLDocumentSource.java XMLEntityResolver.java
XMLErrorHandler.java XMLInputSource.java
XMLParseException.java XMLParserConfiguration.java
XMLPullParserConfiguration.java
java/src/org/w3c/dom package.html
java/src/org/w3c/dom/events package.html
java/src/org/w3c/dom/html package.html
java/src/org/w3c/dom/ranges package.html
java/src/org/w3c/dom/traversal package.html
java/src/org/xml/sax package.html
java/src/org/xml/sax/ext package.html
java/src/org/xml/sax/helpers package.html
Removed: java Makefile RELEASE-PLAN-1.3.1 RELEASE-PLAN-1.4
java/docs faq-migrate.xml javapurecheck.xml sam-domcount.xml
sam-domfilter.xml sam-domwriter.xml
sam-iterator.xml sam-tree.xml sam-treeview.xml
schema.xml site-book.xml
java/samples Makefile
java/samples/dom DOMCount.java DOMFilter.java
DOMParserWrapper.java DOMWriter.java Makefile
java/samples/dom/traversal Makefile
java/samples/dom/wrappers DOMParser.java Makefile
java/samples/sax DTDReader.java Makefile SAX2Count.java
SAX2Writer.java SAXCount.java SAXWriter.java
java/samples/sax/helpers AttributeListImpl.java Makefile
java/samples/ui Makefile
java/samples/util Arguments.java Makefile
java/src Makefile Makefile.incl classfiles_updated
java/src/javax Makefile
java/src/javax/xml Makefile
java/src/javax/xml/parsers Makefile
java/src/org Makefile
java/src/org/apache Makefile
java/src/org/apache/html Makefile
java/src/org/apache/html/dom Makefile
java/src/org/apache/wml Makefile
java/src/org/apache/wml/dom Makefile
java/src/org/apache/xerces Makefile
java/src/org/apache/xerces/dom DeferredAttrImpl.java
DeferredAttrNSImpl.java
DeferredCDATASectionImpl.java
DeferredCommentImpl.java DeferredDocumentImpl.java
DeferredDocumentTypeImpl.java
DeferredElementDefinitionImpl.java
DeferredElementImpl.java DeferredElementNSImpl.java
DeferredEntityImpl.java
DeferredEntityReferenceImpl.java DeferredNode.java
DeferredNotationImpl.java
DeferredProcessingInstructionImpl.java
DeferredTextImpl.java Makefile
java/src/org/apache/xerces/dom/events Makefile
java/src/org/apache/xerces/domx Makefile XGrammarWriter.java
java/src/org/apache/xerces/framework Makefile Version.java
XMLAttrList.java XMLContentSpec.java
XMLDTDScanner.java XMLDocumentHandler.java
XMLDocumentScanner.java XMLErrorReporter.java
XMLParser.java
java/src/org/apache/xerces/jaxp Makefile
java/src/org/apache/xerces/msg DatatypeMessages.java
ExceptionMessages.java
ExceptionMessagesLocalizer.java
ImplementationMessages.java Makefile
SchemaMessages.java XMLMessages.java
java/src/org/apache/xerces/parsers Makefile
java/src/org/apache/xerces/readers AbstractCharReader.java
CharReader.java DefaultEntityHandler.java
DefaultReaderFactory.java EBCDICRecognizer.java
MIME2Java.java Makefile StreamingCharReader.java
StringReader.java UCSReader.java UCSRecognizer.java
UTF8CharReader.java UTF8Reader.java
UTF8Recognizer.java XCatalog.java
XMLCatalogHandler.java XMLDeclRecognizer.java
XMLEntityHandler.java XMLEntityReader.java
XMLEntityReaderFactory.java xcatalog.dtd
java/src/org/apache/xerces/utils Base64.java
CharDataChunk.java ChunkyByteArray.java
ChunkyCharArray.java Hash2intTable.java HexBin.java
ISO8601Format.java ImplementationMessages.java
IntStack.java Makefile NamespacesScope.java
QName.java StringHasher.java StringPool.java
SymbolCache.java URI.java UTF8DataChunk.java
XMLCharacterProperties.java XMLMessageProvider.java
XMLMessages.java
java/src/org/apache/xerces/utils/regex BMPattern.java
Makefile Match.java Op.java ParseException.java
ParserForXMLSchema.java REUtil.java RangeToken.java
RegexParser.java RegularExpression.java Token.java
message.properties message_fr.properties
message_ja.properties
java/src/org/apache/xerces/validators Makefile
java/src/org/apache/xerces/validators/common
AllContentModel.java CMAny.java CMBinOp.java
CMException.java CMLeaf.java CMNode.java
CMStateSet.java CMUniOp.java
ContentLeafNameTypeVector.java DFAContentModel.java
ElementWildcard.java Grammar.java
GrammarResolver.java GrammarResolverImpl.java
InsertableElementsInfo.java Makefile
MixedContentModel.java SimpleContentModel.java
XMLAttributeDecl.java XMLContentModel.java
XMLElementDecl.java XMLValidator.java
java/src/org/apache/xerces/validators/datatype
AbstractDatatypeValidator.java
AbstractNumericFacetValidator.java
AbstractNumericValidator.java
AbstractStringValidator.java AnySimpleType.java
AnyURIDatatypeValidator.java
Base64BinaryDatatypeValidator.java
BooleanDatatypeValidator.java
DatatypeMessageProvider.java DatatypeValidator.java
DatatypeValidatorFactory.java
DatatypeValidatorFactoryImpl.java
DateDatatypeValidator.java
DateTimeDatatypeValidator.java
DateTimeValidator.java DayDatatypeValidator.java
DecimalDatatypeValidator.java
DoubleDatatypeValidator.java
DurationDatatypeValidator.java
ENTITYDatatypeValidator.java
FloatDatatypeValidator.java
HexBinaryDatatypeValidator.java
IDDatatypeValidator.java
IDREFDatatypeValidator.java
InvalidDatatypeFacetException.java
InvalidDatatypeValueException.java
ListDatatypeValidator.java Makefile
MonthDatatypeValidator.java
MonthDayDatatypeValidator.java
NOTATIONDatatypeValidator.java
QNameDatatypeValidator.java
SchemaDateTimeException.java
StateMessageDatatype.java
StringDatatypeValidator.java
TimeDatatypeValidator.java
UnionDatatypeValidator.java XMLException.java
YearDatatypeValidator.java
YearMonthDatatypeValidator.java
java/src/org/apache/xerces/validators/dtd DTDGrammar.java
Makefile
java/src/org/apache/xerces/validators/schema
GeneralAttrCheck.java Makefile SchemaGrammar.java
SchemaMessageProvider.java SchemaSymbols.java
SubstitutionGroupComparator.java
TraverseSchema.java XUtil.java
java/src/org/apache/xerces/validators/schema/identity
Field.java FieldActivator.java IDValue.java
IdentityConstraint.java Key.java KeyRef.java
Makefile Selector.java Unique.java ValueStore.java
XPath.java XPathException.java XPathMatcher.java
java/src/org/apache/xml Makefile
java/src/org/apache/xml/serialize Makefile
java/src/org/w3c Makefile
java/src/org/w3c/dom Makefile
java/src/org/w3c/dom/events Makefile
java/src/org/w3c/dom/html Makefile
java/src/org/w3c/dom/ranges Makefile
java/src/org/w3c/dom/traversal Makefile
java/src/org/xml Makefile
java/src/org/xml/sax Makefile
java/src/org/xml/sax/ext Makefile
java/src/org/xml/sax/helpers Makefile
java/src/whiteboard/org/apache/xerces/tree
AttributeListEx.java AttributeNode.java
AttributeSet.java CDataNode.java CommentNode.java
DataNode.java Doctype.java DocumentEx.java
DomEx.java DtdEventListener.java ElementEx.java
ElementFactory.java ElementNode.java
MessageCatalog.java NamespaceScoped.java
NamespacedNode.java NodeBase.java NodeEx.java
PINode.java ParentNode.java ParseContext.java
README Resolver.java SimpleElementFactory.java
TextNode.java TreeWalker.java XmlChars.java
XmlDocument.java XmlDocumentBuilder.java
XmlNames.java XmlReadable.java XmlReader.java
XmlWritable.java XmlWriteContext.java
java/src/whiteboard/org/apache/xerces/tree/resources
Messages_en.properties
java/tests Makefile
java/tests/dom Makefile
java/tests/dom/events DeferredDOM.java Makefile
java/tests/dom/html Test.java
java/tests/dom/mem Makefile
java/tests/dom/range Makefile
java/tests/dom/serialize Makefile
java/tests/dom/util Makefile
java/tools style-apachexml-Makefile
Log:
Merge/move of Xerces 2 to the trunc!
Revision Changes Path
1.2 +1 -1 xml-xerces/java/LICENSE
Index: LICENSE
===================================================================
RCS file: /home/cvs/xml-xerces/java/LICENSE,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LICENSE 2000/02/01 19:28:43 1.1
+++ LICENSE 2001/08/23 00:35:11 1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.6 +30 -78 xml-xerces/java/README
Index: README
===================================================================
RCS file: /home/cvs/xml-xerces/java/README,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- README 2000/06/03 00:12:21 1.5
+++ README 2001/08/23 00:35:11 1.6
@@ -1,89 +1,41 @@
- Xerces Java Build Instructions
+ Xerces Java Build Instructions
+ ------------------------------
-Table of Contents
+Before building Xerces, you need the source package and tools
+package available from the Apache XML Project's distribution
+web page:
- 1. Building Xerces
- 2. Building Documentation
- 3. Special Instructions
- 3.1 Building on Windows Platform
- 3.2 Building on UNIX Platform
+ http://xml.apache.org/dist/xerces-j/
----------------------------------------------------------------------
+Download both the Xerces-J-src.X.Y.Z.zip and Xerces-J-tools.X.Y.Z.zip
+files for the appropriate Xerces release (where "X.Y.Z" is the version
+number) and extract them in the same directory. If you are using Unix,
+download the equivalent .tar.gz files instead of the .zip files.
-1. Building Xerces
+You also need to have a Java Development Kit (JDK) version 1.2 (or
+higher) installed on your system. Before initiating any part of the
+build, set the JAVA_HOME environment variable to the installation
+directory of your JDK.
- The top level Makefile will build everything, including the
- documentation. If you only want to compile the source code and
- make the JAR files, run the following command from the top of
- the Xerces Java tree:
-
- make jars
-
- If you want to build everything, including the documentation,
- read the following instructions before running make.
-
- When building, all special instructions must be followed.
+The Ant program is used to build everything in Xerces, including
+the documentation. This tool, and the others needed (besides the
+pre-requisite JDK) are contained within the tools package. To
+make building the packages easier, a Windows batch file and a Unix
+shell script are included.
-2. Building Documentation
+If you only want to compile the source code and make the JAR files,
+run the following command on Windows:
- You must download the tools required for building the documentation
- from the distribution page (http://xml.apache.org/dist/). Download
- the following tools ZIP file:
+ build.bat jars
- Xerces-J-tools.x.y.z.zip
+or from Unix (make sure that build.sh is executable):
- where "x.y.z" is either the exact version or the version just before
- the version of the Xerces-J parser for which you want to build the
- documentation. Extract the tools package in the top directory of the
- Xerces Java tree so that you get something like:
+ build.sh jars
- xerces_a_b_c/tools
+This will compile all of the source code and generate the JAR
+files that are available as part of the binary package. After
+building, these files will be located in the build/ directory.
- Then, from the top of the Xerces Java tree, type the following
- command to build the documentation:
-
- make docs apidocs
-
-3. Special Instructions
-
-3.1 Building on Windows Platform
-
- First, you need a copy of Cygnus's Cygwin. See
- http://sourceware.cygnus.com/cygwin.
-
- If your JDK is properly installed on your system, you do not need
- to set any CLASSPATH to build Xerces. If you have one, make sure
- it does not end with a '\' or it will cause the build to fail.
-
- If you're using JDK 1.1 and want to build the documentation you
- then need to specify where the JDK 1.2 java and javadoc programs
- are by setting the variable JDK12BIN in your environment with
- something like:
-
- set JDK12BIN=C:/jdk1.2.2/bin
-
- Note the use of forward slashes! Depending on which version of
- make you are using having blackshlashes there may cause the build
- to fail.
-
- Then, if you're not using the Cygwin bash shell, you need to set
- the variable MAKE_MODE in your environment like this:
-
- set MAKE_MODE=UNIX
-
- Finally, from the top of the Xerces Java tree, run make.
-
-3.2 Building on Unix Platform
-
- If your JDK is properly installed on your system, you do not
- need to set any CLASSPATH to build Xerces.
-
- If you're using JDK 1.1 and want to build the documentation you
- then need to specify where the JDK 1.2 java and javadoc programs
- are by setting the variable JDK12BIN in your environment with
- something like:
-
- set JDK12BIN "/usr/local/jdk-1.2.2/bin"
-
- Then, from the top of the Xerces Java tree, run make.
-
+If you want to build everything, including the documentation,
+run the build batch file (or shell script) specifying the "all"
+target instead of "jars".
\ No newline at end of file
1.2 +23 -12 xml-xerces/java/Readme.html
Index: Readme.html
===================================================================
RCS file: /home/cvs/xml-xerces/java/Readme.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Readme.html 1999/12/29 01:11:26 1.1
+++ Readme.html 2001/08/23 00:35:11 1.2
@@ -1,14 +1,25 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
- "http://www.w3.org/TR/REC-html40/strict.dtd">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
-<head>
-<meta http-equiv="Refresh" content="0; URL=docs/html/index.html">
-<title></title>
-</head>
-<body>
-This document will redirect you to the real documenation which starts at docs/index.html.
-<p>
-If your browser doesn't support redirects, or you are looking at this file from the download
-package, you will need to go to docs/html/index.html manually.
-</body>
+ <head>
+ <meta http-equiv="Refresh" content="3; URL=docs/index.html">
+ <title>Xerces Java Parser</title>
+ </head>
+ <body>
+ <h1 align='center'>Xerces Java Parser</h1>
+ <h2>Redirecting to Documentation...</h2>
+ <p>
+ In a few seconds, you should be redirected to the Xerces Java Parser
+ documentation. If you are not automatically redirected, please click
+ on the following link:
+ <blockquote>
+ <a href='docs/index.html'>Xerces Java Documentation</a>
+ </blockquote>
+ </p>
+ <p>
+ <strong>Note:</strong>
+ You must download the binary distribution to get the documentation.
+ If you downloaded the source distribution, then you must build the
+ documentation first.
+ </p>
+ </body>
</html>
1.8 +19 -50 xml-xerces/java/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/xml-xerces/java/STATUS,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- STATUS 2000/05/11 16:31:37 1.7
+++ STATUS 2001/08/23 00:35:11 1.8
@@ -1,54 +1,23 @@
-This is the Status file for the Xerces for Java code base.
+This is the Status file for the Xerces for Java code base.
+This file provides an overview of the things that need to
+be done. However, specific action items are enumerated in
+the TODO file.
There are lots of things that need to be done:
-* Additional Support for W3C XML schema. (andyc, ericy, jeffr are
- working on it)
+* Performance, performance, performance!
+* Conformance, conformance, conformance!
+* Kill bugs
+
+* W3C XML Schema support
+* Grammar caching
+* Grammar access
+* Re-validation
+* Pull parsing
+
+* Documentation
+* Samples
+* Scripts to build parser subconfigurations
+* Additional configuration options
-* Figuring out what support for DTD access should look like. This
- version of Xerces supports access to the DTD via a special node in
- the DOM tree. There's also room for a more programmatic API to the
- DTD / Schema. This is a meaty one, and would be a good place for
- somebody to jump in and help.
-
-* Enabling support for a DTD Caching mechanism. This would be
- especially beneficial in a server environment. Part of the work
- that helps Schema will help this.
-
-* Revalidation architecture work (i.e. How to validate, after a DOM
- tree has been edited - we used to be able to do this...)
-
-* DOM Write validation (i.e. what is legal to insert here?)
-
-* refinement and extension of the incremental parsing API
-
-* scripts to build parser subconfigurations (i.e. if I don't need
- WML/WAP, take it out of the jar)
-
-* additional configuration options.
-
-* performance, performance, performance. Always need help here.
-
-* conformance, conformance, conformance. We're pretty darn good, but
- we can always do better.
-
-* a bunch of things that haven't been thought of yet.
-
-* more documentation. The docs need to be updated, especially the FAQ.
-
-* more samples (lots, especially code fragments that accomplish specific
- tasks)
-
-* kill bugs (always)
-
-* Major work on the build system.
-
- ANT vs Makefiles is the current discussion
- Is ANT ready for us to use? It has to get beyond the "compile everything"
- stage, because we have files (e.g. for Schema) that should NOT be compiled
- into the build yet.
-
-* Hook up JavaScript DOM API tests (see http://www.nist.gov/xml)
-
-* JAXP Wrappers for Xerces
- [pending resolution of licensing issues]
+* Anything else?
1.50 +104 -36 xml-xerces/java/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/build.xml,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- build.xml 2001/08/20 14:47:44 1.49
+++ build.xml 2001/08/23 00:35:11 1.50
@@ -52,7 +52,7 @@
Copyright:
Copyright (c) 2000 The Apache Software Foundation.
- $Id: build.xml,v 1.49 2001/08/20 14:47:44 neilg Exp $
+ $Id: build.xml,v 1.50 2001/08/23 00:35:11 lehors Exp $
==================================================================== -->
@@ -61,9 +61,9 @@
<target name="init">
<property name="name" value="xerces"/>
<property name="Name" value="Xerces-J"/>
- <property name="version" value="1.4.3"/>
- <property name="version_postfix" value=".1.4.3"/>
- <property name="appendit" value="1_4_3"/>
+ <property name="version" value="2.0.0 (beta)"/>
+ <property name="version_postfix" value=".2.0.0.beta"/>
+ <property name="appendit" value="2_0_0_beta"/>
<property name="year" value="1999-2001"/>
<property name="copyright" value="Copyright © ${year} Apache XML Project. All Rights Reserved."/>
@@ -80,7 +80,7 @@
<property name="tests.dir" value="./tests"/>
<property name="tools.dir" value="./tools"/>
<property name="docs.book" value="${docs.dir}/docs-book.xml"/>
- <property name="version.file" value="org/apache/xerces/framework/Version.java"/>
+ <property name="version.file" value="org/apache/xerces/impl/Version.java"/>
<property name="packages" value="org.*"/>
@@ -92,7 +92,7 @@
<property name="build.dir" value="./build"/>
<property name="build.src" value="${build.dir}/src"/>
<property name="build.dest" value="${build.dir}/classes"/>
- <property name="build.docs" value="${build.dir}/docs/html"/>
+ <property name="build.docs" value="${build.dir}/docs"/>
<property name="build.samples" value="${build.dir}/samples"/>
<property name="build.tests" value="${build.dir}/tests"/>
<property name="build.data" value="${build.dir}/data"/>
@@ -170,16 +170,14 @@
<fileset
dir="${src.dir}"
includes="**/Makefile, **/Makefile.incl, javax/**, org/**"
- excludes="**/classfiles_updated **/CVS* **/.#*
+ excludes="**/classfiles_updated **/CVS* **/.#* **/XMLMessages.java
**/SchemaImporter.java **/RevalidatingDOMParser.java
**/DatatypeContentModel.java **/ComplexTypeInfo.java
- **/DTDImporter.java ">
+ **/DTDImporter.java
+ **/v1/** **/v2/**">
</fileset>
</copy>
-
- <delete dir="${build.src}/whiteboard"/>
-
<!-- substitute tokens as needed -->
<replace file="${build.src}/${version.file}" token="@@version@@" value="${version}"/>
<!-- <replace file="${build.src}/${version.file}" token="@@year@@" value="${year}"/> -->
@@ -194,8 +192,9 @@
includes="**/*.res, **/*.properties">
</fileset>
</copy>
+
<javac srcdir="${build.src}"
- excludes="**/RevalidatingDOMParser.java "
+ excludes="**/RevalidatingDOMParser.java"
classpath="${compilation.classpath}"
destdir="${build.dest}"
debug="${debug}"
@@ -211,7 +210,7 @@
<jar jarfile="${build.dir}/${name}.jar"
basedir="${build.dest}"
compress="false"
- includes="org/**, javax/**,META-INF/**, org/apache/xerces/utils/regex/*.properties"/>
+ includes="org/**, javax/**,META-INF/**"/>
</target>
<!-- =================================================================== -->
@@ -223,6 +222,7 @@
<fileset dir="${samples.dir}" />
</copy>
<javac srcdir="${build.samples}"
+ excludes="**/DOMAddLines.java "
destdir="${build.dest}"
classpath="${build.dir}/${name}.jar"
debug="${debug}"
@@ -235,8 +235,7 @@
<target name="tests" depends="samples">
<mkdir dir="${build.tests}"/>
<copy todir="${build.tests}">
- <fileset dir="${tests.dir}" excludes="io/**"
- />
+ <fileset dir="${tests.dir}" />
</copy>
<javac srcdir="${build.tests}"
destdir="${build.dest}"
@@ -251,7 +250,7 @@
<jar jarfile="${build.dir}/${name}Samples.jar"
basedir="${build.dest}"
compress="false"
- includes="dom/**,sax/**,ui/**,util/**"/>
+ includes="dom/**,sax/**,socket/**,ui/**,xni/**"/>
</target>
<!-- =================================================================== -->
@@ -279,6 +278,7 @@
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadocs" depends="prepare-src">
+ <!--
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="${packages}"
sourcepath="${build.src}"
@@ -289,6 +289,43 @@
windowtitle="${Name} API"
doctitle="${Name}"
bottom="${copyright}" />
+ -->
+ <mkdir dir='${build.dir}/docs/javadocs/api'/>
+ <javadoc packagenames='javax.xml.parsers,org.w3c.*,org.xml.*'
+ sourcepath='${build.src}' destdir='${build.dir}/docs/javadocs/api'
+ author='true' version='true'
+ windowtitle='XML Standard API' doctitle='XML Standard API'
+ bottom='${copyright}'
+ locale='en_US'/>
+ <mkdir dir='${build.dir}/docs/javadocs/xni'/>
+ <javadoc packagenames='org.apache.xerces.xni.*'
+ sourcepath='${build.src}' destdir='${build.dir}/docs/javadocs/xni'
+ author='true' version='true'
+ windowtitle='Xerces Native Interface'
+ doctitle='Xerces Native Interface'
+ bottom='${copyright}'
+ locale='en_US'/>
+ <mkdir dir='${build.dir}/docs/javadocs/xerces2'/>
+ <javadoc packagenames='org.apache.xerces.dom.*,
+ org.apache.xerces.impl.*,
+ org.apache.xerces.jaxp,
+ org.apache.xerces.parsers,
+ org.apache.xerces.util'
+ sourcepath='${build.src}' destdir='${build.dir}/docs/javadocs/xerces2'
+ author='true' version='true'
+ windowtitle='Xerces2 Implementation'
+ doctitle='Xerces2 Implementation'
+ bottom='${copyright}'
+ locale='en_US'/>
+ <mkdir dir='${build.dir}/docs/javadocs/other'/>
+ <javadoc packagenames='org.apache.html.*,
+ org.apache.wml.*,
+ org.apache.xml.serialize.*'
+ sourcepath='${build.src}' destdir='${build.dir}/docs/javadocs/other'
+ author='true' version='true'
+ windowtitle='Other Classes' doctitle='Other Classes'
+ bottom='${copyright}'
+ locale='en_US'/>
</target>
<!-- =================================================================== -->
@@ -308,7 +345,8 @@
<fileset
dir="${src.dir}"
includes="**/Makefile, **/Makefile.incl, org/**, javax/**"
- excludes="**/CVS*, **/.#*, **/*.class"
+ excludes="**/CVS*, **/.#*, **/*.class
+ **/v1/** **/v2/**"
/>
</copy>
@@ -323,7 +361,7 @@
<copy todir="${distsrc.dir}/docs" >
<fileset
dir="${docs.dir}"
- excludes="**/CVS*, **/*.#*, pdf/**, html/**, **/apiDocs*"
+ excludes="**/CVS*, **/*.#*, pdf/**, html/**, **/javadocs*"
/>
</copy>
@@ -339,6 +377,8 @@
<copy file="README" tofile="${distsrc.dir}/README"/>
<copy file="Readme.html" tofile="${distsrc.dir}/Readme.html"/>
<copy file="STATUS" tofile="${distsrc.dir}/STATUS"/>
+ <copy file="TODO" tofile="${distsrc.dir}/TODO"/>
+ <copy file="ISSUES" tofile="${distsrc.dir}/ISSUES"/>
<copy file="build.xml" tofile="${distsrc.dir}/build.xml"/>
<copy file="${basedir}/build.sh" tofile="${distsrc.dir}/build.sh" />
<chmod file="${distsrc.dir}/build.sh" perm="ugo+rx" />
@@ -351,12 +391,31 @@
includes="${name}-${appendit}/**" excludes="*.class"/>
<gzip zipfile="${build.dir}/${Name}-src${version_postfix}.tar.gz"
src="${build.dir}/${Name}-src${version_postfix}.tar" />
+ <!-- and why not get rid of the un-gzip'd tarball and save ourselves 15 Mb? -->
+ <delete file="${build.dir}/${Name}-src${version_postfix}.tar"/>
+ </target>
+
+ <!-- Prepares the tools distribution -->
+ <target name="tools" depends="init">
+ <echo message="Building the tools distribution files (zip,tar)"/>
+ <delete dir="${distbin.dir}"/>
+ <mkdir dir="${distbin.dir}"/>
+ <mkdir dir="${distbin.dir}/tools"/>
+ <copy todir="${distbin.dir}/tools" >
+ <fileset dir="tools"/>
+ </copy>
+ <zip zipfile="${build.dir}/${Name}-tools${version_postfix}.zip" basedir="${build.dir}"
+ includes="${name}-${appendit}/**"/>
+ <tar tarfile="${build.dir}/${Name}-tools${version_postfix}.tar" basedir="${build.dir}"
+ includes="${name}-${appendit}/**"/>
+ <gzip zipfile="${build.dir}/${Name}-tools${version_postfix}.tar.gz"
+ src="${build.dir}/${Name}-tools${version_postfix}.tar" />
</target>
<!-- =================================================================== -->
<!-- Prepares the binary distribution -->
<!-- =================================================================== -->
- <target name="pack-bin" depends="jar, sampjar, javadocs, docs">
+ <target name="pack-bin" depends="jars, javadocs, docs">
<echo message="Building the binary distribution files (zip,tar)"/>
<delete dir="${distbin.dir}"/>
@@ -367,7 +426,6 @@
<mkdir dir="${distbin.dir}/docs/html/apiDocs"/>
<mkdir dir="${distsrc.dir}/samples"/>
-
<copy todir="${distbin.dir}/data" >
<fileset
dir="${data.dir}"
@@ -375,12 +433,21 @@
/>
</copy>
- <copy todir="${distbin.dir}/docs/html" >
+ <copy todir="${distbin.dir}/docs" >
<fileset dir="${build.docs}" />
</copy>
- <copy todir="${distbin.dir}/docs/html/apiDocs" >
- <fileset dir="${build.javadocs}" />
+ <copy todir="${distbin.dir}/docs/javadocs/api" >
+ <fileset dir="${build.dir}/docs/javadocs/api" />
+ </copy>
+ <copy todir="${distbin.dir}/docs/javadocs/xni" >
+ <fileset dir="${build.dir}/docs/javadocs/xni" />
+ </copy>
+ <copy todir="${distbin.dir}/docs/javadocs/xerces2" >
+ <fileset dir="${build.dir}/docs/javadocs/xerces2" />
+ </copy>
+ <copy todir="${distbin.dir}/docs/javadocs/other" >
+ <fileset dir="${build.dir}/docs/javadocs/other" />
</copy>
<copy file="${build.dir}/${name}.jar" tofile="${distbin.dir}/${name}.jar"/>
@@ -396,13 +463,17 @@
/>
</copy>
+ <copydir src="${samples.dir}" dest="${distsrc.dir}/samples" excludes="**/CVS*, **/*.#*"/>
+
<zip zipfile="${build.dir}/${Name}-bin${version_postfix}.zip" basedir="${build.dir}"
includes="${name}-${appendit}/**" excludes="*.class"/>
<tar tarfile="${build.dir}/${Name}-bin${version_postfix}.tar" basedir="${build.dir}"
includes="${name}-${appendit}/**" excludes="*.class"/>
<gzip zipfile="${build.dir}/${Name}-bin${version_postfix}.tar.gz"
src="${build.dir}/${Name}-bin${version_postfix}.tar" />
+ <!-- as before, let's kill of the ungzip'd tarball! -->
+ <delete file="${build.dir}/${Name}-bin${version_postfix}.tar"/>
</target>
@@ -412,36 +483,33 @@
<target name="test" depends="sampjar">
<echo message="Performing sanity test for ${Name} ${version} ..." />
<echo message="Using classpath='${build.dir}/${name}Samples.jar;${build.dir}/${name}.jar'" />
- <echo message="Running SAXCount ..." />
- <java fork="yes"
- classpath="${build.dir}/${name}Samples.jar:${build.dir}/${name}.jar;"
- classname="sax.SAXCount"
- args="${data.dir}/personal.xml"/>
- <echo message="Running SAX2Count ..." />
+ <echo message="Running sax.Counter ..." />
<java fork="yes"
classpath="${build.dir}/${name}Samples.jar:${build.dir}/${name}.jar;"
- classname="sax.SAX2Count"
+ classname="sax.Counter"
args="${data.dir}/personal.xml"/>
- <echo message="Running SAXWriter ..." />
+ <echo message="Running sax.Writer ..." />
<java fork="yes"
classpath="${build.dir}/${name}Samples.jar:${build.dir}/${name}.jar"
- classname="sax.SAXWriter"
+ classname="sax.Writer"
args="${data.dir}/personal.xml"/>
- <echo message="Running DOMCount ..." />
+ <echo message="Running dom.Counter ..." />
<java fork="yes"
classpath="${build.dir}/${name}Samples.jar:${build.dir}/${name}.jar"
- classname="dom.DOMCount"
+ classname="dom.Counter"
args="${data.dir}/personal.xml"/>
- <echo message="Running DOMWriter ..." />
+ <echo message="Running dom.Writer ..." />
<java fork="yes"
classpath="${build.dir}/${name}Samples.jar:${build.dir}/${name}.jar"
- classname="dom.DOMWriter"
+ classname="dom.Writer"
args="${data.dir}/personal.xml"/>
<echo message="Running DOMFilter ..." />
+ <!--
<java fork="yes"
classpath="${build.dir}/${name}Samples.jar:${build.dir}/${name}.jar"
classname="dom.DOMFilter"
args="-p dom.wrappers.DOMParser ${data.dir}/personal.xml"/>
+ -->
<!-- The following are samples but not command-line applications.
<echo message="Running IteratorView ..." />
<java fork="yes"
1.2 +39 -0 xml-xerces/java/ISSUES
1.2 +30 -0 xml-xerces/java/TODO
1.2 +286 -0 xml-xerces/java/design/architecture.html
1.2 +162 -0 xml-xerces/java/design/coding.html
1.2 +94 -0 xml-xerces/java/design/crimson.html
1.2 +2368 -0 xml-xerces/java/design/design.html
1.2 +216 -0 xml-xerces/java/design/design.xsl
1.2 +325 -0 xml-xerces/java/design/design.zip
<<Binary file>>
1.2 +230 -0 xml-xerces/java/design/entities.html
1.2 +241 -0 xml-xerces/java/design/index.html
1.2 +118 -0 xml-xerces/java/design/issues.html
1.2 +312 -0 xml-xerces/java/design/schedule.html
1.2 +287 -0 xml-xerces/java/design/validation.htm
1.2 +109 -0 xml-xerces/java/design/xerces.html
1.2 +22 -0 xml-xerces/java/design/css/design.css
1.2 +20 -0 xml-xerces/java/design/css/diagram.css
1.2 +2 -0 xml-xerces/java/design/css/index.css
1.2 +26 -0 xml-xerces/java/design/css/site.css
1.2 +1 -0 xml-xerces/java/design/images/arrow-right.gif
<<Binary file>>
1.2 +14 -0 xml-xerces/java/design/images/pipeline.gif
<<Binary file>>
1.2 +63 -0 xml-xerces/java/design/images/table.gif
<<Binary file>>
1.2 +19 -0 xml-xerces/java/design/src/DesignDoc$IndentingWriter.class
<<Binary file>>
1.2 +149 -0 xml-xerces/java/design/src/DesignDoc.class
<<Binary file>>
1.2 +1172 -0 xml-xerces/java/design/src/DesignDoc.java
1.2 +18 -0 xml-xerces/java/design/src/Stylesheet.class
<<Binary file>>
1.2 +60 -0 xml-xerces/java/design/src/Stylesheet.java
1.2 +4392 -0 xml-xerces/java/design/xml/design-all.xml
1.2 +95 -0 xml-xerces/java/design/xml/design-datatypes.ent
1.2 +56 -0 xml-xerces/java/design/xml/design-grammars.ent
1.2 +368 -0 xml-xerces/java/design/xml/design-identity.ent
1.2 +800 -0 xml-xerces/java/design/xml/design-impl.ent
1.2 +100 -0 xml-xerces/java/design/xml/design-models.ent
1.2 +295 -0 xml-xerces/java/design/xml/design-parsers.ent
1.2 +498 -0 xml-xerces/java/design/xml/design-util.ent
1.2 +781 -0 xml-xerces/java/design/xml/design-validation.ent
1.2 +1374 -0 xml-xerces/java/design/xml/design-xni.ent
1.2 +66 -0 xml-xerces/java/design/xml/design.dtd
1.2 +36 -0 xml-xerces/java/design/xml/design.xml
1.2 +39 -0 xml-xerces/java/design/xml/issues.dtd
1.2 +97 -0 xml-xerces/java/design/xml/issues.xml
1.2 +7 -0 xml-xerces/java/design/xml/people.ent
1.2 +4 -0 xml-xerces/java/design/xml/person.dtd
1.2 +20 -0 xml-xerces/java/design/xml/schedule.dtd
1.2 +139 -0 xml-xerces/java/design/xml/schedule.xml
1.2 +5 -0 xml-xerces/java/design/xml/types-dom.ent
1.2 +23 -0 xml-xerces/java/design/xml/types-java.ent
1.2 +210 -0 xml-xerces/java/design/xml/types-sax.ent
1.2 +216 -0 xml-xerces/java/design/xsl/design.xsl
1.2 +130 -0 xml-xerces/java/design/xsl/issues.xsl
1.2 +128 -0 xml-xerces/java/design/xsl/schedule.xsl
1.7 +101 -149 xml-xerces/java/docs/api.xml
Index: api.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/api.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- api.xml 2001/05/17 18:20:30 1.6
+++ api.xml 2001/08/23 00:35:14 1.7
@@ -1,149 +1,101 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE s1 SYSTEM "./dtd/document.dtd">
-
-<s1 title="API Documentation">
- <s2 title="Javadoc Generated Documentation">
- <p>&javaparsernamelong; comes packaged with API documentation for SAX and DOM,
- the two most common interfaces for programming XML. In addition,
- we provide documentation for classes that are not part of the SAX
- and DOM API's, but are useful for writing &javaparsername; programs. </p>
- <p>This documentation is generated automatically from the Javadoc-style
- comments inside the source files. Click on one of the links below to
- go to the appropriate API documentation.</p>
- </s2>
- <s2 title="&javaparsername; API Documentation">
- <ul>
- <li><jump href="apiDocs/index.html">Full API documentation</jump></li>
- <li><jump href="apiDocs/overview-tree.html">Hierarchy for all the packages</jump></li>
- </ul>
- <s3 title="Package org.apache.xerces.parsers">
- <s4 title="Classes">
- <ul>
- <li>DOMParser</li>
- <li>SAXParser</li>
- </ul>
- </s4>
- <s4 title="Interfaces">
- <ul>
- <li>Attr
- <br/>The Attr interface represents an attribute in an Element object</li>
- <li>CDATASection
- <br/>CDATA sections are used to escape blocks of text containing characters
- that would otherwise be regarded as markup</li>
- <li>CharacterData
- <br/>The CharacterData interface extends Node with a set of attributes and
- methods for accessing character data in the DOM</li>
- <li>Comment
- <br/>This represents the content of a comment</li>
- <li>Document
- <br/>The Document interface represents the entire HTML or XML document</li>
- <li>DocumentFragment
- <br/>DocumentFragment is a "lightweight" or "minimal" Document object</li>
- <li>DocumentType
- <br/>Each Document has a doctype attribute whose value is either null or a
- DocumentType object</li>
- <li>DOMImplementation
- <br/>The DOMImplementation interface provides methods for performing
- operations independent of a particular document object model instance</li>
- <li>Element
- <br/>The majority of objects (apart from text) in a document are Element nodes</li>
- <li>Entity
- <br/>This interface represents an entity, either parsed or unparsed, in a XML
- document</li>
- <li>EntityReference
- <br/>EntityReference objects may be inserted into the structure model</li>
- <li>NamedNodeMap
- <br/>Objects implementing the NamedNodeMap interface are used to represent
- collections of nodes that can be accessed by name</li>
- <li>Node
- <br/>The Node interface is the primary datatype for the entire Document Object
- Model</li>
- <li>NodeList
- <br/>The NodeList interface provides the abstraction of an ordered collection
- of nodes</li>
- <li>Notation
- <br/>This interface represents a notation declared in the DTD</li>
- <li>ProcessingInstruction
- <br/>The ProcessingInstruction is a way to keep processor-specific
- information in the text of the document</li>
- <li>Text
- <br/>The Text interface represents the textual content (termed character data in
- XML) of an Element or Attr</li>
- </ul>
- </s4>
- <s4 title="Exceptions">
- <ul>
- <li>DOMException
- <br/>Encapsulate an "exceptional" DOM error </li>
- </ul>
- </s4>
- </s3>
- <s3 title="Package org.xml.sax">
- <s4 title="Classes">
- <ul>
- <li>HandlerBase
- <br/>Default base class for handlers</li>
- <li>InputSource
- <br/>A single input source for an XML entity </li>
- </ul>
- </s4>
- <s4 title="Interfaces">
- <ul>
- <li>AttributeList
- <br/>Interface for an element's attribute specifications</li>
- <li>DocumentHandler
- <br/>Receive notification of general document events</li>
- <li>DTDHandler
- <br/>Receive notification of basic DTD-related events</li>
- <li>EntityResolver
- <br/>Basic interface for resolving entities</li>
- <li>ErrorHandler
- <br/>Basic interface for SAX error handlers </li>
- <li>Locator
- <br/>Interface for associating a SAX event with a document location</li>
- <li>Parser
- <br/>Basic interface for SAX (Simple API for XML) parsers</li>
- </ul>
- </s4>
- <s4 title="Exceptions">
- <ul>
- <li>SAXException
- <br/>Encapsulate a general SAX error or warning</li>
- <li>SAXParseException
- <br/>Encapsulate an XML parse error or warning </li>
- </ul>
- </s4>
- </s3>
- <s3 title="Package org.xml.sax.helpers">
- <s4 title="Classes">
- <ul>
- <li>AttributeListImpl
- <br/>Convenience implementation for AttributeList</li>
- <li>LocatorImpl
- <br/>Convenience implementation for Locator</li>
- <li>ParserFactory
- <br/>Java-specific class for dynamically loading SAX parsers</li>
- </ul>
- </s4>
- </s3>
- <s3 title="Package org.apache.xerces.dom.traversal">
- <s4 title="Classes">
- <ul>
- <li>DocumentTraversal
- <br/>DocumentTraversal contains methods that creates Iterators to traverse a
- node and its children</li>
- <li>DocumentTWIF
- <br/>DocumentTWIF contains methods that create Iterators to traverse a node
- and its children</li>
- <li>NodeFilter
- <br/>Filters are objects that know how to "filter out" nodes</li>
- <li>NodeIterator
- <br/>NodeIterators are used to step through a set of nodes</li>
- <li>TreeWalker
- <br/>TreeWalker objects are used to navigate a document tree or subtree using
- the view of the document </li>
- </ul>
- </s4>
- </s3>
- </s2>
-</s1>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE s1 SYSTEM 'dtd/document.dtd'>
+<s1 title='API JavaDoc'>
+ <s2 title='Standard API Documentation'>
+ <p>
+ Always try to use only the standard XML APIs when writing
+ XML applications. This will keep your application shielded
+ from changes in the underlying implementation of those
+ standard APIs and also gives you more flexibility to change
+ the implementation of the standard pieces without modifying
+ your application code.
+ </p>
+ <ul>
+ <li><jump href='javadocs/api/index.html'>Standard API</jump></li>
+ <ul>
+ <li>Java API for XML Processing (JAXP)</li>
+ <ul>
+ <li>
+ <jump href='javadocs/api/javax/xml/parsers/package-summary.html'>XML
+ Parser Factories</jump>
+ </li>
+ </ul>
+ <li>Document Object Model (DOM)</li>
+ <ul>
+ <li>
+ <jump href='javadocs/api/org/w3c/dom/package-summary.html'>Core</jump>
+ </li>
+ <li>
+ <jump href='javadocs/api/org/w3c/dom/events/package-summary.html'>Events</jump>
+ </li>
+ <li>
+ <jump href='javadocs/api/org/w3c/dom/html/package-summary.html'>HTML</jump>
+ </li>
+ <li>
+ <jump href='javadocs/api/org/w3c/dom/ranges/package-summary.html'>Ranges</jump>
+ </li>
+ <li>
+ <jump href='javadocs/api/org/w3c/dom/traversal/package-summary.html'>Traversal</jump>
+ </li>
+ </ul>
+ <li>Simple API for XML (SAX)</li>
+ <ul>
+ <li>
+ <jump href='javadocs/api/org/xml/sax/package-summary.html'>Core</jump>
+ </li>
+ <li>
+ <jump href='javadocs/api/org/xml/sax/helpers/package-summary.html'>Helper Classes</jump>
+ </li>
+ <li>
+ <jump href='javadocs/api/org/xml/sax/ext/package-summary.html'>Extensions</jump>
+ </li>
+ </ul>
+ </ul>
+ </ul>
+ </s2>
+ <s2 title='Xerces Native Interface Documentation'>
+ <p>
+ If you need functionality that is not available in the
+ standard APIs like DOM and SAX, then perhaps using the Xerces
+ Native Interface (XNI) will provide the information to build
+ the appropriate parsing tools for your application. For more
+ detailed information regarding XNI, refer to the
+ <link idref='xni'>XNI Manual</link>.
+ </p>
+ <ul>
+ <li>
+ <jump href='javadocs/xni/index.html'>Xerces Native Interface</jump>
+ </li>
+ <ul>
+ <li>
+ <jump href='javadocs/xni/org/apache/xerces/xni/package-summary.html'>Core</jump>
+ </li>
+ <li>
+ <jump href='javadocs/xni/org/apache/xerces/xni/parser/package-summary.html'>Parser
+ Configuration</jump>
+ </li>
+ </ul>
+ </ul>
+ </s2>
+ <s2 title='Xerces2 Implementation Documentation'>
+ <p>
+ For maintainers and developers of the Xerces2 reference
+ implementation, it's important to know the internal APIs
+ used.
+ </p>
+ <ul>
+ <li>
+ <jump href='javadocs/xerces2/index.html'>Xerces2 Implementation</jump>
+ </li>
+ </ul>
+ </s2>
+ <s2 title='Other Classes Documentation'>
+ <p>
+ The Xerces2 package also contains other implementation classes.
+ You can jump to the API for these classes via the following links:
+ </p>
+ <ul>
+ <li><jump href='javadocs/other/index.html'>Other Classes</jump></li>
+ </ul>
+ </s2>
+</s1>
\ No newline at end of file
1.8 +58 -53 xml-xerces/java/docs/docs-book.xml
Index: docs-book.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/docs-book.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- docs-book.xml 2001/01/23 18:57:04 1.7
+++ docs-book.xml 2001/08/23 00:35:14 1.8
@@ -1,54 +1,59 @@
-<?xml version="1.0"?>
-<!DOCTYPE book SYSTEM "./dtd/book.dtd">
-
-<book title="Xerces-J Documentation" copyright="1999, 2000 The Apache Software Foundation">
- <external href="../index.html" label="Home"/>
-
- <separator/>
- <document id="index" label="Readme" source="readme.xml" />
- <external href="http://xml.apache.org/dist/xerces-j/" label="Download"/>
- <external href="http://xml.apache.org/websrc/cvsweb.cgi/xml-xerces/java/" label="Repository"/>
- <document id="install" label="Installation" source="install.xml" />
-
- <separator/>
- <document id="api" label="API Docs" source="api.xml" />
- <!--
- <container id="samples" label="Samples" source="samples.xml">
- <entry id="domcount" source="sam-domcount.xml" />
- <entry id="domwriter" source="sam-domwriter.xml"/>
- <entry id="domfilter" source="sam-domfilter.xml"/>
- <entry id="iterator" source="sam-iterator.xml" />
- <entry id="tree" source="sam-tree.xml" />
- <entry id="treeview" source="sam-treeview.xml" />
- </container>
- -->
- <document id='samples' label='Samples' source='samples.xml'/>
- <hidden id='domcount' source='sam-domcount.xml'/>
- <hidden id="domwriter" source="sam-domwriter.xml"/>
- <hidden id="domfilter" source="sam-domfilter.xml"/>
- <hidden id="iterator" source="sam-iterator.xml" />
- <hidden id="tree" source="sam-tree.xml" />
- <hidden id="treeview" source="sam-treeview.xml" />
- <document id="schema" label="Schema" source="schema.xml" />
-
- <separator/>
- <document id="properties" label="Properties" source="properties.xml" />
- <document id="features" label="Features" source="features.xml" />
- <group id="faqs" title="Frequently Asked Questions" label="FAQs">
- <entry id="faq-general" source="faq-general.xml" />
- <entry id="faq-build" source="faq-build.xml" />
- <entry id="faq-write" source="faq-write.xml" />
- <entry id="faq-performance" source="faq-performance.xml" />
- <entry id="faq-migrate" source="faq-migrate.xml" />
- <entry id="faq-common" source="faq-common.xml" />
- </group>
- <hidden id="jpc" source="javapurecheck.xml"/>
-
- <separator/>
- <document id="releases" label="Releases" source="releases.xml" />
- <document id="caveats" label="Caveats" source="caveats.xml" />
- <document id="feedback" label="Feedback" source="feedback.xml" />
-
- <separator/>
- <document id="y2k" label="Y2K Compliance" source="y2k.xml" />
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE book SYSTEM 'dtd/book.dtd'>
+<book title='&ParserName; Documentation'
+ copyright='1999-2001 The Apache Software Foundation'>
+ <external label='Home' href='http://xml.apache.org/'/>
+ <separator/>
+ <document label='Readme' title='&ParserNameLong; Readme'
+ id='index' source='readme.xml'/>
+ <document label='Installation' title='Installation Instructions'
+ id='install' source='install.xml'/>
+ <external label='Download' href='http://xml.apache.org/dist/xerces-j/'/>
+ <external label='CVS Repository'
+ href='http://xml.apache.org/websrc/cvsweb.cgi/xml-xerces/java/?only_with_tag=xerces_j_2&hideattic=0'/>
+ <separator/>
+ <document label='Samples' title='Sample Programs'
+ id='samples' source='samples.xml'/>
+ <hidden title='DOM Samples' id='samples-dom' source='samples-dom.xml'/>
+ <hidden title='SAX Samples' id='samples-sax' source='samples-sax.xml'/>
+ <hidden title='Socket Samples' id='samples-socket' source='samples-socket.xml'/>
+ <hidden title='User Interface Samples'
+ id='samples-ui' source='samples-ui.xml'/>
+ <hidden title='XNI Samples' id='samples-xni' source='samples-xni.xml'/>
+ <document label='API JavaDoc' title='API JavaDoc'
+ id='api' source='api.xml'/>
+ <!--
+ <external label='API JavaDoc' href='apiDocs/index.html'/>
+ -->
+ <document label='XNI Manual' title='Xerces Native Interface'
+ id='xni' source='xni.xml'/>
+ <hidden title='XNI Design Details'
+ id='xni-design' source='xni-design.xml'/>
+ <hidden title='XNI Core Interfaces'
+ id='xni-core' source='xni-core.xml'/>
+ <hidden title='XNI Parser Configuration'
+ id='xni-config' source='xni-config.xml'/>
+ <hidden title='Xerces2 Components' id='xni-xerces2' source='xni-xerces2.xml'/>
+ <faqs label='FAQs' title='Frequently Asked Questions' id='faqs'>
+ <faq title='Common FAQs' id='faq-common' source='faq-common.xml'/>
+ <faq title='General FAQs' id='faq-general' source='faq-general.xml'/>
+ <faq title='Building and Running FAQs'
+ id='faq-build' source='faq-build.xml'/>
+ <faq title='Writing Applications FAQs'
+ id='faq-write' source='faq-write.xml'/>
+ <faq title='Performance FAQs'
+ id='faq-performance' source='faq-performance.xml'/>
+ </faqs>
+ <separator/>
+ <settings title='Parser Features' label='Features'
+ id='features' source='features.xml'/>
+ <settings title='Parser Properties' label='Properties'
+ id='properties' source='properties.xml'/>
+ <separator/>
+ <releases label='Release Info' title='Release Information'
+ id='releases' source='releases.xml'/>
+ <document label='Limitations' title='Parser Limitations'
+ id='limitations' source='limitations.xml'/>
+ <external label='Report a Bug'
+ href='http://nagoya.apache.org/bugzilla/enter_bug.cgi?product=Xerces2-J'/>
</book>
1.7 +394 -211 xml-xerces/java/docs/faq-build.xml
Index: faq-build.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/faq-build.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- faq-build.xml 2001/03/15 17:32:43 1.6
+++ faq-build.xml 2001/08/23 00:35:14 1.7
@@ -1,212 +1,395 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE faqs SYSTEM "./dtd/faqs.dtd">
-
-<faqs title="Building and Running FAQs">
- <faq title="Swing version?">
- <q>Which version of Swing is required?</q>
- <a> <p>This release uses Swing 1.1 (JFC 1.1).
- Swing is only used by the sample programs and is not
- required by the parser itself.</p>
- </a>
- </faq>
- <faq title="Recompiling source files?">
- <q>How do I recompile the source files?</q>
- <a> <p>To build &javaparsername; on Windows, you need a copy of Cygnus's Cygwin.
-See <jump href="http://sourceware.cygnus.com/cygwin">http://sourceware.cygnus.com/cygwin</jump>.
-Once Cygwin is installed, you need to set two environment variables. Edit the batch file
-BuildAll.bat to set these variables. Execute BuildAll.bat, and then
-set your classpath to point to the src and samples directories in the
-&javaparsername; distribution. You can then go to the top of the
-&javaparsername; tree and type 'make'.
-</p>
-<p>
-To build &javaparsername; Java on UNIX, you need to set an environment
-variable. Edit the shell script BuildAll to set this variables.
-Execute BuildAll, and then set your classpath to point to the src
-and samples directories in the &javaparsername; distribution. You can then
-go to the top of the &javaparsername; tree and type 'make'.
- </p>
- </a>
- </faq>
- <faq title="Regenerating API documentation?">
- <q>How do I regenerate the api documentation?</q>
- <a> <p>To regenerate the api documentation, you need to set up
-your environment to build &javaparsername;. Instead of typing 'make', you
-type 'make apidocs'.
- </p>
- </a>
- </faq>
-<!-- TBD
- <faq title="Packaging?">
- <q>How do I package the parser?</q>
- <a> <p>blah
- </p>
- </a>
- </faq>
--->
- <faq title="How do I use Visual Age?">
- <q>How do I import &javaparsername; into Visual Age for Java</q>
- <a>
- <ul>
- <li>Why does VisualAge for Java 2.0 report problems when I import the &javaparsername; parser?
- <br/>The current version of the &javaparsername; parser uses Swing 1.1,
- while VisualAge for Java 2.0 comes with Swing 1.0.2. The free update for the
- Professional version of VisualAge for Java 2.0 installs Swing 1.0.3.
- The most important difference between Swing 1.0.2 - 1.0.3 and 1.1 is
- the Java package was changed from com.sun.java.swing.* to javax.swing.*.
- <br/>To fix the errors, you must download the Java Foundation Classes 1.1
- with Swing 1.1 from Sun's Java home page and import the "swingall.jar"
- file into VisualAge for Java 2.0. The Swing 1.1 package can be found at
- the following URL:
- <br/><jump href="http://java.sun.com/products/jfc/index.html">http://java.sun.com/products/jfc/index.html</jump>
- <br/>Refer to the VisualAge for Java 2.0 documentation for information about
- how to import a JAR file into the repository and add that code to your workspace.
- </li>
- <li>Are there any other tips for importing the &javaparsername; parser into VisualAge
- for Java 2.0?
- <br/>The most useful tip applies to <em>any</em> updated code that you import
- into the VisualAge for Java 2.0 product. Before updating code, do the following:
- <br/>1. version the old code
- <br/>2. delete it from your workspace
- <br/>3. import the new code
- <br/>Deleting code from your workspace does not actually delete the code
- permanently -- the versioned code is moved to the repository where it can be
- retrieved later. Be aware, though, that removing code from your
- workspace will cause problems with all of the other classes that use that code.
- VisualAge for Java 2.0 will flag them as errors but this situation is temporary.
- When you import the new code, the errors found when deleting the old code will be fixed.
- <br/>If you are unsure as to how to perform any of these steps, refer to the VisualAge
- for Java 2.0 documentation.
- </li>
- </ul>
- </a>
- </faq>
- <faq title="100% Pure Java compliant?">
- <q>Is this &javaparsername; version 100% pure Java compliant?</q>
- <a> <p>Running JavaPureCheck on the Xerces-J parser code indicated 339
- pure Java classes, 9 warnings, and 0 errors. The nine warnings are
- enumerated below with explanations. To see the entire report, click
- <link idref="jpc">here</link>. </p>
-
- <p>There are many common cases where JavaPureCheck issues warnings
- even though the code is pure Java. These are the most common reasons:</p>
- <ol>
- <li>Warning: method reference:
- <code>java.lang.Class.forName(java.lang.String)</code>
- <br/>This warning is issued in the following two cases:</li>
- <ol>
- <li>Program code calls the <code>Class.forName(String)</code> method to
- dynamically load a class file. In this situation, the
- specified class may contain impure Java code. In the
- cases where this method is called directly in the parser
- code, an explanation is provided detailing why this
- warning can be ignored.</li>
- <li>Program code makes direct reference to an object's
- class. For example: <code>Class stringClass = String.class;</code>.
- In this situation the Java compiler converts
- <code>String.class</code> to the method call
- <code>Class.forName("java.lang.String")</code>.
- As long as the object whose class is being referenced is
- pure Java, the code making the reference remains pure.</li>
- </ol>
- <li>Warning: possible hard-coded path: ...
- <br/>When a String literal contains a common path separator
- character (e.g. '/' or '\'), JavaPureCheck assumes that
- it is a hard-coded path and that the class may not
- contain portable code. While a human tester can verify
- that the string is not a path, JavaPureCheck must be
- conservative and issue a warning.</li>
- </ol>
- <p>Explanations:</p>
- <ul>
- <li>Class: org.xml.sax.helpers.ParserFactory</li>
- <ul><li>Warning: method reference: java.lang.Class.forName(java.lang.String)</li></ul>
- <ul><li>Explanation: The ParserFactory class is part of the standard SAX 1.0 distribution. The warning given that this class "may load impure class" is correct -- the ParserFactory class may load impure Java class files. However, the purpose of this utility class is to load parser classes by name and therefore cannot dynamically check the pureness of parser classes loaded in this fashion. Since the Xerces-J parser does not use this method directly, it is not a problem that concerns the Xerces-J parser. </li></ul>
- <li>Class: org.apache.xml.serialize.SerializerFactory</li>
- <ul><li>Warning: method reference: java.lang.Class.forName(java.lang.String)</li></ul>
- <ul><li>Explanation: The SerializerFactory supports querying a system property to dynamically instantiate a serializer by class name. However, all of the serializer classes provided in this distribution are pure. The only way to load an impure serializer is if the user provided an impure serializer implementation.</li></ul>
- <li>Class: org.apache.xml.serialize.OutputFormat</li>
- <ul><li>Warning: possible hard-coded path: text/xml</li></ul>
- <ul><li>Warning: possible hard-coded path: text/plain</li></ul>
- <ul><li>Warning: possible hard-coded path: application/pdf</li></ul>
- <ul><li>Warning: possible hard-coded path: text/html</li></ul>
- <ul><li>Warning: possible hard-coded path: -//W3C//DTD XHTML 1.0 Strict//EN</li></ul>
- <ul><li>Explanation: These strings are not filenames.</li></ul>
- <li>Class: org.apache.xml.serialize.HTMLdtd</li>
- <ul><li>Warning: method reference: java.lang.Class.forName(java.lang.String)</li></ul>
- <ul><li>Explanation: Referencing class object that is pure Java.</li></ul>
- <li>Class: org.apache.html.dom.HTMLDocumentImpl</li>
- <ul><li>Warning: method reference: java.lang.Class.forName(java.lang.String)</li></ul>
- <ul><li>Explanation: Referencing class object that is pure Java.</li></ul>
- <li>Class: org.apache.xerces.readers.StringReader</li>
- <ul><li>Warning: method reference: java.lang.Class.forName(java.lang.String)</li></ul>
- <ul><li>Explanation: Referencing class object that is pure Java.</li></ul>
- <li>Class: org.apache.xerces.parsers.DOMParser</li>
- <ul><li>Warning: method reference: java.lang.Class.forName(java.lang.String)</li></ul>
- <ul><li>Explanation: The DOMParser class allows the user to set the DOM implemenation to use, by name. However, the default DOM implementation is pure Java.</li></ul>
- <ul><li>Explanation: Referencing class object that is pure Java.</li></ul>
- <li>Class: org.apache.xerces.utils.CharDataChunk</li>
- <ul><li>Warning: method reference: java.lang.Class.forName(java.lang.String)</li></ul>
- <ul><li>Explanation: Referencing class object that is pure Java.</li></ul>
- <li>Class: org.apache.xerces.utils.UTF8DataChunk</li>
- <ul><li>Warning: method reference: java.lang.Class.forName(java.lang.String)</li></ul>
- <ul><li>Explanation: Referencing class object that is pure Java.</li></ul>
- </ul>
- <p>The results file of the JavaPureCheck can be viewed by clicking <link idref="jpc">here</link>.</p>
- <note>The samples were not checked with JavaPureCheck and are not
- guaranteed to be pure Java. We reserve the right to write samples
- in the future that are platform specific and therefore may not
- pass as pure Java. The parser, however, will remain pure Java.</note>
- </a>
- </faq>
- <faq title="Running on the Mac?">
- <q>How do I get &javaparsername; to run on the Mac under MRJ?</q>
- <a> <p><em>Prerequisites</em> (available from
- <jump href="http://developer.apple.com/java/">http://developer.apple.com/java/</jump>):</p>
- <ul>
- <li>MRJ 2.1 (this is the most recent version of the JVM)</li>
- <li>MRJ SDK 2.1 (this is the most recent version of the Java developer tools)</li>
- </ul>
- <p><em>Instructions </em>(other variations would work also):</p>
- <ol>
- <li>Download the .tar.gz file containing &javaparsername;.</li>
- <li>Use Stuffit Expander(tm), Suntar, or some other Macintosh tool that
- <br/>supports the .tar.gz format to expand the downloaded file.</li>
- <li>JBindery, part of MRJ SDK 2.1, is used to create a double-clickable
- Java application with the necessary configuration information built in.
- It is analogous to writing a .bat or .sh script. </li>
- <li><em>To run the dom.DOMWriter example:</em></li>
- <ol>
- <li>Double click on JBindery to start it up.</li>
- <li>Click on the Classpath panel.</li>
- <li>Click on the "Add .zip File" button and add both the
- "Xerces-J.jar" and "Xerces-JSamples.jar" files.</li>
- <li>Click on the Command panel.</li>
- <li>Enter "dom.DOMWriter" as the Class name. Enter
- "data/personal.xml" in the Optional parameters box.</li>
- <li>Click on Save Settings button, pick a name such as "Run <code>dom.DOMWriter</code>"
- for the file, and <em>be sure</em> that "Save as Application"
- is selected (this is the default) and save the file.</li>
- <li>Quit JBindery.</li>
- <li>You can now double click on the file you created in step f to run the XJParse example.</li>
- </ol>
- </ol>
- </a>
- </faq>
- <faq title="Visual Cafe exception error?">
- <q>Why do I get ArrayIndexOutOfBoundsException in the Symantec Visual Cafe debugger?</q>
- <a> <p>The Visual Cafe debugger is set to trap <code>ArrayIndexOutOfBoundsException</code> exceptions by
- default. &javaparsername; uses <code>ArrayIndexOutOfBoundsException</code> internally to signal
- exceptional, but not erroneous conditions. In order to run &javaparsername;2 inside
- Visual Cafe's debugger, you need to turn off the trapping of these
- exceptions.</p>
- <p><em>To do this:</em></p>
- <ol>
- <li>Select the "Options" item in the "Project" menu.</li>
- <li>Select the "Debugger" tab in the dialog which appears.</li>
- <li>Select "Exceptions" from the popup menu.</li>
- <li>Remove the check from the checkbox for <code>java.lang.ArrayIndexOutOfBoundsException</code>.</li>
- </ol>
- </a>
- </faq>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE faqs SYSTEM 'dtd/faqs.dtd'>
+<faqs title='Building and Running FAQs'>
+ <faq title='Swing version?'>
+ <q>Which version of Swing is required?</q>
+ <a>
+ <p>
+ This release uses Swing 1.1 (JFC 1.1). Swing is only used by
+ the sample programs and is not required by the parser itself.
+ </p>
+ </a>
+ </faq>
+ <faq title='Recompling source files?'>
+ <q>How do I recompile the source files?</q>
+ <a>
+ <p>
+ To build &ParserName; you need the Java Development
+ Kit (JDK) version 1.2 (or higher) installed on your machine.
+ The actual build is performed by the Ant program which is
+ written in Java and is a subproject of the Apache
+ <jump href='http://jakarta.apache.org/'>Jakarta</jump>
+ project. The build also requires a few other tools but
+ all of the tools you need (including Ant) are contained
+ in the <ref>&ParserName;-tools.&parserversion;.zip</ref>
+ file, packaged separately. Go to the &ParserName;
+ <jump href='http://xml.apache.org/dist/xerces-j/'>download</jump>
+ page to download the tools package and then extract it in the
+ same location as the source package.
+ </p>
+ <p>
+ Once you have extracted both the source and tools packages
+ in the same directory, you can invoke a build by either
+ using the "build.bat" file for Windows platforms or the
+ "build.sh" file for UNIX platforms. Before invoking either
+ one of these scripts, though, be sure to set the JAVA_HOME
+ environment variable to the installed location of your JDK.
+ </p>
+ <p>
+ The script will invoke the Ant build program for you which
+ displays the list of allowed build targets. To only compile
+ the source files, type "build compile" (on Windows platforms)
+ at the command line in the directory where you extracted
+ &ParserName;; to build the Jar files, type "build jars"; and
+ to build everything, including documentation, type "build
+ all".
+ </p>
+ </a>
+ </faq>
+ <faq title='Regenerating API documention?'>
+ <q>How do I regenerate the api documentation?</q>
+ <a>
+ <p>
+ To regenerate the api documentation, you need to set up
+ your environment to build &ParserName;. Instead of typing
+ "build all", you type "build javadocs".
+ </p>
+ </a>
+ </faq>
+ <faq title="How do I use Visual Age?">
+ <q>How do I import &ParserName; into Visual Age for Java</q>
+ <a>
+ <ul>
+ <li>
+ Why does VisualAge for Java 2.0 report problems when I import
+ the &ParserName; parser?
+ <br/>
+ The current version of the &ParserName; parser uses Swing
+ 1.1, while VisualAge for Java 2.0 comes with Swing 1.0.2. The
+ free update for the Professional version of VisualAge for Java
+ 2.0 installs Swing 1.0.3. The most important difference between
+ Swing 1.0.2 - 1.0.3 and 1.1 is the Java package was changed
+ from com.sun.java.swing.* to javax.swing.*.
+ <br/>
+ To fix the errors, you must download the Java Foundation Classes
+ 1.1 with Swing 1.1 from Sun's Java home page and import the
+ "swingall.jar" file into VisualAge for Java 2.0. The
+ Swing 1.1 package can be found at the following URL:
+ <br/>
+ <jump href="http://java.sun.com/products/jfc/index.html">http://java.sun.com/products/jfc/index.html</jump>
+ <br/>
+ Refer to the VisualAge for Java 2.0 documentation for information
+ about how to import a JAR file into the repository and add that
+ code to your workspace.
+ </li>
+ <li>
+ Are there any other tips for importing the &ParserName;
+ parser into VisualAge for Java 2.0?
+ <br/>
+ The most useful tip applies to <em>any</em> updated code that you
+ import into the VisualAge for Java 2.0 product. Before updating
+ code, do the following:
+ <br/>
+ 1. version the old code
+ <br/>
+ 2. delete it from your workspace
+ <br/>
+ 3. import the new code
+ <br/>
+ Deleting code from your workspace does not actually delete
+ the code permanently - the versioned code is moved to the
+ repository where it can be retrieved later. Be aware, though,
+ that removing code from your workspace will cause problems with
+ all of the other classes that use that code. VisualAge for Java
+ 2.0 will flag them as errors but this situation is temporary.
+ When you import the new code, the errors found when deleting the
+ old code will be fixed.
+ <br/>
+ If you are unsure as to how to perform any of these steps, refer
+ to the VisualAge for Java 2.0 documentation.
+ </li>
+ </ul>
+ </a>
+ </faq>
+ <!--
+ - REVISIT: This needs to be re-run and re-verified before we
+ - put this FAQ item back in.
+ <faq title='100% Pure Java compliant?'>
+ <q>Is this &ParserName; version 100% pure Java compliant?</q>
+ <a>
+ <p>
+ Running JavaPureCheck on the &ParserName; parser code indicated 339
+ pure Java classes, 9 warnings, and 0 errors. The nine warnings are
+ enumerated below with explanations. To see the entire report, click
+ <link idref="jpc">here</link>.
+ </p>
+ <p>
+ There are many common cases where JavaPureCheck issues warnings
+ even though the code is pure Java. These are the most common
+ reasons:
+ </p>
+ <ol>
+ <li>
+ Warning: method reference:
+ <code>java.lang.Class.forName(java.lang.String)</code>
+ <br/>
+ This warning is issued in the following two cases:
+ </li>
+ <ol>
+ <li>
+ Program code calls the <code>Class.forName(String)</code>
+ method to dynamically load a class file. In this situation,
+ the specified class may contain impure Java code. In the
+ cases where this method is called directly in the parser
+ code, an explanation is provided detailing why this warning
+ can be ignored.
+ </li>
+ <li>
+ Program code makes direct reference to an object's
+ class. For example: <code>Class stringClass = String.class;</code>.
+ In this situation the Java compiler converts
+ <code>String.class</code> to the method call
+ <code>Class.forName("java.lang.String")</code>.
+ As long as the object whose class is being referenced is
+ pure Java, the code making the reference remains pure.
+ </li>
+ </ol>
+ <li>
+ Warning: possible hard-coded path: ...
+ <br/>
+ When a String literal contains a common path separator character
+ (e.g. '/' or '\'), JavaPureCheck assumes that
+ it is a hard-coded path and that the class may not contain
+ portable code. While a human tester can verify that the string is
+ not a path, JavaPureCheck must be conservative and issue a
+ warning.
+ </li>
+ </ol>
+ <p>Explanations:</p>
+ <ul>
+ <li>Class: org.xml.sax.helpers.ParserFactory</li>
+ <ul>
+ <li>
+ Warning: method reference:
+ java.lang.Class.forName(java.lang.String)
+ </li>
+ </ul>
+ <ul>
+ <li>
+ Explanation: The ParserFactory class is part of the standard
+ SAX 1.0 distribution. The warning given that this class "may
+ load impure class" is correct - the ParserFactory class may
+ load impure Java class files. However, the purpose of this
+ utility class is to load parser classes by name and therefore
+ cannot dynamically check the pureness of parser classes loaded
+ in this fashion. Since the &ParserName; parser does not use this
+ method directly, it is not a problem that concerns the &ParserName;
+ parser.
+ </li>
+ </ul>
+ <li>Class: org.apache.xml.serialize.SerializerFactory</li>
+ <ul>
+ <li>
+ Warning: method reference:
+ java.lang.Class.forName(java.lang.String)
+ </li>
+ </ul>
+ <ul>
+ <li>
+ Explanation: The SerializerFactory supports querying a system
+ property to dynamically instantiate a serializer by class name.
+ However, all of the serializer classes provided in this
+ distribution are pure. The only way to load an impure
+ serializer is if the user provided an impure serializer
+ implementation.
+ </li>
+ </ul>
+ <li>Class: org.apache.xml.serialize.OutputFormat</li>
+ <ul>
+ <li>Warning: possible hard-coded path: text/xml</li>
+ </ul>
+ <ul>
+ <li>Warning: possible hard-coded path: text/plain</li>
+ </ul>
+ <ul>
+ <li>Warning: possible hard-coded path: application/pdf</li>
+ </ul>
+ <ul>
+ <li>Warning: possible hard-coded path: text/html</li>
+ </ul>
+ <ul>
+ <li>
+ Warning: possible hard-coded path:
+ -//W3C//DTD XHTML 1.0 Strict//EN
+ </li>
+ </ul>
+ <ul>
+ <li>Explanation: These strings are not filenames.</li>
+ </ul>
+ <li>Class: org.apache.xml.serialize.HTMLdtd</li>
+ <ul>
+ <li>
+ Warning: method reference:
+ java.lang.Class.forName(java.lang.String)
+ </li>
+ </ul>
+ <ul>
+ <li>Explanation: Referencing class object that is pure Java.</li>
+ </ul>
+ <li>Class: org.apache.html.dom.HTMLDocumentImpl</li>
+ <ul>
+ <li>
+ Warning: method reference:
+ java.lang.Class.forName(java.lang.String)
+ </li>
+ </ul>
+ <ul>
+ <li>Explanation: Referencing class object that is pure Java.</li>
+ </ul>
+ <li>Class: org.apache.xerces.readers.StringReader</li>
+ <ul>
+ <li>
+ Warning: method reference:
+ java.lang.Class.forName(java.lang.String)
+ </li>
+ </ul>
+ <ul>
+ <li>Explanation: Referencing class object that is pure Java.</li>
+ </ul>
+ <li>Class: org.apache.xerces.parsers.DOMParser</li>
+ <ul>
+ <li>
+ Warning: method reference:
+ java.lang.Class.forName(java.lang.String)
+ </li>
+ </ul>
+ <ul>
+ <li>
+ Explanation: The DOMParser class allows the user to set the
+ DOM implemenation to use, by name. However, the default DOM
+ implementation is pure Java.
+ </li>
+ </ul>
+ <ul>
+ <li>Explanation: Referencing class object that is pure Java.</li>
+ </ul>
+ <li>Class: org.apache.xerces.utils.CharDataChunk</li>
+ <ul>
+ <li>
+ Warning: method reference:
+ java.lang.Class.forName(java.lang.String)
+ </li>
+ </ul>
+ <ul>
+ <li>Explanation: Referencing class object that is pure Java.</li>
+ </ul>
+ <li>Class: org.apache.xerces.utils.UTF8DataChunk</li>
+ <ul>
+ <li>
+ Warning: method reference:
+ java.lang.Class.forName(java.lang.String)
+ </li>
+ </ul>
+ <ul>
+ <li>Explanation: Referencing class object that is pure Java.</li>
+ </ul>
+ </ul>
+ <p>
+ The results file of the JavaPureCheck can be viewed by clicking
+ <link idref="jpc">here</link>.
+ </p>
+ <note>
+ The samples were not checked with JavaPureCheck and are not
+ guaranteed to be pure Java. We reserve the right to write samples
+ in the future that are platform specific and therefore may not
+ pass as pure Java. The parser, however, will remain pure Java.
+ </note>
+ </a>
+ </faq>
+ -->
+ <faq title='Running on the Mac?'>
+ <q>How do I get &ParserName; to run on the Mac under MRJ?</q>
+ <a>
+ <p>
+ <em>Prerequisites</em> (available from
+ <jump href="http://developer.apple.com/java/">http://developer.apple.com/java/</jump>):
+ </p>
+ <ul>
+ <li>MRJ 2.1 (this is the most recent version of the JVM)</li>
+ <li>
+ MRJ SDK 2.1 (this is the most recent version of the Java
+ developer tools)
+ </li>
+ </ul>
+ <p>
+ <em>Instructions </em>(other variations would work also):
+ </p>
+ <ol>
+ <li>Download the .tar.gz file containing &ParserName;.</li>
+ <li>
+ Use Stuffit Expander(tm), Suntar, or some other Macintosh tool
+ that supports the .tar.gz format to expand the downloaded file.
+ </li>
+ <li>
+ JBindery, part of MRJ SDK 2.1, is used to create a double-clickable
+ Java application with the necessary configuration information built
+ in. It is analogous to writing a .bat or .sh script.
+ </li>
+ <li><em>To run the dom.DOMWriter example:</em></li>
+ <ol>
+ <li>Double click on JBindery to start it up.</li>
+ <li>Click on the Classpath panel.</li>
+ <li>
+ Click on the "Add .zip File" button and add both the
+ "xerces.jar" and "xercesSamples.jar" files.
+ </li>
+ <li>Click on the Command panel.</li>
+ <li>
+ Enter "dom.Writer" as the Class name. Enter
+ "data/personal.xml" in the Optional parameters box.
+ </li>
+ <li>
+ Click on Save Settings button, pick a name such as "Run
+ <code>dom.Writer</code>" for the file, and <em>be
+ sure</em> that "Save as Application" is selected
+ (this is the default) and save the file.
+ </li>
+ <li>Quit JBindery.</li>
+ <li>
+ You can now double click on the file you created in step (f) to
+ run the XJParse example.
+ </li>
+ </ol>
+ </ol>
+ </a>
+ </faq>
+ <faq title='Visual Cafe exception error?'>
+ <q>
+ Why do I get ArrayIndexOutOfBoundsException in the Symantec Visual
+ Cafe debugger?
+ </q>
+ <a>
+ <p>
+ The Visual Cafe debugger is set to trap
+ <code>ArrayIndexOutOfBoundsException</code> exceptions by
+ default. &ParserName; sometimes uses
+ <code>ArrayIndexOutOfBoundsException</code> internally to
+ signal exceptional, but not erroneous conditions. In order to
+ run &ParserName; inside Visual Cafe's debugger, you need to
+ turn off the trapping of these exceptions.
+ </p>
+ <p><em>To do this:</em></p>
+ <ol>
+ <li>Select the "Options" item in the "Project" menu.</li>
+ <li>
+ Select the "Debugger" tab in the dialog which appears.
+ </li>
+ <li>Select "Exceptions" from the popup menu.</li>
+ <li>
+ Remove the check from the checkbox for
+ <code>java.lang.ArrayIndexOutOfBoundsException</code>.
+ </li>
+ </ol>
+ </a>
+ </faq>
</faqs>
1.6 +114 -67 xml-xerces/java/docs/faq-common.xml
Index: faq-common.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/faq-common.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- faq-common.xml 2000/06/21 19:18:40 1.5
+++ faq-common.xml 2001/08/23 00:35:14 1.6
@@ -1,68 +1,115 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE faqs SYSTEM "./dtd/faqs.dtd">
-
-<faqs title="Common Problems">
- <faq title="Parsing HTML Generated an Error.">
- <q>I tried to use &javaparsername; to parse an HTML file and it generated an error. What did I do wrong?</q>
- <a><p>Unfortunately, HTML does not, in general, follow the XML grammar rules.
- Most HTML files do not meet the XML style quidelines. Therefore, the XML parser
- generates XML well-formedness errors.</p>
- <p>Typical errors include:</p>
- <ul>
- <li>Missing end tags, e.g. <P> with no </P> (end tags are not required in HTML)</li>
- <li>Missing closing slash on <IMG HREF="foo" <em>/</em>> (not required in HTML)</li>
- <li>Missing quotes on attribute values, e.g. <IMG width="600"> (not generally required in HTML)</li>
- </ul>
- <p>HTML must match the XHTML standard for well-formedness before it
- can be parsed by Xerces-J or any other XML parser. You can find the
- <jump href="http://www.w3c.org/TR/1999/PR-xhtml1-19991210">XHTML standard</jump>
- on the <jump href="http://www.w3c.org">W3C web site</jump>.</p>
- </a>
- </faq>
- <faq title="UTF-8 Character Error">
- <q>I get an "invalid UTF-8 character" error.</q>
- <a><p>There are many Unicode characters that are not allowed in an XML document,
- according to the XML spec. Typical disallowed characters are control
- characters, even if you escape them using the Character Reference form:
- &#xxxx; . See the XML spec, sections
- <jump href="http://www.w3.org/TR/REC-xml#charsets">2.2</jump> and
- <jump href="http://www.w3.org/TR/REC-xml#sec-references">4.1</jump>
- for details. If the parser is generating this error, it is very likely
- that there is a character in the file that you can not see.
- You can generally use a UNIX command like "od -hc" to find it.</p>
-
- </a>
- </faq>
- <faq title="Error Accessing EBCDIC XML Files">
- <q>I get an error when I access EBCDIC XML files, what is happening?</q>
- <a><p>If an XML document/file is not UTF-8, then you MUST specify the encoding.
- When transcoding a UTF8 document to EBCDIC, remember to change this:</p>
- <ul>
- <li><?xml version="1.0" encoding="UTF-8"?>
- <br/>to something like this:
- <br/><?xml version="1.0" encoding="ebcdic-cp-us"?>
- </li>
- </ul>
- </a>
- </faq>
- <faq title="EOF Character Error">
- <q>I get an error on the EOF character (0x1A) -- what is happening?</q>
- <a><p>You are probably using the <em>LPEX</em>
- editor, which automatically inserts an End-of-file character (0x1A) at the end of your
- XML document (other editors might do this as well). Unfortunately, the
- EOF character (0x1A) is an illegal character according to the XML specification,
- and &javaparsername; correctly generates an error.</p>
- </a>
- </faq>
- <faq title='DOS Filenames No Longer Work'>
- <q>I used to be able to use DOS filenames with the parser and now
- they don't work. Why not?</q>
- <a><p>DOS filenames are not legal URIs as required by the XML 1.0
- specification. Therefore, it was an error for the parser to accept
- DOS filenames. This bug is now fixed.</p>
- <p>DOS filenames can be converted to legal URIs, however. For
- example, the DOS filename "c:\xerces\data\personal.xml" would become
- "file:///c:/xerces/data/personal.xml", which is a legal URI.</p>
- </a>
- </faq>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE faqs SYSTEM 'dtd/faqs.dtd'>
+<faqs title='Common Problems FAQs'>
+ <faq title='DOS Filenames No Longer Work'>
+ <q>
+ I used to be able to use DOS filenames with the parser and now
+ they don't work. Why not?
+ </q>
+ <a>
+ <p>
+ DOS filenames are not legal URIs as required by the XML 1.0
+ specification. Therefore, it was an error for the parser to
+ accept DOS filenames. This bug is now fixed.
+ </p>
+ <p>
+ DOS filenames can be converted to legal URIs, however. For
+ example, the DOS filename "c:\xerces\data\personal.xml" would
+ become "file:///c:/xerces/data/personal.xml", which is a legal
+ URI.
+ </p>
+ </a>
+ </faq>
+ <faq title='Parsing HTML Generated an Error.'>
+ <q>
+ I tried to use &ParserName; to parse an HTML file and it
+ generated an error. What did I do wrong?
+ </q>
+ <a>
+ <p>
+ Unfortunately, HTML does not, in general, follow the XML
+ grammar rules. Most HTML files do not meet the XML style
+ quidelines. Therefore, the XML parser generates XML
+ well-formedness errors.
+ </p>
+ <p>Typical errors include:</p>
+ <ul>
+ <li>
+ Missing end tags, e.g. <P> with no </P> (end
+ tags are not required in HTML)
+ </li>
+ <li>
+ Missing closing slash on <IMG HREF="foo" <em>/</em>>
+ (not required in HTML)
+ </li>
+ <li>
+ Missing quotes on attribute values, e.g. <IMG width="600">
+ (not generally required in HTML)
+ </li>
+ </ul>
+ <p>
+ HTML must match the XHTML standard for well-formedness before it
+ can be parsed by &ParserName; or any other XML parser. You can
+ find the
+ <jump href="http://www.w3c.org/TR/1999/PR-xhtml1-19991210">XHTML
+ standard</jump> on the
+ <jump href="http://www.w3c.org">W3C web site</jump>.
+ </p>
+ </a>
+ </faq>
+ <faq title='UTF-8 Character Error'>
+ <q>I get an "invalid UTF-8 character" error.</q>
+ <a>
+ <p>
+ There are many Unicode characters that are not allowed in an
+ XML document, according to the XML spec. Typical disallowed
+ characters are control characters, even if you escape them
+ using the Character Reference form: &#xxxx; . See the XML
+ spec, sections
+ <jump href="http://www.w3.org/TR/REC-xml#charsets">2.2</jump>
+ and
+ <jump href="http://www.w3.org/TR/REC-xml#sec-references">4.1</jump>
+ for details. If the parser is generating this error, it is very
+ likely that there is a character in the file that you can not see.
+ You can generally use a UNIX command like "od -hc" to
+ find it.
+ </p>
+ </a>
+ </faq>
+ <faq title='Error Accessing EBCDIC XML Files'>
+ <q>
+ I get an error when I access EBCDIC XML files, what is happening?
+ </q>
+ <a>
+ <p>
+ If an XML document/file is not UTF-8, then you MUST specify the
+ encoding. When transcoding a UTF8 document to EBCDIC, remember
+ to change this:
+ </p>
+ <ul>
+ <li>
+ <?xml version="1.0" encoding="UTF-8"?>
+ <br/>
+ to something like this:
+ <br/>
+ <?xml version="1.0" encoding="ebcdic-cp-us"?>
+ </li>
+ </ul>
+ </a>
+ </faq>
+ <faq title='EOF Character Error'>
+ <q>
+ I get an error on the EOF character (0x1A) -- what is happening?
+ </q>
+ <a>
+ <p>
+ You are probably using the <em>LPEX</em> editor, which
+ automatically inserts an End-of-file character (0x1A) at the end
+ of your XML document (other editors might do this as well).
+ Unfortunately, the EOF character (0x1A) is an illegal character
+ according to the XML specification, and &ParserName;
+ correctly generates an error.
+ </p>
+ </a>
+ </faq>
</faqs>
1.15 +78 -190 xml-xerces/java/docs/faq-general.xml
Index: faq-general.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/faq-general.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- faq-general.xml 2001/07/16 19:24:37 1.14
+++ faq-general.xml 2001/08/23 00:35:14 1.15
@@ -1,191 +1,79 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE faqs SYSTEM "./dtd/faqs.dtd">
-
-<faqs title="General FAQs">
-
- <faq title="Validating Schemas">
- <q>I have written a schema and I want to use Xerces to
- validate it. How do I do this?</q>
- <a>
- <p>
- The best way to solve this problem is to write a
- simple, valid instance document and use one of the
- sample programs that accompanies Xerces (such as
- sax.SAXCount or dom.DOMCount) to validate the
- instance document. While validating the instance
- document, Xerces will simultaneously validate the
- corresponding schema. We hope to introduce
- functionality to permit schemas to be validated
- independently of instance documents in Xerces2.
- </p>
- </a>
- </faq>
-
- <faq title="Bugzilla">
- <q>How do I use Bugzilla to report bugs?</q>
- <a>
- <ul>
- <li>Please report bugs against the newest release.</li>
- <li>If doubt exists whether the behaviour in question is a bug or a feature,
- please post a message to the xerces-j-user list for clarification.</li>
- <li> To help to eliminate duplicate bug reports,
- before reporting a bug, you should
- first query the bugzilla database to see whether the bug has already been reported (and perhaps fixed).
- Then, checkout code from CVS, and
- build Xerces-J locally to verify that a bug still exists. </li>
- </ul>
- <p>For more information visit the following links:</p>
- <ul>
- <li><jump href="http://nagoya.apache.org/bugzilla/">
- http://nagoya.apache.org/bugzilla/</jump></li>
- <li><jump href="http://www.mozilla.org/bugs/">
- http://www.mozilla.org/bugs/</jump></li>
- </ul>
- <anchor name="bugzilla"/>
- </a>
- </faq>
-
- <faq title="Extracting code from CVS">
- <q>How do I extract code from CVS?</q>
- <a>
- <p>
- <br/>set CVSROOT=:pserver:anoncvs@cvs.apache.org:/home/cvspublic
- <br/>cvs login <em>(password: anoncvs)</em>
- <br/>cvs checkout -d xerces_j xml-xerces/java
- </p>
- </a>
- </faq>
- <faq title="Revalidation of DOM document in Memory">
- <q>I have used the DOMParser to convert an XML document into
- a DOM tree. Then I made some changes to the DOM tree. How do I make sure
- the document still conforms to my (schema or DTD)?</q>
- <a>
- <p>
- DOM revalidation is not supported by Xerces 1. Ken Rawlings has been trying
- to build a revalidating DOMParser based on code which was dropped from Xerces because
- it was no longer being maintained. The current code is at:
- <jump href="http://www.vervet.com/~krawling/RevalidatingDOMParser.java">http://www.vervet.com/~krawling/RevalidatingDOMParser.java.</jump>
- We hope that Xerces 2 will include this capability.
- </p>
- </a>
- </faq>
- <faq title="Schema/DTD caching">
- <q>I have a (DTD or schema) that I will use to validate many XML documents. How can I avoid having to recompile it every time I want to validate a new document?</q>
- <a>
- <p>Xerces 1 does not currently support grammar caching. We
- expect that Xerces 2 will support this functionality. Some users
- have reported success by registering an EntityResolver which handles reading
- the grammar from the disk and storing it in an efficient way (usually a byteArray), then passing the
- parser a reader for the efficiently-stored structure. While this
- does not avoid recompiling the grammar for each instance document,
- it does avoid disk accesses.
- </p>
- </a>
- </faq>
-
- <faq title="New Features?">
- <q>What are the new features?</q>
- <a>
- <p>Here are some of the new features in &javaparsername;:</p>
- <ul>
- <li>Additional support for W3C XML Schema Language.</li>
- <li>DOS filenames no longer work. See Common Problems
- section of the FAQ.</li>
- </ul>
- <anchor name="valid"/>
- </a>
- </faq>
-
- <faq title="Validation">
- <q>How do I turn on validation?</q>
- <a>
- <p>You can turn validation on and off via methods available
- on the SAX2 <code>XMLFilter</code> interface. While only the
- <code>SAXParser</code> implements the <code>XMLFilter</code>
- interface, the methods required for turning on validation
- are available to both parser classes, DOM and SAX.
- <br/>
- The code snippet below shows how to turn validation on -- assume that <ref>parser</ref>
- is an instance of either
- <code>org.apache.xerces.parsers.SAXParser</code> or
- <code>org.apache.xerces.parsers.DOMParser</code>. <br/><br/>
- <code>parser.setFeature("http://xml.org/sax/features/validation", true);</code>
- </p>
- <p><em>IMPORTANT!</em>Simply turning on
- validation will <em>not</em> make Xerces
- actually report the errors that it detects.
- For this, you need to implement the
- <code>org.xml.sax.ErrorHandler</code>
- interface and register your implementation
- with the parser using the
- <code>setErrorHandler</code> method.</p>
- </a>
- </faq>
-
- <faq title="International Encodings">
- <q>What international encodings are supported by &javaparsername;?</q>
- <a>
- <p> In general, the parser supports all IANA encodings and
- aliases (see
- <jump href="http://www.iana.org/assignments/character-sets">
- http://www.iana.org/assignments/character-sets</jump>) that
- have clear mappings to Java encodings (see
- <jump href="http://java.sun.com/j2se/1.3.0/docs/guide/intl/encoding.doc.html">here</jump>
- for details). Some of the more common encodings are:</p>
- <ul>
- <li>UTF-8</li>
- <li>UTF-16 Big Endian, UTF-16 Little Endian</li>
- <li>IBM-1208</li>
- <li>ISO Latin-1 (ISO-8859-1)</li>
- <li>ISO Latin-2 (ISO-8859-2) [Bosnian, Croatian, Czech,
- Hungarian, Polish, Romanian, Serbian (in Latin transcription),
- Serbocroatian, Slovak, Slovenian, Upper and Lower Sorbian]</li>
- <li>ISO Latin-3 (ISO-8859-3) [Maltese, Esperanto]</li>
- <li>ISO Latin-4 (ISO-8859-4)</li>
- <li>ISO Latin Cyrillic (ISO-8859-5)</li>
- <li>ISO Latin Arabic (ISO-8859-6)</li>
- <li>ISO Latin Greek (ISO-8859-7)</li>
- <li>ISO Latin Hebrew (ISO-8859-8)</li>
- <li>ISO Latin-5 (ISO-8859-9) [Turkish]</li>
- <li>Extended Unix Code, packed for Japanese (euc-jp, eucjis)</li>
- <li>Japanese Shift JIS (shift-jis)</li>
- <li>Chinese (big5)</li>
- <li>Chinese for PRC (mixed 1/2 byte) (gb2312)</li>
- <li>Japanese ISO-2022-JP (iso-2022-jp)</li>
- <li>Cyrllic (koi8-r)</li>
- <li>Extended Unix Code, packed for Korean (euc-kr)</li>
- <li>Russian Unix, Cyrillic (koi8-r)</li>
- <li>Windows Thai (cp874)</li>
- <li>Latin 1 Windows (cp1252)</li>
- <li>cp858</li>
- <li>EBCDIC encodings:</li>
- <ul>
- <li>EBCDIC US (ebcdic-cp-us)</li>
- <li>EBCDIC Canada (ebcdic-cp-ca)</li>
- <li>EBCDIC Netherland (ebcdic-cp-nl)</li>
- <li>EBCDIC Denmark (ebcdic-cp-dk)</li>
- <li>EBCDIC Norway (ebcdic-cp-no)</li>
- <li>EBCDIC Finland (ebcdic-cp-fi)</li>
- <li>EBCDIC Sweden (ebcdic-cp-se)</li>
- <li>EBCDIC Italy (ebcdic-cp-it)</li>
- <li>EBCDIC Spain, Latin America (ebcdic-cp-es)</li>
- <li>EBCDIC Great Britain (ebcdic-cp-gb)</li>
- <li>EBCDIC France (ebcdic-cp-fr)</li>
- <li>EBCDIC Hebrew (ebcdic-cp-he)</li>
- <li>EBCDIC Switzerland (ebcdic-cp-ch)</li>
- <li>EBCDIC Roece (ebcdic-cp-roece)</li>
- <li>EBCDIC Yugoslavia (ebcdic-cp-yu)</li>
- <li>EBCDIC Iceland (ebcdic-cp-is)</li>
- <li>EBCDIC Urdu (ebcdic-cp-ar2)</li>
- <li>Latin 0 EBCDIC</li>
- <li>EBCDIC Arabic (ebcdic-cp-ar1)</li>
- </ul>
- </ul>
- <p> Please also look at the documentation for the feature
- "http://apache.org/xml/features/allow-java-encodings"
- which provides a mechanism for using the
- encoding names recognized directly by Java.</p>
- </a>
- </faq>
-
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE faqs SYSTEM 'dtd/faqs.dtd'>
+<faqs title='General FAQs'>
+ <faq title='Validation'>
+ <q>How do I turn on validation?</q>
+ <a>
+ <p>
+ You can turn validation on and off via methods available
+ on the SAX2 <code>XMLFilter</code> interface. While only the
+ <code>SAXParser</code> implements the <code>XMLFilter</code>
+ interface, the methods required for turning on validation
+ are available to both parser classes, DOM and SAX.
+ <br/>
+ The code snippet below shows how to turn validation on -- assume
+ that <ref>parser</ref> is an instance of either
+ <code>org.apache.xerces.parsers.SAXParser</code> or
+ <code>org.apache.xerces.parsers.DOMParser</code>.
+ <br/><br/>
+ <code>parser.setFeature("http://xml.org/sax/features/validation", true);</code>
+ </p>
+ </a>
+ </faq>
+ <faq title='International Encodings'>
+ <q>What international encodings are supported by &ParserName;?</q>
+ <a>
+ <ul>
+ <li>UTF-8</li>
+ <li>UTF-16 Big Endian, UTF-16 Little Endian</li>
+ <li>IBM-1208</li>
+ <li>ISO Latin-1 (ISO-8859-1)</li>
+ <li>
+ ISO Latin-2 (ISO-8859-2) [Bosnian, Croatian, Czech,
+ Hungarian, Polish, Romanian, Serbian (in Latin transcription),
+ Serbocroatian, Slovak, Slovenian, Upper and Lower Sorbian]
+ </li>
+ <li>ISO Latin-3 (ISO-8859-3) [Maltese, Esperanto]</li>
+ <li>ISO Latin-4 (ISO-8859-4)</li>
+ <li>ISO Latin Cyrillic (ISO-8859-5)</li>
+ <li>ISO Latin Arabic (ISO-8859-6)</li>
+ <li>ISO Latin Greek (ISO-8859-7)</li>
+ <li>ISO Latin Hebrew (ISO-8859-8)</li>
+ <li>ISO Latin-5 (ISO-8859-9) [Turkish]</li>
+ <li>Extended Unix Code, packed for Japanese (euc-jp, eucjis)</li>
+ <li>Japanese Shift JIS (shift-jis)</li>
+ <li>Chinese (big5)</li>
+ <li>Chinese for PRC (mixed 1/2 byte) (gb2312)</li>
+ <li>Japanese ISO-2022-JP (iso-2022-jp)</li>
+ <li>Cyrllic (koi8-r)</li>
+ <li>Extended Unix Code, packed for Korean (euc-kr)</li>
+ <li>Russian Unix, Cyrillic (koi8-r)</li>
+ <li>Windows Thai (cp874)</li>
+ <li>Latin 1 Windows (cp1252)</li>
+ <li>cp858</li>
+ <li>EBCDIC encodings:</li>
+ <ul>
+ <li>EBCDIC US (ebcdic-cp-us)</li>
+ <li>EBCDIC Canada (ebcdic-cp-ca)</li>
+ <li>EBCDIC Netherland (ebcdic-cp-nl)</li>
+ <li>EBCDIC Denmark (ebcdic-cp-dk)</li>
+ <li>EBCDIC Norway (ebcdic-cp-no)</li>
+ <li>EBCDIC Finland (ebcdic-cp-fi)</li>
+ <li>EBCDIC Sweden (ebcdic-cp-se)</li>
+ <li>EBCDIC Italy (ebcdic-cp-it)</li>
+ <li>EBCDIC Spain, Latin America (ebcdic-cp-es)</li>
+ <li>EBCDIC Great Britain (ebcdic-cp-gb)</li>
+ <li>EBCDIC France (ebcdic-cp-fr)</li>
+ <li>EBCDIC Hebrew (ebcdic-cp-he)</li>
+ <li>EBCDIC Switzerland (ebcdic-cp-ch)</li>
+ <li>EBCDIC Roece (ebcdic-cp-roece)</li>
+ <li>EBCDIC Yugoslavia (ebcdic-cp-yu)</li>
+ <li>EBCDIC Iceland (ebcdic-cp-is)</li>
+ <li>EBCDIC Urdu (ebcdic-cp-ar2)</li>
+ <li>Latin 0 EBCDIC</li>
+ <li>EBCDIC Arabic (ebcdic-cp-ar1)</li>
+ </ul>
+ </ul>
+ </a>
+ </faq>
</faqs>
1.3 +87 -64 xml-xerces/java/docs/faq-performance.xml
Index: faq-performance.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/faq-performance.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- faq-performance.xml 2000/05/23 20:28:56 1.2
+++ faq-performance.xml 2001/08/23 00:35:14 1.3
@@ -1,65 +1,88 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE faqs SYSTEM "./dtd/faqs.dtd">
-
-<faqs title="Performance FAQs">
-
- <faq title="General Performance">
- <q>General Performance</q>
- <a><p>Don't use XML where it doesn't make sense. XML is not a panacea.
- You will not get good performance by transferring and parsing a
- lot of XML files. </p>
- <p>Using XML is memory, CPU, and network intensive.</p></a>
- </faq>
-
- <faq title="Parser Performance">
- <q>Parser Performance</q>
- <a><p>Avoid creating a new parser each time you parse; reuse parser
- instances. A pool of reusable parser instances might be a good idea
- if you have multiple threads parsing at the same time.</p>
- </a>
- </faq>
- <faq title="Parsing Documents Performance">
- <q>Parsing Documents Performance</q>
- <a><ul>
- <li>Convert the document to US ASCII ("US-ASCII") or Unicode
- ("UTF-8" or "UTF-16") before parsing. Documents written using
- ASCII are the fastest to parse because each character is
- guaranteed to be a single byte and map directly to their
- equivalent Unicode value. For documents that contain Unicode
- characters beyond the ASCII range, multiple byte sequences
- must be read and converted for each character. There is a
- performance penalty for this conversion. The UTF-16 encoding
- alleviates some of this penalty because each character is
- specified using two bytes, assuming no surrogate characters.
- However, using UTF-16 can roughly double the size of the
- original document which takes longer to parse.</li>
- <li>Explicitly specify "US-ASCII" encoding if your document is in
- ASCII format. If no encoding is specified, the XML specification
- requires the parser to assume UTF-8 which is slower to process.</li>
- <li>Avoid external entities and external DTDs. The extra file
- opens and transcoding setup is expensive.</li>
- <li>Reduce character count; smaller documents are parsed quicker.
- Replace elements with attributes where it makes sense. Avoid
- gratuitous use of whitespace because the parser must scan past it.</li>
- <li>Avoid using too many default attributes. Defaulting
- attribute values slows down processing.</li>
- </ul>
- </a>
- </faq>
- <faq title="XML Application Performance">
- <q>XML Application Performance</q>
- <a><ul>
- <li>Turn validation off if you don't need it. Validation is
- expensive. Also, avoid using a DOCTYPE line in your XML document.
- The current version of the parser will always read the DTD if the
- DOCTYPE line is specified even when not validating.</li>
- <li>For large documents, avoid using DOM which uses a lot of
- memory. Instead, use SAX if appropriate. The DOM parser requires
- that the entire document be read into memory before the
- application processes the document. The SAX parser uses very
- little memory and notifies the application as parts of the
- document are parsed.</li>
- </ul>
- </a>
- </faq>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE faqs SYSTEM 'dtd/faqs.dtd'>
+<faqs title='Performance FAQs'>
+ <faq title='General Performance'>
+ <q>General Performance</q>
+ <a>
+ <p>
+ Don't use XML where it doesn't make sense. XML is not a panacea.
+ You will not get good performance by transferring and parsing a
+ lot of XML files.
+ </p>
+ <p>Using XML is memory, CPU, and network intensive.</p>
+ </a>
+ </faq>
+ <faq title='Parser Performance'>
+ <q>Parser Performance</q>
+ <a>
+ <p>
+ Avoid creating a new parser each time you parse; reuse parser
+ instances. A pool of reusable parser instances might be a good idea
+ if you have multiple threads parsing at the same time.
+ </p>
+ </a>
+ </faq>
+ <faq title='Parsing Documents Performance'>
+ <q>Parsing Documents Performance</q>
+ <a>
+ <p>
+ There are a variety of things that you can do to improve the
+ performance when parsing documents:
+ </p>
+ <ul>
+ <li>
+ Convert the document to US ASCII ("US-ASCII") or Unicode
+ ("UTF-8" or "UTF-16") before parsing. Documents written using
+ ASCII are the fastest to parse because each character is
+ guaranteed to be a single byte and map directly to their
+ equivalent Unicode value. For documents that contain Unicode
+ characters beyond the ASCII range, multiple byte sequences
+ must be read and converted for each character. There is a
+ performance penalty for this conversion. The UTF-16 encoding
+ alleviates some of this penalty because each character is
+ specified using two bytes, assuming no surrogate characters.
+ However, using UTF-16 can roughly double the size of the
+ original document which takes longer to parse.
+ </li>
+ <li>
+ Explicitly specify "US-ASCII" encoding if your document is in
+ ASCII format. If no encoding is specified, the XML specification
+ requires the parser to assume UTF-8 which is slower to process.
+ </li>
+ <li>
+ Avoid external entities and external DTDs. The extra file
+ opens and transcoding setup is expensive.
+ </li>
+ <li>
+ Reduce character count; smaller documents are parsed quicker.
+ Replace elements with attributes where it makes sense. Avoid
+ gratuitous use of whitespace because the parser must scan past it.
+ </li>
+ <li>
+ Avoid using too many default attributes. Defaulting attribute
+ values slows down processing.
+ </li>
+ </ul>
+ </a>
+ </faq>
+ <faq title='XML Application Performance'>
+ <q>XML Application Performance</q>
+ <a>
+ <ul>
+ <li>
+ Turn validation off if you don't need it. Validation is expensive.
+ Also, avoid using a DOCTYPE line in your XML document. The current
+ version of the parser will always read the DTD if the DOCTYPE line
+ is specified even when not validating.
+ </li>
+ <li>
+ For large documents, avoid using DOM which uses a lot of memory.
+ Instead, use SAX if appropriate. The DOM parser requires that
+ the entire document be read into memory before the application
+ processes the document. The SAX parser uses very little memory
+ and notifies the application as parts of the document are parsed.
+ </li>
+ </ul>
+ </a>
+ </faq>
</faqs>
1.12 +319 -325 xml-xerces/java/docs/faq-write.xml
Index: faq-write.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/faq-write.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- faq-write.xml 2000/11/02 22:57:34 1.11
+++ faq-write.xml 2001/08/23 00:35:14 1.12
@@ -1,327 +1,327 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE faqs SYSTEM "./dtd/faqs.dtd">
-
-<faqs title="Writing Application FAQs">
- <faq title="Creating a DOM Parser">
- <q>How do I create a DOM parser?</q>
- <a>
-<source>import org.apache.xerces.parsers.DOMParser;
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE faqs SYSTEM 'dtd/faqs.dtd'>
+<faqs title='Writing Application FAQs'>
+ <faq title='Creating a DOM Parser'>
+ <q>How do I create a DOM parser?</q>
+ <a>
+ <p>
+ You can create a DOM parser by using the Java APIs for
+ XML Processing (JAXP). The following source code shows
+ how:
+ </p>
+ <source>import java.io.IOException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
-import java.io.IOException;
...
-
-String xmlFile = "file:///&javaparserdirectory;/data/personal.xml";
-DOMParser parser = new DOMParser();
-
+String xmlFile = "file:///&parserdir;/data/personal.xml";
try {
- parser.parse(xmlFile);
-
-} catch (SAXException se) {
- se.printStackTrace();
-} catch (IOException ioe) {
- ioe.printStackTrace();
+ DocumentBuilderFactory factory =
+ DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document document = builder.parse(xmlFile);
}
-
-Document document = parser.getDocument();</source>
- </a>
- </faq>
-
- <faq title="Creating a SAX Parser">
- <q>How do I create a SAX parser?</q>
- <a>
-<source>import org.apache.xerces.parsers.SAXParser;
-import org.xml.sax.Parser;
-import org.xml.sax.ParserFactory;
-import org.xml.sax.SAXException;
+catch (FactoryConfigurationError e) {
+ // unable to get a document builder factory
+}
+catch (ParserConfigurationException e) {
+ // parser was unable to be configured
+catch (SAXException e) {
+ // parsing error
+}
+catch (IOException e) {
+ // i/o error
+}</source>
+ </a>
+ </faq>
+ <faq title="Creating a SAX Parser">
+ <q>How do I create a SAX parser?</q>
+ <a>
+ <p>
+ You can create a SAX parser by using the Java APIs for
+ XML Processing (JAXP). The following source code shows
+ how:
+ </p>
+ <source>
import java.io.IOException;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
...
-String xmlFile = "file:///&javaparserdirectory;/data/personal.xml";
-
-String parserClass = "org.apache.xerces.parsers.SAXParser";
-Parser parser = ParserFactory.makeParser(parserClass);
-
+String xmlFile = "file:///&parserdir;/data/personal.xml";
try {
- parser.parse(xmlFile);
-} catch (SAXException se) {
- se.printStackTrace();
-} catch (IOException ioe) {
- ioe.printStackTrace();
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser parser = factory.newSAXParser();
+ DefaultHandler handler = /* custom handler class */;
+ parser.parse(xmlFile, handler);
+}
+catch (FactoryConfigurationError e) {
+ // unable to get a document builder factory
+}
+catch (ParserConfigurationException e) {
+ // parser was unable to be configured
+catch (SAXException e) {
+ // parsing error
+}
+catch (IOException e) {
+ // i/o error
}</source>
- </a>
- </faq>
-
- <faq title="Controlling parser options">
- <q>How do I control the various parser options?</q>
- <a><p>For this release, all of the parser control API's have
- been switched over to the SAX2 Configurable interface. This
- provide a uniform and extensible mechanism for setting and
- querying parser options. Here are guides to the set of
- available <link idref="features">features</link> and
- <link idref="properties">properties</link>.</p>
- </a>
- </faq>
- <faq title="Using lazy DOM">
- <q>How do I use the lazy evaluating DOM implementation?</q>
- <a><p>The DOM parser class <code>org.apache.xerces.parsers.DOMParser</code> uses a
- DOM implementation that can take advantage of lazy evaluation to
- improve performance. There is also a mode where the parser creates
- all of the nodes as the document is parsed. By default, the parser
- uses the lazy evaluation DOM implementation.</p>
- <p>Nodes in the DOM tree are only created when they are accessed.
- The initial call to <code>getDocument()</code> will return a DOM tree that
- consists only of the Document node. All of the immediate children
- of a Node are created when any of that Node's children are accessed.
- This shortens the time it takes to parse an XML file and create a DOM
- tree at the expense of requiring more memory during parsing and
- traversing the document.</p>
- <p>The lazy evaluation feature is set using the SAX2 Configurable
- interface. To turn off this feature, use the following code:</p>
-<source>DOMParser parser = new DOMParser();
-parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false);</source>
- <p>To turn the lazy evaluation feature back on, use the following code:</p>
-
-<source>parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", true);</source>
- </a>
- </faq>
-
- <faq title="Handling Errors">
- <q>How do handle errors?</q>
- <a><p>When you create a parser instance, the default error handler does nothing.
- This means that your program will fail silently when it encounters an error.
- You should register an error handler with the parser by supplying a class
- which implements the <code>org.xml.sax.ErrorHandler</code>
- interface. This is true regardless of whether your parser is a
- DOM based or SAX based parser.</p>
- </a>
- </faq>
-
- <faq title="Controlling Entity Representation">
- <q>How can I control the way that entities are represented in
- the DOM?</q>
- <a><p>
- The feature <code>http://apache.org/xml/features/dom/create-entity-ref-nodes</code>
- controls how entities appear in the DOM tree. When this
- feature is set to true (the default), an occurance of an
- entity reference in the XML document will be represented by a
- subtree with an EntityReference node at the root whose
- children represent the entity expansion.</p>
-
- <p>If the property is false, an entity reference in the XML
- document is represented by only the nodes that represent the
- entity expansion.</p>
-
- <p>In either case, the entity expansion will be a DOM tree
- representing the structure of the entity expansion, not a text
- node containing the entity expansion as text.</p>
- </a>
- </faq>
-
- <faq title="What does "non-validating" mean?">
- <q>Why does "non-validating" not mean "well-formedness checking only"?</q>
- <a><p>Using a "non-validating" parser does not mean that only well-formedness
- checking is done! There are still many things that the XML specification
- requires of the parser, including entity substitution, defaulting of
- attribute values, and attribute normalization.</p>
- <p>This table describes what "non-validating" really means for &javaparsername; parsers.
- In this table, "no DTD" means no internal or external DTD subset is present.</p>
-
- <table>
- <tr><tn/>
- <th colspan="2">non-validating parsers</th>
- <th colspan="2">validating parsers</th>
- </tr>
- <tr><tn/> <th>DTD present</th> <th>no DTD</th> <th>DTD present</th> <th>no DTD</th></tr>
- <tr><th>DTD is read</th> <td>Yes</td> <td>No</td> <td>Yes</td> <td>Error</td></tr>
- <tr><th>entity substitution</th> <td>Yes</td> <td>No</td> <td>Yest</td> <td>Error</td></tr>
- <tr><th>defaulting of attributes</th> <td>Yes</td> <td>No</td> <td>Yes</td> <td>Error</td></tr>
- <tr><th>attribute normalization</th> <td>Yes</td> <td>No</td> <td>Yes</td> <td>Error</td></tr>
- <tr><th>checking against model</th> <td>No</td> <td>No</td> <td>Yes</td> <td>Error</td></tr>
- </table>
- </a>
- </faq>
-
- <faq title="Associating Data with a Node">
- <q>How do I associate my own data with a node in the DOM tree?</q>
- <a><p>The class <code>org.apache.xerces.dom.NodeImpl</code> provides a
- <code>void setUserData(Object o)</code> and an <code>Object getUserData()</code>
- method that you can use to attach any object to a node in the DOM tree.</p>
- <p>Beware that you should try and remove references to your
- data on nodes you no longer use (by calling
- <code>setUserData(null)</code>, or these nodes will not be
- garbage collected until the whole document is.</p>
- </a>
- </faq>
-
- <faq title="Parsing Several Documents">
- <q>How do I more efficiently parse several documents sharing a common DTD?</q>
- <a> <p>DTDs are not currently cached by the parser. The common DTD, since it is
- specified in each XML document, will be re-parsed once for each document.</p>
- <p>However, there are things that you can do now, to make the process of
- reading DTD's more efficient:</p>
- <ul>
- <li>keep your DTD and DTD references local</li>
- <li>use internal DTD subsets, if possible</li>
- <li>load files from server to local client before parsing</li>
- <li>Cache document files into a local client cache. You should do an
- HTTP header request to check whether the document has changed,
- before accessing it over the network.</li>
- <li>Do not reference an external DTD or internal DTD subset at all.
- In this case, no DTD will be read.</li>
- <li>Use a custom <code>EntityResolver</code> and keep common
- DTDs in a memory buffer.</li>
- </ul>
- </a>
- </faq>
-
- <faq title="How do I access the DOM Level 2 functionality?">
- <q>How do I access the DOM Level 2 functionality?</q>
- <a><p>The <jump href="http://www.w3.org/TR/DOM-Level-2/">DOM Level 2</jump>
- specification is at the stage of
- "Candidate Recommendation" (CR), which allows feedback from implementors
- before it becomes a "Recommedation". It is comprised of "core"
- functionality, which is mainly the DOM
- <jump href="http://www.w3.org/TR/REC-xml-names/">Namespaces</jump> implementation,
- and a number of optional modules (called Chapters in the spec).</p>
- <p>Please refer to:</p>
- <p><jump href="http://www.w3.org/TR/DOM-Level-2/">
- http://www.w3.org/TR/DOM-Level-2/</jump> for the
- latest DOM Level 2 specification.</p>
- <p>The following DOM Level 2 modules are fully implemented in &javaparsername;: </p>
- <ul>
- <li><jump href="http://www.w3.org/TR/DOM-Level-2/core.html">
- Chapter 1: Core</jump> - most of these enhancements are for
- Namespaces, and can be acessed through additional functions which
- have been added directly to the <ref>org.w3c.dom.*</ref> classes.</li>
-
- <li><jump href="http://www.w3.org/TR/DOM-Level-2/events.html">
- Chapter 6: Events</jump> - The <ref>org.w3c.dom.events.EventTarget</ref>
- interface is implemented by all <code>Nodes</code> of the DOM.
- The &javaparsername; DOM implementation handles all of the event
- triggering, capture and flow.</li>
-
- <li><jump href="http://www.w3.org/TR/DOM-Level-2/traversal.html">
- Chapter 7: Traversal</jump> - The Traversal module interfaces
- are located in <ref>org.w3c.dom.traversal</ref>.
- The <code>NodeIterator</code> and <code>TreeWalker</code>, and
- <code>NodeFilter</code> interfaces have been supplied to allow
- traversal of the DOM at a higher-level. Our DOM Document
- implementation class, <code>DocumentImpl</code> class now
- implements <code>DocumentTraversal</code>, which supplies the
- factory methods to create the iterators and treewalkers.</li>
-
- <li><jump href="http://www.w3.org/TR/DOM-Level-2/range.html">
- Chapter 8. Range</jump> - The Range module interfaces are
- located in <ref>org.w3c.dom.range</ref>. The Range interface
- allows you to specify ranges or selections using boundary
- points in the DOM, along with functions (like delete,
- clone, extract..) that can be performed on these ranges.
- Our DOM Document implementation class, <code>DocumentImpl</code>
- class now implements <code>DocumentRange</code>, that supplies
- the factory method to create a <code>Range</code>.</li>
- </ul>
- <note>Since the DOM Level 2 is still in the CR phase, some changes
- to these specs are still possible. The purpose of this phase is to
- provide feedback to the W3C, so that the specs can be clarified and
- implementation concerns can be addressed.</note>
- </a>
- </faq>
-
- <faq title="How do I read data from a stream as it arrives?">
- <q>How do I read data from a stream as it arrives?</q>
- <a><p>There are 3 problems you have to deal with:</p>
-
-<ol>
-<li>The Apache parsers read the entire data stream into a buffer before they start
- parsing; you need to change this behaviour, so that they analyse "on the fly"</li>
-<li>The Apache parsers terminate when they reach end-of-file; with a data stream,
- unless the sender drops the socket, you have no end-of-file, so you need to
- terminate in some other way</li>
-<li>The Apache parsers close the input stream on termination, and this closes the
- socket; you normally don't want this, because you'll want to send an ack to the
- data stream source, and you may want to have further exchanges on the socket
- anyway.</li>
-</ol>
-
-
-<p>Preventing the buffering</p>
-<p>To do this, create a subclass of org.apache.xerces.readers.DefaultReaderFactory
-and override createCharReader and createUTF8Reader as shown below.</p>
-
-<source>
-package org.apache.xerces.readers;
-
-import org.apache.xerces.framework.XMLErrorReporter;
-import org.apache.xerces.utils.ChunkyByteArray;
-import org.apache.xerces.utils.StringPool;
-import org.xml.sax.InputSource;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-import java.util.Stack;
-
-public class StreamingCharFactory extends org.apache.xerces.readers.DefaultReaderFactory {
- public XMLEntityHandler.EntityReader createCharReader(XMLEntityHandler entityHandler,
- XMLErrorReporter errorReporter,boolean sendCharDataAsCharArray,
- Reader reader,
- StringPool stringPool)
- throws Exception
- {
- return new org.apache.xerces.readers.StreamingCharReader(entityHandler,
- errorReporter,
- sendCharDataAsCharArray,
- reader,
- stringPool);
- }
+ </a>
+ </faq>
+ <!--
+ - REVISIT: make sure that JAXP implementation can handle
+ - passing features and properties through to the
+ - parser implementation. Then complete this section.
+ <faq title='Controlling parser options'>
+ <q>How do I control the various parser options?</q>
+ <a>TBD</a>
+ </faq>
+ -->
+ <faq title='Handling Errors'>
+ <q>How do handle errors?</q>
+ <a>
+ <p>
+ You should register an error handler with the parser by supplying
+ a class which implements the <code>org.xml.sax.ErrorHandler</code>
+ interface. This is true regardless of whether your parser is a
+ DOM based or SAX based parser.
+ </p>
+ <p>
+ You can register an error handler on a <code>DocumentBuilder</code>
+ created using JAXP like this:
+ </p>
+ <source>import javax.xml.parsers.DocumentBuilder;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
- public XMLEntityHandler.EntityReader createUTF8Reader(XMLEntityHandler entityHandler,
- XMLErrorReporter errorReporter,
- boolean sendCharDataAsCharArray,
- InputStream data,StringPool stringPool)
- throws Exception
- {
- XMLEntityHandler.EntityReader reader;
- reader = new org.apache.xerces.readers.StreamingCharReader(entityHandler,
- errorReporter,
- sendCharDataAsCharArray,
- new InputStreamReader(data, "UTF8"),
- stringPool);
- return reader;
+ErrorHandler handler = new ErrorHandler() {
+ public void warning(SAXParseException e) throws SAXException {
+ System.err.println("[warning] "+e.getMessage());
}
-}
-</source>
-
-<p>
-In your program, after you instantiate a parser class, replace the
-DefaultReaderFactory with StreamingCharFactory. You'll need to instantiate your
-parser as a SAXParser, rather than simply as an XMLReader, because the XMLReader
-interface doesn't have the setReaderFactory method. Be sure to wrap the
-InputStream that you are reading from with an InputStreamReader.
-</p>
+ public void error(SAXParseException e) throws SAXException {
+ System.err.println("[error] "+e.getMessage());
+ }
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.err.println("[fatal error] "+e.getMessage());
+ throw e;
+ }
+};
-<source>
-try {
- SAXParser parser =
- (SAXParser)Class.forName("org.apache.xerces.parsers.SAXParser").newInstance();
- parser.setContentHandler(new DocProcessor(out));
- parser.setReaderFactory(new StreamingCharFactory());
- parser.parse(new InputSource(bufferedReader));
-} catch (Exception ex) {
-}
-</source>
+DocumentBuilder builder = /* builder instance */;
+builder.setErrorHandler(handler);</source>
+ <p>
+ You can also register an error handler on a SAXParser using JAXP
+ like this:
+ </p>
+ <source>import javax.xml.parsers.SAXParser;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
-<p>Terminating the parse</p>
-<p>One way that works forSAX is to throw an exception when you detect the logical
-end-of-document.</p>
-<p>For instance, in your class extending DefaultHandler, you can have:</p>
+ErrorHandler handler = new ErrorHandler() {
+ public void warning(SAXParseException e) throws SAXException {
+ System.err.println("[warning] "+e.getMessage());
+ }
+ public void error(SAXParseException e) throws SAXException {
+ System.err.println("[error] "+e.getMessage());
+ }
+ public void fatalError(SAXParseException e) throws SAXException {
+ System.err.println("[fatal error] "+e.getMessage());
+ throw e;
+ }
+};
-<source>
-public class DocProcessor extends DefaultHandler {
+SAXParser parser = /* parser instance */;
+parser.getXMLReader().setErrorHandler(handler);</source>
+ </a>
+ </faq>
+ <faq title='Controlling Entity Representation'>
+ <q>
+ How can I control the way that entities are represented in the DOM?
+ </q>
+ <a>
+ <p>
+ The feature
+ <code>http://apache.org/xml/features/dom/create-entity-ref-nodes</code>
+ controls how entities appear in the DOM tree. When this feature
+ is set to true (the default), an occurance of an entity reference
+ in the XML document will be represented by a subtree with an
+ EntityReference node at the root whose children represent the
+ entity expansion.
+ </p>
+ <p>
+ If the property is false, an entity reference in the XML document
+ is represented by only the nodes that represent the entity
+ expansion.
+ </p>
+ <p>
+ In either case, the entity expansion will be a DOM tree
+ representing the structure of the entity expansion, not a text
+ node containing the entity expansion as text.
+ </p>
+ </a>
+ </faq>
+ <faq title='What does "non-validating" mean?'>
+ <q>
+ Why does "non-validating" not mean "well-formedness
+ checking only"?
+ </q>
+ <a>
+ <p>
+ Using a "non-validating" parser does not mean that
+ only well-formedness checking is done! There are still many
+ things that the XML specification requires of the parser,
+ including entity substitution, defaulting of attribute values,
+ and attribute normalization.
+ </p>
+ <p>
+ This table describes what "non-validating" really
+ means for &ParserName; parsers. In this table, "no DTD"
+ means no internal or external DTD subset is present.
+ </p>
+ <table>
+ <tr>
+ <tn/>
+ <th colspan="2">non-validating parsers</th>
+ <th colspan="2">validating parsers</th>
+ </tr>
+ <tr>
+ <tn/>
+ <th>DTD present</th>
+ <th>no DTD</th>
+ <th>DTD present</th>
+ <th>no DTD</th>
+ </tr>
+ <tr>
+ <th>DTD is read</th>
+ <td>Yes</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Error</td>
+ </tr>
+ <tr>
+ <th>entity substitution</th>
+ <td>Yes</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Error</td>
+ </tr>
+ <tr>
+ <th>defaulting of attributes</th>
+ <td>Yes</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Error</td>
+ </tr>
+ <tr>
+ <th>attribute normalization</th>
+ <td>Yes</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Error</td>
+ </tr>
+ <tr>
+ <th>checking against model</th>
+ <td>No</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Error</td>
+ </tr>
+ </table>
+ </a>
+ </faq>
+ <faq title='Associating Data with a Node'>
+ <q>How do I associate my own data with a node in the DOM tree?</q>
+ <a>
+ <p>
+ The class <code>org.apache.xerces.dom.NodeImpl</code> provides a
+ <code>void setUserData(Object o)</code> and an <code>Object
+ getUserData()</code> method that you can use to attach any object
+ to a node in the DOM tree.
+ </p>
+ <p>
+ Beware that you should try and remove references to your data on
+ nodes you no longer use (by calling <code>setUserData(null)</code>,
+ or these nodes will not be garbage collected until the entire
+ document is garbage collected.
+ </p>
+ </a>
+ </faq>
+ <faq title='Parsing Several Documents'>
+ <q>
+ How do I more efficiently parse several documents sharing a
+ common DTD?
+ </q>
+ <a>
+ <p>
+ DTDs are not currently cached by the parser. The common DTD,
+ since it is specified in each XML document, will be re-parsed
+ once for each document.
+ </p>
+ <p>
+ However, there are things that you can do now, to make the
+ process of reading DTD's more efficient:
+ </p>
+ <ul>
+ <li>keep your DTD and DTD references local</li>
+ <li>use internal DTD subsets, if possible</li>
+ <li>load files from server to local client before parsing</li>
+ <li>
+ Cache document files into a local client cache. You should do an
+ HTTP header request to check whether the document has changed,
+ before accessing it over the network.
+ </li>
+ <li>
+ Do not reference an external DTD or internal DTD subset at all.
+ In this case, no DTD will be read.
+ </li>
+ <li>
+ Use a custom <code>EntityResolver</code> and keep common
+ DTDs in a memory buffer.
+ </li>
+ </ul>
+ </a>
+ </faq>
+ <!--
+ - REVISIT: Rewrite this section with better information.
+ <faq title='How do I read data from a stream as it arrives?'>
+ <q>How do I read data from a stream as it arrives?</q>
+ <a>
+ <p>There are 2 problems you have to deal with:</p>
+ <ol>
+ <li>
+ The Apache parsers terminate when they reach end-of-file; with
+ a data stream, unless the sender drops the socket, you have no
+ end-of-file, so you need to terminate in some other way
+ </li>
+ <li>
+ The Apache parsers close the input stream on termination, and
+ this closes the socket; you normally don't want this, because
+ you'll want to send an ack to the data stream source, and you
+ may want to have further exchanges on the socket anyway.
+ </li>
+ </ol>
+ <p>Terminating the parse</p>
+ <p>
+ One way that works forSAX is to throw an exception when you
+ detect the logical end-of-document.
+ </p>
+ <p>
+ For instance, in your class extending DefaultHandler, you can
+ have:
+ </p>
+ <source>public class DocProcessor extends DefaultHandler {
private int level;
.
.
@@ -337,24 +337,18 @@
String localName,
String qName) throws SAXException
{
- if ((--level) == 0) {
+ level = level - 1;
+ if (level == 0) {
throw new SAXException ("Finished");
}
- }
-</source>
-
-<p>
- Preventing the parser from closing the socket
-
- One way is to subclass BufferedReader to provide an empty close method.
-
- So, invoke the parser as follows:
-</p>
+ }</source>
+ <p>Preventing the parser from closing the socket</p>
+ <p>
+ One way is to subclass BufferedReader to provide an empty close
+ method. So, invoke the parser as follows:
+ </p>
+ <source>Socket socket;
-<source>
-
- Socket socket;
-
// code to set the socket
parser.parse(new InputSource(new MyBufferedReader(new InputStreamReader(socket.getInputStream()))));
@@ -368,8 +362,8 @@
public void close() {
}
- }
-</source>
-
-</a></faq>
+ }</source>
+ </a>
+ </faq>
+ -->
</faqs>
1.16 +286 -269 xml-xerces/java/docs/features.xml
Index: features.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/features.xml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- features.xml 2001/05/18 19:30:17 1.15
+++ features.xml 2001/08/23 00:35:14 1.16
@@ -1,272 +1,289 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE s1 SYSTEM "./dtd/document.dtd">
-
-<s1 title="Features">
- <s2 title="Setting Features">
- <anchor name="features"/>
- <p>To set a feature on either org.apache.xerces.parsers.SAXParser or
- org.apache.xerces.parsers.DOMParser, you should use the SAX2
- method <code>setFeature(String,boolean)</code>. To query a
- feature, use the SAX2 method <code>getFeature(String)</code>.</p>
- <p>For example, to turn on validation:</p>
-<source>SAXParser p=new SAXParser();
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE features SYSTEM 'dtd/settings.dtd'>
+<features>
+ <desc name='Setting Features'>
+ <p>
+ If you have created a DOM document builder or a SAX parser using
+ the JAXP interfaces, you may have difficulty setting features and
+ properties directly using those interfaces. The following
+ instructions tell you how to set features on document builders
+ and SAX parsers created from the JAXP interfaces.
+ </p>
+ <p>
+ The DocumentBuilderFactory interface contains a
+ <code>setAttribute(String,Object)</code> method which <em>may</em>
+ provide a means to set features and properties on the underyling
+ parser. However, it cannot be relied upon. Therefore, you must
+ use the Xerces DOMParser object directly. For example:
+ </p>
+ <source>import org.apache.xerces.parsers.DOMParser;
+import org.xml.sax.SAXException;
+
+DOMParser parser = new DOMParser();
try {
- p.setFeature("http://xml.org/sax/features/validation", true);
-} catch (SAXException e) {
- System.out.println("error in setting up parser feature");
+ parser.setFeature("http://xml.org/sax/features/allow-java-encodings",
+ true);
+}
+catch (SAXException e) {
+ System.err.println("could not set parser feature");
}</source>
- </s2>
-
- <s2 title="General Features">
- <anchor name="validation"/>
- <p>http://xml.org/sax/features/validation</p>
- <table>
- <tr><th>True:</th> <td>Validate the document.</td></tr>
- <tr><th>False:</th> <td>Do not validate the document.</td></tr>
- <tr><th>Default:</th> <td>false</td></tr>
- <tr><th>Access:</th> <td>(parsing) read-only; (not parsing) read/write</td></tr>
- <tr><th>Note:</th> <td>If this feature is set to true, the document must specify a grammar.
- If this feature is set to false, the document may specify a grammar
- and that grammar will be parsed but no validation of the document
- contents will be performed.</td></tr>
- <tr><th>See:</th> <td><link anchor="dynamic">http://apache.org/xml/features/validation/dynamic</link>
- <br/><link anchor="namespaces">http://xml.org/sax/features/namespaces</link></td></tr>
- </table>
-
- <anchor name="external-general-entities"/>
- <p>http://xml.org/sax/features/external-general-entities</p>
- <table>
- <tr><th>True:</th> <td>Include external general (text) entities.</td></tr>
- <tr><th>False:</th> <td>Do not include external general entities.</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- <tr><th>Access:</th> <td>(parsing) read-only; (not parsing) read/write</td></tr>
- <tr><th>See:</th>
- <td><link anchor="external-parameter-entities">http://xml.org/sax/features/external-parameter-entities</link></td></tr>
- </table>
-
- <anchor name="external-parameter-entities"/>
- <p>http://xml.org/sax/features/external-parameter-entities</p>
- <table>
- <tr><th>True:</th> <td>Include external parameter entities and the external DTD subset.</td></tr>
- <tr><th>False:</th> <td>Do not include external parameter entities or the external DTD subset.</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- <tr><th>Access:</th> <td>(parsing) read-only; (not parsing) read/write</td></tr>
- <tr><th>See:</th>
- <td><link anchor="external-parameter-entities">http://xml.org/sax/features/external-parameter-entities</link></td></tr>
- </table>
-
- <anchor name="namespaces"/>
- <p>http://xml.org/sax/features/namespaces</p>
- <table>
- <tr><th>True:</th> <td>Perform namespace processing: prefixes will be stripped off element and
- attribute names and replaced with the corresponding namespace URIs. By
- default, the two will simply be concatenated, but the namespace-sep core
- property allows the application to specify a delimiter string for
- separating the URI part and the local part.</td></tr>
- <tr><th>False:</th> <td>Do not perform namespace processing.</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- <tr><th>Access:</th> <td>(parsing) read-only; (not parsing) read/write</td></tr>
- <tr><th>Note:</th> <td>If the validation feature is set to true, then the document must contain
- a grammar that supports the use of namespaces.</td></tr>
- <tr><th>See:</th> <td><link anchor="validation">http://xml.org/sax/features/validation</link>
- <br/><link idref="properties" anchor="namespace-sep">http://xml.org/sax/properties/namespace-sep</link></td></tr>
- </table>
-
- <anchor name="schema"/>
- <p>http://apache.org/xml/features/validation/schema</p>
- <table>
- <tr><th>True:</th> <td>Turn on XML Schema support.</td></tr>
- <tr><th>False:</th> <td>Turn off XML Schema support.</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- </table>
-
- <anchor name="schema-full-checking"/>
- <p>http://apache.org/xml/features/validation/schema-full-checking</p>
- <table>
- <tr><th>True:</th> <td>Enable full schema constraint checking, including checking which may be time-consuming or memory intensive. Currently, particle unique attribution constraint checking and particle derivation resriction checking are controlled by this option.</td></tr>
- <tr><th>False:</th> <td>Disable full constraint checking.</td></tr>
- <tr><th>Default:</th> <td>false</td></tr>
- </table>
-
- <anchor name="dynamic"/>
- <p>http://apache.org/xml/features/validation/dynamic</p>
- <table>
- <tr><th>True:</th> <td>The parser will validate the document only if a grammar is specified.</td></tr>
- <tr><th>False:</th> <td>Validation is determined by the state of the
- <link anchor="validation">http://xml.org/sax/features/validation</link> feature.</td></tr>
- <tr><th>Default:</th> <td>false</td></tr>
- <tr><th>See:</th> <td><link anchor="validation">http://xml.org/sax/features/validation</link></td></tr>
- </table>
-
- <anchor name="warn-on-duplicate-attdef"/>
- <p>http://apache.org/xml/features/validation/warn-on-duplicate-attdef</p>
- <table>
- <tr><th>True:</th><td>Warn on duplicate attribute declaration.</td></tr>
- <tr><th>False:</th><td>Do not warn on duplicate attribute declaration.</td></tr>
- <tr><th>Default:</th><td>true</td></tr>
- </table>
-
- <anchor name="warn-on-undeclared-elemdef"/>
- <p>http://apache.org/xml/features/validation/warn-on-undeclared-elemdef</p>
- <table>
- <tr><th>True:</th> <td>Warn if element referenced in content model is not declared.</td></tr>
- <tr><th>False:</th> <td>Do not warn if element referenced in content model is not declared.</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- </table>
-
- <anchor name="allow-java-encodings"/>
- <p>http://apache.org/xml/features/allow-java-encodings</p>
- <table>
- <tr><th>True:</th> <td>Allow Java encoding names in XMLDecl and TextDecl line.</td></tr>
- <tr><th>False:</th> <td>Do not allow Java encoding names in XMLDecl and TextDecl line.</td></tr>
- <tr><th>Default:</th> <td>false</td></tr>
- <tr><th>Note:</th> <td>A true value for this feature allows the encoding of the file to be
- specified as a Java encoding name as well as the standard ISO encoding
- name. Be aware that other parsers may not be able to use Java encoding
- names. If this feature is set to false, an error will be generated if
- Java encoding names are used.</td></tr>
- </table>
-
- <anchor name="continue-after-fatal-error"/>
- <p>http://apache.org/xml/features/continue-after-fatal-error</p>
- <table>
- <tr><th>True:</th><td>Continue after fatal error.</td></tr>
- <tr><th>False:</th><td>Stops parse on first fatal error.</td></tr>
- <tr><th>Default:</th><td>false</td></tr>
- </table>
-
- <anchor name="load-dtd-grammar"/>
- <p>http://apache.org/xml/features/nonvalidating/load-dtd-grammar</p>
- <table>
- <tr><th>True:</th><td>Load the DTD and use it to
- add default attributes and set
-attribute types when parsing.</td></tr>
- <tr><th>False:</th><td>Build the grammar but do not use
-the default attributes and attribute types information it contains.</td></tr>
- <tr><th>Default:</th><td>true</td></tr>
- <tr><th>Note:</th> <td>This feature is always on when
-validation is on.</td></tr>
- </table>
+ <p>
+ Using the SAXParser interface in JAXP is better because you can
+ query the underlying XMLReader implementation directly and that
+ interface contains methods to set and query features and
+ properties. For example:
+ </p>
+ <source>import javax.xml.parsers.SAXParser;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
- <anchor name="load-external-dtd"/>
- <p>http://apache.org/xml/features/nonvalidating/load-external-dtd</p>
- <table>
- <tr><th>True:</th><td>Load the external DTD.</td></tr>
- <tr><th>False:</th><td>Ignore the external DTD completely.</td></tr>
- <tr><th>Default:</th><td>true</td></tr>
- <tr><th>Note:</th> <td>This feature is
-always on when validation is on.</td></tr>
- </table>
- </s2>
- <s2 title="DOM Features">
- <anchor name="defer-node-expansion"/>
- <p>http://apache.org/xml/features/dom/defer-node-expansion</p>
- <table>
- <tr><th>True:</th> <td>Lazy DOM node expansion.</td></tr>
- <tr><th>False:</th> <td>Full DOM node expansion.</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- <tr><th>Note:</th> <td>This feature only applies when the
- <link idref="properties" anchor="document-class-name">http://apache.org/xml/properties/dom/document-class-name</link> property is
- set to a value other than the name of the default document factory.
- If this feature is set to true, the DOM nodes in the returned
- document are expanded as the tree is traversed. This feature allows
- the parser to return a document faster than if the tree is fully
- expanded during parsing and improves memory usage when the whole
- tree is not traversed.</td></tr>
- <tr><th>See</th> <td><link idref="properties" anchor="document-class-name">http://apache.org/xml/properties/dom/document-class-name</link></td></tr>
- </table>
-
- <anchor name="create-entity-ref-nodes"/>
- <p>http://apache.org/xml/features/dom/create-entity-ref-nodes</p>
- <table>
- <tr><th>True:</th> <td>Create EntityReference nodes in the DOM tree. The EntityReference nodes and their child nodes will be read-only.</td></tr>
- <tr><th>False:</th> <td>Do not create EntityReference nodes in the DOM tree. No EntityReference nodes will be created, only the nodes corresponding to their fully expanded sustitution text will be created.</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- <tr><th>Note:</th> <td>This feature only affects the appearance of EntityReference nodes in
- the DOM tree. The document will always contain the entity reference
- child nodes.</td></tr>
- </table>
-
- <anchor name="include-ignorable-whitespace"/>
- <p>http://apache.org/xml/features/dom/include-ignorable-whitespace</p>
- <table>
- <tr><th>True:</th> <td>Includes text nodes that can be
- considered "ignorable whitespace" in the DOM tree.</td></tr>
- <tr><th>False:</th> <td>Does not include ignorable whitespace in the DOM tree.</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- <tr><th>Note:</th> <td>The only way that the parser can determine if text is ignorable is
- by reading the associated grammar and having a content model for
- the document. When ignorable whitespace text nodes are included in
- the DOM tree, they will be flagged as ignorable. The ignorable flag
- can be queried by calling the TextImpl#isIgnorableWhitespace():boolean
- method.</td></tr>
- </table>
-
- <anchor name="grammar-access"/>
- <p>http://apache.org/xml/features/domx/grammar-access</p>
- <table>
- <tr><th>True:</th> <td>Creates nodes that describe the grammar in the DOM tree.</td></tr>
- <tr><th>False:</th> <td>Does not create create grammar access nodes in the DOM
- tree. This setting makes the DOM behave as a standard
- DOM Level 1 implementation.</td></tr>
- <tr><th>Default:</th> <td>false</td></tr>
- <tr><th>Note:</th> <td>The grammar access nodes are appended as children of the
- DocumentType node. The grammar is specified as an
- XML Schema document tree, whether it was read from a
- document with an associated DTD or XML Schema grammar.
- This is currently a violation of the DOM Level 1
- specification.
- <br/><em>**** This is an experimental feature that is not guaranteed </em>
- <br/><em>**** to be supported in future versions of
- the parser.</em></td></tr>
- </table>
- </s2>
- <s2 title="SAX Features">
- <!--
- <anchor name="use-locator"/>
- <p>http://xml.org/sax/features/use-locator</p>
- <table>
- <tr><th>True:</th> <td>Provide a Locator using the DocumentHandler setDocumentLocator callback.</td></tr>
- <tr><th>False:</th> <td>Explicitly allow the parser not to provide a Locator (but it still may).</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- <tr><th>Note:</th> <td>Xerces-J always provides a Locator to the document handler</td></tr>
- </table>
-
- <anchor name="normalize-text"/>
- <p>http://xml.org/sax/features/normalize-text</p>
- <table>
- <tr><th>True:</th> <td>Ensure that all consecutive text is returned
- in a single callback to the DocumentHandler
- characters method.</td></tr>
- <tr><th>False:</th> <td>Explicitly allow the parser to split
- consecutive text into more than one callback
- (but it still may not do so).</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- <tr><th>Note:</th> <td>Xerces-J currently does not support allowing
- consecutive text to be buffered and returned
- in a single callback to the DocumentHandler
- characters method.</td></tr>
- </table>
- -->
- <anchor name='namespace-prefixes'/>
- <p>http://xml.org/sax/features/namespace-prefixes</p>
- <table>
- <tr><th>True:</th> <td>Report the original prefixed names and attributes used for Namespace declarations.</td></tr>
- <tr><th>False:</th> <td>Do not report attributes used for Namespace declarations, and optionally do not report original prefixed names.</td></tr>
- <tr><th>Default:</th> <td>true</td></tr>
- <tr><th>Access:</th> <td>(parsing) read-only; (not parsing) read/write</td></tr>
- </table>
- <anchor name='string-interning'/>
- <p>http://xml.org/sax/features/string-interning</p>
- <table>
- <tr><th>True:</th> <td>All element names, prefixes, attribute names, Namespace URIs, and local names are internalized using java.lang.String.intern.</td></tr>
- <tr><th>False:</th> <td>Names are not necessarily internalized.</td></tr>
- <tr><th>Default:</th> <td>false</td></tr>
- <tr><th>Access:</th> <td>(parsing) read-only; (not parsing) read/write</td></tr>
- <tr><th>Note:</th> <td>Xerces-J does not support interning all strings using the
- String.intern() method because Xerces-J does its own intern
- optimizations for String objects.</td></tr>
- </table>
- </s2>
-</s1>
-
+SAXParser parser = /* created from SAXParserFactory */;
+XMLReader reader = parser.getXMLReader();
+try {
+ reader.setFeature("http://xml.org/sax/features/allow-java-encodings",
+ true);
+}
+catch (SAXException e) {
+ System.err.println("could not set parser feature");
+}</source>
+ </desc>
+ <fcategory name='General Features'>
+ <feature name='http://xml.org/sax/features/namespaces'
+ id='namespaces'>
+ <true>
+ Perform namespace processing: prefixes will be stripped off
+ element and attribute names and replaced with the corresponding
+ namespace URIs. By default, the two will simply be concatenated,
+ but the namespace-sep core property allows the application to
+ specify a delimiter string for separating the URI part and the
+ local part.
+ </true>
+ <false>Do not perform namespace processing.</false>
+ <default value='true'/>
+ <access parsing='read-only' not-parsing='read-write'/>
+ <note>
+ If the validation feature is set to true, then the document
+ must contain a grammar that supports the use of namespaces.
+ </note>
+ <see idref='namespace-prefixes'/>
+ <see idref='validation'/>
+ </feature>
+ <feature name='http://xml.org/sax/features/validation'
+ id='validation'>
+ <true>Validate the document.</true>
+ <false>Do not validate the document.</false>
+ <default value='false'/>
+ <access parsing='read-only' not-parsing='read-write'/>
+ <note>
+ If this feature is set to true, the document must specify
+ a grammar. If this feature is set to false, the document
+ may specify a grammar and that grammar will be parsed but
+ no validation of the document contents will be performed.
+ </note>
+ <see idref='validation.dynamic'/>
+ <see idref='namespaces'/>
+ </feature>
+ <feature name='http://apache.org/xml/features/validation/dynamic'
+ id='validation.dynamic'>
+ <true>
+ The parser will validate the document only if a grammar is
+ specified.
+ </true>
+ <false>
+ Validation is determined by the state of the <ref>validation</ref>
+ feature.
+ </false>
+ <default value='false'/>
+ <see idref='validation'/>
+ </feature>
+ <!--
+ - REVISIT: Add these features back in once we have Schema
+ - support in this version.
+ -
+ <feature name='http://apache.org/xml/features/validation/schema'
+ id='validation.schema'>
+ <true>Turn on XML Schema support.</true>
+ <false>Turn off XML Schema support.</false>
+ <default value='true'/>
+ </feature>
+ <feature name='http://apache.org/xml/features/validation/schema-full-checking'
+ id='validation.schema-full-checking'>
+ <true>
+ Enable full schema grammar constraint checking, including checking
+ which may be time-consuming or memory intensive. Currently, particle
+ unique attribution constraint checking and particle derivation
+ resriction checking are controlled by this option.
+ </true>
+ <false>Disable full constraint checking.</false>
+ <default value='false'/>
+ <note>
+ This feature checks the Schema grammar itself for additional
+ errors that are time-consuming or memory intensive. It does
+ <strong>not</strong> affect the level of checking performed on
+ document instances that use Schema grammars.
+ </note>
+ </feature>
+ -->
+ <feature name='http://xml.org/sax/features/external-general-entities'
+ id='external-general-entities'>
+ <true>Include external general entities.</true>
+ <false>Do not include external general entities.</false>
+ <default value='true'/>
+ <access parsing='read-only' not-parsing='read-write'/>
+ <see idref='external-parameter-entities'/>
+ </feature>
+ <feature name='http://xml.org/sax/features/external-parameter-entities'
+ id='external-parameter-entities'>
+ <true>
+ Include external parameter entities and the external DTD subset.
+ </true>
+ <false>
+ Do not include external parameter entities or the external DTD subset.
+ </false>
+ <default value='true'/>
+ <access parsing='read-only' not-parsing='read-write'/>
+ <see idref='external-general-entities'/>
+ </feature>
+ <feature name='http://apache.org/xml/features/validation/warn-on-duplicate-attdef'
+ id='validation.warn-on-duplicate-attdef'>
+ <true>Report a warning when a duplicate attribute is re-declared.</true>
+ <false>
+ Do not report a warning when a duplicate attribute is re-declared.
+ </false>
+ <default value='true'/>
+ </feature>
+ <feature name='http://apache.org/xml/features/validation/warn-on-undeclared-elemdef'
+ id='validation.warn-on-undeclared-elemdef'>
+ <true>
+ Report a warning if an element referenced in a content model is
+ not declared.
+ </true>
+ <false>
+ Do not report a warning if an element referenced in a content model
+ is not declared.
+ </false>
+ <default value='true'/>
+ </feature>
+ <feature name='http://apache.org/xml/features/allow-java-encodings'
+ id='allow-java-encodings'>
+ <true>Allow Java encoding names in XMLDecl and TextDecl line.</true>
+ <false>
+ Do not allow Java encoding names in XMLDecl and TextDecl line.
+ </false>
+ <default value='false'/>
+ <note>
+ A true value for this feature allows the encoding of the file to
+ be specified as a Java encoding name as well as the standard ISO
+ encoding name. Be aware that other parsers may not be able to use
+ Java encoding names. If this feature is set to false, an error
+ will be generated if Java encoding names are used.
+ </note>
+ </feature>
+ <feature name='http://apache.org/xml/features/continue-after-fatal-error'
+ id='continue-after-fatal-error'>
+ <true>Attempt to continue parsing after a fatal error.</true>
+ <false>Stops parse on first fatal error.</false>
+ <default value='false'/>
+ <note>
+ The behavior of the parser when this feature is set to
+ <code>true</code> is <strong>undetermined</strong>! Therefore use
+ this feature with extreme caution because the parser may get stuck
+ in an infinite loop or worse.
+ </note>
+ </feature>
+ <feature name='http://apache.org/xml/features/nonvalidating/load-dtd-grammar'
+ id='nonvalidating.load-dtd-grammar'>
+ <true>
+ Load the DTD and use it to add default attributes and set attribute
+ types when parsing.
+ </true>
+ <false>
+ Build the grammar but do not use the default attributes and attribute
+ types information it contains.
+ </false>
+ <default value='true'/>
+ <note>This feature is always on when validation is on.</note>
+ <see idref='validation'/>
+ <see idref='nonvalidating.load-external-dtd'/>
+ </feature>
+ <feature name='http://apache.org/xml/features/nonvalidating/load-external-dtd'
+ id='nonvalidating.load-external-dtd'>
+ <true>Load the external DTD.</true>
+ <false>Ignore the external DTD completely.</false>
+ <default value='true'/>
+ <note>This feature is always on when validation is on.</note>
+ <see idref='validation'/>
+ <see idref='nonvalidating.load-dtd-grammar'/>
+ </feature>
+ </fcategory>
+ <fcategory name='DOM Features'>
+ <feature name='http://apache.org/xml/features/dom/create-entity-ref-nodes'
+ id='dom.create-entity-ref-nodes'>
+ <true>
+ Create <code>EntityReference</code> nodes in the DOM tree. The
+ <code>EntityReference</code> nodes and their child nodes will be
+ read-only.
+ </true>
+ <false>
+ Do not create <code>EntityReference</code> nodes in the DOM tree.
+ No <code>EntityReference</code> nodes will be created, only the
+ nodes corresponding to their fully expanded sustitution text will
+ be created.
+ </false>
+ <default value='true'/>
+ <note>
+ This feature only affects the appearance of <code>EntityReference</code>
+ nodes in the DOM tree. The document will always contain the entity
+ reference child nodes.
+ </note>
+ </feature>
+ <feature name='http://apache.org/xml/features/dom/include-ignorable-whitespace'
+ id='dom.include-ignorable-whitespace'>
+ <true>
+ Includes text nodes that can be considered "ignorable whitespace" in
+ the DOM tree.
+ </true>
+ <false>Does not include ignorable whitespace in the DOM tree.</false>
+ <default value='true'/>
+ <note>
+ The only way that the parser can determine if text is ignorable
+ is by reading the associated grammar and having a content model for
+ the document. When ignorable whitespace text nodes are included in
+ the DOM tree, they will be flagged as ignorable. The ignorable flag
+ can be queried by calling the
+ <code>TextImpl#isIgnorableWhitespace():boolean</code> method.
+ </note>
+ </feature>
+ </fcategory>
+ <fcategory name='SAX Features'>
+ <feature name='http://xml.org/sax/features/namespace-prefixes'
+ id='namespace-prefixes'>
+ <true>
+ Report the original prefixed names and attributes used for namespace
+ declarations.
+ </true>
+ <false>
+ Do not report attributes used for Namespace declarations, and
+ optionally do not report original prefixed names.
+ </false>
+ <default value='true'/>
+ <access parsing='read-only' not-parsing='read-write'/>
+ </feature>
+ <feature name='http://xml.org/sax/features/string-interning'
+ id='string-interning'>
+ <true>
+ All element names, prefixes, attribute names, namespace URIs, and
+ local names are internalized using the
+ <code>java.lang.String#intern(String):String</code> method.
+ </true>
+ <false>Names are not necessarily internalized.</false>
+ <default value='false'/>
+ <access parsing='read-only' not-parsing='read-write'/>
+ <note>
+ &ParserName; does not support interning all strings using the
+ <code>String#intern()</code> method because &ParserName; does its
+ own intern optimizations for String objects.
+ </note>
+ </feature>
+ </fcategory>
+</features>
1.11 +126 -42 xml-xerces/java/docs/install.xml
Index: install.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/install.xml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- install.xml 2001/05/17 18:20:29 1.10
+++ install.xml 2001/08/23 00:35:14 1.11
@@ -1,43 +1,127 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE s1 SYSTEM "./dtd/document.dtd">
-
-<s1 title="Installation">
- <s2 title="Unpacking the files">
- <p>&javaparsername; is packaged as a ZIP file for all
- platforms and operating systems. You can run the Java
- <ref>jar</ref> command to unpack the distribution.</p>
- <ul>
- <li>jar xf &javaparsername;-bin.&javaparserversion;.zip</li>
- <li>jar xf &javaparsername;-src.&javaparserversion;.zip</li>
- <li>This command creates a "&javaparserdirectory;" sub-directory in the current directory containing all the files.</li>
- </ul>
- </s2>
- <s2 title="Files in the binary package release">
- <table>
- <tr><td>LICENSE</td><td>License for &javaparsername;</td></tr>
- <!--<tr><td>README</td><td>Build instructions</td></tr>-->
- <tr><td>Readme.html</td><td>Web page redirect to docs/html/index.html</td></tr>
- <!--<tr><td>STATUS</td><td>Project status list</td></tr>-->
- <tr><td>xerces.jar</td><td>Jar file containing all the parser class files</td></tr>
- <tr><td>xercesSamples.jar</td><td>Jar file containing all sample class files</td></tr>
- <tr><td>data/</td><td>Directory containing sample XML data files</td></tr>
- <tr><td>docs/html/</td><td>Directory containing documentation</td></tr>
- <tr><td>docs/html/apiDocs/</td><td>Directory containing Javadoc API for parser framework</td></tr>
- </table>
- <note>To use &javaparsername; you do not need the source files.
- </note>
- </s2>
- <s2 title="Files in the source package release">
- <table>
- <tr><td>LICENSE</td><td>License for &javaparsername;</td></tr>
- <tr><td>Makefile</td><td>Top level Makefile -- read README file before building</td></tr>
- <tr><td>README</td><td>Build instructions</td></tr>
- <tr><td>Readme.html</td><td>Web page redirect required for building documentation</td></tr>
- <tr><td>STATUS</td><td>Current source code status information</td></tr>
- <tr><td>data/</td><td>Directory containing sample XML data files</td></tr>
- <tr><td>docs/</td><td>Directory containing documentation, in XML form</td></tr>
- <tr><td>samples/</td><td>Directory containing source code for samples</td></tr>
- <tr><td>src/</td><td>Directory containing source code for parser and supplemental APIs</td></tr>
- </table>
- </s2>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE s1 SYSTEM 'dtd/document.dtd'>
+<s1 title='Installation'>
+ <s2 title='Unpacking the Files'>
+ <p>
+ &ParserName; is packaged as a ZIP file for all platforms
+ and operating systems. The parser release is also packaged
+ as Tar GZip files as a convenience for UNIX users. You can
+ extract the ZIP files using the Java <ref>jar</ref> command
+ to unpack the distribution.
+ </p>
+ <source>jar xf &ParserName;-bin.&parserversion;.zip
+jar xf &ParserName;-src.&parserversion;.zip
+jar xf &ParserName;-tools.&parserversion;.zip</source>
+ <p>
+ All of these commands creates a sub-directory called
+ "&parserdir;" in the current directory.
+ </p>
+ </s2>
+ <s2 title='Files in the Binary Package'>
+ <table>
+ <tr>
+ <td>LICENSE</td>
+ <td>License for &ParserName;</td>
+ </tr>
+ <tr>
+ <td>Readme.html</td>
+ <td>Web page redirect to docs/html/index.html</td>
+ </tr>
+ <tr>
+ <td>xerces.jar</td>
+ <td>Jar file containing all the parser class files</td>
+ </tr>
+ <tr>
+ <td>xercesSamples.jar</td>
+ <td>Jar file containing all sample class files</td>
+ </tr>
+ <tr>
+ <td>data/</td>
+ <td>Directory containing sample XML data files</td>
+ </tr>
+ <tr>
+ <td>docs/html/</td>
+ <td>Directory containing documentation</td>
+ </tr>
+ <tr>
+ <td>docs/apiDocs/</td>
+ <td>Directory containing Javadoc API for parser framework</td>
+ </tr>
+ <tr>
+ <td>samples/</td>
+ <td>Directory containing the source code for the samples</td>
+ </tr>
+ </table>
+ <note>
+ To use &ParserName; you do not need the source files.
+ However, if you want to recompile the sources you need to
+ download the source package.
+ </note>
+ </s2>
+ <s2 title='Files in the Source Package'>
+ <table>
+ <tr>
+ <td>LICENSE</td>
+ <td>License for &ParserName;</td>
+ </tr>
+ <tr>
+ <td>build.bat</td>
+ <td>Batch file for invoking Ant build for Windows users</td>
+ </tr>
+ <tr>
+ <td>build</td>
+ <td>Shell script for invoking Ant build for UNIX users</td>
+ </tr>
+ <tr>
+ <td>build.xml</td>
+ <td>Ant build file -- read README file before building</td>
+ </tr>
+ <tr>
+ <td>README</td>
+ <td>Build instructions</td>
+ </tr>
+ <tr>
+ <td>Readme.html</td>
+ <td>Web page redirect required for building documentation</td>
+ </tr>
+ <tr>
+ <td>STATUS</td>
+ <td>Current source code status information</td>
+ </tr>
+ <tr>
+ <td>TODO</td>
+ <td>Current list of "todo" items</td>
+ </tr>
+ <tr>
+ <td>ISSUES</td>
+ <td>Current open issues that need to be resolved</td>
+ </tr>
+ <tr>
+ <td>data/</td>
+ <td>Directory containing sample XML data files</td>
+ </tr>
+ <tr>
+ <td>docs/</td>
+ <td>Directory containing documentation, in XML form</td>
+ </tr>
+ <tr>
+ <td>samples/</td>
+ <td>Directory containing source code for samples</td>
+ </tr>
+ <tr>
+ <td>src/</td>
+ <td>
+ Directory containing source code for parser and supplemental
+ APIs
+ </td>
+ </tr>
+ </table>
+ <note>
+ In order to compile the source code using Ant or build the
+ release packages, you must download the
+ <code>&ParserName;-tools.&parserversion;.zip</code>
+ package and extract it in the same directory where you
+ extracted the source package.
+ </note>
+ </s2>
</s1>
1.7 +167 -162 xml-xerces/java/docs/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/properties.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- properties.xml 2001/06/21 19:30:29 1.6
+++ properties.xml 2001/08/23 00:35:14 1.7
@@ -1,166 +1,171 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE s1 SYSTEM "./dtd/document.dtd">
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE properties SYSTEM 'dtd/settings.dtd'>
+<properties>
+ <desc name='Setting Properties'>
+ <p>
+ If you have created a DOM document builder or a SAX parser using
+ the JAXP interfaces, you may have difficulty setting features and
+ properties directly using those interfaces. The following
+ instructions tell you how to set properties on document builders
+ and SAX parsers created from the JAXP interfaces.
+ </p>
+ <p>
+ The DocumentBuilderFactory interface contains a
+ <code>setAttribute(String,Object)</code> method which <em>may</em>
+ provide a means to set features and properties on the underyling
+ parser. However, it cannot be relied upon. Therefore, you must
+ use the Xerces DOMParser object directly. For example:
+ </p>
+ <source>import org.apache.xerces.parsers.DOMParser;
+import org.xml.sax.SAXException;
+
+DOMParser parser = new DOMParser();
-<s1 title="Properties">
- <s2 title="Setting Features">
- <anchor name="properties"/>
- <p>To set a property on either org.apache.xerces.parsers.SAXParser
- or org.apache.xerces.parsers.DOMParser, you should use the SAX2
- method <code>setProperty(String,Object)</code>. To query a
- property, use the SAX2 method <code>getProperty(String)</code>.</p>
- <p>For example, to set the document factory by name:</p>
-<source>DOMParser p=new DOMParser();
-try {
- p.setProperty("http://apache.org/xml/properties/dom/document-class-name",
- "org.apache.xerces.dom.DocumentImpl");
-} catch (SAXException e) {
- System.out.println("error in setting up parser property");
+String id = "http://apache.org/xml/properties/dom/document-class-name";
+Object value = "org.apache.xerces.dom.DocumentImpl";
+try {
+ parser.setProperty(id, value);
+}
+catch (SAXException e) {
+ System.err.println("could not set parser feature");
}</source>
- </s2>
-
- <s2 title="General Properties">
- <!--
- <anchor name="namespace-sep"/>
- <p>http://xml.org/sax/properties/namespace-sep</p>
- <table>
- <tr><th>Type:</th> <td>java.lang.String</td></tr>
- <tr><th>Access:</th> <td>read-write</td></tr>
- <tr><th>Desc:</th> <td>The separator string that will appear between the namespace
- URI and the local part of the name when namespace processing is being
- performed. If the value is the empty string, the two parts will be
- concatenated. </td></tr>
- <tr><th> Default: </th> <td>""</td></tr>
- <tr><th>See:</th> <td><link idref="features" anchor="namespaces">http://xml.org/sax/features/namespaces</link></td></tr>
- </table>
- -->
-
- <anchor name="xml-string"/>
- <p>http://xml.org/sax/properties/xml-string</p>
- <table>
- <tr><th>Type:</th> <td>java.lang.String</td></tr>
- <tr><th>Access:</th> <td>read-only</td></tr>
- <tr><th>Desc:</th> <td>Get the string of characters associated with the current event. If the
- parser recognizes and supports this property but is not currently
- parsing text, it should return null.</td></tr>
- <tr><th>Note:</th> <td>This property is currently not supported because the contents of the
- XML string returned by this property is not well defined.</td></tr>
- </table>
-
- <anchor name="xml-string"/>
- <p>http://apache.org/xml/properties/schema/external-schemaLocation</p>
- <table>
- <tr><th>Type:</th> <td>java.lang.String</td></tr>
- <tr><th>Access:</th> <td>read-write</td></tr>
- <tr><th>Desc:</th> <td>The XML Schema Recommendation explicitly states that the inclusion of schemaLocation/ noNamespaceSchemaLocation attributes is only a hint; it does not mandate
- that these attributes must be used to locate schemas. This property
- allows the user to specify a list of schemas to use.
- If the targetNamespace of a schema (specified using this property)
- matches the targetNamespace of a schema occuring in the instance document
- in schemaLocation attribute, the schema specified by the user using this
- property will be used (i.e., the instance document's schemaLocation attribute will be effectively ignored).
- </td></tr>
- <tr><th>Note:</th> <td>The syntax is the same as for schemaLocation attributes in
- instance documents: e.g, "http://www.example.com file_name.xsd".
- The user can specify more than one XML Schema in the list.
- </td></tr>
- </table>
-
- <anchor name="xml-string"/>
- <p>http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation</p>
- <table>
- <tr><th>Type:</th> <td>java.lang.String</td></tr>
- <tr><th>Access:</th> <td>read-write</td></tr>
- <tr><th>Desc:</th> <td>This property allows the user to specify an XML Schema with no namespace.
- </td></tr>
- <tr><th>Note:</th> <td>The syntax is a same as for the noNamespaceSchemaLocation
- attribute that may occur in an instance document:
- e.g."file_name.xsd". The user may specify only one XML Schema. For more information see the documentation for the
- http://apache.org/xml/properties/schema/external-schemaLocation
- property</td></tr>
- </table>
+ <p>
+ Using the SAXParser interface in JAXP is better because you can
+ query the underlying XMLReader implementation directly and that
+ interface contains methods to set and query features and
+ properties. For example:
+ </p>
+ <source>import javax.xml.parsers.SAXParser;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
- </s2>
-
- <s2 title="DOM Parser Properties">
- <anchor name="current-element-node"/>
- <p>http://apache.org/xml/properties/dom/current-element-node</p>
- <table>
- <tr><th>Type:</th> <td>org.w3c.dom.Node</td></tr>
- <tr><th>Access:</th> <td>read-only</td></tr>
- <tr><th>Desc:</th> <td>The current DOM element node while parsing.</td></tr>
- <tr><th>Note:</th> <td>This property is useful for determining the location
- with a DOM document when an error occurs.</td></tr>
- <tr><th>See:</th> <td><link anchor="dom-node">http://xml.org/sax/properties/dom-node</link></td></tr>
- </table>
-
- <anchor name="document-class-name"/>
- <p>http://apache.org/xml/properties/dom/document-class-name</p>
- <table>
- <tr><th>Type:</th> <td>java.lang.String</td></tr>
- <tr><th>Access:</th> <td>read-write</td></tr>
- <tr><th>Desc:</th> <td>The fully qualified class name of the DOM
- implementation. The implementation used must
- have a zero argument constructor.</td></tr>
- <tr><th>Default:</th> <td>"org.apache.xerces.dom.DocumentImpl"</td></tr>
- <tr><th>Note:</th> <td>When the document class name is set to a value other
- than the name of the default document factory, the
- deferred node expansion feature does not work. </td></tr>
- <tr><th>See:</th> <td><link idref="features" anchor="defer-node-expansion">http://apache.org/xml/features/dom/defer-node-expansion</link></td></tr>
- </table>
- </s2>
-
- <s2 title="SAX Parser Properties">
- <!--
- <anchor name="DeclHandler"/>
- <p>http://xml.org/sax/handlers/DeclHandler</p>
- <table>
- <tr><th>Type:</th> <td>org.xml.sax.misc.DeclHandler</td></tr>
- <tr><th>Access:</th> <td>read-write</td></tr>
- <tr><th>Desc:</th> <td>Set the handler for DTD declarations.</td></tr>
- </table>
-
- <anchor name="LexicalHandler"/>
- <p>http://xml.org/sax/handlers/LexicalHandler</p>
- <table>
- <tr><th>Type:</th> <td>org.xml.sax.misc.LexicalHandler</td></tr>
- <tr><th>Access:</th> <td>read-write</td></tr>
- <tr><th>Desc:</th> <td>Set the handler for lexical parsing events.</td></tr>
- </table>
-
- <anchor name="NamespaceHandler"/>
- <p>http://xml.org/sax/handlers/NamespaceHandler</p>
- <table>
- <tr><th>Type:</th> <td>org.xml.sax.misc.NamespaceHandler</td></tr>
- <tr><th>Access:</th> <td>read-write</td></tr>
- <tr><th>Desc:</th> <td>Set the handler for lexical parsing events.</td></tr>
- </table>
- -->
- <anchor name="declaration-handler"/>
- <p>http://xml.org/sax/properties/declaration-handler</p>
- <table>
- <tr><th>Type:</th> <td>org.xml.sax.ext.DeclHandler</td></tr>
- <tr><th>Access:</th> <td>read-write</td></tr>
- <tr><th>Desc:</th> <td>Set the handler for DTD declarations.</td></tr>
- </table>
-
- <anchor name="lexical-handler"/>
- <p>http://xml.org/sax/properties/lexical-handler</p>
- <table>
- <tr><th>Type:</th> <td>org.xml.sax.ext.LexicalHandler</td></tr>
- <tr><th>Access:</th> <td>read-write</td></tr>
- <tr><th>Desc:</th> <td>Set the handler for lexical parsing events.</td></tr>
- </table>
+SAXParser parser = /* created from SAXParserFactory */;
+XMLReader reader = parser.getXMLReader();
- <anchor name="dom-node"/>
- <p>http://xml.org/sax/properties/dom-node</p>
- <table>
- <tr><th>Type:</th> <td>org.w3c.dom.Node</td></tr>
- <tr><th>Access:</th> <td>(parsing) read-only; (not parsing) read/write</td></tr>
- <tr><th>Desc:</th> <td>The DOM node currently being visited,
- if SAX is being used as a DOM iterator.
- If the parser recognizes and supports this property but is
- not currently visiting a DOM node, it should return null.</td></tr>
- </table>
-
- </s2>
-</s1>
+String id = "http://apache.org/xml/properties/dom/document-class-name";
+Object value = "org.apache.xerces.dom.DocumentImpl";
+try {
+ reader.setProperty(id, value);
+}
+catch (SAXException e) {
+ System.err.println("could not set parser feature");
+}</source>
+ </desc>
+ <pcategory name='General Properties'>
+ <property name='http://xml.org/sax/properties/xml-string'
+ id='xml-string'>
+ <desc>
+ Get the string of characters associated with the current event.
+ If the parser recognizes and supports this property but is not
+ currently parsing text, it should return null.
+ </desc>
+ <type>java.lang.String</type>
+ <access general='read-only'/>
+ <note>
+ This property is currently not supported because the contents of
+ the XML string returned by this property is not well defined.
+ </note>
+ </property>
+ <!--
+ - REVISIT: Reconsider adding these properties once parser has
+ - Schema support.
+ -
+ <property name='http://apache.org/xml/properties/schema/external-schemaLocation'
+ id='schema.external-schemaLocation'>
+ <desc>
+ The XML Schema Recommendation explicitly states that the inclusion
+ of schemaLocation/ noNamespaceSchemaLocation attributes is only a
+ hint; it does not mandate that these attributes must be used to
+ locate schemas. This property allows the user to specify a list of
+ schemas to use. If the targetNamespace of a schema (specified
+ using this property) matches the targetNamespace of a schema
+ occuring in the instance document in schemaLocation attribute, the
+ schema specified by the user using this property will be used
+ (i.e., the instance document's schemaLocation attribute will be
+ effectively ignored).
+ </desc>
+ <type>java.lang.String</type>
+ <access general='read-write'/>
+ <note>
+ The syntax is the same as for schemaLocation attributes in
+ instance documents: e.g, "http://www.example.com file_name.xsd".
+ The user can specify more than one XML Schema in the list.
+ </note>
+ </property>
+ <property name='http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation'
+ id='schema.external-noNamespaceSchemaLocation'>
+ <desc>
+ This property allows the user to specify an XML Schema with no
+ namespace.
+ </desc>
+ <type>java.lang.String</type>
+ <access general='read-write'/>
+ <note>
+ The syntax is a same as for the noNamespaceSchemaLocation attribute
+ that may occur in an instance document: e.g."file_name.xsd". The
+ user may specify only one XML Schema. For more information see the
+ documentation for the
+ http://apache.org/xml/properties/schema/external-schemaLocation
+ property.
+ </note>
+ </property>
+ -->
+ </pcategory>
+ <pcategory name='DOM Properties'>
+ <property name='http://apache.org/xml/properties/dom/current-element-node'
+ id='dom.current-element-node'>
+ <desc>The current DOM element node while parsing.</desc>
+ <type>org.w3c.dom.Element</type>
+ <access general='read-only'/>
+ <note>
+ This property is useful for determining the location with a DOM
+ document when an error occurs.
+ </note>
+ </property>
+ <property name='http://apache.org/xml/properties/dom/document-class-name'
+ id='dom.document-class-name'>
+ <desc>
+ The fully qualified class name of the DOM implementation. The
+ implementation used must have a zero argument constructor.
+ </desc>
+ <type>java.lang.String</type>
+ <default value='"org.apache.xerces.dom.DocumentImpl"'/>
+ <access general='read-write'/>
+ <note>
+ When the document class name is set to a value other than the
+ name of the default document factory, the deferred node expansion
+ feature does not work.
+ </note>
+ </property>
+ </pcategory>
+ <pcategory name='SAX Properties'>
+ <property name='http://xml.org/sax/properties/declaration-handler'
+ id='declaration-handler'>
+ <desc>Set the handler for DTD declarations.</desc>
+ <type>org.xml.sax.ext.DeclHandler</type>
+ <access general='read-write'/>
+ </property>
+ <property name='http://xml.org/sax/properties/lexical-handler'
+ id='lexical-handler'>
+ <desc>Set the handler for lexical parsing events.</desc>
+ <type>org.xml.sax.ext.LexicalHandler</type>
+ <access general='read-write'/>
+ </property>
+ <property name='http://xml.org/sax/properties/dom-node'
+ id='dom-node'>
+ <desc>
+ The DOM node currently being visited, if SAX is being used as
+ a DOM iterator. If the parser recognizes and supports this
+ property but is not currently visiting a DOM node, it should
+ return null.
+ </desc>
+ <type>org.w3c.dom.Node</type>
+ <access parsing='read-only' not-parsing='read-write'/>
+ <note>
+ This property is only for SAX parser implementations used as
+ DOM tree walkers. Currently, Xerces does not have this
+ functionality.
+ </note>
+ </property>
+ </pcategory>
+</properties>
1.15 +100 -73 xml-xerces/java/docs/readme.xml
Index: readme.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/readme.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- readme.xml 2001/07/16 15:08:18 1.14
+++ readme.xml 2001/08/23 00:35:14 1.15
@@ -1,74 +1,101 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE s1 SYSTEM "./dtd/document.dtd">
-
-<s1 title="&javaparsernamelong; Readme">
- <s2 title="&javaparsernamelong; &javaparserversion; Release">
- <p>The &javaparsernamelong; &javaparserversion; supports the
- <jump href="http://www.w3.org/TR/1998/REC-xml-19980210">XML 1.0</jump>
- recommendation and contains advanced parser functionality, such as
- support for the W3C's
- <jump href="http://www.w3.org/XML/Schema.html">XML
- Schema recommendation version 1.0</jump>,
- <jump href="http://www.w3.org/TR/DOM-Level-2/">DOM Level 2 version 1.0</jump>, and
- <jump href="http://www.megginson.com/SAX/">SAX Version 2</jump>,
- in addition to supporting the industry-standard
- <jump href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html">DOM Level 1</jump> and
- <jump href="http://www.megginson.com/SAX/SAX1/">SAX version 1</jump>
- APIs.</p>
- <p>
- Note that because some of the standards
- are still not complete, the stable API will definitely be
- different from its current form in &javaparsername; &javaparserversion;.
- This is your chance to give us
- feedback on the features that are important to you, and let us know
- whether the APIs that we are providing are the right ones. Please
- direct your feedback to the &javaparsername; mailing list.</p>
-
- </s2>
- <s2 title="License Information">
- <p>The &javaparsername; &javaparserversion; release is available in both source code
- and precompiled binary (JAR files) form. Both &javaparsername;
- packages are made available under the <jump href='../../LICENSE'>Apache
- Software License</jump>.
- </p>
- </s2>
- <s2 title="Applications of the &javaparsername; Parser">
- <p>The rich generating and validating capabilities allow the &javaparsername;
- Parser to be used for: </p>
- <ul>
- <li>Building XML-savvy Web servers. </li>
- <li>The next generation of vertical applications which will use
- XML as their data format. </li>
- <li>On-the-fly validation for creating XML editors. </li>
- <li>Ensuring the integrity of e-business data expressed in XML. </li>
- <li>Building truly internationalized XML applications. </li>
- </ul>
- </s2>
- <s2 title="XML Schema 1.0 (beta) Support">
- <p>This release includes full support for the W3C XML Schema
- Recommendation, except for limitations as described on the <link
- idref="schema">Schema Implementation Limitations</link> page.
- We intend to remove these limitations and fix outstanding
- bugs in the next release of &javaparsername;.</p>
- </s2>
- <s2 title="DOM Level 2 Support">
- <p>This release includes support for DOM Level 2
- <jump href="http://www.w3.org/TR/DOM-Level-2-Core">Core</jump>,
- <jump href="http://www.w3.org/TR/DOM-Level-2-Events">Events</jump>,
- and <jump href="http://www.w3.org/TR/DOM-Level-2-Traversal-Range">Traversal and Range</jump> modules.
- The DOM Level 2 specification is now a W3C Recommendation.</p>
- </s2>
- <s2 title="SAX 2 Support">
- <p>This release includes support for the <jump href="http://www.megginson.com/SAX/">
- SAX Version 2</jump> API's which have been finalized.</p>
- </s2>
- <s2 title="Configuration Mechanism">
- <p>&javaparsername; &javaparserversion; uses a collection of methods to configure
- various settings in the parser. This release includes a new mechanism
- for setting parser switches. This mechanism uses the SAX2 configuration
- methods that are part of the XMLReader interface. We have defined a series
- of <link idref="properties">properties</link> and
- <link idref="features">features</link> for the &javaparsername;
- options. </p>
- </s2>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE s1 SYSTEM 'dtd/document.dtd'>
+<s1 title='&ParserNameLong; Readme'>
+ <s2 title='&ParserNameLong; &ParserVersion; Release'>
+ <p>
+ Welcome to the future! Xerces2 is the next generation of
+ high performance, fully compliant XML parsers in the Apache
+ Xerces family. This new version of Xerces introduces the
+ Xerces Native Interface (XNI), a complete framework for
+ building parser components and configurations that is
+ extremely modular and easy to program.
+ </p>
+ <p>
+ The Apache Xerces2 parser is the reference implementation
+ of XNI but other parser components, configurations, and parsers
+ can be written using the Xerces Native Interface. For complete
+ design and implementation documents, refer to the
+ <link idref='xni'>XNI Manual</link>.
+ </p>
+ <p>
+ <strong>Note:</strong> Since this is a beta release, bugs are
+ to be expected. Please use
+ <jump href='http://nagoya.apache.org/bugzilla/enter_bug.cgi?product=Xerces2-J'>BugZilla</jump>
+ to report any bugs that you find.
+ </p>
+ </s2>
+ <s2 title='Features of This Release'>
+ <p>
+ The &ParserNameLong; &ParserVersion; supports the
+ following standards and APIs:
+ </p>
+ <ul>
+ <li>
+ <jump href='http://www.w3.org/XML/'>eXtensible Markup Language</jump>
+ (XML) 1.0
+ <jump href='http://www.w3.org/TR/2000/REC-xml-20001006'>Second
+ Edition</jump> Recommendation
+ </li>
+ <li>
+ <jump href='http://www.w3.org/TR/REC-xml-names/'>Namespaces
+ in XML</jump> Recommendation
+ </li>
+ <li>
+ <jump href='http://www.w3.org/DOM/'>Document Object Model</jump>
+ (DOM) Level 2
+ <jump href='http://www.w3.org/TR/DOM-Level-2-Core/'>Core</jump>,
+ <jump href='http://www.w3.org/TR/DOM-Level-2-Events'>Events</jump>,
+ and
+ <jump href='http://www.w3.org/TR/DOM-Level-2-Traversal-Range'>Traversal
+ and Range</jump> Recommendations
+ </li>
+ <li>
+ <jump href='http://www.megginson.com/SAX/'>Simple API for XML</jump>
+ (SAX) 2.0
+ <jump href='http://www.megginson.com/SAX/Java/sax2.zip'>Core</jump>,
+ and
+ <jump href='http://www.megginson.com/Software/sax2-ext-1.0.zip'>Extension</jump>
+ </li>
+ <li>
+ <jump href='http://java.sun.com/xml/xml_jaxp.html'>Java APIs for
+ XML Processing</jump> (JAXP) 1.1
+ </li>
+ </ul>
+ <p>
+ This release does <strong>NOT</strong> yet support the following
+ standards and/or APIs:
+ </p>
+ <ul>
+ <li>
+ <jump href='http://www.w3.org/XML/Schema'>XML Schema</jump> 1.0
+ <jump href='http://www.w3.org/TR/xmlschema-1/'>Structures</jump>
+ and
+ <jump href='http://www.w3.org/TR/xmlschema-2/'>Datatypes</jump>
+ Recommendations
+ </li>
+ </ul>
+ </s2>
+ <s2 title='Changes from Xerces 1.x'>
+ <p>
+ Xerces2 is a nearly complete rewrite of the Xerces 1.x codebase
+ in order to make the code cleaner, more modular, and easier to
+ maintain. Applications using only the standard interfaces such as
+ JAXP, DOM, and SAX should not see any differences. However, the
+ following list details some of the more visible changes between
+ Xerces 1.x and Xerces2:
+ </p>
+ <ul>
+ <li>Deferred DOM implementation removed</li>
+ <li>XML Schema support not yet implemented</li>
+ </ul>
+ </s2>
+ <s2 title='License Information'>
+ <p>
+ The &ParserName; &ParserVersion; release is available
+ in both source code and precompiled binary (JAR files) form.
+ Both &ParserName; packages are made available under the
+ <jump href='http://xml.apache.org/LICENSE'>Apache Software
+ License</jump>.
+ </p>
+ </s2>
</s1>
1.64 +112 -310 xml-xerces/java/docs/releases.xml
Index: releases.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/releases.xml,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- releases.xml 2001/08/20 15:25:28 1.63
+++ releases.xml 2001/08/23 00:35:14 1.64
@@ -1,310 +1,112 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE s1 SYSTEM "./dtd/document.dtd">
-
-<s1 title="Releases">
- <s2 title='August 20, 2001 (version 1.4.3)'>
- <ul>
- <li>Reorganization of the DOM implementation to separate the Core
- functionality (new classes: CoreDOMImplementationImpl,
- CoreDocumentImpl), from the complete DOM (DOMImplementationImpl,
- DocumentImpl) [Arnaud Le Hors]</li>
- <li>Fix to Base64 and HexBinary datatype validators so they work properly on OS/390 [Steve Dulin/Neil Graham]</li>
- <li>General bug fixes [Lisa Martin, Sandy Gao, Elena Litani, Neil Graham]</li>
- </ul>
- </s2>
- <s2 title='July 23, 2001 (version 1.4.2)'>
- <ul>
- <li>Performance fixes [Henry Zongaro/Lisa Martin]</li>
- <li>Patches for improving serializer extensibility [Gunnlaugur Thor Briem/Elena Litani]</li>
- <li>Bug fixes (schema implementation, build, etc.) [Sandy Gao, Neil Graham, Elena Litani, Lisa Martin]</li>
- </ul>
- </s2>
- <s2 title='June 22, 2001 (version 1.4.1)'>
- <ul>
- <li>Added support for all IANA encoding aliases which have a clear mapping to
- encodings recognized by Java [Neil Graham]</li>
- <li> Addressed degradations in DTD validation performance
- caused by the schema implementation [Sandy Gao, Neil Graham]</li>
- <li>Bug fixes [Sandy Gao, Neil Graham, Elena Litani, Lisa Martin, Henry Zongaro, Edwin Goei] </li>
- <li>Added support for setAttribute/getAttribute in JAXP [Edwin Goei]</li>
- <li>Added two new parser properties related to XML Schema [Elena Litani]</li>
- </ul>
- </s2>
- <s2 title='May 22, 2001 (version 1.4.0)'>
- <ul>
- <li>Completed implementation of schema Identity Constraints [Neil Graham]</li>
- <li>Update XPath support to bring it into compliance with Schema PR [Achille Fokoue Nkoutche/Neil Graham]</li>
- <li>Implemented Schema PR changes to the syntax of <attribute> declarations [Ted Han (than@ghx.com)/Neil Graham]</li>
- <li>Added French resource bundle for regex package [Jean-Claude Dufourd, Laurent Foret/Neil Graham]</li>
- <li>Added support for Schema "final" attribute [Neil Graham]</li>
- <li>Added support for nillable and removed limitation for xsi:schemaLocation usage [Elena Litani]</li>
- <li>PR changes for Datatypes (including implementation of date/time) [Sandy Gao, Elena Litani]</li>
- <li>Added support for fixed attribute on datatype facets [Elena Litani]</li>
- <li>Constraint checking [Lisa Martin, Neil Graham, Sandy Gao, Elena Litani]</li>
- <li>Re-implemented "all" group support for performance reasons [Henry Zongaro]</li>
- <li>Re-implemented "mixed" content model groups for Schema [Lisa Martin]</li>
- <li>Miscellaneous bug fixes [Arnaud Le Hors, Jeffrey Rodrigues, Elena Litani]</li>
-
- </ul>
- </s2>
- <s2 title='March 16, 2001 (version 1.3.1)'>
- <ul>
- <li>Added support for schema <redefine> element [Neil Graham]</li>
- <li>Added support for schema notations [Elena Litani]</li>
- <li>Implemented validation constraints for the "abstract" attribute
- on elements [Lisa Martin]</li>
- <li>Simple value normalization and whitespace facet support [Elena Litani]</li>
- <li>Fixed validation constraints surrounding the schema <annotation> element info item [Neil Graham]</li>
- <li>Implemented support for JAXP 1.1 [Edwin Goei]</li>
- <li>Added experimental DOM Level 3 features for handling XML header [Elena Litani]</li>
- <li>Miscellaneous bugfixes [Arnaud Le Hors, Neil Graham, Elena Litani, Andy Clark, Lynn Monson, Sandy Gao, Brad O'Hearne]</li>
- <li>Partially fixed inability to make (or build) Xerces under Unix [Neil Graham]</li>
- <li>Removed final from XMLSerializer per request [Andy Clark]</li>
- <li>Fixed identity constraint bugs (support still limited) [Andy Clark]</li>
- <li>Changed parse method to close streams opened by parser even in
- event of error [Andy Clark]</li>
- </ul>
- </s2>
- <s2 title='January 31, 2001 (version 1.3.0)'>
- <ul>
- <li>Upgraded schema support to the schema CR drafts at a
- similar level to that which had existed for the WD schema
- specifications. [Elena Litani, Lisa Martin, Neil Graham]</li>
- <li>Implemented schema union simple type
- definition. [Elena Litani]</li>
- <li>Implemented many attribute and element declaration
- schema-validation constraints, as well as
- use=prohibited. [Neil Graham]</li>
- <li>Implemented basic support for XML Schema identity constraints [Andy Clark]</li>
- <li>Fixed bug in Deferred DOM with multiple IDs on same element [Andy Clark]</li>
- <li>Updates to improve DFA build-time performance. [Tozawa Akihiko]</li>
- <li>Optimization of memory used by attribute nodes in the DOM. [Arnaud Le Hors]</li>
- <li>Fixed conflict between HTML DOM and Core DOM. [Mark Diekhans]</li>
- <li>Optimized DOM normalize operation. [Jay Cain + Arnaud Le Hors]</li>
- </ul>
- </s2>
- <s2 title='December 06, 2000 (version 1.2.3)'>
- <ul>
- <li>Fixed Memory leak bug was reported by Tosiki IGA where parser runs out of memory [Eric Ye]</li>
- <li>Rampant object creation even when not validating fix patch send by Elena Litani[Elena Litani]</li>
- <li>ListDatatypeValidator enumeration bug fix by Elena Litani Litani[Elena Litani]</li>
- <li>Optimization in validator to only instantiate objects needed in the case of DTD vs. Schemas[Jeffrey Rodriguez]</li>
- <li>Fixed misc. Schema Structures miscelaneous bugs since last release [Eric Ye]</li>
- <li>improved implementation of <all> schema construct
- to handle 8 elements instead of 6; also increased
- validation speed [Neil Graham, Eric Ye]</li>
- <li>Fixed DOM misc. bugs and other patches since last release [Arnaud Le Hors]</li>
- <li>Miscelaneous DOM patches by Lynn Monson [Lynn Monson]</li>
- <li>Added new 'load-external-dtd' feature, so that when non
-validating, applications can ask the parser not to load the external subset at
-all [Arnaud Le Hors]</li>
- </ul>
- </s2>
- <s2 title='November 22, 2000 (version 1.2.2)'>
- <ul>
- <li>DOM 2 Recommendation release support update [Arnaud Le Hors]</li>
- <li>Fixed FAQ section submitted by Tony Montgomery Smith [Jeffrey Rodriguez,Tony Montgomery]</li>
- <li>Added normalization patch by Ken Tamura [Jeffrey Rodriguez, Ken Tamura]</li>
- <li>Fixed hang in UTF8Reader when we find a multb. UTF8 char. outside [#x10000-#x10FFFF] range [Jeffrey Rodriguez]</li>
- <li>Fixed problem in Server env. with Singleton implemtation of validators [Eric Ye, Jeffrey Rodriguez]</li>
- <li>Fixed patch submitted by Elena Litani Kitani and others with
-RangeImpl [Eric Ye, Elena Litani, Lynn Monson]</li>
- <li>Fixed misc. Schema Structures miscelaneous bugs since last release [Eric Ye]</li>
- <li>Miscelaneous bug fixes and patches submitted by Lisa Martin [Lisa Martin]</li>
- <li>Fixed DOM misc. bugs and other patches since last release [Arnaud Le Hors]</li>
- </ul>
- </s2>
-
- <s2 title='October 19, 2000 (version 1.2.1)'>
- <ul>
- <li>This is a bug fix release</li>
- <li>Added Mark Swinkels datatype list refactoring [Mark Swinkels, Jeffrey Rodriguez]</li>
- <li>Added RangeImpl patch submitted by Lynn Monson [Lynn monson, Arnaud Le Hors]</li>
- <li>Fixed datatype registry not being initialized in XMLValidator bug [Jeffrey Rodriguez]</li>
- <li>Fixed misc. Schema Structures bugs since last release [Eric Ye]</li>
- <li>Fixed misc. Datatypes bugs since last release [Jeffrey Rodriguez]</li>
- </ul>
- </s2>
-
- <s2 title='August 28, 2000 (version 1.2.0)'>
- <ul>
- <li>Merged redundant Attribute validators inner classes with the data type validators. [Jeffrey Rodriguez]</li>
- <li>Fixed namespaces bugs for endElement method in SAX. [Jeffrey Rodriguez]</li>
- <li>Fixed misc. Schema Datatype bugs. [Jeffrey Rodriguez]</li>
- <li>Fixed misc. DOM implementation bugs. [Arnaud Le Hors]</li>
- <li>Fixed Makefiles and documentations. [Andy Clark]</li>
- <li>Added "any" with "processContents='lax|skip'" support for Schema. [Eric Ye]</li>
- <li>Added feature "load-dtd-grammar" [Eric Ye]</li>
- <li>Fixed a bug in reset() method of XMLValidator. [Eric Ye]</li>
- <li>Fixed misc. Schema Structures bugs. [Eric Ye]</li>
- </ul>
- </s2>
- <s2 title='July 26, 2000 (version 1.1.3)'>
- <ul>
- <li>Added "anyAttribute" support for Schema. [Eric Ye]</li>
- <li>Added "xsi:type" support for Schema. [Eric Ye]</li>
- <li>Added full equivClass support for Schema. [Eric Ye]</li>
- <li>Fixed "form" attribute behavior to be fully compilant with Schema Spec. [Eric Ye]</li>
- <li>Fixed "xml:space" bug in DTD validation. [Eric Ye, Andy Clark]</li>
- <li>Expanded "any" element support to model groups. [Eric Ye]</li>
- <li>Fixed "any" element bugs when there are multilple URIs. [Eric Ye]</li>
- <li>Cleaned up XMLValidator. [Eric Ye]</li>
- <li>Fixed misc. Schema bugs. [Eric Ye]</li>
- <li>Fixed resolving Schema location bug in XMLValidator. [David Blankenship, Eric Ye]</li>
- <li>Fixed for BUG:SAXParser endElement reports incorrect local name. [Jeffrey Rodriguez]</li>
- <li>Fixed DOM Java Serialization-previous fix did not work. [Jeffrey Rodriguez]</li>
- <li>Added testcase under test to test DOM Java Serialization. [Jeffrey Rodriguez]</li>
- <li>Added James Duncan fix suggestion to not compile RevalidatingDOMParser. [James Duncan, Jeffrey Rodriguez]</li>
- <li>Miscelanous DOM enhancements [Arnaud Le Hors]. </li>
- <li>Fixed parameterizes entities in XMLDTDScanner. [Jeffrey Rodriguez]</li>
- <li>Fixed bug reported by Philippe MOUAWAD, on XMLContentSpec toString method. [Jeffrey Rodriguez]</li>
- <li>Fixed problem with DTD validation when namespace is supported is on. [Andy Clark,Eric Ye]</li>
- <li>Fixed bug reported by Michael Brundage in StringReader. [Jeffrey Rodriguez]</li>
- </ul>
- </s2>
- <s2 title='June 21, 2000 (version 1.1.2)'>
- <ul>
- <li>Added "any" element content support for Schema [Andy Clark]</li>
- <li>Fixed adjacent text nodes bug in deferred DOM [Andy Clark]</li>
- <li>Fixed namespace URI bug in deferred DOM [Andy Clark]</li>
- <li>Fixed null document type node bug [Andy Clark]</li>
- <li>Fixed StringReader index out of bounds exception bug [Andy Clark]</li>
- <li>Turned on namespace support in all parsers, by default [Andy Clark]</li>
- <li>Added feature to allow Schema support to be turned off [Andy Clark]</li>
- <li>Fixed SAX2 DeclHandler, LexicalHandler callbacks [Andy Clark]</li>
- <li>Fixed DOM serialization [Jeffrey Rodriguez]</li>
- <li>Fixed datatype enumeration bugs [Jeffrey Rodriguez]</li>
- <li>Fixed datatype pattern bugs [Jeffrey Rodriguez]</li>
- <li>Fixed datatype min/maxLength bugs [Jeffrey Rodriguez]</li>
- <li>Modified samples to include additional switches [Jeffrey Rodriguez]</li>
- <li>Fixed lexical comparison for string/qname datatypes [Jeffrey Rodriguez]</li>
- <li>Added regular expression character class subtraction [Ken Tamura]</li>
- <li>Fixed regular expression bugs [Ken Tamura]</li>
- <li>Added URI class [paul.eng@iclick.com]</li>
- <li>Fixed import/include Schema bug [Eric Ye]</li>
- <li>Fixed lots of Schema bugs [Eric Ye]</li>
- </ul>
- </s2>
- <s2 title='June 5, 2000 (version 1.1.1)'>
- <ul>
- <li>Added Schema include/import [Eric Ye]</li>
- <li>Performance tuning [Eric Ye, Andy Clark]</li>
- <li>Added Ant support to build process [abagchi]</li>
- <li>Re-architecture Schema datatypes [Jeffrey Rodriguez]</li>
- <li>Re-organized docs directory to get FOP to work[Anupam Bagchi, Jeffrey Rodriguez]</li>
- <li>Fixed Dynamic validation bug [Eric Ye]</li>
- <li>Fixed Grammar access bug [Eric Ye, Andy Clark]</li>
- <li>Fixed Miscellaneous bugs [Eric Ye, Andy Clark, Jeffrey Rodriguez]</li>
- <li>Added JAXP to build, updated JAXP files [Arnaud Le Hors]</li>
- <li>Added a DOM from scratch and Serializer sample [Jeffrey Rodriguez]</li>
- <li>Fixed NodeImpl supports nullpointer bug in Samples [Arnaud Le Hors]</li>
- <li>Fixed a bug in cloning default attribute</li>
- </ul>
- </s2>
- <s2 title='May 19, 2000 (version 1.1.0)'>
- <ul>
- <li>Reworked internals for XML Schema support [Andy Clark, Eric Ye,
- Jeffrey Rodriguez]</li>
- <li>Updated XML Schema support to April working draft [Eric Ye,
- Jeffrey Rodriguez]</li>
- <li>Changed code to notify error handler of content model
- validation errors before calling endElement [Arnaud Le Hors]</li>
- </ul>
- </s2>
- <s2 title='May 9, 2000'>
- <ul>
- <li>Upgraded to SAX 2.0. [Arnaud Le Hors]</li>
- <li>Added support for WML DOM. [david]</li>
- <li>Preliminary work for full schema support.
- [Andy Clark, Glenn Marcy, jefreyr, Eric Ye]</li>
- <li>Reorganized DOM classes to use much less memory. [Arnaud Le Hors]</li>
- <li>Entities and entity reference nodes are now readonly as
- expected. [Arnaud Le Hors]</li>
- <li>Entity references now have their replacement value when created
- with createEntityReference. [Arnaud Le Hors]</li>
- <li>Fixed problem in Deferred DOM which made building it N^2 order.
- [Arnaud Le Hors]</li>
- <li>Fixed handling of elements with IDs in Deferred DOM. [Arnaud Le Hors]</li>
- <li>Added support for namespaces in parameter entities. [Arnaud Le Hors]</li>
- <li>setNodeValue raised an exception when it should simply be a
- no-op. [Arnaud Le Hors]</li>
- <li>Attributes returned by setNamedItem and setNamedItemNS could not
- be reused. [Arnaud Le Hors]</li>
- <li>Implemented new DOM Level 2 methods hasAttribute and
- hasAttributeNS. [Arnaud Le Hors]</li>
- <li>43: importNode now uses createElementNS and createAttributeNS
- when necessary. [Arnaud Le Hors]</li>
- <li>59: after a first iteration over the whole list, item(index)
- returned the wrong value. [Arnaud Le Hors]</li>
- <li>60: Fixed. [Andy Clark]</li>
- <li>62: Cloned attributes return wrong owner element.
- [awiner@us.oracle.com]</li>
- <li>Fixed caption element creation pb with HTMLTableElement.
- [Assaf Arkin]</li>
- <li>Improved performance of XML serialize. Added support of
- encodings and reuse of serializer. [Assaf Arkin]</li>
- <li>Updated XML serializer to not be strictly dependent on DOM Level
- 2. [Andy Clark]</li>
- </ul>
- </s2>
- <s2 title="March 8, 2000">
- <ul>
- <li>26: Schema lookup disabled when validation is off. [Arnaud Le Hors]</li>
- <li>23: With UCS-4 and UTF-16 encodings, 0xD characters are now properly normalized.[Glenn Marcy]</li>
- <li>27: SAX2 http://xml.org/sax/features/namespaces - default set to true. [pier]</li>
- <li>28: Fixed error in setNamespaces javadoc [elharo@metalab.unc.edu]</li>
- <li>33: Relaxed restraint of xml:space attribute for XHTML DTDs [david-b@pacbell.net]</li>
- <li>34: SAX 2.0beta2 changes accepted. [Ralf Pfeiffer]</li>
- <li>35: Fixed getLength() to always return the right value[Arnaud Le Hors]</li>
- <li>36: Fixed setPrefix() to update nodeName [Arnaud Le Hors]</li>
- </ul>
- </s2>
- <s2 title="February 8, 2000">
- <ul>
- <li>Removed hard-coded strings to enable national language support
-(NLS) [Jeffrey Rodriguez, Arnaud Le Hors, Ralf Pfeiffer]</li>
- <li>Update for SAX2beta [Andy Clark]</li>
- <li>Add new feature <code>http://apache.org/xml/features/dom/include-ignorable-whitespace</code> [Andy Clark]</li>
- <li>ChunkyByteArray - needed resize chunk array for large files [Andy Clark] </li>
- <li>UTF8DataChunk - memory perf fix [Andy Clark] </li>
- <li>DOM L1 - cache node children length to accelerate <code>Node#item()</code>[Andy Clark]</li>
- <li>DOM L1 - Off by one error in DeferredDocumentImpl [jflight@impresse.com]</li>
- <li>DOM L1 - Slight refactoring of DOM to save memory [Arnaud Le Hors]</li>
- <li>Schema datatypes - add binary & URI, update
- decimal & String [twl]</li>
- <li>Schema datatypes - allow StringValidator to validate maxLength & enumeration facets [gtj@peakin.com]</li>
- <li>Schema datatypes - timeDuration & timeInstant validators [gtj@peakin.com]</li>
- <li>Schema functionality - allow schema lookup via installed entity resolver [gtj@peakin.com]</li>
- <li>Schema bug fixes (reportSchemaError & integer subtype registration) [gtj@peakin.com]</li>
- <li>Serializer bug on CData sections [Assaf Arkin] </li>
- <li>Serializers now prints PUBLIC/SYSTEM id [Assaf Arkin]</li>
- <li>HTMLTableElementImpl - Empty cell no longer created
- when adding a row [Assaf Arkin]</li>
- <li>DOM L2 - TreeWalkerImpl didn't iterate backwards properly [bmj01@club-internet.fr]</li>
- <li>DOM L2 - Tracking the candidate recommendation [Arnaud Le Hors]</li>
- <li>DOM L2 Namespace bug fixes [Ralf Pfeiffer, Arnaud Le Hors]</li>
- <li>DOM L2 API moved to org.w3c.dom where it belongs
- [Ralf Pfeiffer]</li>
- <li>DOMMemTest [Arnaud Le Hors]</li>
- </ul>
- </s2>
- <s2 title="December 31, 1999">
- <ul>
- <li>Include documentation in the repository.</li>
- <li>Switch packaging to jar files from .zip and .tar.gz files.</li>
- <li>StreamingCharReader for stream based applications.</li>
- <li>Assaf Arkin's serialization package.</li>
- <li>Assaf Arkin's HTML DOM Level 1 classes.</li>
- <li>Performance improvements.</li>
- <li>Bug fixes.</li>
- </ul>
- </s2>
- <s2 title="November 5, 1999">
- <ul>
- <li>Created initial code base from IBM's XML4J.</li>
- <li>Modified documentation to reflect new name (Xerces)</li>
- </ul>
- </s2>
-
-
-</s1>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE releases SYSTEM 'dtd/releases.dtd'>
+<releases>
+ <release version='NOT YET RELEASED'>
+ <desc/>
+ <changes>
+ <fix>
+ <note>
+ Improved ability of document scanner to perform pull parsing.
+ </note>
+ <submitter name='Andy Clark'/>
+ </fix>
+ <fix>
+ <note>
+ Fixed bug where namespace binder would turn an emptyElement callback into
+ startElement and endElement callbacks.
+ </note>
+ <submitter name='Andy Clark'/>
+ </fix>
+ <update>
+ <note>
+ Updated standard parser configuration to separate DTD validation
+ and namespace binding in the parsing pipeline.
+ </note>
+ <submitter name='Andy Clark'/>
+ </update>
+ <remove>
+ <note>
+ Removed old XML Schema code that was not being used. This code
+ is intended to be replaced by either a port of the Xerces 1.x
+ XML Schema implementation or by a re-designed, re-implemented
+ XML Schema implementation.
+ </note>
+ <submitter name='Andy Clark'/>
+ </remove>
+ <fix>
+ <note>
+ Fixed bug in scanner that allowed the built-in entity references
+ to be sent via XNI. The default value for this feature should have
+ been false.
+ </note>
+ <submitter name='Andy Clark'/>
+ </fix>
+ <fix>
+ <note>Fixed several SAX bugs.</note>
+ <submitter name='Andy Clark'/>
+ </fix>
+ <update>
+ <note>
+ Synchronized DOM implementation code from Xerces 1.x codebase.
+ </note>
+ <submitter name='Andy Clark'/>
+ </update>
+ </changes>
+ </release>
+ <release version='&ParserName; 2.0.0 (beta)'>
+ <desc>
+ First beta release of the Xerces2 code. Besides numerous bug
+ fixes, this release has changes and additions to XNI. The new
+ XNI parser configuration framework has been added in this release.
+ Refer to the <link idref='xni'>XNI Manual</link> for complete
+ information.
+ </desc>
+ <changes>
+ <add>
+ <note>
+ Added document and DTD scanner interfaces to XNI to allow
+ parser configuration pipelines to be constructed generically.
+ </note>
+ <submitter name='Andy Clark'/>
+ </add>
+ <fix>
+ <note>
+ Fixed bug in DTD grammar for mixed content models that was
+ building the wrong validation content model.
+ </note>
+ <submitter name='Sandy Gao'/>
+ </fix>
+ <update>
+ <note>
+ Removed SAX dependency from XNI framework. Now the only
+ dependence on external API such as SAX is in the implementation
+ of the AbstractSAXParser and DOMParser so that legacy code
+ doesn't break.
+ </note>
+ <submitter name='Andy Clark'/>
+ </update>
+ <update>
+ <note>
+ Rewrote existing documentation, added XNI information, cleaned
+ up stylesheets, and converted some docs to use custom DTDs.
+ </note>
+ <submitter name='Andy Clark'/>
+ </update>
+ <fix>
+ <note>DTD method ordering problem for INCLUDE/IGNORE sections.</note>
+ <submitter name='Petr Kuzel'/>
+ </fix>
+ <update>
+ <note>Improved DFA build-time performance.</note>
+ <submitter name='ATOZAWA@jp.ibm.com' mailto='ATOZAWA@jp.ibm.com'/>
+ </update>
+ <update>
+ <note>Synchronized with Xerces 1.3.0</note>
+ <submitter name='Arnaud Le Hors'/>
+ </update>
+ </changes>
+ </release>
+ <release version='&ParserName; 2.0.0 (alpha)'>
+ <desc>Initial alpha release of Xerces2 code.</desc>
+ </release>
+</releases>
1.8 +50 -109 xml-xerces/java/docs/samples.xml
Index: samples.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/samples.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- samples.xml 2000/06/23 01:36:46 1.7
+++ samples.xml 2001/08/23 00:35:14 1.8
@@ -1,110 +1,51 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE s1 SYSTEM "./dtd/document.dtd">
-
-<s1 title="Samples">
- <s2 title="Introduction">
- <ul>
- <li><link idref="domcount">DOMCount</link></li>
- <li><link idref="domcount">SAXCount</link></li>
- <li><link idref="domwriter">DOMWriter</link></li>
- <li><link idref="domwriter">SAXWriter</link></li>
- <li><link idref="domfilter">DOMFilter</link></li>
- <li><link idref="iterator">IteratorView</link></li>
- <li><link idref="tree">TreeWalker</link></li>
- <li><link idref="treeview">TreeViewer</link></li>
- </ul>
- </s2>
- <s2 title="Caveats">
- <note>&javaparsername;: Running the sample applications
- requires that you have already loaded the &javaparsername; software on
- your computer.</note>
- <note>Java: Running the sample applications require that your computer has a
- correctly installed JDK. If you do not already have a JDK already on
- your computer download one from Sun's Java website:
- <jump href="http://java.sun.com">http://java.sun.com</jump> or from
- IBM's website
- <jump href="http://www.ibm.com/developer/java/">http://www.ibm.com/developer/java/</jump>
- where you can find an "Enhanced Windows JDK" that is optimized
- for the Windows platform. The sample applications
- described in the following pages support Java 1 - JDK 1.1.6. 1.1.7, 1.1.8 or
- Java 2 - JDK 1.2.2. </note>
- <note>UNIX: Command lines in the pages linked below use the Windows path
- separator ';' (semicolon) and directory separator '\' (backslash)..
- On UNIX, use the ':' (colon) character to separate the JAR files in the classpath,
- and replace Windows directory separator '\' (backslash)
- with '/' (forward slash).</note>
- </s2>
-
- <s2 title="DOMCount Sample">
- <p><link idref="domcount">DOMCount</link> parses your input file,
- and outputs the total parse time,
- along with counts of elements, attributes, text characters, and ignorable
- whitespace characters. DOMCount displays errors and
- warnings that occur during parsing.</p>
- </s2>
-
- <s2 title="SAXCount Sample">
- <p><link idref="domcount">SAXCount</link> parses your input file,
- and outputs the total parse time,
- along with counts of elements, attributes, text characters, and
- ignorable whitespace characters. SAXCount displays errors and
- warnings that occur during parsing.</p>
- </s2>
-
- <s2 title="DOMWriter Sample">
- <p><link idref="domwriter">DOMWriter</link> parses a file, and
- prints it out in XML format.
- The command line option, -c, is used to print files in
- "canonical" XML format, so that two XML documents can be compared.
- They also display any errors or warnings that occurred during the
- parse.
- DOMWriter also provides a feature to set the output Java encoding
- through the -e switch.</p>
- </s2>
-
- <s2 title="SAXWriter Sample">
- <p><link idref="domwriter">SAXWriter</link> parses a file, and
- prints it out in XML format. The command
- line option, -c, is used to print files in "canonical" XML format,
- so that two XML documents can be compared. They also display any
- errors or warnings that occurred during the parse.</p>
- </s2>
-
- <s2 title="DOMFilter Sample">
- <p><link idref="domfilter">DOMFilter</link> shows you how to
- search for specific elements in
- your XML document. It uses <code>getElementsByTagName()</code>
- to traverse the DOM tree, looking for elements or attributes that
- match your specification.</p>
- </s2>
-
- <s2 title="IteratorView Sample">
- <p><link idref="iterator">IteratorView</link> is an interactive
- UI sample that displays the DOM tree. It
- shows the progress of the iteration by moving the selection within the DOM tree.
- Buttons act as a control panel, allowing the user to interactively iterate through
- the tree, remove nodes, add nodes, and view the results immediately in the tree.</p>
- <p>The <code>IteratorView</code> uses an example filter,
- <code>NameNodeFilter</code>, that can be controlled
- from the UI and a <code>DOMTreeFull</code> class that displays the full DOM tree with all
- the nodes.</p>
- </s2>
-
- <s2 title="TreeWalker Sample">
- <p><link idref="tree">TreeWalkerviewView</link> is an interactive UI sample that displays the DOM
- tree. It show the progress of the tree traversal by moving the selection within the
- DOM tree. Buttons act as a control panel, allowing the user to interactively
- traverse the tree, remove nodes, add nodes, and view the results immediately in
- the tree.</p>
-
- <p>The <code>TreeWalkerviewView</code> uses an example filter,
- <code>NameNodeFilter</code>, that can be
- controlled from the UI and a <code>DOMTreeFull</code> class that
- displays the full DOM tree with all the nodes.</p>
- </s2>
-
- <s2 title="Treeviewer Sample">
- <p><link idref="tree">TreeViewer</link> displays the input XML file in a graphical tree-style
- interface. It will also highlight lines have well-formedness or validation errors.</p>
- </s2>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE s1 SYSTEM 'dtd/document.dtd'>
+<s1 title='Sample Programs'>
+ <s2 title='Overview'>
+ <p>
+ &ParserName; contains many useful samples to help you get
+ up-and-running with writing XML applications. Many of the sample
+ programs are even useful as standalone programs to help in
+ testing the validity of XML documents and/or debugging
+ applications.
+ </p>
+ <p>
+ The samples are organized either by API or by programming area in
+ the following categories:
+ </p>
+ <ul>
+ <li><link idref='samples-dom'>DOM Samples</link></li>
+ <li><link idref='samples-sax'>SAX Samples</link></li>
+ <li><link idref='samples-socket'>Socket Samples</link></li>
+ <li><link idref='samples-ui'>UI Samples</link></li>
+ <li><link idref='samples-xni'>XNI Samples</link></li>
+ </ul>
+ </s2>
+ <s2 title='Running the Samples'>
+ <p>
+ Running the sample applications requires that you have already
+ installed the Java Development Kit (JDK) or Java Runtime
+ Environment (JRE) on you computer and extracted the
+ &ParserName; software.
+ </p>
+ <p>
+ If you do not already have a JDK already on your computer download
+ one from Sun's Java website:
+ <jump href="http://java.sun.com">http://java.sun.com</jump> or from
+ IBM's website
+ <jump href="http://www.ibm.com/developer/java/">http://www.ibm.com/developer/java/</jump>.
+ The sample applications described in the following pages support
+ Java 1.x (e.g. 1.1.8, etc) and/or Java 2 (e.g. 1.2.2, 1.3, etc).
+ The UI samples are written using Swing and require Java 2 in order
+ to run but all of the command line programs will run using Java 1.x.
+ </p>
+ <p>
+ Command lines examples on the following pages use the Windows path
+ separator ';' (semicolon) and directory separator
+ '\' (backslash). On UNIX, use the ':' (colon)
+ character to separate the JAR files in the classpath, and replace
+ Windows directory separator '\' (backslash) with
+ '/' (forward slash).
+ </p>
+ </s2>
</s1>
1.2 +18 -0 xml-xerces/java/docs/limitations.xml
1.2 +185 -0 xml-xerces/java/docs/samples-dom.xml
1.2 +170 -0 xml-xerces/java/docs/samples-sax.xml
1.2 +113 -0 xml-xerces/java/docs/samples-socket.xml
1.2 +24 -0 xml-xerces/java/docs/samples-ui.xml
1.2 +308 -0 xml-xerces/java/docs/samples-xni.xml
1.2 +104 -0 xml-xerces/java/docs/xni-components-dependence.gif
<<Binary file>>
1.2 +99 -0 xml-xerces/java/docs/xni-components-overview.gif
<<Binary file>>
1.2 +1151 -0 xml-xerces/java/docs/xni-config.xml
1.2 +1350 -0 xml-xerces/java/docs/xni-core.xml
1.2 +146 -0 xml-xerces/java/docs/xni-design.xml
1.2 +68 -0 xml-xerces/java/docs/xni-entity-manager.gif
<<Binary file>>
1.2 +91 -0 xml-xerces/java/docs/xni-parser-configuration.gif
<<Binary file>>
1.2 +60 -0 xml-xerces/java/docs/xni-pipeline-basic.gif
<<Binary file>>
1.2 +97 -0 xml-xerces/java/docs/xni-pipeline-detailed.gif
<<Binary file>>
1.2 +489 -0 xml-xerces/java/docs/xni-xerces2.xml
1.2 +167 -0 xml-xerces/java/docs/xni.xml
1.2 +2 -2 xml-xerces/java/docs/dtd/blocks.ent
Index: blocks.ent
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/dtd/blocks.ent,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- blocks.ent 2000/05/23 01:13:18 1.1
+++ blocks.ent 2001/08/23 00:35:15 1.2
@@ -1,4 +1,4 @@
-<?xml encoding='US-ASCII'?>
+<?xml encoding='UTF-8'?>
<!-- BLOCKS ENTITY -->
<!ENTITY % blocks "p|note|ul|ol|gloss|table|source|anchor">
@@ -20,7 +20,7 @@
<!ELEMENT label %content;>
<!ELEMENT item %content;>
-<!ELEMENT source (#PCDATA)>
+<!ELEMENT source (#PCDATA|link)*>
<!ELEMENT table (tr)+>
1.3 +36 -30 xml-xerces/java/docs/dtd/book.dtd
Index: book.dtd
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/dtd/book.dtd,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- book.dtd 2000/06/02 17:30:36 1.2
+++ book.dtd 2001/08/23 00:35:15 1.3
@@ -1,4 +1,4 @@
-<?xml encoding='US-ASCII'?>
+<?xml encoding='UTF-8'?>
<!-- STYLEBOOK BOOK DTD -->
@@ -6,7 +6,8 @@
<!ENTITY % externalEntity SYSTEM "entities.ent">
%externalEntity;
-<!ELEMENT book (resources?|document|hidden|faqs|changes|group|container|external|separator)+>
+<!ELEMENT book (resources?|document|hidden|faqs|releases|
+ external|separator|settings|design)+>
<!ATTLIST book title CDATA #REQUIRED
copyright CDATA #IMPLIED>
@@ -14,37 +15,31 @@
<!ATTLIST resources source CDATA #REQUIRED>
<!ELEMENT document EMPTY>
-<!ATTLIST document id ID #REQUIRED
- source CDATA #REQUIRED
- label CDATA #REQUIRED>
+<!ATTLIST document label CDATA #REQUIRED
+ title CDATA #REQUIRED
+ id ID #REQUIRED
+ source CDATA #REQUIRED>
<!ELEMENT hidden EMPTY>
-<!ATTLIST hidden id ID #REQUIRED
+<!ATTLIST hidden title CDATA #REQUIRED
+ id ID #REQUIRED
source CDATA #REQUIRED>
-<!ELEMENT faqs EMPTY>
-<!ATTLIST faqs id ID #REQUIRED
- source CDATA #REQUIRED
- label CDATA #REQUIRED>
-
-<!ELEMENT changes EMPTY>
-<!ATTLIST changes id ID #REQUIRED
- source CDATA #REQUIRED
- label CDATA #REQUIRED>
-
-<!ELEMENT group (entry)+>
-<!ATTLIST group id ID #IMPLIED
- label CDATA #REQUIRED
- title CDATA #REQUIRED>
-
-<!ELEMENT container (entry)+>
-<!ATTLIST container id ID #IMPLIED
- source CDATA #REQUIRED
- label CDATA #REQUIRED>
-
-<!ELEMENT entry EMPTY>
-<!ATTLIST entry id ID #REQUIRED
- source CDATA #REQUIRED>
+<!ELEMENT faqs (faq+)>
+<!ATTLIST faqs label CDATA #REQUIRED
+ title CDATA #REQUIRED
+ id ID #IMPLIED>
+
+<!ELEMENT faq EMPTY>
+<!ATTLIST faq title CDATA #REQUIRED
+ id ID #REQUIRED
+ source CDATA #REQUIRED>
+
+<!ELEMENT releases EMPTY>
+<!ATTLIST releases label CDATA #REQUIRED
+ title CDATA #REQUIRED
+ id ID #REQUIRED
+ source CDATA #REQUIRED>
<!ELEMENT external EMPTY>
<!ATTLIST external label CDATA #REQUIRED
@@ -52,4 +47,15 @@
<!ELEMENT separator EMPTY>
-<!-- CVS $Revision: 1.2 $ $Date: 2000/06/02 17:30:36 $ -->
+<!ELEMENT settings EMPTY>
+<!ATTLIST settings label CDATA #REQUIRED
+ title CDATA #REQUIRED
+ id ID #REQUIRED
+ source CDATA #REQUIRED>
+
+<!ELEMENT design EMPTY>
+<!ATTLIST design title CDATA #REQUIRED
+ id ID #REQUIRED
+ source CDATA #REQUIRED>
+
+<!-- CVS $Revision: 1.3 $ $Date: 2001/08/23 00:35:15 $ -->
1.2 +2 -2 xml-xerces/java/docs/dtd/characters.ent
Index: characters.ent
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/dtd/characters.ent,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- characters.ent 2000/05/23 01:13:18 1.1
+++ characters.ent 2001/08/23 00:35:15 1.2
@@ -1,4 +1,4 @@
-<?xml encoding='US-ASCII'?>
+<?xml encoding='UTF-8'?>
<!-- CHARACTERS ENTITY -->
@@ -289,7 +289,7 @@
<!ENTITY hearts "♥"> <!-- U+2665 ISOpub - black heart suit = valentine -->
<!ENTITY diams "♦"> <!-- U+2666 ISOpub - black diamond suit -->
-<!-- CVS $Revision: 1.1 $ $Date: 2000/05/23 01:13:18 $ -->
+<!-- CVS $Revision: 1.2 $ $Date: 2001/08/23 00:35:15 $ -->
<!-- Portions (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
1.2 +2 -2 xml-xerces/java/docs/dtd/document.dtd
Index: document.dtd
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/dtd/document.dtd,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- document.dtd 2000/05/23 01:13:18 1.1
+++ document.dtd 2001/08/23 00:35:15 1.2
@@ -1,4 +1,4 @@
-<?xml encoding='US-ASCII'?>
+<?xml encoding='UTF-8'?>
<!-- STYLEBOOK DOCUMENT DTD -->
@@ -16,4 +16,4 @@
<!ATTLIST s3 title CDATA #REQUIRED>
<!ATTLIST s4 title CDATA #REQUIRED>
-<!-- CVS $Revision: 1.1 $ $Date: 2000/05/23 01:13:18 $ -->
\ No newline at end of file
+<!-- CVS $Revision: 1.2 $ $Date: 2001/08/23 00:35:15 $ -->
\ No newline at end of file
1.15 +12 -6 xml-xerces/java/docs/dtd/entities.ent
Index: entities.ent
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/dtd/entities.ent,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- entities.ent 2001/08/20 14:47:44 1.14
+++ entities.ent 2001/08/23 00:35:15 1.15
@@ -1,7 +1,13 @@
-<?xml encoding="US-ASCII"?>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- upper case versions of names and versions -->
+<!ENTITY ParserNameLong 'Xerces2 Java Parser'>
+<!ENTITY ParserName 'Xerces-J'>
+<!ENTITY ParserVersion '2.0.0 (beta)'>
-<!ENTITY javaparsernamelong "Xerces Java Parser">
-<!ENTITY javaparsername "Xerces-J">
-<!ENTITY javaparserversion "1.4.3">
-<!ENTITY javaparserdirectory "xerces-1_4_3">
-<!ENTITY javaparserdistname "Xerces-J-bin"> <!-- name of binaries -->
+<!-- lower case versions of names and versions -->
+<!ENTITY parsername 'xerces-j'>
+<!ENTITY parserversion '2.0.0.beta'>
+
+<!-- packaging names -->
+<!ENTITY parserdir 'xerces-2_0_0_beta'>
+<!ENTITY parserdistname 'Xerces-J-bin'>
1.2 +2 -2 xml-xerces/java/docs/dtd/faqs.dtd
Index: faqs.dtd
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/dtd/faqs.dtd,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- faqs.dtd 2000/05/23 01:13:18 1.1
+++ faqs.dtd 2001/08/23 00:35:15 1.2
@@ -1,4 +1,4 @@
-<?xml encoding='US-ASCII'?>
+<?xml encoding='UTF-8'?>
<!-- STYLEBOOK FAQS DTD -->
@@ -16,4 +16,4 @@
<!ELEMENT q (#PCDATA)>
<!ELEMENT a (%blocks;)+>
-<!-- CVS $Revision: 1.1 $ $Date: 2000/05/23 01:13:18 $ -->
\ No newline at end of file
+<!-- CVS $Revision: 1.2 $ $Date: 2001/08/23 00:35:15 $ -->
\ No newline at end of file
1.2 +1 -1 xml-xerces/java/docs/dtd/links.ent
Index: links.ent
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/dtd/links.ent,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- links.ent 2000/05/23 01:13:18 1.1
+++ links.ent 2001/08/23 00:35:15 1.2
@@ -1,4 +1,4 @@
-<?xml encoding='US-ASCII'?>
+<?xml encoding='UTF-8'?>
<!-- LINKS ENTITY -->
<!ENTITY % links "link|anchor|jump|img|resource-ref|human-resource-ref">
1.2 +4 -3 xml-xerces/java/docs/dtd/markup.ent
Index: markup.ent
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/dtd/markup.ent,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- markup.ent 2000/05/23 01:13:18 1.1
+++ markup.ent 2001/08/23 00:35:15 1.2
@@ -1,7 +1,7 @@
-<?xml encoding='US-ASCII'?>
+<?xml encoding='UTF-8'?>
<!-- MARKUP ENTITY -->
-<!ENTITY % markup "em|ref|code|br">
+<!ENTITY % markup "em|strong|ref|code|br">
<!-- import the external source-specific dtd -->
<!ENTITY % externalEntity SYSTEM "entities.ent">
@@ -14,8 +14,9 @@
%linksEntity;
<!ELEMENT em (#PCDATA|%links;)*>
+<!ELEMENT strong (#PCDATA|%links;)*>
<!ELEMENT ref (#PCDATA|%links;)*>
<!ELEMENT code (#PCDATA|%links;)*>
<!ELEMENT br EMPTY>
-<!-- CVS $Revision: 1.1 $ $Date: 2000/05/23 01:13:18 $ -->
+<!-- CVS $Revision: 1.2 $ $Date: 2001/08/23 00:35:15 $ -->
1.2 +66 -0 xml-xerces/java/docs/dtd/design.dtd
1.2 +19 -0 xml-xerces/java/docs/dtd/releases.dtd
1.2 +39 -0 xml-xerces/java/docs/dtd/settings.dtd
1.2 +9 -0 xml-xerces/java/docs/style/loader.xml
1.2 +1 -0 xml-xerces/java/docs/style/graphics/button-a.gif
<<Binary file>>
1.2 +1 -0 xml-xerces/java/docs/style/graphics/button-b.gif
<<Binary file>>
1.2 +5 -0 xml-xerces/java/docs/style/resources/bottom.gif
<<Binary file>>
1.2 +9 -0 xml-xerces/java/docs/style/resources/button-asf-hi.gif
<<Binary file>>
1.2 +15 -0 xml-xerces/java/docs/style/resources/button-asf-lo.gif
<<Binary file>>
1.2 +8 -0 xml-xerces/java/docs/style/resources/button-w3c-hi.gif
<<Binary file>>
1.2 +9 -0 xml-xerces/java/docs/style/resources/button-w3c-lo.gif
<<Binary file>>
1.2 +7 -0 xml-xerces/java/docs/style/resources/button-xml-hi.gif
<<Binary file>>
1.2 +9 -0 xml-xerces/java/docs/style/resources/button-xml-lo.gif
<<Binary file>>
1.2 +5 -0 xml-xerces/java/docs/style/resources/changes-add.jpg
<<Binary file>>
1.2 +4 -0 xml-xerces/java/docs/style/resources/changes-fix.jpg
<<Binary file>>
1.2 +4 -0 xml-xerces/java/docs/style/resources/changes-remove.jpg
<<Binary file>>
1.2 +5 -0 xml-xerces/java/docs/style/resources/changes-update.jpg
<<Binary file>>
1.2 +2 -0 xml-xerces/java/docs/style/resources/close.gif
<<Binary file>>
1.2 +1 -0 xml-xerces/java/docs/style/resources/dot.gif
<<Binary file>>
1.2 +5 -0 xml-xerces/java/docs/style/resources/join.gif
<<Binary file>>
1.2 +4 -0 xml-xerces/java/docs/style/resources/line.gif
<<Binary file>>
1.2 +21 -0 xml-xerces/java/docs/style/resources/logo.gif
<<Binary file>>
1.2 +6 -0 xml-xerces/java/docs/style/resources/note.gif
<<Binary file>>
1.2 +5 -0 xml-xerces/java/docs/style/resources/right.gif
<<Binary file>>
1.2 +21 -0 xml-xerces/java/docs/style/resources/script.js
1.2 +1 -0 xml-xerces/java/docs/style/resources/separator.gif
<<Binary file>>
1.2 +1 -0 xml-xerces/java/docs/style/resources/void.gif
<<Binary file>>
1.2 +40 -0 xml-xerces/java/docs/style/stylesheets/any2header.xsl
1.2 +21 -0 xml-xerces/java/docs/style/stylesheets/any2project.xsl
1.2 +36 -0 xml-xerces/java/docs/style/stylesheets/book2group.xsl
1.2 +273 -0 xml-xerces/java/docs/style/stylesheets/book2project.xsl
1.2 +43 -0 xml-xerces/java/docs/style/stylesheets/changes2document.xsl
1.2 +29 -0 xml-xerces/java/docs/style/stylesheets/context2footer.xsl
1.2 +25 -0 xml-xerces/java/docs/style/stylesheets/context2label.xsl
1.2 +145 -0 xml-xerces/java/docs/style/stylesheets/design2document.xsl
1.2 +231 -0 xml-xerces/java/docs/style/stylesheets/design2html.xsl
1.2 +34 -0 xml-xerces/java/docs/style/stylesheets/directory2project.xsl
1.2 +468 -0 xml-xerces/java/docs/style/stylesheets/document2html.xsl
1.2 +53 -0 xml-xerces/java/docs/style/stylesheets/faqs2document.xsl
1.2 +31 -0 xml-xerces/java/docs/style/stylesheets/group2document.xsl
1.2 +63 -0 xml-xerces/java/docs/style/stylesheets/releases2document.xsl
1.2 +135 -0 xml-xerces/java/docs/style/stylesheets/settings2document.xsl
1.4 +20 -17 xml-xerces/java/samples/dom/DOMAddLines.java
Index: DOMAddLines.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/dom/DOMAddLines.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOMAddLines.java 2000/05/17 18:31:29 1.3
+++ DOMAddLines.java 2001/08/23 00:35:17 1.4
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -58,19 +58,24 @@
package dom;
import java.io.*;
+
+import org.apache.xerces.dom.NodeImpl;
+import org.apache.xerces.parsers.DOMParser;
+import org.apache.xerces.xni.QName;
+import org.apache.xerces.xni.XMLAttributes;
+import org.apache.xerces.xni.XMLString;
+
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
import org.w3c.dom.NamedNodeMap;
+
+import org.xml.sax.InputSource;
import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
import org.xml.sax.helpers.*;
-import org.apache.xerces.dom.NodeImpl;
-import org.apache.xerces.framework.XMLAttrList;
-import org.apache.xerces.parsers.DOMParser;
-import org.apache.xerces.utils.QName;
/**
* A sample of Adding lines to the DOM Node. This sample program illustrates:
@@ -80,7 +85,7 @@
* - How to attach user defined Objects to Nodes using method setUserData
* This example relies on the following:
* - Turning off the "fast" DOM so we can use set expansion to FULL
- * @version
+ * @version $Id: DOMAddLines.java,v 1.4 2001/08/23 00:35:17 lehors Exp $
*/
public class DOMAddLines extends DOMParser {
@@ -227,9 +232,9 @@
/* We override startElement callback from DocumentHandler */
- public void startElement(QName elementQName, XMLAttrList attrList, int attrListIndex) throws Exception
- {
- super.startElement(elementQName, attrList, attrListIndex);
+ public void startElement(QName elementQName, XMLAttributes attrList)
+ throws SAXException {
+ super.startElement(elementQName, attrList);
NodeImpl node = null;
try {
@@ -242,14 +247,12 @@
}
//NodeImpl node = (NodeImpl)getCurrentNode(); // Get current node
if( node != null )
- node.setUserData( String.valueOf( getLocator().getLineNumber() ) ); // Save location String into node
+ node.setUserData( String.valueOf( fEntityManager.getEntityScanner().getLineNumber() ) ); // Save location String into node
} //startElement
/* We override startDocument callback from DocumentHandler */
- public void startDocument(int versionIndex, int encodingIndex,
- int standAloneIndex)
- {
+ public void startDocument() throws SAXException {
//super.startDocument( versionIndex, encodingIndex,
// standAloneIndex);
super.startDocument();
@@ -265,14 +268,14 @@
// NodeImpl node = (NodeImpl)getCurrentNode(); // Get current node
if( node != null )
- node.setUserData( String.valueOf( getLocator().getLineNumber() ) ); // Save location String into node
+ node.setUserData( String.valueOf( fEntityManager.getEntityScanner().getLineNumber() ) ); // Save location String into node
} //startDocument
- public void ignorableWhitespace(int dataIndex) throws Exception
+ public void ignorableWhitespace(XMLString text) throws SAXException
{
if(! NotIncludeIgnorableWhiteSpaces )
- super.ignorableWhitespace( dataIndex);
+ super.ignorableWhitespace( text);
else
;// Ignore ignorable white spaces
}// ignorableWhitespace
1.4 +1 -1 xml-xerces/java/samples/dom/DOMGenerate.java
Index: DOMGenerate.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/dom/DOMGenerate.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOMGenerate.java 2000/05/25 18:42:49 1.3
+++ DOMGenerate.java 2001/08/23 00:35:17 1.4
@@ -73,7 +73,7 @@
* - Generate a DOM from Scratch.
* - Output DOM to a String using Serializer
* @author Jeffrey Rodriguez
- * @version $id$
+ * @version $Id: DOMGenerate.java,v 1.4 2001/08/23 00:35:17 lehors Exp $
*/
public class DOMGenerate {
public static void main( String[] argv ) {
1.2 +446 -0 xml-xerces/java/samples/dom/Counter.java
1.2 +388 -0 xml-xerces/java/samples/dom/GetElementsByTagName.java
1.2 +128 -0 xml-xerces/java/samples/dom/ParserWrapper.java
1.2 +521 -0 xml-xerces/java/samples/dom/Writer.java
1.6 +1 -1 xml-xerces/java/samples/dom/traversal/IteratorView.java
Index: IteratorView.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/dom/traversal/IteratorView.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- IteratorView.java 2000/10/02 22:06:23 1.5
+++ IteratorView.java 2001/08/23 00:35:17 1.6
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.3 +1 -1 xml-xerces/java/samples/dom/traversal/NameNodeFilter.java
Index: NameNodeFilter.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/dom/traversal/NameNodeFilter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NameNodeFilter.java 2000/01/07 00:02:28 1.2
+++ NameNodeFilter.java 2001/08/23 00:35:17 1.3
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.6 +1 -1 xml-xerces/java/samples/dom/traversal/TreeWalkerView.java
Index: TreeWalkerView.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/dom/traversal/TreeWalkerView.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TreeWalkerView.java 2000/10/02 22:06:23 1.5
+++ TreeWalkerView.java 2001/08/23 00:35:17 1.6
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +178 -0 xml-xerces/java/samples/dom/wrappers/Xerces.java
1.4 +693 -275 xml-xerces/java/samples/sax/DocumentTracer.java
Index: DocumentTracer.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/sax/DocumentTracer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DocumentTracer.java 2000/12/20 18:08:54 1.3
+++ DocumentTracer.java 2001/08/23 00:35:17 1.4
@@ -57,44 +57,89 @@
package sax;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
-import org.apache.xerces.parsers.SAXParser;
-
+import org.xml.sax.AttributeList;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
+import org.xml.sax.DocumentHandler;
import org.xml.sax.DTDHandler;
import org.xml.sax.ErrorHandler;
import org.xml.sax.Locator;
+import org.xml.sax.Parser;
import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.ParserAdapter;
+import org.xml.sax.helpers.ParserFactory;
+import org.xml.sax.helpers.XMLReaderFactory;
import org.xml.sax.ext.DeclHandler;
import org.xml.sax.ext.LexicalHandler;
/**
- * Provides a complete trace of SAX2 events for files parsed.
+ * Provides a complete trace of SAX2 events for files parsed. This is
+ * useful for making sure that a SAX parser implementation faithfully
+ * communicates all information in the document to the SAX handlers.
*
* @author Andy Clark, IBM
* @author Arnaud Le Hors, IBM
*
- * @version $Id: DocumentTracer.java,v 1.3 2000/12/20 18:08:54 lehors Exp $
+ * @version $Id: DocumentTracer.java,v 1.4 2001/08/23 00:35:17 lehors Exp $
*/
public class DocumentTracer
extends DefaultHandler
- implements ContentHandler, DTDHandler, ErrorHandler, // standard
- DeclHandler, LexicalHandler // extensions (beta)
+ implements ContentHandler, DTDHandler, ErrorHandler, // SAX2
+ DeclHandler, LexicalHandler, // SAX2 extensions
+ DocumentHandler // deprecated in SAX2
{
//
+ // Constants
+ //
+
+ // feature ids
+
+ /** Namespaces feature id (http://xml.org/sax/features/namespaces). */
+ protected static final String NAMESPACES_FEATURE_ID = "http://xml.org/sax/features/namespaces";
+
+ /** Validation feature id (http://xml.org/sax/features/validation). */
+ protected static final String VALIDATION_FEATURE_ID = "http://xml.org/sax/features/validation";
+
+ /** Schema validation feature id (http://apache.org/xml/features/validation/schema). */
+ protected static final String SCHEMA_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/schema";
+
+ // property ids
+
+ /** Lexical handler property id (http://xml.org/sax/properties/lexical-handler). */
+ protected static final String LEXICAL_HANDLER_PROPERTY_ID = "http://xml.org/sax/properties/lexical-handler";
+
+ // default settings
+
+ /** Default parser name. */
+ protected static final String DEFAULT_PARSER_NAME = "org.apache.xerces.parsers.SAXParser";
+
+ /** Default namespaces support (true). */
+ protected static final boolean DEFAULT_NAMESPACES = true;
+
+ /** Default validation support (false). */
+ protected static final boolean DEFAULT_VALIDATION = false;
+
+ /** Default Schema validation support (true). */
+ protected static final boolean DEFAULT_SCHEMA_VALIDATION = true;
+
+ //
// Data
//
- /** SAX parser. */
- protected SAXParser fSAXParser;
+ /** Print writer. */
+ protected PrintWriter fOut;
/** Indent level. */
protected int fIndent;
@@ -105,358 +150,625 @@
/** Default constructor. */
public DocumentTracer() {
-
+ setOutput(new PrintWriter(System.out));
} // <init>()
//
- // ContentHandler methods
+ // Public methods
//
+ /** Sets the output stream for printing. */
+ public void setOutput(OutputStream stream, String encoding)
+ throws UnsupportedEncodingException {
+
+ if (encoding == null) {
+ encoding = "UTF8";
+ }
+
+ Writer writer = new OutputStreamWriter(stream, encoding);
+ fOut = new PrintWriter(writer);
+
+ } // setOutput(OutputStream,String)
+
+ /** Sets the output writer. */
+ public void setOutput(Writer writer) {
+
+ fOut = writer instanceof PrintWriter
+ ? (PrintWriter)writer : new PrintWriter(writer);
+
+ } // setOutput(Writer)
+
+ //
+ // ContentHandler and DocumentHandler methods
+ //
+
+ /** Set document locator. */
public void setDocumentLocator(Locator locator) {
+
printIndent();
- System.out.println("setDocumentLocator("+locator+')');
- }
+ fOut.print("setDocumentLocator(");
+ fOut.print("locator=");
+ fOut.print(locator);
+ fOut.println(')');
+ fOut.flush();
+ } // setDocumentLocator(Locator)
+
+ /** Start document. */
public void startDocument() throws SAXException {
+
fIndent = 0;
printIndent();
- System.out.println("startDocument()");
+ fOut.println("startDocument()");
+ fOut.flush();
fIndent++;
- }
+ } // startDocument()
+
+ /** Processing instruction. */
public void processingInstruction(String target, String data)
throws SAXException {
+
printIndent();
- System.out.print("processingInstruction(");
- System.out.print("target="+quoteString(target));
- System.out.print(',');
- System.out.print("data="+quoteString(data));
- System.out.println(')');
- }
+ fOut.print("processingInstruction(");
+ fOut.print("target=");
+ printQuotedString(target);
+ fOut.print(',');
+ fOut.print("data=");
+ printQuotedString(data);
+ fOut.println(')');
+ fOut.flush();
- public void startPrefixMapping(String prefix, String uri)
+ } // processingInstruction(String,String)
+
+ /** Characters. */
+ public void characters(char[] ch, int offset, int length)
throws SAXException {
+
printIndent();
- System.out.print("startPrefixMapping(");
- System.out.print("prefix="+quoteString(prefix));
- System.out.print(',');
- System.out.print("uri="+quoteString(uri));
- System.out.println(')');
- fIndent++;
- }
+ fOut.print("characters(");
+ fOut.print("text=");
+ printQuotedString(ch, offset, length);
+ fOut.println(')');
+ fOut.flush();
+
+ } // characters(char[],int,int)
+
+ /** Ignorable whitespace. */
+ public void ignorableWhitespace(char[] ch, int offset, int length)
+ throws SAXException {
+
+ printIndent();
+ fOut.print("ignorableWhitespace(");
+ fOut.print("text=");
+ printQuotedString(ch, offset, length);
+ fOut.println(')');
+ fOut.flush();
+
+ } // ignorableWhitespace(char[],int,int)
+
+ /** End document. */
+ public void endDocument() throws SAXException {
+
+ fIndent--;
+ printIndent();
+ fOut.println("endDocument()");
+ fOut.flush();
+
+ } // endDocument()
+
+ //
+ // ContentHandler methods
+ //
- public void startElement(String uri, String localpart, String rawname, Attributes attributes)
+ /** Start prefix mapping. */
+ public void startPrefixMapping(String prefix, String uri)
throws SAXException {
+
printIndent();
- System.out.print("startElement(");
- System.out.print("element={"+uri+','+localpart+','+rawname+'}');
- System.out.print(',');
- System.out.print("attributes=");
+ fOut.print("startPrefixMapping(");
+ fOut.print("prefix=");
+ printQuotedString(prefix);
+ fOut.print(',');
+ fOut.print("uri=");
+ printQuotedString(uri);
+ fOut.println(')');
+ fOut.flush();
+
+ } // startPrefixMapping(String,String)
+
+ /** Start element. */
+ public void startElement(String uri, String localName, String qname,
+ Attributes attributes) throws SAXException {
+
+ printIndent();
+ fOut.print("startElement(");
+ fOut.print("uri=");
+ printQuotedString(uri);
+ fOut.print(',');
+ fOut.print("localName=");
+ printQuotedString(localName);
+ fOut.print(',');
+ fOut.print("qname=");
+ printQuotedString(qname);
+ fOut.print(',');
+ fOut.print("attributes=");
if (attributes == null) {
- System.out.println("null");
+ fOut.println("null");
}
else {
- System.out.print('{');
+ fOut.print('{');
int length = attributes.getLength();
for (int i = 0; i < length; i++) {
if (i > 0) {
- System.out.print(',');
+ fOut.print(',');
}
+ String attrLocalName = attributes.getLocalName(i);
+ String attrQName = attributes.getQName(i);
String attrURI = attributes.getURI(i);
- String attrLocalpart = attributes.getLocalName(i);
- String attrRawname = attributes.getQName(i);
- System.out.print('{'+attrURI+','+attrLocalpart+','+attrRawname+"}=");
- System.out.print(quoteString(attributes.getValue(i)));
+ String attrType = attributes.getType(i);
+ String attrValue = attributes.getValue(i);
+ fOut.print('{');
+ fOut.print("uri=");
+ printQuotedString(attrURI);
+ fOut.print(',');
+ fOut.print("localName=");
+ printQuotedString(attrLocalName);
+ fOut.print(',');
+ fOut.print("qname=");
+ printQuotedString(attrQName);
+ fOut.print(',');
+ fOut.print("type=");
+ printQuotedString(attrType);
+ fOut.print(',');
+ fOut.print("value=");
+ printQuotedString(attrValue);
+ fOut.print('}');
}
- System.out.print('}');
+ fOut.print('}');
}
- System.out.println(')');
+ fOut.println(')');
+ fOut.flush();
fIndent++;
- }
- public void characters(char[] ch, int offset, int length) throws SAXException {
- printIndent();
- System.out.print("characters(");
- System.out.print("text="+quoteString(new String(ch, offset, length)));
- System.out.println(')');
- }
+ } // startElement(String,String,String,Attributes)
- public void ignorableWhitespace(char[] ch, int offset, int length) throws SAXException {
- printIndent();
- System.out.print("ignorableWhitespace(");
- System.out.print("text="+quoteString(new String(ch, offset, length)));
- System.out.println(')');
- }
+ /** End element. */
+ public void endElement(String uri, String localName, String qname)
+ throws SAXException {
- public void endElement(String uri, String localpart, String rawname) throws SAXException {
fIndent--;
printIndent();
- System.out.print("endElement(");
- System.out.print("element={"+uri+','+localpart+','+rawname+'}');
- System.out.println("})");
- }
+ fOut.print("endElement(");
+ fOut.print("uri=");
+ printQuotedString(uri);
+ fOut.print(',');
+ fOut.print("localName=");
+ printQuotedString(localName);
+ fOut.print(',');
+ fOut.print("qname=");
+ printQuotedString(qname);
+ fOut.println(')');
+ fOut.flush();
+
+ } // endElement(String,String,String)
+ /** End prefix mapping. */
public void endPrefixMapping(String prefix) throws SAXException {
- fIndent--;
+
printIndent();
- System.out.print("endPrefixMapping(");
- System.out.print("prefix="+quoteString(prefix));
- System.out.println(')');
- }
+ fOut.print("endPrefixMapping(");
+ fOut.print("prefix=");
+ printQuotedString(prefix);
+ fOut.println(')');
+ fOut.flush();
+ } // endPrefixMapping(String)
+
+ /** Skipped entity. */
public void skippedEntity(String name) throws SAXException {
+
printIndent();
- System.out.print("skippedEntity(");
- System.out.print("name="+quoteString(name));
- System.out.println(')');
- }
+ fOut.print("skippedEntity(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.println(')');
+ fOut.flush();
- public void endDocument() throws SAXException {
+ } // skippedEntity(String)
+
+ //
+ // DocumentHandler methods
+ //
+
+ /** Start element. */
+ public void startElement(String name, AttributeList attributes)
+ throws SAXException {
+
+ printIndent();
+ fOut.print("startElement(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.print(',');
+ fOut.print("attributes=");
+ if (attributes == null) {
+ fOut.println("null");
+ }
+ else {
+ fOut.print('{');
+ int length = attributes.getLength();
+ for (int i = 0; i < length; i++) {
+ if (i > 0) {
+ System.out.print(',');
+ }
+ String attrName = attributes.getName(i);
+ String attrType = attributes.getType(i);
+ String attrValue = attributes.getValue(i);
+ fOut.print('{');
+ fOut.print("name=");
+ printQuotedString(attrName);
+ fOut.print(',');
+ fOut.print("type=");
+ printQuotedString(attrType);
+ fOut.print(',');
+ fOut.print("value=");
+ printQuotedString(attrValue);
+ fOut.print('}');
+ }
+ fOut.print('}');
+ }
+ fOut.println(')');
+ fOut.flush();
+ fIndent++;
+
+ } // startElement(String,AttributeList)
+
+ /** End element. */
+ public void endElement(String name) throws SAXException {
+
fIndent--;
printIndent();
- System.out.println("endDocument()");
- }
+ fOut.print("endElement(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.println(')');
+ fOut.flush();
+
+ } // endElement(String)
//
// DTDHandler methods
//
+ /** Notation declaration. */
public void notationDecl(String name, String publicId, String systemId)
throws SAXException {
- printIndent();
- System.out.print("notationDecl(");
- System.out.print("name="+quoteString(name));
- System.out.print(',');
- System.out.print("publicId="+quoteString(publicId));
- System.out.print(',');
- System.out.print("systemId="+quoteString(systemId));
- System.out.println(')');
- }
- public void unparsedEntityDecl(String name, String publicId, String systemId,
+ printIndent();
+ fOut.print("notationDecl(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.print(',');
+ fOut.print("publicId=");
+ printQuotedString(publicId);
+ fOut.print(',');
+ fOut.print("systemId=");
+ printQuotedString(systemId);
+ fOut.println(')');
+ fOut.flush();
+
+ } // notationDecl(String,String,String)
+
+ /** Unparsed entity declaration. */
+ public void unparsedEntityDecl(String name,
+ String publicId, String systemId,
String notationName) throws SAXException {
printIndent();
- System.out.print("unparsedEntityDecl(");
- System.out.print("name="+quoteString(name));
- System.out.print(',');
- System.out.print("publicId="+quoteString(publicId));
- System.out.print(',');
- System.out.print("systemId="+quoteString(systemId));
- System.out.print(',');
- System.out.print("notationName="+quoteString(notationName));
- System.out.println(')');
- }
+ fOut.print("unparsedEntityDecl(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.print(',');
+ fOut.print("publicId=");
+ printQuotedString(publicId);
+ fOut.print(',');
+ fOut.print("systemId=");
+ printQuotedString(systemId);
+ fOut.print(',');
+ fOut.print("notationName=");
+ printQuotedString(notationName);
+ fOut.println(')');
+ fOut.flush();
+ } // unparsedEntityDecl(String,String,String,String)
+
//
// LexicalHandler methods
//
+ /** Start DTD. */
public void startDTD(String name, String publicId, String systemId)
throws SAXException {
+
printIndent();
- System.out.print("startDTD(");
- System.out.print("name="+quoteString(name));
- System.out.print(',');
- System.out.print("publicId="+quoteString(publicId));
- System.out.print(',');
- System.out.print("systemId="+quoteString(systemId));
- System.out.println(')');
+ fOut.print("startDTD(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.print(',');
+ fOut.print("publicId=");
+ printQuotedString(publicId);
+ fOut.print(',');
+ fOut.print("systemId=");
+ printQuotedString(systemId);
+ fOut.println(')');
+ fOut.flush();
fIndent++;
- }
+ } // startDTD(String,String,String)
+
+ /** Start entity. */
public void startEntity(String name) throws SAXException {
+
printIndent();
- System.out.print("startEntity(");
- System.out.print("name="+quoteString(name));
- System.out.println(')');
+ fOut.print("startEntity(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.println(')');
+ fOut.flush();
fIndent++;
- }
+ } // startEntity(String)
+
+ /** Start CDATA section. */
public void startCDATA() throws SAXException {
+
printIndent();
- System.out.println("startCDATA()");
+ fOut.println("startCDATA()");
+ fOut.flush();
fIndent++;
- }
+ } // startCDATA()
+
+ /** End CDATA section. */
public void endCDATA() throws SAXException {
+
fIndent--;
printIndent();
- System.out.println("endCDATA()");
- }
+ fOut.println("endCDATA()");
+ fOut.flush();
+
+ } // endCDATA()
- public void comment(char[] ch, int offset, int length) throws SAXException {
+ /** Comment. */
+ public void comment(char[] ch, int offset, int length)
+ throws SAXException {
+
printIndent();
- System.out.print("comment(");
- System.out.print("text="+quoteString(new String(ch, offset, length)));
- System.out.println(')');
- }
+ fOut.print("comment(");
+ fOut.print("text=");
+ printQuotedString(ch, offset, length);
+ fOut.println(')');
+ fOut.flush();
+ } // comment(char[],int,int)
+
+ /** End entity. */
public void endEntity(String name) throws SAXException {
+
fIndent--;
printIndent();
- System.out.print("endEntity(");
- System.out.print("name="+quoteString(name));
- System.out.println(')');
- }
+ fOut.print("endEntity(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.println(')');
+
+ } // endEntity(String)
+ /** End DTD. */
public void endDTD() throws SAXException {
+
fIndent--;
printIndent();
- System.out.println("endDTD()");
- } // endDTD
+ fOut.println("endDTD()");
+ fOut.flush();
+
+ } // endDTD()
//
// DeclHandler methods
//
+ /** Element declaration. */
public void elementDecl(String name, String contentModel)
throws SAXException {
+
printIndent();
- System.out.print("elementDecl(");
- System.out.print("name="+quoteString(name));
- System.out.print(',');
- System.out.print("contentModel="+quoteString(contentModel));
- System.out.println(')');
- } // elementDecl
+ fOut.print("elementDecl(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.print(',');
+ fOut.print("contentModel=");
+ printQuotedString(contentModel);
+ fOut.println(')');
+ fOut.flush();
+ } // elementDecl(String,String)
+
+ /** Attribute declaration. */
public void attributeDecl(String elementName, String attributeName,
- String type, String defaultValue, String defaultType)
- throws SAXException {
+ String type, String valueDefault,
+ String value) throws SAXException {
+
printIndent();
- System.out.print("attributeDecl(");
- System.out.print("elementName="+quoteString(elementName));
- System.out.print(',');
- System.out.print("attributeName="+quoteString(attributeName));
- System.out.print(',');
- System.out.print("type="+quoteString(type));
- System.out.print(',');
- System.out.print("defaultValue="+quoteString(defaultValue));
- System.out.print(',');
- System.out.print("defaultType="+quoteString(defaultType));
- System.out.println(')');
- } // attributeDecl
+ fOut.print("attributeDecl(");
+ fOut.print("elementName=");
+ printQuotedString(elementName);
+ fOut.print(',');
+ fOut.print("attributeName=");
+ printQuotedString(attributeName);
+ fOut.print(',');
+ fOut.print("type=");
+ printQuotedString(type);
+ fOut.print(',');
+ fOut.print("valueDefault=");
+ printQuotedString(valueDefault);
+ fOut.print(',');
+ fOut.print("value=");
+ printQuotedString(value);
+ fOut.println(')');
+ fOut.flush();
+
+ } // attributeDecl(String,String,String,String,String)
+ /** Internal entity declaration. */
public void internalEntityDecl(String name, String text)
throws SAXException {
+
printIndent();
- System.out.print("internalEntityDecl(");
- System.out.print("name="+quoteString(name));
- System.out.print(',');
- System.out.print("text="+quoteString(text));
- System.out.println(')');
- } // internalEntityDecl
-
- public void externalEntityDecl(String name, String publicId, String systemId)
- throws SAXException {
- printIndent();
- System.out.print("externalEntityDecl(");
- System.out.print("name="+quoteString(name));
- System.out.print(',');
- System.out.print("publicId="+quoteString(publicId));
- System.out.print(',');
- System.out.print("systemId="+quoteString(systemId));
- System.out.println(')');
- } // externalEntityDecl
+ fOut.print("internalEntityDecl(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.print(',');
+ fOut.print("text=");
+ printQuotedString(text);
+ fOut.println(')');
+ fOut.flush();
+
+ } // internalEntityDecl(String,String)
+
+ /** External entity declaration. */
+ public void externalEntityDecl(String name,
+ String publicId, String systemId)
+ throws SAXException {
+ printIndent();
+ fOut.print("externalEntityDecl(");
+ fOut.print("name=");
+ printQuotedString(name);
+ fOut.print(',');
+ fOut.print("publicId=");
+ printQuotedString(publicId);
+ fOut.print(',');
+ fOut.print("systemId=");
+ printQuotedString(systemId);
+ fOut.println(')');
+ fOut.flush();
+
+ } // externalEntityDecl(String,String,String)
+
//
// ErrorHandler methods
//
/** Warning. */
- public void warning(SAXParseException ex) {
- System.err.println("[Warning] "+
- getLocationString(ex)+": "+
- ex.getMessage());
- }
+ public void warning(SAXParseException ex) throws SAXException {
+ printError("Warning", ex);
+ } // warning(SAXParseException)
/** Error. */
- public void error(SAXParseException ex) {
- System.err.println("[Error] "+
- getLocationString(ex)+": "+
- ex.getMessage());
- }
+ public void error(SAXParseException ex) throws SAXException {
+ printError("Error", ex);
+ } // error(SAXParseException)
/** Fatal error. */
public void fatalError(SAXParseException ex) throws SAXException {
- System.err.println("[Fatal Error] "+
- getLocationString(ex)+": "+
- ex.getMessage());
+ printError("Fatal Error", ex);
throw ex;
- }
+ } // fatalError(SAXParseException)
//
- // Static methods
+ // Protected methods
//
+
+ /** Print quoted string. */
+ protected void printQuotedString(String s) {
- public static String quoteString(String s) {
if (s == null) {
- return "null";
+ fOut.print("null");
+ return;
}
- StringBuffer str = new StringBuffer();
- str.append('"');
+
+ fOut.print('"');
int length = s.length();
for (int i = 0; i < length; i++) {
char c = s.charAt(i);
- switch (c) {
- case '\n': {
- str.append("\\n");
- break;
- }
- case '\r': {
- str.append("\\r");
- break;
- }
- case '\t': {
- str.append("\\t");
- break;
- }
- case '\\': {
- str.append("\\\\");
- break;
- }
- case '"': {
- str.append("\\\"");
- break;
- }
- default: {
- str.append(c);
- }
- }
+ normalizeAndPrint(c);
}
- str.append('"');
- return str.toString();
- }
+ fOut.print('"');
- //
- // Private methods
- //
+ } // printQuotedString(String)
- /** Prints the indent. */
- private void printIndent() {
- for (int i = 0; i < fIndent; i++) {
- System.out.print(' ');
+ /** Print quoted string. */
+ protected void printQuotedString(char[] ch, int offset, int length) {
+
+ fOut.print('"');
+ for (int i = 0; i < length; i++) {
+ normalizeAndPrint(ch[offset + i]);
}
- }
+ fOut.print('"');
+
+ } // printQuotedString(char[],int,int)
+
+ /** Normalize and print. */
+ protected void normalizeAndPrint(char c) {
+
+ switch (c) {
+ case '\n': {
+ fOut.print("\\n");
+ break;
+ }
+ case '\r': {
+ fOut.print("\\r");
+ break;
+ }
+ case '\t': {
+ fOut.print("\\t");
+ break;
+ }
+ case '\\': {
+ fOut.print("\\\\");
+ break;
+ }
+ case '"': {
+ fOut.print("\\\"");
+ break;
+ }
+ default: {
+ fOut.print(c);
+ }
+ }
+
+ } // normalizeAndPrint(char)
- /** Returns a string of the location. */
- private String getLocationString(SAXParseException ex) {
- StringBuffer str = new StringBuffer();
+ /** Prints the error message. */
+ protected void printError(String type, SAXParseException ex) {
+ System.err.print("[");
+ System.err.print(type);
+ System.err.print("] ");
String systemId = ex.getSystemId();
if (systemId != null) {
int index = systemId.lastIndexOf('/');
- if (index != -1)
+ if (index != -1)
systemId = systemId.substring(index + 1);
- str.append(systemId);
+ System.err.print(systemId);
}
- str.append(':');
- str.append(ex.getLineNumber());
- str.append(':');
- str.append(ex.getColumnNumber());
+ System.err.print(':');
+ System.err.print(ex.getLineNumber());
+ System.err.print(':');
+ System.err.print(ex.getColumnNumber());
+ System.err.print(": ");
+ System.err.print(ex.getMessage());
+ System.err.println();
+ System.err.flush();
- return str.toString();
+ } // printError(String,SAXParseException)
- } // getLocationString(SAXParseException):String
+ /** Prints the indent. */
+ protected void printIndent() {
+ for (int i = 0; i < fIndent; i++) {
+ fOut.print(' ');
+ }
+ }
//
// MAIN
@@ -465,65 +777,171 @@
/** Main. */
public static void main(String[] argv) throws Exception {
- // construct handler
- DefaultHandler handler = new DocumentTracer();
-
- // construct parser; set features
- XMLReader parser = new SAXParser();
- try {
- parser.setFeature("http://xml.org/sax/features/namespaces", true);
- }
- catch (SAXException e) {
- e.printStackTrace(System.err);
- }
- try {
- parser.setFeature("http://xml.org/sax/features/validation", true);
+ // is there anything to do?
+ if (argv.length == 0) {
+ printUsage();
+ System.exit(1);
}
- catch (SAXException e) {
- e.printStackTrace(System.err);
- }
- // set handlers
- parser.setContentHandler(handler);
- parser.setDTDHandler(handler);
- parser.setErrorHandler(handler);
- try {
- parser.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
- }
- catch (SAXException e) {
- e.printStackTrace(System.err);
- }
- try {
- parser.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
- }
- catch (SAXException e) {
- e.printStackTrace(System.err);
- }
-
- // parser files
+ // variables
+ DocumentTracer tracer = new DocumentTracer();
+ PrintWriter out = new PrintWriter(System.out);
+ XMLReader parser = null;
+ boolean namespaces = DEFAULT_NAMESPACES;
+ boolean validation = DEFAULT_VALIDATION;
+ boolean schemaValidation = DEFAULT_SCHEMA_VALIDATION;
+
+ // process arguments
for (int i = 0; i < argv.length; i++) {
String arg = argv[i];
- System.err.println("# argv["+i+"]: "+arg);
- //print(arg);
+ if (arg.startsWith("-")) {
+ String option = arg.substring(1);
+ if (option.equals("p")) {
+ // get parser name
+ if (++i == argv.length) {
+ System.err.println("error: Missing argument to -p option.");
+ }
+ String parserName = argv[i];
+
+ // create parser
+ try {
+ parser = XMLReaderFactory.createXMLReader(parserName);
+ }
+ catch (Exception e) {
+ try {
+ Parser sax1Parser = ParserFactory.makeParser(parserName);
+ parser = new ParserAdapter(sax1Parser);
+ System.err.println("warning: Features and properties not supported on SAX1 parsers.");
+ }
+ catch (Exception ex) {
+ parser = null;
+ System.err.println("error: Unable to instantiate parser ("+parserName+")");
+ }
+ }
+ continue;
+ }
+ if (option.equalsIgnoreCase("n")) {
+ namespaces = option.equals("n");
+ continue;
+ }
+ if (option.equalsIgnoreCase("v")) {
+ validation = option.equals("v");
+ continue;
+ }
+ if (option.equalsIgnoreCase("s")) {
+ schemaValidation = option.equals("s");
+ continue;
+ }
+ if (option.equals("h")) {
+ printUsage();
+ continue;
+ }
+ }
+
+ // use default parser?
+ if (parser == null) {
+
+ // create parser
+ try {
+ parser = XMLReaderFactory.createXMLReader(DEFAULT_PARSER_NAME);
+ }
+ catch (Exception e) {
+ System.err.println("error: Unable to instantiate parser ("+DEFAULT_PARSER_NAME+")");
+ continue;
+ }
+ }
+
+ // set parser features
try {
- parser.parse(arg);
+ parser.setFeature(NAMESPACES_FEATURE_ID, namespaces);
}
catch (SAXException e) {
- Exception ex = e.getException();
- throw ex != null ? ex : e;
+ System.err.println("warning: Parser does not support feature ("+NAMESPACES_FEATURE_ID+")");
}
+ try {
+ parser.setFeature(VALIDATION_FEATURE_ID, validation);
+ }
+ catch (SAXException e) {
+ System.err.println("warning: Parser does not support feature ("+VALIDATION_FEATURE_ID+")");
+ }
+ try {
+ parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, schemaValidation);
+ }
+ catch (SAXNotRecognizedException e) {
+ // ignore
+ }
+ catch (SAXNotSupportedException e) {
+ System.err.println("warning: Parser does not support feature ("+SCHEMA_VALIDATION_FEATURE_ID+")");
+ }
+
+ // set handlers
+ parser.setDTDHandler(tracer);
+ parser.setErrorHandler(tracer);
+ if (parser instanceof XMLReader) {
+ parser.setContentHandler(tracer);
+ try {
+ parser.setProperty("http://xml.org/sax/properties/declaration-handler", tracer);
+ }
+ catch (SAXException e) {
+ e.printStackTrace(System.err);
+ }
+ try {
+ parser.setProperty("http://xml.org/sax/properties/lexical-handler", tracer);
+ }
+ catch (SAXException e) {
+ e.printStackTrace(System.err);
+ }
+ }
+ else {
+ ((Parser)parser).setDocumentHandler(tracer);
+ }
+
+ // parse file
+ try {
+ parser.parse(arg);
+ }
+ catch (SAXParseException e) {
+ // ignore
+ }
+ catch (Exception e) {
+ System.err.println("error: Parse error occurred - "+e.getMessage());
+ if (e instanceof SAXException) {
+ e = ((SAXException)e).getException();
+ }
+ e.printStackTrace(System.err);
+ }
}
+
} // main(String[])
+
+ //
+ // Private static methods
+ //
+
+ /** Prints the usage. */
+ private static void printUsage() {
+
+ System.err.println("usage: java sax.DocumentTracer (options) uri ...");
+ System.err.println();
+
+ System.err.println("options:");
+ System.err.println(" -p name Select parser by name.");
+ System.err.println(" -n | -N Turn on/off namespace processing.");
+ System.err.println(" -v | -V Turn on/off validation.");
+ System.err.println(" -s | -S Turn on/off Schema validation support.");
+ System.err.println(" NOTE: Not supported by all parsers.");
+ System.err.println(" -h This help screen.");
+ System.err.println();
+
+ System.err.println("defaults:");
+ System.err.println(" Parser: "+DEFAULT_PARSER_NAME);
+ System.err.print(" Namespaces: ");
+ System.err.println(DEFAULT_NAMESPACES ? "on" : "off");
+ System.err.print(" Validation: ");
+ System.err.println(DEFAULT_VALIDATION ? "on" : "off");
+ System.err.print(" Schema: ");
+ System.err.println(DEFAULT_SCHEMA_VALIDATION ? "on" : "off");
- /** Prints the file. */
- private static void print(String filename) throws IOException {
- InputStream in = new FileInputStream(filename);
- int c = -1;
- while ((c = in.read()) != -1) {
- System.out.print((char)c);
- }
- System.out.println();
- in.close();
- } // print(String)
+ } // printUsage()
} // class DocumentTracer
1.2 +592 -0 xml-xerces/java/samples/sax/Counter.java
1.2 +616 -0 xml-xerces/java/samples/sax/Writer.java
1.3 +1 -1 xml-xerces/java/samples/sax/helpers/AttributesImpl.java
Index: AttributesImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/sax/helpers/AttributesImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AttributesImpl.java 2000/05/10 00:35:02 1.2
+++ AttributesImpl.java 2001/08/23 00:35:18 1.3
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +474 -0 xml-xerces/java/samples/socket/DelayedInput.java
1.2 +537 -0 xml-xerces/java/samples/socket/KeepSocketOpen.java
1.2 +209 -0 xml-xerces/java/samples/socket/io/WrappedInputStream.java
1.2 +219 -0 xml-xerces/java/samples/socket/io/WrappedOutputStream.java
1.3 +46 -48 xml-xerces/java/samples/ui/DOMParserSaveEncoding.java
Index: DOMParserSaveEncoding.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/ui/DOMParserSaveEncoding.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DOMParserSaveEncoding.java 2000/04/04 22:48:23 1.2
+++ DOMParserSaveEncoding.java 2001/08/23 00:35:18 1.3
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000,2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -60,53 +60,51 @@
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.apache.xerces.readers.MIME2Java;
+import org.apache.xerces.util.EncodingMap;
import org.apache.xerces.parsers.DOMParser;
+import org.apache.xerces.xni.XNIException;
- /**
- * The DOMParserSaveEncoding class extends DOMParser. It also provides
- * the Java Encoding of the XML document by overriding the startDocument method
- * and providing a way to capture the MIME encoding from the XML document which
- * in turn is converted to the Java Encoding by the internal MIME2Java class.
- *
- */
-
-
-public class DOMParserSaveEncoding extends DOMParser
- {
- String _mimeEncoding = "DEFAULT";//Default MIME so we check the file.encoding
- private void setMimeEncoding( String encoding ) {
- _mimeEncoding = encoding;
- }
- private String getMimeEncoding() {
- return (_mimeEncoding);
- }
- public String getJavaEncoding() {
- String javaEncoding = null;
- String mimeEncoding = getMimeEncoding();
-
- if( mimeEncoding != null )
- {
- if( mimeEncoding.equals( "DEFAULT" ) )
- javaEncoding = System.getProperty( "file.encoding" );
- else if( ( javaEncoding = MIME2Java.convert( mimeEncoding ) ) == null )
- javaEncoding = "UTF8"; // We always return an encoding.
- }
-
- if( javaEncoding == null ) // Should never return null
- javaEncoding = "UTF8";
-
- return (javaEncoding);
- }
- public void startDocument( int versionIndex, int encodingIndex, int standAloneIndex ) {
- String encoding = null;
- if ( encodingIndex != -1 ) {
- encoding = fStringPool.toString( encodingIndex );
- setMimeEncoding( encoding );
- }
- // super.startDocument( versionIndex, encodingIndex, standAloneIndex );//passes control to superclass
- super.startDocument();
- }
+/**
+ * The DOMParserSaveEncoding class extends DOMParser. It also provides
+ * the Java Encoding of the XML document by overriding the startDocument method
+ * and providing a way to capture the MIME encoding from the XML document which
+ * in turn is converted to the Java Encoding by the internal MIME2Java class.
+ *
+ */
+
+
+public class DOMParserSaveEncoding extends DOMParser {
+ String _mimeEncoding = "UTF8";//Default MIME so we check the file.encoding
+ private void setMimeEncoding( String encoding ) {
+ _mimeEncoding = encoding;
+ }
+ private String getMimeEncoding() {
+ return(_mimeEncoding);
+ }
+ public String getJavaEncoding() {
+ String javaEncoding = null;
+ String mimeEncoding = getMimeEncoding();
+
+ if (mimeEncoding != null) {
+ if (mimeEncoding.equals( "DEFAULT" ))
+ javaEncoding = "UTF8";
+ else if (mimeEncoding.equalsIgnoreCase( "UTF-16" ))
+ javaEncoding = "Unicode";
+ else
+ javaEncoding = EncodingMap.getIANA2JavaMapping( mimeEncoding );
+ } else // Should never return null
+ javaEncoding = "UTF8";
+ return(javaEncoding);
+ }
+ public void startEntity(String name,
+ String publicId, String systemId,
+ String baseSystemId,
+ String encoding) throws XNIException {
+ if( encoding != null){
+ setMimeEncoding( encoding);
+ }
+ super.startEntity(name, publicId, systemId, baseSystemId, encoding);
+ }
+
+}
- }
-
1.2 +1 -1 xml-xerces/java/samples/ui/DOMTree.java
Index: DOMTree.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/ui/DOMTree.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOMTree.java 1999/11/09 01:13:42 1.1
+++ DOMTree.java 2001/08/23 00:35:18 1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +1 -1 xml-xerces/java/samples/ui/DOMTreeFull.java
Index: DOMTreeFull.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/ui/DOMTreeFull.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOMTreeFull.java 1999/11/09 01:13:42 1.1
+++ DOMTreeFull.java 2001/08/23 00:35:18 1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +1 -1 xml-xerces/java/samples/ui/DefaultImages.java
Index: DefaultImages.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/ui/DefaultImages.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultImages.java 1999/11/09 01:13:40 1.1
+++ DefaultImages.java 2001/08/23 00:35:18 1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +1 -1 xml-xerces/java/samples/ui/TreeView.java
Index: TreeView.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/ui/TreeView.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TreeView.java 1999/11/09 01:13:43 1.1
+++ TreeView.java 2001/08/23 00:35:18 1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +1 -1 xml-xerces/java/samples/ui/TreeViewer.java
Index: TreeViewer.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/ui/TreeViewer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TreeViewer.java 1999/11/09 01:13:44 1.1
+++ TreeViewer.java 2001/08/23 00:35:18 1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +612 -0 xml-xerces/java/samples/xni/Counter.java
1.2 +1255 -0 xml-xerces/java/samples/xni/DocumentTracer.java
1.2 +413 -0 xml-xerces/java/samples/xni/PassThroughFilter.java
1.2 +157 -0 xml-xerces/java/samples/xni/UpperCaseFilter.java
1.2 +668 -0 xml-xerces/java/samples/xni/Writer.java
1.2 +428 -0 xml-xerces/java/samples/xni/parser/AbstractConfiguration.java
1.2 +268 -0 xml-xerces/java/samples/xni/parser/CSVConfiguration.java
1.2 +82 -0 xml-xerces/java/samples/xni/parser/CSVParser.java
1.2 +130 -0 xml-xerces/java/samples/xni/parser/NonValidatingParserConfiguration.java
1.2 +2 -10 xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java
Index: CoreDocumentImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CoreDocumentImpl.java 2001/08/10 01:18:16 1.1
+++ CoreDocumentImpl.java 2001/08/23 00:35:20 1.2
@@ -82,7 +82,7 @@
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.EventTarget;
-import org.apache.xerces.utils.XMLCharacterProperties;
+import org.apache.xerces.util.XMLChar;
/**
@@ -237,8 +237,6 @@
*/
public CoreDocumentImpl() {
this(false);
- // make sure the XMLCharacterProperties class is initilialized
- XMLCharacterProperties.initCharFlags();
}
/** Constructor. */
@@ -246,8 +244,6 @@
super(null);
ownerDocument = this;
allowGrammarAccess = grammarAccess;
- // make sure the XMLCharacterProperties class is initilialized
- XMLCharacterProperties.initCharFlags();
}
/**
@@ -257,8 +253,6 @@
public CoreDocumentImpl(DocumentType doctype)
{
this(doctype, false);
- // make sure the XMLCharacterProperties class is initilialized
- XMLCharacterProperties.initCharFlags();
}
/** For DOM2 support. */
@@ -275,8 +269,6 @@
doctypeImpl.ownerDocument = this;
appendChild(doctype);
}
- // make sure the XMLCharacterProperties class is initilialized
- XMLCharacterProperties.initCharFlags();
}
//
@@ -1411,7 +1403,7 @@
if (s == null) {
return false;
}
- return XMLCharacterProperties.validName(s);
+ return XMLChar.isValidName(s);
} // isXMLName(String):boolean
1.61 +0 -1 xml-xerces/java/src/org/apache/xerces/dom/DocumentImpl.java
Index: DocumentImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DocumentImpl.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- DocumentImpl.java 2001/08/21 15:21:39 1.60
+++ DocumentImpl.java 2001/08/23 00:35:20 1.61
@@ -87,7 +87,6 @@
import org.apache.xerces.dom.events.EventImpl;
import org.apache.xerces.dom.events.MutationEventImpl;
-import org.apache.xerces.utils.XMLCharacterProperties;
/**
1.2 +406 -0 xml-xerces/java/src/org/apache/xerces/impl/Constants.java
1.2 +86 -0 xml-xerces/java/src/org/apache/xerces/impl/Version.java
1.2 +1858 -0 xml-xerces/java/src/org/apache/xerces/impl/XMLDTDScannerImpl.java
1.2 +2699 -0 xml-xerces/java/src/org/apache/xerces/impl/XMLDTDValidator.java
1.2 +2085 -0 xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentScannerImpl.java
1.2 +115 -0 xml-xerces/java/src/org/apache/xerces/impl/XMLEntityHandler.java
1.2 +3072 -0 xml-xerces/java/src/org/apache/xerces/impl/XMLEntityManager.java
1.2 +340 -0 xml-xerces/java/src/org/apache/xerces/impl/XMLEntityScanner.java
1.2 +497 -0 xml-xerces/java/src/org/apache/xerces/impl/XMLErrorReporter.java
1.2 +737 -0 xml-xerces/java/src/org/apache/xerces/impl/XMLNamespaceBinder.java
1.2 +1415 -0 xml-xerces/java/src/org/apache/xerces/impl/XMLScanner.java
1.2 +251 -0 xml-xerces/java/src/org/apache/xerces/impl/io/ASCIIReader.java
1.2 +694 -0 xml-xerces/java/src/org/apache/xerces/impl/io/UTF8Reader.java
1.2 +97 -0 xml-xerces/java/src/org/apache/xerces/impl/msg/DatatypeMessages.java
1.2 +174 -0 xml-xerces/java/src/org/apache/xerces/impl/msg/ExceptionMessages.java
1.2 +111 -0 xml-xerces/java/src/org/apache/xerces/impl/msg/ExceptionMessagesLocalizer.java
1.2 +100 -0 xml-xerces/java/src/org/apache/xerces/impl/msg/ImplementationMessages.java
1.2 +103 -0 xml-xerces/java/src/org/apache/xerces/impl/msg/SchemaMessages.java
1.2 +136 -0 xml-xerces/java/src/org/apache/xerces/impl/msg/XMLMessageFormatter.java
1.2 +259 -0 xml-xerces/java/src/org/apache/xerces/impl/msg/XMLMessages.properties
1.2 +556 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/AllContentModel.java
1.2 +189 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/CMAny.java
1.2 +186 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/CMBinOp.java
1.2 +97 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/CMException.java
1.2 +182 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/CMLeaf.java
1.2 +163 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/CMNode.java
1.2 +332 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/CMStateSet.java
1.2 +138 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/CMUniOp.java
1.2 +105 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/ContentLeafNameTypeVector.java
1.2 +1517 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/DFAContentModel.java
1.2 +253 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/ElementWildcard.java
1.2 +1159 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/Grammar.java
1.2 +149 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/GrammarResolver.java
1.2 +305 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/GrammarResolverImpl.java
1.2 +172 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/InsertableElementsInfo.java
1.2 +433 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/MixedContentModel.java
1.2 +772 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/SimpleContentModel.java
1.2 +608 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/StandardParserConfiguration.java
1.2 +192 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/XMLAttributeDecl.java
1.2 +182 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/XMLContentModel.java
1.2 +687 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/XMLContentSpec.java
1.2 +163 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/XMLElementDecl.java
1.2 +5593 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/XMLValidator.java
1.2 +133 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/AbstractDatatypeValidator.java
1.2 +469 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/AbstractNumericFacetValidator.java
1.2 +198 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/AbstractNumericValidator.java
1.2 +425 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/AbstractStringValidator.java
1.2 +118 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/AnyURIDatatypeValidator.java
1.2 +133 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/Base64BinaryDatatypeValidator.java
1.2 +200 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/BooleanDatatypeValidator.java
1.2 +225 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DatatypeMessageProvider.java
1.2 +132 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DatatypeValidator.java
1.2 +71 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DatatypeValidatorFactory.java
1.2 +467 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DatatypeValidatorFactoryImpl.java
1.2 +118 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DateDatatypeValidator.java
1.2 +116 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DateTimeDatatypeValidator.java
1.2 +1006 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DateTimeValidator.java
1.2 +150 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DayDatatypeValidator.java
1.2 +373 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DecimalDatatypeValidator.java
1.2 +297 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DoubleDatatypeValidator.java
1.2 +379 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/DurationDatatypeValidator.java
1.2 +242 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/ENTITYDatatypeValidator.java
1.2 +280 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/FloatDatatypeValidator.java
1.2 +154 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/HexBinaryDatatypeValidator.java
1.2 +204 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/IDDatatypeValidator.java
1.2 +218 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/IDREFDatatypeValidator.java
1.2 +95 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/InvalidDatatypeFacetException.java
1.2 +92 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/InvalidDatatypeValueException.java
1.2 +423 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/ListDatatypeValidator.java
1.2 +185 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/MonthDatatypeValidator.java
1.2 +155 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/MonthDayDatatypeValidator.java
1.2 +132 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/NOTATIONDatatypeValidator.java
1.2 +132 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/QNameDatatypeValidator.java
1.2 +69 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/SchemaDateTimeException.java
1.2 +65 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/StateMessageDatatype.java
1.2 +203 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/StringDatatypeValidator.java
1.2 +143 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/TimeDatatypeValidator.java
1.2 +324 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/UnionDatatypeValidator.java
1.2 +80 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/XMLException.java
1.2 +144 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/YearDatatypeValidator.java
1.2 +117 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/datatype/YearMonthDatatypeValidator.java
1.2 +651 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/dtd/DTDGrammar.java
1.2 +106 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/msg/DatatypeMessages.java
1.2 +174 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/msg/ExceptionMessages.java
1.2 +111 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/msg/ExceptionMessagesLocalizer.java
1.2 +184 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/msg/Implementation.java
1.2 +100 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/msg/ImplementationMessages.java
1.2 +130 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/msg/SchemaMessages.java
1.2 +1267 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/msg/XML.java
1.2 +91 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/msg/XMLMessageProvider.java
1.2 +288 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/msg/XMLMessages.java
1.2 +1273 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/GeneralAttrCheck.java
1.2 +1140 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/SchemaGrammar.java
1.2 +259 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/SchemaMessageProvider.java
1.2 +219 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/SchemaSymbols.java
1.2 +298 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/SubstitutionGroupComparator.java
1.2 +8742 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/TraverseSchema.java
1.2 +603 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/XUtil.java
1.2 +158 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/datatypes.dtd
1.2 +328 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/structures.dtd
1.2 +40 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/versionInfo.ent
1.2 +225 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/Field.java
1.2 +105 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/FieldActivator.java
1.2 +131 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/IDValue.java
1.2 +197 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/IdentityConstraint.java
1.2 +87 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/Key.java
1.2 +101 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/KeyRef.java
1.2 +252 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/Selector.java
1.2 +87 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/Unique.java
1.2 +102 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/ValueStore.java
1.2 +3705 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/XPath.java
1.2 +84 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/XPathException.java
1.2 +653 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/schema/identity/XPathMatcher.java
1.2 +408 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/Base64.java
1.2 +193 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/Hash2intTable.java
1.2 +171 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/HexBin.java
1.2 +151 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/IntStack.java
1.2 +272 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/BMPattern.java
1.2 +222 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/Match.java
1.2 +289 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/Op.java
1.2 +87 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/ParseException.java
1.2 +504 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/ParserForXMLSchema.java
1.2 +365 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/REUtil.java
1.2 +651 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/RangeToken.java
1.2 +1272 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/RegexParser.java
1.2 +3191 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/RegularExpression.java
1.2 +1502 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/Token.java
1.2 +32 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/message.properties
1.2 +32 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/message_fr.properties
1.2 +32 -0 xml-xerces/java/src/org/apache/xerces/impl/v1/util/regex/message_ja.properties
1.2 +83 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/ContentModelValidator.java
1.2 +122 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/DatatypeValidator.java
1.2 +85 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/DatatypeValidatorFactory.java
1.2 +1825 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/Grammar.java
1.2 +183 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/GrammarPool.java
1.2 +108 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/InvalidDatatypeFacetException.java
1.2 +139 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/InvalidDatatypeValueException.java
1.2 +107 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/XMLAttributeDecl.java
1.2 +330 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/XMLContentSpec.java
1.2 +138 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/XMLElementDecl.java
1.2 +132 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/XMLEntityDecl.java
1.2 +105 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/XMLNotationDecl.java
1.2 +201 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/XMLSimpleType.java
1.2 +139 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/AbstractDatatypeValidator.java
1.2 +201 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/DatatypeMessageProvider.java
1.2 +588 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/DatatypeValidatorFactoryImpl.java
1.2 +221 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/ENTITYDatatypeValidator.java
1.2 +290 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/IDDatatypeValidator.java
1.2 +313 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/IDREFDatatypeValidator.java
1.2 +343 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/ListDatatypeValidator.java
1.2 +111 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/NMTOKENDatatypeValidator.java
1.2 +157 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/NOTATIONDatatypeValidator.java
1.2 +91 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/StatefullDatatypeValidator.java
1.2 +406 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/StringDatatypeValidator.java
1.2 +1154 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/grammars/DTDGrammar.java
1.2 +190 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/models/CMAny.java
1.2 +188 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/models/CMBinOp.java
1.2 +183 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/models/CMLeaf.java
1.2 +166 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/models/CMNode.java
1.2 +331 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/models/CMStateSet.java
1.2 +140 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/models/CMUniOp.java
1.2 +1062 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/models/DFAContentModel.java
1.2 +286 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/models/MixedContentModel.java
1.2 +372 -0 xml-xerces/java/src/org/apache/xerces/impl/validation/models/SimpleContentModel.java
1.52 +259 -3061 xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java
Index: DOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- DOMParser.java 2001/07/09 19:29:09 1.51
+++ DOMParser.java 2001/08/23 00:35:31 1.52
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000,2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
@@ -57,499 +57,274 @@
package org.apache.xerces.parsers;
+import java.io.InputStream;
import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-
-import org.apache.xerces.dom.TextImpl;
-import org.apache.xerces.framework.XMLAttrList;
-import org.apache.xerces.framework.XMLContentSpec;
-import org.apache.xerces.framework.XMLDocumentHandler;
-import org.apache.xerces.framework.XMLParser;
-import org.apache.xerces.readers.XMLEntityHandler;
-import org.apache.xerces.utils.QName;
-import org.apache.xerces.utils.StringPool;
-import org.apache.xerces.validators.common.XMLAttributeDecl;
-import org.apache.xerces.validators.common.XMLElementDecl;
-import org.apache.xerces.validators.schema.XUtil;
-import org.apache.xerces.validators.schema.SchemaSymbols;
-
-import org.apache.xerces.dom.DeferredDocumentImpl;
-import org.apache.xerces.dom.DocumentImpl;
-import org.apache.xerces.dom.DocumentTypeImpl;
-import org.apache.xerces.dom.NodeImpl;
-import org.apache.xerces.dom.EntityImpl;
-import org.apache.xerces.dom.NotationImpl;
-import org.apache.xerces.dom.ElementDefinitionImpl;
-import org.apache.xerces.dom.AttrImpl;
-import org.apache.xerces.dom.TextImpl;
-import org.apache.xerces.dom.ElementImpl;
-import org.apache.xerces.dom.EntityImpl;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.Entity;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
+import java.io.Reader;
+import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.util.EntityResolverWrapper;
+import org.apache.xerces.util.ErrorHandlerWrapper;
+import org.apache.xerces.util.SymbolTable;
+import org.apache.xerces.xni.XNIException;
+import org.apache.xerces.xni.parser.XMLConfigurationException;
+import org.apache.xerces.xni.parser.XMLEntityResolver;
+import org.apache.xerces.xni.parser.XMLErrorHandler;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.apache.xerces.xni.parser.XMLParserConfiguration;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
/**
- * DOMParser provides a parser which produces a W3C DOM tree as its output
+ * This is the main Xerces DOM parser class. It uses the abstract DOM
+ * parser with a document scanner, a dtd scanner, and a validator, as
+ * well as a grammar pool.
*
+ * @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
+ * @author Arnaud Le Hors, IBM
+ * @author Andy Clark, IBM
*
- * @version $Id: DOMParser.java,v 1.51 2001/07/09 19:29:09 sandygao Exp $
+ * @version $Id: DOMParser.java,v 1.52 2001/08/23 00:35:31 lehors Exp $
*/
public class DOMParser
- extends XMLParser
- implements XMLDocumentHandler
- {
+ extends AbstractDOMParser {
//
- // Constants
- //
-
- // public
-
- /** Default programmatic document class name (org.apache.xerces.dom.DocumentImpl). */
- public static final String DEFAULT_DOCUMENT_CLASS_NAME = "org.apache.xerces.dom.DocumentImpl";
-
- /** Default deferred document class name (org.apache.xerces.dom.DeferredDocumentImpl). */
- public static final String DEFAULT_DEFERRED_DOCUMENT_CLASS_NAME = "org.apache.xerces.dom.DeferredDocumentImpl";
-
- // debugging
-
- /** Set to true to debug attribute list declaration calls. */
- private static final boolean DEBUG_ATTLIST_DECL = false;
-
- // features and properties
-
- /** Features recognized by this parser. */
- private static final String RECOGNIZED_FEATURES[] = {
- // SAX2 core features
- // Xerces features
- "http://apache.org/xml/features/dom/defer-node-expansion",
- "http://apache.org/xml/features/dom/create-entity-ref-nodes",
- "http://apache.org/xml/features/dom/include-ignorable-whitespace",
- // Experimental features
- "http://apache.org/xml/features/domx/grammar-access",
- };
-
- /** Properties recognized by this parser. */
- private static final String RECOGNIZED_PROPERTIES[] = {
- // SAX2 core properties
- // Xerces properties
- "http://apache.org/xml/properties/dom/document-class-name",
- "http://apache.org/xml/properties/dom/current-element-node",
- };
-
- //
- // Data
- //
-
- // common data
-
- protected Document fDocument;
-
- // deferred expansion data
-
- protected DeferredDocumentImpl fDeferredDocumentImpl;
- protected int fDocumentIndex;
- protected int fDocumentTypeIndex;
- protected int fCurrentNodeIndex;
-
- //DOM Level 3 WD - experimental
-
- protected int fCurrentEntityName; //name of current entity reference
- protected int fCurrentEntityNode; //index of entity node corresponding to current entity reference
-
- // full expansion data
-
- protected DocumentImpl fDocumentImpl;
- protected DocumentType fDocumentType;
- protected Node fCurrentElementNode;
-
- // state
-
- protected boolean fInDTD;
- protected boolean fWithinElement;
- protected boolean fInCDATA;
-
- // features
- private boolean fGrammarAccess;
-
- // properties
-
- // REVISIT: Even though these have setters and getters, should they
- // be protected visibility? -Ac
- private String fDocumentClassName;
- private boolean fDeferNodeExpansion;
- private boolean fCreateEntityReferenceNodes;
- private boolean fIncludeIgnorableWhitespace;
-
- // built-in entities
-
- protected int fAmpIndex;
- protected int fLtIndex;
- protected int fGtIndex;
- protected int fAposIndex;
- protected int fQuotIndex;
-
- private boolean fSeenRootElement;
-
- private boolean fStringPoolInUse;
-
- private XMLAttrList fAttrList;
-
- //
// Constructors
//
- /** Default constructor. */
+ /**
+ * Constructs a DOM parser using the default basic parser configuration.
+ */
public DOMParser() {
+ super(new StandardParserConfiguration());
+ } // <init>
- initHandlers(false, this, this);
-
- // setup parser state
- init();
+ /**
+ * Constructs a DOM parser using the specified parser configuration.
+ */
+ public DOMParser(XMLParserConfiguration config) {
+ super(config);
+ } // <init>(XMLParserConfiguration)
- // set default values
- try {
- setDocumentClassName(DEFAULT_DOCUMENT_CLASS_NAME);
- setCreateEntityReferenceNodes(true);
- setDeferNodeExpansion(true);
- setIncludeIgnorableWhitespace(true);
- } catch (SAXException e) {
- throw new RuntimeException("PAR001 Fatal error constructing DOMParser.");
- }
+ /**
+ * Constructs a DOM parser using the specified symbol table.
+ */
+ public DOMParser(SymbolTable symbolTable) {
+ super(new StandardParserConfiguration(symbolTable));
+ } // <init>(SymbolTable)
- } // <init>()
+ /**
+ * Constructs a DOM parser using the specified symbol table and
+ * grammar pool.
+ */
+ public DOMParser(SymbolTable symbolTable, GrammarPool grammarPool) {
+ super(new StandardParserConfiguration(symbolTable, grammarPool));
+ }
//
- // Public methods
+ // XMLReader methods
//
- // document
-
- /** Returns the document. */
- public Document getDocument() {
- return fDocument;
- }
-
- // features and properties
-
/**
- * Returns a list of features that this parser recognizes.
- * This method will never return null; if no features are
- * recognized, this method will return a zero length array.
+ * Parses the input source specified by the given system identifier.
+ * <p>
+ * This method is equivalent to the following:
+ * <pre>
+ * parse(new InputSource(systemId));
+ * </pre>
+ *
+ * @param source The input source.
*
- * @see #isFeatureRecognized
- * @see #setFeature
- * @see #getFeature
+ * @exception org.xml.sax.SAXException Throws exception on SAX error.
+ * @exception java.io.IOException Throws exception on i/o error.
*/
- public String[] getFeaturesRecognized() {
+ public void parse(String systemId) throws SAXException, IOException {
- // get features that super/this recognizes
- String superRecognized[] = super.getFeaturesRecognized();
- String thisRecognized[] = RECOGNIZED_FEATURES;
-
- // is one or the other the empty set?
- int thisLength = thisRecognized.length;
- if (thisLength == 0) {
- return superRecognized;
+ // parse document
+ XMLInputSource source = new XMLInputSource(null, systemId, null);
+ try {
+ parse(source);
}
- int superLength = superRecognized.length;
- if (superLength == 0) {
- return thisRecognized;
+
+ // wrap XNI exceptions as SAX exceptions
+ catch (XNIException e) {
+ Exception ex = e.getException();
+ if (ex == null) {
+ throw new SAXException(e.getMessage());
+ }
+ if (ex instanceof SAXException) {
+ throw (SAXException)ex;
+ }
+ if (ex instanceof IOException) {
+ throw (IOException)ex;
+ }
+ throw new SAXException(ex);
}
- // combine the two lists and return
- String recognized[] = new String[superLength + thisLength];
- System.arraycopy(superRecognized, 0, recognized, 0, superLength);
- System.arraycopy(thisRecognized, 0, recognized, superLength, thisLength);
- return recognized;
+ // close stream opened by the parser
+ finally {
+ try {
+ Reader reader = source.getCharacterStream();
+ if (reader != null) {
+ reader.close();
+ }
+ else {
+ InputStream is = source.getByteStream();
+ if (is != null) {
+ is.close();
+ }
+ }
+ }
+ catch (IOException e) {
+ // ignore
+ }
+ }
- } // getFeaturesRecognized():String[]
+ } // parse(String)
/**
- * Returns a list of properties that this parser recognizes.
- * This method will never return null; if no properties are
- * recognized, this method will return a zero length array.
+ * parse
*
- * @see #isPropertyRecognized
- * @see #setProperty
- * @see #getProperty
+ * @param inputSource
+ *
+ * @exception org.xml.sax.SAXException
+ * @exception java.io.IOException
*/
- public String[] getPropertiesRecognized() {
-
- // get properties that super/this recognizes
- String superRecognized[] = super.getPropertiesRecognized();
- String thisRecognized[] = RECOGNIZED_PROPERTIES;
-
- // is one or the other the empty set?
- int thisLength = thisRecognized.length;
- if (thisLength == 0) {
- return superRecognized;
- }
- int superLength = superRecognized.length;
- if (superLength == 0) {
- return thisRecognized;
- }
-
- // combine the two lists and return
- String recognized[] = new String[superLength + thisLength];
- System.arraycopy(superRecognized, 0, recognized, 0, superLength);
- System.arraycopy(thisRecognized, 0, recognized, superLength, thisLength);
- return recognized;
-
- }
+ public void parse(InputSource inputSource)
+ throws SAXException, IOException {
- // resetting
-
- /** Resets the parser. */
- public void reset() throws Exception {
- if (fStringPoolInUse) {
- // we can't reuse the string pool, let's create another one
- fStringPool = new StringPool();
- fStringPoolInUse = false;
+ // parse document
+ try {
+ XMLInputSource xmlInputSource =
+ new XMLInputSource(inputSource.getPublicId(),
+ inputSource.getSystemId(),
+ null);
+ xmlInputSource.setByteStream(inputSource.getByteStream());
+ xmlInputSource.setCharacterStream(inputSource.getCharacterStream());
+ xmlInputSource.setEncoding(inputSource.getEncoding());
+ parse(xmlInputSource);
}
- super.reset();
- init();
- }
-
- /** Resets or copies the parser. */
- public void resetOrCopy() throws Exception {
- super.resetOrCopy();
- init();
- }
-
- //
- // Protected methods
- //
-
- // initialization
-
- /**
- * Initializes the parser to a pre-parse state. This method is
- * called between calls to <code>parse()</code>.
- */
- protected void init() {
-
- // init common
- fDocument = null;
-
- // init deferred expansion
- fDeferredDocumentImpl = null;
- fDocumentIndex = -1;
- fDocumentTypeIndex = -1;
- fCurrentNodeIndex = -1;
-
- //DOM Level 3 WD - experimental
- fCurrentEntityNode = -1;
- fCurrentEntityName = -1;
-
- // init full expansion
- fDocumentImpl = null;
- fDocumentType = null;
- fCurrentElementNode = null;
-
- // state
- fInDTD = false;
- fWithinElement = false;
- fInCDATA = false;
-
- // built-in entities
- fAmpIndex = fStringPool.addSymbol("amp");
- fLtIndex = fStringPool.addSymbol("lt");
- fGtIndex = fStringPool.addSymbol("gt");
- fAposIndex = fStringPool.addSymbol("apos");
- fQuotIndex = fStringPool.addSymbol("quot");
-
- fSeenRootElement = false;
- fStringPoolInUse = false;
-
- fAttrList = new XMLAttrList(fStringPool);
- } // init()
-
- // features
+ // wrap XNI exceptions as SAX exceptions
+ catch (XNIException e) {
+ Exception ex = e.getException();
+ if (ex == null) {
+ throw new SAXException(e.getMessage());
+ }
+ if (ex instanceof SAXException) {
+ throw (SAXException)ex;
+ }
+ if (ex instanceof IOException) {
+ throw (IOException)ex;
+ }
+ throw new SAXException(ex);
+ }
- /**
- * This method sets whether the expansion of the nodes in the default
- * DOM implementation are deferred.
- *
- * @see #getDeferNodeExpansion
- * @see #setDocumentClassName
- */
- protected void setDeferNodeExpansion(boolean deferNodeExpansion)
- throws SAXNotRecognizedException, SAXNotSupportedException {
- fDeferNodeExpansion = deferNodeExpansion;
- }
+ } // parse(InputSource)
/**
- * Returns true if the expansion of the nodes in the default DOM
- * implementation are deferred.
+ * Sets the resolver used to resolve external entities. The EntityResolver
+ * interface supports resolution of public and system identifiers.
*
- * @see #setDeferNodeExpansion
+ * @param resolver The new entity resolver. Passing a null value will
+ * uninstall the currently installed resolver.
*/
- protected boolean getDeferNodeExpansion()
- throws SAXNotRecognizedException, SAXNotSupportedException {
- return fDeferNodeExpansion;
- }
+ public void setEntityResolver(EntityResolver resolver) {
- /**
- * This feature determines whether entity references within
- * the document are included in the document tree as
- * EntityReference nodes.
- * <p>
- * Note: The children of the entity reference are always
- * added to the document. This feature only affects
- * whether an EntityReference node is also included
- * as the parent of the entity reference children.
- *
- * @param create True to create entity reference nodes; false
- * to only insert the entity reference children.
- *
- * @see #getCreateEntityReferenceNodes
- */
- protected void setCreateEntityReferenceNodes(boolean create)
- throws SAXNotRecognizedException, SAXNotSupportedException {
- fCreateEntityReferenceNodes = create;
- }
+ try {
+ fConfiguration.setProperty(ENTITY_RESOLVER,
+ new EntityResolverWrapper(resolver));
+ }
+ catch (XMLConfigurationException e) {
+ // do nothing
+ }
- /**
- * Returns true if entity references within the document are
- * included in the document tree as EntityReference nodes.
- *
- * @see #setCreateEntityReferenceNodes
- */
- public boolean getCreateEntityReferenceNodes()
- throws SAXNotRecognizedException, SAXNotSupportedException {
- return fCreateEntityReferenceNodes;
- }
+ } // setEntityResolver(EntityResolver)
/**
- * This feature determines whether text nodes that can be
- * considered "ignorable whitespace" are included in the DOM
- * tree.
- * <p>
- * Note: The only way that the parser can determine if text
- * is ignorable is by reading the associated grammar
- * and having a content model for the document. When
- * ignorable whitespace text nodes *are* included in
- * the DOM tree, they will be flagged as ignorable.
- * The ignorable flag can be queried by calling the
- * TextImpl#isIgnorableWhitespace():boolean method.
+ * Return the current entity resolver.
*
- * @param include True to include ignorable whitespace text nodes;
- * false to not include ignorable whitespace text
- * nodes.
- *
- * @see #getIncludeIgnorableWhitespace
+ * @return The current entity resolver, or null if none
+ * has been registered.
+ * @see #setEntityResolver
*/
- public void setIncludeIgnorableWhitespace(boolean include)
- throws SAXNotRecognizedException, SAXNotSupportedException {
- fIncludeIgnorableWhitespace = include;
- }
+ public EntityResolver getEntityResolver() {
- /**
- * Returns true if ignorable whitespace text nodes are included
- * in the DOM tree.
- *
- * @see #setIncludeIgnorableWhitespace
- */
- public boolean getIncludeIgnorableWhitespace()
- throws SAXNotRecognizedException, SAXNotSupportedException {
- return fIncludeIgnorableWhitespace;
- }
+ EntityResolver entityResolver = null;
+ try {
+ XMLEntityResolver xmlEntityResolver =
+ (XMLEntityResolver)fConfiguration.getProperty(ENTITY_RESOLVER);
+ if (xmlEntityResolver != null &&
+ xmlEntityResolver instanceof EntityResolverWrapper) {
+ entityResolver = ((EntityResolverWrapper)xmlEntityResolver).getEntityResolver();
+ }
+ }
+ catch (XMLConfigurationException e) {
+ // do nothing
+ }
+ return entityResolver;
- // properties
+ } // getEntityResolver():EntityResolver
/**
- * This method allows the programmer to decide which document
- * factory to use when constructing the DOM tree. However, doing
- * so will lose the functionality of the default factory. Also,
- * a document class other than the default will lose the ability
- * to defer node expansion on the DOM tree produced.
+ * Allow an application to register an error event handler.
*
- * @param documentClassName The fully qualified class name of the
- * document factory to use when constructing
- * the DOM tree.
+ * <p>If the application does not register an error handler, all
+ * error events reported by the SAX parser will be silently
+ * ignored; however, normal processing may not continue. It is
+ * highly recommended that all SAX applications implement an
+ * error handler to avoid unexpected bugs.</p>
*
- * @see #getDocumentClassName
- * @see #setDeferNodeExpansion
- * @see #DEFAULT_DOCUMENT_CLASS_NAME
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param errorHandler The error handler.
+ * @exception java.lang.NullPointerException If the handler
+ * argument is null.
+ * @see #getErrorHandler
*/
- protected void setDocumentClassName(String documentClassName)
- throws SAXNotRecognizedException, SAXNotSupportedException {
-
- // normalize class name
- if (documentClassName == null) {
- documentClassName = DEFAULT_DOCUMENT_CLASS_NAME;
- }
+ public void setErrorHandler(ErrorHandler errorHandler) {
- // verify that this class exists and is of the right type
try {
- Class _class = Class.forName(documentClassName);
- //if (!_class.isAssignableFrom(Document.class)) {
- if (!Document.class.isAssignableFrom(_class)) {
- throw new IllegalArgumentException("PAR002 Class, \""+documentClassName+"\", is not of type org.w3c.dom.Document."+"\n"+documentClassName);
- }
- }
- catch (ClassNotFoundException e) {
- throw new IllegalArgumentException("PAR003 Class, \""+documentClassName+"\", not found."+"\n"+documentClassName);
+ fConfiguration.setProperty(ERROR_HANDLER,
+ new ErrorHandlerWrapper(errorHandler));
}
-
- // set document class name
- fDocumentClassName = documentClassName;
- if (!documentClassName.equals(DEFAULT_DOCUMENT_CLASS_NAME)) {
- setDeferNodeExpansion(false);
+ catch (XMLConfigurationException e) {
+ // do nothing
}
- } // setDocumentClassName(String)
+ } // setErrorHandler(ErrorHandler)
/**
- * Returns the fully qualified class name of the document factory
- * used when constructing the DOM tree.
+ * Return the current error handler.
*
- * @see #setDocumentClassName
- */
- protected String getDocumentClassName()
- throws SAXNotRecognizedException, SAXNotSupportedException {
- return fDocumentClassName;
- }
-
- /**
- * Returns the current element node.
- * <p>
- * Note: This method is not supported when the "deferNodeExpansion"
- * property is set to true and the document factory is set to
- * the default factory.
+ * @return The current error handler, or null if none
+ * has been registered.
+ * @see #setErrorHandler
*/
- protected Element getCurrentElementNode()
- throws SAXNotRecognizedException, SAXNotSupportedException {
+ public ErrorHandler getErrorHandler() {
- if (fCurrentElementNode != null &&
- fCurrentElementNode.getNodeType() == Node.ELEMENT_NODE) {
- return (Element)fCurrentElementNode;
+ ErrorHandler errorHandler = null;
+ try {
+ XMLErrorHandler xmlErrorHandler =
+ (XMLErrorHandler)fConfiguration.getProperty(ERROR_HANDLER);
+ if (xmlErrorHandler != null &&
+ xmlErrorHandler instanceof ErrorHandlerWrapper) {
+ errorHandler = ((ErrorHandlerWrapper)xmlErrorHandler).getErrorHandler();
+ }
}
- return null;
-
- } // getCurrentElementNode():Element
+ catch (XMLConfigurationException e) {
+ // do nothing
+ }
+ return errorHandler;
- //
- // Configurable methods
- //
+ } // getErrorHandler():ErrorHandler
/**
* Set the state of any feature in a SAX2 parser. The parser
@@ -559,209 +334,60 @@
* @param featureId The unique identifier (URI) of the feature.
* @param state The requested state of the feature (true or false).
*
- * @exception SAXNotRecognizedException If the requested feature is
- * not known.
- * @exception SAXNotSupportedException If the requested feature is
- * known, but the requested state
- * is not supported.
+ * @exception SAXNotRecognizedException If the
+ * requested feature is not known.
+ * @exception SAXNotSupportedException If the
+ * requested feature is known, but the requested
+ * state is not supported.
*/
public void setFeature(String featureId, boolean state)
throws SAXNotRecognizedException, SAXNotSupportedException {
-
- //
- // SAX2 core features
- //
-
- if (featureId.startsWith(SAX2_FEATURES_PREFIX)) {
- //
- // No additional SAX properties defined for DOMParser.
- // Pass request off to XMLParser for the common cases.
- //
- }
-
- //
- // Xerces features
- //
-
- else if (featureId.startsWith(XERCES_FEATURES_PREFIX)) {
- String feature = featureId.substring(XERCES_FEATURES_PREFIX.length());
- //
- // http://apache.org/xml/features/dom/defer-node-expansion
- // Allows the document tree returned by getDocument()
- // to be constructed lazily. In other words, the DOM
- // nodes are constructed as the tree is traversed.
- // This allows the document to be returned sooner with
- // the expense of holding all of the blocks of character
- // data held in memory. Then again, lots of DOM nodes
- // use a lot of memory as well.
- //
- if (feature.equals("dom/defer-node-expansion")) {
- if (fParseInProgress) {
- throw new SAXNotSupportedException("PAR004 Cannot setFeature("+featureId + "): parse is in progress."+"\n"+featureId);
- }
- setDeferNodeExpansion(state);
- return;
- }
- //
- // http://apache.org/xml/features/dom/create-entity-ref-nodes
- // This feature determines whether entity references within
- // the document are included in the document tree as
- // EntityReference nodes.
- // Note: The children of the entity reference are always
- // added to the document. This feature only affects
- // whether an EntityReference node is also included
- // as the parent of the entity reference children.
- //
- if (feature.equals("dom/create-entity-ref-nodes")) {
- setCreateEntityReferenceNodes(state);
- return;
- }
- //
- // http://apache.org/xml/features/dom/include-ignorable-whitespace
- // This feature determines whether text nodes that can be
- // considered "ignorable whitespace" are included in the DOM
- // tree.
- // Note: The only way that the parser can determine if text
- // is ignorable is by reading the associated grammar
- // and having a content model for the document. When
- // ignorable whitespace text nodes *are* included in
- // the DOM tree, they will be flagged as ignorable.
- // The ignorable flag can be queried by calling the
- // TextImpl#isIgnorableWhitespace():boolean method.
- //
- if (feature.equals("dom/include-ignorable-whitespace")) {
- setIncludeIgnorableWhitespace(state);
- return;
+ try {
+ fConfiguration.setFeature(featureId, state);
+ }
+ catch (XMLConfigurationException e) {
+ String message = e.getMessage();
+ if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
+ throw new SAXNotRecognizedException(message);
}
-
- //
- // Experimental features
- //
-
- //
- // http://apache.org/xml/features/domx/grammar-access
- // Allows grammar access in the DOM tree. Currently, this
- // means that there is an XML Schema document tree as a
- // child of the Doctype node.
- //
- if (feature.equals("domx/grammar-access")) {
- fGrammarAccess = state;
- return;
+ else {
+ throw new SAXNotSupportedException(message);
}
-
- //
- // Pass request off to XMLParser for the common cases.
- //
}
- //
- // Pass request off to XMLParser for the common cases.
- //
- super.setFeature(featureId, state);
-
} // setFeature(String,boolean)
/**
+ * Query the state of a feature.
+ *
* Query the current state of any feature in a SAX2 parser. The
* parser might not recognize the feature.
*
* @param featureId The unique identifier (URI) of the feature
* being set.
- *
* @return The current state of the feature.
- *
- * @exception SAXNotRecognizedException If the requested feature is
- * not known.
+ * @exception org.xml.sax.SAXNotRecognizedException If the
+ * requested feature is not known.
+ * @exception SAXNotSupportedException If the
+ * requested feature is known but not supported.
*/
public boolean getFeature(String featureId)
throws SAXNotRecognizedException, SAXNotSupportedException {
-
- //
- // SAX2 core features
- //
-
- if (featureId.startsWith(SAX2_FEATURES_PREFIX)) {
- //
- // No additional SAX properties defined for DOMParser.
- // Pass request off to XMLParser for the common cases.
- //
- }
-
- //
- // Xerces features
- //
-
- else if (featureId.startsWith(XERCES_FEATURES_PREFIX)) {
- String feature = featureId.substring(XERCES_FEATURES_PREFIX.length());
- //
- // http://apache.org/xml/features/dom/defer-node-expansion
- // Allows the document tree returned by getDocument()
- // to be constructed lazily. In other words, the DOM
- // nodes are constructed as the tree is traversed.
- // This allows the document to be returned sooner with
- // the expense of holding all of the blocks of character
- // data held in memory. Then again, lots of DOM nodes
- // use a lot of memory as well.
- //
- if (feature.equals("dom/defer-node-expansion")) {
- return getDeferNodeExpansion();
- }
- //
- // http://apache.org/xml/features/dom/create-entity-ref-nodes
- // This feature determines whether entity references within
- // the document are included in the document tree as
- // EntityReference nodes.
- // Note: The children of the entity reference are always
- // added to the document. This feature only affects
- // whether an EntityReference node is also included
- // as the parent of the entity reference children.
- //
- else if (feature.equals("dom/create-entity-ref-nodes")) {
- return getCreateEntityReferenceNodes();
- }
- //
- // http://apache.org/xml/features/dom/include-ignorable-whitespace
- // This feature determines whether text nodes that can be
- // considered "ignorable whitespace" are included in the DOM
- // tree.
- // Note: The only way that the parser can determine if text
- // is ignorable is by reading the associated grammar
- // and having a content model for the document. When
- // ignorable whitespace text nodes *are* included in
- // the DOM tree, they will be flagged as ignorable.
- // The ignorable flag can be queried by calling the
- // TextImpl#isIgnorableWhitespace():boolean method.
- //
- if (feature.equals("dom/include-ignorable-whitespace")) {
- return getIncludeIgnorableWhitespace();
+ try {
+ return fConfiguration.getFeature(featureId);
+ }
+ catch (XMLConfigurationException e) {
+ String message = e.getMessage();
+ if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
+ throw new SAXNotRecognizedException(message);
}
-
- //
- // Experimental features
- //
-
- //
- // http://apache.org/xml/features/domx/grammar-access
- // Allows grammar access in the DOM tree. Currently, this
- // means that there is an XML Schema document tree as a
- // child of the Doctype node.
- //
- if (feature.equals("domx/grammar-access")) {
- return fGrammarAccess;
+ else {
+ throw new SAXNotSupportedException(message);
}
-
- //
- // Pass request off to XMLParser for the common cases.
- //
}
- //
- // Pass request off to XMLParser for the common cases.
- //
- return super.getFeature(featureId);
-
} // getFeature(String):boolean
/**
@@ -773,2488 +399,60 @@
* being set.
* @param Object The value to which the property is being set.
*
- * @exception SAXNotRecognizedException If the requested property is
- * not known.
- * @exception SAXNotSupportedException If the requested property is
- * known, but the requested
- * value is not supported.
+ * @exception SAXNotRecognizedException If the
+ * requested property is not known.
+ * @exception SAXNotSupportedException If the
+ * requested property is known, but the requested
+ * value is not supported.
*/
public void setProperty(String propertyId, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException {
- //
- // Xerces properties
- //
-
- if (propertyId.startsWith(XERCES_PROPERTIES_PREFIX)) {
- String property = propertyId.substring(XERCES_PROPERTIES_PREFIX.length());
- //
- // http://apache.org/xml/properties/dom/current-element-node
- // Returns the current element node as the DOM Parser is
- // parsing. This property is useful for determining the
- // relative location of the document when an error is
- // encountered. Note that this feature does *not* work
- // when the http://apache.org/xml/features/dom/defer-node-expansion
- // is set to true.
- //
- if (property.equals("dom/current-element-node")) {
- throw new SAXNotSupportedException("PAR005 Property, \""+propertyId+"\" is read-only.\n"+propertyId);
+ try {
+ fConfiguration.setProperty(propertyId, value);
+ }
+ catch (XMLConfigurationException e) {
+ String message = e.getMessage();
+ if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
+ throw new SAXNotRecognizedException(message);
}
- //
- // http://apache.org/xml/properties/dom/document-class-name
- // This property can be used to set/query the name of the
- // document factory.
- //
- else if (property.equals("dom/document-class-name")) {
- if (value != null && !(value instanceof String)) {
- throw new SAXNotSupportedException("PAR006 Property value must be of type java.lang.String.");
- }
- setDocumentClassName((String)value);
- return;
+ else {
+ throw new SAXNotSupportedException(message);
}
}
- //
- // Pass request off to XMLParser for the common cases.
- //
- super.setProperty(propertyId, value);
-
} // setProperty(String,Object)
/**
+ * Query the value of a property.
+ *
* Return the current value of a property in a SAX2 parser.
* The parser might not recognize the property.
*
* @param propertyId The unique identifier (URI) of the property
* being set.
- *
* @return The current value of the property.
- *
- * @exception SAXNotRecognizedException If the requested property is
- * not known.
- *
- * @see Configurable#getProperty
+ * @exception org.xml.sax.SAXNotRecognizedException If the
+ * requested property is not known.
+ * @exception SAXNotSupportedException If the
+ * requested property is known but not supported.
*/
public Object getProperty(String propertyId)
throws SAXNotRecognizedException, SAXNotSupportedException {
- //
- // Xerces properties
- //
-
- if (propertyId.startsWith(XERCES_PROPERTIES_PREFIX)) {
- String property = propertyId.substring(XERCES_PROPERTIES_PREFIX.length());
- //
- // http://apache.org/xml/properties/dom/current-element-node
- // Returns the current element node as the DOM Parser is
- // parsing. This property is useful for determining the
- // relative location of the document when an error is
- // encountered. Note that this feature does *not* work
- // when the http://apache.org/xml/features/dom/defer-node-expansion
- // is set to true.
- //
- if (property.equals("dom/current-element-node")) {
- boolean throwException = false;
- try {
- throwException = getFeature(XERCES_FEATURES_PREFIX+"dom/defer-node-expansion");
- }
- catch (SAXNotSupportedException e) {
- // ignore
- }
- catch (SAXNotRecognizedException e) {
- // ignore
- }
- if (throwException) {
- throw new SAXNotSupportedException("PAR007 Current element node cannot be queried when node expansion is deferred.");
- }
- return getCurrentElementNode();
- }
- //
- // http://apache.org/xml/properties/dom/document-class-name
- // This property can be used to set/query the name of the
- // document factory.
- //
- else if (property.equals("dom/document-class-name")) {
- return getDocumentClassName();
- }
- }
-
- //
- // Pass request off to XMLParser for the common cases.
- //
- return super.getProperty(propertyId);
-
- } // getProperty(String):Object
-
- //
- // XMLParser methods
- //
-
- /** Start document. */
- public void startDocument() {
-
- // deferred expansion
- String documentClassName = null;
- try {
- documentClassName = getDocumentClassName();
- } catch (SAXException e) {
- throw new RuntimeException("PAR008 Fatal error getting document factory.");
- }
- boolean deferNodeExpansion = true;
try {
- deferNodeExpansion = getDeferNodeExpansion();
- } catch (SAXException e) {
- throw new RuntimeException("PAR009 Fatal error reading expansion mode.");
+ return fConfiguration.getProperty(propertyId);
}
- try {
- boolean isDocumentImpl = fDocumentClassName.equals(DEFAULT_DOCUMENT_CLASS_NAME);
- boolean isDeferredImpl = fDocumentClassName.equals(DEFAULT_DEFERRED_DOCUMENT_CLASS_NAME);
- if (deferNodeExpansion && (isDocumentImpl || isDeferredImpl)) {
- boolean nsEnabled = false;
- try { nsEnabled = getNamespaces(); }
- catch (SAXException s) {}
- fDeferredDocumentImpl = new DeferredDocumentImpl(fStringPool, nsEnabled, fGrammarAccess);
- fStringPoolInUse = true;
- fDocument = fDeferredDocumentImpl;
- fDocumentIndex = fDeferredDocumentImpl.createDocument();
- fCurrentNodeIndex = fDocumentIndex;
+ catch (XMLConfigurationException e) {
+ String message = e.getMessage();
+ if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
+ throw new SAXNotRecognizedException(message);
}
-
- // full expansion
else {
- if (isDocumentImpl) {
- fDocumentImpl = new DocumentImpl(fGrammarAccess);
- fDocument = fDocumentImpl;
- // set DOM error checking off
- fDocumentImpl.setErrorChecking(false);
- }
- else {
- Class documentClass = Class.forName(documentClassName);
- try {
- fDocument = (Document)documentClass.newInstance();
- }
- catch (Exception e) {
- // REVISIT: Localize this message.
- throw new RuntimeException(
- "Failed to create document object of class: "
- + documentClassName);
- }
- // if subclass of our own class that's cool too
- Class defaultDocClass =
- Class.forName(DEFAULT_DOCUMENT_CLASS_NAME);
- if (defaultDocClass.isAssignableFrom(documentClass)) {
- fDocumentImpl = (DocumentImpl)fDocument;
- // set DOM error checking off
- fDocumentImpl.setErrorChecking(false);
- }
- }
- fCurrentElementNode = fDocument;
- }
- }
- catch (ClassNotFoundException e) {
- // REVISIT: Localize this message.
- throw new RuntimeException(documentClassName);
- }
-
- } // startDocument()
-
- /** End document. */
- public void endDocument() throws Exception {
- // set DOM error checking back on
- if (fDocumentImpl != null) {
- fDocumentImpl.setErrorChecking(true);
-
- if (fDocumentType!=null) {
- // set entities and notations read_only per DOM spec
- ((DocumentTypeImpl)fDocumentType).setReadOnly(true, false);
- }
- }
- }
-
- /** XML declaration. */
- public void xmlDecl(int versionIndex, int encodingIndex, int standaloneIndex) throws Exception {
- boolean standalone = (standaloneIndex!=-1)?(fStringPool.toString(standaloneIndex).equals("yes"))?true:false:false;
- if (fDocumentImpl != null) { //full node expansion
- fDocumentImpl.setVersion(fStringPool.toString(versionIndex));
- fDocumentImpl.setEncoding(fStringPool.toString(encodingIndex));
- fDocumentImpl.setStandalone(standalone);
- }
- else if (fDeferredDocumentImpl != null) {
- fDeferredDocumentImpl.setVersion(fStringPool.toString(versionIndex));
- fDeferredDocumentImpl.setEncoding(fStringPool.toString(encodingIndex));
- fDeferredDocumentImpl.setStandalone(standalone);
- }
- else{
- //non xerces implementation
- }
-
-
- }
-
- /** Text declaration.
- * added DOM Level 3 WD support - experimental
- */
- public void textDecl(int versionIndex, int encodingIndex) throws Exception {
- if (fDeferredDocumentImpl != null) {
- String name = fStringPool.toString(fCurrentEntityName);
- // we only support one context for entity references (name !=null)
- if (fDocumentTypeIndex != -1 && name != null) {
- // find Entity decl for fCurrentEntityName.
- int entityDecl = fDeferredDocumentImpl.getLastChild(fDocumentTypeIndex, false);
- while (entityDecl != -1) {
- if (fDeferredDocumentImpl.getNodeType(entityDecl, false) == Node.ENTITY_NODE
- && fDeferredDocumentImpl.getNodeNameString(entityDecl, false).equals(name)) {
- break;
- }
- entityDecl = fDeferredDocumentImpl.getPrevSibling(entityDecl, false);
- }
- fCurrentEntityNode = entityDecl;
- fDeferredDocumentImpl.setEntityInfo(entityDecl, versionIndex, encodingIndex);
- }
- }
- // full node expansion
- else if (fDocumentImpl !=null){
- NamedNodeMap entities = fDocumentType.getEntities();
- if (entities!=null) {
- EntityImpl entityNode = (EntityImpl)entities.getNamedItem(fCurrentElementNode.getNodeName());
- if (entityNode !=null) {
- entityNode.setVersion(fStringPool.toString(versionIndex));
- entityNode.setEncoding(fStringPool.toString(encodingIndex));
- }
- }
- }
- else {
- //non xerces implementation
- }
- }
-
- /** Report the start of the scope of a namespace declaration. */
- public void startNamespaceDeclScope(int prefix, int uri) throws Exception {}
-
- /** Report the end of the scope of a namespace declaration. */
- public void endNamespaceDeclScope(int prefix) throws Exception {}
-
-
-
- /** Start element. */
- public void startElement(QName elementQName,
- XMLAttrList xmlAttrList, int attrListIndex)
- throws Exception {
-
- // deferred expansion
- if (fDeferredDocumentImpl != null) {
-
- // copy schema grammar, if needed
- if (!fSeenRootElement) {
- fSeenRootElement = true;
- // REVISIT: How do we know which grammar is in use?
- //Document schemaDocument = fValidator.getSchemaDocument();
- if (fGrammarAccess && fGrammarResolver.size() > 0) {
- if (fDocumentTypeIndex == -1) {
- fDocumentTypeIndex = fDeferredDocumentImpl.createDocumentType(elementQName.rawname, -1, -1);
- fDeferredDocumentImpl.appendChild(0, fDocumentTypeIndex);
- }
- Enumeration schemas = fGrammarResolver.nameSpaceKeys();
- Document schemaDocument = fGrammarResolver.getGrammar((String)schemas.nextElement()).getGrammarDocument();
- if (schemaDocument != null) {
- Element schema = schemaDocument.getDocumentElement();
- copyInto(schema, fDocumentTypeIndex);
- }
- }
- }
-
- int element =
- fDeferredDocumentImpl.createElement(elementQName.rawname,
- elementQName.uri,
- xmlAttrList,
- attrListIndex);
- fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, element);
- fCurrentNodeIndex = element;
- fWithinElement = true;
-
- // identifier registration
- int index = xmlAttrList.getFirstAttr(attrListIndex);
- while (index != -1) {
- if (xmlAttrList.getAttType(index) == fStringPool.addSymbol("ID")) {
- int nameIndex = xmlAttrList.getAttValue(index);
- fDeferredDocumentImpl.putIdentifier(nameIndex, element);
- }
- index = xmlAttrList.getNextAttr(index);
- }
- }
-
- // full expansion
- else {
-
- boolean nsEnabled = false;
- try { nsEnabled = getNamespaces(); }
- catch (SAXException s) {}
-
- String elementName = fStringPool.toString(elementQName.rawname);
-
- // copy schema grammar, if needed
- if (!fSeenRootElement) {
- fSeenRootElement = true;
- if (fDocumentImpl != null
- && fGrammarAccess && fGrammarResolver.size() > 0) {
- if (fDocumentType == null) {
- String rootName = elementName;
- String systemId = ""; // REVISIT: How do we get this value? -Ac
- String publicId = ""; // REVISIT: How do we get this value? -Ac
- fDocumentType = fDocumentImpl.createDocumentType(rootName, publicId, systemId);
- fDocument.appendChild(fDocumentType);
- // REVISIT: We could use introspection to get the
- // DOMImplementation#createDocumentType method
- // for DOM Level 2 implementations. The only
- // problem is that the owner document for the
- // node created is null. How does it get set
- // for document when appended? A cursory look
- // at the DOM Level 2 CR didn't yield any
- // information. -Ac
- }
- Enumeration schemas = fGrammarResolver.nameSpaceKeys();
- Document schemaDocument = fGrammarResolver.getGrammar((String)schemas.nextElement()).getGrammarDocument();
- if (schemaDocument != null) {
- Element schema = schemaDocument.getDocumentElement();
- XUtil.copyInto(schema, fDocumentType);
- }
- }
- }
-
- Element e;
- if (nsEnabled) {
- String namespaceURI = fStringPool.toString(elementQName.uri);
- // hide the fact that our parser uses an empty string for null
- if (namespaceURI.length() == 0) {
- namespaceURI = null;
- }
- e = fDocument.createElementNS(namespaceURI, elementName);
- } else {
- e = fDocument.createElement(elementName);
- }
- int attrHandle = xmlAttrList.getFirstAttr(attrListIndex);
- while (attrHandle != -1) {
- int attName = xmlAttrList.getAttrName(attrHandle);
- String attrName = fStringPool.toString(attName);
- String attrValue =
- fStringPool.toString(xmlAttrList.getAttValue(attrHandle));
- if (nsEnabled) {
- int nsURIIndex = xmlAttrList.getAttrURI(attrHandle);
- String namespaceURI = fStringPool.toString(nsURIIndex);
- // DOM Level 2 wants all namespace declaration attributes
- // to be bound to "http://www.w3.org/2000/xmlns/"
- // So as long as the XML parser doesn't do it, it needs to
- // done here.
- int prefixIndex = xmlAttrList.getAttrPrefix(attrHandle);
- String prefix = fStringPool.toString(prefixIndex);
- // hide that our parser uses an empty string for null
- if (namespaceURI.length() == 0) {
- namespaceURI = null;
- }
- if (namespaceURI == null) {
- if (prefix != null) {
- if (prefix.equals("xmlns")) {
- namespaceURI = "http://www.w3.org/2000/xmlns/";
- }
- } else if (attrName.equals("xmlns")) {
- namespaceURI = "http://www.w3.org/2000/xmlns/";
- }
- }
- e.setAttributeNS(namespaceURI, attrName, attrValue);
- } else {
- e.setAttribute(attrName, attrValue);
- }
- if (fDocumentImpl != null
- && !xmlAttrList.isSpecified(attrHandle)) {
- ((AttrImpl)e.getAttributeNode(attrName))
- .setSpecified(false);
- }
- attrHandle = xmlAttrList.getNextAttr(attrHandle);
+ throw new SAXNotSupportedException(message);
}
- fCurrentElementNode.appendChild(e);
- fCurrentElementNode = e;
- fWithinElement = true;
-
- // identifier registration
- if (fDocumentImpl != null) {
- int index = xmlAttrList.getFirstAttr(attrListIndex);
- while (index != -1) {
- if (xmlAttrList.getAttType(index) == fStringPool.addSymbol("ID")) {
- String name = fStringPool.toString(xmlAttrList.getAttValue(index));
- fDocumentImpl.putIdentifier(name, e);
- }
- index = xmlAttrList.getNextAttr(index);
- }
- }
-
- // release attributes
- xmlAttrList.releaseAttrList(attrListIndex);
- }
-
- } // startElement(QName,XMLAttrList,int)
-
- /** End element. */
- public void endElement(QName elementQName)
- throws Exception {
-
- // deferred node expansion
- if (fDeferredDocumentImpl != null) {
- fCurrentNodeIndex = fDeferredDocumentImpl.getParentNode(fCurrentNodeIndex, false);
- fWithinElement = false;
}
- // full node expansion
- else {
- fCurrentElementNode = fCurrentElementNode.getParentNode();
- fWithinElement = false;
- }
-
- } // endElement(QName)
-
- /** Characters. */
- public void characters(int dataIndex)
- throws Exception {
-
- // deferred node expansion
- if (fDeferredDocumentImpl != null) {
-
- int text;
-
- if (fInCDATA) {
- text = fDeferredDocumentImpl.createCDATASection(dataIndex, false);
- } else {
- // The Text normalization is taken care of within the Text Node
- // in the DEFERRED case.
- text = fDeferredDocumentImpl.createTextNode(dataIndex, false);
- }
- fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, text);
- }
-
- // full node expansion
- else {
-
- Text text;
-
- if (fInCDATA) {
- text = fDocument.createCDATASection(fStringPool.orphanString(dataIndex));
- }
- else {
-
- if (fWithinElement && fCurrentElementNode.getNodeType() == Node.ELEMENT_NODE) {
- Node lastChild = fCurrentElementNode.getLastChild();
- if (lastChild != null
- && lastChild.getNodeType() == Node.TEXT_NODE) {
- // Normalization of Text Nodes - append rather than create.
- ((Text)lastChild).appendData(fStringPool.orphanString(dataIndex));
- return;
- }
- }
- text = fDocument.createTextNode(fStringPool.orphanString(dataIndex));
- }
-
- fCurrentElementNode.appendChild(text);
-
- }
-
- } // characters(int)
-
- /** Ignorable whitespace. */
- public void ignorableWhitespace(int dataIndex) throws Exception {
-
- // ignore the whitespace
- if (!fIncludeIgnorableWhitespace) {
- fStringPool.orphanString(dataIndex);
- return;
- }
-
- // deferred node expansion
- if (fDeferredDocumentImpl != null) {
-
- int text;
-
- if (fInCDATA) {
- text = fDeferredDocumentImpl.createCDATASection(dataIndex, true);
- } else {
- // The Text normalization is taken care of within the Text Node
- // in the DEFERRED case.
- text = fDeferredDocumentImpl.createTextNode(dataIndex, true);
- }
- fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, text);
- }
-
- // full node expansion
- else {
-
- Text text;
-
- if (fInCDATA) {
- text = fDocument.createCDATASection(fStringPool.orphanString(dataIndex));
- }
- else {
-
- if (fWithinElement && fCurrentElementNode.getNodeType() == Node.ELEMENT_NODE) {
- Node lastChild = fCurrentElementNode.getLastChild();
- if (lastChild != null
- && lastChild.getNodeType() == Node.TEXT_NODE) {
- // Normalization of Text Nodes - append rather than create.
- ((Text)lastChild).appendData(fStringPool.orphanString(dataIndex));
- return;
- }
- }
- text = fDocument.createTextNode(fStringPool.orphanString(dataIndex));
- }
-
- if (fDocumentImpl != null) {
- ((TextImpl)text).setIgnorableWhitespace(true);
- }
-
- fCurrentElementNode.appendChild(text);
-
- }
-
- } // ignorableWhitespace(int)
-
- /** Processing instruction. */
- public void processingInstruction(int targetIndex, int dataIndex)
- throws Exception {
-
- // deferred node expansion
- if (fDeferredDocumentImpl != null) {
- int pi = fDeferredDocumentImpl.createProcessingInstruction(targetIndex, dataIndex);
- fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, pi);
- }
-
- // full node expansion
- else {
- String target = fStringPool.orphanString(targetIndex);
- String data = fStringPool.orphanString(dataIndex);
- ProcessingInstruction pi = fDocument.createProcessingInstruction(target, data);
- fCurrentElementNode.appendChild(pi);
- }
-
- } // processingInstruction(int,int)
-
- /** Comment. */
- public void comment(int dataIndex) throws Exception {
-
- if (fInDTD && !fGrammarAccess) {
- fStringPool.orphanString(dataIndex);
- }
- else {
- // deferred node expansion
- if (fDeferredDocumentImpl != null) {
- int comment = fDeferredDocumentImpl.createComment(dataIndex);
- fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, comment);
- }
-
- // full node expansion
- else {
- Comment comment = fDocument.createComment(fStringPool.orphanString(dataIndex));
- fCurrentElementNode.appendChild(comment);
- }
- }
-
- } // comment(int)
-
- // Callers who know they're interacting with this parser should use
- // characters(int); callers who don't know which parser they
- // are interacting with, or who can't be sure of sharing
- // the same stringPool, should use this method.
- public void characters(char ch[], int start, int length) throws Exception {
- characters(fStringPool.addSymbol(new String(ch, start, length)));
- } // characters(char[], int, int)
-
- /** Not called. */
- public void ignorableWhitespace(char ch[], int start, int length) throws Exception {}
-
- //
- // XMLDocumentScanner methods
- //
-
- /** Start CDATA section. */
- public void startCDATA() throws Exception {
- fInCDATA = true;
- }
-
- /** End CDATA section. */
- public void endCDATA() throws Exception {
- fInCDATA = false;
- }
-
- //
- // XMLEntityHandler methods
- //
-
- /** Start entity reference. */
- public void startEntityReference(int entityName, int entityType,
- int entityContext) throws Exception {
-
- fCurrentEntityName = entityName;
- // are we ignoring entity reference nodes?
- if (!fCreateEntityReferenceNodes) {
- return;
- }
-
-
- // ignore built-in entities
- if (entityName == fAmpIndex ||
- entityName == fGtIndex ||
- entityName == fLtIndex ||
- entityName == fAposIndex ||
- entityName == fQuotIndex) {
- return;
- }
-
- // we only support one context for entity references right now...
- if (entityContext != XMLEntityHandler.ENTITYREF_IN_CONTENT) {
- return;
- }
-
- // deferred node expansion
-
- if (fDeferredDocumentImpl != null) {
-
- int entityRefIndex = fDeferredDocumentImpl.createEntityReference(entityName);
- fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, entityRefIndex);
-
- fCurrentNodeIndex = entityRefIndex;
-
- }
-
- // full node expansion
- else {
-
- EntityReference er =
- fDocument.createEntityReference(fStringPool.toString(entityName));
-
- fCurrentElementNode.appendChild(er);
- fCurrentElementNode = er;
- }
-
- } // startEntityReference(int,int,int)
-
- /** End entity reference. */
- public void endEntityReference(int entityName, int entityType,
- int entityContext) throws Exception {
- // are we ignoring entity reference nodes?
- if (!fCreateEntityReferenceNodes) {
- return;
- }
-
- // ignore built-in entities
- if (entityName == fAmpIndex ||
- entityName == fGtIndex ||
- entityName == fLtIndex ||
- entityName == fAposIndex ||
- entityName == fQuotIndex) {
- return;
- }
-
- // we only support one context for entity references right now...
- if (entityContext != XMLEntityHandler.ENTITYREF_IN_CONTENT) {
- return;
- }
-
- // deferred node expansion
- if (fDeferredDocumentImpl != null) {
-
- String name = fStringPool.toString(entityName);
-
- int erChild = fCurrentNodeIndex;
- fCurrentNodeIndex = fDeferredDocumentImpl.getParentNode(erChild, false);
-
- // should never be true - we should not return here.
- if (fDeferredDocumentImpl.getNodeType(erChild, false) != Node.ENTITY_REFERENCE_NODE) return;
-
- erChild = fDeferredDocumentImpl.getLastChild(erChild, false); // first Child of EntityReference
- if (fDocumentTypeIndex != -1) {
- // if we have seen <?xml..> decl then Entity decl was found and
- // set in textDecl() using fCurrentEntityNode
- if (fCurrentEntityNode == -1) {
- // find Entity decl for this EntityReference.
- int entityDecl = fDeferredDocumentImpl.getLastChild(fDocumentTypeIndex, false);
- while (entityDecl != -1) {
- if (fDeferredDocumentImpl.getNodeType(entityDecl, false) == Node.ENTITY_NODE
- && fDeferredDocumentImpl.getNodeNameString(entityDecl, false).equals(name)) // string compare...
- {
- break;
- }
- entityDecl = fDeferredDocumentImpl.getPrevSibling(entityDecl, false);
- }
- fCurrentEntityNode = entityDecl;
- }
- if (fCurrentEntityNode != -1
- && fDeferredDocumentImpl.getLastChild(fCurrentEntityNode, false) == -1) {
- // found entityDecl with same name as this reference
- // AND it doesn't have any children.
-
- // we don't need to iterate, because the whole structure
- // should already be connected to the 1st child.
- fDeferredDocumentImpl.setAsLastChild(fCurrentEntityNode, erChild);
- }
- // done with current entity reference.
- // reset values
- fCurrentEntityNode = -1;
- fCurrentEntityName = -1;
- }
-
- }
-
- // full node expansion
- else {
-
- Node erNode = fCurrentElementNode;//fCurrentElementNode.getParentNode();
- fCurrentElementNode = erNode.getParentNode();
-
- // if necessary populate the related entity now
- if (fDocumentImpl != null) {
- NamedNodeMap entities = fDocumentType.getEntities();
- String name = fStringPool.toString(entityName);
- Node entityNode = entities.getNamedItem(name);
-
- // simply return here if there is no entity for
- // the reference or if the entity is already populated.
- if (entityNode == null || entityNode.hasChildNodes()) {
- return;
- }
-
- EntityImpl entity = (EntityImpl) entityNode;
- for (Node child = erNode.getFirstChild();
- child != null;
- child = child.getNextSibling()) {
- Node childClone = child.cloneNode(true);
- entity.appendChild(childClone);
- }
- }
- }
-
- } // endEntityReference(int,int,int)
-
- //
- // DTDValidator.EventHandler methods
- //
-
- /**
- * This function will be called when a <!DOCTYPE...> declaration is
- * encountered.
- */
- public void startDTD(QName rootElement, int publicId, int systemId)
- throws Exception {
-
- fInDTD = true;
-
- // full expansion
- if (fDocumentImpl != null) {
- String rootElementName = fStringPool.toString(rootElement.rawname);
- String publicString = fStringPool.toString(publicId);
- String systemString = fStringPool.toString(systemId);
- fDocumentType = fDocumentImpl.
- createDocumentType(rootElementName, publicString, systemString);
- fDocumentImpl.appendChild(fDocumentType);
-
- if (fGrammarAccess) {
- Element schema = fDocument.createElement("schema");
- // REVISIT: What should the namespace be? -Ac
- schema.setAttribute("xmlns", SchemaSymbols.URI_SCHEMAFORSCHEMA);
- ((AttrImpl)schema.getAttributeNode("xmlns")).setSpecified(false);
- schema.setAttribute("finalDefault", "");
- ((AttrImpl)schema.getAttributeNode("finalDefault")).setSpecified(false);
- schema.setAttribute("exactDefault", "");
- ((AttrImpl)schema.getAttributeNode("exactDefault")).setSpecified(false);
- fDocumentType.appendChild(schema);
- fCurrentElementNode = schema;
- }
- }
-
- // deferred expansion
- else if (fDeferredDocumentImpl != null) {
- fDocumentTypeIndex =
- fDeferredDocumentImpl.
- createDocumentType(rootElement.rawname, publicId, systemId);
- fDeferredDocumentImpl.appendChild(fDocumentIndex, fDocumentTypeIndex);
-
- if (fGrammarAccess) {
- int handle = fAttrList.startAttrList();
- fAttrList.addAttr(
- fStringPool.addSymbol("xmlns"),
- fStringPool.addString(SchemaSymbols.URI_SCHEMAFORSCHEMA),
- fStringPool.addSymbol("CDATA"),
- false,
- false); // search
- fAttrList.addAttr(
- fStringPool.addSymbol("finalDefault"),
- fStringPool.addString(""),
- fStringPool.addSymbol("CDATA"),
- false,
- false); // search
- fAttrList.addAttr(
- fStringPool.addSymbol("exactDefault"),
- fStringPool.addString(""),
- fStringPool.addSymbol("CDATA"),
- false,
- false); // search
- fAttrList.endAttrList();
- int schemaIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("schema"), fAttrList, handle);
- // REVISIT: What should the namespace be? -Ac
- fDeferredDocumentImpl.appendChild(fDocumentTypeIndex, schemaIndex);
- fCurrentNodeIndex = schemaIndex;
- }
- }
-
- } // startDTD(int,int,int)
-
- /**
- * Supports DOM Level 2 internalSubset additions.
- * Called when the internal subset is completely scanned.
- */
- public void internalSubset(int internalSubset) {
-
- //System.out.println("internalSubset callback:"+fStringPool.toString(internalSubset));
-
- // full expansion
- if (fDocumentImpl != null && fDocumentType != null) {
- ((DocumentTypeImpl)fDocumentType).setInternalSubset(fStringPool.toString(internalSubset));
- }
-
- // deferred expansion
- else if (fDeferredDocumentImpl != null) {
- fDeferredDocumentImpl.setInternalSubset(fDocumentTypeIndex, internalSubset);
- }
-
- }
-
-
- /**
- * This function will be called at the end of the DTD.
- */
- public void endDTD() throws Exception {
-
- fInDTD = false;
-
- if (fGrammarAccess) {
- if (fDocumentImpl != null) {
- fCurrentElementNode = fDocumentImpl;
- }
- else if (fDeferredDocumentImpl != null) {
- fCurrentNodeIndex = 0;
- }
- }
-
- } // endDTD()
-
- /**
- * <!ELEMENT Name contentspec>
- */
- public void elementDecl(QName elementDecl,
- int contentSpecType,
- int contentSpecIndex,
- XMLContentSpec.Provider contentSpecProvider) throws Exception {
-
- if (DEBUG_ATTLIST_DECL) {
- String contentModel = XMLContentSpec.toString(contentSpecProvider, fStringPool, contentSpecIndex);
- System.out.println("elementDecl(" + fStringPool.toString(elementDecl.rawname) + ", " +
- contentModel + ")");
- }
-
- //
- // Create element declaration
- //
- if (fGrammarAccess) {
-
- if (fDeferredDocumentImpl != null) {
-
- //
- // Build element
- //
-
- // get element declaration; create if necessary
- int schemaIndex = getLastChildElement(fDocumentTypeIndex, "schema");
- String elementName = fStringPool.toString(elementDecl.rawname);
- int elementIndex = getLastChildElement(schemaIndex, "element", "name", elementName);
- if (elementIndex == -1) {
- int handle = fAttrList.startAttrList();
- fAttrList.addAttr(
- fStringPool.addSymbol("name"),
- fStringPool.addString(elementName),
- fStringPool.addSymbol("NMTOKEN"),
- true,
- false); // search
- fAttrList.addAttr(
- fStringPool.addSymbol("minOccurs"), // name
- fStringPool.addString("1"), // value
- fStringPool.addSymbol("NMTOKEN"), // type
- false, // specified
- false); // search
- fAttrList.addAttr(
- fStringPool.addSymbol("nillable"), // name
- fStringPool.addString("false"), // value
- fStringPool.addSymbol("ENUMERATION"), // type
- false, // specified
- false); // search
- fAttrList.addAttr(
- fStringPool.addSymbol("abstract"), // name
- fStringPool.addString("false"), // value
- fStringPool.addSymbol("ENUMERATION"), // type
- false, // specified
- false); // search
- fAttrList.addAttr(
- fStringPool.addSymbol("final"), // name
- fStringPool.addString("false"), // value
- fStringPool.addSymbol("ENUMERATION"), // type
- false, // specified
- false); // search
- fAttrList.endAttrList();
- elementIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("element"), fAttrList, handle);
- fDeferredDocumentImpl.appendChild(schemaIndex, elementIndex);
- }
-
- //
- // Build content model
- //
-
- // get type element; create if necessary
- int typeIndex = getLastChildElement(elementIndex, "complexType");
- if (typeIndex == -1 && contentSpecType != XMLElementDecl.TYPE_MIXED_SIMPLE) {
- typeIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("complexType"), null, -1);
- // REVISIT: Check for type redeclaration? -Ac
- fDeferredDocumentImpl.insertBefore(elementIndex, typeIndex, getFirstChildElement(elementIndex));
- }
-
- // create models
- switch (contentSpecType) {
- case XMLElementDecl.TYPE_EMPTY: {
- int attributeIndex = fDeferredDocumentImpl.createAttribute(fStringPool.addSymbol("content"), fStringPool.addString("empty"), true);
- fDeferredDocumentImpl.setAttributeNode(typeIndex, attributeIndex);
- break;
- }
- case XMLElementDecl.TYPE_ANY: {
- int anyIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("any"), null, -1);
- fDeferredDocumentImpl.insertBefore(typeIndex, anyIndex, getFirstChildElement(typeIndex));
- break;
- }
- case XMLElementDecl.TYPE_MIXED_SIMPLE: {
- XMLContentSpec contentSpec = new XMLContentSpec();
- contentSpecProvider.getContentSpec(contentSpecIndex, contentSpec);
- contentSpecIndex = contentSpec.value;
- if (contentSpecIndex == -1) {
- int attributeIndex = fDeferredDocumentImpl.createAttribute(fStringPool.addSymbol("type"), fStringPool.addString("string"), true);
- fDeferredDocumentImpl.setAttributeNode(elementIndex, attributeIndex);
- }
- else {
- if (typeIndex == -1) {
- typeIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("complexType"), null, -1);
- // REVISIT: Check for type redeclaration? -Ac
- fDeferredDocumentImpl.insertBefore(elementIndex, typeIndex, getFirstChildElement(elementIndex));
- }
- int attributeIndex = fDeferredDocumentImpl.createAttribute(fStringPool.addSymbol("content"), fStringPool.addString("mixed"), true);
- fDeferredDocumentImpl.setAttributeNode(typeIndex, attributeIndex);
- int handle = fAttrList.startAttrList();
- fAttrList.addAttr(
- fStringPool.addSymbol("minOccurs"),
- fStringPool.addString("0"),
- fStringPool.addSymbol("NMTOKEN"),
- true,
- false); // search
- fAttrList.addAttr(
- fStringPool.addSymbol("maxOccurs"),
- fStringPool.addString("unbounded"),
- fStringPool.addSymbol("CDATA"),
- true,
- false); // search
- fAttrList.endAttrList();
- int choiceIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("choice"), fAttrList, handle);
- fDeferredDocumentImpl.appendChild(typeIndex, choiceIndex);
- while (contentSpecIndex != -1) {
-
- // get node
- contentSpecProvider.getContentSpec(contentSpecIndex, contentSpec);
- int type = contentSpec.type;
- int left = contentSpec.value;
- int right = contentSpec.otherValue;
-
- // if leaf, skip "#PCDATA" and stop
- if (type == XMLContentSpec.CONTENTSPECNODE_LEAF) {
- break;
- }
-
- // add right hand leaf
- contentSpecProvider.getContentSpec(right, contentSpec);
- handle = fAttrList.startAttrList();
- fAttrList.addAttr(
- fStringPool.addSymbol("ref"),
- fStringPool.addString(fStringPool.toString(contentSpec.value)),
- fStringPool.addSymbol("NMTOKEN"),
- true,
- false); //search
- fAttrList.endAttrList();
- int rightIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("element"), fAttrList, handle);
- int refIndex = getFirstChildElement(choiceIndex);
- fDeferredDocumentImpl.insertBefore(choiceIndex, rightIndex, refIndex);
-
- // go to next node
- contentSpecIndex = left;
- }
- }
- break;
- }
- case XMLElementDecl.TYPE_CHILDREN: {
- int attributeIndex = fDeferredDocumentImpl.createAttribute(fStringPool.addSymbol("content"), fStringPool.addString("elementOnly"), true);
- fDeferredDocumentImpl.setAttributeNode(typeIndex, attributeIndex);
- int children = createChildren(contentSpecProvider,
- contentSpecIndex,
- new XMLContentSpec(),
- fDeferredDocumentImpl,
- -1);
- fDeferredDocumentImpl.insertBefore(typeIndex, children, getFirstChildElement(typeIndex));
- break;
- }
- }
-
- } // if defer-node-expansion
-
- else if (fDocumentImpl != null) {
-
- //
- // Build element
- //
-
- // get element declaration; create if necessary
- Element schema = XUtil.getLastChildElement(fDocumentType, "schema");
- String elementName = fStringPool.toString(elementDecl.rawname);
- Element element = XUtil.getLastChildElement(schema, "element", "name", elementName);
- if (element == null) {
- element = fDocumentImpl.createElement("element");
- element.setAttribute("name", elementName);
- element.setAttribute("minOccurs", "1");
- ((AttrImpl)element.getAttributeNode("minOccurs")).setSpecified(false);
- element.setAttribute("nillable", "false");
- ((AttrImpl)element.getAttributeNode("nillable")).setSpecified(false);
- element.setAttribute("abstract", "false");
- ((AttrImpl)element.getAttributeNode("abstract")).setSpecified(false);
- element.setAttribute("final", "false");
- ((AttrImpl)element.getAttributeNode("final")).setSpecified(false);
- schema.appendChild(element);
- }
-
- //
- // Build content model
- //
-
- // get type element; create if necessary
- Element type = XUtil.getLastChildElement(element, "complexType");
- if (type == null && contentSpecType != XMLElementDecl.TYPE_MIXED_SIMPLE) {
- type = fDocumentImpl.createElement("complexType");
- // REVISIT: Check for type redeclaration? -Ac
- element.insertBefore(type, XUtil.getFirstChildElement(element));
- }
-
- // create models
- switch (contentSpecType) {
- case XMLElementDecl.TYPE_EMPTY: {
- type.setAttribute("content", "empty");
- break;
- }
- case XMLElementDecl.TYPE_ANY: {
- Element any = fDocumentImpl.createElement("any");
- type.insertBefore(any, XUtil.getFirstChildElement(type));
- break;
- }
- case XMLElementDecl.TYPE_MIXED_SIMPLE: {
- XMLContentSpec contentSpec = new XMLContentSpec();
- contentSpecProvider.getContentSpec(contentSpecIndex, contentSpec);
- contentSpecIndex = contentSpec.value;
- if (contentSpecIndex == -1) {
- element.setAttribute("type", "string");
- }
- else {
- if (type == null) {
- type = fDocumentImpl.createElement("complexType");
- // REVISIT: Check for type redeclaration? -Ac
- element.insertBefore(type, XUtil.getFirstChildElement(element));
- }
- type.setAttribute("content", "mixed");
- Element choice = fDocumentImpl.createElement("choice");
- choice.setAttribute("minOccurs", "0");
- choice.setAttribute("maxOccurs", "unbounded");
- type.appendChild(choice);
- while (contentSpecIndex != -1) {
-
- // get node
- contentSpecProvider.getContentSpec(contentSpecIndex, contentSpec);
- int cstype = contentSpec.type;
- int csleft = contentSpec.value;
- int csright = contentSpec.otherValue;
-
- // if leaf, skip "#PCDATA" and stop
- if (cstype == XMLContentSpec.CONTENTSPECNODE_LEAF) {
- break;
- }
-
- // add right hand leaf
- contentSpecProvider.getContentSpec(csright, contentSpec);
- Element right = fDocumentImpl.createElement("element");
- right.setAttribute("ref", fStringPool.toString(contentSpec.value));
- Element ref = XUtil.getFirstChildElement(choice);
- choice.insertBefore(right, ref);
-
- // go to next node
- contentSpecIndex = csleft;
- }
- }
- break;
- }
- case XMLElementDecl.TYPE_CHILDREN: {
- type.setAttribute("content", "elementOnly");
- Element children = createChildren(contentSpecProvider,
- contentSpecIndex,
- new XMLContentSpec(),
- fDocumentImpl,
- null);
- type.insertBefore(children, XUtil.getFirstChildElement(type));
- break;
- }
- }
-
- } // if NOT defer-node-expansion
-
- } // if grammar-access
-
- } // elementDecl(int,String)
-
- /**
- * <!ATTLIST Name AttDef>
- */
- public void attlistDecl(QName elementDecl, QName attributeDecl,
- int attType, boolean attList, String enumString,
- int attDefaultType, int attDefaultValue)
- throws Exception {
-
- if (DEBUG_ATTLIST_DECL) {
- System.out.println("attlistDecl(" + fStringPool.toString(elementDecl.rawname) + ", " +
- fStringPool.toString(attributeDecl.rawname) + ", " +
- fStringPool.toString(attType) + ", " +
- enumString + ", " +
- fStringPool.toString(attDefaultType) + ", " +
- fStringPool.toString(attDefaultValue) + ")");
- }
-
- // deferred expansion
- if (fDeferredDocumentImpl != null) {
-
- // get the default value
- if (attDefaultValue != -1) {
- if (DEBUG_ATTLIST_DECL) {
- System.out.println(" adding default attribute value: "+
- fStringPool.toString(attDefaultValue));
- }
-
- // get element definition
- int elementDefIndex = fDeferredDocumentImpl.lookupElementDefinition(elementDecl.rawname);
-
- // create element definition if not already there
- if (elementDefIndex == -1) {
- elementDefIndex = fDeferredDocumentImpl.createElementDefinition(elementDecl.rawname);
- fDeferredDocumentImpl.appendChild(fDocumentTypeIndex, elementDefIndex);
- }
-
- // add default attribute
- int attrIndex =
- fDeferredDocumentImpl.createAttribute(attributeDecl.rawname,
- attributeDecl.uri,
- attDefaultValue,
- false);
- fDeferredDocumentImpl.appendChild(elementDefIndex, attrIndex);
-
- }
-
- //
- // Create attribute declaration
- //
- if (fGrammarAccess) {
-
- // get element declaration; create it if necessary
- int schemaIndex = getLastChildElement(fDocumentTypeIndex, "schema");
- String elementName = fStringPool.toString(elementDecl.rawname);
- int elementIndex = getLastChildElement(schemaIndex, "element", "name", elementName);
- if (elementIndex == -1) {
- int handle = fAttrList.startAttrList();
- fAttrList.addAttr(
- fStringPool.addSymbol("name"),
- fStringPool.addString(elementName),
- fStringPool.addSymbol("NMTOKEN"),
- true,
- false); //search
- fAttrList.endAttrList();
- elementIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("element"), fAttrList, handle);
- fDeferredDocumentImpl.appendChild(schemaIndex, elementIndex);
- }
-
- // get type element; create it if necessary
- int typeIndex = getLastChildElement(elementIndex, "complexType");
- if (typeIndex == -1) {
- typeIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("complexType"), null, -1);
- fDeferredDocumentImpl.insertBefore(elementIndex, typeIndex, getLastChildElement(elementIndex));
- }
-
- // create attribute and set its attributes
- String attributeName = fStringPool.toString(attributeDecl.rawname);
- int attributeIndex = getLastChildElement(elementIndex, "attribute", "name", attributeName);
- if (attributeIndex == -1) {
- int handle = fAttrList.startAttrList();
- fAttrList.addAttr(
- fStringPool.addSymbol("name"),
- fStringPool.addString(attributeName),
- fStringPool.addSymbol("NMTOKEN"),
- true,
- false); // search
- fAttrList.addAttr(
- fStringPool.addSymbol("maxOccurs"),
- fStringPool.addString("1"),
- fStringPool.addSymbol("CDATA"),
- false,
- false); // search
- fAttrList.endAttrList();
- attributeIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("attribute"), fAttrList, handle);
- fDeferredDocumentImpl.appendChild(typeIndex, attributeIndex);
-
- // attribute type: CDATA, ENTITY, ... , NMTOKENS; ENUMERATION
- if (attType == XMLAttributeDecl.TYPE_ENUMERATION) {
- handle = fAttrList.startAttrList();
- fAttrList.addAttr(
- fStringPool.addSymbol("base"),
- fStringPool.addString("NMTOKEN"),
- fStringPool.addSymbol("NMTOKEN"),
- true,
- false); // search
- fAttrList.endAttrList();
- int simpleTypeIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("simpleType"), fAttrList, handle);
- fDeferredDocumentImpl.appendChild(attributeIndex, simpleTypeIndex);
- String tokenizerString = enumString.substring(1, enumString.length() - 1);
- StringTokenizer tokenizer = new StringTokenizer(tokenizerString, "|");
- while (tokenizer.hasMoreTokens()) {
- handle = fAttrList.startAttrList();
- fAttrList.addAttr(
- fStringPool.addSymbol("value"),
- fStringPool.addString(tokenizer.nextToken()),
- fStringPool.addSymbol("CDATA"),
- true,
- false); // search
- fAttrList.endAttrList();
- int enumerationIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("enumeration"), fAttrList, handle);
- fDeferredDocumentImpl.appendChild(simpleTypeIndex, enumerationIndex);
- }
- }
- else {
- int typeNameIndex = -1;
- switch (attType) {
- case XMLAttributeDecl.TYPE_ENTITY: {
- typeNameIndex = fStringPool.addString(attList?"ENTITIES":"ENTITY");
- break;
- }
- case XMLAttributeDecl.TYPE_ID: {
- typeNameIndex = fStringPool.addString("ID");
- break;
- }
- case XMLAttributeDecl.TYPE_IDREF: {
- typeNameIndex = fStringPool.addString(attList?"IDREFS":"IDREF");
- break;
- }
- case XMLAttributeDecl.TYPE_NMTOKEN: {
- typeNameIndex = fStringPool.addString(attList?"NMTOKENS":"NMTOKEN");
- break;
- }
- case XMLAttributeDecl.TYPE_NOTATION: {
- typeNameIndex = fStringPool.addString("NOTATION");
- break;
- }
- case XMLAttributeDecl.TYPE_CDATA:
- default: {
- typeNameIndex = fStringPool.addString("string");
- break;
- }
- }
- int attrIndex = fDeferredDocumentImpl.createAttribute(fStringPool.addSymbol("type"), typeNameIndex, true);
- fDeferredDocumentImpl.setAttributeNode(attributeIndex, attrIndex);
- }
-
- // attribute default type: #IMPLIED, #REQUIRED, #FIXED
- boolean fixed = false;
- switch (attDefaultType) {
- case XMLAttributeDecl.DEFAULT_TYPE_REQUIRED: {
- int useAttrIndex = fDeferredDocumentImpl.createAttribute(fStringPool.addSymbol("use"), fStringPool.addString("required"), true);
- fDeferredDocumentImpl.setAttributeNode(attributeIndex, useAttrIndex);
- break;
- }
- case XMLAttributeDecl.DEFAULT_TYPE_FIXED: {
- fixed = true;
- int useAttrIndex = fDeferredDocumentImpl.createAttribute(fStringPool.addSymbol("use"), fStringPool.addString("fixed"), true);
- fDeferredDocumentImpl.setAttributeNode(attributeIndex, useAttrIndex);
- break;
- }
- }
-
- // attribute default value
- if (attDefaultValue != -1) {
- if (!fixed) {
- int useAttrIndex = fDeferredDocumentImpl.createAttribute(fStringPool.addSymbol("use"), fStringPool.addString("default"), true);
- fDeferredDocumentImpl.setAttributeNode(attributeIndex, useAttrIndex);
- }
- int valueAttrIndex = fDeferredDocumentImpl.createAttribute(fStringPool.addSymbol("value"), attDefaultValue, true);
- fDeferredDocumentImpl.setAttributeNode(attributeIndex, valueAttrIndex);
- }
- }
- }
- }
-
- // full expansion
- else if (fDocumentImpl != null) {
-
- // get the default value
- if (attDefaultValue != -1) {
- if (DEBUG_ATTLIST_DECL) {
- System.out.println(" adding default attribute value: "+
- fStringPool.toString(attDefaultValue));
- }
-
- // get element name
- String elementName = fStringPool.toString(elementDecl.rawname);
-
- // get element definition node
- NamedNodeMap elements = ((DocumentTypeImpl)fDocumentType).getElements();
- ElementDefinitionImpl elementDef = (ElementDefinitionImpl)elements.getNamedItem(elementName);
- if (elementDef == null) {
- elementDef = fDocumentImpl.createElementDefinition(elementName);
- ((DocumentTypeImpl)fDocumentType).getElements().setNamedItem(elementDef);
- }
-
- // REVISIT: Check for uniqueness of element name? -Ac
-
- // get attribute name and value index
- String attrName = fStringPool.toString(attributeDecl.rawname);
- String attrValue = fStringPool.toString(attDefaultValue);
-
- // create attribute and set properties
- boolean nsEnabled = false;
- try { nsEnabled = getNamespaces(); }
- catch (SAXException s) {}
- AttrImpl attr;
- if (nsEnabled) {
- String namespaceURI = fStringPool.toString(attributeDecl.uri);
- // DOM Level 2 wants all namespace declaration attributes
- // to be bound to "http://www.w3.org/2000/xmlns/"
- // So as long as the XML parser doesn't do it, it needs to
- // done here.
- String prefix = fStringPool.toString(attributeDecl.prefix);
- // hide that our parser uses an empty string for null
- if (namespaceURI.length() == 0) {
- namespaceURI = null;
- }
- if (namespaceURI == null) {
- if (prefix != null) {
- if (prefix.equals("xmlns")) {
- namespaceURI = "http://www.w3.org/2000/xmlns/";
- }
- } else if (attrName.equals("xmlns")) {
- namespaceURI = "http://www.w3.org/2000/xmlns/";
- }
- }
- attr = (AttrImpl)fDocumentImpl.createAttributeNS(namespaceURI,attrName);
- }
- else{
- attr = (AttrImpl)fDocumentImpl.createAttribute(attrName);
- }
- attr.setValue(attrValue);
- attr.setSpecified(false);
-
- // add default attribute to element definition
- if(nsEnabled){
- elementDef.getAttributes().setNamedItemNS(attr);
- }
- else{
- elementDef.getAttributes().setNamedItem(attr);
- }
- }
-
- //
- // Create attribute declaration
- //
- try {
- if (fGrammarAccess) {
-
- // get element declaration; create it if necessary
- Element schema = XUtil.getLastChildElement(fDocumentType, "schema");
- String elementName = fStringPool.toString(elementDecl.rawname);
- Element element = XUtil.getLastChildElement(schema, "element", "name", elementName);
- if (element == null) {
- element = fDocumentImpl.createElement("element");
- element.setAttribute("name", elementName);
- schema.appendChild(element);
- }
-
- // get type element; create it if necessary
- Element type = XUtil.getLastChildElement(element, "complexType");
- if (type == null) {
- type = fDocumentImpl.createElement("complexType");
- element.insertBefore(type, XUtil.getLastChildElement(element));
- }
-
- // create attribute and set its attributes
- String attributeName = fStringPool.toString(attributeDecl.rawname);
- Element attribute = XUtil.getLastChildElement(element, "attribute", "name", attributeName);
- if (attribute == null) {
- attribute = fDocumentImpl.createElement("attribute");
- attribute.setAttribute("name", attributeName);
- attribute.setAttribute("maxOccurs", "1");
- ((AttrImpl)attribute.getAttributeNode("maxOccurs")).setSpecified(false);
- type.appendChild(attribute);
-
- // attribute type: CDATA, ENTITY, ... , NMTOKENS; ENUMERATION
- if (attType == XMLAttributeDecl.TYPE_ENUMERATION) {
- Element simpleType = fDocumentImpl.createElement("simpleType");
- simpleType.setAttribute("base", "NMTOKEN");
- attribute.appendChild(simpleType);
- String tokenizerString = enumString.substring(1, enumString.length() - 1);
- StringTokenizer tokenizer = new StringTokenizer(tokenizerString, "|");
- while (tokenizer.hasMoreTokens()) {
- Element enumeration = fDocumentImpl.createElement("enumeration");
- enumeration.setAttribute("value", tokenizer.nextToken());
- simpleType.appendChild(enumeration);
- }
- }
- else {
- String typeName = null;
- switch (attType) {
- case XMLAttributeDecl.TYPE_ENTITY: {
- typeName = attList ? "ENTITIES" : "ENTITY";
- break;
- }
- case XMLAttributeDecl.TYPE_ID: {
- typeName = "ID";
- break;
- }
- case XMLAttributeDecl.TYPE_IDREF: {
- typeName = attList ? "IDREFS" : "IDREF";
- break;
- }
- case XMLAttributeDecl.TYPE_NMTOKEN: {
- typeName = attList ? "NMTOKENS" : "NMTOKEN";
- break;
- }
- case XMLAttributeDecl.TYPE_NOTATION: {
- typeName = "NOTATION";
- break;
- }
- case XMLAttributeDecl.TYPE_CDATA:
- default: {
- typeName = "string";
- break;
- }
- }
- attribute.setAttribute("type", typeName);
- }
-
- // attribute default type: #IMPLIED, #REQUIRED, #FIXED
- boolean fixed = false;
- switch (attDefaultType) {
- case XMLAttributeDecl.DEFAULT_TYPE_REQUIRED: {
- attribute.setAttribute("use", "required");
- break;
- }
- case XMLAttributeDecl.DEFAULT_TYPE_FIXED: {
- attribute.setAttribute("use", "fixed");
- fixed = true;
- break;
- }
- }
-
- // attribute default value
- if (attDefaultValue != -1) {
- if (!fixed) {
- attribute.setAttribute("use", "default");
- }
- attribute.setAttribute("value", fStringPool.toString(attDefaultValue));
- }
- }
- }
- }
- catch (Exception e) {
- e.printStackTrace(System.err);
- }
-
- } // if NOT defer-node-expansion
-
- } // attlistDecl(int,int,int,String,int,int)
-
- /**
- * <!ENTITY % Name EntityValue> (internal)
- */
- public void internalPEDecl(int entityNameIndex, int entityValueIndex) throws Exception {
- if (fDeferredDocumentImpl != null) {
- if (fGrammarAccess) {
- StringBuffer str = new StringBuffer();
- str.append("<!ENTITY % ");
- str.append(fStringPool.toString(entityNameIndex));
- str.append(" \"");
- str.append(fStringPool.toString(entityValueIndex));
- str.append("\">");
- int commentIndex = fStringPool.addString(str.toString());
- int internalPEEntityIndex = fDeferredDocumentImpl.createComment(commentIndex);
- int schemaIndex = getFirstChildElement(fDocumentTypeIndex, "schema");
- fDeferredDocumentImpl.appendChild(schemaIndex, internalPEEntityIndex);
- }
- }
- else if (fDocumentImpl != null) {
- if (fGrammarAccess) {
- StringBuffer str = new StringBuffer();
- str.append("<!ENTITY % ");
- str.append(fStringPool.toString(entityNameIndex));
- str.append(" \"");
- str.append(fStringPool.toString(entityValueIndex));
- str.append("\">");
- Node internalPEEntity = fDocumentImpl.createComment(str.toString());
- Node schema = XUtil.getFirstChildElement(fDocumentType, "schema");
- schema.appendChild(internalPEEntity);
- }
- }
- else {
- fStringPool.orphanString(entityValueIndex);
- }
- }
-
- /**
- * <!ENTITY % Name ExternalID> (external)
- */
- public void externalPEDecl(int entityNameIndex, int publicIdIndex, int systemIdIndex) throws Exception {
- if (fDeferredDocumentImpl != null) {
- if (fGrammarAccess) {
- StringBuffer str = new StringBuffer();
- str.append("<!ENTITY ");
- str.append(fStringPool.toString(entityNameIndex));
- str.append(' ');
- if (publicIdIndex != -1) {
- str.append("PUBLIC \"");
- str.append(fStringPool.toString(publicIdIndex));
- str.append('"');
- if (systemIdIndex != -1) {
- str.append(" \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- }
- else if (systemIdIndex != -1) {
- str.append("SYSTEM \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- str.append('>');
- int commentIndex = fStringPool.addString(str.toString());
- int externalPEEntityIndex = fDeferredDocumentImpl.createComment(commentIndex);
- int schemaIndex = getFirstChildElement(fDocumentTypeIndex, "schema");
- fDeferredDocumentImpl.appendChild(schemaIndex, externalPEEntityIndex);
- }
- }
- else if (fDocumentImpl != null) {
- if (fGrammarAccess) {
- StringBuffer str = new StringBuffer();
- str.append("<!ENTITY ");
- str.append(fStringPool.toString(entityNameIndex));
- str.append(' ');
- if (publicIdIndex != -1) {
- str.append("PUBLIC \"");
- str.append(fStringPool.toString(publicIdIndex));
- str.append('"');
- if (systemIdIndex != -1) {
- str.append(" \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- }
- else if (systemIdIndex != -1) {
- str.append("SYSTEM \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- str.append('>');
- Node externalPEEntity = fDocumentImpl.createComment(str.toString());
- Node schema = XUtil.getFirstChildElement(fDocumentType, "schema");
- schema.appendChild(externalPEEntity);
- }
- }
- }
-
- /**
- * <!ENTITY Name EntityValue> (internal)
- */
- public void internalEntityDecl(int entityNameIndex, int entityValueIndex)
- throws Exception {
-
- // deferred expansion
- if (fDeferredDocumentImpl != null) {
-
- if (fDocumentTypeIndex == -1) return; //revisit: should never happen. Exception?
-
- //revisit: how to check if entity was already declared.
- // XML spec says that 1st Entity decl is binding.
-
- int newEntityIndex = fDeferredDocumentImpl.createEntity(entityNameIndex, -1, -1, -1);
- fDeferredDocumentImpl.appendChild(fDocumentTypeIndex, newEntityIndex);
-
- // REVISIT: Entities were removed from latest working draft. -Ac
- // create internal entity declaration
- if (fGrammarAccess) {
- StringBuffer str = new StringBuffer();
- str.append("<!ENTITY ");
- str.append(fStringPool.toString(entityNameIndex));
- str.append(" \"");
- str.append(fStringPool.toString(entityValueIndex));
- str.append("\">");
- int commentIndex = fStringPool.addString(str.toString());
- int textEntityIndex = fDeferredDocumentImpl.createComment(commentIndex);
- int schemaIndex = getFirstChildElement(fDocumentTypeIndex, "schema");
- fDeferredDocumentImpl.appendChild(schemaIndex, textEntityIndex);
- }
- }
-
- // full expansion
- else if (fDocumentImpl != null) {
- if (fDocumentType == null) return; //revisit: should never happen. Exception?
-
- //revisit: how to check if entity was already declared.
- // XML spec says that 1st Entity decl is binding.
-
- String entityName = fStringPool.toString(entityNameIndex);
-
- Entity entity = fDocumentImpl.createEntity(entityName);
- fDocumentType.getEntities().setNamedItem(entity);
-
- // REVISIT: Entities were removed from latest working draft. -Ac
- // create internal entity declaration
- if (fGrammarAccess) {
- StringBuffer str = new StringBuffer();
- str.append("<!ENTITY ");
- str.append(fStringPool.toString(entityNameIndex));
- str.append(" \"");
- str.append(fStringPool.toString(entityValueIndex));
- str.append("\">");
- Node textEntity = fDocumentImpl.createComment(str.toString());
- Node schema = XUtil.getFirstChildElement(fDocumentType, "schema");
- schema.appendChild(textEntity);
- }
- }
-
- } // internalEntityDecl(int,int)
-
- /**
- * <!ENTITY Name ExternalID> (external)
- */
- public void externalEntityDecl(int entityNameIndex, int publicIdIndex, int systemIdIndex)
- throws Exception {
-
- // deferred expansion
- if (fDeferredDocumentImpl != null) {
-
- //revisit: how to check if entity was already declared.
- // XML spec says that 1st Entity decl is binding.
-
- int newEntityIndex = fDeferredDocumentImpl.createEntity(entityNameIndex, publicIdIndex, systemIdIndex, -1);
-
- fDeferredDocumentImpl.appendChild(fDocumentTypeIndex, newEntityIndex);
-
- // REVISIT: Entities were removed from latest working draft. -Ac
- // create external entity declaration
- if (fGrammarAccess) {
- StringBuffer str = new StringBuffer();
- str.append("<!ENTITY ");
- str.append(fStringPool.toString(entityNameIndex));
- str.append(' ');
- if (publicIdIndex != -1) {
- str.append("PUBLIC \"");
- str.append(fStringPool.toString(publicIdIndex));
- str.append('"');
- if (systemIdIndex != -1) {
- str.append(" \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- }
- else if (systemIdIndex != -1) {
- str.append("SYSTEM \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- str.append('>');
- int commentIndex = fStringPool.addString(str.toString());
- int externalEntityIndex = fDeferredDocumentImpl.createComment(commentIndex);
- int schemaIndex = getFirstChildElement(fDocumentTypeIndex, "schema");
- fDeferredDocumentImpl.appendChild(schemaIndex, externalEntityIndex);
- }
- }
-
- // full expansion
- else if (fDocumentImpl != null) {
-
- //revisit: how to check if entity was already declared.
- // XML spec says that 1st Entity decl is binding.
-
- String entityName = fStringPool.toString(entityNameIndex);
- String publicId = fStringPool.toString(publicIdIndex);
- String systemId = fStringPool.toString(systemIdIndex);
-
- EntityImpl entity = (EntityImpl)fDocumentImpl.createEntity(entityName);
- if (publicIdIndex != -1) {
- entity.setPublicId(publicId);
- }
- entity.setSystemId(systemId);
- fDocumentType.getEntities().setNamedItem(entity);
-
- // REVISIT: Entities were removed from latest working draft. -Ac
- // create external entity declaration
- if (fGrammarAccess) {
- StringBuffer str = new StringBuffer();
- str.append("<!ENTITY ");
- str.append(fStringPool.toString(entityNameIndex));
- str.append(' ');
- if (publicIdIndex != -1) {
- str.append("PUBLIC \"");
- str.append(fStringPool.toString(publicIdIndex));
- str.append('"');
- if (systemIdIndex != -1) {
- str.append(" \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- }
- else if (systemIdIndex != -1) {
- str.append("SYSTEM \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- str.append('>');
- Node externalEntity = fDocumentImpl.createComment(str.toString());
- Node schema = XUtil.getFirstChildElement(fDocumentType, "schema");
- schema.appendChild(externalEntity);
- }
- }
-
- } // externalEntityDecl(int,int,int)
-
- /**
- * <!ENTITY Name ExternalID NDataDecl> (unparsed)
- */
- public void unparsedEntityDecl(int entityNameIndex,
- int publicIdIndex, int systemIdIndex,
- int notationNameIndex) throws Exception {
-
- // deferred expansion
- if (fDeferredDocumentImpl != null) {
-
- //revisit: how to check if entity was already declared.
- // XML spec says that 1st Entity decl is binding.
-
- int newEntityIndex = fDeferredDocumentImpl.createEntity(entityNameIndex, publicIdIndex, systemIdIndex, notationNameIndex);
-
- fDeferredDocumentImpl.appendChild(fDocumentTypeIndex, newEntityIndex);
-
- // REVISIT: Entities were removed from latest working draft. -Ac
- // add unparsed entity declaration
- if (fGrammarAccess) {
- StringBuffer str = new StringBuffer();
- str.append("<!ENTITY ");
- str.append(fStringPool.toString(entityNameIndex));
- str.append(' ');
- if (publicIdIndex != -1) {
- str.append("PUBLIC \"");
- str.append(fStringPool.toString(publicIdIndex));
- str.append('"');
- if (systemIdIndex != -1) {
- str.append(" \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- }
- else if (systemIdIndex != -1) {
- str.append("SYSTEM \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- str.append(" NDATA ");
- str.append(fStringPool.toString(notationNameIndex));
- str.append('>');
- int commentIndex = fStringPool.addString(str.toString());
- int unparsedEntityIndex = fDeferredDocumentImpl.createComment(commentIndex);
- int schemaIndex = getFirstChildElement(fDocumentTypeIndex, "schema");
- fDeferredDocumentImpl.appendChild(schemaIndex, unparsedEntityIndex);
- }
- }
-
- // full expansion
- else if (fDocumentImpl != null) {
-
- //revisit: how to check if entity was already declared.
- // XML spec says that 1st Entity decl is binding.
-
- String entityName = fStringPool.toString(entityNameIndex);
- String publicId = fStringPool.toString(publicIdIndex);
- String systemId = fStringPool.toString(systemIdIndex);
- String notationName = fStringPool.toString(notationNameIndex);
-
- EntityImpl entity = (EntityImpl)fDocumentImpl.createEntity(entityName);
- if (publicIdIndex != -1) {
- entity.setPublicId(publicId);
- }
- entity.setSystemId(systemId);
- entity.setNotationName(notationName);
- fDocumentType.getEntities().setNamedItem(entity);
-
- // REVISIT: Entities were removed from latest working draft. -Ac
- // add unparsed entity declaration
- if (fGrammarAccess) {
- StringBuffer str = new StringBuffer();
- str.append("<!ENTITY ");
- str.append(fStringPool.toString(entityNameIndex));
- str.append(' ');
- if (publicIdIndex != -1) {
- str.append("PUBLIC \"");
- str.append(fStringPool.toString(publicIdIndex));
- str.append('"');
- if (systemIdIndex != -1) {
- str.append(" \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- }
- else if (systemIdIndex != -1) {
- str.append("SYSTEM \"");
- str.append(fStringPool.toString(systemIdIndex));
- str.append('"');
- }
- str.append(" NDATA ");
- str.append(fStringPool.toString(notationNameIndex));
- str.append('>');
- Node unparsedEntity = fDocumentImpl.createComment(str.toString());
- Node schema = XUtil.getFirstChildElement(fDocumentType, "schema");
- schema.appendChild(unparsedEntity);
- }
- }
-
- } // unparsedEntityDecl(int,int,int,int)
-
- /**
- * <!NOTATION Name ExternalId>
- */
- public void notationDecl(int notationNameIndex, int publicIdIndex, int systemIdIndex)
- throws Exception {
-
- // deferred expansion
- if (fDeferredDocumentImpl != null) {
-
- //revisit: how to check if entity was already declared.
- // XML spec says that 1st Entity decl is binding.
-
- int newNotationIndex = fDeferredDocumentImpl.createNotation(notationNameIndex, publicIdIndex, systemIdIndex);
-
- fDeferredDocumentImpl.appendChild(fDocumentTypeIndex, newNotationIndex);
-
- // create notation declaration
- if (fGrammarAccess) {
- int schemaIndex = getLastChildElement(fDocumentTypeIndex, "schema");
- String notationName = fStringPool.toString(notationNameIndex);
- int notationIndex = getLastChildElement(schemaIndex, "notation", "name", notationName);
- if (notationIndex == -1) {
- int handle = fAttrList.startAttrList();
- fAttrList.addAttr(
- fStringPool.addSymbol("name"),
- fStringPool.addString(notationName),
- fStringPool.addSymbol("NMTOKEN"),
- true,
- false); // search
- if (publicIdIndex != -1) {
- fAttrList.addAttr(
- fStringPool.addSymbol("public"),
- publicIdIndex,
- fStringPool.addSymbol("CDATA"),
- true,
- false); // search
- }
- if (systemIdIndex != -1) {
- fAttrList.addAttr(
- fStringPool.addSymbol("system"),
- systemIdIndex,
- fStringPool.addSymbol("CDATA"),
- true,
- false); // search
- }
- fAttrList.endAttrList();
- notationIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol("notation"), fAttrList, handle);
- fDeferredDocumentImpl.appendChild(schemaIndex, notationIndex);
- }
- }
- }
-
- // full expansion
- else if (fDocumentImpl != null) {
-
- // REVISIT: how to check if entity was already declared.
- // XML spec says that 1st Entity decl is binding.
-
- String notationName = fStringPool.toString(notationNameIndex);
- String publicId = fStringPool.toString(publicIdIndex);
- String systemId = fStringPool.toString(systemIdIndex);
-
- NotationImpl notationImpl = (NotationImpl)fDocumentImpl.createNotation(notationName);
- notationImpl.setPublicId(publicId);
- if (systemIdIndex != -1) {
- notationImpl.setSystemId(systemId);
- }
-
- fDocumentType.getNotations().setNamedItem(notationImpl);
-
- // create notation declaration
- if (fGrammarAccess) {
- Element schema = XUtil.getFirstChildElement(fDocumentType, "schema");
- Element notation = XUtil.getFirstChildElement(schema, "notation", "name", notationName);
- if (notation == null) {
- notation = fDocument.createElement("notation");
- notation.setAttribute("name", notationName);
- //notation.setAttribute("export", "true");
- //((AttrImpl)notation.getAttributeNode("export")).setSpecified(false);
- if (publicId != null) {
- notation.setAttribute("public", publicId);
- }
- if (systemIdIndex != -1) {
- notation.setAttribute("system", systemId);
- }
- schema.appendChild(notation);
- }
- }
- }
-
- } // notationDecl(int,int,int)
-
- //
- // Private methods
- //
-
- /** Returns the first child element of the specified node. */
- private int getFirstChildElement(int nodeIndex) {
- int childIndex = getLastChildElement(nodeIndex);
- while (childIndex != -1) {
- int prevIndex = getPrevSiblingElement(childIndex);
- if (prevIndex == -1) {
- break;
- }
- childIndex = prevIndex;
- }
- return childIndex;
- }
-
- /** Returns the first child element of the specified node. */
- private int getFirstChildElement(int nodeIndex, String name) {
- int childIndex = getLastChildElement(nodeIndex);
- if (childIndex != -1) {
- int nameIndex = fStringPool.addSymbol(name);
- while (childIndex != -1) {
- if (fDeferredDocumentImpl.getNodeName(childIndex, false) == nameIndex) {
- break;
- }
- int prevIndex = getPrevSiblingElement(childIndex);
- childIndex = prevIndex;
- }
- }
- return childIndex;
- }
-
- /** Returns the last child element of the specified node. */
- private int getLastChildElement(int nodeIndex) {
- int childIndex = fDeferredDocumentImpl.getLastChild(nodeIndex, false);
- while (childIndex != -1) {
- if (fDeferredDocumentImpl.getNodeType(childIndex, false) == Node.ELEMENT_NODE) {
- return childIndex;
- }
- childIndex = fDeferredDocumentImpl.getPrevSibling(childIndex, false);
- }
- return -1;
- }
-
- /** Returns the previous sibling element of the specified node. */
- private int getPrevSiblingElement(int nodeIndex) {
- int siblingIndex = fDeferredDocumentImpl.getPrevSibling(nodeIndex, false);
- while (siblingIndex != -1) {
- if (fDeferredDocumentImpl.getNodeType(siblingIndex, false) == Node.ELEMENT_NODE) {
- return siblingIndex;
- }
- siblingIndex = fDeferredDocumentImpl.getPrevSibling(siblingIndex, false);
- }
- return -1;
- }
-
- /** Returns the first child element with the given name. */
- private int getLastChildElement(int nodeIndex, String elementName) {
- int childIndex = getLastChildElement(nodeIndex);
- if (childIndex != -1) {
- while (childIndex != -1) {
- String nodeName = fDeferredDocumentImpl.getNodeNameString(childIndex, false);
- if (nodeName.equals(elementName)) {
- return childIndex;
- }
- childIndex = getPrevSiblingElement(childIndex);
- }
- }
- return -1;
- }
-
- /** Returns the next sibling element with the given name. */
- private int getPrevSiblingElement(int nodeIndex, String elementName) {
- int siblingIndex = getPrevSiblingElement(nodeIndex);
- if (siblingIndex != -1) {
- while (siblingIndex != -1) {
- String nodeName = fDeferredDocumentImpl.getNodeNameString(siblingIndex, false);
- if (nodeName.equals(elementName)) {
- return siblingIndex;
- }
- siblingIndex = getPrevSiblingElement(siblingIndex);
- }
- }
- return -1;
- }
-
- /** Returns the first child element with the given name. */
- private int getLastChildElement(int nodeIndex, String elemName, String attrName, String attrValue) {
- int childIndex = getLastChildElement(nodeIndex, elemName);
- if (childIndex != -1) {
- while (childIndex != -1) {
- int attrIndex = fDeferredDocumentImpl.getNodeValue(childIndex, false);
- while (attrIndex != -1) {
- String nodeName = fDeferredDocumentImpl.getNodeNameString(attrIndex, false);
- if (nodeName.equals(attrName)) {
- // REVISIT: Do we need to normalize the text? -Ac
- int textIndex = fDeferredDocumentImpl.getLastChild(attrIndex, false);
- String nodeValue = fDeferredDocumentImpl.getNodeValueString(textIndex, false);
- if (nodeValue.equals(attrValue)) {
- return childIndex;
- }
- }
- attrIndex = fDeferredDocumentImpl.getPrevSibling(attrIndex, false);
- }
- childIndex = getPrevSiblingElement(childIndex, elemName);
- }
- }
- return -1;
- }
-
- /** Returns the next sibling element with the given name and attribute. */
- private int getPrevSiblingElement(int nodeIndex, String elemName, String attrName, String attrValue) {
- int siblingIndex = getPrevSiblingElement(nodeIndex, elemName);
- if (siblingIndex != -1) {
- int attributeNameIndex = fStringPool.addSymbol(attrName);
- while (siblingIndex != -1) {
- int attrIndex = fDeferredDocumentImpl.getNodeValue(siblingIndex, false);
- while (attrIndex != -1) {
- int attrValueIndex = fDeferredDocumentImpl.getNodeValue(attrIndex, false);
- if (attrValue.equals(fStringPool.toString(attrValueIndex))) {
- return siblingIndex;
- }
- attrIndex = fDeferredDocumentImpl.getPrevSibling(attrIndex, false);
- }
- siblingIndex = getPrevSiblingElement(siblingIndex, elemName);
- }
- }
- return -1;
- }
-
- /**
- * Copies the source tree into the specified place in a destination
- * tree. The source node and its children are appended as children
- * of the destination node.
- * <p>
- * <em>Note:</em> This is an iterative implementation.
- */
- private void copyInto(Node src, int destIndex) throws Exception {
-
- // for ignorable whitespace features
- boolean domimpl = src != null && src instanceof DocumentImpl;
-
- // placement variables
- Node start = src;
- Node parent = src;
- Node place = src;
-
- // traverse source tree
- while (place != null) {
-
- // copy this node
- int nodeIndex = -1;
- short type = place.getNodeType();
- switch (type) {
- case Node.CDATA_SECTION_NODE: {
- boolean ignorable = domimpl && ((TextImpl)place).isIgnorableWhitespace();
- nodeIndex = fDeferredDocumentImpl.createCDATASection(fStringPool.addString(place.getNodeValue()), ignorable);
- break;
- }
- case Node.COMMENT_NODE: {
- nodeIndex = fDeferredDocumentImpl.createComment(fStringPool.addString(place.getNodeValue()));
- break;
- }
- case Node.ELEMENT_NODE: {
- XMLAttrList attrList = null;
- int handle = -1;
- NamedNodeMap attrs = place.getAttributes();
- if (attrs != null) {
- int length = attrs.getLength();
- if (length > 0) {
- handle = fAttrList.startAttrList();
- for (int i = 0; i < length; i++) {
- Attr attr = (Attr)attrs.item(i);
- String attrName = attr.getNodeName();
- String attrValue = attr.getNodeValue();
- fAttrList.addAttr(
- fStringPool.addSymbol(attrName),
- fStringPool.addString(attrValue),
- fStringPool.addSymbol("CDATA"), // REVISIT
- attr.getSpecified(),
- false); // search
- }
- fAttrList.endAttrList();
- attrList = fAttrList;
- }
- }
- nodeIndex = fDeferredDocumentImpl.createElement(fStringPool.addSymbol(place.getNodeName()), attrList, handle);
- break;
- }
- case Node.ENTITY_REFERENCE_NODE: {
- nodeIndex = fDeferredDocumentImpl.createEntityReference(fStringPool.addSymbol(place.getNodeName()));
- break;
- }
- case Node.PROCESSING_INSTRUCTION_NODE: {
- nodeIndex = fDeferredDocumentImpl.createProcessingInstruction(fStringPool.addSymbol(place.getNodeName()), fStringPool.addString(place.getNodeValue()));
- break;
- }
- case Node.TEXT_NODE: {
- boolean ignorable = domimpl && ((TextImpl)place).isIgnorableWhitespace();
- nodeIndex = fDeferredDocumentImpl.createTextNode(fStringPool.addString(place.getNodeValue()), ignorable);
- break;
- }
- default: {
- throw new IllegalArgumentException("PAR010 Can't copy node type, "+
- type+" ("+
- place.getNodeName()+')'
- +"\n"+type+"\t"+place.getNodeName());
- }
- }
- fDeferredDocumentImpl.appendChild(destIndex, nodeIndex);
-
- // iterate over children
- if (place.hasChildNodes()) {
- parent = place;
- place = place.getFirstChild();
- destIndex = nodeIndex;
- }
-
- // advance
- else {
- place = place.getNextSibling();
- while (place == null && parent != start) {
- place = parent.getNextSibling();
- parent = parent.getParentNode();
- destIndex = fDeferredDocumentImpl.getParentNode(destIndex, false);
- }
- }
-
- }
-
- } // copyInto(Node,int)
-
- /**
- * Sets the appropriate occurrence count attributes on the specified
- * model element.
- */
- private void setOccurrenceCount(Element model, int minOccur, int maxOccur) {
-
- // min
- model.setAttribute("minOccurs", Integer.toString(minOccur));
- if (minOccur == 1) {
- ((AttrImpl)model.getAttributeNode("minOccurs")).setSpecified(false);
- }
-
- // max
- if (maxOccur == -1) {
- model.setAttribute("maxOccurs", "*");
- }
- else if (maxOccur != 1) {
- model.setAttribute("maxOccurs", Integer.toString(maxOccur));
- }
-
- } // setOccurrenceCount(Element,int,int)
-
- /** Creates the children for the element decl. */
- private Element createChildren(XMLContentSpec.Provider provider,
- int index, XMLContentSpec node,
- DocumentImpl factory,
- Element parent) throws Exception {
-
- // get occurrence count
- provider.getContentSpec(index, node);
- int occurs = -1;
- switch (node.type) {
- case XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE: {
- occurs = '+';
- provider.getContentSpec(node.value, node);
- break;
- }
- case XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE: {
- occurs = '*';
- provider.getContentSpec(node.value, node);
- break;
- }
- case XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE: {
- occurs = '?';
- provider.getContentSpec(node.value, node);
- break;
- }
- }
-
- // flatten model
- int nodeType = node.type;
- switch (nodeType) {
-
- // CHOICE or SEQUENCE
- case XMLContentSpec.CONTENTSPECNODE_CHOICE:
- case XMLContentSpec.CONTENTSPECNODE_SEQ: {
-
- // go down left side
- int leftIndex = node.value;
- int rightIndex = node.otherValue;
- Element left = createChildren(provider, leftIndex, node,
- factory, parent);
-
- // go down right side
- Element right = createChildren(provider, rightIndex, node,
- factory, null);
-
- // append left children
- boolean choice = nodeType == XMLContentSpec.CONTENTSPECNODE_CHOICE;
- String type = choice ? "choice" : "sequence";
- Element model = left;
- if (!left.getNodeName().equals(type)) {
- String minOccurs = left.getAttribute("minOccurs");
- String maxOccurs = left.getAttribute("maxOccurs");
- boolean min1 = minOccurs.length() == 0 || minOccurs.equals("1");
- boolean max1 = maxOccurs.length() == 0 || maxOccurs.equals("1");
- if (parent == null || (min1 && max1)) {
- model = factory.createElement(type);
- model.appendChild(left);
- }
- else {
- model = parent;
- }
- }
-
- // set occurrence count
- switch (occurs) {
- case '+': {
- model.setAttribute("maxOccurs", "unbounded");
- break;
- }
- case '*': {
- model.setAttribute("minOccurs", "0");
- model.setAttribute("maxOccurs", "unbounded");
- break;
- }
- case '?': {
- model.setAttribute("minOccurs", "0");
- break;
- }
- }
-
- // append right children
- model.appendChild(right);
-
- // return model
- return model;
- }
-
- // LEAF
- case XMLContentSpec.CONTENTSPECNODE_LEAF: {
- Element leaf = factory.createElement("element");
- leaf.setAttribute("ref", fStringPool.toString(node.value));
- switch (occurs) {
- case '+': {
- leaf.setAttribute("maxOccurs", "unbounded");
- break;
- }
- case '*': {
- leaf.setAttribute("minOccurs", "0");
- leaf.setAttribute("maxOccurs", "unbounded");
- break;
- }
- case '?': {
- leaf.setAttribute("minOccurs", "0");
- break;
- }
- }
- return leaf;
- }
-
- } // switch node type
-
- // error
- return null;
-
- } // createChildren(XMLContentSpec.Provider,int,XMLContentSpec,DocumentImpl,Element):Element
-
- /** Creates the children for the deferred element decl. */
- private int createChildren(XMLContentSpec.Provider provider,
- int index, XMLContentSpec node,
- DeferredDocumentImpl factory,
- int parent) throws Exception {
-
- // get occurrence count
- provider.getContentSpec(index, node);
- int occurs = -1;
- switch (node.type) {
- case XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE: {
- occurs = '+';
- provider.getContentSpec(node.value, node);
- break;
- }
- case XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE: {
- occurs = '*';
- provider.getContentSpec(node.value, node);
- break;
- }
- case XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE: {
- occurs = '?';
- provider.getContentSpec(node.value, node);
- break;
- }
- }
-
- // flatten model
- int nodeType = node.type;
- switch (nodeType) {
-
- // CHOICE or SEQUENCE
- case XMLContentSpec.CONTENTSPECNODE_CHOICE:
- case XMLContentSpec.CONTENTSPECNODE_SEQ: {
-
- // go down left side
- int leftIndex = node.value;
- int rightIndex = node.otherValue;
- int left = createChildren(provider, leftIndex, node,
- factory, parent);
-
- // go down right side
- int right = createChildren(provider, rightIndex, node,
- factory, -1);
-
- // append left children
- boolean choice = nodeType == XMLContentSpec.CONTENTSPECNODE_CHOICE;
- int type = fStringPool.addSymbol(choice ? "choice" : "sequence");
- int model = left;
- if (factory.getNodeName(left, false) != type) {
- int minOccurs = factory.getAttribute(left, fStringPool.addSymbol("minOccurs"));
- int maxOccurs = factory.getAttribute(left, fStringPool.addSymbol("maxOccurs"));
- boolean min1 = minOccurs == -1 || fStringPool.toString(minOccurs).equals("1");
- boolean max1 = maxOccurs == -1 || fStringPool.toString(maxOccurs).equals("1");
- if (parent == -1 || (min1 && max1)) {
- model = factory.createElement(type, null, -1);
- factory.appendChild(model, left);
- }
- else {
- model = parent;
- }
- }
-
- // set occurrence count
- switch (occurs) {
- case '+': {
- int maxOccurs = factory.createAttribute(fStringPool.addSymbol("maxOccurs"),
- fStringPool.addString("unbounded"),
- true);
- factory.setAttributeNode(model, maxOccurs);
- break;
- }
- case '*': {
- int minOccurs = factory.createAttribute(fStringPool.addSymbol("minOccurs"),
- fStringPool.addString("0"),
- true);
- factory.setAttributeNode(model, minOccurs);
- int maxOccurs = factory.createAttribute(fStringPool.addSymbol("maxOccurs"),
- fStringPool.addString("unbounded"),
- true);
- factory.setAttributeNode(model, maxOccurs);
- break;
- }
- case '?': {
- int minOccurs = factory.createAttribute(fStringPool.addSymbol("minOccurs"),
- fStringPool.addString("0"),
- true);
- factory.setAttributeNode(model, minOccurs);
- break;
- }
- }
-
- // append right children
- factory.appendChild(model, right);
-
- // return model
- return model;
- }
-
- // LEAF
- case XMLContentSpec.CONTENTSPECNODE_LEAF: {
- int handle = fAttrList.startAttrList();
- fAttrList.addAttr(
- fStringPool.addSymbol("ref"),
- fStringPool.addString(fStringPool.toString(node.value)),
- fStringPool.addSymbol("NMTOKEN"),
- true,
- false); // search
- switch (occurs) {
- case '+': {
- fAttrList.addAttr(
- fStringPool.addSymbol("maxOccurs"),
- fStringPool.addString("unbounded"),
- fStringPool.addSymbol("CDATA"),
- true,
- false); // search
- break;
- }
- case '*': {
- fAttrList.addAttr(
- fStringPool.addSymbol("minOccurs"),
- fStringPool.addString("0"),
- fStringPool.addSymbol("NMTOKEN"),
- true,
- false); // search
- fAttrList.addAttr(
- fStringPool.addSymbol("maxOccurs"),
- fStringPool.addString("unbounded"),
- fStringPool.addSymbol("CDATA"),
- true,
- false); // search
- break;
- }
- case '?': {
- fAttrList.addAttr(
- fStringPool.addSymbol("minOccurs"),
- fStringPool.addString("0"),
- fStringPool.addSymbol("NMTOKEN"),
- true,
- false); // search
- break;
- }
- }
- fAttrList.endAttrList();
- int leaf = factory.createElement(fStringPool.addSymbol("element"), fAttrList, handle);
- return leaf;
- }
-
- } // switch node type
-
- // error
- return -1;
-
- } // createChildren(XMLContentSpec.Provider,int,XMLContentSpec,DeferredDocumentImpl,int):int
+ } // getProperty(String):Object
} // class DOMParser
1.23 +25 -1521 xml-xerces/java/src/org/apache/xerces/parsers/SAXParser.java
Index: SAXParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/SAXParser.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- SAXParser.java 2001/02/01 09:58:19 1.22
+++ SAXParser.java 2001/08/23 00:35:31 1.23
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -57,1544 +57,48 @@
package org.apache.xerces.parsers;
-import org.apache.xerces.framework.XMLAttrList;
-import org.apache.xerces.framework.XMLContentSpec;
-import org.apache.xerces.framework.XMLDocumentHandler;
-import org.apache.xerces.framework.XMLParser;
-import org.apache.xerces.readers.XMLEntityHandler;
-import org.apache.xerces.utils.QName;
-import org.apache.xerces.utils.StringPool;
-import org.apache.xerces.validators.common.XMLAttributeDecl;
-import org.apache.xerces.validators.common.XMLElementDecl;
+import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.util.SymbolTable;
+import org.apache.xerces.xni.parser.XMLParserConfiguration;
-import org.xml.sax.Attributes;
-import org.xml.sax.AttributeList;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.Parser;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.ext.DeclHandler;
-import org.xml.sax.ext.LexicalHandler;
-import org.xml.sax.helpers.AttributesImpl;
-
-// REVISIT: [SAX2beta] ContentHandler#skippedEntity(String)
-
/**
- * SAXParser provides a parser which implements the SAX1 and SAX2
- * parser APIs.
+ * This is the main Xerces SAX parser class. It uses the abstract SAX
+ * parser with a document scanner, a dtd scanner, and a validator, as
+ * well as a grammar pool.
+ *
+ * @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
+ * @author Arnaud Le Hors, IBM
+ * @author Andy Clark, IBM
*
- * @version $Id: SAXParser.java,v 1.22 2001/02/01 09:58:19 andyc Exp $
+ * @version $Id: SAXParser.java,v 1.23 2001/08/23 00:35:31 lehors Exp $
*/
public class SAXParser
- extends XMLParser
- implements XMLDocumentHandler, XMLDocumentHandler.DTDHandler,
- Parser, XMLReader {
+ extends AbstractSAXParser {
//
- // Constants
- //
-
- // private
-
- /** Features recognized by this parser. */
- private static final String RECOGNIZED_FEATURES[] = {
- // SAX2 core
- /*"http://xml.org/sax/features/normalize-text",*/
- /*"http://xml.org/sax/features/use-locator",*/
- "http://xml.org/sax/features/namespace-prefixes",
- "http://xml.org/sax/features/string-interning",
- // Xerces
- };
-
- /** Properties recognized by this parser. */
- private static final String RECOGNIZED_PROPERTIES[] = {
- // SAX2 core
- "http://xml.org/sax/properties/lexical-handler",
- "http://xml.org/sax/properties/declaration-handler",
- "http://xml.org/sax/properties/dom-node",
- // Xerces
- };
-
- // debugging
-
- /** Set to true and recompile to debug callbacks. */
- private static final boolean DEBUG_CALLBACKS = false;
-
- //
- // Data
- //
-
- // parser handlers
-
- /** Document handler. */
- private DocumentHandler fDocumentHandler;
-
- // parser/xmlreader handlers
-
- /** DTD handler. */
- private org.xml.sax.DTDHandler fDTDHandler;
-
- // xmlreader handlers
-
- /** Content handler. */
- private ContentHandler fContentHandler;
-
- /** Decl handler. */
- private DeclHandler fDeclHandler;
-
- /** Lexical handler. */
- private LexicalHandler fLexicalHandler;
-
- private boolean fNamespacePrefixes = false;
-
- // temp
-
- private transient AttributesImpl fAttributes = new AttributesImpl();
-
- //
// Constructors
//
- /** Default constructor. */
- public SAXParser() {
- initHandlers(true, this, this);
- }
-
- protected SAXParser(StringPool stringPool) {
- super(stringPool);
- initHandlers(true, this, this);
- }
-
- //
- // Public methods
- //
-
- // features and properties
-
- /**
- * Returns a list of features that this parser recognizes.
- * This method will never return null; if no features are
- * recognized, this method will return a zero length array.
- *
- * @see #isFeatureRecognized
- * @see #setFeature
- * @see #getFeature
- */
- public String[] getFeaturesRecognized() {
-
- // get features that super/this recognizes
- String superRecognized[] = super.getFeaturesRecognized();
- String thisRecognized[] = RECOGNIZED_FEATURES;
-
- // is one or the other the empty set?
- int thisLength = thisRecognized.length;
- if (thisLength == 0) {
- return superRecognized;
- }
- int superLength = superRecognized.length;
- if (superLength == 0) {
- return thisRecognized;
- }
-
- // combine the two lists and return
- String recognized[] = new String[superLength + thisLength];
- System.arraycopy(superRecognized, 0, recognized, 0, superLength);
- System.arraycopy(thisRecognized, 0, recognized, superLength, thisLength);
- return recognized;
-
- } // getFeaturesRecognized():String[]
-
- /**
- * Returns a list of properties that this parser recognizes.
- * This method will never return null; if no properties are
- * recognized, this method will return a zero length array.
- *
- * @see #isPropertyRecognized
- * @see #setProperty
- * @see #getProperty
- */
- public String[] getPropertiesRecognized() {
-
- // get properties that super/this recognizes
- String superRecognized[] = super.getPropertiesRecognized();
- String thisRecognized[] = RECOGNIZED_PROPERTIES;
-
- // is one or the other the empty set?
- int thisLength = thisRecognized.length;
- if (thisLength == 0) {
- return superRecognized;
- }
- int superLength = superRecognized.length;
- if (superLength == 0) {
- return thisRecognized;
- }
-
- // combine the two lists and return
- String recognized[] = new String[superLength + thisLength];
- System.arraycopy(superRecognized, 0, recognized, 0, superLength);
- System.arraycopy(thisRecognized, 0, recognized, superLength, thisLength);
- return recognized;
-
- }
-
- //
- // Protected methods
- //
-
- // SAX2 core features
-
- /**
- * <b>Note: Currently, the parser does not support this feature.</b>
- * Setting this feature to true will throw a SAXNotSupportedException.
- * <p>
- * Ensures that all consecutive text is returned in a single callback
- * to the DocumentHandler.characters or DocumentHandler.ignorableWhitespace
- * methods.
- * <p>
- * This method is the equivalent to the feature:
- * <pre>
- * http://xml.org/sax/features/normalize-text
- * <pre>
- *
- * @param normalize True to normalize; false not to normalize.
- *
- * @see #getNormalizeText
- * @see #setFeature
- */
- /*
- protected void setNormalizeText(boolean normalize)
- throws SAXNotRecognizedException, SAXNotSupportedException {
- if (normalize) {
- throw new SAXNotSupportedException("http://xml.org/sax/features/normalize-text");
- }
- }
- */
-
- /**
- * <b>Note: This feature is always false.</b>
- * <p>
- * Returns true if the parser normalizes all consecutive text into
- * a single callback to the DocumentHandler.characters or
- * DocumentHandler.ignorableWhitespace methods.
- *
- * @see #setNormalizeText
- */
- /*
- protected boolean getNormalizeText()
- throws SAXNotRecognizedException, SAXNotSupportedException {
- return false;
- }
- */
-
- /**
- * <b>Note: Currently, this parser always sets the locator.</b>
- * Setting this feature to false will throw a SAXNotSupportedException.
- * <p>
- * Provide a Locator using the DocumentHandler.setDocumentLocator
- * callback (true), or explicitly do not provide one (false).
- * <p>
- * This method is the equivalent to the feature:
- * <pre>
- * http://xml.org/sax/features/use-locator
- * </pre>
- *
- * @see #getUseLocator
- * @see #setFeature
- */
- /*
- protected void setUseLocator(boolean use)
- throws SAXNotRecognizedException, SAXNotSupportedException {
- if (!use) {
- throw new SAXNotSupportedException("http://xml.org/sax/features/use-locator");
- }
- }
- */
-
- /**
- * <b>Note: This feature is always true.</b>
- * <p>
- * Returns true if the locator is always set.
- *
- * @see #setUseLocator
- */
- /*
- protected boolean getUseLocator()
- throws SAXNotRecognizedException, SAXNotSupportedException {
- return true;
- }
- */
-
- // SAX2 core properties
-
- /**
- * Set the DTD declaration event handler.
- * <p>
- * This method is the equivalent to the property:
- * <pre>
- * http://xml.org/sax/properties/declaration-handler
- * </pre>
- *
- * @param handler The new handler.
- *
- * @see #getDeclHandler
- * @see #setProperty
- */
- protected void setDeclHandler(DeclHandler handler)
- throws SAXNotRecognizedException, SAXNotSupportedException {
- if (fParseInProgress) {
- throw new SAXNotSupportedException(
- "PAR011 Feature: http://xml.org/sax/properties/declaration-handler"
- +" is not supported during parse."
- +"\nhttp://xml.org/sax/properties/declaration-handler");
- }
- fDeclHandler = handler;
- }
-
- /**
- * Returns the DTD declaration event handler.
- *
- * @see #setDeclHandler
- */
- protected DeclHandler getDeclHandler()
- throws SAXNotRecognizedException, SAXNotSupportedException {
- return fDeclHandler;
- }
-
- /**
- * Set the lexical event handler.
- * <p>
- * This method is the equivalent to the property:
- * <pre>
- * http://xml.org/sax/properties/lexical-handler
- * </pre>
- *
- * @param handler lexical event handler
- *
- * @see #getLexicalHandler
- * @see #setProperty
- */
- protected void setLexicalHandler(LexicalHandler handler)
- throws SAXNotRecognizedException, SAXNotSupportedException {
- if (fParseInProgress) {
- throw new SAXNotSupportedException(
- "PAR011 Feature: http://xml.org/sax/properties/lexical-handler"
- +" is not supported during parse."
- +"\nhttp://xml.org/sax/properties/lexical-handler");
- }
- fLexicalHandler = handler;
- }
-
- /**
- * Returns the lexical handler.
- *
- * @see #setLexicalHandler
- */
- protected LexicalHandler getLexicalHandler()
- throws SAXNotRecognizedException, SAXNotSupportedException {
- return fLexicalHandler;
- }
-
- //
- // Parser methods
- //
-
- /** Sets the document handler. */
- public void setDocumentHandler(DocumentHandler handler) {
- fDocumentHandler = handler;
- }
-
- //
- // Parser/XMLReader methods
- //
-
/**
- * Allow an application to register a DTD event handler.
- *
- * <p>If the application does not register a DTD handler, all DTD
- * events reported by the SAX parser will be silently ignored.</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The DTD handler.
- * @exception java.lang.NullPointerException If the handler
- * argument is null.
- * @see #getDTDHandler
+ * Constructs a SAX parser using the default basic parser configuration.
*/
- public void setDTDHandler(org.xml.sax.DTDHandler handler) {
- fDTDHandler = handler;
- }
-
- /**
- * Return the current DTD handler.
- *
- * @return The current DTD handler, or null if none
- * has been registered.
- * @see #setDTDHandler
- */
- public org.xml.sax.DTDHandler getDTDHandler() {
- return fDTDHandler;
- }
-
- /**
- * Sets how the parser reports raw prefixed names,
- * and whether xmlns attributes are reported.
- * <p>
- * This method is the equivalent to the feature:
- * <pre>
- * http://xml.org/sax/features/namespaces-prefixes
- * <pre>
- *
- * @param process True to process namespaces; false to not process.
- *
- * @see #getNamespaces
- * @see #setFeature
- */
- protected void setNamespacePrefixes(boolean process)
- throws SAXNotRecognizedException, SAXNotSupportedException {
- if (fParseInProgress) {
- throw new SAXNotSupportedException("PAR004 Cannot setFeature(http://xml.org/sax/features/namespace-prefixes): parse is in progress.\n"+
- "http://xml.org/sax/features/namespace-prefixes");
- }
- fNamespacePrefixes = process;
- }
-
- /**
- * Returns the http://xml.org/features/namespace-prefixes
- * value.
- *
- * @see #setNamespacePrefixes
- */
- protected boolean getNamespacePrefixes()
- throws SAXNotRecognizedException, SAXNotSupportedException {
- return fNamespacePrefixes;
- }
-
-
- //
- // XMLReader methods
- //
-
- /**
- * Set the state of any feature in a SAX2 parser. The parser
- * might not recognize the feature, and if it does recognize
- * it, it might not be able to fulfill the request.
- *
- * @param featureId The unique identifier (URI) of the feature.
- * @param state The requested state of the feature (true or false).
- *
- * @exception SAXNotRecognizedException If the
- * requested feature is not known.
- * @exception SAXNotSupportedException If the
- * requested feature is known, but the requested
- * state is not supported.
- */
- public void setFeature(String featureId, boolean state)
- throws SAXNotRecognizedException, SAXNotSupportedException {
-
- //
- // SAX2 Features
- //
-
- if (featureId.startsWith(SAX2_FEATURES_PREFIX)) {
- String feature = featureId.substring(SAX2_FEATURES_PREFIX.length());
-
- /*
- //
- // http://xml.org/sax/features/normalize-text
- // Ensure that all consecutive text is returned in a single callback to
- // DocumentHandler.characters or DocumentHandler.ignorableWhitespace
- // (true) or explicitly do not require it (false).
- //
- if (feature.equals("normalize-text")) {
- setNormalizeText(state);
- return;
- }
- */
- /*
- //
- // http://xml.org/sax/features/use-locator
- // Provide a Locator using the DocumentHandler.setDocumentLocator
- // callback (true), or explicitly do not provide one (false).
- //
- if (feature.equals("use-locator")) {
- setUseLocator(state);
- return;
- }
- */
-
- // http://xml.org/sax/features/namespace-prefixes
- // controls the reporting of raw prefixed names and Namespace
- // declarations (xmlns* attributes): when this feature is false
- // (the default), raw prefixed names may optionally be reported,
- // and xmlns* attributes must not be reported.
- //
- if (feature.equals("namespace-prefixes")) {
- setNamespacePrefixes(state);
- return;
- }
- // http://xml.org/sax/features/string-interning
- // controls the use of java.lang.String#intern() for strings
- // passed to SAX handlers.
- //
- if (feature.equals("string-interning")) {
- if (state) {
- throw new SAXNotSupportedException(
- "PAR018 "+state+" state for feature \""+featureId+"\" is not supported.\n"+
- state+'\t'+featureId
- );
- }
- return;
- }
-
- //
- // Drop through and perform default processing
- //
- }
-
- //
- // Xerces Features
- //
-
- /*
- else if (featureId.startsWith(XERCES_FEATURES_PREFIX)) {
- String feature = featureId.substring(XERCES_FEATURES_PREFIX.length());
- //
- // Drop through and perform default processing
- //
- }
- */
-
- //
- // Perform default processing
- //
-
- super.setFeature(featureId, state);
-
- } // setFeature(String,boolean)
-
- /**
- * Query the state of a feature.
- *
- * Query the current state of any feature in a SAX2 parser. The
- * parser might not recognize the feature.
- *
- * @param featureId The unique identifier (URI) of the feature
- * being set.
- * @return The current state of the feature.
- * @exception org.xml.sax.SAXNotRecognizedException If the
- * requested feature is not known.
- * @exception SAXNotSupportedException If the
- * requested feature is known but not supported.
- */
- public boolean getFeature(String featureId)
- throws SAXNotRecognizedException, SAXNotSupportedException {
-
- //
- // SAX2 Features
- //
-
- if (featureId.startsWith(SAX2_FEATURES_PREFIX)) {
- String feature = featureId.substring(SAX2_FEATURES_PREFIX.length());
-
- /*
- //
- // http://xml.org/sax/features/normalize-text
- // Ensure that all consecutive text is returned in a single callback to
- // DocumentHandler.characters or DocumentHandler.ignorableWhitespace
- // (true) or explicitly do not require it (false).
- //
- if (feature.equals("normalize-text")) {
- return getNormalizeText();
- }
- */
- /*
- //
- // http://xml.org/sax/features/use-locator
- // Provide a Locator using the DocumentHandler.setDocumentLocator
- // callback (true), or explicitly do not provide one (false).
- //
- if (feature.equals("use-locator")) {
- return getUseLocator();
- }
- */
-
- // http://xml.org/sax/features/namespace-prefixes
- // controls the reporting of raw prefixed names and Namespace
- // declarations (xmlns* attributes): when this feature is false
- // (the default), raw prefixed names may optionally be reported,
- // and xmlns* attributes must not be reported.
- //
- if (feature.equals("namespace-prefixes")) {
- return getNamespacePrefixes();
- }
- // http://xml.org/sax/features/string-interning
- // controls the use of java.lang.String#intern() for strings
- // passed to SAX handlers.
- //
- if (feature.equals("string-interning")) {
- return false;
- }
-
- //
- // Drop through and perform default processing
- //
- }
-
- //
- // Xerces Features
- //
-
- /*
- else if (featureId.startsWith(XERCES_FEATURES_PREFIX)) {
- //
- // Drop through and perform default processing
- //
- }
- */
-
- //
- // Perform default processing
- //
-
- return super.getFeature(featureId);
-
- } // getFeature(String):boolean
-
- /**
- * Set the value of any property in a SAX2 parser. The parser
- * might not recognize the property, and if it does recognize
- * it, it might not support the requested value.
- *
- * @param propertyId The unique identifier (URI) of the property
- * being set.
- * @param Object The value to which the property is being set.
- *
- * @exception SAXNotRecognizedException If the
- * requested property is not known.
- * @exception SAXNotSupportedException If the
- * requested property is known, but the requested
- * value is not supported.
- */
- public void setProperty(String propertyId, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException {
-
- //
- // SAX2 core properties
- //
-
- if (propertyId.startsWith(SAX2_PROPERTIES_PREFIX)) {
- String property = propertyId.substring(SAX2_PROPERTIES_PREFIX.length());
- //
- // http://xml.org/sax/properties/lexical-handler
- // Value type: org.xml.sax.ext.LexicalHandler
- // Access: read/write, pre-parse only
- // Set the lexical event handler.
- //
- if (property.equals("lexical-handler")) {
- try {
- setLexicalHandler((LexicalHandler)value);
- }
- catch (ClassCastException e) {
- throw new SAXNotSupportedException(
- "PAR012 For propertyID \""
- +propertyId+"\", the value \""
- +value+"\" cannot be cast to LexicalHandler."
- +'\n'+propertyId+'\t'+value+"\tLexicalHandler");
- }
- return;
- }
- //
- // http://xml.org/sax/properties/declaration-handler
- // Value type: org.xml.sax.ext.DeclHandler
- // Access: read/write, pre-parse only
- // Set the DTD declaration event handler.
- //
- if (property.equals("declaration-handler")) {
- try {
- setDeclHandler((DeclHandler)value);
- }
- catch (ClassCastException e) {
- throw new SAXNotSupportedException(
- "PAR012 For propertyID \""
- +propertyId+"\", the value \""
- +value+"\" cannot be cast to DeclHandler."
- +'\n'+propertyId+'\t'+value+"\tDeclHandler"
- );
- }
- return;
- }
- //
- // http://xml.org/sax/properties/dom-node
- // Value type: DOM Node
- // Access: read-only
- // Get the DOM node currently being visited, if the SAX parser is
- // iterating over a DOM tree. If the parser recognises and supports
- // this property but is not currently visiting a DOM node, it should
- // return null (this is a good way to check for availability before the
- // parse begins).
- //
- if (property.equals("dom-node")) {
- throw new SAXNotSupportedException(
- "PAR013 Property \""+propertyId+"\" is read only."
- +'\n'+propertyId
- ); // read-only property
- }
- //
- // Drop through and perform default processing
- //
- }
-
- //
- // Xerces Properties
- //
-
- /*
- else if (propertyId.startsWith(XERCES_PROPERTIES_PREFIX)) {
- //
- // Drop through and perform default processing
- //
- }
- */
-
- //
- // Perform default processing
- //
-
- super.setProperty(propertyId, value);
-
- } // setProperty(String,Object)
-
- /**
- * Query the value of a property.
- *
- * Return the current value of a property in a SAX2 parser.
- * The parser might not recognize the property.
- *
- * @param propertyId The unique identifier (URI) of the property
- * being set.
- * @return The current value of the property.
- * @exception org.xml.sax.SAXNotRecognizedException If the
- * requested property is not known.
- * @exception SAXNotSupportedException If the
- * requested property is known but not supported.
- */
- public Object getProperty(String propertyId)
- throws SAXNotRecognizedException, SAXNotSupportedException {
-
- //
- // SAX2 core properties
- //
-
- if (propertyId.startsWith(SAX2_PROPERTIES_PREFIX)) {
- String property = propertyId.substring(SAX2_PROPERTIES_PREFIX.length());
- //
- // http://xml.org/sax/properties/lexical-handler
- // Value type: org.xml.sax.ext.LexicalHandler
- // Access: read/write, pre-parse only
- // Set the lexical event handler.
- //
- if (property.equals("lexical-handler")) {
- return getLexicalHandler();
- }
- //
- // http://xml.org/sax/properties/declaration-handler
- // Value type: org.xml.sax.ext.DeclHandler
- // Access: read/write, pre-parse only
- // Set the DTD declaration event handler.
- //
- if (property.equals("declaration-handler")) {
- return getDeclHandler();
- }
- //
- // http://xml.org/sax/properties/dom-node
- // Value type: DOM Node
- // Access: read-only
- // Get the DOM node currently being visited, if the SAX parser is
- // iterating over a DOM tree. If the parser recognises and supports
- // this property but is not currently visiting a DOM node, it should
- // return null (this is a good way to check for availability before the
- // parse begins).
- //
- if (property.equals("dom-node")) {
- throw new SAXNotSupportedException(
- "PAR014 Cannot getProperty(\""+propertyId
- +"\". No DOM Tree exists.\n"+propertyId
- ); // we are not iterating a DOM tree
- }
- //
- // Drop through and perform default processing
- //
- }
-
- //
- // Xerces properties
- //
-
- /*
- else if (propertyId.startsWith(XERCES_PROPERTIES_PREFIX)) {
- //
- // Drop through and perform default processing
- //
- }
- */
-
- //
- // Perform default processing
- //
-
- return super.getProperty(propertyId);
-
- } // getProperty(String):Object
-
- /**
- * Allow an application to register a content event handler.
- *
- * <p>If the application does not register a content handler, all
- * content events reported by the SAX parser will be silently
- * ignored.</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The content handler.
- * @exception java.lang.NullPointerException If the handler
- * argument is null.
- * @see #getContentHandler
- */
- public void setContentHandler(ContentHandler handler) {
- if (handler == null) {
- throw new NullPointerException();
- }
- fContentHandler = handler;
- }
-
- /**
- * Return the current content handler.
- *
- * @return The current content handler, or null if none
- * has been registered.
- * @see #setContentHandler
- */
- public ContentHandler getContentHandler() {
- return fContentHandler;
- }
-
- //
- // XMLParser methods
- //
-
- /**
- * This function will be called when a <!DOCTYPE...> declaration is
- * encountered.
- */
- public void startDTD(QName rootElement, int publicId, int systemId) throws Exception {
- if (fLexicalHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String name = fStringPool.toString(rootElement.rawname);
- String pubid = fStringPool.toString(publicId);
- String sysid = fStringPool.toString(systemId);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("startDTD(" + name + ", " + pubid + ", " + sysid + ")");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.startDTD(name, pubid, sysid);
- }
- }
- }
-
- /**
- * This function will be called at the end of the DTD.
- */
- public void endDTD() throws Exception {
- if (DEBUG_CALLBACKS) {
- System.err.println("endDTD()");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.endDTD();
- }
- }
-
- /**
- * Report an element type declaration.
- *
- * The content model will consist of the string "EMPTY", the
- * string "ANY", or a parenthesised group, optionally followed
- * by an occurrence indicator. The model will be normalized so
- * that all whitespace is removed.
- *
- * @param name The element type name.
- * @param model The content model as a normalized string.
- * @exception SAXException The application may raise an exception.
- */
- public void elementDecl(QName elementDecl,
- int contentSpecType,
- int contentSpecIndex,
- XMLContentSpec.Provider contentSpecProvider) throws Exception {
-
- if (fDeclHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String name = fStringPool.toString(elementDecl.rawname);
- String contentModel;
- if (contentSpecType == XMLElementDecl.TYPE_ANY) {
- contentModel = "ANY";
- }
- else if (contentSpecType == XMLElementDecl.TYPE_EMPTY) {
- contentModel = "EMPTY";
- }
- else {
- contentModel = XMLContentSpec.toString(contentSpecProvider,
- fStringPool,
- contentSpecIndex);
- }
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("elementDecl(" + name + ", " + contentModel + ")");
- }
- if (fDeclHandler != null) {
- fDeclHandler.elementDecl(name, contentModel);
- }
- }
-
- }
-
- /**
- * Report an attribute type declaration.
- *
- * Only the effective (first) declaration for an attribute will
- * be reported. The type will be one of the strings "CDATA",
- * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
- * "ENTITIES", or "NOTATION", or a parenthesized token group with
- * the separator "|" and all whitespace removed.
- *
- * @param eName The name of the associated element.
- * @param aName The name of the attribute.
- * @param type A string representing the attribute type.
- * @param valueDefault A string representing the attribute default
- * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
- * none of these applies.
- * @param value A string representing the attribute's default value,
- * or null if there is none.
- * @exception SAXException The application may raise an exception.
- */
- public void attlistDecl(QName elementDecl, QName attributeDecl,
- int attType, boolean attList, String enumString,
- int attDefaultType,
- int attDefaultValue) throws Exception
- {
- if (fDeclHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String eName = fStringPool.toString(elementDecl.rawname);
- String aName = fStringPool.toString(attributeDecl.rawname);
- String aType = enumString;
- if (attType != XMLAttributeDecl.TYPE_ENUMERATION) {
- switch (attType) {
- case XMLAttributeDecl.TYPE_CDATA: {
- aType = "CDATA";
- break;
- }
- case XMLAttributeDecl.TYPE_ENTITY: {
- aType = attList ? "ENTITIES" : "ENTITY";
- break;
- }
- case XMLAttributeDecl.TYPE_ID: {
- aType = "ID";
- break;
- }
- case XMLAttributeDecl.TYPE_IDREF: {
- aType = attList ? "IDREFS" : "IDREF";
- break;
- }
- case XMLAttributeDecl.TYPE_NMTOKEN: {
- aType = attList ? "NMTOKENS" : "NMTOKEN";
- break;
- }
- case XMLAttributeDecl.TYPE_NOTATION: {
- aType = "NOTATION "+enumString;
- break;
- }
- }
- }
- String aDefaultType = null;
- switch (attDefaultType) {
- case XMLAttributeDecl.DEFAULT_TYPE_FIXED: {
- aDefaultType = "#FIXED";
- break;
- }
- case XMLAttributeDecl.DEFAULT_TYPE_IMPLIED: {
- aDefaultType = "#IMPLIED";
- break;
- }
- case XMLAttributeDecl.DEFAULT_TYPE_REQUIRED: {
- aDefaultType = "#REQUIRED";
- break;
- }
- }
- String aDefaultValue = fStringPool.toString(attDefaultValue);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("attributeDecl(" +
- eName + ", " +
- aName + ", " +
- aType + ", " +
- aDefaultType + ", " +
- aDefaultValue + ")");
- }
- if (fDeclHandler != null) {
- fDeclHandler.attributeDecl(eName, aName, aType, aDefaultType, aDefaultValue);
- }
- }
- }
-
- /**
- * Report an internal parameter entity declaration.
- */
- public void internalPEDecl(int entityName, int entityValue) throws Exception {
-
- if (fDeclHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String name = "%" + fStringPool.toString(entityName);
- String value = fStringPool.toString(entityValue);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("internalEntityDecl(" + name + ", " + value + ")");
- }
- if (fDeclHandler != null) {
- fDeclHandler.internalEntityDecl(name, value);
- }
- }
-
- }
-
- /**
- * Report a parsed external parameter entity declaration.
- */
- public void externalPEDecl(int entityName, int publicId, int systemId) throws Exception {
-
- if (fDeclHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String name = "%" + fStringPool.toString(entityName);
- String pubid = fStringPool.toString(publicId);
- String sysid = fStringPool.toString(systemId);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("externalEntityDecl(" + name + ", " + pubid + ", " + sysid + ")");
- }
- if (fDeclHandler != null) {
- fDeclHandler.externalEntityDecl(name, pubid, sysid);
- }
- }
-
- }
-
- /**
- * Report an internal general entity declaration.
- */
- public void internalEntityDecl(int entityName, int entityValue) throws Exception {
-
- if (fDeclHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String name = fStringPool.toString(entityName);
- String value = fStringPool.toString(entityValue);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("internalEntityDecl(" + name + ", " + value + ")");
- }
- if (fDeclHandler != null) {
- fDeclHandler.internalEntityDecl(name, value);
- }
- }
-
- }
-
- /**
- * Report a parsed external general entity declaration.
- */
- public void externalEntityDecl(int entityName, int publicId, int systemId) throws Exception {
-
- if (fDeclHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String name = fStringPool.toString(entityName);
- String pubid = fStringPool.toString(publicId);
- String sysid = fStringPool.toString(systemId);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("externalEntityDecl(" + name + ", " + pubid + ", " + sysid + ")");
- }
- if (fDeclHandler != null) {
- fDeclHandler.externalEntityDecl(name, pubid, sysid);
- }
- }
-
- }
-
- /**
- * Receive notification of an unparsed entity declaration event.
- */
- public void unparsedEntityDecl(int entityName, int publicId, int systemId, int notationName) throws Exception {
-
- if (fDTDHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String name = fStringPool.toString(entityName);
- String pubid = fStringPool.toString(publicId);
- String sysid = fStringPool.toString(systemId);
- String notation = fStringPool.toString(notationName);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("unparsedEntityDecl(" + name + ", " + pubid + ", " + sysid + ", " + notation + ")");
- }
- if (fDTDHandler != null) {
- fDTDHandler.unparsedEntityDecl(name, pubid, sysid, notation);
- }
- }
-
- }
-
- /**
- * Receive notification of a notation declaration event.
- */
- public void notationDecl(int notationName, int publicId, int systemId) throws Exception {
-
- if (fDTDHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String name = fStringPool.toString(notationName);
- String pubid = fStringPool.toString(publicId);
- String sysid = fStringPool.toString(systemId);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("notationDecl(" + name + ", " + pubid + ", " + sysid + ")");
- }
- if (fDTDHandler != null) {
- fDTDHandler.notationDecl(name, pubid, sysid);
- }
- }
-
- }
-
- /** Start document. */
- public void startDocument() throws Exception {
-
- // perform callbacks
- if (DEBUG_CALLBACKS) {
- System.err.println("setDocumentLocator(<locator>)");
- System.err.println("startDocument()");
- }
- if (fDocumentHandler != null) {
- fDocumentHandler.setDocumentLocator(getLocator());
- fDocumentHandler.startDocument();
- }
- if (fContentHandler != null) {
- fContentHandler.setDocumentLocator(getLocator());
- fContentHandler.startDocument();
- }
-
- } // startDocument()
-
- /** End document. */
- public void endDocument() throws Exception {
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("endDocument()");
- }
- if (fDocumentHandler != null) {
- fDocumentHandler.endDocument();
- }
- if (fContentHandler != null) {
- fContentHandler.endDocument();
- }
-
- } // endDocument()
-
- /** XML declaration. */
- public void xmlDecl(int versionIndex, int encodingIndex, int standaloneIndex) throws Exception {
-
- // perform callbacks
- if (DEBUG_CALLBACKS) {
- String notes = "";
- if (versionIndex != -1)
- notes += " version='" + fStringPool.toString(versionIndex) + "'";
- if (encodingIndex != -1)
- notes += " encoding='" + fStringPool.toString(encodingIndex) + "'";
- if (standaloneIndex != -1)
- notes += " standalone='" + fStringPool.toString(standaloneIndex) + "'";
- System.err.println("xmlDecl(<?xml" + notes + "?>)");
- }
-
- // release strings
- fStringPool.releaseString(versionIndex);
- fStringPool.releaseString(encodingIndex);
- fStringPool.releaseString(standaloneIndex);
-
- }
-
- /** Text declaration. */
- public void textDecl(int versionIndex, int encodingIndex) throws Exception {
-
- // perform callbacks
- if (DEBUG_CALLBACKS) {
- String notes = "";
- if (versionIndex != -1)
- notes += " version='" + fStringPool.toString(versionIndex) + "'";
- if (encodingIndex != -1)
- notes += " encoding='" + fStringPool.toString(encodingIndex) + "'";
- System.err.println("textDecl(<?xml" + notes + "?>)");
- }
-
- // release strings
- fStringPool.releaseString(versionIndex);
- fStringPool.releaseString(encodingIndex);
- }
+ public SAXParser() {
+ super(new StandardParserConfiguration());
+ } // <init>
/**
- * Report the start of the scope of a namespace declaration.
+ * Constructs a SAX parser using the specified symbol table.
*/
- public void startNamespaceDeclScope(int prefix, int uri) throws Exception {
-
- if (fContentHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String p = fStringPool.toString(prefix);
- String ns = fStringPool.toString(uri);
+ public SAXParser(SymbolTable symbolTable) {
+ super(new StandardParserConfiguration(symbolTable));
+ } // <init>(SymbolTable)
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("startNamespaceDeclScope(" + p + ", " + ns + ")");
- }
- if (fContentHandler != null) {
- fContentHandler.startPrefixMapping(p, ns);
- }
- }
-
- }
-
/**
- * Report the end of the scope of a namespace declaration.
+ * Constructs a SAX parser using the specified symbol table and
+ * grammar pool.
*/
- public void endNamespaceDeclScope(int prefix) throws Exception {
-
- if (fContentHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String p = fStringPool.toString(prefix);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("endNamespaceDeclScope(" + p + ")");
- }
- if (fContentHandler != null) {
- fContentHandler.endPrefixMapping(p);
- }
- }
-
- }
-
- /** New callback from DOM Level 2. There is no corresponding SAX callout for this yet. */
- public void internalSubset(int internalSubset) {
- }
-
- /** Start element */
- public void startElement(QName element,
- XMLAttrList attrList, int attrListIndex)
- throws Exception {
-
- // parameters
- String name = fStringPool.toString(element.rawname);
- AttributeList attrs = attrList.getAttributeList(attrListIndex);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- String atts = attrs.getLength() > 0 ? "" : " ";
- for (int i = 0; i < attrs.getLength(); i++) {
- atts += " " + attrs.getName(i) + "='" + attrs.getValue(i) + "'";
- }
- System.err.println("startElement(" + name + "," + atts + ")");
- }
- if (fDocumentHandler != null) {
- fDocumentHandler.startElement(name, attrs);
- }
- if (fContentHandler != null) {
- boolean namespaces = getNamespaces();
- int uriIndex = element.uri;
- String uri = uriIndex != StringPool.EMPTY_STRING && namespaces
- ? fStringPool.toString(uriIndex) : "";
- int localIndex = element.localpart;
- String local = localIndex != -1 && namespaces
- ? fStringPool.toString(localIndex) : "";
- String raw = name;
- fAttributes.clear();
- for (int attrIndex = attrList.getFirstAttr(attrListIndex);
- attrIndex != -1;
- attrIndex = attrList.getNextAttr(attrIndex)) {
- int attrNameIndex = attrList.getAttrName(attrIndex);
- int attrUriIndex = attrList.getAttrURI(attrIndex);
- String attrUri = attrUriIndex != -1 && namespaces
- ? fStringPool.toString(attrUriIndex) : "";
- int attrLocalIndex = attrList.getAttrLocalpart(attrIndex);
- String attrLocal = attrLocalIndex != -1 && namespaces
- ? fStringPool.toString(attrLocalIndex) : "";
- String attrRaw = fStringPool.toString(attrNameIndex);
- String attrType = fStringPool.toString(attrList.getAttType(attrIndex));
- String attrValue = fStringPool.toString(attrList.getAttValue(attrIndex));
- //int attrPrefix = fStringPool.getPrefixForQName(attrNameIndex);
- int attrPrefix = attrList.getAttrPrefix(attrIndex);
- boolean namespacePrefixes = getNamespacePrefixes();
- if (!namespaces || namespacePrefixes ||
- (attrPrefix != fStringPool.addSymbol("xmlns")
- && attrLocalIndex != fStringPool.addSymbol("xmlns")
- ))
- fAttributes.addAttribute(attrUri, attrLocal, attrRaw,
- attrType, attrValue);
-
- }
- fContentHandler.startElement(uri, local, raw, fAttributes);
- }
-
- // free attribute list
- attrList.releaseAttrList(attrListIndex);
-
- } // startElement(QName,XMLAttrList,int)
-
- /** End element. */
- public void endElement(QName element) throws Exception {
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("endElement(" + fStringPool.toString(element.rawname) + ")");
- }
- if (fDocumentHandler != null) {
- fDocumentHandler.endElement(fStringPool.toString(element.rawname));
- }
- if (fContentHandler != null) {
- boolean namespaces = getNamespaces();
- int uriIndex = element.uri;
- String uri = uriIndex != StringPool.EMPTY_STRING && namespaces
- ? fStringPool.toString(uriIndex) : "";
- int localIndex = element.localpart;
- String local = localIndex != -1 && namespaces
- ? fStringPool.toString(localIndex) : "";
- String raw = fStringPool.toString(element.rawname);
- fContentHandler.endElement(uri, local, raw);
- }
-
- } // endElement(QName)
-
- /** Start entity reference. */
- public void startEntityReference(int entityName, int entityType, int entityContext) throws Exception {
- if (fLexicalHandler != null || DEBUG_CALLBACKS) {
- switch (entityType) {
- case XMLEntityHandler.ENTITYTYPE_INTERNAL_PE:
- case XMLEntityHandler.ENTITYTYPE_EXTERNAL_PE:
- if (DEBUG_CALLBACKS) {
- System.err.println("startEntity(%" + fStringPool.toString(entityName) + ")");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.startEntity("%" + fStringPool.toString(entityName));
- }
- break;
- case XMLEntityHandler.ENTITYTYPE_INTERNAL:
- case XMLEntityHandler.ENTITYTYPE_EXTERNAL:
- if (DEBUG_CALLBACKS) {
- System.err.println("startEntity(" + fStringPool.toString(entityName) + ")");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.startEntity(fStringPool.toString(entityName));
- }
- break;
- case XMLEntityHandler.ENTITYTYPE_UNPARSED: // these are mentioned by name, not referenced
- throw new RuntimeException(
- "PAR015 startEntityReference(): ENTITYTYPE_UNPARSED");
- case XMLEntityHandler.ENTITYTYPE_DOCUMENT:
- break; // not reported
- case XMLEntityHandler.ENTITYTYPE_EXTERNAL_SUBSET:
- if (DEBUG_CALLBACKS) {
- System.err.println("startEntity(\"[dtd]\")");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.startEntity("[dtd]");
- }
- break;
- }
- }
- }
-
- /** End entity reference. */
- public void endEntityReference(int entityName, int entityType, int entityContext) throws Exception {
- if (fLexicalHandler != null || DEBUG_CALLBACKS) {
- switch (entityType) {
- case XMLEntityHandler.ENTITYTYPE_INTERNAL_PE:
- case XMLEntityHandler.ENTITYTYPE_EXTERNAL_PE:
- if (DEBUG_CALLBACKS) {
- System.err.println("endEntity(%" + fStringPool.toString(entityName) + ")");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.endEntity("%" + fStringPool.toString(entityName));
- }
- break;
- case XMLEntityHandler.ENTITYTYPE_INTERNAL:
- case XMLEntityHandler.ENTITYTYPE_EXTERNAL:
- if (DEBUG_CALLBACKS) {
- System.err.println("endEntity(" + fStringPool.toString(entityName) + ")");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.endEntity(fStringPool.toString(entityName));
- }
- break;
- case XMLEntityHandler.ENTITYTYPE_UNPARSED: // these are mentioned by name, not referenced
- throw new RuntimeException("PAR016 endEntityReference(): ENTITYTYPE_UNPARSED");
- case XMLEntityHandler.ENTITYTYPE_DOCUMENT:
- break; // not reported
- case XMLEntityHandler.ENTITYTYPE_EXTERNAL_SUBSET:
- if (DEBUG_CALLBACKS) {
- System.err.println("endEntity(\"[dtd]\")");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.endEntity("[dtd]");
- }
- break;
- }
- }
- }
-
- /** Start CDATA section. */
- public void startCDATA() throws Exception {
- if (DEBUG_CALLBACKS) {
- System.err.println("startCDATA()");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.startCDATA();
- }
- }
-
- /** End CDATA section. */
- public void endCDATA() throws Exception {
- if (DEBUG_CALLBACKS) {
- System.err.println("endCDATA()");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.endCDATA();
- }
- }
-
- /** Not called. */
- public void characters(int dataIndex) throws Exception {
- throw new RuntimeException("PAR017 cannot happen 5\n5");
- }
-
- /** Not called. */
- public void ignorableWhitespace(int dataIndex) throws Exception {
- throw new RuntimeException("PAR017 cannot happen 6\n6");
- }
-
- /** Processing instruction. */
- public void processingInstruction(int piTarget, int piData) throws Exception {
-
- if (fDocumentHandler != null || fContentHandler != null || DEBUG_CALLBACKS) {
- //
- // REVISIT - I keep running into SAX apps that expect
- // null data to be an empty string, which is contrary
- // to the comment for this method in the SAX API.
- //
-
- // strings
- String target = fStringPool.orphanString(piTarget);
- String data = piData == -1 ? "" : fStringPool.orphanString(piData);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("processingInstruction(" + target + ", " + data + ")");
- }
- if (fDocumentHandler != null) {
- fDocumentHandler.processingInstruction(target, data);
- }
- if (fContentHandler != null) {
- fContentHandler.processingInstruction(target, data);
- }
-
- }
- else {
- fStringPool.releaseString(piTarget);
- fStringPool.releaseString(piData);
- }
-
- }
-
- /** Comment. */
- public void comment(int dataIndex) throws Exception {
-
- if (fLexicalHandler != null || DEBUG_CALLBACKS) {
-
- // strings
- String data = fStringPool.orphanString(dataIndex);
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("comment(" + data + ")");
- }
- if (fLexicalHandler != null) {
- fLexicalHandler.comment(data.toCharArray(), 0, data.length());
- }
- } else {
- fStringPool.releaseString(dataIndex);
- }
- }
-
- /** Characters. */
- public void characters(char ch[], int start, int length) throws Exception {
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("characters(<char-data>) length " + length);
- }
- if (fDocumentHandler != null) {
- fDocumentHandler.characters(ch, start, length);
- }
- if (fContentHandler != null) {
- fContentHandler.characters(ch, start, length);
- }
-
- }
-
- /** Ignorable whitespace. */
- public void ignorableWhitespace(char ch[], int start, int length) throws Exception {
-
- // perform callback
- if (DEBUG_CALLBACKS) {
- System.err.println("ignorableWhitespace(<white-space>)");
- }
- if (fDocumentHandler != null) {
- fDocumentHandler.ignorableWhitespace(ch, start, length);
- }
- if (fContentHandler != null) {
- fContentHandler.ignorableWhitespace(ch, start, length);
- }
-
+ public SAXParser(SymbolTable symbolTable, GrammarPool grammarPool) {
+ super(new StandardParserConfiguration(symbolTable, grammarPool));
}
} // class SAXParser
1.2 +626 -0 xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java
1.2 +1825 -0 xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java
1.2 +617 -0 xml-xerces/java/src/org/apache/xerces/parsers/AbstractXMLDocumentParser.java
1.2 +668 -0 xml-xerces/java/src/org/apache/xerces/parsers/BasicParserConfiguration.java
1.2 +544 -0 xml-xerces/java/src/org/apache/xerces/parsers/CachingParserPool.java
1.2 +496 -0 xml-xerces/java/src/org/apache/xerces/parsers/DTDParser.java
1.2 +736 -0 xml-xerces/java/src/org/apache/xerces/parsers/StandardParserConfiguration.java
1.2 +112 -0 xml-xerces/java/src/org/apache/xerces/parsers/XMLDocumentParser.java
1.2 +92 -0 xml-xerces/java/src/org/apache/xerces/parsers/XMLGrammarParser.java
1.2 +162 -0 xml-xerces/java/src/org/apache/xerces/parsers/XMLParser.java
1.2 +154 -0 xml-xerces/java/src/org/apache/xerces/util/DefaultErrorHandler.java
1.2 +683 -0 xml-xerces/java/src/org/apache/xerces/util/EncodingMap.java
1.2 +171 -0 xml-xerces/java/src/org/apache/xerces/util/EntityResolverWrapper.java
1.2 +248 -0 xml-xerces/java/src/org/apache/xerces/util/ErrorHandlerWrapper.java
1.2 +99 -0 xml-xerces/java/src/org/apache/xerces/util/MessageFormatter.java
1.2 +448 -0 xml-xerces/java/src/org/apache/xerces/util/NamespaceSupport.java
1.2 +328 -0 xml-xerces/java/src/org/apache/xerces/util/SymbolTable.java
1.2 +1402 -0 xml-xerces/java/src/org/apache/xerces/util/URI.java
1.2 +764 -0 xml-xerces/java/src/org/apache/xerces/util/XMLAttributesImpl.java
1.2 +620 -0 xml-xerces/java/src/org/apache/xerces/util/XMLChar.java
1.2 +209 -0 xml-xerces/java/src/org/apache/xerces/util/XMLStringBuffer.java
1.2 +118 -0 xml-xerces/java/src/org/apache/xerces/xni/NamespaceContext.java
1.2 +234 -0 xml-xerces/java/src/org/apache/xerces/xni/QName.java
1.2 +468 -0 xml-xerces/java/src/org/apache/xerces/xni/XMLAttributes.java
1.2 +275 -0 xml-xerces/java/src/org/apache/xerces/xni/XMLDTDContentModelHandler.java
1.2 +345 -0 xml-xerces/java/src/org/apache/xerces/xni/XMLDTDHandler.java
1.2 +274 -0 xml-xerces/java/src/org/apache/xerces/xni/XMLDocumentFragmentHandler.java
1.2 +307 -0 xml-xerces/java/src/org/apache/xerces/xni/XMLDocumentHandler.java
1.2 +88 -0 xml-xerces/java/src/org/apache/xerces/xni/XMLLocator.java
1.2 +230 -0 xml-xerces/java/src/org/apache/xerces/xni/XMLString.java
1.2 +127 -0 xml-xerces/java/src/org/apache/xerces/xni/XNIException.java
1.2 +143 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLComponent.java
1.2 +102 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLComponentManager.java
1.2 +151 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLConfigurationException.java
1.2 +84 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLDTDContentModelSource.java
1.2 +136 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLDTDScanner.java
1.2 +84 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLDTDSource.java
1.2 +112 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLDocumentScanner.java
1.2 +84 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLDocumentSource.java
1.2 +100 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLEntityResolver.java
1.2 +144 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLErrorHandler.java
1.2 +276 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLInputSource.java
1.2 +192 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLParseException.java
1.2 +270 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLParserConfiguration.java
1.2 +128 -0 xml-xerces/java/src/org/apache/xerces/xni/parser/XMLPullParserConfiguration.java
1.2 +113 -0 xml-xerces/java/src/org/w3c/dom/package.html
1.2 +108 -0 xml-xerces/java/src/org/w3c/dom/events/package.html
1.2 +109 -0 xml-xerces/java/src/org/w3c/dom/html/package.html
1.2 +115 -0 xml-xerces/java/src/org/w3c/dom/ranges/package.html
1.2 +115 -0 xml-xerces/java/src/org/w3c/dom/traversal/package.html
1.2 +30 -0 xml-xerces/java/src/org/xml/sax/package.html
1.2 +108 -0 xml-xerces/java/src/org/xml/sax/ext/package.html
1.2 +26 -0 xml-xerces/java/src/org/xml/sax/helpers/package.html
1.2 +1 -1 xml-xerces/java/tests/dom/events/EventReporter.java
Index: EventReporter.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/tests/dom/events/EventReporter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EventReporter.java 2001/02/08 19:25:51 1.1
+++ EventReporter.java 2001/08/23 00:35:39 1.2
@@ -1,4 +1,4 @@
-/* $Id: EventReporter.java,v 1.1 2001/02/08 19:25:51 lehors Exp $ */
+/* $Id: EventReporter.java,v 1.2 2001/08/23 00:35:39 lehors Exp $ */
/*
* The Apache Software License, Version 1.1
*
1.4 +2 -2 xml-xerces/java/tests/dom/range/Test.java
Index: Test.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/tests/dom/range/Test.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Test.java 2000/12/11 19:06:58 1.3
+++ Test.java 2001/08/23 00:35:39 1.4
@@ -65,7 +65,7 @@
import org.w3c.dom.ranges.RangeException;
import java.io.*;
-import dom.DOMWriter;
+import dom.Writer;
import org.xml.sax.InputSource;
/** This RangeTest tests all of the cases delineated as examples
@@ -202,7 +202,7 @@
public boolean performTest(String arg) {
boolean passed = true;
try {
- DOMWriter writer = new DOMWriter(false);
+ Writer writer = new Writer(false);
DOMParser parser = new DOMParser();
if (!arg.equals("delete2") && !arg.equals("insert2")) {
System.out.println("\n*************** Test == "+arg+" ***************");
1.2 +3 -3 xml-xerces/java/tests/dom/serialize/TestSerializeDOMIn.java
Index: TestSerializeDOMIn.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/tests/dom/serialize/TestSerializeDOMIn.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestSerializeDOMIn.java 2000/06/27 02:14:08 1.1
+++ TestSerializeDOMIn.java 2001/08/23 00:35:39 1.2
@@ -64,7 +64,7 @@
import org.w3c.dom.Document;
import java.io.FileInputStream;
import org.w3c.dom.Node;
-import dom.DOMWriter;
+import dom.Writer;
import dom.serialize.*;
@@ -134,9 +134,9 @@
}
}
try {
- DOMWriter prettyWriter = new DOMWriter( false );
+ Writer prettyWriter = new Writer( false );
System.out.println( "Here is the whole Document" );
- prettyWriter.print( doc.getDocumentElement() );
+ prettyWriter.write( doc.getDocumentElement() );
} catch( Exception ex ){
}
}
1.2 +3 -3 xml-xerces/java/tests/dom/serialize/TestSerializeDOMOut.java
Index: TestSerializeDOMOut.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/tests/dom/serialize/TestSerializeDOMOut.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestSerializeDOMOut.java 2000/06/27 02:14:08 1.1
+++ TestSerializeDOMOut.java 2001/08/23 00:35:39 1.2
@@ -65,7 +65,7 @@
import org.w3c.dom.Document;
import java.io.FileOutputStream;
import org.w3c.dom.Node;
-import dom.DOMWriter;
+import dom.Writer;
/**
@@ -153,9 +153,9 @@
TestSerializeDOMIn tstIn = new TestSerializeDOMIn();
doc = tstIn.deserializeDOM( nameOfSerializedFile );
- DOMWriter prettyWriter = new DOMWriter( false );
+ Writer prettyWriter = new Writer( false );
System.out.println( "Here is the whole Document" );
- prettyWriter.print( doc.getDocumentElement() );
+ prettyWriter.write( doc.getDocumentElement() );
} catch ( Exception ex ){
ex.printStackTrace();
}
1.3 +11 -10 xml-xerces/java/tests/io/UTF8.java
Index: UTF8.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/tests/io/UTF8.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UTF8.java 2000/11/24 03:33:05 1.2
+++ UTF8.java 2001/08/23 00:35:39 1.3
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
@@ -66,15 +66,16 @@
import org.apache.xerces.impl.io.UTF8Reader;
/**
- * This program tests the ability of the customized UTF-8 reader used in
- * Xerces to correctly handle all valid Unicode characters. The UTF-8
- * reader included in the JDK is also tested as a reference but this
- * reader currently has a problem with surrogate characters (up to Java
- * 1.3).
+ * This program tests the customized UTF-8 reader for the parser,
+ * comparing it with the Java UTF-8 reader. Interestingly, when
+ * reading character by character (as opposed to block character
+ * reads), the Java reader silently skips surrogate characters
+ * on the input! I've seen this behavior in 1.1.8, 1.2, and 1.3
+ * under the Windows platform.
*
* @author Andy Clark, IBM
*
- * @version $Id: UTF8.java,v 1.2 2000/11/24 03:33:05 andyc Exp $
+ * @version $Id: UTF8.java,v 1.3 2001/08/23 00:35:39 lehors Exp $
*/
public class UTF8 {
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org