summaryrefslogtreecommitdiff
path: root/gnu/xml
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/xml')
-rw-r--r--gnu/xml/aelfred2/JAXPFactory.java35
-rw-r--r--gnu/xml/aelfred2/SAXDriver.java178
-rw-r--r--gnu/xml/aelfred2/XmlParser.java659
-rw-r--r--gnu/xml/aelfred2/XmlReader.java15
-rw-r--r--gnu/xml/dom/Consumer.java456
-rw-r--r--gnu/xml/dom/DTDAttributeTypeInfo.java3
-rw-r--r--gnu/xml/dom/DTDElementTypeInfo.java5
-rw-r--r--gnu/xml/dom/DomAttr.java45
-rw-r--r--gnu/xml/dom/DomCDATASection.java7
-rw-r--r--gnu/xml/dom/DomCharacterData.java33
-rw-r--r--gnu/xml/dom/DomComment.java7
-rw-r--r--gnu/xml/dom/DomDOMException.java21
-rw-r--r--gnu/xml/dom/DomDoctype.java56
-rw-r--r--gnu/xml/dom/DomDocument.java75
-rw-r--r--gnu/xml/dom/DomDocumentBuilder.java9
-rw-r--r--gnu/xml/dom/DomDocumentBuilderFactory.java7
-rw-r--r--gnu/xml/dom/DomDocumentConfiguration.java6
-rw-r--r--gnu/xml/dom/DomDocumentFragment.java9
-rw-r--r--gnu/xml/dom/DomElement.java22
-rw-r--r--gnu/xml/dom/DomEntity.java33
-rw-r--r--gnu/xml/dom/DomEntityReference.java8
-rw-r--r--gnu/xml/dom/DomEvent.java47
-rw-r--r--gnu/xml/dom/DomExtern.java13
-rw-r--r--gnu/xml/dom/DomImpl.java35
-rw-r--r--gnu/xml/dom/DomIterator.java49
-rw-r--r--gnu/xml/dom/DomNSResolverContext.java74
-rw-r--r--gnu/xml/dom/DomNamedNodeMap.java24
-rw-r--r--gnu/xml/dom/DomNode.java173
-rw-r--r--gnu/xml/dom/DomNodeIterator.java4
-rw-r--r--gnu/xml/dom/DomNotation.java13
-rw-r--r--gnu/xml/dom/DomNsNode.java21
-rw-r--r--gnu/xml/dom/DomProcessingInstruction.java15
-rw-r--r--gnu/xml/dom/DomText.java24
-rw-r--r--gnu/xml/dom/DomXPathExpression.java106
-rw-r--r--gnu/xml/dom/DomXPathNSResolver.java4
-rw-r--r--gnu/xml/dom/DomXPathResult.java2
-rw-r--r--gnu/xml/dom/ImplementationList.java2
-rw-r--r--gnu/xml/dom/ImplementationSource.java4
-rw-r--r--gnu/xml/dom/JAXPFactory.java55
-rw-r--r--gnu/xml/dom/html2/DomHTMLAnchorElement.java27
-rw-r--r--gnu/xml/dom/html2/DomHTMLAppletElement.java27
-rw-r--r--gnu/xml/dom/html2/DomHTMLAreaElement.java19
-rw-r--r--gnu/xml/dom/html2/DomHTMLBRElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLBaseElement.java7
-rw-r--r--gnu/xml/dom/html2/DomHTMLBaseFontElement.java9
-rw-r--r--gnu/xml/dom/html2/DomHTMLBodyElement.java15
-rw-r--r--gnu/xml/dom/html2/DomHTMLButtonElement.java13
-rw-r--r--gnu/xml/dom/html2/DomHTMLCollection.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLDListElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLDirectoryElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLDivElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLDocument.java3
-rw-r--r--gnu/xml/dom/html2/DomHTMLElement.java13
-rw-r--r--gnu/xml/dom/html2/DomHTMLEmbedElement.java24
-rw-r--r--gnu/xml/dom/html2/DomHTMLFieldSetElement.java3
-rw-r--r--gnu/xml/dom/html2/DomHTMLFontElement.java9
-rw-r--r--gnu/xml/dom/html2/DomHTMLFormElement.java15
-rw-r--r--gnu/xml/dom/html2/DomHTMLFrameElement.java19
-rw-r--r--gnu/xml/dom/html2/DomHTMLFrameSetElement.java7
-rw-r--r--gnu/xml/dom/html2/DomHTMLHRElement.java11
-rw-r--r--gnu/xml/dom/html2/DomHTMLHeadElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLHeadingElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLHtmlElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLIFrameElement.java23
-rw-r--r--gnu/xml/dom/html2/DomHTMLImageElement.java25
-rw-r--r--gnu/xml/dom/html2/DomHTMLImpl.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLInputElement.java37
-rw-r--r--gnu/xml/dom/html2/DomHTMLIsIndexElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLLIElement.java7
-rw-r--r--gnu/xml/dom/html2/DomHTMLLabelElement.java7
-rw-r--r--gnu/xml/dom/html2/DomHTMLLegendElement.java7
-rw-r--r--gnu/xml/dom/html2/DomHTMLLinkElement.java21
-rw-r--r--gnu/xml/dom/html2/DomHTMLMapElement.java7
-rw-r--r--gnu/xml/dom/html2/DomHTMLMenuElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLMetaElement.java11
-rw-r--r--gnu/xml/dom/html2/DomHTMLModElement.java7
-rw-r--r--gnu/xml/dom/html2/DomHTMLOListElement.java9
-rw-r--r--gnu/xml/dom/html2/DomHTMLObjectElement.java55
-rw-r--r--gnu/xml/dom/html2/DomHTMLOptGroupElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLOptionElement.java13
-rw-r--r--gnu/xml/dom/html2/DomHTMLParagraphElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLParamElement.java11
-rw-r--r--gnu/xml/dom/html2/DomHTMLParser.java22
-rw-r--r--gnu/xml/dom/html2/DomHTMLPreElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLQuoteElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLScriptElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLSelectElement.java21
-rw-r--r--gnu/xml/dom/html2/DomHTMLStyleElement.java9
-rw-r--r--gnu/xml/dom/html2/DomHTMLTableCaptionElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLTableCellElement.java31
-rw-r--r--gnu/xml/dom/html2/DomHTMLTableColElement.java15
-rw-r--r--gnu/xml/dom/html2/DomHTMLTableElement.java27
-rw-r--r--gnu/xml/dom/html2/DomHTMLTableRowElement.java17
-rw-r--r--gnu/xml/dom/html2/DomHTMLTableSectionElement.java15
-rw-r--r--gnu/xml/dom/html2/DomHTMLTextAreaElement.java23
-rw-r--r--gnu/xml/dom/html2/DomHTMLTitleElement.java5
-rw-r--r--gnu/xml/dom/html2/DomHTMLUListElement.java7
-rw-r--r--gnu/xml/dom/ls/DomLSException.java2
-rw-r--r--gnu/xml/dom/ls/DomLSInput.java5
-rw-r--r--gnu/xml/dom/ls/DomLSOutput.java4
-rw-r--r--gnu/xml/dom/ls/DomLSParser.java11
-rw-r--r--gnu/xml/dom/ls/DomLSSerializer.java7
-rw-r--r--gnu/xml/dom/ls/FilteredSAXEventSink.java37
-rw-r--r--gnu/xml/dom/ls/ReaderInputStream.java9
-rw-r--r--gnu/xml/dom/ls/SAXEventSink.java13
-rw-r--r--gnu/xml/dom/ls/WriterOutputStream.java5
-rw-r--r--gnu/xml/libxmlj/dom/GnomeAttr.java23
-rw-r--r--gnu/xml/libxmlj/dom/GnomeCDATASection.java2
-rw-r--r--gnu/xml/libxmlj/dom/GnomeCharacterData.java2
-rw-r--r--gnu/xml/libxmlj/dom/GnomeComment.java2
-rw-r--r--gnu/xml/libxmlj/dom/GnomeDOMException.java4
-rw-r--r--gnu/xml/libxmlj/dom/GnomeDOMStringList.java4
-rw-r--r--gnu/xml/libxmlj/dom/GnomeDocument.java34
-rw-r--r--gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java28
-rw-r--r--gnu/xml/libxmlj/dom/GnomeDocumentBuilderFactory.java6
-rw-r--r--gnu/xml/libxmlj/dom/GnomeDocumentFragment.java2
-rw-r--r--gnu/xml/libxmlj/dom/GnomeDocumentType.java4
-rw-r--r--gnu/xml/libxmlj/dom/GnomeElement.java16
-rw-r--r--gnu/xml/libxmlj/dom/GnomeEntity.java12
-rw-r--r--gnu/xml/libxmlj/dom/GnomeEntityReference.java2
-rw-r--r--gnu/xml/libxmlj/dom/GnomeNamedNodeMap.java6
-rw-r--r--gnu/xml/libxmlj/dom/GnomeNode.java24
-rw-r--r--gnu/xml/libxmlj/dom/GnomeNodeList.java4
-rw-r--r--gnu/xml/libxmlj/dom/GnomeNotation.java2
-rw-r--r--gnu/xml/libxmlj/dom/GnomeProcessingInstruction.java2
-rw-r--r--gnu/xml/libxmlj/dom/GnomeText.java10
-rw-r--r--gnu/xml/libxmlj/dom/GnomeTypeInfo.java4
-rw-r--r--gnu/xml/libxmlj/dom/GnomeXPathExpression.java6
-rw-r--r--gnu/xml/libxmlj/dom/GnomeXPathNSResolver.java5
-rw-r--r--gnu/xml/libxmlj/dom/GnomeXPathNodeList.java2
-rw-r--r--gnu/xml/libxmlj/dom/GnomeXPathResult.java6
-rw-r--r--gnu/xml/libxmlj/sax/GnomeLocator.java8
-rw-r--r--gnu/xml/libxmlj/sax/GnomeSAXParser.java4
-rw-r--r--gnu/xml/libxmlj/sax/GnomeSAXParserFactory.java4
-rw-r--r--gnu/xml/libxmlj/sax/GnomeXMLReader.java10
-rw-r--r--gnu/xml/libxmlj/sax/Namespaces.java6
-rw-r--r--gnu/xml/libxmlj/sax/StringArrayAttributes.java3
-rw-r--r--gnu/xml/libxmlj/sax/XMLName.java4
-rw-r--r--gnu/xml/libxmlj/transform/ErrorListenerErrorHandler.java8
-rwxr-xr-xgnu/xml/libxmlj/transform/GnomeTransformer.java30
-rwxr-xr-xgnu/xml/libxmlj/transform/GnomeTransformerFactory.java26
-rw-r--r--gnu/xml/libxmlj/transform/URIResolverEntityResolver.java2
-rw-r--r--gnu/xml/libxmlj/util/EmptyNodeList.java4
-rw-r--r--gnu/xml/libxmlj/util/NamedInputStream.java6
-rw-r--r--gnu/xml/libxmlj/util/StandaloneDocumentType.java12
-rw-r--r--gnu/xml/libxmlj/util/StandaloneLocator.java6
-rw-r--r--gnu/xml/libxmlj/util/XMLJ.java18
-rw-r--r--gnu/xml/pipeline/CallFilter.java160
-rw-r--r--gnu/xml/pipeline/DomConsumer.java1374
-rw-r--r--gnu/xml/pipeline/EventConsumer.java4
-rw-r--r--gnu/xml/pipeline/EventFilter.java636
-rw-r--r--gnu/xml/pipeline/LinkFilter.java192
-rw-r--r--gnu/xml/pipeline/NSFilter.java400
-rw-r--r--gnu/xml/pipeline/PipelineFactory.java1036
-rw-r--r--gnu/xml/pipeline/TeeConsumer.java310
-rw-r--r--gnu/xml/pipeline/TextConsumer.java26
-rw-r--r--gnu/xml/pipeline/ValidationConsumer.java2822
-rw-r--r--gnu/xml/pipeline/WellFormednessFilter.java330
-rw-r--r--gnu/xml/pipeline/XIncludeFilter.java620
-rw-r--r--gnu/xml/pipeline/XsltFilter.java100
-rw-r--r--gnu/xml/stream/AttributeImpl.java7
-rw-r--r--gnu/xml/stream/BufferedReader.java16
-rw-r--r--gnu/xml/stream/CRLFReader.java5
-rw-r--r--gnu/xml/stream/CharactersImpl.java11
-rw-r--r--gnu/xml/stream/CommentImpl.java7
-rw-r--r--gnu/xml/stream/DTDImpl.java7
-rw-r--r--gnu/xml/stream/EndDocumentImpl.java7
-rw-r--r--gnu/xml/stream/EndElementImpl.java7
-rw-r--r--gnu/xml/stream/EntityDeclarationImpl.java5
-rw-r--r--gnu/xml/stream/EntityReferenceImpl.java3
-rw-r--r--gnu/xml/stream/FilteredEventReader.java11
-rw-r--r--gnu/xml/stream/FilteredStreamReader.java7
-rw-r--r--gnu/xml/stream/NamespaceImpl.java7
-rw-r--r--gnu/xml/stream/NotationDeclarationImpl.java7
-rw-r--r--gnu/xml/stream/ProcessingInstructionImpl.java7
-rw-r--r--gnu/xml/stream/SAXParser.java18
-rw-r--r--gnu/xml/stream/SAXParserFactory.java8
-rw-r--r--gnu/xml/stream/StartDocumentImpl.java7
-rw-r--r--gnu/xml/stream/StartElementImpl.java7
-rw-r--r--gnu/xml/stream/UnicodeReader.java4
-rw-r--r--gnu/xml/stream/XIncludeFilter.java10
-rw-r--r--gnu/xml/stream/XMLEventAllocatorImpl.java7
-rw-r--r--gnu/xml/stream/XMLEventFactoryImpl.java15
-rw-r--r--gnu/xml/stream/XMLEventImpl.java7
-rw-r--r--gnu/xml/stream/XMLEventReaderImpl.java5
-rw-r--r--gnu/xml/stream/XMLEventWriterImpl.java9
-rw-r--r--gnu/xml/stream/XMLInputFactoryImpl.java27
-rw-r--r--gnu/xml/stream/XMLOutputFactoryImpl.java7
-rw-r--r--gnu/xml/stream/XMLParser.java97
-rw-r--r--gnu/xml/stream/XMLStreamWriterImpl.java30
-rw-r--r--gnu/xml/transform/AbstractNumberNode.java8
-rw-r--r--gnu/xml/transform/ApplyImportsNode.java5
-rw-r--r--gnu/xml/transform/ApplyTemplatesNode.java6
-rw-r--r--gnu/xml/transform/AttributeNode.java14
-rw-r--r--gnu/xml/transform/AttributeSet.java5
-rw-r--r--gnu/xml/transform/Bindings.java12
-rw-r--r--gnu/xml/transform/CallTemplateNode.java12
-rw-r--r--gnu/xml/transform/ChooseNode.java6
-rw-r--r--gnu/xml/transform/CommentNode.java6
-rw-r--r--gnu/xml/transform/CopyNode.java4
-rw-r--r--gnu/xml/transform/CopyOfNode.java8
-rw-r--r--gnu/xml/transform/CurrentFunction.java3
-rw-r--r--gnu/xml/transform/DOMSourceLocator.java4
-rw-r--r--gnu/xml/transform/DocumentFunction.java8
-rw-r--r--gnu/xml/transform/ElementAvailableFunction.java5
-rw-r--r--gnu/xml/transform/ElementNode.java12
-rw-r--r--gnu/xml/transform/ErrorListenerErrorHandler.java8
-rw-r--r--gnu/xml/transform/ForEachNode.java36
-rw-r--r--gnu/xml/transform/FormatNumberFunction.java3
-rw-r--r--gnu/xml/transform/FunctionAvailableFunction.java5
-rw-r--r--gnu/xml/transform/GenerateIdFunction.java3
-rw-r--r--gnu/xml/transform/IfNode.java8
-rw-r--r--gnu/xml/transform/Key.java5
-rw-r--r--gnu/xml/transform/KeyFunction.java7
-rw-r--r--gnu/xml/transform/LiteralNode.java4
-rw-r--r--gnu/xml/transform/MessageNode.java4
-rw-r--r--gnu/xml/transform/NamespaceProxy.java4
-rw-r--r--gnu/xml/transform/NodeNumberNode.java4
-rw-r--r--gnu/xml/transform/NumberNode.java4
-rw-r--r--gnu/xml/transform/OtherwiseNode.java6
-rw-r--r--gnu/xml/transform/ParameterNode.java13
-rw-r--r--gnu/xml/transform/ProcessingInstructionNode.java6
-rw-r--r--gnu/xml/transform/SAXSerializer.java2
-rw-r--r--gnu/xml/transform/SAXTemplatesHandler.java2
-rw-r--r--gnu/xml/transform/SAXTransformerHandler.java4
-rw-r--r--gnu/xml/transform/SortKey.java12
-rw-r--r--gnu/xml/transform/StreamSerializer.java32
-rw-r--r--gnu/xml/transform/StrippingInstruction.java6
-rw-r--r--gnu/xml/transform/Stylesheet.java69
-rw-r--r--gnu/xml/transform/SystemPropertyFunction.java3
-rw-r--r--gnu/xml/transform/Template.java14
-rw-r--r--gnu/xml/transform/TemplateNode.java2
-rw-r--r--gnu/xml/transform/TemplatesImpl.java2
-rw-r--r--gnu/xml/transform/TextNode.java4
-rw-r--r--gnu/xml/transform/TransformerFactoryImpl.java12
-rw-r--r--gnu/xml/transform/TransformerImpl.java6
-rw-r--r--gnu/xml/transform/TransformerOutputProperties.java7
-rw-r--r--gnu/xml/transform/URIResolverEntityResolver.java4
-rw-r--r--gnu/xml/transform/UnparsedEntityUriFunction.java3
-rw-r--r--gnu/xml/transform/ValueOfNode.java8
-rw-r--r--gnu/xml/transform/WhenNode.java8
-rw-r--r--gnu/xml/transform/WithParam.java2
-rw-r--r--gnu/xml/transform/XSLComparator.java96
-rw-r--r--gnu/xml/transform/XSLURIResolver.java9
-rw-r--r--gnu/xml/util/DoParse.java334
-rw-r--r--gnu/xml/util/DomParser.java1022
-rw-r--r--gnu/xml/util/Resolver.java218
-rw-r--r--gnu/xml/util/SAXNullTransformerFactory.java144
-rw-r--r--gnu/xml/util/XCat.java2250
-rw-r--r--gnu/xml/util/XHTMLWriter.java22
-rw-r--r--gnu/xml/util/XMLWriter.java2372
-rw-r--r--gnu/xml/validation/datatype/Annotation.java5
-rw-r--r--gnu/xml/validation/datatype/AnySimpleType.java5
-rw-r--r--gnu/xml/validation/datatype/AnyType.java5
-rw-r--r--gnu/xml/validation/datatype/AnyURIType.java5
-rw-r--r--gnu/xml/validation/datatype/AtomicSimpleType.java7
-rw-r--r--gnu/xml/validation/datatype/Base64BinaryType.java7
-rw-r--r--gnu/xml/validation/datatype/BooleanType.java7
-rw-r--r--gnu/xml/validation/datatype/ByteType.java7
-rw-r--r--gnu/xml/validation/datatype/DateTimeType.java7
-rw-r--r--gnu/xml/validation/datatype/DateType.java7
-rw-r--r--gnu/xml/validation/datatype/DecimalType.java7
-rw-r--r--gnu/xml/validation/datatype/DoubleType.java7
-rw-r--r--gnu/xml/validation/datatype/DurationType.java7
-rw-r--r--gnu/xml/validation/datatype/EntitiesType.java5
-rw-r--r--gnu/xml/validation/datatype/EntityType.java5
-rw-r--r--gnu/xml/validation/datatype/EnumerationFacet.java7
-rw-r--r--gnu/xml/validation/datatype/Facet.java5
-rw-r--r--gnu/xml/validation/datatype/FloatType.java7
-rw-r--r--gnu/xml/validation/datatype/FractionDigitsFacet.java9
-rw-r--r--gnu/xml/validation/datatype/GDayType.java9
-rw-r--r--gnu/xml/validation/datatype/GMonthDayType.java9
-rw-r--r--gnu/xml/validation/datatype/GMonthType.java9
-rw-r--r--gnu/xml/validation/datatype/GYearMonthType.java9
-rw-r--r--gnu/xml/validation/datatype/GYearType.java9
-rw-r--r--gnu/xml/validation/datatype/HexBinaryType.java5
-rw-r--r--gnu/xml/validation/datatype/IDRefType.java5
-rw-r--r--gnu/xml/validation/datatype/IDRefsType.java5
-rw-r--r--gnu/xml/validation/datatype/IDType.java5
-rw-r--r--gnu/xml/validation/datatype/IntType.java7
-rw-r--r--gnu/xml/validation/datatype/IntegerType.java7
-rw-r--r--gnu/xml/validation/datatype/LanguageType.java5
-rw-r--r--gnu/xml/validation/datatype/LengthFacet.java9
-rw-r--r--gnu/xml/validation/datatype/ListSimpleType.java9
-rw-r--r--gnu/xml/validation/datatype/LongType.java7
-rw-r--r--gnu/xml/validation/datatype/MaxExclusiveFacet.java9
-rw-r--r--gnu/xml/validation/datatype/MaxInclusiveFacet.java11
-rw-r--r--gnu/xml/validation/datatype/MaxLengthFacet.java5
-rw-r--r--gnu/xml/validation/datatype/MinExclusiveFacet.java11
-rw-r--r--gnu/xml/validation/datatype/MinInclusiveFacet.java11
-rw-r--r--gnu/xml/validation/datatype/MinLengthFacet.java5
-rw-r--r--gnu/xml/validation/datatype/NCNameType.java5
-rw-r--r--gnu/xml/validation/datatype/NMTokenType.java5
-rw-r--r--gnu/xml/validation/datatype/NMTokensType.java7
-rw-r--r--gnu/xml/validation/datatype/NameType.java5
-rw-r--r--gnu/xml/validation/datatype/NegativeIntegerType.java7
-rw-r--r--gnu/xml/validation/datatype/NonNegativeIntegerType.java7
-rw-r--r--gnu/xml/validation/datatype/NonPositiveIntegerType.java7
-rw-r--r--gnu/xml/validation/datatype/NormalizedStringType.java5
-rw-r--r--gnu/xml/validation/datatype/NotationType.java5
-rw-r--r--gnu/xml/validation/datatype/PatternFacet.java5
-rw-r--r--gnu/xml/validation/datatype/PositiveIntegerType.java7
-rw-r--r--gnu/xml/validation/datatype/QNameType.java5
-rw-r--r--gnu/xml/validation/datatype/ShortType.java7
-rw-r--r--gnu/xml/validation/datatype/SimpleType.java13
-rw-r--r--gnu/xml/validation/datatype/StringType.java3
-rw-r--r--gnu/xml/validation/datatype/TimeType.java9
-rw-r--r--gnu/xml/validation/datatype/TokenType.java5
-rw-r--r--gnu/xml/validation/datatype/TotalDigitsFacet.java9
-rw-r--r--gnu/xml/validation/datatype/Type.java5
-rw-r--r--gnu/xml/validation/datatype/TypeBuilder.java20
-rw-r--r--gnu/xml/validation/datatype/TypeLibrary.java6
-rw-r--r--gnu/xml/validation/datatype/TypeLibraryFactory.java4
-rw-r--r--gnu/xml/validation/datatype/UnionSimpleType.java7
-rw-r--r--gnu/xml/validation/datatype/UnsignedByteType.java7
-rw-r--r--gnu/xml/validation/datatype/UnsignedIntType.java7
-rw-r--r--gnu/xml/validation/datatype/UnsignedLongType.java7
-rw-r--r--gnu/xml/validation/datatype/UnsignedShortType.java7
-rw-r--r--gnu/xml/validation/datatype/WhiteSpaceFacet.java11
-rw-r--r--gnu/xml/validation/relaxng/AnyNameNameClass.java5
-rw-r--r--gnu/xml/validation/relaxng/AttributePattern.java3
-rw-r--r--gnu/xml/validation/relaxng/ChoiceNameClass.java5
-rw-r--r--gnu/xml/validation/relaxng/ChoicePattern.java3
-rw-r--r--gnu/xml/validation/relaxng/DataPattern.java5
-rw-r--r--gnu/xml/validation/relaxng/Define.java5
-rw-r--r--gnu/xml/validation/relaxng/ElementPattern.java3
-rw-r--r--gnu/xml/validation/relaxng/EmptyPattern.java3
-rw-r--r--gnu/xml/validation/relaxng/FullSyntaxBuilder.java24
-rw-r--r--gnu/xml/validation/relaxng/Grammar.java5
-rw-r--r--gnu/xml/validation/relaxng/GrammarException.java4
-rw-r--r--gnu/xml/validation/relaxng/GrammarValidator.java4
-rw-r--r--gnu/xml/validation/relaxng/GroupPattern.java5
-rw-r--r--gnu/xml/validation/relaxng/InterleavePattern.java5
-rw-r--r--gnu/xml/validation/relaxng/ListPattern.java3
-rw-r--r--gnu/xml/validation/relaxng/NSNameNameClass.java5
-rw-r--r--gnu/xml/validation/relaxng/NameClass.java4
-rw-r--r--gnu/xml/validation/relaxng/NameNameClass.java3
-rw-r--r--gnu/xml/validation/relaxng/NotAllowedPattern.java4
-rw-r--r--gnu/xml/validation/relaxng/OneOrMorePattern.java3
-rw-r--r--gnu/xml/validation/relaxng/Param.java3
-rw-r--r--gnu/xml/validation/relaxng/Pattern.java3
-rw-r--r--gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java8
-rw-r--r--gnu/xml/validation/relaxng/RefPattern.java3
-rw-r--r--gnu/xml/validation/relaxng/TextPattern.java3
-rw-r--r--gnu/xml/validation/relaxng/ValuePattern.java5
-rw-r--r--gnu/xml/validation/xmlschema/AnyAttribute.java5
-rw-r--r--gnu/xml/validation/xmlschema/AttributeDeclaration.java9
-rw-r--r--gnu/xml/validation/xmlschema/AttributeUse.java7
-rw-r--r--gnu/xml/validation/xmlschema/ComplexType.java5
-rw-r--r--gnu/xml/validation/xmlschema/ElementDeclaration.java11
-rw-r--r--gnu/xml/validation/xmlschema/Particle.java5
-rw-r--r--gnu/xml/validation/xmlschema/ValidationException.java5
-rw-r--r--gnu/xml/validation/xmlschema/XMLSchema.java7
-rw-r--r--gnu/xml/validation/xmlschema/XMLSchemaAttributeTypeInfo.java5
-rw-r--r--gnu/xml/validation/xmlschema/XMLSchemaBuilder.java21
-rw-r--r--gnu/xml/validation/xmlschema/XMLSchemaElementTypeInfo.java5
-rw-r--r--gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java9
-rw-r--r--gnu/xml/validation/xmlschema/XMLSchemaTypeInfo.java5
-rw-r--r--gnu/xml/validation/xmlschema/XMLSchemaTypeInfoProvider.java5
-rw-r--r--gnu/xml/validation/xmlschema/XMLSchemaValidator.java7
-rw-r--r--gnu/xml/validation/xmlschema/XMLSchemaValidatorHandler.java11
-rw-r--r--gnu/xml/xpath/AndExpr.java4
-rw-r--r--gnu/xml/xpath/ArithmeticExpr.java8
-rw-r--r--gnu/xml/xpath/BooleanFunction.java10
-rw-r--r--gnu/xml/xpath/CeilingFunction.java12
-rw-r--r--gnu/xml/xpath/ConcatFunction.java4
-rw-r--r--gnu/xml/xpath/Constant.java6
-rw-r--r--gnu/xml/xpath/ContainsFunction.java4
-rw-r--r--gnu/xml/xpath/CountFunction.java6
-rw-r--r--gnu/xml/xpath/DocumentOrderComparator.java4
-rw-r--r--gnu/xml/xpath/EqualityExpr.java46
-rw-r--r--gnu/xml/xpath/Expr.java64
-rw-r--r--gnu/xml/xpath/FalseFunction.java4
-rw-r--r--gnu/xml/xpath/FloorFunction.java4
-rw-r--r--gnu/xml/xpath/Function.java3
-rw-r--r--gnu/xml/xpath/FunctionCall.java6
-rw-r--r--gnu/xml/xpath/IdFunction.java4
-rw-r--r--gnu/xml/xpath/LangFunction.java6
-rw-r--r--gnu/xml/xpath/LastFunction.java4
-rw-r--r--gnu/xml/xpath/LocalNameFunction.java6
-rw-r--r--gnu/xml/xpath/NameFunction.java10
-rw-r--r--gnu/xml/xpath/NameTest.java4
-rw-r--r--gnu/xml/xpath/NamespaceTest.java4
-rw-r--r--gnu/xml/xpath/NamespaceUriFunction.java10
-rw-r--r--gnu/xml/xpath/NegativeExpr.java4
-rw-r--r--gnu/xml/xpath/NodeTypeTest.java4
-rw-r--r--gnu/xml/xpath/NormalizeSpaceFunction.java8
-rw-r--r--gnu/xml/xpath/NotFunction.java4
-rw-r--r--gnu/xml/xpath/NumberFunction.java4
-rw-r--r--gnu/xml/xpath/OrExpr.java4
-rw-r--r--gnu/xml/xpath/ParenthesizedExpr.java14
-rw-r--r--gnu/xml/xpath/Path.java4
-rw-r--r--gnu/xml/xpath/Pattern.java3
-rw-r--r--gnu/xml/xpath/PositionFunction.java4
-rw-r--r--gnu/xml/xpath/Predicate.java6
-rw-r--r--gnu/xml/xpath/RelationalExpr.java4
-rw-r--r--gnu/xml/xpath/Root.java4
-rw-r--r--gnu/xml/xpath/RoundFunction.java4
-rw-r--r--gnu/xml/xpath/Selector.java6
-rw-r--r--gnu/xml/xpath/StartsWithFunction.java4
-rw-r--r--gnu/xml/xpath/Steps.java22
-rw-r--r--gnu/xml/xpath/StringFunction.java6
-rw-r--r--gnu/xml/xpath/StringLengthFunction.java6
-rw-r--r--gnu/xml/xpath/SubstringAfterFunction.java4
-rw-r--r--gnu/xml/xpath/SubstringBeforeFunction.java4
-rw-r--r--gnu/xml/xpath/SubstringFunction.java6
-rw-r--r--gnu/xml/xpath/SumFunction.java16
-rw-r--r--gnu/xml/xpath/Test.java2
-rw-r--r--gnu/xml/xpath/TranslateFunction.java10
-rw-r--r--gnu/xml/xpath/TrueFunction.java4
-rw-r--r--gnu/xml/xpath/UnionExpr.java20
-rw-r--r--gnu/xml/xpath/VariableReference.java4
-rw-r--r--gnu/xml/xpath/XPathFactoryImpl.java4
-rw-r--r--gnu/xml/xpath/XPathImpl.java4
-rw-r--r--gnu/xml/xpath/XPathParser.java180
-rw-r--r--gnu/xml/xpath/XPathTokenizer.java8
416 files changed, 9971 insertions, 10207 deletions
diff --git a/gnu/xml/aelfred2/JAXPFactory.java b/gnu/xml/aelfred2/JAXPFactory.java
index 011ca3c6a..094442765 100644
--- a/gnu/xml/aelfred2/JAXPFactory.java
+++ b/gnu/xml/aelfred2/JAXPFactory.java
@@ -1,4 +1,4 @@
-/* JAXPFactory.java --
+/* JAXPFactory.java --
Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,7 +63,7 @@ import javax.xml.parsers.SAXParserFactory;
public final class JAXPFactory
extends SAXParserFactory
{
-
+
private Hashtable flags = new Hashtable();
/**
@@ -86,7 +86,7 @@ public final class JAXPFactory
parser.setFeature(SAXDriver.FEATURE + "validation",
isValidating());
// that makes SAX2 feature flags trump JAXP
-
+
while (e.hasMoreElements())
{
String uri = (String) e.nextElement();
@@ -98,8 +98,8 @@ public final class JAXPFactory
}
// yes, this "feature transfer" mechanism doesn't play well
-
- public void setFeature(String name, boolean value)
+
+ public void setFeature(String name, boolean value)
throws ParserConfigurationException, SAXNotRecognizedException,
SAXNotSupportedException
{
@@ -108,7 +108,7 @@ public final class JAXPFactory
// force "early" detection of errors where possible
// (flags can't necessarily be set before parsing)
new JaxpParser().getXMLReader().setFeature(name, value);
-
+
flags.put(name, Boolean.valueOf(value));
}
catch (SAXNotRecognizedException e)
@@ -127,12 +127,12 @@ public final class JAXPFactory
}
}
- public boolean getFeature(String name)
+ public boolean getFeature(String name)
throws ParserConfigurationException, SAXNotRecognizedException,
SAXNotSupportedException
{
Boolean value = (Boolean) flags.get(name);
-
+
if (value != null)
{
return value.booleanValue();
@@ -159,25 +159,25 @@ public final class JAXPFactory
}
}
}
-
+
private static class JaxpParser
extends SAXParser
{
-
+
private XmlReader ae2 = new XmlReader();
private XMLReaderAdapter parser = null;
-
+
JaxpParser()
{
}
- public void setProperty(String id, Object value)
+ public void setProperty(String id, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException
{
ae2.setProperty(id, value);
}
- public Object getProperty(String id)
+ public Object getProperty(String id)
throws SAXNotRecognizedException, SAXNotSupportedException
{
return ae2.getProperty(id);
@@ -210,7 +210,7 @@ public final class JAXPFactory
throw new Error();
}
}
-
+
public boolean isValidating()
{
try
@@ -222,10 +222,9 @@ public final class JAXPFactory
throw new Error();
}
}
-
+
// TODO isXIncludeAware()
-
+
}
-
-}
+}
diff --git a/gnu/xml/aelfred2/SAXDriver.java b/gnu/xml/aelfred2/SAXDriver.java
index e7c4d5a3f..6ce14707b 100644
--- a/gnu/xml/aelfred2/SAXDriver.java
+++ b/gnu/xml/aelfred2/SAXDriver.java
@@ -1,4 +1,4 @@
-/* SAXDriver.java --
+/* SAXDriver.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,45 +80,45 @@ import org.xml.sax.helpers.NamespaceSupport;
*
* <table border="1" width='100%' cellpadding='3' cellspacing='0'>
* <tr bgcolor='#ccccff'>
- * <th><font size='+1'>Name</font></th>
- * <th><font size='+1'>Notes</font></th></tr>
+ * <th><font size='+1'>Name</font></th>
+ * <th><font size='+1'>Notes</font></th></tr>
*
* <tr><td colspan=2><center><em>Features ... URL prefix is
* <b>http://xml.org/sax/features/</b></em></center></td></tr>
*
* <tr><td>(URL)/external-general-entities</td>
- * <td>Value defaults to <em>true</em></td></tr>
+ * <td>Value defaults to <em>true</em></td></tr>
* <tr><td>(URL)/external-parameter-entities</td>
- * <td>Value defaults to <em>true</em></td></tr>
+ * <td>Value defaults to <em>true</em></td></tr>
* <tr><td>(URL)/is-standalone</td>
- * <td>(PRELIMINARY) Returns true iff the document's parsing
- * has started (some non-error event after <em>startDocument()</em>
- * was reported) and the document's standalone flag is set.</td></tr>
+ * <td>(PRELIMINARY) Returns true iff the document's parsing
+ * has started (some non-error event after <em>startDocument()</em>
+ * was reported) and the document's standalone flag is set.</td></tr>
* <tr><td>(URL)/namespace-prefixes</td>
- * <td>Value defaults to <em>false</em> (but XML 1.0 names are
- * always reported)</td></tr>
+ * <td>Value defaults to <em>false</em> (but XML 1.0 names are
+ * always reported)</td></tr>
* <tr><td>(URL)/lexical-handler/parameter-entities</td>
- * <td>Value is fixed at <em>true</em></td></tr>
+ * <td>Value is fixed at <em>true</em></td></tr>
* <tr><td>(URL)/namespaces</td>
- * <td>Value defaults to <em>true</em></td></tr>
+ * <td>Value defaults to <em>true</em></td></tr>
* <tr><td>(URL)/resolve-dtd-uris</td>
- * <td>(PRELIMINARY) Value defaults to <em>true</em></td></tr>
+ * <td>(PRELIMINARY) Value defaults to <em>true</em></td></tr>
* <tr><td>(URL)/string-interning</td>
- * <td>Value is fixed at <em>true</em></td></tr>
+ * <td>Value is fixed at <em>true</em></td></tr>
* <tr><td>(URL)/use-attributes2</td>
- * <td>(PRELIMINARY) Value is fixed at <em>true</em></td></tr>
+ * <td>(PRELIMINARY) Value is fixed at <em>true</em></td></tr>
* <tr><td>(URL)/use-entity-resolver2</td>
- * <td>(PRELIMINARY) Value defaults to <em>true</em></td></tr>
+ * <td>(PRELIMINARY) Value defaults to <em>true</em></td></tr>
* <tr><td>(URL)/validation</td>
- * <td>Value is fixed at <em>false</em></td></tr>
+ * <td>Value is fixed at <em>false</em></td></tr>
*
* <tr><td colspan=2><center><em>Handler Properties ... URL prefix is
* <b>http://xml.org/sax/properties/</b></em></center></td></tr>
*
* <tr><td>(URL)/declaration-handler</td>
- * <td>A declaration handler may be provided. </td></tr>
+ * <td>A declaration handler may be provided. </td></tr>
* <tr><td>(URL)/lexical-handler</td>
- * <td>A lexical handler may be provided. </td></tr>
+ * <td>A lexical handler may be provided. </td></tr>
* </table>
*
* <p>This parser currently implements the SAX1 Parser API, but
@@ -131,10 +131,10 @@ import org.xml.sax.helpers.NamespaceSupport;
final public class SAXDriver
implements Locator, Attributes2, XMLReader, Parser, AttributeList
{
-
+
private final DefaultHandler2 base = new DefaultHandler2();
private XmlParser parser;
-
+
private EntityResolver entityResolver = base;
private EntityResolver2 resolver2 = null;
private ContentHandler contentHandler = base;
@@ -142,28 +142,28 @@ final public class SAXDriver
private ErrorHandler errorHandler = base;
private DeclHandler declHandler = base;
private LexicalHandler lexicalHandler = base;
-
+
private String elementName;
private Stack entityStack;
-
+
// one vector (of object/struct): faster, smaller
private List attributesList;
-
+
private boolean namespaces = true;
private boolean xmlNames = false;
private boolean extGE = true;
private boolean extPE = true;
private boolean resolveAll = true;
private boolean useResolver2 = true;
-
+
// package private to allow (read-only) access in XmlParser
boolean stringInterning = true;
-
+
private int attributeCount;
private boolean attributes;
private String[] nsTemp;
private NamespaceSupport prefixStack;
-
+
//
// Constructor.
//
@@ -355,12 +355,12 @@ final public class SAXDriver
throw new IllegalStateException();
}
parser.setHandler(this);
-
+
try
{
Reader r = source.getCharacterStream();
InputStream in = source.getByteStream();
-
+
parser.doParse(source.getSystemId(),
source.getPublicId(),
r,
@@ -430,7 +430,7 @@ final public class SAXDriver
{
return extPE;
}
-
+
// element/attribute names are as written in document; no mangling
if ((FEATURE + "namespace-prefixes").equals(featureId))
{
@@ -454,15 +454,15 @@ final public class SAXDriver
{
return stringInterning;
}
-
+
// EXTENSIONS 1.1
-
+
// always returns isSpecified info
if ((FEATURE + "use-attributes2").equals(featureId))
{
return true;
}
-
+
// meaningful between startDocument/endDocument
if ((FEATURE + "is-standalone").equals(featureId))
{
@@ -484,7 +484,7 @@ final public class SAXDriver
{
return useResolver2;
}
-
+
throw new SAXNotRecognizedException(featureId);
}
@@ -518,7 +518,7 @@ final public class SAXDriver
{
return (lexicalHandler == base) ? null : lexicalHandler;
}
-
+
// unknown properties
throw new SAXNotRecognizedException(propertyId);
}
@@ -531,10 +531,10 @@ final public class SAXDriver
throws SAXNotRecognizedException, SAXNotSupportedException
{
boolean state;
-
+
// Features with a defined value, we just change it if we can.
state = getFeature (featureId);
-
+
if (state == value)
{
return;
@@ -601,9 +601,9 @@ final public class SAXDriver
{
// see if the property is recognized
getProperty(propertyId);
-
+
// Properties with a defined value, we just change it if we can.
-
+
if ((PROPERTY + "declaration-handler").equals(propertyId))
{
if (value == null)
@@ -620,7 +620,7 @@ final public class SAXDriver
}
return ;
}
-
+
if ((PROPERTY + "lexical-handler").equals(propertyId))
{
if (value == null)
@@ -637,7 +637,7 @@ final public class SAXDriver
}
return;
}
-
+
throw new SAXNotSupportedException(propertyId);
}
@@ -676,7 +676,7 @@ final public class SAXDriver
throws SAXException, IOException
{
InputSource source;
-
+
// external entities might be skipped
if (isPE && !extPE)
{
@@ -724,7 +724,7 @@ final public class SAXDriver
// FIXME normalize system IDs -- when?
// - Convert to UTF-8
// - Map reserved and non-ASCII characters to %HH
-
+
try
{
if (baseURI == null)
@@ -749,7 +749,7 @@ final public class SAXDriver
{
throw e;
}
-
+
// sometimes sysids for notations or unparsed entities
// aren't really URIs...
warn("Can't absolutize SYSTEM id: " + e.getMessage());
@@ -800,15 +800,15 @@ final public class SAXDriver
throws SAXException
{
lexicalHandler.startDTD(name, publicId, systemId);
-
+
// ... the "name" is a declaration and should be given
// to the DeclHandler (but sax2 doesn't).
-
+
// the IDs for the external subset are lexical details,
// as are the contents of the internal subset; but sax2
// doesn't provide the internal subset "pre-parse"
}
-
+
void notationDecl(String name, String publicId, String systemId,
String baseUri)
throws SAXException
@@ -857,7 +857,7 @@ final public class SAXDriver
{
int index = uri.indexOf(':');
- // many versions of nwalsh docbook stylesheets
+ // many versions of nwalsh docbook stylesheets
// have bogus URLs; so this can't be an error...
if (index < 1 && uri.length() != 0)
{
@@ -866,7 +866,7 @@ final public class SAXDriver
// FIXME: char [0] must be ascii alpha; chars [1..index]
// must be ascii alphanumeric or in "+-." [RFC 2396]
-
+
//Namespace Constraints
//name for xml prefix must be http://www.w3.org/XML/1998/namespace
boolean prefixEquality = prefix.equals("xml");
@@ -876,13 +876,13 @@ final public class SAXDriver
fatal("xml is by definition bound to the namespace name " +
"http://www.w3.org/XML/1998/namespace");
}
-
+
//xmlns prefix declaration is illegal but xml prefix declaration is llegal...
if (prefixEquality && uriEquality)
{
return;
}
-
+
//name for xmlns prefix must be http://www.w3.org/2000/xmlns/
prefixEquality = prefix.equals("xmlns");
uriEquality = uri.equals("http://www.w3.org/2000/xmlns/");
@@ -891,14 +891,14 @@ final public class SAXDriver
fatal("http://www.w3.org/2000/xmlns/ is by definition bound" +
" to prefix xmlns");
}
-
+
//even if the uri is http://www.w3.org/2000/xmlns/
// it is illegal to declare it
if (prefixEquality && uriEquality)
{
fatal ("declaring the xmlns prefix is illegal");
}
-
+
uri = uri.intern();
prefixStack.declarePrefix(prefix, uri);
contentHandler.startPrefixMapping(prefix, uri);
@@ -915,13 +915,13 @@ final public class SAXDriver
prefixStack.pushContext();
}
}
-
+
// process namespace decls immediately;
// then maybe forget this as an attribute
if (namespaces)
{
int index;
-
+
// default NS declaration?
if (stringInterning)
{
@@ -938,11 +938,11 @@ final public class SAXDriver
&& qname.startsWith("xmlns"))
{
String prefix = qname.substring(6);
-
+
if (prefix.equals(""))
{
fatal("missing prefix " +
- "in namespace declaration attribute");
+ "in namespace declaration attribute");
}
if (value.length() == 0)
{
@@ -974,7 +974,7 @@ final public class SAXDriver
&& qname.startsWith("xmlns"))
{
String prefix = qname.substring(6);
-
+
if (value.length() == 0)
{
verror("missing URI in namespace decl attribute: "
@@ -993,12 +993,12 @@ final public class SAXDriver
}
// remember this attribute ...
attributeCount++;
-
+
// attribute type comes from querying parser's DTD records
attributesList.add(new Attribute(qname, value, isSpecified));
-
+
}
-
+
void startElement(String elname)
throws SAXException
{
@@ -1016,7 +1016,7 @@ final public class SAXDriver
// String.hashCode() (1.5%) and about 1.3% each for pushing
// the context, and two chunks of name processing.
//
-
+
if (!attributes)
{
if (namespaces)
@@ -1026,7 +1026,7 @@ final public class SAXDriver
}
else if (namespaces)
{
-
+
// now we can patch up namespace refs; we saw all the
// declarations, so now we'll do the Right Thing
Iterator itt = attributesList.iterator();
@@ -1035,7 +1035,7 @@ final public class SAXDriver
Attribute attribute = (Attribute) itt.next();
String qname = attribute.name;
int index;
-
+
// default NS declaration?
if (stringInterning)
{
@@ -1059,13 +1059,13 @@ final public class SAXDriver
"character are invalid");
}
index = qname.indexOf(':');
-
+
// NS prefix declaration?
if (index == 5 && qname.startsWith("xmlns"))
{
continue;
}
-
+
// it's not a NS decl; patch namespace info items
if (prefixStack.processName(qname, nsTemp, true) == null)
{
@@ -1078,7 +1078,7 @@ final public class SAXDriver
}
}
}
-
+
// save element name so attribute callbacks work
elementName = elname;
if (namespaces)
@@ -1095,7 +1095,7 @@ final public class SAXDriver
handler.startElement("", "", elname, this);
}
// elementName = null;
-
+
// elements with no attributes are pretty common!
if (attributes)
{
@@ -1104,7 +1104,7 @@ final public class SAXDriver
attributes = false;
}
}
-
+
void endElement(String elname)
throws SAXException
{
@@ -1117,9 +1117,9 @@ final public class SAXDriver
}
prefixStack.processName(elname, nsTemp, false);
handler.endElement(nsTemp[0], nsTemp[1], elname);
-
+
Enumeration prefixes = prefixStack.getDeclaredPrefixes();
-
+
while (prefixes.hasMoreElements())
{
handler.endPrefixMapping((String) prefixes.nextElement());
@@ -1170,7 +1170,7 @@ final public class SAXDriver
throws SAXException
{
SAXParseException fatal;
-
+
fatal = new SAXParseException(message, this);
errorHandler.fatalError(fatal);
@@ -1184,16 +1184,16 @@ final public class SAXDriver
throws SAXException
{
SAXParseException err;
-
+
err = new SAXParseException(message, this);
errorHandler.error(err);
}
-
+
void warn(String message)
throws SAXException
{
SAXParseException err;
-
+
err = new SAXParseException(message, this);
errorHandler.warning(err);
}
@@ -1307,7 +1307,7 @@ final public class SAXDriver
public int getIndex(String uri, String local)
{
int length = getLength();
-
+
for (int i = 0; i < length; i++)
{
if (!getURI(i).equals(uri))
@@ -1328,7 +1328,7 @@ final public class SAXDriver
public int getIndex(String xmlName)
{
int length = getLength();
-
+
for (int i = 0; i < length; i++)
{
if (getQName(i).equals(xmlName))
@@ -1345,7 +1345,7 @@ final public class SAXDriver
public String getType(String uri, String local)
{
int index = getIndex(uri, local);
-
+
if (index < 0)
{
return null;
@@ -1360,7 +1360,7 @@ final public class SAXDriver
public String getType(String xmlName)
{
int index = getIndex(xmlName);
-
+
if (index < 0)
{
return null;
@@ -1374,7 +1374,7 @@ final public class SAXDriver
public String getValue(String uri, String local)
{
int index = getIndex(uri, local);
-
+
if (index < 0)
{
return null;
@@ -1389,7 +1389,7 @@ final public class SAXDriver
public String getValue(String xmlName)
{
int index = getIndex(xmlName);
-
+
if (index < 0)
{
return null;
@@ -1404,7 +1404,7 @@ final public class SAXDriver
/** @return false unless the attribute was declared in the DTD.
* @throws java.lang.ArrayIndexOutOfBoundsException
* When the supplied index does not identify an attribute.
- */
+ */
public boolean isDeclared(int index)
{
if (index < 0 || index >= attributeCount)
@@ -1513,7 +1513,7 @@ final public class SAXDriver
private static class Adapter
implements ContentHandler
{
-
+
private DocumentHandler docHandler;
Adapter(DocumentHandler dh)
@@ -1525,19 +1525,19 @@ final public class SAXDriver
{
docHandler.setDocumentLocator(l);
}
-
+
public void startDocument()
throws SAXException
{
docHandler.startDocument();
}
-
+
public void processingInstruction(String target, String data)
throws SAXException
{
docHandler.processingInstruction(target, data);
}
-
+
public void startPrefixMapping(String prefix, String uri)
{
/* ignored */
@@ -1589,13 +1589,13 @@ final public class SAXDriver
private static class Attribute
{
-
+
String name;
String value;
String nameSpace;
String localName;
boolean specified;
-
+
Attribute(String name, String value, boolean specified)
{
this.name = name;
@@ -1603,7 +1603,7 @@ final public class SAXDriver
this.nameSpace = "";
this.specified = specified;
}
-
+
}
}
diff --git a/gnu/xml/aelfred2/XmlParser.java b/gnu/xml/aelfred2/XmlParser.java
index c0fd8027c..813593d93 100644
--- a/gnu/xml/aelfred2/XmlParser.java
+++ b/gnu/xml/aelfred2/XmlParser.java
@@ -1,4 +1,4 @@
-/* XmlParser.java --
+/* XmlParser.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -81,7 +81,7 @@ import org.xml.sax.SAXException;
* internal parser interfaces are subject to change.
*
* @author Written by David Megginson &lt;dmeggins@microstar.com&gt;
- * (version 1.2a with bugfixes)
+ * (version 1.2a with bugfixes)
* @author Updated by David Brownell &lt;dbrownell@users.sourceforge.net&gt;
* @see SAXDriver
*/
@@ -94,74 +94,74 @@ final class XmlParser
////////////////////////////////////////////////////////////////////////
// Constants.
////////////////////////////////////////////////////////////////////////
-
+
//
// Constants for element content type.
//
-
+
/**
* Constant: an element has not been declared.
* @see #getElementContentType
*/
public final static int CONTENT_UNDECLARED = 0;
-
+
/**
* Constant: the element has a content model of ANY.
* @see #getElementContentType
*/
public final static int CONTENT_ANY = 1;
-
+
/**
* Constant: the element has declared content of EMPTY.
* @see #getElementContentType
*/
public final static int CONTENT_EMPTY = 2;
-
+
/**
* Constant: the element has mixed content.
* @see #getElementContentType
*/
public final static int CONTENT_MIXED = 3;
-
+
/**
* Constant: the element has element content.
* @see #getElementContentType
*/
public final static int CONTENT_ELEMENTS = 4;
-
-
+
+
//
// Constants for the entity type.
//
-
+
/**
* Constant: the entity has not been declared.
* @see #getEntityType
*/
public final static int ENTITY_UNDECLARED = 0;
-
+
/**
* Constant: the entity is internal.
* @see #getEntityType
*/
public final static int ENTITY_INTERNAL = 1;
-
+
/**
* Constant: the entity is external, non-parsable data.
* @see #getEntityType
*/
public final static int ENTITY_NDATA = 2;
-
+
/**
* Constant: the entity is external XML data.
* @see #getEntityType
*/
public final static int ENTITY_TEXT = 3;
-
+
//
// Attribute type constants are interned literal strings.
//
-
+
//
// Constants for supported encodings. "external" is just a flag.
//
@@ -175,43 +175,43 @@ final class XmlParser
private final static int ENCODING_UCS_4_2143 = 7;
private final static int ENCODING_UCS_4_3412 = 8;
private final static int ENCODING_ASCII = 9;
-
+
//
// Constants for attribute default value.
//
-
+
/**
* Constant: the attribute is not declared.
* @see #getAttributeDefaultValueType
*/
public final static int ATTRIBUTE_DEFAULT_UNDECLARED = 30;
-
+
/**
* Constant: the attribute has a literal default value specified.
* @see #getAttributeDefaultValueType
* @see #getAttributeDefaultValue
*/
public final static int ATTRIBUTE_DEFAULT_SPECIFIED = 31;
-
+
/**
* Constant: the attribute was declared #IMPLIED.
* @see #getAttributeDefaultValueType
*/
public final static int ATTRIBUTE_DEFAULT_IMPLIED = 32;
-
+
/**
* Constant: the attribute was declared #REQUIRED.
* @see #getAttributeDefaultValueType
*/
public final static int ATTRIBUTE_DEFAULT_REQUIRED = 33;
-
+
/**
* Constant: the attribute was declared #FIXED.
* @see #getAttributeDefaultValueType
* @see #getAttributeDefaultValue
*/
public final static int ATTRIBUTE_DEFAULT_FIXED = 34;
-
+
//
// Constants for input.
//
@@ -219,7 +219,7 @@ final class XmlParser
private final static int INPUT_INTERNAL = 1;
private final static int INPUT_STREAM = 3;
private final static int INPUT_READER = 5;
-
+
//
// Flags for reading literals.
//
@@ -227,7 +227,7 @@ final class XmlParser
private final static int LIT_ENTITY_REF = 2;
// normalize this value (space chars) (attributes, public ids)
private final static int LIT_NORMALIZE = 4;
- // literal is an attribute value
+ // literal is an attribute value
private final static int LIT_ATTRIBUTE = 8;
// don't expand parameter entities
private final static int LIT_DISABLE_PE = 16;
@@ -235,30 +235,30 @@ final class XmlParser
private final static int LIT_DISABLE_CREF = 32;
// don't parse general entity refs
private final static int LIT_DISABLE_EREF = 64;
- // literal is a public ID value
+ // literal is a public ID value
private final static int LIT_PUBID = 256;
-
+
//
// Flags affecting PE handling in DTDs (if expandPE is true).
// PEs expand with space padding, except inside literals.
//
private final static int CONTEXT_NORMAL = 0;
private final static int CONTEXT_LITERAL = 1;
-
+
// Emit warnings for relative URIs with no base URI.
static boolean uriWarnings;
static
{
String key = "gnu.xml.aelfred2.XmlParser.uriWarnings";
GetPropertyAction a = new GetPropertyAction(key);
- uriWarnings = "true".equals(AccessController.doPrivileged(a));
+ uriWarnings = "true".equals(AccessController.doPrivileged(a));
}
-
+
//
// The current XML handler interface.
//
private SAXDriver handler;
-
+
//
// I/O information.
//
@@ -272,7 +272,7 @@ final class XmlParser
private int encoding; // current character encoding
private int currentByteCount; // bytes read from current source
private InputSource scratch; // temporary
-
+
//
// Buffers for decoded but unparsed character input.
//
@@ -280,33 +280,33 @@ final class XmlParser
private int readBufferPos;
private int readBufferLength;
private int readBufferOverflow; // overflow from last data chunk.
-
+
//
// Buffer for undecoded raw byte input.
//
private final static int READ_BUFFER_MAX = 16384;
private byte[] rawReadBuffer;
-
-
+
+
//
// Buffer for attribute values, char refs, DTD stuff.
//
private static int DATA_BUFFER_INITIAL = 4096;
private char[] dataBuffer;
private int dataBufferPos;
-
+
//
// Buffer for parsed names.
//
private static int NAME_BUFFER_INITIAL = 1024;
private char[] nameBuffer;
private int nameBufferPos;
-
+
//
// Save any standalone flag
//
private boolean docIsStandalone;
-
+
//
// Hashtables for DTD information on elements, entities, and notations.
// Populated until we start ignoring decls (because of skipping a PE)
@@ -315,18 +315,18 @@ final class XmlParser
private HashMap entityInfo;
private HashMap notationInfo;
private boolean skippedPE;
-
+
//
// Element type currently in force.
//
private String currentElement;
private int currentElementContent;
-
+
//
// Stack of entity names, to detect recursion.
//
private LinkedList entityStack;
-
+
//
// PE expansion is enabled in most chunks of the DTD, not all.
// When it's enabled, literals are treated differently.
@@ -334,14 +334,14 @@ final class XmlParser
private boolean inLiteral;
private boolean expandPE;
private boolean peIsError;
-
+
//
// can't report entity expansion inside two constructs:
// - attribute expansions (internal entities only)
// - markup declarations (parameter entities only)
//
private boolean doReport;
-
+
//
// Symbol table, for caching interned names.
//
@@ -358,38 +358,38 @@ final class XmlParser
// 32 bit hardware.
//
private final static int SYMBOL_TABLE_LENGTH = 2039;
-
+
private Object[][] symbolTable;
-
+
//
// Hash table of attributes found in current start tag.
//
private String[] tagAttributes;
private int tagAttributePos;
-
+
//
// Utility flag: have we noticed a CR while reading the last
// data chunk? If so, we will have to go back and normalise
// CR or CR/LF line ends.
//
private boolean sawCR;
-
+
//
// Utility flag: are we in CDATA? If so, whitespace isn't ignorable.
- //
+ //
private boolean inCDATA;
-
+
//
// Xml version.
- //
- private static final int XML_10 = 0;
- private static final int XML_11 = 1;
+ //
+ private static final int XML_10 = 0;
+ private static final int XML_11 = 1;
private int xmlVersion = XML_10;
//////////////////////////////////////////////////////////////////////
// Constructors.
////////////////////////////////////////////////////////////////////////
-
+
/**
* Construct a new parser with no associated handler.
* @see #setHandler
@@ -422,14 +422,14 @@ final class XmlParser
* which MUST NOT REUSE the parser (just null it).
*
* @param systemId Absolute URI of the document; should never be null,
- * but may be so iff a reader <em>or</em> a stream is provided.
+ * but may be so iff a reader <em>or</em> a stream is provided.
* @param publicId The public identifier of the document, or null.
* @param reader A character stream; must be null if stream isn't.
* @param stream A byte input stream; must be null if reader isn't.
* @param encoding The suggested encoding, or null if unknown.
* @exception java.lang.Exception Basically SAXException or IOException
*/
- // package private
+ // package private
void doParse(String systemId, String publicId, Reader reader,
InputStream stream, String encoding)
throws Exception
@@ -459,7 +459,7 @@ final class XmlParser
// default baseURI: null
new ExternalIdentifiers(publicId, systemId, null),
reader, stream, encoding, false);
-
+
parseDocument();
}
catch (EOFException e)
@@ -509,7 +509,7 @@ final class XmlParser
//////////////////////////////////////////////////////////////////////
// Error reporting.
//////////////////////////////////////////////////////////////////////
-
+
/**
* Report an error.
* @param message The error message.
@@ -529,7 +529,7 @@ final class XmlParser
message = message + " (expected \"" + textExpected + "\")";
}
handler.fatal(message);
-
+
// "can't happen"
throw new SAXException(message);
}
@@ -581,7 +581,7 @@ final class XmlParser
{ // added by MHK
error("premature end of file", "[EOF]", null);
}
-
+
try
{
parseMisc(); //skip all white, PIs, and comments
@@ -593,7 +593,7 @@ final class XmlParser
return;
}
}
-
+
static final char[] startDelimComment = { '<', '!', '-', '-' };
static final char[] endDelimComment = { '-', '-' };
@@ -609,7 +609,7 @@ final class XmlParser
{
char c;
boolean saved = expandPE;
-
+
expandPE = false;
parseUntil(endDelimComment);
require('>');
@@ -617,7 +617,7 @@ final class XmlParser
handler.comment(dataBuffer, 0, dataBufferPos);
dataBufferPos = 0;
}
-
+
static final char[] startDelimPI = { '<', '?' };
static final char[] endDelimPI = { '?', '>' };
@@ -636,7 +636,7 @@ final class XmlParser
{
String name;
boolean saved = expandPE;
-
+
expandPE = false;
name = readNmtoken(true);
//NE08
@@ -657,7 +657,7 @@ final class XmlParser
expandPE = saved;
handler.processingInstruction(name, dataBufferToString());
}
-
+
static final char[] endDelimCDATA = { ']', ']', '>' };
private boolean isDirtyCurrentElement;
@@ -756,7 +756,7 @@ final class XmlParser
String standalone = null;
int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
String inputEncoding = null;
-
+
switch (this.encoding)
{
case ENCODING_EXTERNAL:
@@ -773,7 +773,7 @@ final class XmlParser
inputEncoding = "UTF-16LE";
break;
}
-
+
// Read the version.
require("version");
parseEq();
@@ -796,7 +796,7 @@ final class XmlParser
}
// Try reading an encoding declaration.
boolean white = tryWhitespace();
-
+
if (tryRead("encoding"))
{
if (!white)
@@ -810,7 +810,7 @@ final class XmlParser
setupDecoding(encodingName);
}
}
-
+
// Try reading a standalone declaration
if (encodingName != null)
{
@@ -869,13 +869,13 @@ final class XmlParser
String version;
parseEq();
checkLegalVersion(version = readLiteral(flags));
-
+
if (version.equals("1.1"))
{
if (xmlVersion == XML_10)
{
error("external subset has later version number.", "1.0",
- version);
+ version);
}
handler.warn("expected XML version 1.0, not: " + version);
xmlVersion = XML_11;
@@ -886,7 +886,7 @@ final class XmlParser
}
requireWhitespace();
}
-
+
// Read the encoding.
require("encoding");
parseEq();
@@ -897,7 +897,7 @@ final class XmlParser
}
skipWhitespace();
require("?>");
-
+
return encodingName;
}
@@ -921,14 +921,14 @@ final class XmlParser
throws SAXException, IOException
{
encodingName = encodingName.toUpperCase();
-
+
// ENCODING_EXTERNAL indicates an encoding that wasn't
// autodetected ... we can use builtin decoders, or
// ones from the JVM (InputStreamReader).
-
+
// Otherwise we can only tweak what was autodetected, and
// only for single byte (ASCII derived) builtin encodings.
-
+
// ASCII-derived encodings
if (encoding == ENCODING_UTF_8 || encoding == ENCODING_EXTERNAL)
{
@@ -959,7 +959,7 @@ final class XmlParser
// else fallthrough ...
// it's ASCII-ish and something other than a builtin
}
-
+
// Unicode and such
if (encoding == ENCODING_UCS_2_12 || encoding == ENCODING_UCS_2_21)
{
@@ -972,7 +972,7 @@ final class XmlParser
}
return;
}
-
+
// four byte encodings
if (encoding == ENCODING_UCS_4_1234
|| encoding == ENCODING_UCS_4_4321
@@ -987,11 +987,11 @@ final class XmlParser
}
return;
}
-
+
// assert encoding == ENCODING_EXTERNAL
// if (encoding != ENCODING_EXTERNAL)
// throw new RuntimeException ("encoding = " + encoding);
-
+
if (encodingName.equals("UTF-16BE"))
{
encoding = ENCODING_UCS_2_12;
@@ -1002,22 +1002,22 @@ final class XmlParser
encoding = ENCODING_UCS_2_21;
return;
}
-
+
// We couldn't use the builtin decoders at all. But we can try to
// create a reader, since we haven't messed up buffering. Tweak
// the encoding name if necessary.
-
+
if (encodingName.equals("UTF-16")
|| encodingName.equals("ISO-10646-UCS-2"))
{
encodingName = "Unicode";
}
// Ignoring all the EBCDIC aliases here
-
+
reader = new InputStreamReader(is, encodingName);
sourceType = INPUT_READER;
}
-
+
/**
* Parse miscellaneous markup outside the document element and DOCTYPE
* declaration.
@@ -1070,12 +1070,12 @@ final class XmlParser
// report (a) declaration of name, (b) lexical info (ids)
handler.doctypeDecl(rootName, ids.publicId, ids.systemId);
-
+
// Internal subset is parsed first, if present
skipWhitespace();
if (tryRead('['))
{
-
+
// loop until the subset ends
while (true)
{
@@ -1097,10 +1097,10 @@ final class XmlParser
}
skipWhitespace();
require('>');
-
+
// Read the external subset, if any
InputSource subset;
-
+
if (ids.systemId == null)
{
subset = handler.getExternalSubset(rootName,
@@ -1113,7 +1113,7 @@ final class XmlParser
if (ids.systemId != null || subset != null)
{
pushString(null, ">");
-
+
// NOTE: [dtd] is so we say what SAX2 expects,
// though it's misleading (subset, not entire dtd)
if (ids.systemId != null)
@@ -1132,7 +1132,7 @@ final class XmlParser
subset.getEncoding(),
false);
}
-
+
// Loop until we end up back at '>'
while (true)
{
@@ -1150,20 +1150,20 @@ final class XmlParser
expandPE = false;
}
}
-
+
// the ">" string isn't popped yet
if (inputStack.size() != 1)
{
error("external subset has unmatched '>'");
}
}
-
+
// done dtd
handler.endDoctype();
expandPE = false;
doReport = true;
}
-
+
/**
* Parse a markup declaration in the internal or external DTD subset.
* <pre>
@@ -1185,7 +1185,7 @@ final class XmlParser
require('<');
unread('<');
expandPE = false;
-
+
if (tryRead("<!ELEMENT"))
{
saved = readBuffer;
@@ -1246,7 +1246,7 @@ final class XmlParser
handler.verror("Illegal Declaration/PE nesting");
}
}
-
+
/**
* Parse an element, with its tags.
* <pre>
@@ -1270,10 +1270,10 @@ final class XmlParser
// This is the (global) counter for the
// array of specified attributes.
tagAttributePos = 0;
-
+
// Read the element type name.
gi = readNmtoken(true);
-
+
// If we saw no DTD, and this is the document root element,
// let the application modify the input stream by providing one.
if (maybeGetSubset)
@@ -1284,11 +1284,11 @@ final class XmlParser
{
String publicId = subset.getPublicId();
String systemId = subset.getSystemId();
-
+
handler.warn("modifying document by adding DTD");
handler.doctypeDecl(gi, publicId, systemId);
pushString(null, ">");
-
+
// NOTE: [dtd] is so we say what SAX2 expects,
// though it's misleading (subset, not entire dtd)
pushURL(true, "[dtd]",
@@ -1297,7 +1297,7 @@ final class XmlParser
subset.getByteStream(),
subset.getEncoding(),
false);
-
+
// Loop until we end up back at '>'
while (true)
{
@@ -1315,17 +1315,17 @@ final class XmlParser
expandPE = false;
}
}
-
+
// the ">" string isn't popped yet
if (inputStack.size() != 1)
{
error("external subset has unmatched '>'");
}
-
+
handler.endDoctype();
}
}
-
+
// Determine the current content type.
currentElement = gi;
element = (ElementDecl) elementInfo.get(gi);
@@ -1346,7 +1346,7 @@ final class XmlParser
white = tryWhitespace();
c = readCh();
}
-
+
// Supply any defaulted attributes.
Iterator atts = declaredAttributes(element);
if (atts != null)
@@ -1366,7 +1366,7 @@ loop:
}
// ... or has a default
String value = getAttributeDefaultValue(gi, aname);
-
+
if (value == null)
{
continue;
@@ -1395,7 +1395,7 @@ loop:
currentElement = oldElement;
currentElementContent = oldElementContent;
}
-
+
/**
* Parse an attribute assignment.
* <pre>
@@ -1411,11 +1411,11 @@ loop:
String type;
String value;
int flags = LIT_ATTRIBUTE | LIT_ENTITY_REF;
-
+
// Read the attribute name.
aname = readNmtoken(true);
type = getAttributeType(name, aname);
-
+
// Parse '='
parseEq();
@@ -1457,7 +1457,7 @@ loop:
// attribute.
handler.attribute(aname, value, true);
dataBufferPos = 0;
-
+
// Note that the attribute has been
// specified.
if (tagAttributePos == tagAttributes.length)
@@ -1501,7 +1501,7 @@ loop:
// not re-reporting any SAXException re bogus end tags,
// even though that diagnostic might be clearer ...
}
-
+
/**
* Parse the content of an element.
* <pre>
@@ -1515,7 +1515,7 @@ loop:
throws Exception
{
char c;
-
+
while (true)
{
// consume characters (or ignorable whitspace) until delimiter
@@ -1538,7 +1538,7 @@ loop:
}
isDirtyCurrentElement = true;
break;
-
+
case '<': // Found "<"
dataBufferFlush();
c = readCh();
@@ -1567,17 +1567,17 @@ loop:
break;
}
break;
-
+
case '?': // Found "<?"
isDirtyCurrentElement = false;
parsePI();
break;
-
+
case '/': // Found "</"
isDirtyCurrentElement = false;
parseETag();
return;
-
+
default: // Found "<" followed by something else
isDirtyCurrentElement = false;
unread(c);
@@ -1587,7 +1587,7 @@ loop:
}
}
}
-
+
/**
* Parse an element type declaration.
* <pre>
@@ -1599,7 +1599,7 @@ loop:
throws Exception
{
String name;
-
+
requireWhitespace();
// Read the element type name.
name = readNmtoken(true);
@@ -1607,7 +1607,7 @@ loop:
requireWhitespace();
// Read the content model.
parseContentspec(name);
-
+
skipWhitespace();
require('>');
}
@@ -1643,8 +1643,8 @@ loop:
else
{
String model;
- char[] saved;
-
+ char[] saved;
+
require('(');
saved = readBuffer;
dataBufferAppend('(');
@@ -1668,7 +1668,7 @@ loop:
}
}
}
-
+
/**
* Parse an element-content model.
* <pre>
@@ -1686,11 +1686,11 @@ loop:
{
char c;
char sep;
-
+
// Parse the first content particle
skipWhitespace();
parseCp();
-
+
// Check for end or for a separator.
skipWhitespace();
c = readCh();
@@ -1702,7 +1702,7 @@ loop:
{
handler.verror("Illegal Group/PE nesting");
}
-
+
dataBufferAppend(')');
c = readCh();
switch (c)
@@ -1725,7 +1725,7 @@ loop:
error("bad separator in content model", c, null);
return;
}
-
+
// Parse the rest of the content model.
while (true)
{
@@ -1740,7 +1740,7 @@ loop:
{
handler.verror("Illegal Group/PE nesting");
}
-
+
dataBufferAppend(')');
break;
}
@@ -1754,7 +1754,7 @@ loop:
dataBufferAppend(c);
}
}
-
+
// Check for the occurrence indicator.
c = readCh();
switch (c)
@@ -1769,7 +1769,7 @@ loop:
return;
}
}
-
+
/**
* Parse a content particle.
* <pre>
@@ -1823,12 +1823,12 @@ loop:
{
handler.verror("Illegal Group/PE nesting");
}
-
+
dataBufferAppend(")*");
tryRead('*');
return;
}
-
+
// Parse mixed content.
skipWhitespace();
while (!tryRead(")"))
@@ -1839,17 +1839,17 @@ loop:
dataBufferAppend(readNmtoken(true));
skipWhitespace();
}
-
+
// VC: Proper Group/PE Nesting
if (readBuffer != saved)
{
handler.verror("Illegal Group/PE nesting");
}
-
+
require('*');
dataBufferAppend(")*");
}
-
+
/**
* Parse an attribute list declaration.
* <pre>
@@ -1861,7 +1861,7 @@ loop:
throws Exception
{
String elementName;
-
+
requireWhitespace();
elementName = readNmtoken(true);
boolean white = tryWhitespace();
@@ -1875,7 +1875,7 @@ loop:
white = tryWhitespace();
}
}
-
+
/**
* Parse a single attribute definition.
* <pre>
@@ -1888,7 +1888,7 @@ loop:
String name;
String type;
String enumer = null;
-
+
// Read the attribute name.
name = readNmtoken(true);
@@ -1911,7 +1911,7 @@ loop:
enumer = dataBufferToString();
}
}
-
+
// Read the default value.
requireWhitespace();
parseDefault(elementName, name, type, enumer);
@@ -1980,7 +1980,7 @@ loop:
return null;
}
}
-
+
/**
* Parse an enumeration.
* <pre>
@@ -2022,7 +2022,7 @@ loop:
{
requireWhitespace();
require('(');
-
+
parseEnumeration(true);
}
@@ -2042,11 +2042,11 @@ loop:
int flags = LIT_ATTRIBUTE;
boolean saved = expandPE;
String defaultType = null;
-
+
// LIT_ATTRIBUTE forces '<' checks now (ASAP) and turns whitespace
// chars to spaces (doesn't matter when that's done if it doesn't
// interfere with char refs expanding to whitespace).
-
+
if (!skippedPE)
{
flags |= LIT_ENTITY_REF;
@@ -2065,7 +2065,7 @@ loop:
}
}
}
-
+
expandPE = false;
if (tryRead('#'))
{
@@ -2125,7 +2125,7 @@ loop:
defaultType, value);
}
}
-
+
/**
* Parse a conditional section.
* <pre>
@@ -2197,7 +2197,7 @@ loop:
error("conditional section must begin with INCLUDE or IGNORE");
}
}
-
+
private void parseCharRef()
throws SAXException, IOException
{
@@ -2216,7 +2216,7 @@ loop:
{
int value = 0;
char c;
-
+
if (tryRead('x'))
{
loop1:
@@ -2263,7 +2263,7 @@ loop2:
}
}
}
-
+
// check for character refs being legal XML
if ((value < 0x0020
&& ! (value == '\n' || value == '\t' || value == '\r'))
@@ -2274,7 +2274,7 @@ loop2:
error("illegal XML character reference U+"
+ Integer.toHexString(value));
}
-
+
// Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz
// (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz:
if (value > 0x0010ffff)
@@ -2283,9 +2283,9 @@ loop2:
error("character reference " + value + " is too large for UTF-16",
Integer.toString(value), null);
}
-
+
}
-
+
/**
* Read and interpret a character reference.
* <pre>
@@ -2298,7 +2298,7 @@ loop2:
{
int value = 0;
char c;
-
+
if (tryRead('x'))
{
loop1:
@@ -2345,7 +2345,7 @@ loop2:
}
}
}
-
+
// check for character refs being legal XML
if ((value < 0x0020
&& ! (value == '\n' || value == '\t' || value == '\r'))
@@ -2356,7 +2356,7 @@ loop2:
error("illegal XML character reference U+"
+ Integer.toHexString(value));
}
-
+
// Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz
// (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz:
if (value <= 0x0000ffff)
@@ -2382,7 +2382,7 @@ loop2:
dataBufferFlush();
}
}
-
+
/**
* Parse and expand an entity reference.
* <pre>
@@ -2395,7 +2395,7 @@ loop2:
throws SAXException, IOException
{
String name;
-
+
name = readNmtoken(true);
require(';');
switch (getEntityType(name))
@@ -2406,7 +2406,7 @@ loop2:
// unless the processor might _legitimately_ not have seen a
// declaration ... which is what this implements.
String message;
-
+
message = "reference to undeclared general entity " + name;
if (skippedPE && !docIsStandalone)
{
@@ -2424,25 +2424,25 @@ loop2:
break;
case ENTITY_INTERNAL:
pushString(name, getEntityValue(name));
-
+
//workaround for possible input pop before marking
- //the buffer reading position
+ //the buffer reading position
char t = readCh();
unread(t);
int bufferPosMark = readBufferPos;
-
+
int end = readBufferPos + getEntityValue(name).length();
for (int k = readBufferPos; k < end; k++)
{
t = readCh();
if (t == '&')
{
- t = readCh();
+ t = readCh();
if (t == '#')
- {
+ {
//try to match a character ref
tryReadCharRef();
-
+
//everything has been read
if (readBufferPos >= end)
{
@@ -2457,7 +2457,7 @@ loop2:
unread(t);
readNmtoken(true);
require(';');
-
+
//everything has been read
if (readBufferPos >= end)
{
@@ -2468,7 +2468,7 @@ loop2:
}
error(" malformed entity reference");
}
-
+
}
readBufferPos = bufferPosMark;
break;
@@ -2499,7 +2499,7 @@ loop2:
throw new RuntimeException();
}
}
-
+
/**
* Parse and expand a parameter entity reference.
* <pre>
@@ -2511,7 +2511,7 @@ loop2:
throws SAXException, IOException
{
String name;
-
+
name = "%" + readNmtoken(true);
require(';');
switch (getEntityType(name))
@@ -2519,7 +2519,7 @@ loop2:
case ENTITY_UNDECLARED:
// VC: Entity Declared
handler.verror("reference to undeclared parameter entity " + name);
-
+
// we should disable handling of all subsequent declarations
// unless this is a standalone document (info discarded)
break;
@@ -2546,7 +2546,7 @@ loop2:
break;
}
}
-
+
/**
* Parse an entity declaration.
* <pre>
@@ -2566,7 +2566,7 @@ loop2:
{
boolean peFlag = false;
int flags = 0;
-
+
// Check for a parameter entity.
expandPE = false;
requireWhitespace();
@@ -2576,7 +2576,7 @@ loop2:
requireWhitespace();
}
expandPE = true;
-
+
// Read the entity name, and prepend
// '%' if necessary.
String name = readNmtoken(true);
@@ -2605,7 +2605,7 @@ loop2:
{
// Read the external IDs
ExternalIdentifiers ids = readExternalIds(false, false);
-
+
// Check for NDATA declaration.
boolean white = tryWhitespace();
if (!peFlag && tryRead("NDATA"))
@@ -2637,7 +2637,7 @@ loop2:
: ids.systemId);
}
}
-
+
// Finish the declaration.
skipWhitespace();
require('>');
@@ -2672,11 +2672,11 @@ loop2:
// Register the notation.
setNotation(nname, ids);
-
+
skipWhitespace();
require('>');
}
-
+
/**
* Parse character data.
* <pre>
@@ -2691,7 +2691,7 @@ loop2:
boolean pureWhite = false;
// assert (dataBufferPos == 0);
-
+
// are we expecting pure whitespace? it might be dirty...
if ((currentElementContent == CONTENT_ELEMENTS) && !isDirtyCurrentElement)
{
@@ -2705,7 +2705,7 @@ loop2:
int lineAugment = 0;
int columnAugment = 0;
int i;
-
+
loop:
for (i = readBufferPos; i < readBufferLength; i++)
{
@@ -2751,8 +2751,8 @@ loop:
break;
default:
if ((c < 0x0020 || c > 0xFFFD)
- || ((c >= 0x007f) && (c <= 0x009f) && (c != 0x0085)
- && xmlVersion == XML_11))
+ || ((c >= 0x007f) && (c <= 0x009f) && (c != 0x0085)
+ && xmlVersion == XML_11))
{
error("illegal XML character U+"
+ Integer.toHexString(c));
@@ -2762,7 +2762,7 @@ loop:
columnAugment++;
}
}
-
+
// report text thus far
if (lineAugment > 0)
{
@@ -2773,10 +2773,10 @@ loop:
{
column += columnAugment;
}
-
+
// report characters/whitspace
int length = i - readBufferPos;
-
+
if (length != 0)
{
if (pureWhite)
@@ -2790,12 +2790,12 @@ loop:
}
readBufferPos = i;
}
-
+
if (state != 0)
{
break;
}
-
+
// fill next buffer from this entity, or
// pop stack and continue with previous entity
unread(readCh());
@@ -2810,11 +2810,11 @@ loop:
error("character data may not contain ']]>'");
}
}
-
+
//////////////////////////////////////////////////////////////////////
// High-level reading and scanning methods.
//////////////////////////////////////////////////////////////////////
-
+
/**
* Require whitespace characters.
*/
@@ -2849,7 +2849,7 @@ loop:
{
int lineAugment = 0;
int columnAugment = 0;
-
+
loop:
for (int i = readBufferPos; i < readBufferLength; i++)
{
@@ -2885,7 +2885,7 @@ loop:
}
}
}
-
+
// OK, do it the slow way.
char c = readCh ();
while (isWhitespace(c))
@@ -2894,7 +2894,7 @@ loop:
}
unread(c);
}
-
+
/**
* Read a name or (when parsing an enumeration) name token.
* <pre>
@@ -2906,7 +2906,7 @@ loop:
throws SAXException, IOException
{
char c;
-
+
if (USE_CHEATS)
{
loop:
@@ -2921,7 +2921,7 @@ loop:
break loop;
}
// else fall through...
-
+
// What may legitimately come AFTER a name/nmtoken?
case '<': case '>': case '&':
case ',': case '|': case '*': case '+': case '?':
@@ -2939,10 +2939,10 @@ loop:
}
readBufferPos = i;
return intern(readBuffer, start, i - start);
-
+
default:
// FIXME ... per IBM's OASIS test submission, these:
- // ? U+06dd
+ // ? U+06dd
// Combining U+309B
//these switches are kind of ugly but at least we won't
//have to go over the whole lits for each char
@@ -2997,7 +2997,7 @@ loop:
+ Integer.toHexString(c));
}
}
-
+
break;
//starting with 11
case 0x1100:
@@ -3061,7 +3061,7 @@ loop:
}
break;
default:
- if (c == 0x0e46 || c == 0x1011
+ if (c == 0x0e46 || c == 0x1011
|| c == 0x212f || c == 0x0587
|| c == 0x0230 )
{
@@ -3091,7 +3091,7 @@ loop:
}
}
}
-
+
nameBufferPos = 0;
// Read the first character.
@@ -3128,7 +3128,7 @@ loop:
return s;
default:
// punt on exact tests from Appendix A, but approximate them
-
+
if ((nameBufferPos != 0 || !isName)
&& !Character.isUnicodeIdentifierPart(c)
&& ":-_.".indexOf(c) == -1
@@ -3147,7 +3147,7 @@ loop:
}
}
}
-
+
private static boolean isExtender(char c)
{
// [88] Extender ::= ...
@@ -3178,7 +3178,7 @@ loop:
int startLine = line;
boolean saved = expandPE;
boolean savedReport = doReport;
-
+
// Find the first delimiter.
delim = readCh();
if (delim != '"' && delim != '\'')
@@ -3192,7 +3192,7 @@ loop:
expandPE = false;
}
doReport = false;
-
+
// Each level of input source has its own buffer; remember
// ours, so we won't read the ending delimiter from any
// other input source, regardless of entity processing.
@@ -3235,11 +3235,11 @@ loop:
break;
}
parseCharRef(false /* Do not do flushDataBuffer */);
-
+
// exotic WFness risk: this is an entity literal,
// dataBuffer [dataBufferPos - 1] == '&', and
// following chars are a _partial_ entity/char ref
-
+
// It looks like an entity ref ...
}
else
@@ -3258,7 +3258,7 @@ loop:
else if ((flags & LIT_DISABLE_EREF) != 0)
{
dataBufferAppend('&');
-
+
// OK, it will be an entity ref -- expanded later.
}
else
@@ -3272,7 +3272,7 @@ loop:
}
c = readCh();
continue loop;
-
+
case '<':
// and why? Perhaps so "&foo;" expands the same
// inside and outside an attribute?
@@ -3283,7 +3283,7 @@ loop:
break;
// We don't worry about case '%' and PE refs, readCh does.
-
+
default:
break;
}
@@ -3299,17 +3299,17 @@ loop:
inLiteral = false;
expandPE = saved;
doReport = savedReport;
-
+
// Normalise whitespace if necessary.
if ((flags & LIT_NORMALIZE) > 0)
{
dataBufferNormalize();
}
-
+
// Return the value.
return dataBufferToString();
}
-
+
/**
* Try reading external identifiers.
* A system identifier is not required for notations.
@@ -3325,7 +3325,7 @@ loop:
char c;
ExternalIdentifiers ids = new ExternalIdentifiers();
int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
-
+
if (tryRead("PUBLIC"))
{
requireWhitespace();
@@ -3345,7 +3345,7 @@ loop:
requireWhitespace();
ids.systemId = readLiteral(flags);
}
-
+
for (int i = 0; i < ids.publicId.length(); i++)
{
c = ids.publicId.charAt(i);
@@ -3374,7 +3374,7 @@ loop:
{
error("missing SYSTEM or PUBLIC keyword");
}
-
+
if (ids.systemId != null)
{
if (ids.systemId.indexOf('#') != -1)
@@ -3388,7 +3388,7 @@ loop:
+ ids.systemId);
}
}
-
+
return ids;
}
@@ -3416,7 +3416,7 @@ loop:
//////////////////////////////////////////////////////////////////////
// Utility routines.
//////////////////////////////////////////////////////////////////////
-
+
/**
* Add a character to the data buffer.
*/
@@ -3446,7 +3446,7 @@ loop:
{
dataBuffer = (char[]) extendArray(dataBuffer, dataBuffer.length,
dataBufferPos + length);
-
+
System.arraycopy(ch, start, dataBuffer, dataBufferPos, length);
dataBufferPos += length;
}
@@ -3459,13 +3459,13 @@ loop:
int i = 0;
int j = 0;
int end = dataBufferPos;
-
+
// Skip spaces at the start.
while (j < end && dataBuffer[j] == ' ')
{
j++;
}
-
+
// Skip whitespace at the end.
while (end > j && dataBuffer[end - 1] == ' ')
{
@@ -3475,9 +3475,9 @@ loop:
// Start copying to the left.
while (j < end)
{
-
+
char c = dataBuffer[j++];
-
+
// Normalise all other spaces to
// a single space.
if (c == ' ')
@@ -3494,7 +3494,7 @@ loop:
dataBuffer[i++] = c;
}
}
-
+
// The new length is <= the old one.
dataBufferPos = i;
}
@@ -3554,7 +3554,7 @@ loop:
{
int length = delim.length();
char[] ch;
-
+
if (length < dataBuffer.length)
{
ch = dataBuffer;
@@ -3564,11 +3564,11 @@ loop:
{
ch = delim.toCharArray();
}
-
+
if (USE_CHEATS && length <= (readBufferLength - readBufferPos))
{
int offset = readBufferPos;
-
+
for (int i = 0; i < length; i++, offset++)
{
if (ch[i] != readBuffer[offset])
@@ -3577,7 +3577,7 @@ loop:
}
}
readBufferPos = offset;
-
+
}
else
{
@@ -3595,13 +3595,13 @@ loop:
throws SAXException, IOException
{
char c = readCh();
-
+
if (c != delim)
{
error("required character", c, Character.toString(delim));
}
}
-
+
/**
* Create an interned string from a character array.
* &AElig;lfred uses this method to create an interned version
@@ -3631,13 +3631,13 @@ loop:
hash = 31 * hash + ch[i];
}
hash = (hash & 0x7fffffff) % SYMBOL_TABLE_LENGTH;
-
+
// Get the bucket -- consists of {array,String} pairs
if ((bucket = symbolTable[hash]) == null)
{
// first string in this bucket
bucket = new Object[8];
-
+
// Search for a matching tuple, and
// return the string if we find one.
}
@@ -3646,13 +3646,13 @@ loop:
while (index < bucket.length)
{
char[] chFound = (char[]) bucket[index];
-
+
// Stop when we hit an empty entry.
if (chFound == null)
{
break;
}
-
+
// If they're the same length, check for a match.
if (chFound.length == length)
{
@@ -3673,12 +3673,12 @@ loop:
index += 2;
}
// Not found -- we'll have to add it.
-
+
// Do we have to grow the bucket?
bucket = (Object[]) extendArray(bucket, bucket.length, index);
}
symbolTable[hash] = bucket;
-
+
// OK, add it to the end of the bucket -- "local" interning.
// Intern "globally" to let applications share interning benefits.
// That is, "!=" and "==" work on our strings, not just equals().
@@ -3690,7 +3690,7 @@ loop:
/**
* Ensure the capacity of an array, allocating a new one if
- * necessary. Usually extends only for name hash collisions.
+ * necessary. Usually extends only for name hash collisions.
*/
private Object extendArray(Object array, int currentSize, int requiredSize)
{
@@ -3702,12 +3702,12 @@ loop:
{
Object newArray = null;
int newSize = currentSize * 2;
-
+
if (newSize <= requiredSize)
{
newSize = requiredSize + 1;
}
-
+
if (array instanceof char[])
{
newArray = new char[newSize];
@@ -3720,7 +3720,7 @@ loop:
{
throw new RuntimeException();
}
-
+
System.arraycopy(array, 0, newArray, 0, currentSize);
return newArray;
}
@@ -3729,20 +3729,20 @@ loop:
//////////////////////////////////////////////////////////////////////
// XML query routines.
//////////////////////////////////////////////////////////////////////
-
+
boolean isStandalone()
{
return docIsStandalone;
}
-
+
//
// Elements
//
-
+
private int getContentType(ElementDecl element, int defaultType)
{
int retval;
-
+
if (element == null)
{
return defaultType;
@@ -3770,7 +3770,7 @@ loop:
ElementDecl element = (ElementDecl) elementInfo.get(name);
return getContentType(element, CONTENT_UNDECLARED);
}
-
+
/**
* Register an element.
* Array format:
@@ -3788,7 +3788,7 @@ loop:
}
ElementDecl element = (ElementDecl) elementInfo.get(name);
-
+
// first <!ELEMENT ...> or <!ATTLIST ...> for this type?
if (element == null)
{
@@ -3799,7 +3799,7 @@ loop:
elementInfo.put(name, element);
return;
}
-
+
// <!ELEMENT ...> declaration?
if (contentType != CONTENT_UNDECLARED)
{
@@ -3816,14 +3816,14 @@ loop:
+ name);
}
}
-
+
// first <!ATTLIST ...>, before <!ELEMENT ...> ?
else if (attributes != null)
{
element.attributes = attributes;
}
}
-
+
/**
* Look up the attribute hash table for an element.
* The hash table is the second item in the element array.
@@ -3837,7 +3837,7 @@ loop:
//
// Attributes
//
-
+
/**
* Get the declared attributes for an element type.
* @param elname The name of the element type.
@@ -3853,7 +3853,7 @@ loop:
private Iterator declaredAttributes(ElementDecl element)
{
HashMap attlist;
-
+
if (element == null)
{
return null;
@@ -3977,8 +3977,8 @@ loop:
AttributeDecl attribute = getAttribute(name, aname);
return (attribute == null) ? ATTRIBUTE_DEFAULT_UNDECLARED :
attribute.valueType;
- }
-
+ }
+
/**
* Register an attribute declaration for later retrieval.
* Format:
@@ -3993,19 +3993,19 @@ loop:
throws Exception
{
HashMap attlist;
-
+
if (skippedPE)
{
return;
}
-
+
// Create a new hashtable if necessary.
attlist = getElementAttributes(elName);
if (attlist == null)
{
attlist = new HashMap();
}
-
+
// ignore multiple attribute declarations!
if (attlist.get(name) != null)
{
@@ -4020,7 +4020,7 @@ loop:
attribute.valueType = valueType;
attribute.enumeration = enumeration;
attlist.put(name, attribute);
-
+
// save; but don't overwrite any existing <!ELEMENT ...>
setElement(elName, CONTENT_UNDECLARED, null, attlist);
}
@@ -4038,7 +4038,7 @@ loop:
//
// Entities
//
-
+
/**
* Find the type of an entity.
* @returns An integer constant representing the entity type.
@@ -4135,7 +4135,7 @@ loop:
//
// Notations.
//
-
+
/**
* Report a notation declaration, checking for duplicates.
*/
@@ -4146,7 +4146,7 @@ loop:
{
return;
}
-
+
handler.notationDecl(nname, ids.publicId, ids.systemId, ids.baseUri);
if (notationInfo.get(nname) == null)
{
@@ -4158,11 +4158,11 @@ loop:
handler.verror("Duplicate notation name decl: " + nname);
}
}
-
+
//
// Location.
//
-
+
/**
* Return the current line number.
*/
@@ -4182,7 +4182,7 @@ loop:
//////////////////////////////////////////////////////////////////////
// High-level I/O.
//////////////////////////////////////////////////////////////////////
-
+
/**
* Read a single character from the readBuffer.
* <p>The readDataChunk () method maintains the buffer.
@@ -4223,16 +4223,16 @@ loop:
}
}
break;
-
+
default:
-
+
popInput();
break;
}
}
-
+
char c = readBuffer[readBufferPos++];
-
+
if (c == '\n')
{
line++;
@@ -4245,7 +4245,7 @@ loop:
/* the most common return to parseContent () ... NOP */
}
else if (((c < 0x0020 && (c != '\t') && (c != '\r')) || c > 0xFFFD)
- || ((c >= 0x007f) && (c <= 0x009f) && (c != 0x0085)
+ || ((c >= 0x007f) && (c <= 0x009f) && (c != 0x0085)
&& xmlVersion == XML_11))
{
error("illegal XML character U+" + Integer.toHexString(c));
@@ -4274,7 +4274,7 @@ loop:
* Push a single character back onto the current input stream.
* <p>This method usually pushes the character back onto
* the readBuffer.
- * <p>I don't think that this would ever be called with
+ * <p>I don't think that this would ever be called with
* readBufferPos = 0, because the methods always reads a character
* before unreading it, but just in case, I've added a boundary
* condition.
@@ -4451,7 +4451,7 @@ loop:
scratch.setCharacterStream(null);
scratch.setByteStream(null);
scratch.setEncoding(null);
-
+
// Push the existing status.
pushInput(ename);
@@ -4475,7 +4475,7 @@ loop:
tryEncodingDecl(true);
return;
}
-
+
// Else we handle the conversion, and need to ensure
// it's done right.
sourceType = INPUT_STREAM;
@@ -4487,12 +4487,12 @@ loop:
{
// We have to open our own stream to the URL.
URL url = new URL(systemId);
-
+
externalEntity = url.openConnection();
externalEntity.connect();
is = externalEntity.getInputStream();
}
-
+
// If we get to here, there must be
// an InputStream available.
if (!is.markSupported())
@@ -4509,11 +4509,11 @@ loop:
if (!"file".equals(externalEntity.getURL().getProtocol()))
{
int temp;
-
+
// application/xml;charset=something;otherAttr=...
// ... with many variants on 'something'
encoding = externalEntity.getContentType();
-
+
// MHK code (fix for Saxon 5.5.1/007):
// protect against encoding==null
if (encoding == null)
@@ -4524,7 +4524,7 @@ loop:
{
temp = encoding.indexOf("charset");
}
-
+
// RFC 2376 sez MIME text defaults to ASCII, but since the
// JDK will create a MIME type out of thin air, we always
// autodetect when there's no explicit charset attribute.
@@ -4539,11 +4539,11 @@ loop:
{
encoding = encoding.substring(0, temp);
}
-
+
if ((temp = encoding.indexOf('=', temp + 7)) > 0)
{
encoding = encoding.substring(temp + 1);
-
+
// attributes can have comment fields (RFC 822)
if ((temp = encoding.indexOf('(')) > 0)
{
@@ -4567,14 +4567,14 @@ loop:
}
}
}
-
+
// if we got an external encoding label, use it ...
if (encoding != null)
{
this.encoding = ENCODING_EXTERNAL;
setupDecoding(encoding);
ignoreEncoding = true;
-
+
// ... else autodetect from first bytes.
}
else
@@ -4608,13 +4608,13 @@ loop:
readBufferOverflow = -1;
line = 1;
currentByteCount = column = 0;
-
+
sourceType = INPUT_READER;
this.reader = new InputStreamReader(is, encoding);
is = null;
-
+
tryEncodingDecl(true);
-
+
}
catch (IOException e)
{
@@ -4672,7 +4672,7 @@ loop:
/**
* Attempt to detect the encoding of an entity.
* <p>The trick here (as suggested in the XML standard) is that
- * any entity not in UTF-8, or in UCS-2 with a byte-order mark,
+ * any entity not in UTF-8, or in UCS-2 with a byte-order mark,
* <b>must</b> begin with an XML declaration or an encoding
* declaration; we simply have to look for "&lt;?xml" in various
* encodings.
@@ -4792,7 +4792,7 @@ loop:
{
// 4c 6f a7 94 ... we don't understand EBCDIC flavors
// ... but we COULD at least kick in some fixed code page
-
+
// (default) UTF-8 without encoding/XML declaration
encoding = ENCODING_UTF_8;
}
@@ -4832,7 +4832,7 @@ loop:
/**
* This method pushes a string back onto input.
- * <p>It is useful either as the expansion of an internal entity,
+ * <p>It is useful either as the expansion of an internal entity,
* or for backtracking during the parse.
* <p>Call pushCharArray () to do the actual work.
* @param s The string to push back onto input.
@@ -4918,13 +4918,13 @@ loop:
}
}
entityStack.addLast(ename);
-
+
// Don't bother if there is no current input.
if (sourceType == INPUT_NONE)
{
return;
}
-
+
// Set up a snapshot of the current
// input source.
Input input = new Input();
@@ -4941,7 +4941,7 @@ loop:
input.currentByteCount = currentByteCount;
input.column = column;
input.reader = reader;
-
+
// Push it onto the stack.
inputStack.addLast(input);
}
@@ -5010,7 +5010,7 @@ loop:
column = input.column;
reader = input.reader;
}
-
+
/**
* Return true if we can read the expected character.
* <p>Note that the character will be removed from the input stream
@@ -5026,7 +5026,7 @@ loop:
throws SAXException, IOException
{
char c;
-
+
// Read the character
c = readCh();
@@ -5069,7 +5069,7 @@ loop:
// Compare the input, character-
// by character.
-
+
for (int i = 0; i < ch.length; i++)
{
c = readCh();
@@ -5109,7 +5109,7 @@ loop:
return false;
}
}
-
+
/**
* Read all data until we find the specified string.
* This is useful for scanning CDATA sections and PIs.
@@ -5130,7 +5130,7 @@ loop:
{
char c;
int startLine = line;
-
+
try
{
while (!tryRead(delim))
@@ -5150,7 +5150,7 @@ loop:
//////////////////////////////////////////////////////////////////////
// Low-level I/O.
//////////////////////////////////////////////////////////////////////
-
+
/**
* Prefetch US-ASCII XML/text decl from input stream into read buffer.
* Doesn't buffer more than absolutely needed, so that when an encoding
@@ -5163,7 +5163,7 @@ loop:
{
int ch;
readBufferPos = readBufferLength = 0;
-
+
is.mark(readBuffer.length);
while (true)
{
@@ -5201,7 +5201,7 @@ loop:
throws SAXException, IOException
{
int count;
-
+
// See if we have any overflow (filterCR sets for CR at end)
if (readBufferOverflow > -1)
{
@@ -5236,7 +5236,7 @@ loop:
sawCR = false;
return;
}
-
+
// Read as many bytes as possible into the raw buffer.
count = is.read(rawReadBuffer, 0, READ_BUFFER_MAX);
@@ -5265,7 +5265,7 @@ loop:
case ENCODING_UCS_2_21:
copyUcs2ReadBuffer(count, 0, 8);
break;
-
+
// four byte builtins
case ENCODING_UCS_4_1234:
copyUcs4ReadBuffer(count, 24, 16, 8, 0);
@@ -5287,27 +5287,27 @@ loop:
}
readBufferPos = 0;
-
+
// Filter out all carriage returns if we've seen any
// (including any saved from a previous read)
if (sawCR)
{
filterCR(count >= 0);
sawCR = false;
-
+
// must actively report EOF, lest some CRs get lost.
if (readBufferLength == 0 && count >= 0)
{
readDataChunk();
}
}
-
+
if (count > 0)
{
currentByteCount += count;
}
}
-
+
/**
* Filter carriage returns in the read buffer.
* CRLF becomes LF; CR becomes LF.
@@ -5321,7 +5321,7 @@ loop:
int i, j;
readBufferOverflow = -1;
-
+
loop:
for (i = j = readBufferPos; j < readBufferLength; i++, j++)
{
@@ -5359,8 +5359,8 @@ loop:
/**
* Convert a buffer of UTF-8-encoded bytes into UTF-16 characters.
- * <p>When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
+ * <p>When readDataChunk () calls this method, the raw bytes are in
+ * rawReadBuffer, and the final characters will appear in
* readBuffer.
* <p>Note that as of Unicode 3.1, good practice became a requirement,
* so that each Unicode character has exactly one UTF-8 representation.
@@ -5377,7 +5377,7 @@ loop:
int j = readBufferPos;
int b1;
char c = 0;
-
+
/*
// check once, so the runtime won't (if it's smart enough)
if (count < 0 || count > rawReadBuffer.length)
@@ -5403,7 +5403,7 @@ loop:
encodingError("Illegal two byte UTF-8 sequence",
c, 0);
}
-
+
//Sec 2.11
// [1] the two-character sequence #xD #xA
// [2] the two-character sequence #xD #x85
@@ -5411,10 +5411,10 @@ loop:
{
continue;
}
-
+
// Sec 2.11
// [3] the single character #x85
-
+
if (c == 0x0085 && xmlVersion == XML_11)
{
readBuffer[j++] = '\r';
@@ -5453,7 +5453,7 @@ loop:
iso646 = (iso646 << 6) + getNextUtf8Byte(i++, count);
iso646 = (iso646 << 6) + getNextUtf8Byte(i++, count);
iso646 = (iso646 << 6) + getNextUtf8Byte(i++, count);
-
+
if (iso646 <= 0xffff)
{
encodingError("Illegal four byte UTF-8 sequence",
@@ -5497,7 +5497,7 @@ loop:
// How many characters have we read?
readBufferLength = j;
}
-
+
/**
* Return the next byte value in a UTF-8 sequence.
* If it is not possible to get a byte from the current
@@ -5512,7 +5512,7 @@ loop:
throws SAXException, IOException
{
int val;
-
+
// Take a character from the buffer
// or from the actual input stream.
if (pos < count)
@@ -5544,8 +5544,8 @@ loop:
* Convert a buffer of US-ASCII or ISO-8859-1-encoded bytes into
* UTF-16 characters.
*
- * <p>When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
+ * <p>When readDataChunk () calls this method, the raw bytes are in
+ * rawReadBuffer, and the final characters will appear in
* readBuffer.
*
* @param count The number of bytes to convert.
@@ -5583,8 +5583,8 @@ loop:
* Convert a buffer of UCS-2-encoded bytes into UTF-16 characters
* (as used in Java string manipulation).
*
- * <p>When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
+ * <p>When readDataChunk () calls this method, the raw bytes are in
+ * rawReadBuffer, and the final characters will appear in
* readBuffer.
* @param count The number of bytes to convert.
* @param shift1 The number of bits to shift byte 1.
@@ -5597,7 +5597,7 @@ loop:
throws SAXException
{
int j = readBufferPos;
-
+
if (count > 0 && (count % 2) != 0)
{
encodingError("odd number of bytes in UCS-2 encoding", -1, count);
@@ -5635,8 +5635,8 @@ loop:
/**
* Convert a buffer of UCS-4-encoded bytes into UTF-16 characters.
*
- * <p>When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
+ * <p>When readDataChunk () calls this method, the raw bytes are in
+ * rawReadBuffer, and the final characters will appear in
* readBuffer.
* <p>Java has Unicode chars, and this routine uses surrogate pairs
* for ISO-10646 values between 0x00010000 and 0x000fffff. An
@@ -5657,7 +5657,7 @@ loop:
throws SAXException
{
int j = readBufferPos;
-
+
if (count > 0 && (count % 4) != 0)
{
encodingError("number of bytes in UCS-4 encoding " +
@@ -5706,11 +5706,11 @@ loop:
error(message);
}
}
-
+
//////////////////////////////////////////////////////////////////////
// Local Variables.
//////////////////////////////////////////////////////////////////////
-
+
/**
* Re-initialize the variables for each parse.
*/
@@ -5719,7 +5719,7 @@ loop:
// First line
line = 1;
column = 0;
-
+
// Set up the buffers for data and names
dataBufferPos = 0;
dataBuffer = new char[DATA_BUFFER_INITIAL];
@@ -5736,7 +5736,7 @@ loop:
// element context.
currentElement = null;
currentElementContent = CONTENT_UNDECLARED;
-
+
// Set up the input variables
sourceType = INPUT_NONE;
inputStack = new LinkedList();
@@ -5752,11 +5752,11 @@ loop:
inLiteral = false;
expandPE = false;
peIsError = false;
-
+
doReport = false;
-
+
inCDATA = false;
-
+
symbolTable = new Object[SYMBOL_TABLE_LENGTH][];
}
@@ -5777,7 +5777,7 @@ loop:
this.systemId = systemId;
this.baseUri = baseUri;
}
-
+
}
static class EntityInfo
@@ -5787,12 +5787,12 @@ loop:
ExternalIdentifiers ids;
String value;
String notationName;
-
+
}
static class AttributeDecl
{
-
+
String type;
String value;
int valueType;
@@ -5803,16 +5803,16 @@ loop:
static class ElementDecl
{
-
+
int contentType;
String contentModel;
HashMap attributes;
-
+
}
-
+
static class Input
{
-
+
int sourceType;
URLConnection externalEntity;
char[] readBuffer;
@@ -5825,8 +5825,7 @@ loop:
int currentByteCount;
int column;
Reader reader;
-
+
}
-
-}
+}
diff --git a/gnu/xml/aelfred2/XmlReader.java b/gnu/xml/aelfred2/XmlReader.java
index a3bd03a86..e0a047612 100644
--- a/gnu/xml/aelfred2/XmlReader.java
+++ b/gnu/xml/aelfred2/XmlReader.java
@@ -1,4 +1,4 @@
-/* XmlReader.java --
+/* XmlReader.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -77,15 +77,15 @@ public final class XmlReader
static class FatalErrorHandler
extends DefaultHandler2
{
-
+
public void error(SAXParseException e)
throws SAXException
{
throw e;
}
-
+
}
-
+
private SAXDriver aelfred2 = new SAXDriver();
private EventFilter filter = new EventFilter();
private boolean isValidating;
@@ -109,7 +109,7 @@ public final class XmlReader
setErrorHandler(new FatalErrorHandler());
}
}
-
+
/**
* <b>SAX2</b>: Returns the object used to report the logical
* content of an XML document.
@@ -154,7 +154,7 @@ public final class XmlReader
}
filter.setDTDHandler(handler);
}
-
+
/**
* <b>SAX2</b>: Returns the object used when resolving external
* entities during parsing (both general and parameter entities).
@@ -224,7 +224,7 @@ public final class XmlReader
}
throw new SAXNotRecognizedException(propertyId);
}
-
+
private void forceValidating()
throws SAXNotRecognizedException, SAXNotSupportedException
{
@@ -371,4 +371,3 @@ public final class XmlReader
}
}
-
diff --git a/gnu/xml/dom/Consumer.java b/gnu/xml/dom/Consumer.java
index 026e2754e..836c8d257 100644
--- a/gnu/xml/dom/Consumer.java
+++ b/gnu/xml/dom/Consumer.java
@@ -1,4 +1,4 @@
-/* Consumer.java --
+/* Consumer.java --
Copyright (C) 2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -81,8 +81,8 @@ public class Consumer extends DomConsumer
public Consumer ()
throws SAXException
{
- super (DomDocument.class);
- setHandler (new Backdoor (this));
+ super (DomDocument.class);
+ setHandler (new Backdoor (this));
}
/**
@@ -93,8 +93,8 @@ public class Consumer extends DomConsumer
public Consumer (EventConsumer next)
throws SAXException
{
- super (DomDocument.class, next);
- setHandler (new Backdoor (this));
+ super (DomDocument.class, next);
+ setHandler (new Backdoor (this));
}
/**
@@ -105,160 +105,160 @@ public class Consumer extends DomConsumer
*/
public static class Backdoor extends DomConsumer.Handler
{
- /**
- * Constructor.
- * @param consumer must have been initialized to use the
- * {@link DomDocument} class (or a subclass) for
- * constructing DOM trees
- */
- protected Backdoor (DomConsumer consumer)
- throws SAXException
- { super (consumer); }
-
- // helper routine
- private DomDoctype getDoctype ()
- throws SAXException
- {
- DomDocument doc = (DomDocument) getDocument ();
- DocumentType dt = doc.getDoctype ();
-
- if (dt == null)
- throw new SAXException ("doctype missing!");
- return (DomDoctype) dt;
- }
-
- // SAX2 "lexical" event
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- DomDocument doc = (DomDocument) getDocument ();
-
- super.startDTD (name, publicId, systemId);
- // DOM L2 doctype creation model is bizarre
- DomDoctype dt = new DomDoctype (doc, name, publicId, systemId);
- doc.appendChild (dt);
- }
-
- // SAX2 "lexical" event
- public void endDTD ()
- throws SAXException
- {
- super.endDTD ();
- // DOM L2 has no way to make things readonly
- getDoctype ().makeReadonly ();
- }
-
- // SAX1 DTD event
- public void notationDecl (
- String name,
- String publicId, String systemId
- ) throws SAXException
- {
- // DOM L2 can't create/save notation nodes
- getDoctype ().declareNotation (name, publicId, systemId);
- }
-
- // SAX1 DTD event
- public void unparsedEntityDecl (
- String name,
- String publicId, String systemId,
- String notationName
- ) throws SAXException
- {
- // DOM L2 can't create/save entity nodes
- getDoctype ().declareEntity (name, publicId, systemId,
- notationName);
- }
-
- // SAX2 declaration event
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- // DOM L2 can't create/save entity nodes
- // NOTE: this doesn't save the value as a child of this
- // node, though it could realistically do so.
- getDoctype ().declareEntity (name, null, null, null);
- }
-
- // SAX2 declaration event
- public void externalEntityDecl (
- String name,
- String publicId,
- String systemId
- ) throws SAXException
- {
- // DOM L2 can't create/save entity nodes
- // NOTE: DOM allows for these to have children, if
- // they don't have unbound namespace references.
- getDoctype ().declareEntity (name, publicId, systemId, null);
- }
-
- // SAX2 element
- public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- Node top;
-
- super.startElement (uri, localName, qName, atts);
-
- // might there be more work?
- top = getTop ();
- if (!top.hasAttributes () || !(atts instanceof Attributes2))
- return;
-
- // remember any attributes that got defaulted
- DomNamedNodeMap map = (DomNamedNodeMap) top.getAttributes ();
- Attributes2 attrs = (Attributes2) atts;
- int length = atts.getLength ();
-
- //map.compact ();
- for (int i = 0; i < length; i++) {
- if (attrs.isSpecified (i))
- continue;
-
- // value was defaulted.
- String temp = attrs.getQName (i);
- DomAttr attr;
-
- if ("".equals (temp))
- attr = (DomAttr) map.getNamedItemNS (attrs.getURI (i),
- atts.getLocalName (i));
- else
- attr = (DomAttr) map.getNamedItem (temp);
-
- // DOM L2 can't write this flag, only read it
- attr.setSpecified (false);
- }
- }
-
- public void endElement (
- String uri,
- String localName,
- String qName
- ) throws SAXException
- {
- DomNode top = (DomNode) getTop ();
- top.compact ();
- super.endElement (uri, localName, qName);
- }
-
- protected Text createText (
- boolean isCDATA,
- char buf [],
- int off,
- int len
- ) {
- DomDocument doc = (DomDocument) getDocument ();
-
- if (isCDATA)
- return doc.createCDATASection (buf, off, len);
- else
- return doc.createTextNode (buf, off, len);
- }
+ /**
+ * Constructor.
+ * @param consumer must have been initialized to use the
+ * {@link DomDocument} class (or a subclass) for
+ * constructing DOM trees
+ */
+ protected Backdoor (DomConsumer consumer)
+ throws SAXException
+ { super (consumer); }
+
+ // helper routine
+ private DomDoctype getDoctype ()
+ throws SAXException
+ {
+ DomDocument doc = (DomDocument) getDocument ();
+ DocumentType dt = doc.getDoctype ();
+
+ if (dt == null)
+ throw new SAXException ("doctype missing!");
+ return (DomDoctype) dt;
+ }
+
+ // SAX2 "lexical" event
+ public void startDTD (String name, String publicId, String systemId)
+ throws SAXException
+ {
+ DomDocument doc = (DomDocument) getDocument ();
+
+ super.startDTD (name, publicId, systemId);
+ // DOM L2 doctype creation model is bizarre
+ DomDoctype dt = new DomDoctype (doc, name, publicId, systemId);
+ doc.appendChild (dt);
+ }
+
+ // SAX2 "lexical" event
+ public void endDTD ()
+ throws SAXException
+ {
+ super.endDTD ();
+ // DOM L2 has no way to make things readonly
+ getDoctype ().makeReadonly ();
+ }
+
+ // SAX1 DTD event
+ public void notationDecl (
+ String name,
+ String publicId, String systemId
+ ) throws SAXException
+ {
+ // DOM L2 can't create/save notation nodes
+ getDoctype ().declareNotation (name, publicId, systemId);
+ }
+
+ // SAX1 DTD event
+ public void unparsedEntityDecl (
+ String name,
+ String publicId, String systemId,
+ String notationName
+ ) throws SAXException
+ {
+ // DOM L2 can't create/save entity nodes
+ getDoctype ().declareEntity (name, publicId, systemId,
+ notationName);
+ }
+
+ // SAX2 declaration event
+ public void internalEntityDecl (String name, String value)
+ throws SAXException
+ {
+ // DOM L2 can't create/save entity nodes
+ // NOTE: this doesn't save the value as a child of this
+ // node, though it could realistically do so.
+ getDoctype ().declareEntity (name, null, null, null);
+ }
+
+ // SAX2 declaration event
+ public void externalEntityDecl (
+ String name,
+ String publicId,
+ String systemId
+ ) throws SAXException
+ {
+ // DOM L2 can't create/save entity nodes
+ // NOTE: DOM allows for these to have children, if
+ // they don't have unbound namespace references.
+ getDoctype ().declareEntity (name, publicId, systemId, null);
+ }
+
+ // SAX2 element
+ public void startElement (
+ String uri,
+ String localName,
+ String qName,
+ Attributes atts
+ ) throws SAXException
+ {
+ Node top;
+
+ super.startElement (uri, localName, qName, atts);
+
+ // might there be more work?
+ top = getTop ();
+ if (!top.hasAttributes () || !(atts instanceof Attributes2))
+ return;
+
+ // remember any attributes that got defaulted
+ DomNamedNodeMap map = (DomNamedNodeMap) top.getAttributes ();
+ Attributes2 attrs = (Attributes2) atts;
+ int length = atts.getLength ();
+
+ //map.compact ();
+ for (int i = 0; i < length; i++) {
+ if (attrs.isSpecified (i))
+ continue;
+
+ // value was defaulted.
+ String temp = attrs.getQName (i);
+ DomAttr attr;
+
+ if ("".equals (temp))
+ attr = (DomAttr) map.getNamedItemNS (attrs.getURI (i),
+ atts.getLocalName (i));
+ else
+ attr = (DomAttr) map.getNamedItem (temp);
+
+ // DOM L2 can't write this flag, only read it
+ attr.setSpecified (false);
+ }
+ }
+
+ public void endElement (
+ String uri,
+ String localName,
+ String qName
+ ) throws SAXException
+ {
+ DomNode top = (DomNode) getTop ();
+ top.compact ();
+ super.endElement (uri, localName, qName);
+ }
+
+ protected Text createText (
+ boolean isCDATA,
+ char buf [],
+ int off,
+ int len
+ ) {
+ DomDocument doc = (DomDocument) getDocument ();
+
+ if (isCDATA)
+ return doc.createCDATASection (buf, off, len);
+ else
+ return doc.createTextNode (buf, off, len);
+ }
public void elementDecl(String name, String model)
throws SAXException
@@ -266,87 +266,87 @@ public class Consumer extends DomConsumer
getDoctype().elementDecl(name, model);
}
- public void attributeDecl (
- String ename,
- String aname,
- String type,
- String mode,
- String value
- ) throws SAXException
- {
+ public void attributeDecl (
+ String ename,
+ String aname,
+ String type,
+ String mode,
+ String value
+ ) throws SAXException
+ {
getDoctype().attributeDecl(ename, aname, type, mode, value);
/*
- if (value == null && !"ID".equals (type))
- return;
-
- DomDoctype.ElementInfo info;
-
- info = getDoctype ().getElementInfo (ename);
- if (value != null)
- info.setAttrDefault (aname, value);
- if ("ID".equals (type))
- info.setIdAttr (aname);
+ if (value == null && !"ID".equals (type))
+ return;
+
+ DomDoctype.ElementInfo info;
+
+ info = getDoctype ().getElementInfo (ename);
+ if (value != null)
+ info.setAttrDefault (aname, value);
+ if ("ID".equals (type))
+ info.setIdAttr (aname);
*/
-
- }
-
- // force duplicate name checking off while we're
- // using parser output (don't duplicate the work)
- public void startDocument () throws SAXException
- {
- super.startDocument ();
-
+
+ }
+
+ // force duplicate name checking off while we're
+ // using parser output (don't duplicate the work)
+ public void startDocument () throws SAXException
+ {
+ super.startDocument ();
+
DomDocument doc = (DomDocument) getDocument ();
doc.setStrictErrorChecking(false);
doc.setBuilding(true);
- }
+ }
- public void endDocument ()
- throws SAXException
- {
- DomDocument doc = (DomDocument) getDocument ();
- doc.setStrictErrorChecking(true);
+ public void endDocument ()
+ throws SAXException
+ {
+ DomDocument doc = (DomDocument) getDocument ();
+ doc.setStrictErrorChecking(true);
doc.setBuilding(false);
- doc.compact ();
+ doc.compact ();
DomDoctype doctype = (DomDoctype) doc.getDoctype();
if (doctype != null)
{
doctype.makeReadonly();
}
- super.endDocument ();
- }
-
- // these three methods collaborate to populate entity
- // refs, marking contents readonly on end-of-entity
-
- public boolean canPopulateEntityRefs ()
- { return true; }
-
- public void startEntity (String name)
- throws SAXException
- {
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return;
- super.startEntity (name);
-
- DomNode top = (DomNode) getTop ();
-
- if (top.getNodeType () == Node.ENTITY_REFERENCE_NODE)
- top.readonly = false;
- }
-
- public void endEntity (String name)
- throws SAXException
- {
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return;
- DomNode top = (DomNode) getTop ();
-
- if (top.getNodeType () == Node.ENTITY_REFERENCE_NODE) {
- top.compact ();
- top.makeReadonly ();
- }
- super.endEntity (name);
- }
+ super.endDocument ();
+ }
+
+ // these three methods collaborate to populate entity
+ // refs, marking contents readonly on end-of-entity
+
+ public boolean canPopulateEntityRefs ()
+ { return true; }
+
+ public void startEntity (String name)
+ throws SAXException
+ {
+ if (name.charAt (0) == '%' || "[dtd]".equals (name))
+ return;
+ super.startEntity (name);
+
+ DomNode top = (DomNode) getTop ();
+
+ if (top.getNodeType () == Node.ENTITY_REFERENCE_NODE)
+ top.readonly = false;
+ }
+
+ public void endEntity (String name)
+ throws SAXException
+ {
+ if (name.charAt (0) == '%' || "[dtd]".equals (name))
+ return;
+ DomNode top = (DomNode) getTop ();
+
+ if (top.getNodeType () == Node.ENTITY_REFERENCE_NODE) {
+ top.compact ();
+ top.makeReadonly ();
+ }
+ super.endEntity (name);
+ }
}
}
diff --git a/gnu/xml/dom/DTDAttributeTypeInfo.java b/gnu/xml/dom/DTDAttributeTypeInfo.java
index e3c69c43e..d6e25529d 100644
--- a/gnu/xml/dom/DTDAttributeTypeInfo.java
+++ b/gnu/xml/dom/DTDAttributeTypeInfo.java
@@ -1,4 +1,4 @@
-/* DTDAttributeTypeInfo.java --
+/* DTDAttributeTypeInfo.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -81,4 +81,3 @@ class DTDAttributeTypeInfo
}
}
-
diff --git a/gnu/xml/dom/DTDElementTypeInfo.java b/gnu/xml/dom/DTDElementTypeInfo.java
index c5553e20e..9063d4c79 100644
--- a/gnu/xml/dom/DTDElementTypeInfo.java
+++ b/gnu/xml/dom/DTDElementTypeInfo.java
@@ -1,4 +1,4 @@
-/* DTDElementTypeInfo.java --
+/* DTDElementTypeInfo.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -107,6 +107,5 @@ class DTDElementTypeInfo
}
return attributes.values().iterator();
}
-
-}
+}
diff --git a/gnu/xml/dom/DomAttr.java b/gnu/xml/dom/DomAttr.java
index 6a8da8371..421baf76a 100644
--- a/gnu/xml/dom/DomAttr.java
+++ b/gnu/xml/dom/DomAttr.java
@@ -1,4 +1,4 @@
-/* DomAttr.java --
+/* DomAttr.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,7 +65,7 @@ import org.w3c.dom.events.MutationEvent;
* methods (setNodeValue, setValue, and Element.setAttribute) to modify
* those values. That is, if you manipulate those children directly,
* elements won't get notified that attribute values have changed.
- * The natural fix for that will report other modifications, but won't
+ * The natural fix for that will report other modifications, but won't
* be able to expose "previous" attribute value; it'll need to be cached
* or something (at which point why bother using child nodes). </p>
*
@@ -79,10 +79,10 @@ public class DomAttr
extends DomNsNode
implements Attr
{
-
+
private boolean specified;
private String value; // string value cache
-
+
/**
* Constructs an Attr node associated with the specified document.
* The "specified" flag is initialized to true, since this DOM has
@@ -95,7 +95,7 @@ public class DomAttr
*
* @param owner The document with which this node is associated
* @param namespaceURI Combined with the local part of the name,
- * this is used to uniquely identify a type of attribute
+ * this is used to uniquely identify a type of attribute
* @param name Name of this attribute, which may include a prefix
*/
protected DomAttr(DomDocument owner, String namespaceURI, String name)
@@ -103,7 +103,7 @@ public class DomAttr
super(ATTRIBUTE_NODE, owner, namespaceURI, name);
specified = true;
length = 1;
-
+
// XXX register self to get insertion/removal events
// and character data change events and when they happen,
// report self-mutation
@@ -121,18 +121,18 @@ public class DomAttr
* <p>
* With this constructor, the prefix and local part are given explicitly
* rather than being computed. This allows them to be explicitly set to
- * {@code null} as required by {@link Document#createAttribute(String)}.
+ * {@code null} as required by {@link Document#createAttribute(String)}.
* </p>
*
* @param owner The document with which this node is associated
* @param namespaceURI Combined with the local part of the name,
- * this is used to uniquely identify a type of attribute
+ * this is used to uniquely identify a type of attribute
* @param name Name of this attribute, which may include a prefix
* @param prefix the namespace prefix of the name. May be {@code null}.
* @param localName the local part of the name. May be {@code null}.
*/
protected DomAttr(DomDocument owner, String namespaceURI, String name,
- String prefix, String localName)
+ String prefix, String localName)
{
super(ATTRIBUTE_NODE, owner, namespaceURI, name, prefix, localName);
specified = true;
@@ -147,7 +147,7 @@ public class DomAttr
{
return getNodeName();
}
-
+
/**
* <b>DOM L1</b>
* Returns true if a parser reported this was in the source text.
@@ -156,7 +156,7 @@ public class DomAttr
{
return specified;
}
-
+
/**
* Records whether this attribute was in the source text.
*/
@@ -194,7 +194,7 @@ public class DomAttr
}
return buf.toString();
}
-
+
/**
* <b>DOM L1</b>
* Assigns the value of the attribute; it will have one child,
@@ -205,7 +205,7 @@ public class DomAttr
{
setNodeValue(value);
}
-
+
/**
* <b>DOM L1</b>
* Returns the value of the attribute as a non-null string; same
@@ -216,7 +216,7 @@ public class DomAttr
{
return getNodeValue();
}
-
+
/**
* <b>DOM L1</b>
* Assigns the attribute value; using this API, no entity or
@@ -246,7 +246,7 @@ public class DomAttr
this.value = value;
length = 1;
specified = true;
-
+
mutating(oldValue, value, MutationEvent.MODIFICATION);
}
@@ -334,7 +334,7 @@ public class DomAttr
{
return null;
}
-
+
/**
* Shallow clone of the attribute, breaking all ties with any
* elements.
@@ -345,18 +345,18 @@ public class DomAttr
retval.specified = true;
return retval;
}
-
+
private void mutating(String oldValue, String newValue, short why)
{
if (!reportMutations || parent == null || equal(newValue, oldValue))
{
return;
}
-
+
// EVENT: DOMAttrModified, target = parent,
- // prev/new values provided, also attr name
- MutationEvent event;
-
+ // prev/new values provided, also attr name
+ MutationEvent event;
+
event = (MutationEvent) createEvent ("MutationEvents");
event.initMutationEvent ("DOMAttrModified",
true /* bubbles */, false /* nocancel */,
@@ -365,7 +365,7 @@ public class DomAttr
}
// DOM Level 3 methods
-
+
public TypeInfo getSchemaTypeInfo()
{
if (parent != null)
@@ -409,4 +409,3 @@ public class DomAttr
}
}
-
diff --git a/gnu/xml/dom/DomCDATASection.java b/gnu/xml/dom/DomCDATASection.java
index e34359e71..770f7d5dd 100644
--- a/gnu/xml/dom/DomCDATASection.java
+++ b/gnu/xml/dom/DomCDATASection.java
@@ -1,4 +1,4 @@
-/* DomCDATASection.java --
+/* DomCDATASection.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,7 +58,7 @@ public class DomCDATASection
extends DomText
implements CDATASection
{
-
+
/**
* Constructs a CDATA section node associated with the specified
* document and holding the specified data.
@@ -86,6 +86,5 @@ public class DomCDATASection
{
return "#cdata-section";
}
-
-}
+}
diff --git a/gnu/xml/dom/DomCharacterData.java b/gnu/xml/dom/DomCharacterData.java
index 1eec5bea7..396c5f7a7 100644
--- a/gnu/xml/dom/DomCharacterData.java
+++ b/gnu/xml/dom/DomCharacterData.java
@@ -1,4 +1,4 @@
-/* DomCharacterData.java --
+/* DomCharacterData.java --
Copyright (C) 1999,2000,2001,2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -73,7 +73,7 @@ public abstract class DomCharacterData
{
return null;
}
-
+
}
/**
@@ -82,7 +82,7 @@ public abstract class DomCharacterData
static final NodeList CHILD_NODES = new EmptyNodeList();
private String text;
-
+
// package private
DomCharacterData(short nodeType, DomDocument doc, String value)
{
@@ -113,7 +113,7 @@ public abstract class DomCharacterData
mutating(value);
text = value;
}
-
+
/**
* <b>DOM L1</b>
* Modifies the value of this node.
@@ -153,7 +153,7 @@ public abstract class DomCharacterData
throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
}
}
-
+
/**
* <b>DOM L1</b>
* Returns the value of this node.
@@ -162,7 +162,7 @@ public abstract class DomCharacterData
{
return text;
}
-
+
/**
* <b>DOM L1</b>
* Returns the value of this node; same as getNodeValue.
@@ -180,7 +180,7 @@ public abstract class DomCharacterData
{
return text.length();
}
-
+
/**
* <b>DOM L1</b>
* Modifies the value of this node.
@@ -194,7 +194,7 @@ public abstract class DomCharacterData
char[] raw = text.toCharArray();
char[] tmp = arg.toCharArray ();
char[] buf = new char[raw.length + tmp.length];
-
+
try
{
System.arraycopy(raw, 0, buf, 0, offset);
@@ -210,7 +210,7 @@ public abstract class DomCharacterData
throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
}
}
-
+
/**
* <b>DOM L1</b>
* Modifies the value of this node. Causes DOMCharacterDataModified
@@ -223,7 +223,7 @@ public abstract class DomCharacterData
throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
}
char[] raw = text.toCharArray();
-
+
// deleteData
if (offset < 0 || count < 0 || offset > raw.length)
{
@@ -239,7 +239,7 @@ public abstract class DomCharacterData
System.arraycopy(raw, 0, buf, 0, offset);
System.arraycopy(raw, offset + count, buf, offset,
raw.length - (offset + count));
-
+
// insertData
char[] tmp = arg.toCharArray ();
char[] buf2 = new char[buf.length + tmp.length];
@@ -256,7 +256,7 @@ public abstract class DomCharacterData
throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
}
}
-
+
/**
* <b>DOM L1</b>
* Assigns the value of this node.
@@ -275,7 +275,7 @@ public abstract class DomCharacterData
mutating(value);
text = value;
}
-
+
/**
* <b>DOM L1</b>
* Assigns the value of this node; same as setNodeValue.
@@ -329,17 +329,16 @@ public abstract class DomCharacterData
{
return;
}
-
+
// EVENT: DOMCharacterDataModified, target = this,
// prev/new values provided
MutationEvent event;
-
+
event = (MutationEvent) createEvent("MutationEvents");
event.initMutationEvent("DOMCharacterDataModified",
true /* bubbles */, false /* nocancel */,
null, text, newValue, null, (short) 0);
dispatchEvent(event);
}
-
-}
+}
diff --git a/gnu/xml/dom/DomComment.java b/gnu/xml/dom/DomComment.java
index 71c816048..5be6bd518 100644
--- a/gnu/xml/dom/DomComment.java
+++ b/gnu/xml/dom/DomComment.java
@@ -1,4 +1,4 @@
-/* DomComment.java --
+/* DomComment.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,7 +54,7 @@ public class DomComment
extends DomCharacterData
implements Comment
{
-
+
/**
* Constructs a comment node associated with the specified
* document and holding the specified data.
@@ -67,7 +67,7 @@ public class DomComment
{
super(COMMENT_NODE, owner, value);
}
-
+
/**
* <b>DOM L1</b>
* Returns the string "#comment".
@@ -78,4 +78,3 @@ public class DomComment
}
}
-
diff --git a/gnu/xml/dom/DomDOMException.java b/gnu/xml/dom/DomDOMException.java
index cf93fcf97..4a3ba7a8c 100644
--- a/gnu/xml/dom/DomDOMException.java
+++ b/gnu/xml/dom/DomDOMException.java
@@ -1,4 +1,4 @@
-/* DomDOMException.java --
+/* DomDOMException.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import org.w3c.dom.Node;
* that is being reported, in terms of the relevant DOM structures
* and data.
*
- * @author David Brownell
+ * @author David Brownell
*/
public class DomDOMException
extends DOMException
@@ -56,13 +56,13 @@ public class DomDOMException
/** @serial Data that caused an error to be reported */
private String data;
-
+
/** @serial Node associated with the error. */
private Node node;
-
+
/** @serial Data associated with the error. */
private int value;
-
+
/**
* Constructs an exception, with the diagnostic message
* corresponding to the specified code.
@@ -71,7 +71,7 @@ public class DomDOMException
{
super(code, diagnostic(code));
}
-
+
/**
* Constructs an exception, with the diagnostic message
* corresponding to the specified code and additional
@@ -110,7 +110,7 @@ public class DomDOMException
public String getMessage()
{
String retval = super.getMessage();
-
+
if (data != null)
{
retval += "\nMore Information: " + data;
@@ -127,11 +127,11 @@ public class DomDOMException
}
// these strings should be localizable.
-
+
private static String diagnostic(short code)
{
switch (code)
- {
+ {
// DOM L1:
case INDEX_SIZE_ERR:
return "An index or size is out of range.";
@@ -153,7 +153,7 @@ public class DomDOMException
return "That object is not supported.";
case INUSE_ATTRIBUTE_ERR:
return "The attribute belongs to a different element.";
-
+
// DOM L2:
case INVALID_STATE_ERR:
return "The object is not usable.";
@@ -172,4 +172,3 @@ public class DomDOMException
}
}
-
diff --git a/gnu/xml/dom/DomDoctype.java b/gnu/xml/dom/DomDoctype.java
index d35eedc7f..ecf7a9588 100644
--- a/gnu/xml/dom/DomDoctype.java
+++ b/gnu/xml/dom/DomDoctype.java
@@ -1,4 +1,4 @@
-/* DomDoctype.java --
+/* DomDoctype.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -72,22 +72,22 @@ import org.w3c.dom.Notation;
* @see DomEntityReference
* @see DomNotation
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomDoctype
extends DomExtern
implements DocumentType
{
-
+
private DomNamedNodeMap notations;
private DomNamedNodeMap entities;
private final DOMImplementation implementation;
private String subset;
-
+
private HashMap elements = new HashMap();
private boolean ids;
-
+
/**
* Constructs a DocumentType node associated with the specified
* implementation, with the specified name.
@@ -103,11 +103,11 @@ public class DomDoctype
* @param impl The implementation with which this object is associated
* @param name Name of this root element
* @param publicId If non-null, provides the external subset's
- * PUBLIC identifier
+ * PUBLIC identifier
* @param systemId If non-null, provides the external subset's
- * SYSTEM identifier
+ * SYSTEM identifier
* @param internalSubset Provides the literal value (unparsed, no
- * entities expanded) of the DTD's internal subset.
+ * entities expanded) of the DTD's internal subset.
*/
protected DomDoctype(DOMImplementation impl,
String name,
@@ -154,7 +154,7 @@ public class DomDoctype
* then it doesn't have the strange construction rules of L2.</em>
*
* @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
+ * is not associated with a document.
*/
public NamedNodeMap getEntities()
{
@@ -172,15 +172,15 @@ public class DomDoctype
* @param publicId If non-null, provides the entity's PUBLIC identifier
* @param systemId Provides the entity's SYSTEM identifier
* @param notation If non-null, provides the entity's notation
- * (indicating an unparsed entity)
+ * (indicating an unparsed entity)
* @return The Entity that was declared, or null if the entity wasn't
- * recorded (because it's a parameter entity or because an entity with
- * this name was already declared).
+ * recorded (because it's a parameter entity or because an entity with
+ * this name was already declared).
*
* @exception DOMException NO_MODIFICATION_ALLOWED_ERR if the
- * DocumentType is no longer writable.
+ * DocumentType is no longer writable.
* @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
+ * is not associated with a document.
*/
public Entity declareEntity(String name,
String publicId,
@@ -188,7 +188,7 @@ public class DomDoctype
String notation)
{
DomEntity entity;
-
+
if (name.charAt(0) == '%' || "[dtd]".equals(name))
{
return null;
@@ -198,19 +198,19 @@ public class DomDoctype
throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
}
getEntities();
-
+
DomDocument.checkName(name, (owner != null) ?
"1.1".equals(owner.getXmlVersion()) : false);
if (entities.getNamedItem(name) != null)
{
return null;
}
-
+
entity = new DomEntity(owner, name, publicId, systemId, notation);
entities.setNamedItem(entity);
return entity;
}
-
+
/**
* <b>DOM L1</b>
* Returns information about any notations declared in the DTD.
@@ -219,7 +219,7 @@ public class DomDoctype
* then it doesn't have the strange construction rules of L2.</em>
*
* @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
+ * is not associated with a document.
*/
public NamedNodeMap getNotations()
{
@@ -239,25 +239,25 @@ public class DomDoctype
* @return The notation that was declared.
*
* @exception DOMException NO_MODIFICATION_ALLOWED_ERR if the
- * DocumentType is no longer writable.
+ * DocumentType is no longer writable.
* @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
+ * is not associated with a document.
*/
public Notation declareNotation(String name,
String publicId,
String systemId)
{
DomNotation notation;
-
+
if (isReadonly())
{
throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
}
getNotations();
-
+
DomDocument.checkName(name, (owner != null) ?
"1.1".equals(owner.getXmlVersion()) : false);
-
+
notation = new DomNotation(owner, name, publicId, systemId);
notations.setNamedItem(notation);
return notation;
@@ -290,7 +290,7 @@ public class DomDoctype
{
return null;
}
-
+
/**
* Sets the internal "readonly" flag so the node and its associated
* data (only lists of entities and notations, no type information
@@ -337,7 +337,7 @@ public class DomDoctype
{
return implementation.hasFeature(feature, version);
}
-
+
/**
* Returns the implementation associated with this document type.
*/
@@ -395,7 +395,7 @@ public class DomDoctype
{
return ids;
}
-
+
public boolean isSameNode(Node arg)
{
if (equals(arg))
@@ -423,7 +423,7 @@ public class DomDoctype
// TODO notations
return true;
}
-
+
/**
* Shallow clone of the doctype, except that associated
* entities and notations are (deep) cloned.
diff --git a/gnu/xml/dom/DomDocument.java b/gnu/xml/dom/DomDocument.java
index b32c6b82d..b1e99f46d 100644
--- a/gnu/xml/dom/DomDocument.java
+++ b/gnu/xml/dom/DomDocument.java
@@ -1,4 +1,4 @@
-/* DomDocument.java --
+/* DomDocument.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,7 +76,7 @@ import org.w3c.dom.xpath.XPathNSResolver;
* of basic XML conformance tests. (The huge XML character tables are
* hairy to implement.)
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomDocument
@@ -90,7 +90,7 @@ public class DomDocument
private boolean defaultAttributes = true;
boolean building; // if true, skip mutation events in the tree
-
+
DomDocumentConfiguration config;
String inputEncoding;
@@ -98,7 +98,7 @@ public class DomDocument
String version = "1.0";
boolean standalone;
String systemId;
-
+
/**
* Constructs a Document node, associating it with an instance
* of the DomImpl class.
@@ -115,7 +115,7 @@ public class DomDocument
{
this(new DomImpl());
}
-
+
/**
* Constructs a Document node, associating it with the specified
* implementation. This should only be used in conjunction with
@@ -165,7 +165,7 @@ public class DomDocument
{
defaultAttributes = flag;
}
-
+
/**
* <b>DOM L1</b>
* Returns the constant "#document".
@@ -236,12 +236,12 @@ public class DomDocument
{
doctype = null;
}
-
+
// yes, this is linear in size of document.
// it'd be easy enough to maintain a hashtable.
Node current = getDocumentElement();
Node temp;
-
+
if (current == null)
{
return null;
@@ -286,14 +286,14 @@ public class DomDocument
return element;
}
}
-
+
// descend?
if (current.hasChildNodes())
{
current = current.getFirstChild();
continue;
}
-
+
// lateral?
temp = current.getNextSibling();
if (temp != null)
@@ -301,8 +301,8 @@ public class DomDocument
current = temp;
continue;
}
-
- // back up ...
+
+ // back up ...
do
{
temp = current.getParentNode();
@@ -385,13 +385,13 @@ public class DomDocument
}
return super.replaceChild(newChild, refChild);
}
-
+
// NOTE: DOM can't really tell when the name of an entity,
// notation, or PI must follow the namespace rules (excluding
// colons) instead of the XML rules (which allow them without
// much restriction). That's an API issue. verifyXmlName
// aims to enforce the XML rules, not the namespace rules.
-
+
/**
* Throws a DOM exception if the specified name is not a legal XML 1.0
* Name.
@@ -417,7 +417,7 @@ public class DomDocument
}
// dog: rewritten to use the rules for XML 1.0 and 1.1
-
+
// Name start character
char c = name.charAt(0);
if (xml11)
@@ -565,13 +565,13 @@ public class DomDocument
char[] chars = value.toCharArray();
checkChar(chars, 0, chars.length, xml11);
}
-
+
static void checkChar(char[] buf, int off, int len, boolean xml11)
{
for (int i = 0; i < len; i++)
{
char c = buf[i];
-
+
// assume surrogate pairing checks out OK, for simplicity
if ((c >= 0x0020 && c <= 0xd7ff) ||
(c == 0x000a || c == 0x000d || c == 0x0009) ||
@@ -603,7 +603,7 @@ public class DomDocument
public Element createElement(String name)
{
Element element;
-
+
if (checkingCharacters)
{
checkName(name, "1.1".equals(version));
@@ -633,7 +633,7 @@ public class DomDocument
{
checkNCName(name, "1.1".equals(version));
}
-
+
if ("".equals(namespaceURI))
{
namespaceURI = null;
@@ -661,13 +661,13 @@ public class DomDocument
"prefixed name '" + name +
"' needs a URI", this, 0);
}
-
+
Element element = new DomElement(this, namespaceURI, name);
if (defaultAttributes)
setDefaultAttributes(element, name);
return element;
}
-
+
private void setDefaultAttributes(Element element, String name)
{
DomDoctype doctype = (DomDoctype) getDoctype();
@@ -687,7 +687,7 @@ public class DomDocument
if ("#IMPLIED".equals(attr.mode) && value == null)
continue;
DomAttr node = (DomAttr) createAttribute(attr.name);
-
+
if (value == null)
{
value = "";
@@ -830,7 +830,7 @@ public class DomDocument
{
checkNCName(name, "1.1".equals(version));
}
-
+
if ("".equals(namespaceURI))
{
namespaceURI = null;
@@ -871,7 +871,7 @@ public class DomDocument
}
return new DomAttr(this, namespaceURI, name);
}
-
+
/**
* <b>DOM L1</b>
* Returns a newly created reference to the specified entity.
@@ -1006,7 +1006,7 @@ public class DomDocument
{
Attr a = (Attr) srcAttrs.item(i);
Attr dflt;
-
+
// maybe update defaulted attributes
dflt = (Attr) dstAttrs.getNamedItem(a.getNodeName());
if (dflt != null)
@@ -1019,7 +1019,7 @@ public class DomDocument
}
continue;
}
-
+
dstAttrs.setNamedItem((Attr) importNode(a, false));
}
if (deep)
@@ -1039,7 +1039,7 @@ public class DomDocument
default:
throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, null, src, 0);
}
-
+
// FIXME cleanup a bit -- for deep copies, copy those
// children in one place, here (code sharing is healthy)
@@ -1077,7 +1077,7 @@ public class DomDocument
}
// DOM Level 3 methods
-
+
/**
* DOM L3
*/
@@ -1090,7 +1090,7 @@ public class DomDocument
{
this.inputEncoding = inputEncoding;
}
-
+
/**
* DOM L3
*/
@@ -1098,12 +1098,12 @@ public class DomDocument
{
return encoding;
}
-
+
public void setXmlEncoding(String encoding)
{
this.encoding = encoding;
}
-
+
public boolean getXmlStandalone()
{
return standalone;
@@ -1181,7 +1181,7 @@ public class DomDocument
return systemId;
*/
}
-
+
public String getDocumentURI()
{
return systemId;
@@ -1454,7 +1454,7 @@ public class DomDocument
ctx = ctxNext;
}
}
-
+
public Node renameNode(Node n, String namespaceURI, String qualifiedName)
throws DOMException
{
@@ -1514,7 +1514,7 @@ public class DomDocument
"xmlns namespace must be " +
XMLConstants.XMLNS_ATTRIBUTE_NS_URI, src, 0);
}
-
+
}
src.setNodeName(qualifiedName);
src.setNamespaceURI(namespaceURI);
@@ -1527,19 +1527,19 @@ public class DomDocument
}
// -- XPathEvaluator --
-
+
public XPathExpression createExpression(String expression,
XPathNSResolver resolver)
throws XPathException, DOMException
{
return new DomXPathExpression(this, expression, resolver);
}
-
+
public XPathNSResolver createNSResolver(Node nodeResolver)
{
return new DomXPathNSResolver(nodeResolver);
}
-
+
public Object evaluate(String expression,
Node contextNode,
XPathNSResolver resolver,
@@ -1553,4 +1553,3 @@ public class DomDocument
}
}
-
diff --git a/gnu/xml/dom/DomDocumentBuilder.java b/gnu/xml/dom/DomDocumentBuilder.java
index e62ce2076..99c254481 100644
--- a/gnu/xml/dom/DomDocumentBuilder.java
+++ b/gnu/xml/dom/DomDocumentBuilder.java
@@ -1,4 +1,4 @@
-/* DomDocumentBuilder.java --
+/* DomDocumentBuilder.java --
Copyright (C) 2004,2006,2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -68,7 +68,7 @@ class DomDocumentBuilder
final DOMImplementation impl;
final DOMImplementationLS ls;
final LSParser parser;
-
+
DomDocumentBuilder(DOMImplementation impl,
DOMImplementationLS ls,
LSParser parser)
@@ -83,7 +83,7 @@ class DomDocumentBuilder
DOMConfiguration config = parser.getDomConfig();
return ((Boolean) config.getParameter("namespaces")).booleanValue();
}
-
+
public boolean isValidating()
{
DOMConfiguration config = parser.getDomConfig();
@@ -112,7 +112,7 @@ class DomDocumentBuilder
{
return impl;
}
-
+
public Document newDocument()
{
return impl.createDocument(null, null, null);
@@ -225,4 +225,3 @@ class DomDocumentBuilder
}
}
-
diff --git a/gnu/xml/dom/DomDocumentBuilderFactory.java b/gnu/xml/dom/DomDocumentBuilderFactory.java
index 4d2828af8..1e3eaa582 100644
--- a/gnu/xml/dom/DomDocumentBuilderFactory.java
+++ b/gnu/xml/dom/DomDocumentBuilderFactory.java
@@ -1,4 +1,4 @@
-/* DomDocumentBuilderFactory.java --
+/* DomDocumentBuilderFactory.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -156,7 +156,7 @@ public class DomDocumentBuilderFactory
{
// TODO
}
-
+
public void setFeature(String name, boolean value)
throws ParserConfigurationException
{
@@ -177,6 +177,5 @@ public class DomDocumentBuilderFactory
return secureProcessing;
throw new ParserConfigurationException(name);
}
-
-}
+}
diff --git a/gnu/xml/dom/DomDocumentConfiguration.java b/gnu/xml/dom/DomDocumentConfiguration.java
index 5c589f82f..9aab44532 100644
--- a/gnu/xml/dom/DomDocumentConfiguration.java
+++ b/gnu/xml/dom/DomDocumentConfiguration.java
@@ -1,4 +1,4 @@
-/* DomDocumentConfiguration.java --
+/* DomDocumentConfiguration.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -245,12 +245,12 @@ class DomDocumentConfiguration
return null;
}
}
-
+
public int getLength()
{
return SUPPORTED_PARAMETERS.size();
}
-
+
public boolean contains(String str)
{
str = str.toLowerCase();
diff --git a/gnu/xml/dom/DomDocumentFragment.java b/gnu/xml/dom/DomDocumentFragment.java
index 8d2603778..8c4e0db3b 100644
--- a/gnu/xml/dom/DomDocumentFragment.java
+++ b/gnu/xml/dom/DomDocumentFragment.java
@@ -1,4 +1,4 @@
-/* DomDocumentFragment.java --
+/* DomDocumentFragment.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,14 +42,14 @@ import org.w3c.dom.DocumentFragment;
/**
* <p> "DocumentFragment" implementation. </p>
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomDocumentFragment
extends DomNode
implements DocumentFragment
{
-
+
/**
* Constructs a DocumentFragment node associated with the
* specified document.
@@ -71,6 +71,5 @@ public class DomDocumentFragment
{
return "#document-fragment";
}
-
-}
+}
diff --git a/gnu/xml/dom/DomElement.java b/gnu/xml/dom/DomElement.java
index 462cb9178..429749978 100644
--- a/gnu/xml/dom/DomElement.java
+++ b/gnu/xml/dom/DomElement.java
@@ -1,4 +1,4 @@
-/* DomElement.java --
+/* DomElement.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ import org.w3c.dom.TypeInfo;
/**
* <p> "Element" implementation.
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomElement
@@ -81,7 +81,7 @@ public class DomElement
*
* @param owner The document with which this node is associated
* @param namespaceURI Combined with the local part of the name,
- * this is used to uniquely identify a type of element
+ * this is used to uniquely identify a type of element
* @param name Name of this element, which may include a prefix
*/
protected DomElement(DomDocument owner, String namespaceURI, String name)
@@ -99,18 +99,18 @@ public class DomElement
* <p>
* With this constructor, the prefix and local part are given explicitly
* rather than being computed. This allows them to be explicitly set to
- * {@code null} as required by {@link Document#createElement(String)}.
+ * {@code null} as required by {@link Document#createElement(String)}.
* </p>
*
* @param owner The document with which this node is associated
* @param namespaceURI Combined with the local part of the name,
- * this is used to uniquely identify a type of element
+ * this is used to uniquely identify a type of element
* @param name Name of this element, which may include a prefix
* @param prefix the namespace prefix of the name. May be {@code null}.
* @param localName the local part of the name. May be {@code null}.
*/
protected DomElement(DomDocument owner, String namespaceURI, String name,
- String prefix, String localName)
+ String prefix, String localName)
{
super(ELEMENT_NODE, owner, namespaceURI, name, prefix, localName);
}
@@ -263,7 +263,7 @@ public class DomElement
* <b>DOM L1</b>
* Modifies an existing attribute to have the specified value,
* or creates a new one with that value. The name used is the
- * nodeName value.
+ * nodeName value.
*/
public void setAttribute(String name, String value)
{
@@ -476,7 +476,7 @@ public class DomElement
}
return super.lookupNamespaceURI(prefix);
}
-
+
public String getBaseURI()
{
if (attributes != null)
@@ -490,7 +490,7 @@ public class DomElement
}
return super.getBaseURI();
}
-
+
public TypeInfo getSchemaTypeInfo()
{
// DTD implementation
@@ -509,7 +509,7 @@ public class DomElement
Attr attr = (Attr) attrs.getNamedItem(name);
setIdAttributeNode(attr, isId);
}
-
+
public void setIdAttributeNode(Attr attr, boolean isId)
{
if (readonly)
@@ -578,5 +578,5 @@ public class DomElement
}
return true;
}
-
+
}
diff --git a/gnu/xml/dom/DomEntity.java b/gnu/xml/dom/DomEntity.java
index 3a76479a3..be44d7359 100644
--- a/gnu/xml/dom/DomEntity.java
+++ b/gnu/xml/dom/DomEntity.java
@@ -1,4 +1,4 @@
-/* DomEntity.java --
+/* DomEntity.java --
Copyright (C) 1999,2000,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,17 +45,17 @@ import org.w3c.dom.Entity;
* particularly well in this API:</p><dl>
*
* <dt><em>Unparsed Entities</em></dt>
- * <dd>Since ENTITY/ENTITIES attributes, the only legal use of unparsed
- * entities in XML, can't be detected with DOM, there isn't much point in
- * trying to use unparsed entities in DOM applications. (XML Linking is
- * working to provide a better version of this functionality.) </dd>
+ * <dd>Since ENTITY/ENTITIES attributes, the only legal use of unparsed
+ * entities in XML, can't be detected with DOM, there isn't much point in
+ * trying to use unparsed entities in DOM applications. (XML Linking is
+ * working to provide a better version of this functionality.) </dd>
*
* <dt><em>Parsed Entities</em></dt>
- * <dd> While the DOM specification permits nodes for parsed entities
- * to have a readonly set of children, this is not required and there
- * is no portable way to provide such children. <em>This implementation
- * currently does not permit children to be added to Entities.</em>
- * There are related issues with the use of EntityReference nodes. </dd>
+ * <dd> While the DOM specification permits nodes for parsed entities
+ * to have a readonly set of children, this is not required and there
+ * is no portable way to provide such children. <em>This implementation
+ * currently does not permit children to be added to Entities.</em>
+ * There are related issues with the use of EntityReference nodes. </dd>
*
* </dl>
*
@@ -65,14 +65,14 @@ import org.w3c.dom.Entity;
* @see DomEntityReference
* @see DomNotation
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomEntity
extends DomExtern
implements Entity
{
-
+
private String notation;
/**
@@ -113,13 +113,13 @@ public class DomEntity
}
// DOM Level 3 methods
-
+
public String getInputEncoding()
{
// TODO
- return null;
+ return null;
}
-
+
public String getXmlEncoding()
{
// TODO
@@ -142,6 +142,5 @@ public class DomEntity
String systemId = getSystemId();
return (systemId == null) ? owner.getBaseURI() : systemId;
}
-
-}
+}
diff --git a/gnu/xml/dom/DomEntityReference.java b/gnu/xml/dom/DomEntityReference.java
index d4596b405..1fa2ea628 100644
--- a/gnu/xml/dom/DomEntityReference.java
+++ b/gnu/xml/dom/DomEntityReference.java
@@ -1,4 +1,4 @@
-/* DomEntityReference.java --
+/* DomEntityReference.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,7 +71,7 @@ import org.w3c.dom.EntityReference;
* @see DomDoctype
* @see DomEntity
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomEntityReference
@@ -80,7 +80,7 @@ public class DomEntityReference
{
private String name;
-
+
/**
* Constructs an EntityReference node associated with the specified
* document. The creator should populate this with whatever contents
@@ -97,7 +97,7 @@ public class DomEntityReference
super(ENTITY_REFERENCE_NODE, owner);
this.name = name;
}
-
+
/**
* Returns the name of the referenced entity.
* @since DOM Level 1 Core
diff --git a/gnu/xml/dom/DomEvent.java b/gnu/xml/dom/DomEvent.java
index 9190ed8eb..3e9a6550a 100644
--- a/gnu/xml/dom/DomEvent.java
+++ b/gnu/xml/dom/DomEvent.java
@@ -1,4 +1,4 @@
-/* DomEvent.java --
+/* DomEvent.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import org.w3c.dom.events.EventTarget;
import org.w3c.dom.events.MutationEvent;
import org.w3c.dom.events.UIEvent;
-import org.w3c.dom.views.AbstractView; // used by UIEvent
+import org.w3c.dom.views.AbstractView; // used by UIEvent
/**
* "Event" implementation. Events are
@@ -62,7 +62,7 @@ import org.w3c.dom.views.AbstractView; // used by UIEvent
public class DomEvent
implements Event
{
-
+
String type; // init
EventTarget target;
EventTarget currentNode;
@@ -130,10 +130,10 @@ public class DomEvent
{
return timeStamp;
}
-
+
boolean stop;
boolean doDefault;
-
+
/**
* Requests the event no longer be captured or bubbled; only
* listeners on the event target will see the event, if they
@@ -174,7 +174,7 @@ public class DomEvent
cancelable = cancelableArg;
timeStamp = System.currentTimeMillis();
}
-
+
/** Constructs, but does not initialize, an event. */
public DomEvent(String type)
{
@@ -216,7 +216,7 @@ public class DomEvent
buf.append("]");
return buf.toString();
}
-
+
/**
* "MutationEvent" implementation.
*/
@@ -224,46 +224,46 @@ public class DomEvent
extends DomEvent
implements MutationEvent
{
-
+
// package private
Node relatedNode; // init
-
+
private String prevValue; // init
private String newValue; // init
-
+
private String attrName; // init
private short attrChange; // init
-
+
/** Returns any "related" node provided by this type of event */
public final Node getRelatedNode()
{
return relatedNode;
}
-
+
/** Returns any "previous value" provided by this type of event */
public final String getPrevValue()
{
return prevValue;
}
-
+
/** Returns any "new value" provided by this type of event */
public final String getNewValue()
{
return newValue;
}
-
+
/** For attribute change events, returns the attribute's name */
public final String getAttrName()
{
return attrName;
}
-
+
/** For attribute change events, returns how the attribuet changed */
public final short getAttrChange()
{
return attrChange;
}
-
+
/** Initializes a mutation event */
public final void initMutationEvent(String typeArg,
boolean canBubbleArg,
@@ -281,7 +281,7 @@ public class DomEvent
bubbles = canBubbleArg;
cancelable = cancelableArg;
timeStamp = System.currentTimeMillis();
-
+
relatedNode = relatedNodeArg;
prevValue = prevValueArg;
newValue = newValueArg;
@@ -304,7 +304,7 @@ public class DomEvent
{
super(type);
}
-
+
}
/**
@@ -314,16 +314,16 @@ public class DomEvent
extends DomEvent
implements UIEvent
{
-
+
private AbstractView view; // init
private int detail; // init
-
+
/** Constructs an uninitialized User Interface (UI) event */
public DomUIEvent (String type) { super (type); }
-
+
public final AbstractView getView () { return view; }
public final int getDetail () { return detail; }
-
+
/** Initializes a UI event */
public final void initUIEvent(String typeArg,
boolean canBubbleArg,
@@ -335,7 +335,7 @@ public class DomEvent
view = viewArg;
detail = detailArg;
}
-
+
}
/*
@@ -349,4 +349,3 @@ public class DomEvent
*/
}
-
diff --git a/gnu/xml/dom/DomExtern.java b/gnu/xml/dom/DomExtern.java
index 87a6909f7..7f2e55afc 100644
--- a/gnu/xml/dom/DomExtern.java
+++ b/gnu/xml/dom/DomExtern.java
@@ -1,4 +1,4 @@
-/* DomExtern.java --
+/* DomExtern.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,17 +48,17 @@ package gnu.xml.dom;
* of them is defined fully enough to permit full use of the
* XML feature they partially expose. </p>
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public abstract class DomExtern
extends DomNode
{
-
+
private final String name;
private final String publicId;
private final String systemId;
-
+
/**
* Constructs a node associated with the specified document,
* with the specified descriptive data.
@@ -98,7 +98,7 @@ public abstract class DomExtern
{
return publicId;
}
-
+
/**
* <b>DOM L1</b>
* Returns the object's name.
@@ -112,6 +112,5 @@ public abstract class DomExtern
{
return name;
}
-
-}
+}
diff --git a/gnu/xml/dom/DomImpl.java b/gnu/xml/dom/DomImpl.java
index cabe741c9..76a63caf6 100644
--- a/gnu/xml/dom/DomImpl.java
+++ b/gnu/xml/dom/DomImpl.java
@@ -1,4 +1,4 @@
-/* DomImpl.java --
+/* DomImpl.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,13 +64,13 @@ import gnu.xml.dom.ls.DomLSSerializer;
* It is possible to compile the package so it doesn't support some of these
* features (notably, Traversal).
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomImpl
implements DOMImplementation, DOMImplementationLS
{
-
+
/**
* Constructs a DOMImplementation object which supports
* "XML" and other DOM Level 2 features.
@@ -95,7 +95,7 @@ public class DomImpl
{
name = name.substring(1);
}
-
+
if ("xml".equals(name) || "core".equals(name))
{
return (version == null ||
@@ -103,7 +103,7 @@ public class DomImpl
"1.0".equals(version) ||
"2.0".equals(version) ||
"3.0".equals(version));
-
+
}
else if ("ls".equals(name) || "ls-async".equals(name))
{
@@ -120,7 +120,7 @@ public class DomImpl
return (version == null ||
"".equals(version) ||
"2.0".equals(version));
-
+
// Extension: "USER-" prefix event types can
// be created and passed through the DOM.
@@ -131,11 +131,11 @@ public class DomImpl
"".equals(version) ||
"0.1".equals(version));
- // NOTE: "hasFeature" for events is here interpreted to
- // mean the DOM can manufacture those sorts of events,
- // since actually choosing to report the events is more
- // often part of the environment or application. It's
- // only really an issue for mutation events.
+ // NOTE: "hasFeature" for events is here interpreted to
+ // mean the DOM can manufacture those sorts of events,
+ // since actually choosing to report the events is more
+ // often part of the environment or application. It's
+ // only really an issue for mutation events.
}
else if (DomNode.reportMutations
@@ -143,7 +143,7 @@ public class DomImpl
{
return (version == null ||
"".equals(version) ||
- "2.0".equals(version));
+ "2.0".equals(version));
}
else if ("xpath".equals(name))
{
@@ -162,7 +162,7 @@ public class DomImpl
// stylesheets
// css, css2
// range
-
+
return false;
}
@@ -208,7 +208,7 @@ public class DomImpl
{
Document doc = createDocument();
Element root = null;
-
+
if (rootName != null)
{
root = doc.createElementNS(namespaceURI, rootName);
@@ -221,7 +221,7 @@ public class DomImpl
// Bleech -- L2 seemingly _requires_ omission of xmlns attributes.
if (doctype != null)
{
- doc.appendChild(doctype); // handles WRONG_DOCUMENT error
+ doc.appendChild(doctype); // handles WRONG_DOCUMENT error
}
if (root != null)
{
@@ -236,7 +236,7 @@ public class DomImpl
}
// DOM Level 3
-
+
public Object getFeature(String feature, String version)
{
if (hasFeature(feature, version))
@@ -273,6 +273,5 @@ public class DomImpl
{
return new DomLSOutput();
}
-
-}
+}
diff --git a/gnu/xml/dom/DomIterator.java b/gnu/xml/dom/DomIterator.java
index 31f998246..d5f305cd8 100644
--- a/gnu/xml/dom/DomIterator.java
+++ b/gnu/xml/dom/DomIterator.java
@@ -1,4 +1,4 @@
-/* DomIterator.java --
+/* DomIterator.java --
Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,21 +50,21 @@ import org.w3c.dom.traversal.NodeIterator;
* <p> "NodeIterator" implementation, usable with any L2 DOM which
* supports MutationEvents. </p>
*
- * @author David Brownell
+ * @author David Brownell
*/
public final class DomIterator
implements NodeIterator, EventListener
{
-
+
private Node reference;
private boolean right;
private boolean done;
-
+
private final Node root;
private final int whatToShow;
private final NodeFilter filter;
private final boolean expandEntityReferences;
-
+
/**
* Constructs and initializes an iterator.
*/
@@ -73,22 +73,22 @@ public final class DomIterator
NodeFilter filter,
boolean entityReferenceExpansion)
{
- if (!root.isSupported("MutationEvents", "2.0"))
+ if (!root.isSupported("MutationEvents", "2.0"))
{
throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR,
"Iterator needs mutation events", root, 0);
}
-
+
this.root = root;
this.whatToShow = whatToShow;
this.filter = filter;
this.expandEntityReferences = entityReferenceExpansion;
-
+
// start condition: going right, seen nothing yet.
reference = null;
right = true;
-
- EventTarget target = (EventTarget) root;
+
+ EventTarget target = (EventTarget) root;
target.addEventListener("DOMNodeRemoved", this, false);
}
@@ -100,7 +100,7 @@ public final class DomIterator
*/
public void detach()
{
- EventTarget target = (EventTarget) root;
+ EventTarget target = (EventTarget) root;
target.removeEventListener("DOMNodeRemoved", this, false);
done = true;
}
@@ -114,7 +114,7 @@ public final class DomIterator
{
return expandEntityReferences;
}
-
+
/**
* <b>DOM L2</b>
* Returns the filter provided during construction.
@@ -123,7 +123,7 @@ public final class DomIterator
{
return filter;
}
-
+
/**
* <b>DOM L2</b>
* Returns the root of the tree this is iterating through.
@@ -132,7 +132,7 @@ public final class DomIterator
{
return root;
}
-
+
/**
* <b>DOM L2</b>
* Returns the mask of flags provided during construction.
@@ -141,7 +141,7 @@ public final class DomIterator
{
return whatToShow;
}
-
+
/**
* <b>DOM L2</b>
* Returns the next node in a forward iteration, masked and filtered.
@@ -228,7 +228,7 @@ public final class DomIterator
}
return leaf;
}
-
+
//
// Returns the immediate successor in a forward (or backward)
// document order walk, sans filtering ... except that it knows
@@ -253,13 +253,13 @@ public final class DomIterator
{
return here.getFirstChild();
}
-
+
// There's no way up or sideways from the root, so if we
// couldn't move down to a child, there's nowhere to go.
//
if (here == root)
return null;
-
+
//
// Siblings ... if forward, we visit them, if backwards
// we visit their children first.
@@ -284,7 +284,7 @@ public final class DomIterator
}
return next;
}
-
+
//
// We can't go down or lateral -- it's up, then. The logic is
// the converse of what's above: backwards is easy (the parent
@@ -295,7 +295,7 @@ public final class DomIterator
{
return next;
}
-
+
Node temp = null;
while (next != null
&& next != root
@@ -303,7 +303,7 @@ public final class DomIterator
{
next = next.getParentNode();
}
-
+
// If we have exceeded the root node then stop traversing.
if (next == root.getParentNode())
{
@@ -324,7 +324,7 @@ public final class DomIterator
{
MutationEvent event;
Node ancestor, removed;
-
+
if (reference == null
|| !"DOMNodeRemoved".equals(e.getType())
|| e.getEventPhase() != Event.BUBBLING_PHASE)
@@ -372,10 +372,9 @@ search:
}
return;
}
-
+
// The current DOM WD talks about a special case here;
// I've not yet seen it.
}
-
-}
+}
diff --git a/gnu/xml/dom/DomNSResolverContext.java b/gnu/xml/dom/DomNSResolverContext.java
index 4cf57772e..3dd957560 100644
--- a/gnu/xml/dom/DomNSResolverContext.java
+++ b/gnu/xml/dom/DomNSResolverContext.java
@@ -1,4 +1,4 @@
-/* DomNSResolverContext.java --
+/* DomNSResolverContext.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,41 +50,41 @@ class DomNSResolverContext
implements NamespaceContext, Iterator
{
- final XPathNSResolver resolver;
-
- DomNSResolverContext(XPathNSResolver resolver)
- {
- this.resolver = resolver;
- }
-
- public String getNamespaceURI(String prefix)
- {
- return resolver.lookupNamespaceURI(prefix);
- }
-
- public String getPrefix(String namespaceURI)
- {
- return null;
- }
-
- public Iterator getPrefixes(String namespaceURI)
- {
- return this;
- }
-
- public boolean hasNext()
- {
- return false;
- }
-
- public Object next()
- {
- return null;
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
+ final XPathNSResolver resolver;
+
+ DomNSResolverContext(XPathNSResolver resolver)
+ {
+ this.resolver = resolver;
+ }
+
+ public String getNamespaceURI(String prefix)
+ {
+ return resolver.lookupNamespaceURI(prefix);
+ }
+
+ public String getPrefix(String namespaceURI)
+ {
+ return null;
+ }
+
+ public Iterator getPrefixes(String namespaceURI)
+ {
+ return this;
+ }
+
+ public boolean hasNext()
+ {
+ return false;
+ }
+
+ public Object next()
+ {
+ return null;
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/gnu/xml/dom/DomNamedNodeMap.java b/gnu/xml/dom/DomNamedNodeMap.java
index e37cc3dce..7a767355a 100644
--- a/gnu/xml/dom/DomNamedNodeMap.java
+++ b/gnu/xml/dom/DomNamedNodeMap.java
@@ -1,4 +1,4 @@
-/* DomNamedNodeMap.java --
+/* DomNamedNodeMap.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import org.w3c.dom.Node;
* Used mostly to hold element attributes, but sometimes also
* to list notations or entities.
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomNamedNodeMap
@@ -55,11 +55,11 @@ public class DomNamedNodeMap
final DomNode owner;
final short type;
-
+
DomNode first;
int length;
boolean readonly;
-
+
// package private
DomNamedNodeMap(DomNode owner, short type)
{
@@ -76,8 +76,8 @@ public class DomNamedNodeMap
public final boolean isReadonly()
{
return readonly;
- }
-
+ }
+
/**
* Sets the internal "readonly" flag so the node and its
* children can't be changed.
@@ -90,7 +90,7 @@ public class DomNamedNodeMap
ctx.makeReadonly();
}
}
-
+
/**
* <b>DOM L1</b>
* Returns the named item from the map, or null; names are just
@@ -189,7 +189,7 @@ public class DomNamedNodeMap
node.parent = owner;
node.depth = owner.depth + 1;
}
-
+
String nodeName = node.getNodeName();
String localName = ns ? node.getLocalName() : null;
String namespaceURI = ns ? node.getNamespaceURI() : null;
@@ -197,7 +197,7 @@ public class DomNamedNodeMap
{
namespaceURI = null;
}
-
+
// maybe attribute ADDITION events (?)
DomNode last = null;
for (DomNode ctx = first; ctx != null; ctx = ctx.next)
@@ -373,10 +373,10 @@ public class DomNamedNodeMap
ctx.index = 0;
return ctx;
}
- }
+ }
throw new DomDOMException(DOMException.NOT_FOUND_ERR);
}
-
+
String getDefaultValue(String name)
{
DomDoctype doctype = (DomDoctype) owner.owner.getDoctype();
@@ -417,5 +417,5 @@ public class DomNamedNodeMap
{
return length;
}
-
+
}
diff --git a/gnu/xml/dom/DomNode.java b/gnu/xml/dom/DomNode.java
index 78e1ab85c..879baaa8d 100644
--- a/gnu/xml/dom/DomNode.java
+++ b/gnu/xml/dom/DomNode.java
@@ -1,4 +1,4 @@
-/* DomNode.java --
+/* DomNode.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -102,10 +102,10 @@ public abstract class DomNode
//final static String xmlnsURI = "http://www.w3.org/2000/xmlns/";
// tunable
- // NKIDS_* affects arrays of children (which grow)
+ // NKIDS_* affects arrays of children (which grow)
// (currently) fixed size:
- // ANCESTORS_* is for event capture/bubbling, # ancestors
- // NOTIFICATIONS_* is for per-node event delivery, # events
+ // ANCESTORS_* is for event capture/bubbling, # ancestors
+ // NOTIFICATIONS_* is for per-node event delivery, # events
private static final int NKIDS_DELTA = 8;
private static final int ANCESTORS_INIT = 20;
private static final int NOTIFICATIONS_INIT = 10;
@@ -193,7 +193,7 @@ public abstract class DomNode
this.owner = owner;
this.listeners = new HashSet();
}
-
+
/**
* <b>DOM L1</b>
@@ -314,7 +314,7 @@ public abstract class DomNode
this.owner;
DomDocument childOwner = child.owner;
short childNodeType = child.nodeType;
-
+
if (childOwner != owner)
{
// new in DOM L2, this case -- patch it up later, in reparent()
@@ -338,7 +338,7 @@ public abstract class DomNode
return;
}
break;
-
+
case ATTRIBUTE_NODE:
switch (childNodeType)
{
@@ -347,7 +347,7 @@ public abstract class DomNode
return;
}
break;
-
+
case DOCUMENT_FRAGMENT_NODE:
case ENTITY_REFERENCE_NODE:
case ELEMENT_NODE:
@@ -384,7 +384,7 @@ public abstract class DomNode
this, 0);
}
}
-
+
// Here's hoping a good optimizer will detect the case when the
// next several methods are never called, and won't allocate
// object code space of any kind. (Case: not reporting any
@@ -399,7 +399,7 @@ public abstract class DomNode
return;
}
boolean doFree = false;
-
+
if (event == null)
{
event = getMutationEvent();
@@ -531,7 +531,7 @@ public abstract class DomNode
{
try
{
- DomNode child = (DomNode) newChild;
+ DomNode child = (DomNode) newChild;
if (child.nodeType == DOCUMENT_FRAGMENT_NODE)
{
@@ -610,9 +610,9 @@ public abstract class DomNode
try
{
- DomNode child = (DomNode) newChild;
+ DomNode child = (DomNode) newChild;
DomNode ref = (DomNode) refChild;
-
+
if (child.nodeType == DOCUMENT_FRAGMENT_NODE)
{
// Append all nodes in the fragment to this node
@@ -641,7 +641,7 @@ public abstract class DomNode
"can't insert node before itself",
ref, 0);
}
-
+
if (child.parent != null)
{
child.parent.removeChild(child);
@@ -672,7 +672,7 @@ public abstract class DomNode
}
length++;
}
-
+
return child;
}
catch (ClassCastException e)
@@ -713,10 +713,10 @@ public abstract class DomNode
{
DomNode child = (DomNode) newChild;
DomNode ref = (DomNode) refChild;
-
+
DomEvent.DomMutationEvent event = getMutationEvent();
boolean doFree = (event != null);
-
+
if (child.nodeType == DOCUMENT_FRAGMENT_NODE)
{
// Append all nodes in the fragment to this node
@@ -729,14 +729,14 @@ public abstract class DomNode
throw new DomDOMException(DOMException.NOT_FOUND_ERR,
null, ref, 0);
}
-
+
if (reportMutations)
{
removalEvent(event, ref);
}
length--;
length += child.length;
-
+
if (child.length == 0)
{
// Removal
@@ -793,12 +793,12 @@ public abstract class DomNode
throw new DomDOMException(DOMException.NOT_FOUND_ERR,
null, ref, 0);
}
-
+
if (reportMutations)
{
removalEvent(event, ref);
}
-
+
if (child.parent != null)
{
child.parent.removeChild(child);
@@ -839,7 +839,7 @@ public abstract class DomNode
ref.setDepth(0);
ref.previous = null;
ref.next = null;
-
+
return ref;
}
catch (ClassCastException e)
@@ -875,7 +875,7 @@ public abstract class DomNode
throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
null, this, 0);
}
-
+
for (DomNode child = first; child != null; child = child.next)
{
if (child == ref)
@@ -913,7 +913,7 @@ public abstract class DomNode
ref.index = 0;
ref.previous = null;
ref.next = null;
-
+
return ref;
}
}
@@ -1002,9 +1002,9 @@ public abstract class DomNode
*/
public boolean isSupported(String feature, String version)
{
- Document doc = owner;
- DOMImplementation impl = null;
-
+ Document doc = owner;
+ DOMImplementation impl = null;
+
if (doc == null && nodeType == DOCUMENT_NODE)
{
doc = (Document) this;
@@ -1183,7 +1183,7 @@ public abstract class DomNode
try
{
DomNode node = (DomNode) super.clone();
-
+
node.parent = null;
node.depth = 0;
node.index = 0;
@@ -1192,7 +1192,7 @@ public abstract class DomNode
node.last = null;
node.previous = null;
node.next = null;
-
+
node.readonly = false;
node.listeners = new HashSet();
node.nListeners = 0;
@@ -1242,7 +1242,7 @@ public abstract class DomNode
{
private LiveNodeList liveList;
-
+
ShadowList(String ns, String local)
{
liveList = new LiveNodeList(ns, local);
@@ -1268,15 +1268,15 @@ public abstract class DomNode
final class LiveNodeList
implements NodeList, EventListener, NodeFilter
{
-
+
private final boolean matchAnyURI;
- private final boolean matchAnyName;
+ private final boolean matchAnyName;
private final String elementURI;
private final String elementName;
-
+
private DomIterator current;
private int lastIndex;
-
+
LiveNodeList(String uri, String name)
{
elementURI = uri;
@@ -1336,28 +1336,28 @@ public abstract class DomNode
{
return new DomIterator(DomNode.this,
NodeFilter.SHOW_ELEMENT,
- this, /* filter */
- true /* expand entity refs */
+ this, /* filter */
+ true /* expand entity refs */
);
}
public void handleEvent(Event e)
{
- MutationEvent mutation = (MutationEvent) e;
- Node related = mutation.getRelatedNode();
-
+ MutationEvent mutation = (MutationEvent) e;
+ Node related = mutation.getRelatedNode();
+
// XXX if it's got children ... check all kids too, they
// will invalidate our saved index
-
+
if (related.getNodeType() != Node.ELEMENT_NODE ||
related.getNodeName() != elementName ||
related.getNamespaceURI() != elementURI)
{
return;
}
-
+
if (current != null)
- current.detach();
+ current.detach();
current = null;
}
@@ -1368,7 +1368,7 @@ public abstract class DomNode
current = createIterator();
lastIndex = -1;
}
-
+
// last node or before? go backwards
if (index <= lastIndex) {
while (index != lastIndex) {
@@ -1376,11 +1376,11 @@ public abstract class DomNode
lastIndex--;
}
Node ret = current.previousNode ();
- current.detach();
+ current.detach();
current = null;
return ret;
- }
-
+ }
+
// somewhere after last node
while (++lastIndex != index)
current.nextNode ();
@@ -1390,12 +1390,12 @@ public abstract class DomNode
current = null;
return ret;
}
-
+
public int getLength()
{
int retval = 0;
NodeIterator iter = createIterator();
-
+
while (iter.nextNode() != null)
{
retval++;
@@ -1403,7 +1403,7 @@ public abstract class DomNode
iter.detach();
return retval;
}
-
+
}
//
@@ -1411,7 +1411,7 @@ public abstract class DomNode
//
static final class ListenerRecord
{
-
+
String type;
EventListener listener;
boolean useCapture;
@@ -1435,10 +1435,10 @@ public abstract class DomNode
&& useCapture == rec.useCapture
&& type == rec.type;
}
-
+
public int hashCode()
{
- return listener.hashCode() ^ type.hashCode();
+ return listener.hashCode() ^ type.hashCode();
}
}
@@ -1456,32 +1456,32 @@ public abstract class DomNode
* of DomEvent and pass that to dispatchEvent().
*
* @param eventType Identifies the particular DOM feature module
- * defining the type of event, such as "MutationEvents".
- * <em>The event "name" is a different kind of "type".</em>
+ * defining the type of event, such as "MutationEvents".
+ * <em>The event "name" is a different kind of "type".</em>
*/
public Event createEvent(String eventType)
{
eventType = eventType.toLowerCase();
-
+
if ("mutationevents".equals(eventType))
{
return new DomEvent.DomMutationEvent(null);
}
-
+
if ("htmlevents".equals(eventType)
|| "events".equals(eventType)
|| "user-events".equals(eventType))
{
return new DomEvent(null);
}
-
+
if ("uievents".equals(eventType))
{
return new DomEvent.DomUIEvent(null);
}
- // mouse events
-
+ // mouse events
+
throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR,
eventType, null, 0);
}
@@ -1508,12 +1508,12 @@ public abstract class DomNode
static final class DomEventException
extends EventException
{
-
+
DomEventException()
{
super(UNSPECIFIED_EVENT_TYPE_ERR, "unspecified event type");
}
-
+
}
/**
@@ -1527,7 +1527,7 @@ public abstract class DomNode
*
* @exception NullPointerException When a null event is passed.
* @exception ClassCastException When the event wasn't provided by
- * the createEvent method, or otherwise isn't a DomEvent.
+ * the createEvent method, or otherwise isn't a DomEvent.
* @exception EventException If the event type wasn't specified
*/
public final boolean dispatchEvent(Event event)
@@ -1537,7 +1537,7 @@ public abstract class DomNode
DomNode[] ancestors = null;
int ancestorMax = 0;
boolean haveDispatchDataLock = false;
-
+
if (e.type == null)
{
throw new DomEventException();
@@ -1545,7 +1545,7 @@ public abstract class DomNode
e.doDefault = true;
e.target = this;
-
+
//
// Typical case: one nonrecursive dispatchEvent call at a time
// for this class. If that's our case, we can avoid allocating
@@ -1565,7 +1565,7 @@ public abstract class DomNode
boolean haveAncestorRegistrations = false;
ListenerRecord[] notificationSet;
int ancestorLen;
-
+
synchronized (lockNode)
{
if (!dispatchDataLock)
@@ -1581,7 +1581,7 @@ public abstract class DomNode
}
ancestorLen = ancestors.length;
}
-
+
// Climb to the top of this subtree and handle capture, letting
// each node (from the top down) capture until one stops it or
// until we get to this one.
@@ -1597,7 +1597,7 @@ public abstract class DomNode
{
if (current == null || current.depth == 0)
break;
-
+
if (current.nListeners != 0)
{
haveAncestorRegistrations = true;
@@ -1609,10 +1609,10 @@ public abstract class DomNode
{
throw new RuntimeException("dispatchEvent capture stack size");
}
-
+
ancestorMax = index;
e.stop = false;
-
+
if (haveAncestorRegistrations)
{
e.eventPhase = Event.CAPTURING_PHASE;
@@ -1625,7 +1625,7 @@ public abstract class DomNode
}
}
}
-
+
// Always deliver events to the target node (this)
// unless stopPropagation was called. If we saw
// no registrations yet (typical!), we never will.
@@ -1638,11 +1638,11 @@ public abstract class DomNode
{
e.stop = true;
}
-
+
// If the event bubbles and propagation wasn't halted,
// walk back up the ancestor list. Stop bubbling when
// any bubbled event handler stops it.
-
+
if (!e.stop && e.bubbles)
{
e.eventPhase = Event.BUBBLING_PHASE;
@@ -1659,11 +1659,11 @@ public abstract class DomNode
}
}
e.eventPhase = 0;
-
+
// Caller chooses whether to perform the default
// action based on return from this method.
return e.doDefault;
-
+
}
finally
{
@@ -1678,13 +1678,13 @@ public abstract class DomNode
ancestors [i] = null;
}
// notificationSet handled by notifyNode
-
+
dispatchDataLock = false;
}
}
}
}
-
+
private void notifyNode(DomEvent e,
DomNode current,
boolean capture,
@@ -1704,7 +1704,7 @@ public abstract class DomNode
{
continue;
}
- if (!e.type.equals (rec.type))
+ if (!e.type.equals (rec.type))
{
continue;
}
@@ -1722,18 +1722,18 @@ public abstract class DomNode
iter = null;
// Notify just those listeners
- e.currentNode = current;
+ e.currentNode = current;
for (int i = 0; i < count; i++)
{
try
{
- iter = current.listeners.iterator();
+ iter = current.listeners.iterator();
// Late in the DOM CR process (3rd or 4th CR?) the
// removeEventListener spec became asymmetric with respect
// to addEventListener ... effect is now immediate.
- while (iter.hasNext())
+ while (iter.hasNext())
{
- ListenerRecord rec = (ListenerRecord)iter.next();
+ ListenerRecord rec = (ListenerRecord)iter.next();
if (rec.equals(notificationSet[i]))
{
@@ -1747,7 +1747,7 @@ public abstract class DomNode
{
// ignore all exceptions
}
- notificationSet[i] = null; // free for GC
+ notificationSet[i] = null; // free for GC
}
}
@@ -2074,7 +2074,7 @@ public abstract class DomNode
}
if (ctx != null || argCtx != null)
return false;
-
+
// TODO DocumentType
return true;
}
@@ -2082,9 +2082,9 @@ public abstract class DomNode
boolean equal(String arg1, String arg2)
{
return ((arg1 == null && arg2 == null) ||
- (arg1 != null && arg1.equals(arg2)));
+ (arg1 != null && arg1.equals(arg2)));
}
-
+
public Object getFeature(String feature, String version)
{
DOMImplementation impl = (nodeType == DOCUMENT_NODE) ?
@@ -2145,7 +2145,7 @@ public abstract class DomNode
buf.append(']');
return buf.toString();
}
-
+
String encode(String value)
{
CPStringBuilder buf = null;
@@ -2220,4 +2220,3 @@ public abstract class DomNode
}
}
-
diff --git a/gnu/xml/dom/DomNodeIterator.java b/gnu/xml/dom/DomNodeIterator.java
index 8001556e5..9f9ec7e39 100644
--- a/gnu/xml/dom/DomNodeIterator.java
+++ b/gnu/xml/dom/DomNodeIterator.java
@@ -1,4 +1,4 @@
-/* DomNodeIterator.java --
+/* DomNodeIterator.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -140,7 +140,7 @@ public class DomNodeIterator
current = (ret == null) ? current : ret;
}
while (!accept(ret));
-
+
return ret;
}
diff --git a/gnu/xml/dom/DomNotation.java b/gnu/xml/dom/DomNotation.java
index 26e78724f..abb0e9da9 100644
--- a/gnu/xml/dom/DomNotation.java
+++ b/gnu/xml/dom/DomNotation.java
@@ -1,4 +1,4 @@
-/* DomNotation.java --
+/* DomNotation.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,14 +56,14 @@ import org.w3c.dom.Notation;
* @see DomEntity
* @see DomPI
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomNotation
extends DomExtern
implements Notation
{
-
+
/**
* Constructs a Notation node associated with the specified document,
* with the specified descriptive data. Note that at least one of
@@ -72,7 +72,7 @@ public class DomNotation
*
* <p>This constructor should only be invoked by a DomDoctype object
* as part of its declareNotation functionality, or through a subclass
- * which is similarly used in a "Sub-DOM" style layer.
+ * which is similarly used in a "Sub-DOM" style layer.
*
* @param owner The document with which this notation is associated
* @param name Name of this notation
@@ -87,7 +87,7 @@ public class DomNotation
super(NOTATION_NODE, owner, name, publicId, systemId);
makeReadonly();
}
-
+
/**
* The base URI of an external entity is its system ID.
* The base URI of an internal entity is the parent document's base URI.
@@ -98,6 +98,5 @@ public class DomNotation
String systemId = getSystemId();
return (systemId == null) ? owner.getBaseURI() : systemId;
}
-
-}
+}
diff --git a/gnu/xml/dom/DomNsNode.java b/gnu/xml/dom/DomNsNode.java
index d3361515b..55e351185 100644
--- a/gnu/xml/dom/DomNsNode.java
+++ b/gnu/xml/dom/DomNsNode.java
@@ -1,4 +1,4 @@
-/* DomNsNode.java --
+/* DomNsNode.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,25 +44,25 @@ import org.w3c.dom.DOMException;
* <p> Abstract implemention of namespace support. This facilitates
* sharing code for attribute and element nodes.
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public abstract class DomNsNode
extends DomNode
{
-
+
private String name;
private String namespace;
private String prefix;
private String localName;
-
+
/**
* Constructs a node associated with the specified document, and
* with the specified namespace information.
*
* @param owner The document with which this entity is associated
* @param namespaceURI Combined with the local part of the name,
- * this identifies a type of element or attribute; may be null.
+ * this identifies a type of element or attribute; may be null.
* If this is the empty string, it is reassigned as null so that
* applications only need to test that case.
* @param name Name of this node, which may include a prefix
@@ -84,7 +84,7 @@ public abstract class DomNsNode
*
* @param owner The document with which this entity is associated
* @param namespaceURI Combined with the local part of the name,
- * this identifies a type of element or attribute; may be null.
+ * this identifies a type of element or attribute; may be null.
* If this is the empty string, it is reassigned as null so that
* applications only need to test that case.
* @param name Name of this node, which may include a prefix
@@ -93,7 +93,7 @@ public abstract class DomNsNode
*/
// package private
DomNsNode(short nodeType, DomDocument owner, String namespaceURI, String name,
- String prefix, String localName)
+ String prefix, String localName)
{
super(nodeType, owner);
this.name = name.intern();
@@ -126,7 +126,7 @@ public abstract class DomNsNode
localName = name.substring(index + 1).intern();
}
}
-
+
/**
* <b>DOM L2</b>
* Returns the node's namespace URI
@@ -145,7 +145,7 @@ public abstract class DomNsNode
}
namespace = (namespaceURI == null) ? null : namespaceURI.intern();
}
-
+
/**
* <b>DOM L2</b>
* Returns any prefix part of the node's name (before any colon).
@@ -222,6 +222,5 @@ public abstract class DomNsNode
{
return localName;
}
-
-}
+}
diff --git a/gnu/xml/dom/DomProcessingInstruction.java b/gnu/xml/dom/DomProcessingInstruction.java
index 2c90967d0..6d443a293 100644
--- a/gnu/xml/dom/DomProcessingInstruction.java
+++ b/gnu/xml/dom/DomProcessingInstruction.java
@@ -1,4 +1,4 @@
-/* DomProcessingInstruction.java --
+/* DomProcessingInstruction.java --
Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,24 +55,24 @@ import org.w3c.dom.ProcessingInstruction;
*
* @see DomNotation
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomProcessingInstruction
extends DomNode
implements ProcessingInstruction
{
-
+
private String target;
private String data;
-
+
/**
* Constructs a ProcessingInstruction node associated with the
* specified document, with the specified data.
*
* <p>This constructor should only be invoked by a Document object as
* part of its createProcessingInstruction functionality, or through
- * a subclass which is similarly used in a "Sub-DOM" style layer.
+ * a subclass which is similarly used in a "Sub-DOM" style layer.
*/
protected DomProcessingInstruction(DomDocument owner,
String target, String data)
@@ -129,7 +129,7 @@ public class DomProcessingInstruction
{
setNodeValue(data);
}
-
+
/**
* <b>DOM L1</b>
* Assigns the data associated with the processing instruction.
@@ -142,6 +142,5 @@ public class DomProcessingInstruction
}
this.data = data;
}
-
-}
+}
diff --git a/gnu/xml/dom/DomText.java b/gnu/xml/dom/DomText.java
index 167eba3c1..b74c5b4c2 100644
--- a/gnu/xml/dom/DomText.java
+++ b/gnu/xml/dom/DomText.java
@@ -1,4 +1,4 @@
-/* DomText.java --
+/* DomText.java --
Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,24 +45,24 @@ import org.w3c.dom.Text;
/**
* <p> "Text" implementation. </p>
*
- * @author David Brownell
+ * @author David Brownell
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DomText
extends DomCharacterData
implements Text
{
-
+
// NOTE: deleted unused per-instance "isIgnorable"
// support to reclaim its space.
-
+
/**
* Constructs a text node associated with the specified
* document and holding the specified data.
*
* <p>This constructor should only be invoked by a Document object
* as part of its createTextNode functionality, or through a subclass
- * which is similarly used in a "Sub-DOM" style layer.
+ * which is similarly used in a "Sub-DOM" style layer.
*/
protected DomText(DomDocument owner, String value)
{
@@ -112,7 +112,7 @@ public class DomText
String before = text.substring(0, offset);
String after = text.substring(offset);
Text next;
-
+
if (getNodeType() == TEXT_NODE)
{
next = owner.createTextNode(after);
@@ -121,7 +121,7 @@ public class DomText
{
next = owner.createCDATASection(after);
}
-
+
if (this.next != null)
{
parent.insertBefore(next, this.next);
@@ -132,16 +132,16 @@ public class DomText
}
setNodeValue(before);
return next;
-
+
}
catch (IndexOutOfBoundsException x)
{
throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
}
}
-
+
// DOM Level 3
-
+
public boolean isElementContentWhitespace()
{
if (parent != null)
@@ -192,7 +192,7 @@ public class DomText
{
setNodeValue(content);
}
-
+
DomNode ref = this;
DomNode ctx;
for (ctx = previous; ctx != null &&
@@ -218,5 +218,5 @@ public class DomText
}
return (isEmpty) ? null : this;
}
-
+
}
diff --git a/gnu/xml/dom/DomXPathExpression.java b/gnu/xml/dom/DomXPathExpression.java
index 25187520c..0b6962930 100644
--- a/gnu/xml/dom/DomXPathExpression.java
+++ b/gnu/xml/dom/DomXPathExpression.java
@@ -1,4 +1,4 @@
-/* DomXPathExpression.java --
+/* DomXPathExpression.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -73,13 +73,13 @@ implements org.w3c.dom.xpath.XPathExpression
{
this.doc = doc;
this.resolver = resolver;
-
- XPathFactory factory = XPathFactory.newInstance();
- XPath xpath = factory.newXPath();
- if (resolver != null)
- {
- xpath.setNamespaceContext(new DomNSResolverContext(resolver));
- }
+
+ XPathFactory factory = XPathFactory.newInstance();
+ XPath xpath = factory.newXPath();
+ if (resolver != null)
+ {
+ xpath.setNamespaceContext(new DomNSResolverContext(resolver));
+ }
try
{
this.expression = xpath.compile(expression);
@@ -87,61 +87,61 @@ implements org.w3c.dom.xpath.XPathExpression
catch (XPathExpressionException e)
{
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,
- e.getMessage ());
+ e.getMessage ());
}
}
public Object evaluate(Node contextNode, short type, Object result)
throws XPathException, DOMException
{
- try
- {
- QName typeName = null;
- switch (type)
- {
- case XPathResult.BOOLEAN_TYPE:
- typeName = XPathConstants.BOOLEAN;
- break;
- case XPathResult.NUMBER_TYPE:
- typeName = XPathConstants.NUMBER;
- break;
- case XPathResult.STRING_TYPE:
- typeName = XPathConstants.STRING;
- break;
- case XPathResult.ANY_UNORDERED_NODE_TYPE:
- case XPathResult.FIRST_ORDERED_NODE_TYPE:
- typeName = XPathConstants.NODE;
- break;
- case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
- case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
- typeName = XPathConstants.NODESET;
- break;
- default:
- throw new XPathException(XPathException.TYPE_ERR, null);
- }
- Object val = expression.evaluate(contextNode, typeName);
- switch (type)
- {
- case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
- // Sort the nodes
- List ns = new ArrayList((Collection) val);
- Collections.sort(ns, new DocumentOrderComparator());
- val = ns;
- }
- return new DomXPathResult(val, type);
- }
- catch (javax.xml.xpath.XPathException e)
- {
- throw new XPathException(XPathException.TYPE_ERR, e.getMessage());
- }
+ try
+ {
+ QName typeName = null;
+ switch (type)
+ {
+ case XPathResult.BOOLEAN_TYPE:
+ typeName = XPathConstants.BOOLEAN;
+ break;
+ case XPathResult.NUMBER_TYPE:
+ typeName = XPathConstants.NUMBER;
+ break;
+ case XPathResult.STRING_TYPE:
+ typeName = XPathConstants.STRING;
+ break;
+ case XPathResult.ANY_UNORDERED_NODE_TYPE:
+ case XPathResult.FIRST_ORDERED_NODE_TYPE:
+ typeName = XPathConstants.NODE;
+ break;
+ case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
+ case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
+ case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
+ case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
+ typeName = XPathConstants.NODESET;
+ break;
+ default:
+ throw new XPathException(XPathException.TYPE_ERR, null);
+ }
+ Object val = expression.evaluate(contextNode, typeName);
+ switch (type)
+ {
+ case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
+ case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
+ // Sort the nodes
+ List ns = new ArrayList((Collection) val);
+ Collections.sort(ns, new DocumentOrderComparator());
+ val = ns;
+ }
+ return new DomXPathResult(val, type);
+ }
+ catch (javax.xml.xpath.XPathException e)
+ {
+ throw new XPathException(XPathException.TYPE_ERR, e.getMessage());
+ }
}
public String toString ()
{
return getClass ().getName () + "[expression=" + expression + "]";
}
-
+
}
diff --git a/gnu/xml/dom/DomXPathNSResolver.java b/gnu/xml/dom/DomXPathNSResolver.java
index 96dfd97d4..fb0719a4e 100644
--- a/gnu/xml/dom/DomXPathNSResolver.java
+++ b/gnu/xml/dom/DomXPathNSResolver.java
@@ -1,4 +1,4 @@
-/* DomXPathNSResolver.java --
+/* DomXPathNSResolver.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,5 +60,5 @@ implements XPathNSResolver
{
return node.lookupNamespaceURI (prefix);
}
-
+
}
diff --git a/gnu/xml/dom/DomXPathResult.java b/gnu/xml/dom/DomXPathResult.java
index bed249624..da8fcf513 100644
--- a/gnu/xml/dom/DomXPathResult.java
+++ b/gnu/xml/dom/DomXPathResult.java
@@ -1,4 +1,4 @@
-/* DomXPathResult.java --
+/* DomXPathResult.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/dom/ImplementationList.java b/gnu/xml/dom/ImplementationList.java
index 8c0f44916..c99f55d0d 100644
--- a/gnu/xml/dom/ImplementationList.java
+++ b/gnu/xml/dom/ImplementationList.java
@@ -1,4 +1,4 @@
-/* ImplementationList.java --
+/* ImplementationList.java --
Copyright (C) 2004 Free Software Foundation, Inc..
This file is part of GNU Classpath.
diff --git a/gnu/xml/dom/ImplementationSource.java b/gnu/xml/dom/ImplementationSource.java
index 913079cd0..5f404423a 100644
--- a/gnu/xml/dom/ImplementationSource.java
+++ b/gnu/xml/dom/ImplementationSource.java
@@ -1,4 +1,4 @@
-/* ImplementationSource.java --
+/* ImplementationSource.java --
Copyright (C) 2004 Free Software Foundation, Inc..
This file is part of GNU Classpath.
@@ -72,7 +72,7 @@ public class ImplementationSource
}
catch (Exception e)
{
- // libxmlj not available
+ // libxmlj not available
}
catch (UnsatisfiedLinkError e)
{
diff --git a/gnu/xml/dom/JAXPFactory.java b/gnu/xml/dom/JAXPFactory.java
index ca14a8e9d..d7d399b5b 100644
--- a/gnu/xml/dom/JAXPFactory.java
+++ b/gnu/xml/dom/JAXPFactory.java
@@ -1,4 +1,4 @@
-/* JAXPFactory.java --
+/* JAXPFactory.java --
Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -66,20 +66,20 @@ import javax.xml.parsers.SAXParserFactory;
public final class JAXPFactory
extends DocumentBuilderFactory
{
-
- private static final String PROPERTY = "http://xml.org/sax/properties/";
- private static final String FEATURE = "http://xml.org/sax/features/";
-
- private SAXParserFactory pf;
+
+ private static final String PROPERTY = "http://xml.org/sax/properties/";
+ private static final String FEATURE = "http://xml.org/sax/features/";
+
+ private SAXParserFactory pf;
private boolean secureProcessing;
-
+
/**
* Default constructor.
*/
public JAXPFactory()
{
}
-
+
/**
* Constructs a JAXP document builder which uses the default
* JAXP SAX2 parser and the DOM implementation in this package.
@@ -94,14 +94,14 @@ public final class JAXPFactory
pf = new gnu.xml.aelfred2.JAXPFactory();
// pf = SAXParserFactory.newInstance ();
}
-
+
// JAXP default: false
pf.setValidating(isValidating());
// FIXME: this namespace setup may cause errors in some
// conformant SAX2 parsers, which we CAN patch up by
// splicing a "NSFilter" stage up front ...
-
+
// JAXP default: false
pf.setNamespaceAware(isNamespaceAware());
@@ -118,7 +118,7 @@ public final class JAXPFactory
throw new ParserConfigurationException(msg);
}
}
-
+
/** There seems to be no useful specification for attribute names */
public void setAttribute(String name, Object value)
throws IllegalArgumentException
@@ -160,21 +160,21 @@ public final class JAXPFactory
return secureProcessing;
throw new ParserConfigurationException(name);
}
-
+
static final class JAXPBuilder
extends DocumentBuilder
implements ErrorHandler
{
- private Consumer consumer;
- private XMLReader producer;
- private DomImpl impl;
-
+ private Consumer consumer;
+ private XMLReader producer;
+ private DomImpl impl;
+
JAXPBuilder(XMLReader parser, JAXPFactory factory)
throws ParserConfigurationException
{
impl = new DomImpl();
-
+
// set up consumer side
try
{
@@ -198,8 +198,8 @@ public final class JAXPFactory
try
{
- String id;
-
+ String id;
+
// if validating, report validity errors, and default
// to treating them as fatal
if (factory.isValidating ())
@@ -207,7 +207,7 @@ public final class JAXPFactory
producer.setFeature(FEATURE + "validation", true);
producer.setErrorHandler(this);
}
-
+
// always save prefix info, maybe do namespace processing
producer.setFeature(FEATURE + "namespace-prefixes", true);
producer.setFeature(FEATURE + "namespaces",
@@ -219,15 +219,15 @@ public final class JAXPFactory
id = PROPERTY + "declaration-handler";
producer.setProperty(id, consumer.getProperty(id));
-
+
}
catch (SAXException e)
{
throw new ParserConfigurationException(e.getMessage());
}
}
-
- public Document parse(InputSource source)
+
+ public Document parse(InputSource source)
throws SAXException, IOException
{
producer.parse(source);
@@ -283,27 +283,26 @@ public final class JAXPFactory
{
return new DomDocument();
}
-
+
// implementation of error handler that's used when validating
public void fatalError(SAXParseException e)
throws SAXException
{
throw e;
}
-
+
public void error(SAXParseException e)
throws SAXException
{
throw e;
}
-
+
public void warning(SAXParseException e)
throws SAXException
{
/* ignore */
}
-
+
}
}
-
diff --git a/gnu/xml/dom/html2/DomHTMLAnchorElement.java b/gnu/xml/dom/html2/DomHTMLAnchorElement.java
index 5da913306..4448dd580 100644
--- a/gnu/xml/dom/html2/DomHTMLAnchorElement.java
+++ b/gnu/xml/dom/html2/DomHTMLAnchorElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLAnchorElement.java --
+/* DomHTMLAnchorElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLAnchorElement
{
setHTMLAttribute("accesskey", accessKey);
}
-
+
public String getCharset()
{
return getHTMLAttribute("charset");
@@ -74,7 +74,7 @@ public class DomHTMLAnchorElement
{
setHTMLAttribute("charset", charset);
}
-
+
public String getCoords()
{
return getHTMLAttribute("coords");
@@ -84,7 +84,7 @@ public class DomHTMLAnchorElement
{
setHTMLAttribute("coords", coords);
}
-
+
public String getHref()
{
return getHTMLAttribute("href");
@@ -94,7 +94,7 @@ public class DomHTMLAnchorElement
{
setHTMLAttribute("href", href);
}
-
+
public String getHreflang()
{
return getHTMLAttribute("hreflang");
@@ -104,7 +104,7 @@ public class DomHTMLAnchorElement
{
setHTMLAttribute("hreflang", hreflang);
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -114,7 +114,7 @@ public class DomHTMLAnchorElement
{
setHTMLAttribute("name", name);
}
-
+
public String getRel()
{
return getHTMLAttribute("rel");
@@ -124,7 +124,7 @@ public class DomHTMLAnchorElement
{
setHTMLAttribute("rel", rel);
}
-
+
public String getRev()
{
return getHTMLAttribute("rev");
@@ -134,7 +134,7 @@ public class DomHTMLAnchorElement
{
setHTMLAttribute("rev", rev);
}
-
+
public String getShape()
{
return getHTMLAttribute("shape");
@@ -144,7 +144,7 @@ public class DomHTMLAnchorElement
{
setHTMLAttribute("shape", shape);
}
-
+
public int getTabIndex()
{
return getIntHTMLAttribute("tabindex");
@@ -154,7 +154,7 @@ public class DomHTMLAnchorElement
{
setIntHTMLAttribute("tabindex", tabIndex);
}
-
+
public String getTarget()
{
return getHTMLAttribute("target");
@@ -164,7 +164,7 @@ public class DomHTMLAnchorElement
{
setHTMLAttribute("target", target);
}
-
+
public String getType()
{
return getHTMLAttribute("type");
@@ -184,6 +184,5 @@ public class DomHTMLAnchorElement
{
dispatchUIEvent("focus");
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLAppletElement.java b/gnu/xml/dom/html2/DomHTMLAppletElement.java
index 918cf0d92..429fb0038 100644
--- a/gnu/xml/dom/html2/DomHTMLAppletElement.java
+++ b/gnu/xml/dom/html2/DomHTMLAppletElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLAppletElement.java --
+/* DomHTMLAppletElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("align", align);
}
-
+
public String getCls()
{
return getHTMLAttribute("class");
@@ -74,7 +74,7 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("class", cls);
}
-
+
public String getSrc()
{
return getHTMLAttribute("src");
@@ -84,7 +84,7 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("src", src);
}
-
+
public String getAlt()
{
return getHTMLAttribute("alt");
@@ -94,7 +94,7 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("alt", alt);
}
-
+
public String getArchive()
{
return getHTMLAttribute("archive");
@@ -104,7 +104,7 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("archive", archive);
}
-
+
public String getCode()
{
return getHTMLAttribute("code");
@@ -114,7 +114,7 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("code", code);
}
-
+
public String getCodeBase()
{
return getHTMLAttribute("codebase");
@@ -124,7 +124,7 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("codebase", codeBase);
}
-
+
public String getHeight()
{
return getHTMLAttribute("height");
@@ -134,7 +134,7 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("height", height);
}
-
+
public int getHspace()
{
return getIntHTMLAttribute("hspace");
@@ -144,7 +144,7 @@ public class DomHTMLAppletElement
{
setIntHTMLAttribute("hspace", hspace);
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -154,7 +154,7 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("name", name);
}
-
+
public String getObject()
{
return getHTMLAttribute("object");
@@ -164,7 +164,7 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("object", object);
}
-
+
public int getVspace()
{
return getIntHTMLAttribute("vspace");
@@ -174,7 +174,7 @@ public class DomHTMLAppletElement
{
setIntHTMLAttribute("vspace", vspace);
}
-
+
public String getWidth()
{
return getHTMLAttribute("width");
@@ -185,4 +185,3 @@ public class DomHTMLAppletElement
setHTMLAttribute("width", width);
}
}
-
diff --git a/gnu/xml/dom/html2/DomHTMLAreaElement.java b/gnu/xml/dom/html2/DomHTMLAreaElement.java
index d7eed07dd..728b3fdfc 100644
--- a/gnu/xml/dom/html2/DomHTMLAreaElement.java
+++ b/gnu/xml/dom/html2/DomHTMLAreaElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLAreaElement.java --
+/* DomHTMLAreaElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLAreaElement
{
setHTMLAttribute("accesskey", accessKey);
}
-
+
public String getAlt()
{
return getHTMLAttribute("alt");
@@ -74,7 +74,7 @@ public class DomHTMLAreaElement
{
setHTMLAttribute("alt", alt);
}
-
+
public String getCoords()
{
return getHTMLAttribute("coords");
@@ -84,7 +84,7 @@ public class DomHTMLAreaElement
{
setHTMLAttribute("coords", coords);
}
-
+
public String getHref()
{
return getHTMLAttribute("href");
@@ -94,7 +94,7 @@ public class DomHTMLAreaElement
{
setHTMLAttribute("href", href);
}
-
+
public boolean getNoHref()
{
return getBooleanHTMLAttribute("nohref");
@@ -104,7 +104,7 @@ public class DomHTMLAreaElement
{
setBooleanHTMLAttribute("nohref", nohref);
}
-
+
public String getShape()
{
return getHTMLAttribute("shape");
@@ -114,7 +114,7 @@ public class DomHTMLAreaElement
{
setHTMLAttribute("shape", shape);
}
-
+
public int getTabIndex()
{
return getIntHTMLAttribute("tabindex");
@@ -124,7 +124,7 @@ public class DomHTMLAreaElement
{
setIntHTMLAttribute("tabindex", tabIndex);
}
-
+
public String getTarget()
{
return getHTMLAttribute("target");
@@ -134,6 +134,5 @@ public class DomHTMLAreaElement
{
setHTMLAttribute("target", target);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLBRElement.java b/gnu/xml/dom/html2/DomHTMLBRElement.java
index 673699d52..5ad49c549 100644
--- a/gnu/xml/dom/html2/DomHTMLBRElement.java
+++ b/gnu/xml/dom/html2/DomHTMLBRElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLBRElement.java --
+/* DomHTMLBRElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLBRElement
{
setHTMLAttribute("clear", clear);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLBaseElement.java b/gnu/xml/dom/html2/DomHTMLBaseElement.java
index ddc805307..99a0993ba 100644
--- a/gnu/xml/dom/html2/DomHTMLBaseElement.java
+++ b/gnu/xml/dom/html2/DomHTMLBaseElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLBaseElement.java --
+/* DomHTMLBaseElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLBaseElement
{
setHTMLAttribute("href", href);
}
-
+
public String getTarget()
{
return getHTMLAttribute("target");
@@ -74,6 +74,5 @@ public class DomHTMLBaseElement
{
setHTMLAttribute("target", target);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLBaseFontElement.java b/gnu/xml/dom/html2/DomHTMLBaseFontElement.java
index 73172d3bf..73ec96dbd 100644
--- a/gnu/xml/dom/html2/DomHTMLBaseFontElement.java
+++ b/gnu/xml/dom/html2/DomHTMLBaseFontElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLBaseFontElement.java --
+/* DomHTMLBaseFontElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLBaseFontElement
{
setHTMLAttribute("color", color);
}
-
+
public String getFace()
{
return getHTMLAttribute("face");
@@ -74,7 +74,7 @@ public class DomHTMLBaseFontElement
{
setHTMLAttribute("face", face);
}
-
+
public int getSize()
{
return getIntHTMLAttribute("size");
@@ -84,6 +84,5 @@ public class DomHTMLBaseFontElement
{
setIntHTMLAttribute("size", size);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLBodyElement.java b/gnu/xml/dom/html2/DomHTMLBodyElement.java
index 44fbcf23c..d4528625b 100644
--- a/gnu/xml/dom/html2/DomHTMLBodyElement.java
+++ b/gnu/xml/dom/html2/DomHTMLBodyElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLBodyElement.java --
+/* DomHTMLBodyElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLBodyElement
{
setHTMLAttribute("alink", alink);
}
-
+
public String getBackground()
{
return getHTMLAttribute("background");
@@ -74,7 +74,7 @@ public class DomHTMLBodyElement
{
setHTMLAttribute("background", background);
}
-
+
public String getBgColor()
{
return getHTMLAttribute("bgcolor");
@@ -84,7 +84,7 @@ public class DomHTMLBodyElement
{
setHTMLAttribute("bgcolor", bgcolor);
}
-
+
public String getLink()
{
return getHTMLAttribute("link");
@@ -94,7 +94,7 @@ public class DomHTMLBodyElement
{
setHTMLAttribute("link", link);
}
-
+
public String getText()
{
return getHTMLAttribute("text");
@@ -104,7 +104,7 @@ public class DomHTMLBodyElement
{
setHTMLAttribute("text", text);
}
-
+
public String getVLink()
{
return getHTMLAttribute("vlink");
@@ -114,6 +114,5 @@ public class DomHTMLBodyElement
{
setHTMLAttribute("vlink", vlink);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLButtonElement.java b/gnu/xml/dom/html2/DomHTMLButtonElement.java
index 3bca44c09..696169ac2 100644
--- a/gnu/xml/dom/html2/DomHTMLButtonElement.java
+++ b/gnu/xml/dom/html2/DomHTMLButtonElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLButtonElement.java --
+/* DomHTMLButtonElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,7 +70,7 @@ public class DomHTMLButtonElement
{
setHTMLAttribute("accesskey", accessKey);
}
-
+
public boolean getDisabled()
{
return getBooleanHTMLAttribute("disabled");
@@ -80,7 +80,7 @@ public class DomHTMLButtonElement
{
setBooleanHTMLAttribute("disabled", disabled);
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -90,7 +90,7 @@ public class DomHTMLButtonElement
{
setHTMLAttribute("name", name);
}
-
+
public int getTabIndex()
{
return getIntHTMLAttribute("tabindex");
@@ -105,7 +105,7 @@ public class DomHTMLButtonElement
{
return getHTMLAttribute("type");
}
-
+
public String getValue()
{
return getHTMLAttribute("value");
@@ -115,6 +115,5 @@ public class DomHTMLButtonElement
{
setHTMLAttribute("value", value);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLCollection.java b/gnu/xml/dom/html2/DomHTMLCollection.java
index c63620087..830028753 100644
--- a/gnu/xml/dom/html2/DomHTMLCollection.java
+++ b/gnu/xml/dom/html2/DomHTMLCollection.java
@@ -1,4 +1,4 @@
-/* DomHTMLCollection.java --
+/* DomHTMLCollection.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -221,6 +221,5 @@ class DomHTMLCollection
}
return null;
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLDListElement.java b/gnu/xml/dom/html2/DomHTMLDListElement.java
index 2b9dbf236..9acce856a 100644
--- a/gnu/xml/dom/html2/DomHTMLDListElement.java
+++ b/gnu/xml/dom/html2/DomHTMLDListElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLDListElement.java --
+/* DomHTMLDListElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLDListElement
{
setBooleanHTMLAttribute("compact", compact);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLDirectoryElement.java b/gnu/xml/dom/html2/DomHTMLDirectoryElement.java
index 26af97e78..e0f94a1ed 100644
--- a/gnu/xml/dom/html2/DomHTMLDirectoryElement.java
+++ b/gnu/xml/dom/html2/DomHTMLDirectoryElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLDirectoryElement.java --
+/* DomHTMLDirectoryElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLDirectoryElement
{
setBooleanHTMLAttribute("compact", compact);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLDivElement.java b/gnu/xml/dom/html2/DomHTMLDivElement.java
index 462069dcf..66b3ac743 100644
--- a/gnu/xml/dom/html2/DomHTMLDivElement.java
+++ b/gnu/xml/dom/html2/DomHTMLDivElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLDivElement.java --
+/* DomHTMLDivElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLDivElement
{
setHTMLAttribute("align", align);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLDocument.java b/gnu/xml/dom/html2/DomHTMLDocument.java
index d45c1b223..1afed7beb 100644
--- a/gnu/xml/dom/html2/DomHTMLDocument.java
+++ b/gnu/xml/dom/html2/DomHTMLDocument.java
@@ -1,4 +1,4 @@
-/* DomHTMLDocument.java --
+/* DomHTMLDocument.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -424,4 +424,3 @@ public class DomHTMLDocument
}
}
-
diff --git a/gnu/xml/dom/html2/DomHTMLElement.java b/gnu/xml/dom/html2/DomHTMLElement.java
index b957083d6..deeefec60 100644
--- a/gnu/xml/dom/html2/DomHTMLElement.java
+++ b/gnu/xml/dom/html2/DomHTMLElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLElement.java --
+/* DomHTMLElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -242,7 +242,7 @@ public abstract class DomHTMLElement
{
setHTMLAttribute("id", id);
}
-
+
public String getTitle()
{
return getHTMLAttribute("title");
@@ -252,7 +252,7 @@ public abstract class DomHTMLElement
{
setHTMLAttribute("title", title);
}
-
+
public String getLang()
{
return getHTMLAttribute("lang");
@@ -262,7 +262,7 @@ public abstract class DomHTMLElement
{
setHTMLAttribute("lang", lang);
}
-
+
public String getDir()
{
return getHTMLAttribute("dir");
@@ -272,7 +272,7 @@ public abstract class DomHTMLElement
{
setHTMLAttribute("dir", dir);
}
-
+
public String getClassName()
{
return getHTMLAttribute("class");
@@ -282,6 +282,5 @@ public abstract class DomHTMLElement
{
setHTMLAttribute("class", className);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLEmbedElement.java b/gnu/xml/dom/html2/DomHTMLEmbedElement.java
index 1ae081c28..221131533 100644
--- a/gnu/xml/dom/html2/DomHTMLEmbedElement.java
+++ b/gnu/xml/dom/html2/DomHTMLEmbedElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLEmbedElement.java --
+/* DomHTMLEmbedElement.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ public class DomHTMLEmbedElement
{
super(owner, namespaceURI, name);
}
-
+
public String getJavaObject()
{
return getHTMLAttribute("java_object");
@@ -56,7 +56,7 @@ public class DomHTMLEmbedElement
{
setHTMLAttribute("java_object", object);
}
-
+
public String getJavaCodeBase()
{
return getHTMLAttribute("java_codebase");
@@ -66,7 +66,7 @@ public class DomHTMLEmbedElement
{
setHTMLAttribute("java_codebase", codeBase);
}
-
+
public String getJavaArchive()
{
return getHTMLAttribute("java_archive");
@@ -81,42 +81,42 @@ public class DomHTMLEmbedElement
{
setHTMLAttribute("java_code", code);
}
-
+
public String getJavaCode()
{
return getHTMLAttribute("java_code");
}
-
+
public void setJavaType(String type)
{
setHTMLAttribute("java_type", type);
}
-
+
public String getJavaType()
{
return getHTMLAttribute("java_type");
}
-
+
public void setType(String type)
{
setHTMLAttribute("type", type);
}
-
+
public String getType()
{
return getHTMLAttribute("type");
}
-
+
public String getPluginsPage()
{
return getHTMLAttribute("pluginspage");
}
-
+
public void setPluginsPage(String pluginspage)
{
setHTMLAttribute("pluginspage", pluginspage);
}
-
+
public String getMayscript()
{
return getHTMLAttribute("mayscript");
diff --git a/gnu/xml/dom/html2/DomHTMLFieldSetElement.java b/gnu/xml/dom/html2/DomHTMLFieldSetElement.java
index 2c8577219..252cd3d2b 100644
--- a/gnu/xml/dom/html2/DomHTMLFieldSetElement.java
+++ b/gnu/xml/dom/html2/DomHTMLFieldSetElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLFieldSetElement.java --
+/* DomHTMLFieldSetElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -62,4 +62,3 @@ public class DomHTMLFieldSetElement
}
}
-
diff --git a/gnu/xml/dom/html2/DomHTMLFontElement.java b/gnu/xml/dom/html2/DomHTMLFontElement.java
index 08bd349fa..5bfbb6f36 100644
--- a/gnu/xml/dom/html2/DomHTMLFontElement.java
+++ b/gnu/xml/dom/html2/DomHTMLFontElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLFontElement.java --
+/* DomHTMLFontElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLFontElement
{
setHTMLAttribute("color", color);
}
-
+
public String getFace()
{
return getHTMLAttribute("face");
@@ -74,7 +74,7 @@ public class DomHTMLFontElement
{
setHTMLAttribute("face", face);
}
-
+
public String getSize()
{
return getHTMLAttribute("size");
@@ -84,6 +84,5 @@ public class DomHTMLFontElement
{
setHTMLAttribute("size", size);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLFormElement.java b/gnu/xml/dom/html2/DomHTMLFormElement.java
index 119d97eb8..9fe2ae802 100644
--- a/gnu/xml/dom/html2/DomHTMLFormElement.java
+++ b/gnu/xml/dom/html2/DomHTMLFormElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLFormElement.java --
+/* DomHTMLFormElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -85,7 +85,7 @@ public class DomHTMLFormElement
{
setHTMLAttribute("name", name);
}
-
+
public String getAcceptCharset()
{
return getHTMLAttribute("accept-charset");
@@ -95,7 +95,7 @@ public class DomHTMLFormElement
{
setHTMLAttribute("accept-charset", acceptCharset);
}
-
+
public String getAction()
{
return getHTMLAttribute("action");
@@ -105,7 +105,7 @@ public class DomHTMLFormElement
{
setHTMLAttribute("action", action);
}
-
+
public String getEnctype()
{
return getHTMLAttribute("enctype");
@@ -115,7 +115,7 @@ public class DomHTMLFormElement
{
setHTMLAttribute("enctype", enctype);
}
-
+
public String getMethod()
{
return getHTMLAttribute("method");
@@ -125,7 +125,7 @@ public class DomHTMLFormElement
{
setHTMLAttribute("method", method);
}
-
+
public String getTarget()
{
return getHTMLAttribute("target");
@@ -145,6 +145,5 @@ public class DomHTMLFormElement
{
dispatchUIEvent("reset");
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLFrameElement.java b/gnu/xml/dom/html2/DomHTMLFrameElement.java
index 124f35268..2465c4b89 100644
--- a/gnu/xml/dom/html2/DomHTMLFrameElement.java
+++ b/gnu/xml/dom/html2/DomHTMLFrameElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLFrameElement.java --
+/* DomHTMLFrameElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,7 +65,7 @@ public class DomHTMLFrameElement
{
setHTMLAttribute("frameborder", frameBorder);
}
-
+
public String getLongDesc()
{
return getHTMLAttribute("longdesc");
@@ -75,7 +75,7 @@ public class DomHTMLFrameElement
{
setHTMLAttribute("longdesc", longDesc);
}
-
+
public String getMarginHeight()
{
return getHTMLAttribute("marginheight");
@@ -85,7 +85,7 @@ public class DomHTMLFrameElement
{
setHTMLAttribute("marginheight", marginHeight);
}
-
+
public String getMarginWidth()
{
return getHTMLAttribute("marginwidth");
@@ -95,7 +95,7 @@ public class DomHTMLFrameElement
{
setHTMLAttribute("marginwidth", marginWidth);
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -105,7 +105,7 @@ public class DomHTMLFrameElement
{
setHTMLAttribute("name", name);
}
-
+
public boolean getNoResize()
{
return getBooleanHTMLAttribute("noresize");
@@ -115,7 +115,7 @@ public class DomHTMLFrameElement
{
setBooleanHTMLAttribute("noresize", noResize);
}
-
+
public String getScrolling()
{
return getHTMLAttribute("scrolling");
@@ -125,7 +125,7 @@ public class DomHTMLFrameElement
{
setHTMLAttribute("scrolling", scrolling);
}
-
+
public String getSrc()
{
return getHTMLAttribute("src");
@@ -141,6 +141,5 @@ public class DomHTMLFrameElement
// TODO getContentDocument
return null;
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLFrameSetElement.java b/gnu/xml/dom/html2/DomHTMLFrameSetElement.java
index 44d317f64..dae9430fb 100644
--- a/gnu/xml/dom/html2/DomHTMLFrameSetElement.java
+++ b/gnu/xml/dom/html2/DomHTMLFrameSetElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLFrameSetElement.java --
+/* DomHTMLFrameSetElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLFrameSetElement
{
setHTMLAttribute("cols", cols);
}
-
+
public String getRows()
{
return getHTMLAttribute("rows");
@@ -74,6 +74,5 @@ public class DomHTMLFrameSetElement
{
setHTMLAttribute("rows", rows);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLHRElement.java b/gnu/xml/dom/html2/DomHTMLHRElement.java
index d1b480121..e27ef5595 100644
--- a/gnu/xml/dom/html2/DomHTMLHRElement.java
+++ b/gnu/xml/dom/html2/DomHTMLHRElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLHRElement.java --
+/* DomHTMLHRElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLHRElement
{
setHTMLAttribute("align", align);
}
-
+
public boolean getNoShade()
{
return getBooleanHTMLAttribute("noshade");
@@ -74,7 +74,7 @@ public class DomHTMLHRElement
{
setBooleanHTMLAttribute("noshade", noShade);
}
-
+
public String getSize()
{
return getHTMLAttribute("size");
@@ -84,7 +84,7 @@ public class DomHTMLHRElement
{
setHTMLAttribute("size", size);
}
-
+
public String getWidth()
{
return getHTMLAttribute("width");
@@ -94,6 +94,5 @@ public class DomHTMLHRElement
{
setHTMLAttribute("width", width);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLHeadElement.java b/gnu/xml/dom/html2/DomHTMLHeadElement.java
index f68e8c7fa..4a8ef995b 100644
--- a/gnu/xml/dom/html2/DomHTMLHeadElement.java
+++ b/gnu/xml/dom/html2/DomHTMLHeadElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLHeadElement.java --
+/* DomHTMLHeadElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLHeadElement
{
setHTMLAttribute("profile", profile);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLHeadingElement.java b/gnu/xml/dom/html2/DomHTMLHeadingElement.java
index f1427ad89..6e78e9004 100644
--- a/gnu/xml/dom/html2/DomHTMLHeadingElement.java
+++ b/gnu/xml/dom/html2/DomHTMLHeadingElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLHeadingElement.java --
+/* DomHTMLHeadingElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLHeadingElement
{
setHTMLAttribute("align", align);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLHtmlElement.java b/gnu/xml/dom/html2/DomHTMLHtmlElement.java
index 95d45264e..73f7243ed 100644
--- a/gnu/xml/dom/html2/DomHTMLHtmlElement.java
+++ b/gnu/xml/dom/html2/DomHTMLHtmlElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLHtmlElement.java --
+/* DomHTMLHtmlElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLHtmlElement
{
setHTMLAttribute("version", version);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLIFrameElement.java b/gnu/xml/dom/html2/DomHTMLIFrameElement.java
index c5ca75d8c..1a58fb73e 100644
--- a/gnu/xml/dom/html2/DomHTMLIFrameElement.java
+++ b/gnu/xml/dom/html2/DomHTMLIFrameElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLIFrameElement.java --
+/* DomHTMLIFrameElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,7 +65,7 @@ public class DomHTMLIFrameElement
{
setHTMLAttribute("align", align);
}
-
+
public String getFrameBorder()
{
return getHTMLAttribute("frameborder");
@@ -75,7 +75,7 @@ public class DomHTMLIFrameElement
{
setHTMLAttribute("frameborder", frameBorder);
}
-
+
public String getHeight()
{
return getHTMLAttribute("height");
@@ -85,7 +85,7 @@ public class DomHTMLIFrameElement
{
setHTMLAttribute("height", height);
}
-
+
public String getLongDesc()
{
return getHTMLAttribute("longdesc");
@@ -95,7 +95,7 @@ public class DomHTMLIFrameElement
{
setHTMLAttribute("longdesc", longDesc);
}
-
+
public String getMarginHeight()
{
return getHTMLAttribute("marginheight");
@@ -105,7 +105,7 @@ public class DomHTMLIFrameElement
{
setHTMLAttribute("marginheight", marginHeight);
}
-
+
public String getMarginWidth()
{
return getHTMLAttribute("marginwidth");
@@ -115,7 +115,7 @@ public class DomHTMLIFrameElement
{
setHTMLAttribute("marginwidth", marginWidth);
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -125,7 +125,7 @@ public class DomHTMLIFrameElement
{
setHTMLAttribute("name", name);
}
-
+
public String getScrolling()
{
return getHTMLAttribute("scrolling");
@@ -135,7 +135,7 @@ public class DomHTMLIFrameElement
{
setHTMLAttribute("scrolling", scrolling);
}
-
+
public String getSrc()
{
return getHTMLAttribute("src");
@@ -155,12 +155,11 @@ public class DomHTMLIFrameElement
{
setHTMLAttribute("width", width);
}
-
+
public Document getContentDocument()
{
// TODO getContentDocument
return null;
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLImageElement.java b/gnu/xml/dom/html2/DomHTMLImageElement.java
index c96e5fede..c5d294c6f 100644
--- a/gnu/xml/dom/html2/DomHTMLImageElement.java
+++ b/gnu/xml/dom/html2/DomHTMLImageElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLImageElement.java --
+/* DomHTMLImageElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLImageElement
{
setHTMLAttribute("name", name);
}
-
+
public String getAlign()
{
return getHTMLAttribute("align");
@@ -74,7 +74,7 @@ public class DomHTMLImageElement
{
setHTMLAttribute("align", align);
}
-
+
public String getAlt()
{
return getHTMLAttribute("alt");
@@ -84,7 +84,7 @@ public class DomHTMLImageElement
{
setHTMLAttribute("alt", alt);
}
-
+
public String getBorder()
{
return getHTMLAttribute("border");
@@ -94,7 +94,7 @@ public class DomHTMLImageElement
{
setHTMLAttribute("border", border);
}
-
+
public int getHeight()
{
return getIntHTMLAttribute("height");
@@ -104,7 +104,7 @@ public class DomHTMLImageElement
{
setIntHTMLAttribute("height", height);
}
-
+
public int getHspace()
{
return getIntHTMLAttribute("hspace");
@@ -114,7 +114,7 @@ public class DomHTMLImageElement
{
setIntHTMLAttribute("hspace", hspace);
}
-
+
public boolean getIsMap()
{
return getBooleanHTMLAttribute("ismap");
@@ -124,7 +124,7 @@ public class DomHTMLImageElement
{
setBooleanHTMLAttribute("ismap", isMap);
}
-
+
public String getLongDesc()
{
return getHTMLAttribute("longdesc");
@@ -134,7 +134,7 @@ public class DomHTMLImageElement
{
setHTMLAttribute("longdesc", longDesc);
}
-
+
public String getSrc()
{
return getHTMLAttribute("src");
@@ -154,7 +154,7 @@ public class DomHTMLImageElement
{
setHTMLAttribute("usemap", useMap);
}
-
+
public int getVspace()
{
return getIntHTMLAttribute("vspace");
@@ -164,7 +164,7 @@ public class DomHTMLImageElement
{
setIntHTMLAttribute("vspace", vspace);
}
-
+
public int getWidth()
{
return getIntHTMLAttribute("width");
@@ -174,6 +174,5 @@ public class DomHTMLImageElement
{
setIntHTMLAttribute("width", width);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLImpl.java b/gnu/xml/dom/html2/DomHTMLImpl.java
index 9f0db0850..a5faee5ce 100644
--- a/gnu/xml/dom/html2/DomHTMLImpl.java
+++ b/gnu/xml/dom/html2/DomHTMLImpl.java
@@ -1,4 +1,4 @@
-/* DomHTMLImpl.java --
+/* DomHTMLImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import org.w3c.dom.Document;
public class DomHTMLImpl
extends DomImpl
{
-
+
protected Document createDocument()
{
return new DomHTMLDocument(this);
@@ -64,4 +64,3 @@ public class DomHTMLImpl
}
}
-
diff --git a/gnu/xml/dom/html2/DomHTMLInputElement.java b/gnu/xml/dom/html2/DomHTMLInputElement.java
index 1dbc9c28d..21201889d 100644
--- a/gnu/xml/dom/html2/DomHTMLInputElement.java
+++ b/gnu/xml/dom/html2/DomHTMLInputElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLInputElement.java --
+/* DomHTMLInputElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -68,7 +68,7 @@ public class DomHTMLInputElement
{
setHTMLAttribute("value", defaultValue);
}
-
+
public boolean getDefaultChecked()
{
return getBooleanHTMLAttribute("checked");
@@ -83,7 +83,7 @@ public class DomHTMLInputElement
{
return (HTMLFormElement) getParentElement("form");
}
-
+
public String getAccept()
{
return getHTMLAttribute("accept");
@@ -93,7 +93,7 @@ public class DomHTMLInputElement
{
setHTMLAttribute("accept", accept);
}
-
+
public String getAccessKey()
{
return getHTMLAttribute("accesskey");
@@ -103,7 +103,7 @@ public class DomHTMLInputElement
{
setHTMLAttribute("accesskey", accessKey);
}
-
+
public String getAlign()
{
return getHTMLAttribute("align");
@@ -113,7 +113,7 @@ public class DomHTMLInputElement
{
setHTMLAttribute("align", align);
}
-
+
public String getAlt()
{
return getHTMLAttribute("alt");
@@ -123,7 +123,7 @@ public class DomHTMLInputElement
{
setHTMLAttribute("alt", alt);
}
-
+
public boolean getChecked()
{
if (checked == null)
@@ -137,7 +137,7 @@ public class DomHTMLInputElement
{
this.checked = Boolean.valueOf(checked);
}
-
+
public boolean getDisabled()
{
return getBooleanHTMLAttribute("disabled");
@@ -147,7 +147,7 @@ public class DomHTMLInputElement
{
setBooleanHTMLAttribute("disabled", disabled);
}
-
+
public int getMaxLength()
{
return getIntHTMLAttribute("maxLength");
@@ -157,7 +157,7 @@ public class DomHTMLInputElement
{
setIntHTMLAttribute("maxLength", maxLength);
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -167,7 +167,7 @@ public class DomHTMLInputElement
{
setHTMLAttribute("name", name);
}
-
+
public boolean getReadOnly()
{
return getBooleanHTMLAttribute("readonly");
@@ -177,7 +177,7 @@ public class DomHTMLInputElement
{
setBooleanHTMLAttribute("readonly", readOnly);
}
-
+
public int getSize()
{
return getIntHTMLAttribute("size");
@@ -187,7 +187,7 @@ public class DomHTMLInputElement
{
setIntHTMLAttribute("size", size);
}
-
+
public String getSrc()
{
return getHTMLAttribute("src");
@@ -197,7 +197,7 @@ public class DomHTMLInputElement
{
setHTMLAttribute("src", src);
}
-
+
public int getTabIndex()
{
return getIntHTMLAttribute("tabindex");
@@ -207,7 +207,7 @@ public class DomHTMLInputElement
{
setIntHTMLAttribute("tabindex", tabIndex);
}
-
+
public String getType()
{
return getHTMLAttribute("type");
@@ -217,7 +217,7 @@ public class DomHTMLInputElement
{
setHTMLAttribute("type", type);
}
-
+
public String getUseMap()
{
return getHTMLAttribute("usemap");
@@ -227,7 +227,7 @@ public class DomHTMLInputElement
{
setHTMLAttribute("usemap", useMap);
}
-
+
public String getValue()
{
if (value == null)
@@ -261,6 +261,5 @@ public class DomHTMLInputElement
{
dispatchUIEvent("click");
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLIsIndexElement.java b/gnu/xml/dom/html2/DomHTMLIsIndexElement.java
index 087f4a0cd..8578cb6c0 100644
--- a/gnu/xml/dom/html2/DomHTMLIsIndexElement.java
+++ b/gnu/xml/dom/html2/DomHTMLIsIndexElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLIsIndexElement.java --
+/* DomHTMLIsIndexElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,6 +70,5 @@ public class DomHTMLIsIndexElement
{
setHTMLAttribute("prompt", prompt);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLLIElement.java b/gnu/xml/dom/html2/DomHTMLLIElement.java
index 11eccdf5d..cab1412dd 100644
--- a/gnu/xml/dom/html2/DomHTMLLIElement.java
+++ b/gnu/xml/dom/html2/DomHTMLLIElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLLIElement.java --
+/* DomHTMLLIElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLLIElement
{
setHTMLAttribute("type", type);
}
-
+
public int getValue()
{
return getIntHTMLAttribute("value");
@@ -74,6 +74,5 @@ public class DomHTMLLIElement
{
setIntHTMLAttribute("value", value);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLLabelElement.java b/gnu/xml/dom/html2/DomHTMLLabelElement.java
index c0cc39f8e..96cfbaab5 100644
--- a/gnu/xml/dom/html2/DomHTMLLabelElement.java
+++ b/gnu/xml/dom/html2/DomHTMLLabelElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLLabelElement.java --
+/* DomHTMLLabelElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,7 +70,7 @@ public class DomHTMLLabelElement
{
setHTMLAttribute("accesskey", accessKey);
}
-
+
public String getHtmlFor()
{
return getHTMLAttribute("for");
@@ -80,6 +80,5 @@ public class DomHTMLLabelElement
{
setHTMLAttribute("for", htmlFor);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLLegendElement.java b/gnu/xml/dom/html2/DomHTMLLegendElement.java
index a500f8fa1..045861cae 100644
--- a/gnu/xml/dom/html2/DomHTMLLegendElement.java
+++ b/gnu/xml/dom/html2/DomHTMLLegendElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLLegendElement.java --
+/* DomHTMLLegendElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,7 +70,7 @@ public class DomHTMLLegendElement
{
setHTMLAttribute("accesskey", accessKey);
}
-
+
public String getAlign()
{
return getHTMLAttribute("align");
@@ -80,6 +80,5 @@ public class DomHTMLLegendElement
{
setHTMLAttribute("align", align);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLLinkElement.java b/gnu/xml/dom/html2/DomHTMLLinkElement.java
index 127726ef7..292ec9305 100644
--- a/gnu/xml/dom/html2/DomHTMLLinkElement.java
+++ b/gnu/xml/dom/html2/DomHTMLLinkElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLLinkElement.java --
+/* DomHTMLLinkElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLLinkElement
{
setBooleanHTMLAttribute("disabled", disabled);
}
-
+
public String getCharset()
{
return getHTMLAttribute("charset");
@@ -74,7 +74,7 @@ public class DomHTMLLinkElement
{
setHTMLAttribute("charset", charset);
}
-
+
public String getHref()
{
return getHTMLAttribute("href");
@@ -84,7 +84,7 @@ public class DomHTMLLinkElement
{
setHTMLAttribute("href", href);
}
-
+
public String getHreflang()
{
return getHTMLAttribute("hreflang");
@@ -94,7 +94,7 @@ public class DomHTMLLinkElement
{
setHTMLAttribute("hreflang", hreflang);
}
-
+
public String getMedia()
{
return getHTMLAttribute("media");
@@ -104,7 +104,7 @@ public class DomHTMLLinkElement
{
setHTMLAttribute("media", media);
}
-
+
public String getRel()
{
return getHTMLAttribute("rel");
@@ -114,7 +114,7 @@ public class DomHTMLLinkElement
{
setHTMLAttribute("rel", rel);
}
-
+
public String getRev()
{
return getHTMLAttribute("rev");
@@ -124,7 +124,7 @@ public class DomHTMLLinkElement
{
setHTMLAttribute("rev", rev);
}
-
+
public String getTarget()
{
return getHTMLAttribute("target");
@@ -134,7 +134,7 @@ public class DomHTMLLinkElement
{
setHTMLAttribute("target", target);
}
-
+
public String getType()
{
return getHTMLAttribute("type");
@@ -144,6 +144,5 @@ public class DomHTMLLinkElement
{
setHTMLAttribute("type", type);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLMapElement.java b/gnu/xml/dom/html2/DomHTMLMapElement.java
index 1f7182f4f..4497b00e2 100644
--- a/gnu/xml/dom/html2/DomHTMLMapElement.java
+++ b/gnu/xml/dom/html2/DomHTMLMapElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLMapElement.java --
+/* DomHTMLMapElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLMapElement
ret.evaluate();
return ret;
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -74,6 +74,5 @@ public class DomHTMLMapElement
{
setHTMLAttribute("name", name);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLMenuElement.java b/gnu/xml/dom/html2/DomHTMLMenuElement.java
index 17f6f589f..2a6ff08f1 100644
--- a/gnu/xml/dom/html2/DomHTMLMenuElement.java
+++ b/gnu/xml/dom/html2/DomHTMLMenuElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLMenuElement.java --
+/* DomHTMLMenuElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLMenuElement
{
setBooleanHTMLAttribute("compact", compact);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLMetaElement.java b/gnu/xml/dom/html2/DomHTMLMetaElement.java
index 1a0440504..e555a4273 100644
--- a/gnu/xml/dom/html2/DomHTMLMetaElement.java
+++ b/gnu/xml/dom/html2/DomHTMLMetaElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLMetaElement.java --
+/* DomHTMLMetaElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLMetaElement
{
setHTMLAttribute("content", content);
}
-
+
public String getHttpEquiv()
{
return getHTMLAttribute("http-equiv");
@@ -74,7 +74,7 @@ public class DomHTMLMetaElement
{
setHTMLAttribute("http-equiv", httpEquiv);
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -84,7 +84,7 @@ public class DomHTMLMetaElement
{
setHTMLAttribute("name", name);
}
-
+
public String getScheme()
{
return getHTMLAttribute("scheme");
@@ -94,6 +94,5 @@ public class DomHTMLMetaElement
{
setHTMLAttribute("scheme", scheme);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLModElement.java b/gnu/xml/dom/html2/DomHTMLModElement.java
index 493f7242b..8c158f48a 100644
--- a/gnu/xml/dom/html2/DomHTMLModElement.java
+++ b/gnu/xml/dom/html2/DomHTMLModElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLModElement.java --
+/* DomHTMLModElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLModElement
{
setHTMLAttribute("cite", cite);
}
-
+
public String getDateTime()
{
return getHTMLAttribute("datetime");
@@ -74,6 +74,5 @@ public class DomHTMLModElement
{
setHTMLAttribute("datetime", dateTime);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLOListElement.java b/gnu/xml/dom/html2/DomHTMLOListElement.java
index fb98cf40d..54f7fd46b 100644
--- a/gnu/xml/dom/html2/DomHTMLOListElement.java
+++ b/gnu/xml/dom/html2/DomHTMLOListElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLOListElement.java --
+/* DomHTMLOListElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLOListElement
{
setBooleanHTMLAttribute("compact", compact);
}
-
+
public int getStart()
{
return getIntHTMLAttribute("start");
@@ -74,7 +74,7 @@ public class DomHTMLOListElement
{
setIntHTMLAttribute("start", start);
}
-
+
public String getType()
{
return getHTMLAttribute("type");
@@ -84,6 +84,5 @@ public class DomHTMLOListElement
{
setHTMLAttribute("type", type);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLObjectElement.java b/gnu/xml/dom/html2/DomHTMLObjectElement.java
index 9bb621122..2ce5f45c3 100644
--- a/gnu/xml/dom/html2/DomHTMLObjectElement.java
+++ b/gnu/xml/dom/html2/DomHTMLObjectElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLObjectElement.java --
+/* DomHTMLObjectElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,7 +71,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("code", code);
}
-
+
public String getJavaCode()
{
return getHTMLAttribute("java_code");
@@ -81,7 +81,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("java_code", code);
}
-
+
public String getObject()
{
return getHTMLAttribute("object");
@@ -91,7 +91,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("object", obj);
}
-
+
public String getJavaObject()
{
return getHTMLAttribute("java_object");
@@ -101,7 +101,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("java_object", obj);
}
-
+
public String getAlign()
{
return getHTMLAttribute("align");
@@ -111,7 +111,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("align", align);
}
-
+
public String getArchive()
{
return getHTMLAttribute("archive");
@@ -121,7 +121,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("archive", archive);
}
-
+
public String getJavaArchive()
{
return getHTMLAttribute("java_archive");
@@ -131,7 +131,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("java_archive", archive);
}
-
+
public String getBorder()
{
return getHTMLAttribute("border");
@@ -141,7 +141,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("border", border);
}
-
+
public String getCodeBase()
{
return getHTMLAttribute("codebase");
@@ -151,7 +151,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("codebase", codeBase);
}
-
+
public String getJavaCodeBase()
{
return getHTMLAttribute("java_codebase");
@@ -161,7 +161,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("java_codebase", codeBase);
}
-
+
public String getCodeType()
{
return getHTMLAttribute("codetype");
@@ -171,7 +171,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("codetype", codeType);
}
-
+
public String getData()
{
return getHTMLAttribute("data");
@@ -181,7 +181,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("data", data);
}
-
+
public boolean getDeclare()
{
return getBooleanHTMLAttribute("declare");
@@ -191,7 +191,7 @@ public class DomHTMLObjectElement
{
setBooleanHTMLAttribute("declare", declare);
}
-
+
public String getHeight()
{
return getHTMLAttribute("height");
@@ -201,7 +201,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("height", height);
}
-
+
public int getHspace()
{
return getIntHTMLAttribute("hspace");
@@ -211,7 +211,7 @@ public class DomHTMLObjectElement
{
setIntHTMLAttribute("hspace", hspace);
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -221,7 +221,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("name", name);
}
-
+
public String getStandby()
{
return getHTMLAttribute("standby");
@@ -231,7 +231,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("standby", standby);
}
-
+
public int getTabIndex()
{
return getIntHTMLAttribute("tabindex");
@@ -241,7 +241,7 @@ public class DomHTMLObjectElement
{
setIntHTMLAttribute("tabindex", tabIndex);
}
-
+
public String getType()
{
return getHTMLAttribute("type");
@@ -251,7 +251,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("type", type);
}
-
+
public String getJavaType()
{
return getHTMLAttribute("java_type");
@@ -261,7 +261,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("java_type", type);
}
-
+
public String getUseMap()
{
return getHTMLAttribute("usemap");
@@ -271,7 +271,7 @@ public class DomHTMLObjectElement
{
setHTMLAttribute("usemap", useMap);
}
-
+
public int getVspace()
{
return getIntHTMLAttribute("vspace");
@@ -281,7 +281,7 @@ public class DomHTMLObjectElement
{
setIntHTMLAttribute("vspace", vspace);
}
-
+
public String getWidth()
{
return getHTMLAttribute("width");
@@ -297,25 +297,24 @@ public class DomHTMLObjectElement
// TODO getContentDocument
return null;
}
-
+
public void setMayscript(String may)
{
setHTMLAttribute("mayscript", may);
}
-
+
public String getMayscript()
{
return getHTMLAttribute("mayscript");
}
-
+
public void setScriptable(String scr)
{
setHTMLAttribute("scriptable", scr);
}
-
+
public String getScriptable()
{
return getHTMLAttribute("scriptable");
}
}
-
diff --git a/gnu/xml/dom/html2/DomHTMLOptGroupElement.java b/gnu/xml/dom/html2/DomHTMLOptGroupElement.java
index 76545e130..acb948484 100644
--- a/gnu/xml/dom/html2/DomHTMLOptGroupElement.java
+++ b/gnu/xml/dom/html2/DomHTMLOptGroupElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLOptGroupElement.java --
+/* DomHTMLOptGroupElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -74,6 +74,5 @@ public class DomHTMLOptGroupElement
{
setHTMLAttribute("label", label);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLOptionElement.java b/gnu/xml/dom/html2/DomHTMLOptionElement.java
index 69c059d9d..f775c138a 100644
--- a/gnu/xml/dom/html2/DomHTMLOptionElement.java
+++ b/gnu/xml/dom/html2/DomHTMLOptionElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLOptionElement.java --
+/* DomHTMLOptionElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -82,7 +82,7 @@ public class DomHTMLOptionElement
{
return super.getIndex();
}
-
+
public boolean getDisabled()
{
return getBooleanHTMLAttribute("disabled");
@@ -92,7 +92,7 @@ public class DomHTMLOptionElement
{
setBooleanHTMLAttribute("disabled", disabled);
}
-
+
public String getLabel()
{
return getHTMLAttribute("label");
@@ -102,7 +102,7 @@ public class DomHTMLOptionElement
{
setHTMLAttribute("label", label);
}
-
+
public boolean getSelected()
{
if (selected == null)
@@ -116,7 +116,7 @@ public class DomHTMLOptionElement
{
this.selected = Boolean.valueOf(selected);
}
-
+
public String getValue()
{
return getHTMLAttribute("value");
@@ -126,6 +126,5 @@ public class DomHTMLOptionElement
{
setHTMLAttribute("value", value);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLParagraphElement.java b/gnu/xml/dom/html2/DomHTMLParagraphElement.java
index 2a8c4f6fb..4c867fdc1 100644
--- a/gnu/xml/dom/html2/DomHTMLParagraphElement.java
+++ b/gnu/xml/dom/html2/DomHTMLParagraphElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLParagraphElement.java --
+/* DomHTMLParagraphElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLParagraphElement
{
setHTMLAttribute("align", align);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLParamElement.java b/gnu/xml/dom/html2/DomHTMLParamElement.java
index 81c655952..cdd74ad4a 100644
--- a/gnu/xml/dom/html2/DomHTMLParamElement.java
+++ b/gnu/xml/dom/html2/DomHTMLParamElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLParamElement.java --
+/* DomHTMLParamElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLParamElement
{
setHTMLAttribute("name", name);
}
-
+
public String getType()
{
return getHTMLAttribute("type");
@@ -74,7 +74,7 @@ public class DomHTMLParamElement
{
setHTMLAttribute("type", type);
}
-
+
public String getValue()
{
return getHTMLAttribute("value");
@@ -84,7 +84,7 @@ public class DomHTMLParamElement
{
setHTMLAttribute("value", value);
}
-
+
public String getValueType()
{
return getHTMLAttribute("valuetype");
@@ -94,6 +94,5 @@ public class DomHTMLParamElement
{
setHTMLAttribute("valuetype", valueType);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLParser.java b/gnu/xml/dom/html2/DomHTMLParser.java
index c6d8c4c5c..88656d2d3 100644
--- a/gnu/xml/dom/html2/DomHTMLParser.java
+++ b/gnu/xml/dom/html2/DomHTMLParser.java
@@ -60,11 +60,11 @@ import org.w3c.dom.html2.HTMLDocument;
* The tag attributes become the node attributes. The text inside
* HTML tag is inserted as one or several text nodes. The nested
* HTML tags are inserted as child nodes.
- *
+ *
* If the strict tree structure, closing the tag means closing all
* nested tags. To work around this, this parser closes the nested
* tags and immediately reopens them after the closed tag.
- * In this way, <code>&lt;b&gt;&lt;i&gt;c&lt;/b&gt;d</code>
+ * In this way, <code>&lt;b&gt;&lt;i&gt;c&lt;/b&gt;d</code>
* is parsed as <code>&lt;b&gt;&lt;i&gt;c&lt;/i&gt;&lt;/b&gt;&lt;i&gt;d</code> .
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
@@ -124,9 +124,9 @@ public class DomHTMLParser
document = new DomHTMLDocument();
document.setCheckWellformedness(false);
document.setCheckingCharacters(false);
-
+
cursor = document;
-
+
parse(input);
DomHTMLDocument h = document;
@@ -139,7 +139,7 @@ public class DomHTMLParser
throw new IOException("Exception: " + ex.getMessage());
}
}
-
+
/**
* Create a new node.
* @param name the name of node, case insensitive.
@@ -165,13 +165,13 @@ public class DomHTMLParser
natts.setNamedItem(attribute);
}
- // The default values are stored in a parent node.
+ // The default values are stored in a parent node.
hatts = hatts.getResolveParent();
}
return new_node;
}
-
+
/**
* Handle comment by inserting the comment node.
* @param text the comment text.
@@ -181,7 +181,7 @@ public class DomHTMLParser
Node c = document.createComment(new String(text));
cursor.appendChild(c);
}
-
+
/**
* Handle the tag with no content.
* @param tag the tag to handle.
@@ -196,7 +196,7 @@ public class DomHTMLParser
Node c = createNode(name);
cursor.appendChild(c);
}
-
+
/**
* Close the given tag. Close and reopen all nested tags.
* @param tag the tag to close.
@@ -229,7 +229,7 @@ public class DomHTMLParser
else
cursor = close.getParentNode();
- // Insert the copies of the opened nodes.
+ // Insert the copies of the opened nodes.
Iterator iter = open.iterator();
while (iter.hasNext())
{
@@ -251,7 +251,7 @@ public class DomHTMLParser
cursor.appendChild(c);
cursor = c;
}
-
+
/**
* Handle text by inserting the text node.
* @param text the text to insert.
diff --git a/gnu/xml/dom/html2/DomHTMLPreElement.java b/gnu/xml/dom/html2/DomHTMLPreElement.java
index 9b36a2887..9a51aaeeb 100644
--- a/gnu/xml/dom/html2/DomHTMLPreElement.java
+++ b/gnu/xml/dom/html2/DomHTMLPreElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLPreElement.java --
+/* DomHTMLPreElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLPreElement
{
setIntHTMLAttribute("width", width);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLQuoteElement.java b/gnu/xml/dom/html2/DomHTMLQuoteElement.java
index 678a5ada6..811aed58b 100644
--- a/gnu/xml/dom/html2/DomHTMLQuoteElement.java
+++ b/gnu/xml/dom/html2/DomHTMLQuoteElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLQuoteElement.java --
+/* DomHTMLQuoteElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLQuoteElement
{
setHTMLAttribute("cite", cite);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLScriptElement.java b/gnu/xml/dom/html2/DomHTMLScriptElement.java
index 8f8fff58a..1bd7b3417 100644
--- a/gnu/xml/dom/html2/DomHTMLScriptElement.java
+++ b/gnu/xml/dom/html2/DomHTMLScriptElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLScriptElement.java --
+/* DomHTMLScriptElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -124,6 +124,5 @@ public class DomHTMLScriptElement
{
setHTMLAttribute("type", type);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLSelectElement.java b/gnu/xml/dom/html2/DomHTMLSelectElement.java
index 09752e1ff..fc1debbd6 100644
--- a/gnu/xml/dom/html2/DomHTMLSelectElement.java
+++ b/gnu/xml/dom/html2/DomHTMLSelectElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLSelectElement.java --
+/* DomHTMLSelectElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,7 +60,7 @@ public class DomHTMLSelectElement
{
super(owner, namespaceURI, name);
}
-
+
public String getType()
{
return getHTMLAttribute("type");
@@ -95,7 +95,7 @@ public class DomHTMLSelectElement
option.setSelected(i == selectedIndex);
}
}
-
+
public String getValue()
{
return getHTMLAttribute("value");
@@ -105,7 +105,7 @@ public class DomHTMLSelectElement
{
setHTMLAttribute("value", value);
}
-
+
public int getLength()
{
return getIntHTMLAttribute("length");
@@ -129,7 +129,7 @@ public class DomHTMLSelectElement
ret.evaluate();
return ret;
}
-
+
public boolean getDisabled()
{
return getBooleanHTMLAttribute("disabled");
@@ -139,7 +139,7 @@ public class DomHTMLSelectElement
{
setBooleanHTMLAttribute("disabled", disabled);
}
-
+
public boolean getMultiple()
{
return getBooleanHTMLAttribute("multiple");
@@ -149,7 +149,7 @@ public class DomHTMLSelectElement
{
setBooleanHTMLAttribute("multiple", multiple);
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -159,7 +159,7 @@ public class DomHTMLSelectElement
{
setHTMLAttribute("name", name);
}
-
+
public int getSize()
{
return getIntHTMLAttribute("size");
@@ -169,7 +169,7 @@ public class DomHTMLSelectElement
{
setIntHTMLAttribute("size", size);
}
-
+
public int getTabIndex()
{
return getIntHTMLAttribute("tabindex");
@@ -206,6 +206,5 @@ public class DomHTMLSelectElement
{
dispatchUIEvent("focus");
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLStyleElement.java b/gnu/xml/dom/html2/DomHTMLStyleElement.java
index f6f1fcc68..78cef3b18 100644
--- a/gnu/xml/dom/html2/DomHTMLStyleElement.java
+++ b/gnu/xml/dom/html2/DomHTMLStyleElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLStyleElement.java --
+/* DomHTMLStyleElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLStyleElement
{
setBooleanHTMLAttribute("disabled", disabled);
}
-
+
public String getMedia()
{
return getHTMLAttribute("media");
@@ -74,7 +74,7 @@ public class DomHTMLStyleElement
{
setHTMLAttribute("media", media);
}
-
+
public String getType()
{
return getHTMLAttribute("type");
@@ -84,6 +84,5 @@ public class DomHTMLStyleElement
{
setHTMLAttribute("type", type);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLTableCaptionElement.java b/gnu/xml/dom/html2/DomHTMLTableCaptionElement.java
index 28ea34188..2133b1412 100644
--- a/gnu/xml/dom/html2/DomHTMLTableCaptionElement.java
+++ b/gnu/xml/dom/html2/DomHTMLTableCaptionElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLTableCaptionElement.java --
+/* DomHTMLTableCaptionElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,6 +65,5 @@ public class DomHTMLTableCaptionElement
{
setHTMLAttribute("align", align);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLTableCellElement.java b/gnu/xml/dom/html2/DomHTMLTableCellElement.java
index 41d33af26..350f0bf42 100644
--- a/gnu/xml/dom/html2/DomHTMLTableCellElement.java
+++ b/gnu/xml/dom/html2/DomHTMLTableCellElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLTableCellElement.java --
+/* DomHTMLTableCellElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,7 +70,7 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("abbr", abbr);
}
-
+
public String getAlign()
{
return getHTMLAttribute("align");
@@ -80,7 +80,7 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("align", align);
}
-
+
public String getAxis()
{
return getHTMLAttribute("axis");
@@ -90,7 +90,7 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("axis", axis);
}
-
+
public String getBgColor()
{
return getHTMLAttribute("bgcolor");
@@ -100,7 +100,7 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("bgcolor", bgColor);
}
-
+
public String getCh()
{
return getHTMLAttribute("char");
@@ -110,7 +110,7 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("char", ch);
}
-
+
public String getChOff()
{
return getHTMLAttribute("charoff");
@@ -120,7 +120,7 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("charoff", chOff);
}
-
+
public int getColSpan()
{
return getIntHTMLAttribute("colspan");
@@ -130,7 +130,7 @@ public class DomHTMLTableCellElement
{
setIntHTMLAttribute("colspan", colSpan);
}
-
+
public String getHeaders()
{
return getHTMLAttribute("headers");
@@ -140,7 +140,7 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("headers", headers);
}
-
+
public String getHeight()
{
return getHTMLAttribute("height");
@@ -150,7 +150,7 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("height", height);
}
-
+
public boolean getNoWrap()
{
return getBooleanHTMLAttribute("nowrap");
@@ -160,7 +160,7 @@ public class DomHTMLTableCellElement
{
setBooleanHTMLAttribute("nowrap", noWrap);
}
-
+
public int getRowSpan()
{
return getIntHTMLAttribute("rowspan");
@@ -170,7 +170,7 @@ public class DomHTMLTableCellElement
{
setIntHTMLAttribute("rowspan", rowSpan);
}
-
+
public String getScope()
{
return getHTMLAttribute("scope");
@@ -180,7 +180,7 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("scope", scope);
}
-
+
public String getVAlign()
{
return getHTMLAttribute("valign");
@@ -190,7 +190,7 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("valign", vAlign);
}
-
+
public String getWidth()
{
return getHTMLAttribute("width");
@@ -200,6 +200,5 @@ public class DomHTMLTableCellElement
{
setHTMLAttribute("width", width);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLTableColElement.java b/gnu/xml/dom/html2/DomHTMLTableColElement.java
index 799447dc8..c7cef31eb 100644
--- a/gnu/xml/dom/html2/DomHTMLTableColElement.java
+++ b/gnu/xml/dom/html2/DomHTMLTableColElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLTableColElement.java --
+/* DomHTMLTableColElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,7 +65,7 @@ public class DomHTMLTableColElement
{
setHTMLAttribute("align", align);
}
-
+
public String getCh()
{
return getHTMLAttribute("char");
@@ -75,7 +75,7 @@ public class DomHTMLTableColElement
{
setHTMLAttribute("char", ch);
}
-
+
public String getChOff()
{
return getHTMLAttribute("charoff");
@@ -85,7 +85,7 @@ public class DomHTMLTableColElement
{
setHTMLAttribute("charoff", chOff);
}
-
+
public int getSpan()
{
return getIntHTMLAttribute("span");
@@ -95,7 +95,7 @@ public class DomHTMLTableColElement
{
setIntHTMLAttribute("span", span);
}
-
+
public String getVAlign()
{
return getHTMLAttribute("valign");
@@ -105,7 +105,7 @@ public class DomHTMLTableColElement
{
setHTMLAttribute("valign", vAlign);
}
-
+
public String getWidth()
{
return getHTMLAttribute("width");
@@ -115,6 +115,5 @@ public class DomHTMLTableColElement
{
setHTMLAttribute("width", width);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLTableElement.java b/gnu/xml/dom/html2/DomHTMLTableElement.java
index ea925400e..ade463ef7 100644
--- a/gnu/xml/dom/html2/DomHTMLTableElement.java
+++ b/gnu/xml/dom/html2/DomHTMLTableElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLTableElement.java --
+/* DomHTMLTableElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -79,7 +79,7 @@ public class DomHTMLTableElement
replaceChild(caption, ref);
}
}
-
+
public HTMLTableSectionElement getTHead()
{
return (HTMLTableSectionElement) getChildElement("thead");
@@ -133,7 +133,7 @@ public class DomHTMLTableElement
ret.evaluate();
return ret;
}
-
+
public String getAlign()
{
return getHTMLAttribute("align");
@@ -143,7 +143,7 @@ public class DomHTMLTableElement
{
setHTMLAttribute("align", align);
}
-
+
public String getBgColor()
{
return getHTMLAttribute("bgcolor");
@@ -153,7 +153,7 @@ public class DomHTMLTableElement
{
setHTMLAttribute("bgcolor", bgColor);
}
-
+
public String getBorder()
{
return getHTMLAttribute("border");
@@ -163,7 +163,7 @@ public class DomHTMLTableElement
{
setHTMLAttribute("border", border);
}
-
+
public String getCellPadding()
{
return getHTMLAttribute("cellpadding");
@@ -173,7 +173,7 @@ public class DomHTMLTableElement
{
setHTMLAttribute("cellpadding", cellPadding);
}
-
+
public String getCellSpacing()
{
return getHTMLAttribute("cellspacing");
@@ -183,7 +183,7 @@ public class DomHTMLTableElement
{
setHTMLAttribute("cellspacing", cellSpacing);
}
-
+
public String getFrame()
{
return getHTMLAttribute("frame");
@@ -193,7 +193,7 @@ public class DomHTMLTableElement
{
setHTMLAttribute("frame", frame);
}
-
+
public String getRules()
{
return getHTMLAttribute("rules");
@@ -203,7 +203,7 @@ public class DomHTMLTableElement
{
setHTMLAttribute("rules", rules);
}
-
+
public String getSummary()
{
return getHTMLAttribute("summary");
@@ -213,7 +213,7 @@ public class DomHTMLTableElement
{
setHTMLAttribute("summary", summary);
}
-
+
public String getWidth()
{
return getHTMLAttribute("width");
@@ -320,9 +320,9 @@ public class DomHTMLTableElement
}
ref.getParentNode().removeChild(ref);
}
-
+
Node getRow(final int index)
- {
+ {
int i = 0;
Node thead = getChildElement("thead");
if (thead != null)
@@ -395,4 +395,3 @@ public class DomHTMLTableElement
}
}
-
diff --git a/gnu/xml/dom/html2/DomHTMLTableRowElement.java b/gnu/xml/dom/html2/DomHTMLTableRowElement.java
index ecd07a743..9943585f4 100644
--- a/gnu/xml/dom/html2/DomHTMLTableRowElement.java
+++ b/gnu/xml/dom/html2/DomHTMLTableRowElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLTableRowElement.java --
+/* DomHTMLTableRowElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -134,7 +134,7 @@ public class DomHTMLTableRowElement
{
setHTMLAttribute("align", align);
}
-
+
public String getBgColor()
{
return getHTMLAttribute("bgcolor");
@@ -144,7 +144,7 @@ public class DomHTMLTableRowElement
{
setHTMLAttribute("bgcolor", bgColor);
}
-
+
public String getCh()
{
return getHTMLAttribute("char");
@@ -154,7 +154,7 @@ public class DomHTMLTableRowElement
{
setHTMLAttribute("char", ch);
}
-
+
public String getChOff()
{
return getHTMLAttribute("charoff");
@@ -164,7 +164,7 @@ public class DomHTMLTableRowElement
{
setHTMLAttribute("charoff", chOff);
}
-
+
public String getVAlign()
{
return getHTMLAttribute("valign");
@@ -199,9 +199,9 @@ public class DomHTMLTableRowElement
}
removeChild(ref);
}
-
+
Node getCell(final int index)
- {
+ {
int i = 0;
for (Node ctx = getFirstChild(); ctx != null;
ctx = ctx.getNextSibling())
@@ -224,6 +224,5 @@ public class DomHTMLTableRowElement
}
return null;
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLTableSectionElement.java b/gnu/xml/dom/html2/DomHTMLTableSectionElement.java
index da015f1f6..389eb591b 100644
--- a/gnu/xml/dom/html2/DomHTMLTableSectionElement.java
+++ b/gnu/xml/dom/html2/DomHTMLTableSectionElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLTableSectionElement.java --
+/* DomHTMLTableSectionElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,7 +70,7 @@ public class DomHTMLTableSectionElement
{
setHTMLAttribute("align", align);
}
-
+
public String getCh()
{
return getHTMLAttribute("char");
@@ -80,7 +80,7 @@ public class DomHTMLTableSectionElement
{
setHTMLAttribute("char", ch);
}
-
+
public String getChOff()
{
return getHTMLAttribute("charoff");
@@ -90,7 +90,7 @@ public class DomHTMLTableSectionElement
{
setHTMLAttribute("charoff", chOff);
}
-
+
public String getVAlign()
{
return getHTMLAttribute("valign");
@@ -134,9 +134,9 @@ public class DomHTMLTableSectionElement
}
removeChild(ref);
}
-
+
Node getRow(final int index)
- {
+ {
int i = 0;
for (Node ctx = getFirstChild(); ctx != null;
ctx = ctx.getNextSibling())
@@ -158,6 +158,5 @@ public class DomHTMLTableSectionElement
}
return null;
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLTextAreaElement.java b/gnu/xml/dom/html2/DomHTMLTextAreaElement.java
index 22d610569..9acfab134 100644
--- a/gnu/xml/dom/html2/DomHTMLTextAreaElement.java
+++ b/gnu/xml/dom/html2/DomHTMLTextAreaElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLTextAreaElement.java --
+/* DomHTMLTextAreaElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -73,7 +73,7 @@ public class DomHTMLTextAreaElement
{
return (HTMLFormElement) getParentElement("form");
}
-
+
public String getAccessKey()
{
return getHTMLAttribute("accesskey");
@@ -83,7 +83,7 @@ public class DomHTMLTextAreaElement
{
setHTMLAttribute("accesskey", accessKey);
}
-
+
public int getCols()
{
return getIntHTMLAttribute("cols");
@@ -93,7 +93,7 @@ public class DomHTMLTextAreaElement
{
setIntHTMLAttribute("cols", cols);
}
-
+
public boolean getDisabled()
{
return getBooleanHTMLAttribute("disabled");
@@ -103,7 +103,7 @@ public class DomHTMLTextAreaElement
{
setBooleanHTMLAttribute("disabled", disabled);
}
-
+
public String getName()
{
return getHTMLAttribute("name");
@@ -113,7 +113,7 @@ public class DomHTMLTextAreaElement
{
setHTMLAttribute("name", name);
}
-
+
public boolean getReadOnly()
{
return getBooleanHTMLAttribute("readOnly");
@@ -123,7 +123,7 @@ public class DomHTMLTextAreaElement
{
setBooleanHTMLAttribute("readonly", readOnly);
}
-
+
public int getRows()
{
return getIntHTMLAttribute("rows");
@@ -133,7 +133,7 @@ public class DomHTMLTextAreaElement
{
setIntHTMLAttribute("rows", rows);
}
-
+
public int getTabIndex()
{
return getIntHTMLAttribute("tabindex");
@@ -143,7 +143,7 @@ public class DomHTMLTextAreaElement
{
setIntHTMLAttribute("tabindex", tabIndex);
}
-
+
public String getType()
{
return "textarea";
@@ -172,11 +172,10 @@ public class DomHTMLTextAreaElement
{
dispatchUIEvent("focus");
}
-
+
public void select()
{
dispatchUIEvent("select");
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLTitleElement.java b/gnu/xml/dom/html2/DomHTMLTitleElement.java
index f62342d6f..4f581061b 100644
--- a/gnu/xml/dom/html2/DomHTMLTitleElement.java
+++ b/gnu/xml/dom/html2/DomHTMLTitleElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLTitleElement.java --
+/* DomHTMLTitleElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,5 @@ public class DomHTMLTitleElement
{
setTextContent(text);
}
-
-}
+}
diff --git a/gnu/xml/dom/html2/DomHTMLUListElement.java b/gnu/xml/dom/html2/DomHTMLUListElement.java
index c07adeabf..39cdce7d3 100644
--- a/gnu/xml/dom/html2/DomHTMLUListElement.java
+++ b/gnu/xml/dom/html2/DomHTMLUListElement.java
@@ -1,4 +1,4 @@
-/* DomHTMLUListElement.java --
+/* DomHTMLUListElement.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ public class DomHTMLUListElement
{
setBooleanHTMLAttribute("compact", compact);
}
-
+
public String getType()
{
return getHTMLAttribute("type");
@@ -74,6 +74,5 @@ public class DomHTMLUListElement
{
setHTMLAttribute("type", type);
}
-
-}
+}
diff --git a/gnu/xml/dom/ls/DomLSException.java b/gnu/xml/dom/ls/DomLSException.java
index 6ac49e669..31efc845f 100644
--- a/gnu/xml/dom/ls/DomLSException.java
+++ b/gnu/xml/dom/ls/DomLSException.java
@@ -1,4 +1,4 @@
-/* DomLSException.java --
+/* DomLSException.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/dom/ls/DomLSInput.java b/gnu/xml/dom/ls/DomLSInput.java
index 68705fdee..39b17694f 100644
--- a/gnu/xml/dom/ls/DomLSInput.java
+++ b/gnu/xml/dom/ls/DomLSInput.java
@@ -1,4 +1,4 @@
-/* DomLSInput.java --
+/* DomLSInput.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -155,6 +155,5 @@ public class DomLSInput
{
this.certifiedText = certifiedText;
}
-
-}
+}
diff --git a/gnu/xml/dom/ls/DomLSOutput.java b/gnu/xml/dom/ls/DomLSOutput.java
index c2f4d4132..e8bec2ec1 100644
--- a/gnu/xml/dom/ls/DomLSOutput.java
+++ b/gnu/xml/dom/ls/DomLSOutput.java
@@ -1,4 +1,4 @@
-/* DomLSOutput.java --
+/* DomLSOutput.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -94,5 +94,5 @@ public class DomLSOutput
{
this.encoding = encoding;
}
-
+
}
diff --git a/gnu/xml/dom/ls/DomLSParser.java b/gnu/xml/dom/ls/DomLSParser.java
index f4f555e8c..99db79d64 100644
--- a/gnu/xml/dom/ls/DomLSParser.java
+++ b/gnu/xml/dom/ls/DomLSParser.java
@@ -1,4 +1,4 @@
-/* DomLSParser.java --
+/* DomLSParser.java --
Copyright (C) 1999,2000,2001,2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -125,12 +125,12 @@ public class DomLSParser
}
// -- LSParser --
-
+
public DOMConfiguration getDomConfig()
{
return this;
}
-
+
public LSParserFilter getFilter()
{
return filter;
@@ -283,7 +283,7 @@ public class DomLSParser
catch (SAXNotRecognizedException e)
{
// ignore
- }
+ }
try
{
reader.setFeature("http://xml.org/sax/features/use-attributes2",
@@ -563,6 +563,5 @@ public class DomLSParser
}
abort();
}
-
-}
+}
diff --git a/gnu/xml/dom/ls/DomLSSerializer.java b/gnu/xml/dom/ls/DomLSSerializer.java
index cedaf151e..c282b0b9f 100644
--- a/gnu/xml/dom/ls/DomLSSerializer.java
+++ b/gnu/xml/dom/ls/DomLSSerializer.java
@@ -1,4 +1,4 @@
-/* DomLSSerializer.java --
+/* DomLSSerializer.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -85,7 +85,7 @@ public class DomLSSerializer
}
// -- LSSerializer --
-
+
public DOMConfiguration getDomConfig()
{
return this;
@@ -349,6 +349,5 @@ public class DomLSSerializer
{
return SUPPORTED_PARAMETERS.contains(str);
}
-
-}
+}
diff --git a/gnu/xml/dom/ls/FilteredSAXEventSink.java b/gnu/xml/dom/ls/FilteredSAXEventSink.java
index 1c99ee524..65c1d37a4 100644
--- a/gnu/xml/dom/ls/FilteredSAXEventSink.java
+++ b/gnu/xml/dom/ls/FilteredSAXEventSink.java
@@ -1,4 +1,4 @@
-/* FilteredSAXEventSink.java --
+/* FilteredSAXEventSink.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ class FilteredSAXEventSink
* Stack of elements to insert.
*/
LinkedList nodes;
-
+
/**
* Corresponding stack of filter decisions about the nodes.
*/
@@ -90,7 +90,7 @@ class FilteredSAXEventSink
}
nodes = new LinkedList();
decisions = new LinkedList();
-
+
super.startDocument();
}
@@ -110,7 +110,7 @@ class FilteredSAXEventSink
doc = null;
break;
}
-
+
nodes = null;
decisions = null;
}
@@ -125,7 +125,7 @@ class FilteredSAXEventSink
}
Element element = createElement(uri, localName, qName, atts);
ctx = element;
-
+
short decision = getDecision(element, true);
nodes.addLast(element);
decisions.addLast(new Short(decision));
@@ -164,7 +164,7 @@ class FilteredSAXEventSink
return;
}
super.endElement(uri, localName, qName);
-
+
Element element = (Element) nodes.removeLast();
Node parent = nodes.isEmpty() ? doc : (Node) nodes.getLast();
ctx = parent;
@@ -303,40 +303,40 @@ class FilteredSAXEventSink
{
case Node.ATTRIBUTE_NODE:
show = ((whatToShow & NodeFilter.SHOW_ATTRIBUTE) != 0);
- break;
+ break;
case Node.TEXT_NODE:
show = ((whatToShow & NodeFilter.SHOW_TEXT) != 0);
- break;
+ break;
case Node.CDATA_SECTION_NODE:
show = ((whatToShow & NodeFilter.SHOW_CDATA_SECTION) != 0);
- break;
+ break;
case Node.ELEMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_ELEMENT) != 0);
- break;
+ break;
case Node.COMMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_COMMENT) != 0);
- break;
+ break;
case Node.DOCUMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_DOCUMENT) != 0);
- break;
+ break;
case Node.PROCESSING_INSTRUCTION_NODE:
show = ((whatToShow & NodeFilter.SHOW_PROCESSING_INSTRUCTION) != 0);
- break;
+ break;
case Node.DOCUMENT_FRAGMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_DOCUMENT_FRAGMENT) != 0);
- break;
+ break;
case Node.DOCUMENT_TYPE_NODE:
show = ((whatToShow & NodeFilter.SHOW_DOCUMENT_TYPE) != 0);
- break;
+ break;
case Node.ENTITY_REFERENCE_NODE:
show = ((whatToShow & NodeFilter.SHOW_ENTITY_REFERENCE) != 0);
- break;
+ break;
case Node.ENTITY_NODE:
show = ((whatToShow & NodeFilter.SHOW_ENTITY) != 0);
- break;
+ break;
case Node.NOTATION_NODE:
show = ((whatToShow & NodeFilter.SHOW_NOTATION) != 0);
- break;
+ break;
}
}
if (!show)
@@ -351,4 +351,3 @@ class FilteredSAXEventSink
}
}
-
diff --git a/gnu/xml/dom/ls/ReaderInputStream.java b/gnu/xml/dom/ls/ReaderInputStream.java
index 5b41abd3d..cf279ab39 100644
--- a/gnu/xml/dom/ls/ReaderInputStream.java
+++ b/gnu/xml/dom/ls/ReaderInputStream.java
@@ -1,4 +1,4 @@
-/* ReaderInputStream.java --
+/* ReaderInputStream.java --
Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -124,7 +124,7 @@ public class ReaderInputStream
String s = new String(c, 0, l);
byte[] d = s.getBytes(encoding);
-
+
int available = d.length;
int more = d.length - len;
if (more > 0)
@@ -134,7 +134,7 @@ public class ReaderInputStream
System.arraycopy(d, len, extra, 0, more);
available -= more;
}
-
+
System.arraycopy(d, 0, b, off, available);
return available;
}
@@ -232,6 +232,5 @@ public class ReaderInputStream
{
return getClass().getName() + "[" + reader + ", " + encoding + "]";
}
-
-}
+}
diff --git a/gnu/xml/dom/ls/SAXEventSink.java b/gnu/xml/dom/ls/SAXEventSink.java
index 1f8de046d..06333dd7e 100644
--- a/gnu/xml/dom/ls/SAXEventSink.java
+++ b/gnu/xml/dom/ls/SAXEventSink.java
@@ -1,4 +1,4 @@
-/* SAXEventSink.java --
+/* SAXEventSink.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -96,7 +96,7 @@ public class SAXEventSink
boolean coalescing;
XMLReader reader; // reference back to the parser to get features
-
+
DomDocument doc; // document being constructed
Node ctx; // current context (parent node)
LinkedList entityCtx; // entity context
@@ -122,7 +122,7 @@ public class SAXEventSink
}
// -- ContentHandler2 --
-
+
public void setDocumentLocator(Locator locator)
{
this.locator = locator;
@@ -378,7 +378,7 @@ public class SAXEventSink
}
// -- LexicalHandler --
-
+
public void startDTD(String name, String publicId, String systemId)
throws SAXException
{
@@ -534,7 +534,7 @@ public class SAXEventSink
}
// -- DeclHandler --
-
+
public void elementDecl(String name, String model)
throws SAXException
{
@@ -599,6 +599,5 @@ public class SAXEventSink
DomDoctype doctype = (DomDoctype) ctx;
Entity entity = doctype.declareEntity(name, publicId, systemId, null);
}
-
-}
+}
diff --git a/gnu/xml/dom/ls/WriterOutputStream.java b/gnu/xml/dom/ls/WriterOutputStream.java
index 2fb206147..f1ae344f4 100644
--- a/gnu/xml/dom/ls/WriterOutputStream.java
+++ b/gnu/xml/dom/ls/WriterOutputStream.java
@@ -1,4 +1,4 @@
-/* WriterOutputStream.java --
+/* WriterOutputStream.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -93,6 +93,5 @@ public class WriterOutputStream
{
writer.flush();
}
-
-}
+}
diff --git a/gnu/xml/libxmlj/dom/GnomeAttr.java b/gnu/xml/libxmlj/dom/GnomeAttr.java
index 144aaf828..da9c62c9d 100644
--- a/gnu/xml/libxmlj/dom/GnomeAttr.java
+++ b/gnu/xml/libxmlj/dom/GnomeAttr.java
@@ -1,4 +1,4 @@
-/* GnomeAttr.java -
+/* GnomeAttr.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,31 +59,31 @@ class GnomeAttr
{
super(id);
}
-
+
public String getName()
{
return getNodeName();
}
-
+
public native boolean getSpecified();
-
+
public native String getValue();
-
+
public native void setValue(String value)
throws DOMException;
-
+
public Node getParentNode()
{
return null;
}
-
+
public Element getOwnerElement()
{
return (Element) super.getParentNode();
}
-
+
// DOM Level 3 methods
-
+
public TypeInfo getSchemaTypeInfo()
{
return new GnomeTypeInfo(id);
@@ -100,7 +100,7 @@ class GnomeAttr
element.userIdAttrs != null &&
element.userIdAttrs.contains(this));
}
-
+
private native boolean xmljIsId();
public String toString()
@@ -113,6 +113,5 @@ class GnomeAttr
buffer.append("]");
return buffer.toString();
}
-
-}
+}
diff --git a/gnu/xml/libxmlj/dom/GnomeCDATASection.java b/gnu/xml/libxmlj/dom/GnomeCDATASection.java
index 8fb89ff4d..3e408e653 100644
--- a/gnu/xml/libxmlj/dom/GnomeCDATASection.java
+++ b/gnu/xml/libxmlj/dom/GnomeCDATASection.java
@@ -1,4 +1,4 @@
-/* GnomeCDATASection.java -
+/* GnomeCDATASection.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/libxmlj/dom/GnomeCharacterData.java b/gnu/xml/libxmlj/dom/GnomeCharacterData.java
index aa98652ba..3f3d6ecb5 100644
--- a/gnu/xml/libxmlj/dom/GnomeCharacterData.java
+++ b/gnu/xml/libxmlj/dom/GnomeCharacterData.java
@@ -1,4 +1,4 @@
-/* GnomeCharacterData.java -
+/* GnomeCharacterData.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/libxmlj/dom/GnomeComment.java b/gnu/xml/libxmlj/dom/GnomeComment.java
index a0cad5b3e..b6985c4a4 100644
--- a/gnu/xml/libxmlj/dom/GnomeComment.java
+++ b/gnu/xml/libxmlj/dom/GnomeComment.java
@@ -1,4 +1,4 @@
-/* GnomeComment.java -
+/* GnomeComment.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/libxmlj/dom/GnomeDOMException.java b/gnu/xml/libxmlj/dom/GnomeDOMException.java
index eae07876f..a1af82335 100644
--- a/gnu/xml/libxmlj/dom/GnomeDOMException.java
+++ b/gnu/xml/libxmlj/dom/GnomeDOMException.java
@@ -1,4 +1,4 @@
-/* GnomeDOMException.java -
+/* GnomeDOMException.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -94,5 +94,5 @@ class GnomeDOMException
return null;
}
}
-
+
}
diff --git a/gnu/xml/libxmlj/dom/GnomeDOMStringList.java b/gnu/xml/libxmlj/dom/GnomeDOMStringList.java
index 3456acd99..c415ec782 100644
--- a/gnu/xml/libxmlj/dom/GnomeDOMStringList.java
+++ b/gnu/xml/libxmlj/dom/GnomeDOMStringList.java
@@ -1,4 +1,4 @@
-/* GnomeDOMStringList.java -
+/* GnomeDOMStringList.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,5 +80,5 @@ class GnomeDOMStringList
}
return false;
}
-
+
}
diff --git a/gnu/xml/libxmlj/dom/GnomeDocument.java b/gnu/xml/libxmlj/dom/GnomeDocument.java
index a5333550e..0d1b487d8 100644
--- a/gnu/xml/libxmlj/dom/GnomeDocument.java
+++ b/gnu/xml/libxmlj/dom/GnomeDocument.java
@@ -1,4 +1,4 @@
-/* GnomeDocument.java -
+/* GnomeDocument.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -102,18 +102,18 @@ public class GnomeDocument
boolean validate = false;
boolean validateIfSchema = false;
boolean wellFormed = true;
-
+
GnomeDocument(Object id)
{
super(id);
strictErrorChecking = true;
}
-
+
protected void finalize()
{
free(id);
}
-
+
private native void free(Object id);
public native DocumentType getDoctype();
@@ -177,7 +177,7 @@ public class GnomeDocument
public native Element createElementNS(String namespaceURI, String
qualifiedName)
throws DOMException;
-
+
public native Attr createAttributeNS(String namespaceURI, String
qualifiedName)
throws DOMException;
@@ -211,7 +211,7 @@ public class GnomeDocument
}
return element;
}
-
+
private native Element xmljGetElementById(String elementId);
// DOM Level 3 methods
@@ -237,7 +237,7 @@ public class GnomeDocument
{
this.strictErrorChecking = strictErrorChecking;
}
-
+
public native String getDocumentURI();
public native void setDocumentURI(String documentURI);
@@ -410,14 +410,14 @@ public class GnomeDocument
else if ("infoset".equals(name))
{
return Boolean.valueOf(!validateIfSchema &&
- !entities &&
- !datatypeNormalization &&
- !cdataSections &&
- namespaceDeclarations &&
- wellFormed &&
- elementContentWhitespace &&
- comments &&
- namespaces);
+ !entities &&
+ !datatypeNormalization &&
+ !cdataSections &&
+ namespaceDeclarations &&
+ wellFormed &&
+ elementContentWhitespace &&
+ comments &&
+ namespaces);
}
else if ("namespaces".equals(name))
{
@@ -466,7 +466,7 @@ public class GnomeDocument
"namespace-declarations".equals(name) ||
"split-cdata-sections".equals(name));
}
-
+
public DOMStringList getParameterNames()
{
String[] names = new String[] {
@@ -547,7 +547,7 @@ public class GnomeDocument
}
// -- Debugging --
-
+
public String toString()
{
CPStringBuilder buffer = new CPStringBuilder(getClass().getName());
diff --git a/gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java b/gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java
index 4decee0d8..6dea87226 100644
--- a/gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java
+++ b/gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java
@@ -1,4 +1,4 @@
-/* GnomeDocumentBuilder.java -
+/* GnomeDocumentBuilder.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -89,7 +89,7 @@ public class GnomeDocumentBuilder
{
this(true, false, false);
}
-
+
/**
* Constructs a new document builder.
* @param validate whether to validate during parsing
@@ -151,7 +151,7 @@ public class GnomeDocumentBuilder
true, //entityResolver != null,
errorHandler != null);
}
-
+
private native Document parseStream(InputStream in,
byte[] detectBuffer,
String publicId,
@@ -162,7 +162,7 @@ public class GnomeDocumentBuilder
boolean expandEntities,
boolean entityResolver,
boolean errorHandler);
-
+
public void setEntityResolver(EntityResolver resolver)
{
entityResolver = resolver;
@@ -186,7 +186,7 @@ public class GnomeDocumentBuilder
{
name = name.substring(1);
}
-
+
if ("xml".equals(name) || "core".equals(name))
{
return (version == null ||
@@ -194,7 +194,7 @@ public class GnomeDocumentBuilder
"1.0".equals(version) ||
"2.0".equals(version) ||
"3.0".equals(version));
-
+
}
else if ("ls".equals(name) || "ls-async".equals(name))
{
@@ -210,7 +210,7 @@ public class GnomeDocumentBuilder
{
return (version == null ||
"".equals(version) ||
- "2.0".equals(version));
+ "2.0".equals(version));
}
else if ("xpath".equals(name))
{
@@ -220,7 +220,7 @@ public class GnomeDocumentBuilder
}
return false;
}
-
+
// DOM Level 3
public Object getFeature(String feature, String version)
@@ -231,25 +231,25 @@ public class GnomeDocumentBuilder
}
return null;
}
-
+
public native Document createDocument(String namespaceURI,
String qualifiedName,
DocumentType doctype);
-
+
public DocumentType createDocumentType(String qualifiedName,
String publicId,
String systemId)
{
return new StandaloneDocumentType(qualifiedName, publicId, systemId);
}
-
+
// Callback hooks from JNI
-
+
private void setDocumentLocator(Object ctx, Object loc)
{
// ignore
}
-
+
private InputStream resolveEntity(String publicId, String systemId,
String base)
throws SAXException, IOException
@@ -270,7 +270,7 @@ public class GnomeDocumentBuilder
}
return in;
}
-
+
private void warning(String message,
int lineNumber,
int columnNumber,
diff --git a/gnu/xml/libxmlj/dom/GnomeDocumentBuilderFactory.java b/gnu/xml/libxmlj/dom/GnomeDocumentBuilderFactory.java
index c8918aa72..448e12351 100644
--- a/gnu/xml/libxmlj/dom/GnomeDocumentBuilderFactory.java
+++ b/gnu/xml/libxmlj/dom/GnomeDocumentBuilderFactory.java
@@ -1,4 +1,4 @@
-/* GnomeDocumentBuilderFactory.java -
+/* GnomeDocumentBuilderFactory.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -93,7 +93,7 @@ public class GnomeDocumentBuilderFactory
{
// TODO
}
-
+
public void setFeature(String name, boolean value)
throws ParserConfigurationException
{
@@ -114,5 +114,5 @@ public class GnomeDocumentBuilderFactory
return secureProcessing;
throw new ParserConfigurationException(name);
}
-
+
}
diff --git a/gnu/xml/libxmlj/dom/GnomeDocumentFragment.java b/gnu/xml/libxmlj/dom/GnomeDocumentFragment.java
index e5b355e42..3623eb6cf 100644
--- a/gnu/xml/libxmlj/dom/GnomeDocumentFragment.java
+++ b/gnu/xml/libxmlj/dom/GnomeDocumentFragment.java
@@ -1,4 +1,4 @@
-/* GnomeDocumentFragment.java -
+/* GnomeDocumentFragment.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/libxmlj/dom/GnomeDocumentType.java b/gnu/xml/libxmlj/dom/GnomeDocumentType.java
index eb3a65f1d..7649b7339 100644
--- a/gnu/xml/libxmlj/dom/GnomeDocumentType.java
+++ b/gnu/xml/libxmlj/dom/GnomeDocumentType.java
@@ -1,4 +1,4 @@
-/* GnomeDocumentType.java -
+/* GnomeDocumentType.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,7 +56,7 @@ implements DocumentType
{
super (id);
}
-
+
public String getName ()
{
return getNodeName ();
diff --git a/gnu/xml/libxmlj/dom/GnomeElement.java b/gnu/xml/libxmlj/dom/GnomeElement.java
index e87e3adfe..19889d663 100644
--- a/gnu/xml/libxmlj/dom/GnomeElement.java
+++ b/gnu/xml/libxmlj/dom/GnomeElement.java
@@ -1,4 +1,4 @@
-/* GnomeElement.java -
+/* GnomeElement.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,7 +67,7 @@ class GnomeElement
{
super(id);
}
-
+
public String getTagName()
{
return getNodeName();
@@ -77,7 +77,7 @@ class GnomeElement
public native void setAttribute(String name, String value)
throws DOMException;
-
+
public void removeAttribute(String name)
throws DOMException
{
@@ -89,7 +89,7 @@ class GnomeElement
}
public native Attr getAttributeNode(String name);
-
+
public native Attr setAttributeNode(Attr newAttr)
throws DOMException;
@@ -97,9 +97,9 @@ class GnomeElement
throws DOMException;
public native NodeList getElementsByTagName(String name);
-
+
public native String getAttributeNS(String namespaceURI, String localName);
-
+
public native void setAttributeNS(String namespaceURI, String
qualifiedName, String value)
throws DOMException;
@@ -113,7 +113,7 @@ class GnomeElement
removeAttributeNode(attr);
}
}
-
+
public native Attr getAttributeNodeNS(String namespaceURI,
String localName);
@@ -122,7 +122,7 @@ class GnomeElement
public native NodeList getElementsByTagNameNS(String namespaceURI,
String localName);
-
+
public native boolean hasAttribute(String name);
public native boolean hasAttributeNS(String namespaceURI,
diff --git a/gnu/xml/libxmlj/dom/GnomeEntity.java b/gnu/xml/libxmlj/dom/GnomeEntity.java
index 8d61a26c1..a05217473 100644
--- a/gnu/xml/libxmlj/dom/GnomeEntity.java
+++ b/gnu/xml/libxmlj/dom/GnomeEntity.java
@@ -1,4 +1,4 @@
-/* GnomeEntity.java -
+/* GnomeEntity.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,25 +63,25 @@ implements Entity
public native String getNotationName ();
// DOM Level 3 methods
-
+
public String getInputEncoding ()
{
// TODO
- return null;
+ return null;
}
-
+
public String getXmlEncoding ()
{
// TODO
return null;
}
-
+
public String getXmlVersion ()
{
// TODO
return null;
}
-
+
public String toString ()
{
String publicId = getPublicId ();
diff --git a/gnu/xml/libxmlj/dom/GnomeEntityReference.java b/gnu/xml/libxmlj/dom/GnomeEntityReference.java
index 136b3a69d..aa2fcf1e5 100644
--- a/gnu/xml/libxmlj/dom/GnomeEntityReference.java
+++ b/gnu/xml/libxmlj/dom/GnomeEntityReference.java
@@ -1,4 +1,4 @@
-/* GnomeEntityReference.java -
+/* GnomeEntityReference.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/libxmlj/dom/GnomeNamedNodeMap.java b/gnu/xml/libxmlj/dom/GnomeNamedNodeMap.java
index 8ca892128..b8df4fede 100644
--- a/gnu/xml/libxmlj/dom/GnomeNamedNodeMap.java
+++ b/gnu/xml/libxmlj/dom/GnomeNamedNodeMap.java
@@ -1,4 +1,4 @@
-/* GnomeNamedNodeMap.java -
+/* GnomeNamedNodeMap.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -78,7 +78,7 @@ implements NamedNodeMap
throws DOMException;
public native Node item (int index);
-
+
public native int getLength ();
public native Node getNamedItemNS (String namespaceURI, String localName);
@@ -88,5 +88,5 @@ implements NamedNodeMap
public native Node removeNamedItemNS (String namespaceURI,
String localName);
-
+
}
diff --git a/gnu/xml/libxmlj/dom/GnomeNode.java b/gnu/xml/libxmlj/dom/GnomeNode.java
index 6f574ec29..5874916e5 100644
--- a/gnu/xml/libxmlj/dom/GnomeNode.java
+++ b/gnu/xml/libxmlj/dom/GnomeNode.java
@@ -1,4 +1,4 @@
-/* GnomeNode.java -
+/* GnomeNode.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -145,7 +145,7 @@ class GnomeNode
docNodes.put(node, nodeInstance);
return nodeInstance;
}
-
+
/**
* Frees the specified document.
* This removes all its nodes from the cache.
@@ -159,7 +159,7 @@ class GnomeNode
instances.remove(doc);
//System.out.println("Freed "+instances.remove(doc));
}
-
+
/**
* xmlNodePtr
*/
@@ -302,7 +302,7 @@ class GnomeNode
notifyUserDataHandlers(UserDataHandler.NODE_CLONED, this, ret);
return ret;
}
-
+
private native Node xmljCloneNode(boolean deep);
public native void normalize();
@@ -359,7 +359,7 @@ class GnomeNode
}
private native int xmljCompareTo(Object other);
-
+
public String getTextContent()
throws DOMException
{
@@ -392,7 +392,7 @@ class GnomeNode
return null;
}
}
-
+
public void setTextContent(String textContent)
throws DOMException
{
@@ -427,20 +427,20 @@ class GnomeNode
break;
}
}
-
+
public boolean isSameNode(Node other)
{
return equals(other);
}
-
+
public native String lookupPrefix(String namespaceURI);
-
+
public native boolean isDefaultNamespace(String namespaceURI);
-
+
public native String lookupNamespaceURI(String prefix);
-
+
public native boolean isEqualNode(Node arg);
-
+
public Object getFeature(String feature, String version)
{
return getOwnerDocument().getImplementation()
diff --git a/gnu/xml/libxmlj/dom/GnomeNodeList.java b/gnu/xml/libxmlj/dom/GnomeNodeList.java
index efd07acb0..51a6d0bfa 100644
--- a/gnu/xml/libxmlj/dom/GnomeNodeList.java
+++ b/gnu/xml/libxmlj/dom/GnomeNodeList.java
@@ -1,4 +1,4 @@
-/* GnomeNodeList.java -
+/* GnomeNodeList.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -62,5 +62,5 @@ implements NodeList
public native Node item (int index);
public native int getLength ();
-
+
}
diff --git a/gnu/xml/libxmlj/dom/GnomeNotation.java b/gnu/xml/libxmlj/dom/GnomeNotation.java
index 7f6fdf448..50e48e2a3 100644
--- a/gnu/xml/libxmlj/dom/GnomeNotation.java
+++ b/gnu/xml/libxmlj/dom/GnomeNotation.java
@@ -1,4 +1,4 @@
-/* GnomeNotation.java -
+/* GnomeNotation.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/libxmlj/dom/GnomeProcessingInstruction.java b/gnu/xml/libxmlj/dom/GnomeProcessingInstruction.java
index d2ecd1890..fad6e108a 100644
--- a/gnu/xml/libxmlj/dom/GnomeProcessingInstruction.java
+++ b/gnu/xml/libxmlj/dom/GnomeProcessingInstruction.java
@@ -1,4 +1,4 @@
-/* GnomeProcessingInstruction.java -
+/* GnomeProcessingInstruction.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/libxmlj/dom/GnomeText.java b/gnu/xml/libxmlj/dom/GnomeText.java
index 8b8e5e0c1..e00be18a9 100644
--- a/gnu/xml/libxmlj/dom/GnomeText.java
+++ b/gnu/xml/libxmlj/dom/GnomeText.java
@@ -1,4 +1,4 @@
-/* GnomeText.java -
+/* GnomeText.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ implements Text
{
super (id);
}
-
+
public Text splitText (int offset)
throws DOMException
{
@@ -69,14 +69,14 @@ implements Text
setNodeValue (part2);
return text;
}
-
+
// DOM Level 3
public boolean isElementContentWhitespace ()
{
return getTextContent ().trim ().length () == 0;
}
-
+
public String getWholeText ()
{
Node first = this;
@@ -103,7 +103,7 @@ implements Text
{
setNodeValue (content);
}
-
+
Node first = this;
Node node = getPreviousSibling ();
while (node != null && node instanceof Text)
diff --git a/gnu/xml/libxmlj/dom/GnomeTypeInfo.java b/gnu/xml/libxmlj/dom/GnomeTypeInfo.java
index d365f0d9f..5517e8a99 100644
--- a/gnu/xml/libxmlj/dom/GnomeTypeInfo.java
+++ b/gnu/xml/libxmlj/dom/GnomeTypeInfo.java
@@ -1,4 +1,4 @@
-/* GnomeTypeInfo.java -
+/* GnomeTypeInfo.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,5 +61,5 @@ class GnomeTypeInfo implements TypeInfo
public native boolean isDerivedFrom (String typeNamespaceArg,
String typeNameArg,
int derivationMethod);
-
+
}
diff --git a/gnu/xml/libxmlj/dom/GnomeXPathExpression.java b/gnu/xml/libxmlj/dom/GnomeXPathExpression.java
index 815804799..52f4daa21 100644
--- a/gnu/xml/libxmlj/dom/GnomeXPathExpression.java
+++ b/gnu/xml/libxmlj/dom/GnomeXPathExpression.java
@@ -1,4 +1,4 @@
-/* GnomeXPathExpression.java -
+/* GnomeXPathExpression.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -78,9 +78,9 @@ implements XPathExpression
{
return doEvaluate (expr, contextNode, type, result);
}
-
+
private native Object doEvaluate (Object expr, Node contextNode,
short type, Object result)
throws XPathException, DOMException;
-
+
}
diff --git a/gnu/xml/libxmlj/dom/GnomeXPathNSResolver.java b/gnu/xml/libxmlj/dom/GnomeXPathNSResolver.java
index a9ba85509..039a79a03 100644
--- a/gnu/xml/libxmlj/dom/GnomeXPathNSResolver.java
+++ b/gnu/xml/libxmlj/dom/GnomeXPathNSResolver.java
@@ -1,4 +1,4 @@
-/* GnomeXPathNSResolver.java -
+/* GnomeXPathNSResolver.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,6 +60,5 @@ class GnomeXPathNSResolver
{
return node.lookupNamespaceURI(prefix);
}
-
-}
+}
diff --git a/gnu/xml/libxmlj/dom/GnomeXPathNodeList.java b/gnu/xml/libxmlj/dom/GnomeXPathNodeList.java
index dde3be2d9..b8d0a3d0a 100644
--- a/gnu/xml/libxmlj/dom/GnomeXPathNodeList.java
+++ b/gnu/xml/libxmlj/dom/GnomeXPathNodeList.java
@@ -1,4 +1,4 @@
-/* GnomeXPathNodeList.java -
+/* GnomeXPathNodeList.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/libxmlj/dom/GnomeXPathResult.java b/gnu/xml/libxmlj/dom/GnomeXPathResult.java
index 850b5fae0..b2c706f65 100644
--- a/gnu/xml/libxmlj/dom/GnomeXPathResult.java
+++ b/gnu/xml/libxmlj/dom/GnomeXPathResult.java
@@ -1,4 +1,4 @@
-/* GnomeXPathResult.java -
+/* GnomeXPathResult.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -69,7 +69,7 @@ implements XPathResult
}
private native void free (Object obj);
-
+
public native short getResultType ();
public native double getNumberValue ()
@@ -130,5 +130,5 @@ implements XPathResult
getSnapshotLength () + ']';
}
}
-
+
}
diff --git a/gnu/xml/libxmlj/sax/GnomeLocator.java b/gnu/xml/libxmlj/sax/GnomeLocator.java
index 0c812f683..dba0a72c0 100644
--- a/gnu/xml/libxmlj/sax/GnomeLocator.java
+++ b/gnu/xml/libxmlj/sax/GnomeLocator.java
@@ -1,4 +1,4 @@
-/* GnomeLocator.java -
+/* GnomeLocator.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,7 +67,7 @@ implements Locator
throw new NullPointerException ("loc");
}
}
-
+
public String getPublicId ()
{
return publicId (ctx, loc);
@@ -86,14 +86,14 @@ implements Locator
{
return lineNumber (ctx, loc);
}
-
+
private native int lineNumber (Object ctx, Object loc);
public int getColumnNumber ()
{
return columnNumber (ctx, loc);
}
-
+
private native int columnNumber (Object ctx, Object loc);
}
diff --git a/gnu/xml/libxmlj/sax/GnomeSAXParser.java b/gnu/xml/libxmlj/sax/GnomeSAXParser.java
index a5cdc42b7..86d326b7c 100644
--- a/gnu/xml/libxmlj/sax/GnomeSAXParser.java
+++ b/gnu/xml/libxmlj/sax/GnomeSAXParser.java
@@ -1,4 +1,4 @@
-/* GnomeSAXParser.java -
+/* GnomeSAXParser.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -101,5 +101,5 @@ extends SAXParser
{
return validating;
}
-
+
}
diff --git a/gnu/xml/libxmlj/sax/GnomeSAXParserFactory.java b/gnu/xml/libxmlj/sax/GnomeSAXParserFactory.java
index 5152d540f..0c2881240 100644
--- a/gnu/xml/libxmlj/sax/GnomeSAXParserFactory.java
+++ b/gnu/xml/libxmlj/sax/GnomeSAXParserFactory.java
@@ -1,4 +1,4 @@
-/* GnomeSAXParserFactory.java -
+/* GnomeSAXParserFactory.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -88,5 +88,5 @@ extends SAXParserFactory
GnomeXMLReader.checkFeatureName (name);
features.put (name, flag ? Boolean.TRUE : Boolean.FALSE);
}
-
+
}
diff --git a/gnu/xml/libxmlj/sax/GnomeXMLReader.java b/gnu/xml/libxmlj/sax/GnomeXMLReader.java
index 846015a1c..3a34bc934 100644
--- a/gnu/xml/libxmlj/sax/GnomeXMLReader.java
+++ b/gnu/xml/libxmlj/sax/GnomeXMLReader.java
@@ -1,4 +1,4 @@
-/* GnomeXMLReader.java -
+/* GnomeXMLReader.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -83,7 +83,7 @@ implements XMLReader
private static final String FEATURES_PREFIX =
"http://xml.org/sax/features/";
-
+
private static final List RECOGNIZED_FEATURES =
Arrays.asList (new String[]
{
@@ -100,10 +100,10 @@ implements XMLReader
"use-entity-resolver2",
"validation"
});
-
+
private static final String PROPERTIES_PREFIX =
"http://xml.org/sax/properties/";
-
+
private static final List RECOGNIZED_PROPERTIES =
Arrays.asList (new String[]
{
@@ -671,7 +671,7 @@ implements XMLReader
{
}
}
-
+
private void startDocument (boolean standalone)
throws SAXException
{
diff --git a/gnu/xml/libxmlj/sax/Namespaces.java b/gnu/xml/libxmlj/sax/Namespaces.java
index 646d7b408..473d02028 100644
--- a/gnu/xml/libxmlj/sax/Namespaces.java
+++ b/gnu/xml/libxmlj/sax/Namespaces.java
@@ -1,4 +1,4 @@
-/* Namespaces.java -
+/* Namespaces.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,14 +44,14 @@ import java.util.Iterator;
/**
* Helper class for managing namespaces.
- *
+ *
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
class Namespaces
{
ArrayList stack = new ArrayList ();
-
+
/**
* Increments the tree depth.
* This allocates a new potential namespace entry.
diff --git a/gnu/xml/libxmlj/sax/StringArrayAttributes.java b/gnu/xml/libxmlj/sax/StringArrayAttributes.java
index f534efbcf..f5a753c56 100644
--- a/gnu/xml/libxmlj/sax/StringArrayAttributes.java
+++ b/gnu/xml/libxmlj/sax/StringArrayAttributes.java
@@ -1,4 +1,4 @@
-/* StringArrayAttributes.java -
+/* StringArrayAttributes.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -168,4 +168,3 @@ implements Attributes
}
}
-
diff --git a/gnu/xml/libxmlj/sax/XMLName.java b/gnu/xml/libxmlj/sax/XMLName.java
index 5950a7996..b9bdf9159 100644
--- a/gnu/xml/libxmlj/sax/XMLName.java
+++ b/gnu/xml/libxmlj/sax/XMLName.java
@@ -1,4 +1,4 @@
-/* XMLName.java -
+/* XMLName.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ class XMLName
{
private static final String XML_URI = "http://www.w3.org/XML/1998/namespace";
-
+
final String uri;
final String localName;
final String qName;
diff --git a/gnu/xml/libxmlj/transform/ErrorListenerErrorHandler.java b/gnu/xml/libxmlj/transform/ErrorListenerErrorHandler.java
index 0601e5e89..398a0ba2e 100644
--- a/gnu/xml/libxmlj/transform/ErrorListenerErrorHandler.java
+++ b/gnu/xml/libxmlj/transform/ErrorListenerErrorHandler.java
@@ -1,4 +1,4 @@
-/* ErrorListenerErrorHandler.java -
+/* ErrorListenerErrorHandler.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,7 +71,7 @@ implements ErrorHandler
throw getSAXException (te);
}
}
-
+
public void error (SAXParseException e)
throws SAXException
{
@@ -84,7 +84,7 @@ implements ErrorHandler
throw getSAXException (te);
}
}
-
+
public void fatalError (SAXParseException e)
throws SAXException
{
@@ -107,5 +107,5 @@ implements ErrorHandler
}
return new SAXException (e);
}
-
+
}
diff --git a/gnu/xml/libxmlj/transform/GnomeTransformer.java b/gnu/xml/libxmlj/transform/GnomeTransformer.java
index 37aa05b93..5f31cb898 100755
--- a/gnu/xml/libxmlj/transform/GnomeTransformer.java
+++ b/gnu/xml/libxmlj/transform/GnomeTransformer.java
@@ -1,4 +1,4 @@
-/* GnomeTransformer.java -
+/* GnomeTransformer.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -120,19 +120,19 @@ public class GnomeTransformer
* @param errorListener the error listener for transformation errors
*/
GnomeTransformer (Source source,
- URIResolver resolver,
- ErrorListener errorListener)
+ URIResolver resolver,
+ ErrorListener errorListener)
throws TransformerConfigurationException
{
this.resolver = resolver;
this.errorListener = errorListener;
parameters = new HashMap ();
outputProperties = new Properties ();
-
+
if (source == null)
{
stylesheet = newStylesheet ();
- }
+ }
else if (source instanceof StreamSource)
{
try
@@ -176,12 +176,12 @@ public class GnomeTransformer
throw new TransformerConfigurationException (msg);
}
}
-
+
/**
* Copy constructor.
*/
private GnomeTransformer (Object stylesheet,
- URIResolver resolver,
+ URIResolver resolver,
ErrorListener errorListener,
Map parameters,
Properties outputProperties)
@@ -215,7 +215,7 @@ public class GnomeTransformer
public synchronized void setParameter (String parameter, Object value)
{
parameters.put (parameter, value);
- }
+ }
public synchronized Object getParameter (String name)
{
@@ -232,7 +232,7 @@ public class GnomeTransformer
public void setErrorListener (ErrorListener listener)
{
this.errorListener = listener;
- }
+ }
public ErrorListener getErrorListener ()
{
@@ -244,7 +244,7 @@ public class GnomeTransformer
public void setURIResolver (URIResolver resolver)
{
this.resolver = resolver;
- }
+ }
public URIResolver getURIResolver ()
{
@@ -259,12 +259,12 @@ public class GnomeTransformer
{
// Note: defensive copying
this.outputProperties = new Properties (outputProperties);
- }
+ }
public void setOutputProperty (String name, String value)
{
outputProperties.setProperty (name, value);
- }
+ }
public Properties getOutputProperties ()
{
@@ -510,7 +510,7 @@ public class GnomeTransformer
throw new TransformerException (e);
}
}
-
+
private void setDocumentLocator (Object ctx, Object loc)
{
}
@@ -550,7 +550,7 @@ public class GnomeTransformer
systemId);
errorListener.error (new TransformerException (message, l));
}
-
+
private void fatalError (String message,
int lineNumber,
int columnNumber,
@@ -568,5 +568,5 @@ public class GnomeTransformer
systemId);
errorListener.fatalError (new TransformerException (message, l));
}
-
+
}
diff --git a/gnu/xml/libxmlj/transform/GnomeTransformerFactory.java b/gnu/xml/libxmlj/transform/GnomeTransformerFactory.java
index 78dfe2148..4a0100a21 100755
--- a/gnu/xml/libxmlj/transform/GnomeTransformerFactory.java
+++ b/gnu/xml/libxmlj/transform/GnomeTransformerFactory.java
@@ -1,4 +1,4 @@
-/* GnomeTransformerFactory.java -
+/* GnomeTransformerFactory.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -86,7 +86,7 @@ public class GnomeTransformerFactory
{
XMLJ.init ();
}
-
+
/**
* URIResolver set by user, or default implementation.
*/
@@ -104,7 +104,7 @@ public class GnomeTransformerFactory
//--- Implementation of javax.xml.transform.TransformerFactory
//--- follows.
-
+
// -- begin getAssociatedStylesheet implementation --
/**
@@ -112,7 +112,7 @@ public class GnomeTransformerFactory
* <code>null</code> if no associated stylesheet could be found.
*/
public Source getAssociatedStylesheet(Source source, String media,
- String title, String charset)
+ String title, String charset)
throws TransformerConfigurationException
{
String href= null;
@@ -225,7 +225,7 @@ public class GnomeTransformerFactory
class AssociatedStylesheetHandler
extends DefaultHandler
{
-
+
String media;
String title;
String href;
@@ -246,7 +246,7 @@ public class GnomeTransformerFactory
href = parseParameter(data, "href");
}
}
-
+
}
String parseParameter(String data, String name)
@@ -270,33 +270,33 @@ public class GnomeTransformerFactory
public synchronized void setAttribute (String name, Object value)
{
this.attributes.put (name, value);
- }
+ }
public synchronized Object getAttribute (String name)
{
return attributes.get (name);
}
-
+
public void setErrorListener (ErrorListener errorListener)
{
this.errorListener = errorListener;
- }
+ }
public ErrorListener getErrorListener ()
{
return errorListener;
}
-
+
public void setURIResolver (URIResolver uriResolver)
{
this.uriResolver = uriResolver;
- }
+ }
public URIResolver getURIResolver ()
{
return uriResolver;
}
-
+
public boolean getFeature (String name)
{
return (StreamSource.FEATURE.equals (name) ||
@@ -335,7 +335,7 @@ public class GnomeTransformerFactory
* Returns a new instance of class {@link Templates} for
* the given souce.
*/
- public Templates newTemplates (Source source)
+ public Templates newTemplates (Source source)
throws TransformerConfigurationException
{
return new GnomeTransformer (source, uriResolver, errorListener);
diff --git a/gnu/xml/libxmlj/transform/URIResolverEntityResolver.java b/gnu/xml/libxmlj/transform/URIResolverEntityResolver.java
index 88a58e1a2..0ce71d0ef 100644
--- a/gnu/xml/libxmlj/transform/URIResolverEntityResolver.java
+++ b/gnu/xml/libxmlj/transform/URIResolverEntityResolver.java
@@ -1,4 +1,4 @@
-/* URIResolverEntityResolver.java -
+/* URIResolverEntityResolver.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/libxmlj/util/EmptyNodeList.java b/gnu/xml/libxmlj/util/EmptyNodeList.java
index 24a08229c..60019ddd4 100644
--- a/gnu/xml/libxmlj/util/EmptyNodeList.java
+++ b/gnu/xml/libxmlj/util/EmptyNodeList.java
@@ -1,4 +1,4 @@
-/* EmptyNodeList.java -
+/* EmptyNodeList.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,5 +58,5 @@ implements NodeList
{
return 0;
}
-
+
}
diff --git a/gnu/xml/libxmlj/util/NamedInputStream.java b/gnu/xml/libxmlj/util/NamedInputStream.java
index 8d20ec4e5..01b3af90d 100644
--- a/gnu/xml/libxmlj/util/NamedInputStream.java
+++ b/gnu/xml/libxmlj/util/NamedInputStream.java
@@ -1,4 +1,4 @@
-/* NamedInputStream.java -
+/* NamedInputStream.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,7 +54,7 @@ extends FilterInputStream
{
private static int DETECT_BUFFER_SIZE = 50;
-
+
private String name;
NamedInputStream (String name, InputStream in, int size)
@@ -95,5 +95,5 @@ extends FilterInputStream
return ret;
}
}
-
+
}
diff --git a/gnu/xml/libxmlj/util/StandaloneDocumentType.java b/gnu/xml/libxmlj/util/StandaloneDocumentType.java
index d47cdb05d..5c3316611 100644
--- a/gnu/xml/libxmlj/util/StandaloneDocumentType.java
+++ b/gnu/xml/libxmlj/util/StandaloneDocumentType.java
@@ -1,4 +1,4 @@
-/* StandaloneDocumentType.java -
+/* StandaloneDocumentType.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -75,7 +75,7 @@ implements DocumentType
// TODO
return null;
}
-
+
public NamedNodeMap getNotations ()
{
// TODO
@@ -96,7 +96,7 @@ implements DocumentType
{
return null;
}
-
+
// -- Node --
public String getNodeName ()
@@ -109,7 +109,7 @@ implements DocumentType
{
return null;
}
-
+
public void setNodeValue (String nodeValue)
throws DOMException
{
@@ -254,12 +254,12 @@ implements DocumentType
{
return equals (other);
}
-
+
public String lookupPrefix (String namespace)
{
return null;
}
-
+
public boolean isDefaultNamespace (String namespace)
{
return false;
diff --git a/gnu/xml/libxmlj/util/StandaloneLocator.java b/gnu/xml/libxmlj/util/StandaloneLocator.java
index 5430330cc..75b40bdf1 100644
--- a/gnu/xml/libxmlj/util/StandaloneLocator.java
+++ b/gnu/xml/libxmlj/util/StandaloneLocator.java
@@ -1,4 +1,4 @@
-/* StandaloneLocator.java -
+/* StandaloneLocator.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,12 +65,12 @@ implements Locator, SourceLocator
this.publicId = publicId;
this.systemId = systemId;
}
-
+
public String getPublicId ()
{
return publicId;
}
-
+
public String getSystemId ()
{
return systemId;
diff --git a/gnu/xml/libxmlj/util/XMLJ.java b/gnu/xml/libxmlj/util/XMLJ.java
index 0d5f9f689..8d954d0be 100644
--- a/gnu/xml/libxmlj/util/XMLJ.java
+++ b/gnu/xml/libxmlj/util/XMLJ.java
@@ -1,4 +1,4 @@
-/* XMLJ.java -
+/* XMLJ.java -
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,35 +70,35 @@ public final class XMLJ
static class XMLJShutdownHook
implements Runnable
{
-
+
public void run ()
{
// Make sure finalizers are run
System.gc ();
Runtime.getRuntime ().runFinalization ();
-
+
// Perform global cleanup on the native level
GnomeTransformerFactory.freeLibxsltGlobal ();
}
-
+
}
private static boolean initialised = false;
-
+
public static void init ()
{
if (!initialised)
{
System.loadLibrary ("xmlj");
-
- XMLJShutdownHook hook = new XMLJShutdownHook ();
+
+ XMLJShutdownHook hook = new XMLJShutdownHook ();
Runtime.getRuntime ().addShutdownHook (new Thread (hook));
}
initialised = true;
}
private static final int LOOKAHEAD = 50;
-
+
/**
* Returns an input stream for the specified input source.
* This returns a pushback stream that libxmlj can use to detect the
@@ -276,5 +276,5 @@ public final class XMLJ
}
return uri;
}
-
+
}
diff --git a/gnu/xml/pipeline/CallFilter.java b/gnu/xml/pipeline/CallFilter.java
index 3b3375173..2398b8685 100644
--- a/gnu/xml/pipeline/CallFilter.java
+++ b/gnu/xml/pipeline/CallFilter.java
@@ -1,4 +1,4 @@
-/* CallFilter.java --
+/* CallFilter.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -99,11 +99,11 @@ import gnu.xml.util.XMLWriter;
*/
final public class CallFilter implements EventConsumer
{
- private Requestor req;
- private EventConsumer next;
- private URL target;
- private URLConnection conn;
- private ErrorHandler errHandler;
+ private Requestor req;
+ private EventConsumer next;
+ private URL target;
+ private URLConnection conn;
+ private ErrorHandler errHandler;
/**
@@ -113,13 +113,13 @@ final public class CallFilter implements EventConsumer
*
* @exception IOException if the URI isn't accepted as a URL
*/
- // constructor used by PipelineFactory
+ // constructor used by PipelineFactory
public CallFilter (String uri, EventConsumer next)
throws IOException
{
- this.next = next;
- req = new Requestor ();
- setCallTarget (uri);
+ this.next = next;
+ req = new Requestor ();
+ setCallTarget (uri);
}
/**
@@ -129,7 +129,7 @@ final public class CallFilter implements EventConsumer
final public void setCallTarget (String uri)
throws IOException
{
- target = new URL (uri);
+ target = new URL (uri);
}
/**
@@ -138,7 +138,7 @@ final public class CallFilter implements EventConsumer
*/
public void setErrorHandler (ErrorHandler handler)
{
- req.setErrorHandler (handler);
+ req.setErrorHandler (handler);
}
@@ -147,19 +147,19 @@ final public class CallFilter implements EventConsumer
*/
final public String getCallTarget ()
{
- return target.toString ();
+ return target.toString ();
}
/** Returns the content handler currently in use. */
final public org.xml.sax.ContentHandler getContentHandler ()
{
- return req;
+ return req;
}
/** Returns the DTD handler currently in use. */
final public DTDHandler getDTDHandler ()
{
- return req;
+ return req;
}
@@ -170,11 +170,11 @@ final public class CallFilter implements EventConsumer
final public Object getProperty (String id)
throws SAXNotRecognizedException
{
- if (EventFilter.DECL_HANDLER.equals (id))
- return req;
- if (EventFilter.LEXICAL_HANDLER.equals (id))
- return req;
- throw new SAXNotRecognizedException (id);
+ if (EventFilter.DECL_HANDLER.equals (id))
+ return req;
+ if (EventFilter.LEXICAL_HANDLER.equals (id))
+ return req;
+ throw new SAXNotRecognizedException (id);
}
@@ -187,71 +187,71 @@ final public class CallFilter implements EventConsumer
//
final class Requestor extends XMLWriter
{
- Requestor ()
- {
- super ((Writer)null);
- }
-
- public synchronized void startDocument () throws SAXException
- {
- // Connect to remote object and set up to send it XML text
- try {
- if (conn != null)
- throw new IllegalStateException ("call is being made");
-
- conn = target.openConnection ();
- conn.setDoOutput (true);
- conn.setRequestProperty ("Content-Type",
- "application/xml;charset=UTF-8");
-
- setWriter (new OutputStreamWriter (
- conn.getOutputStream (),
- "UTF8"), "UTF-8");
-
- } catch (IOException e) {
- fatal ("can't write (POST) to URI: " + target, e);
- }
-
- // NOW base class can safely write that text!
- super.startDocument ();
- }
-
- public void endDocument () throws SAXException
- {
- //
- // Finish writing the request (for HTTP, a POST);
- // this closes the output stream.
- //
- super.endDocument ();
-
- //
- // Receive the response.
- // Produce events for the next stage.
- //
- InputSource source;
- XMLReader producer;
- String encoding;
-
- try {
-
- source = new InputSource (conn.getInputStream ());
+ Requestor ()
+ {
+ super ((Writer)null);
+ }
+
+ public synchronized void startDocument () throws SAXException
+ {
+ // Connect to remote object and set up to send it XML text
+ try {
+ if (conn != null)
+ throw new IllegalStateException ("call is being made");
+
+ conn = target.openConnection ();
+ conn.setDoOutput (true);
+ conn.setRequestProperty ("Content-Type",
+ "application/xml;charset=UTF-8");
+
+ setWriter (new OutputStreamWriter (
+ conn.getOutputStream (),
+ "UTF8"), "UTF-8");
+
+ } catch (IOException e) {
+ fatal ("can't write (POST) to URI: " + target, e);
+ }
+
+ // NOW base class can safely write that text!
+ super.startDocument ();
+ }
+
+ public void endDocument () throws SAXException
+ {
+ //
+ // Finish writing the request (for HTTP, a POST);
+ // this closes the output stream.
+ //
+ super.endDocument ();
+
+ //
+ // Receive the response.
+ // Produce events for the next stage.
+ //
+ InputSource source;
+ XMLReader producer;
+ String encoding;
+
+ try {
+
+ source = new InputSource (conn.getInputStream ());
// FIXME if status is anything but success, report it!! It'd be good to
// save the request data just in case we need to deal with a forward.
- encoding = Resolver.getEncoding (conn.getContentType ());
- if (encoding != null)
- source.setEncoding (encoding);
+ encoding = Resolver.getEncoding (conn.getContentType ());
+ if (encoding != null)
+ source.setEncoding (encoding);
- producer = XMLReaderFactory.createXMLReader ();
- producer.setErrorHandler (getErrorHandler ());
- EventFilter.bind (producer, next);
- producer.parse (source);
- conn = null;
+ producer = XMLReaderFactory.createXMLReader ();
+ producer.setErrorHandler (getErrorHandler ());
+ EventFilter.bind (producer, next);
+ producer.parse (source);
+ conn = null;
- } catch (IOException e) {
- fatal ("I/O Exception reading response, " + e.getMessage (), e);
- }
- }
+ } catch (IOException e) {
+ fatal ("I/O Exception reading response, " + e.getMessage (), e);
+ }
+ }
}
}
diff --git a/gnu/xml/pipeline/DomConsumer.java b/gnu/xml/pipeline/DomConsumer.java
index 53f7f24a2..141f36eca 100644
--- a/gnu/xml/pipeline/DomConsumer.java
+++ b/gnu/xml/pipeline/DomConsumer.java
@@ -1,4 +1,4 @@
-/* DomConsumer.java --
+/* DomConsumer.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -105,17 +105,17 @@ import org.w3c.dom.Text;
*/
public class DomConsumer implements EventConsumer
{
- private Class domImpl;
+ private Class domImpl;
- private boolean hidingCDATA = true;
- private boolean hidingComments = true;
- private boolean hidingWhitespace = true;
- private boolean hidingReferences = true;
+ private boolean hidingCDATA = true;
+ private boolean hidingComments = true;
+ private boolean hidingWhitespace = true;
+ private boolean hidingReferences = true;
- private Handler handler;
- private ErrorHandler errHandler;
+ private Handler handler;
+ private ErrorHandler errHandler;
- private EventConsumer next;
+ private EventConsumer next;
// FIXME: this can't be a generic pipeline stage just now,
// since its input became a Class not a String (to be turned
@@ -127,16 +127,16 @@ public class DomConsumer implements EventConsumer
* of DOM when constructing its result value.
*
* @param impl class implementing {@link org.w3c.dom.Document Document}
- * which publicly exposes a default constructor
+ * which publicly exposes a default constructor
*
* @exception SAXException when there is a problem creating an
- * empty DOM document using the specified implementation
+ * empty DOM document using the specified implementation
*/
public DomConsumer (Class impl)
throws SAXException
{
- domImpl = impl;
- handler = new Handler (this);
+ domImpl = impl;
+ handler = new Handler (this);
}
/**
@@ -148,22 +148,22 @@ public class DomConsumer implements EventConsumer
*/
protected void setHandler (Handler h)
{
- handler = h;
+ handler = h;
}
private Document emptyDocument ()
throws SAXException
{
- try {
- return (Document) domImpl.newInstance ();
- } catch (IllegalAccessException e) {
- throw new SAXException ("can't access constructor: "
- + e.getMessage ());
- } catch (InstantiationException e) {
- throw new SAXException ("can't instantiate Document: "
- + e.getMessage ());
- }
+ try {
+ return (Document) domImpl.newInstance ();
+ } catch (IllegalAccessException e) {
+ throw new SAXException ("can't access constructor: "
+ + e.getMessage ());
+ } catch (InstantiationException e) {
+ throw new SAXException ("can't instantiate Document: "
+ + e.getMessage ());
+ }
}
@@ -178,18 +178,18 @@ public class DomConsumer implements EventConsumer
* copy of the input event stream, use a {@link TeeConsumer}.
*
* @param impl class implementing {@link org.w3c.dom.Document Document}
- * which publicly exposes a default constructor
+ * which publicly exposes a default constructor
* @param next receives a "replayed" sequence of parse events when
- * the <em>endDocument</em> method is invoked.
+ * the <em>endDocument</em> method is invoked.
*
* @exception SAXException when there is a problem creating an
- * empty DOM document using the specified DOM implementation
+ * empty DOM document using the specified DOM implementation
*/
public DomConsumer (Class impl, EventConsumer n)
throws SAXException
{
- this (impl);
- next = n;
+ this (impl);
+ next = n;
}
@@ -197,16 +197,16 @@ public class DomConsumer implements EventConsumer
* Returns the document constructed from the preceding
* sequence of events. This method should not be
* used again until another sequence of events has been
- * given to this EventConsumer.
+ * given to this EventConsumer.
*/
final public Document getDocument ()
{
- return handler.clearDocument ();
+ return handler.clearDocument ();
}
public void setErrorHandler (ErrorHandler handler)
{
- errHandler = handler;
+ errHandler = handler;
}
@@ -219,8 +219,8 @@ public class DomConsumer implements EventConsumer
*
* @see #setHidingReferences
*/
- final public boolean isHidingReferences ()
- { return hidingReferences; }
+ final public boolean isHidingReferences ()
+ { return hidingReferences; }
/**
* Controls whether the consumer will hide entity expansions,
@@ -229,9 +229,9 @@ public class DomConsumer implements EventConsumer
* @see #isHidingReferences
* @param flag False if entity reference nodes will appear
*/
- final public void setHidingReferences (boolean flag)
- { hidingReferences = flag; }
-
+ final public void setHidingReferences (boolean flag)
+ { hidingReferences = flag; }
+
/**
* Returns true if the consumer is hiding comments (the default),
@@ -240,7 +240,7 @@ public class DomConsumer implements EventConsumer
* @see #setHidingComments
*/
public final boolean isHidingComments ()
- { return hidingComments; }
+ { return hidingComments; }
/**
* Controls whether the consumer is hiding comments.
@@ -248,7 +248,7 @@ public class DomConsumer implements EventConsumer
* @see #isHidingComments
*/
public final void setHidingComments (boolean flag)
- { hidingComments = flag; }
+ { hidingComments = flag; }
/**
@@ -259,7 +259,7 @@ public class DomConsumer implements EventConsumer
* @see #setHidingWhitespace
*/
public final boolean isHidingWhitespace ()
- { return hidingWhitespace; }
+ { return hidingWhitespace; }
/**
* Controls whether the consumer hides ignorable whitespace
@@ -267,7 +267,7 @@ public class DomConsumer implements EventConsumer
* @see #isHidingComments
*/
public final void setHidingWhitespace (boolean flag)
- { hidingWhitespace = flag; }
+ { hidingWhitespace = flag; }
/**
@@ -276,28 +276,28 @@ public class DomConsumer implements EventConsumer
*
* @see #setHidingCDATA
*/
- final public boolean isHidingCDATA ()
- { return hidingCDATA; }
+ final public boolean isHidingCDATA ()
+ { return hidingCDATA; }
/**
* Controls whether the consumer will save CDATA boundaries.
*
* @see #isHidingCDATA
* @param flag True to treat CDATA text differently from other
- * text nodes
+ * text nodes
*/
- final public void setHidingCDATA (boolean flag)
- { hidingCDATA = flag; }
-
+ final public void setHidingCDATA (boolean flag)
+ { hidingCDATA = flag; }
+
/** Returns the document handler being used. */
final public ContentHandler getContentHandler ()
- { return handler; }
+ { return handler; }
/** Returns the DTD handler being used. */
final public DTDHandler getDTDHandler ()
- { return handler; }
+ { return handler; }
/**
* Returns the lexical handler being used.
@@ -306,11 +306,11 @@ public class DomConsumer implements EventConsumer
final public Object getProperty (String id)
throws SAXNotRecognizedException
{
- if ("http://xml.org/sax/properties/lexical-handler".equals (id))
- return handler;
- if ("http://xml.org/sax/properties/declaration-handler".equals (id))
- return handler;
- throw new SAXNotRecognizedException (id);
+ if ("http://xml.org/sax/properties/lexical-handler".equals (id))
+ return handler;
+ if ("http://xml.org/sax/properties/declaration-handler".equals (id))
+ return handler;
+ throw new SAXNotRecognizedException (id);
}
EventConsumer getNext () { return next; }
@@ -320,7 +320,7 @@ public class DomConsumer implements EventConsumer
/**
* Class used to intercept various parsing events and use them to
* populate a DOM document. Subclasses would typically know and use
- * backdoors into specific DOM implementations, used to implement
+ * backdoors into specific DOM implementations, used to implement
* DTD-related functionality.
*
* <p> Note that if this ever throws a DOMException (runtime exception)
@@ -329,639 +329,639 @@ public class DomConsumer implements EventConsumer
* accepted illegal input data). </p>
*/
public static class Handler
- implements ContentHandler, LexicalHandler,
- DTDHandler, DeclHandler
+ implements ContentHandler, LexicalHandler,
+ DTDHandler, DeclHandler
{
- protected DomConsumer consumer;
-
- private DOMImplementation impl;
- private Document document;
- private boolean isL2;
-
- private Locator locator;
- private Node top;
- private boolean inCDATA;
- private boolean mergeCDATA;
- private boolean inDTD;
- private String currentEntity;
-
- private boolean recreatedAttrs;
- private AttributesImpl attributes = new AttributesImpl ();
-
- /**
- * Subclasses may use SAX2 events to provide additional
- * behaviors in the resulting DOM.
- */
- protected Handler (DomConsumer consumer)
- throws SAXException
- {
- this.consumer = consumer;
- document = consumer.emptyDocument ();
- impl = document.getImplementation ();
- isL2 = impl.hasFeature ("XML", "2.0");
- }
-
- private void fatal (String message, Exception x)
- throws SAXException
- {
- SAXParseException e;
- ErrorHandler errHandler = consumer.getErrorHandler ();
-
- if (locator == null)
- e = new SAXParseException (message, null, null, -1, -1, x);
- else
- e = new SAXParseException (message, locator, x);
- if (errHandler != null)
- errHandler.fatalError (e);
- throw e;
- }
-
- /**
- * Returns and forgets the document produced. If the handler is
- * reused, a new document may be created.
- */
- Document clearDocument ()
- {
- Document retval = document;
- document = null;
- locator = null;
- return retval;
- }
-
- /**
- * Returns the document under construction.
- */
- protected Document getDocument ()
- { return document; }
-
- /**
- * Returns the current node being populated. This is usually
- * an Element or Document, but it might be an EntityReference
- * node if some implementation-specific code knows how to put
- * those into the result tree and later mark them as readonly.
- */
- protected Node getTop ()
- { return top; }
-
-
- // SAX1
- public void setDocumentLocator (Locator locator)
- {
- this.locator = locator;
- }
-
- // SAX1
- public void startDocument ()
- throws SAXException
- {
- if (document == null)
- try {
- if (isL2) {
- // couple to original implementation
- document = impl.createDocument (null, "foo", null);
- document.removeChild (document.getFirstChild ());
- } else {
- document = consumer.emptyDocument ();
- }
- } catch (Exception e) {
- fatal ("DOM create document", e);
- }
- top = document;
- }
-
- // SAX1
- public void endDocument ()
- throws SAXException
- {
- try {
- if (consumer.getNext () != null && document != null) {
- DomParser parser = new DomParser (document);
-
- EventFilter.bind (parser, consumer.getNext ());
- parser.parse ("ignored");
- }
- } finally {
- top = null;
- }
- }
-
- // SAX1
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- // we can't create populated entity ref nodes using
- // only public DOM APIs (they've got to be readonly)
- if (currentEntity != null)
- return;
-
- ProcessingInstruction pi;
-
- if (isL2
- // && consumer.isUsingNamespaces ()
- && target.indexOf (':') != -1)
- namespaceError (
- "PI target name is namespace nonconformant: "
- + target);
- if (inDTD)
- return;
- pi = document.createProcessingInstruction (target, data);
- top.appendChild (pi);
- }
-
- /**
- * Subclasses may overrride this method to provide a more efficient
- * way to construct text nodes.
- * Typically, copying the text into a single character array will
- * be more efficient than doing that as well as allocating other
- * needed for a String, including an internal StringBuffer.
- * Those additional memory and CPU costs can be incurred later,
- * if ever needed.
- * Unfortunately the standard DOM factory APIs encourage those costs
- * to be incurred early.
- */
- protected Text createText (
- boolean isCDATA,
- char ch [],
- int start,
- int length
- ) {
- String value = new String (ch, start, length);
-
- if (isCDATA)
- return document.createCDATASection (value);
- else
- return document.createTextNode (value);
- }
-
- // SAX1
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- // we can't create populated entity ref nodes using
- // only public DOM APIs (they've got to be readonly
- // at creation time)
- if (currentEntity != null)
- return;
-
- Node lastChild = top.getLastChild ();
-
- // merge consecutive text or CDATA nodes if appropriate.
- if (lastChild instanceof Text) {
- if (consumer.isHidingCDATA ()
- // consecutive Text content ... always merge
- || (!inCDATA
- && !(lastChild instanceof CDATASection))
- // consecutive CDATASection content ... don't
- // merge between sections, only within them
- || (inCDATA && mergeCDATA
- && lastChild instanceof CDATASection)
- ) {
- CharacterData last = (CharacterData) lastChild;
- String value = new String (ch, start, length);
-
- last.appendData (value);
- return;
- }
- }
- if (inCDATA && !consumer.isHidingCDATA ()) {
- top.appendChild (createText (true, ch, start, length));
- mergeCDATA = true;
- } else
- top.appendChild (createText (false, ch, start, length));
- }
-
- // SAX2
- public void skippedEntity (String name)
- throws SAXException
- {
- // this callback is useless except to report errors, since
- // we can't know if the ref was in content, within an
- // attribute, within a declaration ... only one of those
- // cases supports more intelligent action than a panic.
- fatal ("skipped entity: " + name, null);
- }
-
- // SAX2
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- // reconstruct "xmlns" attributes deleted by all
- // SAX2 parsers without "namespace-prefixes" = true
- if ("".equals (prefix))
- attributes.addAttribute ("", "", "xmlns",
- "CDATA", uri);
- else
- attributes.addAttribute ("", "", "xmlns:" + prefix,
- "CDATA", uri);
- recreatedAttrs = true;
- }
-
- // SAX2
- public void endPrefixMapping (String prefix)
- throws SAXException
- { }
-
- // SAX2
- public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- // we can't create populated entity ref nodes using
- // only public DOM APIs (they've got to be readonly)
- if (currentEntity != null)
- return;
-
- // parser discarded basic information; DOM tree isn't writable
- // without massaging to assign prefixes to all nodes.
- // the "NSFilter" class does that massaging.
- if (qName.length () == 0)
- qName = localName;
-
-
- Element element;
- int length = atts.getLength ();
-
- if (!isL2) {
- element = document.createElement (qName);
-
- // first the explicit attributes ...
- length = atts.getLength ();
- for (int i = 0; i < length; i++)
- element.setAttribute (atts.getQName (i),
- atts.getValue (i));
- // ... then any recreated ones (DOM deletes duplicates)
- if (recreatedAttrs) {
- recreatedAttrs = false;
- length = attributes.getLength ();
- for (int i = 0; i < length; i++)
- element.setAttribute (attributes.getQName (i),
- attributes.getValue (i));
- attributes.clear ();
- }
-
- top.appendChild (element);
- top = element;
- return;
- }
-
- // For an L2 DOM when namespace use is enabled, use
- // createElementNS/createAttributeNS except when
- // (a) it's an element in the default namespace, or
- // (b) it's an attribute with no prefix
- String namespace;
-
- if (localName.length () != 0)
- namespace = (uri.length () == 0) ? null : uri;
- else
- namespace = getNamespace (getPrefix (qName), atts);
-
- if (namespace == null)
- element = document.createElement (qName);
- else
- element = document.createElementNS (namespace, qName);
-
- populateAttributes (element, atts);
- if (recreatedAttrs) {
- recreatedAttrs = false;
- // ... DOM deletes any duplicates
- populateAttributes (element, attributes);
- attributes.clear ();
- }
-
- top.appendChild (element);
- top = element;
- }
-
- final static String xmlnsURI = "http://www.w3.org/2000/xmlns/";
-
- private void populateAttributes (Element element, Attributes attrs)
- throws SAXParseException
- {
- int length = attrs.getLength ();
-
- for (int i = 0; i < length; i++) {
- String type = attrs.getType (i);
- String value = attrs.getValue (i);
- String name = attrs.getQName (i);
- String local = attrs.getLocalName (i);
- String uri = attrs.getURI (i);
-
- // parser discarded basic information, DOM tree isn't writable
- if (name.length () == 0)
- name = local;
-
- // all attribute types other than these three may not
- // contain scoped names... enumerated attributes get
- // reported as NMTOKEN, except for NOTATION values
- if (!("CDATA".equals (type)
- || "NMTOKEN".equals (type)
- || "NMTOKENS".equals (type))) {
- if (value.indexOf (':') != -1) {
- namespaceError (
- "namespace nonconformant attribute value: "
- + "<" + element.getNodeName ()
- + " " + name + "='" + value + "' ...>");
- }
- }
-
- // xmlns="" is legal (undoes default NS)
- // xmlns:foo="" is illegal
- String prefix = getPrefix (name);
- String namespace;
-
- if ("xmlns".equals (prefix)) {
- if ("".equals (value))
- namespaceError ("illegal null namespace decl, " + name);
- namespace = xmlnsURI;
- } else if ("xmlns".equals (name))
- namespace = xmlnsURI;
-
- else if (prefix == null)
- namespace = null;
- else if (!"".equals(uri) && uri.length () != 0)
- namespace = uri;
- else
- namespace = getNamespace (prefix, attrs);
-
- if (namespace == null)
- element.setAttribute (name, value);
- else
- element.setAttributeNS (namespace, name, value);
- }
- }
-
- private String getPrefix (String name)
- {
- int temp;
-
- if ((temp = name.indexOf (':')) > 0)
- return name.substring (0, temp);
- return null;
- }
-
- // used with SAX1-level parser output
- private String getNamespace (String prefix, Attributes attrs)
- throws SAXParseException
- {
- String namespace;
- String decl;
-
- // defaulting
- if (prefix == null) {
- decl = "xmlns";
- namespace = attrs.getValue (decl);
- if ("".equals (namespace))
- return null;
- else if (namespace != null)
- return namespace;
-
- // "xmlns" is like a keyword
- // ... according to the Namespace REC, but DOM L2 CR2+
- // and Infoset violate that by assigning a namespace.
- // that conflict is resolved elsewhere.
- } else if ("xmlns".equals (prefix))
- return null;
-
- // "xml" prefix is fixed
- else if ("xml".equals (prefix))
- return "http://www.w3.org/XML/1998/namespace";
-
- // otherwise, expect a declaration
- else {
- decl = "xmlns:" + prefix;
- namespace = attrs.getValue (decl);
- }
-
- // if we found a local declaration, great
- if (namespace != null)
- return namespace;
-
-
- // ELSE ... search up the tree we've been building
- for (Node n = top;
- n != null && n.getNodeType () != Node.DOCUMENT_NODE;
- n = n.getParentNode ()) {
- if (n.getNodeType () == Node.ENTITY_REFERENCE_NODE)
- continue;
- Element e = (Element) n;
- Attr attr = e.getAttributeNode (decl);
- if (attr != null)
- return attr.getNodeValue ();
- }
- // see above re "xmlns" as keyword
- if ("xmlns".equals (decl))
- return null;
-
- namespaceError ("Undeclared namespace prefix: " + prefix);
- return null;
- }
-
- // SAX2
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- // we can't create populated entity ref nodes using
- // only public DOM APIs (they've got to be readonly)
- if (currentEntity != null)
- return;
-
- top = top.getParentNode ();
- }
-
- // SAX1 (mandatory reporting if validating)
- public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- if (consumer.isHidingWhitespace ())
- return;
- characters (ch, start, length);
- }
-
- // SAX2 lexical event
- public void startCDATA ()
- throws SAXException
- {
- inCDATA = true;
- // true except for the first fragment of a cdata section
- mergeCDATA = false;
- }
-
- // SAX2 lexical event
- public void endCDATA ()
- throws SAXException
- {
- inCDATA = false;
- }
-
- // SAX2 lexical event
- //
- // this SAX2 callback merges two unrelated things:
- // - Declaration of the root element type ... belongs with
- // the other DTD declaration methods, NOT HERE.
- // - IDs for the optional external subset ... belongs here
- // with other lexical information.
- //
- // ...and it doesn't include the internal DTD subset, desired
- // both to support DOM L2 and to enable "pass through" processing
- //
- public void startDTD (String name, String publicId, String SystemId)
- throws SAXException
- {
- // need to filter out comments and PIs within the DTD
- inDTD = true;
- }
-
- // SAX2 lexical event
- public void endDTD ()
- throws SAXException
- {
- inDTD = false;
- }
-
- // SAX2 lexical event
- public void comment (char ch [], int start, int length)
- throws SAXException
- {
- Node comment;
-
- // we can't create populated entity ref nodes using
- // only public DOM APIs (they've got to be readonly)
- if (consumer.isHidingComments ()
- || inDTD
- || currentEntity != null)
- return;
- comment = document.createComment (new String (ch, start, length));
- top.appendChild (comment);
- }
-
- /**
- * May be overridden by subclasses to return true, indicating
- * that entity reference nodes can be populated and then made
- * read-only.
- */
- public boolean canPopulateEntityRefs ()
- { return false; }
-
- // SAX2 lexical event
- public void startEntity (String name)
- throws SAXException
- {
- // are we ignoring what would be contents of an
- // entity ref, since we can't populate it?
- if (currentEntity != null)
- return;
-
- // Are we hiding all entity boundaries?
- if (consumer.isHidingReferences ())
- return;
-
- // SAX2 shows parameter entities; DOM hides them
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return;
-
- // Since we can't create a populated entity ref node in any
- // standard way, we create an unpopulated one.
- EntityReference ref = document.createEntityReference (name);
- top.appendChild (ref);
- top = ref;
-
- // ... allowing subclasses to populate them
- if (!canPopulateEntityRefs ())
- currentEntity = name;
- }
-
- // SAX2 lexical event
- public void endEntity (String name)
- throws SAXException
- {
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return;
- if (name.equals (currentEntity))
- currentEntity = null;
- if (!consumer.isHidingReferences ())
- top = top.getParentNode ();
- }
-
-
- // SAX1 DTD event
- public void notationDecl (
- String name,
- String publicId, String SystemId
- ) throws SAXException
- {
- /* IGNORE -- no public DOM API lets us store these
- * into the doctype node
- */
- }
-
- // SAX1 DTD event
- public void unparsedEntityDecl (
- String name,
- String publicId, String SystemId,
- String notationName
- ) throws SAXException
- {
- /* IGNORE -- no public DOM API lets us store these
- * into the doctype node
- */
- }
-
- // SAX2 declaration event
- public void elementDecl (String name, String model)
- throws SAXException
- {
- /* IGNORE -- no content model support in DOM L2 */
- }
-
- // SAX2 declaration event
- public void attributeDecl (
- String eName,
- String aName,
- String type,
- String mode,
- String value
- ) throws SAXException
- {
- /* IGNORE -- no attribute model support in DOM L2 */
- }
-
- // SAX2 declaration event
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- /* IGNORE -- no public DOM API lets us store these
- * into the doctype node
- */
- }
-
- // SAX2 declaration event
- public void externalEntityDecl (
- String name,
- String publicId,
- String SystemId
- ) throws SAXException
- {
- /* IGNORE -- no public DOM API lets us store these
- * into the doctype node
- */
- }
-
- //
- // These really should offer the option of nonfatal handling,
- // like other validity errors, though that would cause major
- // chaos in the DOM data structures. DOM is already spec'd
- // to treat many of these as fatal, so this is consistent.
- //
- private void namespaceError (String description)
- throws SAXParseException
- {
- SAXParseException err;
-
- err = new SAXParseException (description, locator);
- throw err;
- }
+ protected DomConsumer consumer;
+
+ private DOMImplementation impl;
+ private Document document;
+ private boolean isL2;
+
+ private Locator locator;
+ private Node top;
+ private boolean inCDATA;
+ private boolean mergeCDATA;
+ private boolean inDTD;
+ private String currentEntity;
+
+ private boolean recreatedAttrs;
+ private AttributesImpl attributes = new AttributesImpl ();
+
+ /**
+ * Subclasses may use SAX2 events to provide additional
+ * behaviors in the resulting DOM.
+ */
+ protected Handler (DomConsumer consumer)
+ throws SAXException
+ {
+ this.consumer = consumer;
+ document = consumer.emptyDocument ();
+ impl = document.getImplementation ();
+ isL2 = impl.hasFeature ("XML", "2.0");
+ }
+
+ private void fatal (String message, Exception x)
+ throws SAXException
+ {
+ SAXParseException e;
+ ErrorHandler errHandler = consumer.getErrorHandler ();
+
+ if (locator == null)
+ e = new SAXParseException (message, null, null, -1, -1, x);
+ else
+ e = new SAXParseException (message, locator, x);
+ if (errHandler != null)
+ errHandler.fatalError (e);
+ throw e;
+ }
+
+ /**
+ * Returns and forgets the document produced. If the handler is
+ * reused, a new document may be created.
+ */
+ Document clearDocument ()
+ {
+ Document retval = document;
+ document = null;
+ locator = null;
+ return retval;
+ }
+
+ /**
+ * Returns the document under construction.
+ */
+ protected Document getDocument ()
+ { return document; }
+
+ /**
+ * Returns the current node being populated. This is usually
+ * an Element or Document, but it might be an EntityReference
+ * node if some implementation-specific code knows how to put
+ * those into the result tree and later mark them as readonly.
+ */
+ protected Node getTop ()
+ { return top; }
+
+
+ // SAX1
+ public void setDocumentLocator (Locator locator)
+ {
+ this.locator = locator;
+ }
+
+ // SAX1
+ public void startDocument ()
+ throws SAXException
+ {
+ if (document == null)
+ try {
+ if (isL2) {
+ // couple to original implementation
+ document = impl.createDocument (null, "foo", null);
+ document.removeChild (document.getFirstChild ());
+ } else {
+ document = consumer.emptyDocument ();
+ }
+ } catch (Exception e) {
+ fatal ("DOM create document", e);
+ }
+ top = document;
+ }
+
+ // SAX1
+ public void endDocument ()
+ throws SAXException
+ {
+ try {
+ if (consumer.getNext () != null && document != null) {
+ DomParser parser = new DomParser (document);
+
+ EventFilter.bind (parser, consumer.getNext ());
+ parser.parse ("ignored");
+ }
+ } finally {
+ top = null;
+ }
+ }
+
+ // SAX1
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ // we can't create populated entity ref nodes using
+ // only public DOM APIs (they've got to be readonly)
+ if (currentEntity != null)
+ return;
+
+ ProcessingInstruction pi;
+
+ if (isL2
+ // && consumer.isUsingNamespaces ()
+ && target.indexOf (':') != -1)
+ namespaceError (
+ "PI target name is namespace nonconformant: "
+ + target);
+ if (inDTD)
+ return;
+ pi = document.createProcessingInstruction (target, data);
+ top.appendChild (pi);
+ }
+
+ /**
+ * Subclasses may overrride this method to provide a more efficient
+ * way to construct text nodes.
+ * Typically, copying the text into a single character array will
+ * be more efficient than doing that as well as allocating other
+ * needed for a String, including an internal StringBuffer.
+ * Those additional memory and CPU costs can be incurred later,
+ * if ever needed.
+ * Unfortunately the standard DOM factory APIs encourage those costs
+ * to be incurred early.
+ */
+ protected Text createText (
+ boolean isCDATA,
+ char ch [],
+ int start,
+ int length
+ ) {
+ String value = new String (ch, start, length);
+
+ if (isCDATA)
+ return document.createCDATASection (value);
+ else
+ return document.createTextNode (value);
+ }
+
+ // SAX1
+ public void characters (char ch [], int start, int length)
+ throws SAXException
+ {
+ // we can't create populated entity ref nodes using
+ // only public DOM APIs (they've got to be readonly
+ // at creation time)
+ if (currentEntity != null)
+ return;
+
+ Node lastChild = top.getLastChild ();
+
+ // merge consecutive text or CDATA nodes if appropriate.
+ if (lastChild instanceof Text) {
+ if (consumer.isHidingCDATA ()
+ // consecutive Text content ... always merge
+ || (!inCDATA
+ && !(lastChild instanceof CDATASection))
+ // consecutive CDATASection content ... don't
+ // merge between sections, only within them
+ || (inCDATA && mergeCDATA
+ && lastChild instanceof CDATASection)
+ ) {
+ CharacterData last = (CharacterData) lastChild;
+ String value = new String (ch, start, length);
+
+ last.appendData (value);
+ return;
+ }
+ }
+ if (inCDATA && !consumer.isHidingCDATA ()) {
+ top.appendChild (createText (true, ch, start, length));
+ mergeCDATA = true;
+ } else
+ top.appendChild (createText (false, ch, start, length));
+ }
+
+ // SAX2
+ public void skippedEntity (String name)
+ throws SAXException
+ {
+ // this callback is useless except to report errors, since
+ // we can't know if the ref was in content, within an
+ // attribute, within a declaration ... only one of those
+ // cases supports more intelligent action than a panic.
+ fatal ("skipped entity: " + name, null);
+ }
+
+ // SAX2
+ public void startPrefixMapping (String prefix, String uri)
+ throws SAXException
+ {
+ // reconstruct "xmlns" attributes deleted by all
+ // SAX2 parsers without "namespace-prefixes" = true
+ if ("".equals (prefix))
+ attributes.addAttribute ("", "", "xmlns",
+ "CDATA", uri);
+ else
+ attributes.addAttribute ("", "", "xmlns:" + prefix,
+ "CDATA", uri);
+ recreatedAttrs = true;
+ }
+
+ // SAX2
+ public void endPrefixMapping (String prefix)
+ throws SAXException
+ { }
+
+ // SAX2
+ public void startElement (
+ String uri,
+ String localName,
+ String qName,
+ Attributes atts
+ ) throws SAXException
+ {
+ // we can't create populated entity ref nodes using
+ // only public DOM APIs (they've got to be readonly)
+ if (currentEntity != null)
+ return;
+
+ // parser discarded basic information; DOM tree isn't writable
+ // without massaging to assign prefixes to all nodes.
+ // the "NSFilter" class does that massaging.
+ if (qName.length () == 0)
+ qName = localName;
+
+
+ Element element;
+ int length = atts.getLength ();
+
+ if (!isL2) {
+ element = document.createElement (qName);
+
+ // first the explicit attributes ...
+ length = atts.getLength ();
+ for (int i = 0; i < length; i++)
+ element.setAttribute (atts.getQName (i),
+ atts.getValue (i));
+ // ... then any recreated ones (DOM deletes duplicates)
+ if (recreatedAttrs) {
+ recreatedAttrs = false;
+ length = attributes.getLength ();
+ for (int i = 0; i < length; i++)
+ element.setAttribute (attributes.getQName (i),
+ attributes.getValue (i));
+ attributes.clear ();
+ }
+
+ top.appendChild (element);
+ top = element;
+ return;
+ }
+
+ // For an L2 DOM when namespace use is enabled, use
+ // createElementNS/createAttributeNS except when
+ // (a) it's an element in the default namespace, or
+ // (b) it's an attribute with no prefix
+ String namespace;
+
+ if (localName.length () != 0)
+ namespace = (uri.length () == 0) ? null : uri;
+ else
+ namespace = getNamespace (getPrefix (qName), atts);
+
+ if (namespace == null)
+ element = document.createElement (qName);
+ else
+ element = document.createElementNS (namespace, qName);
+
+ populateAttributes (element, atts);
+ if (recreatedAttrs) {
+ recreatedAttrs = false;
+ // ... DOM deletes any duplicates
+ populateAttributes (element, attributes);
+ attributes.clear ();
+ }
+
+ top.appendChild (element);
+ top = element;
+ }
+
+ final static String xmlnsURI = "http://www.w3.org/2000/xmlns/";
+
+ private void populateAttributes (Element element, Attributes attrs)
+ throws SAXParseException
+ {
+ int length = attrs.getLength ();
+
+ for (int i = 0; i < length; i++) {
+ String type = attrs.getType (i);
+ String value = attrs.getValue (i);
+ String name = attrs.getQName (i);
+ String local = attrs.getLocalName (i);
+ String uri = attrs.getURI (i);
+
+ // parser discarded basic information, DOM tree isn't writable
+ if (name.length () == 0)
+ name = local;
+
+ // all attribute types other than these three may not
+ // contain scoped names... enumerated attributes get
+ // reported as NMTOKEN, except for NOTATION values
+ if (!("CDATA".equals (type)
+ || "NMTOKEN".equals (type)
+ || "NMTOKENS".equals (type))) {
+ if (value.indexOf (':') != -1) {
+ namespaceError (
+ "namespace nonconformant attribute value: "
+ + "<" + element.getNodeName ()
+ + " " + name + "='" + value + "' ...>");
+ }
+ }
+
+ // xmlns="" is legal (undoes default NS)
+ // xmlns:foo="" is illegal
+ String prefix = getPrefix (name);
+ String namespace;
+
+ if ("xmlns".equals (prefix)) {
+ if ("".equals (value))
+ namespaceError ("illegal null namespace decl, " + name);
+ namespace = xmlnsURI;
+ } else if ("xmlns".equals (name))
+ namespace = xmlnsURI;
+
+ else if (prefix == null)
+ namespace = null;
+ else if (!"".equals(uri) && uri.length () != 0)
+ namespace = uri;
+ else
+ namespace = getNamespace (prefix, attrs);
+
+ if (namespace == null)
+ element.setAttribute (name, value);
+ else
+ element.setAttributeNS (namespace, name, value);
+ }
+ }
+
+ private String getPrefix (String name)
+ {
+ int temp;
+
+ if ((temp = name.indexOf (':')) > 0)
+ return name.substring (0, temp);
+ return null;
+ }
+
+ // used with SAX1-level parser output
+ private String getNamespace (String prefix, Attributes attrs)
+ throws SAXParseException
+ {
+ String namespace;
+ String decl;
+
+ // defaulting
+ if (prefix == null) {
+ decl = "xmlns";
+ namespace = attrs.getValue (decl);
+ if ("".equals (namespace))
+ return null;
+ else if (namespace != null)
+ return namespace;
+
+ // "xmlns" is like a keyword
+ // ... according to the Namespace REC, but DOM L2 CR2+
+ // and Infoset violate that by assigning a namespace.
+ // that conflict is resolved elsewhere.
+ } else if ("xmlns".equals (prefix))
+ return null;
+
+ // "xml" prefix is fixed
+ else if ("xml".equals (prefix))
+ return "http://www.w3.org/XML/1998/namespace";
+
+ // otherwise, expect a declaration
+ else {
+ decl = "xmlns:" + prefix;
+ namespace = attrs.getValue (decl);
+ }
+
+ // if we found a local declaration, great
+ if (namespace != null)
+ return namespace;
+
+
+ // ELSE ... search up the tree we've been building
+ for (Node n = top;
+ n != null && n.getNodeType () != Node.DOCUMENT_NODE;
+ n = n.getParentNode ()) {
+ if (n.getNodeType () == Node.ENTITY_REFERENCE_NODE)
+ continue;
+ Element e = (Element) n;
+ Attr attr = e.getAttributeNode (decl);
+ if (attr != null)
+ return attr.getNodeValue ();
+ }
+ // see above re "xmlns" as keyword
+ if ("xmlns".equals (decl))
+ return null;
+
+ namespaceError ("Undeclared namespace prefix: " + prefix);
+ return null;
+ }
+
+ // SAX2
+ public void endElement (String uri, String localName, String qName)
+ throws SAXException
+ {
+ // we can't create populated entity ref nodes using
+ // only public DOM APIs (they've got to be readonly)
+ if (currentEntity != null)
+ return;
+
+ top = top.getParentNode ();
+ }
+
+ // SAX1 (mandatory reporting if validating)
+ public void ignorableWhitespace (char ch [], int start, int length)
+ throws SAXException
+ {
+ if (consumer.isHidingWhitespace ())
+ return;
+ characters (ch, start, length);
+ }
+
+ // SAX2 lexical event
+ public void startCDATA ()
+ throws SAXException
+ {
+ inCDATA = true;
+ // true except for the first fragment of a cdata section
+ mergeCDATA = false;
+ }
+
+ // SAX2 lexical event
+ public void endCDATA ()
+ throws SAXException
+ {
+ inCDATA = false;
+ }
+
+ // SAX2 lexical event
+ //
+ // this SAX2 callback merges two unrelated things:
+ // - Declaration of the root element type ... belongs with
+ // the other DTD declaration methods, NOT HERE.
+ // - IDs for the optional external subset ... belongs here
+ // with other lexical information.
+ //
+ // ...and it doesn't include the internal DTD subset, desired
+ // both to support DOM L2 and to enable "pass through" processing
+ //
+ public void startDTD (String name, String publicId, String SystemId)
+ throws SAXException
+ {
+ // need to filter out comments and PIs within the DTD
+ inDTD = true;
+ }
+
+ // SAX2 lexical event
+ public void endDTD ()
+ throws SAXException
+ {
+ inDTD = false;
+ }
+
+ // SAX2 lexical event
+ public void comment (char ch [], int start, int length)
+ throws SAXException
+ {
+ Node comment;
+
+ // we can't create populated entity ref nodes using
+ // only public DOM APIs (they've got to be readonly)
+ if (consumer.isHidingComments ()
+ || inDTD
+ || currentEntity != null)
+ return;
+ comment = document.createComment (new String (ch, start, length));
+ top.appendChild (comment);
+ }
+
+ /**
+ * May be overridden by subclasses to return true, indicating
+ * that entity reference nodes can be populated and then made
+ * read-only.
+ */
+ public boolean canPopulateEntityRefs ()
+ { return false; }
+
+ // SAX2 lexical event
+ public void startEntity (String name)
+ throws SAXException
+ {
+ // are we ignoring what would be contents of an
+ // entity ref, since we can't populate it?
+ if (currentEntity != null)
+ return;
+
+ // Are we hiding all entity boundaries?
+ if (consumer.isHidingReferences ())
+ return;
+
+ // SAX2 shows parameter entities; DOM hides them
+ if (name.charAt (0) == '%' || "[dtd]".equals (name))
+ return;
+
+ // Since we can't create a populated entity ref node in any
+ // standard way, we create an unpopulated one.
+ EntityReference ref = document.createEntityReference (name);
+ top.appendChild (ref);
+ top = ref;
+
+ // ... allowing subclasses to populate them
+ if (!canPopulateEntityRefs ())
+ currentEntity = name;
+ }
+
+ // SAX2 lexical event
+ public void endEntity (String name)
+ throws SAXException
+ {
+ if (name.charAt (0) == '%' || "[dtd]".equals (name))
+ return;
+ if (name.equals (currentEntity))
+ currentEntity = null;
+ if (!consumer.isHidingReferences ())
+ top = top.getParentNode ();
+ }
+
+
+ // SAX1 DTD event
+ public void notationDecl (
+ String name,
+ String publicId, String SystemId
+ ) throws SAXException
+ {
+ /* IGNORE -- no public DOM API lets us store these
+ * into the doctype node
+ */
+ }
+
+ // SAX1 DTD event
+ public void unparsedEntityDecl (
+ String name,
+ String publicId, String SystemId,
+ String notationName
+ ) throws SAXException
+ {
+ /* IGNORE -- no public DOM API lets us store these
+ * into the doctype node
+ */
+ }
+
+ // SAX2 declaration event
+ public void elementDecl (String name, String model)
+ throws SAXException
+ {
+ /* IGNORE -- no content model support in DOM L2 */
+ }
+
+ // SAX2 declaration event
+ public void attributeDecl (
+ String eName,
+ String aName,
+ String type,
+ String mode,
+ String value
+ ) throws SAXException
+ {
+ /* IGNORE -- no attribute model support in DOM L2 */
+ }
+
+ // SAX2 declaration event
+ public void internalEntityDecl (String name, String value)
+ throws SAXException
+ {
+ /* IGNORE -- no public DOM API lets us store these
+ * into the doctype node
+ */
+ }
+
+ // SAX2 declaration event
+ public void externalEntityDecl (
+ String name,
+ String publicId,
+ String SystemId
+ ) throws SAXException
+ {
+ /* IGNORE -- no public DOM API lets us store these
+ * into the doctype node
+ */
+ }
+
+ //
+ // These really should offer the option of nonfatal handling,
+ // like other validity errors, though that would cause major
+ // chaos in the DOM data structures. DOM is already spec'd
+ // to treat many of these as fatal, so this is consistent.
+ //
+ private void namespaceError (String description)
+ throws SAXParseException
+ {
+ SAXParseException err;
+
+ err = new SAXParseException (description, locator);
+ throw err;
+ }
}
}
diff --git a/gnu/xml/pipeline/EventConsumer.java b/gnu/xml/pipeline/EventConsumer.java
index 017bc7f74..a0a8824f7 100644
--- a/gnu/xml/pipeline/EventConsumer.java
+++ b/gnu/xml/pipeline/EventConsumer.java
@@ -1,4 +1,4 @@
-/* EventConsumer.java --
+/* EventConsumer.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -75,7 +75,7 @@ public interface EventConsumer
* @return The value of that property, if it is defined.
*
* @exception SAXNotRecognizedException Thrown if the particular
- * pipeline stage does not understand the specified identifier.
+ * pipeline stage does not understand the specified identifier.
*/
public Object getProperty (String id)
throws SAXNotRecognizedException;
diff --git a/gnu/xml/pipeline/EventFilter.java b/gnu/xml/pipeline/EventFilter.java
index af2113f97..b3cc2d654 100644
--- a/gnu/xml/pipeline/EventFilter.java
+++ b/gnu/xml/pipeline/EventFilter.java
@@ -1,4 +1,4 @@
-/* EventFilter.java --
+/* EventFilter.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -89,35 +89,35 @@ import org.xml.sax.helpers.XMLFilterImpl;
* {@link org.xml.sax.helpers.XMLFilterImpl XMLFilterImpl} class.
* Key differences include: <ul>
*
- * <li> This fully separates consumer and producer roles: it
- * does not implement the producer side <em>XMLReader</em> or
- * <em>EntityResolver</em> interfaces, so it can only be used
- * in "push" mode (it has no <em>parse()</em> methods).
+ * <li> This fully separates consumer and producer roles: it
+ * does not implement the producer side <em>XMLReader</em> or
+ * <em>EntityResolver</em> interfaces, so it can only be used
+ * in "push" mode (it has no <em>parse()</em> methods).
*
- * <li> "Extension" handlers are fully supported, enabling a
- * richer set of application requirements.
- * And it implements {@link EventConsumer}, which groups related
- * consumer methods together, rather than leaving them separated.
+ * <li> "Extension" handlers are fully supported, enabling a
+ * richer set of application requirements.
+ * And it implements {@link EventConsumer}, which groups related
+ * consumer methods together, rather than leaving them separated.
*
- * <li> The chaining which is visible is "downstream" to the next
- * consumer, not "upstream" to the preceding producer.
- * It supports "fan-in", where
- * a consumer can be fed by several producers. (For "fan-out",
- * see the {@link TeeConsumer} class.)
+ * <li> The chaining which is visible is "downstream" to the next
+ * consumer, not "upstream" to the preceding producer.
+ * It supports "fan-in", where
+ * a consumer can be fed by several producers. (For "fan-out",
+ * see the {@link TeeConsumer} class.)
*
- * <li> Event chaining is set up differently. It is intended to
- * work "upstream" from terminus towards producer, during filter
- * construction, as described above.
- * This is part of an early binding model:
- * events don't need to pass through stages which ignore them.
+ * <li> Event chaining is set up differently. It is intended to
+ * work "upstream" from terminus towards producer, during filter
+ * construction, as described above.
+ * This is part of an early binding model:
+ * events don't need to pass through stages which ignore them.
*
- * <li> ErrorHandler support is separated, on the grounds that
- * pipeline stages need to share the same error handling policy.
- * For the same reason, error handler setup goes "downstream":
- * when error handlers get set, they are passed to subsequent
- * consumers.
+ * <li> ErrorHandler support is separated, on the grounds that
+ * pipeline stages need to share the same error handling policy.
+ * For the same reason, error handler setup goes "downstream":
+ * when error handlers get set, they are passed to subsequent
+ * consumers.
*
- * </ul>
+ * </ul>
*
* <p> The {@link #chainTo chainTo()} convenience routine supports chaining to
* an XMLFilterImpl, in its role as a limited functionality event
@@ -137,34 +137,34 @@ import org.xml.sax.helpers.XMLFilterImpl;
*/
public class EventFilter
implements EventConsumer, ContentHandler, DTDHandler,
- LexicalHandler, DeclHandler
+ LexicalHandler, DeclHandler
{
// SAX handlers
- private ContentHandler docHandler, docNext;
- private DTDHandler dtdHandler, dtdNext;
- private LexicalHandler lexHandler, lexNext;
- private DeclHandler declHandler, declNext;
+ private ContentHandler docHandler, docNext;
+ private DTDHandler dtdHandler, dtdNext;
+ private LexicalHandler lexHandler, lexNext;
+ private DeclHandler declHandler, declNext;
// and ideally, one more for the stuff SAX2 doesn't show
- private Locator locator;
- private EventConsumer next;
- private ErrorHandler errHandler;
+ private Locator locator;
+ private EventConsumer next;
+ private ErrorHandler errHandler;
+
-
/** SAX2 URI prefix for standard feature flags. */
- public static final String FEATURE_URI
- = "http://xml.org/sax/features/";
+ public static final String FEATURE_URI
+ = "http://xml.org/sax/features/";
/** SAX2 URI prefix for standard properties (mostly for handlers). */
- public static final String PROPERTY_URI
- = "http://xml.org/sax/properties/";
+ public static final String PROPERTY_URI
+ = "http://xml.org/sax/properties/";
/** SAX2 property identifier for {@link DeclHandler} events */
- public static final String DECL_HANDLER
- = PROPERTY_URI + "declaration-handler";
+ public static final String DECL_HANDLER
+ = PROPERTY_URI + "declaration-handler";
/** SAX2 property identifier for {@link LexicalHandler} events */
- public static final String LEXICAL_HANDLER
- = PROPERTY_URI + "lexical-handler";
-
+ public static final String LEXICAL_HANDLER
+ = PROPERTY_URI + "lexical-handler";
+
//
// These class objects will be null if the relevant class isn't linked.
// Small configurations (pJava and some kinds of embedded systems) need
@@ -176,11 +176,11 @@ public class EventFilter
// that's associated with "this" class loader. But that wouldn't be true
// for classes in another package.
//
- private static boolean loaded;
- private static Class nsClass;
- private static Class validClass;
- private static Class wfClass;
- private static Class xincClass;
+ private static boolean loaded;
+ private static Class nsClass;
+ private static Class validClass;
+ private static Class wfClass;
+ private static Class xincClass;
static ClassLoader getClassLoader ()
{
@@ -206,25 +206,25 @@ public class EventFilter
static Class loadClass (ClassLoader classLoader, String className)
{
- try {
- if (classLoader == null)
- return Class.forName(className);
- else
- return classLoader.loadClass(className);
- } catch (Exception e) {
- return null;
- }
+ try {
+ if (classLoader == null)
+ return Class.forName(className);
+ else
+ return classLoader.loadClass(className);
+ } catch (Exception e) {
+ return null;
+ }
}
static private void loadClasses ()
{
- ClassLoader loader = getClassLoader ();
+ ClassLoader loader = getClassLoader ();
- nsClass = loadClass (loader, "gnu.xml.pipeline.NSFilter");
- validClass = loadClass (loader, "gnu.xml.pipeline.ValidationConsumer");
- wfClass = loadClass (loader, "gnu.xml.pipeline.WellFormednessFilter");
- xincClass = loadClass (loader, "gnu.xml.pipeline.XIncludeFilter");
- loaded = true;
+ nsClass = loadClass (loader, "gnu.xml.pipeline.NSFilter");
+ validClass = loadClass (loader, "gnu.xml.pipeline.ValidationConsumer");
+ wfClass = loadClass (loader, "gnu.xml.pipeline.WellFormednessFilter");
+ xincClass = loadClass (loader, "gnu.xml.pipeline.XIncludeFilter");
+ loaded = true;
}
@@ -246,146 +246,146 @@ public class EventFilter
* of the XMLReader implementation in use; for example, it permits
* validating output of a {@link gnu.xml.util.DomParser}. <ul>
*
- * <li> {@link NSFilter} will be removed if the producer can be
- * told not to discard namespace data, using the "namespace-prefixes"
- * feature flag.
+ * <li> {@link NSFilter} will be removed if the producer can be
+ * told not to discard namespace data, using the "namespace-prefixes"
+ * feature flag.
*
- * <li> {@link ValidationConsumer} will be removed if the producer
- * can be told to validate, using the "validation" feature flag.
+ * <li> {@link ValidationConsumer} will be removed if the producer
+ * can be told to validate, using the "validation" feature flag.
*
- * <li> {@link WellFormednessFilter} is always removed, on the
- * grounds that no XMLReader is permitted to producee malformed
- * event streams and this would just be processing overhead.
+ * <li> {@link WellFormednessFilter} is always removed, on the
+ * grounds that no XMLReader is permitted to producee malformed
+ * event streams and this would just be processing overhead.
*
- * <li> {@link XIncludeFilter} stops the special handling, except
- * that it's told about the "namespace-prefixes" feature of the
- * event producer so that the event stream is internally consistent.
+ * <li> {@link XIncludeFilter} stops the special handling, except
+ * that it's told about the "namespace-prefixes" feature of the
+ * event producer so that the event stream is internally consistent.
*
- * <li> The first consumer which is not one of those classes stops
- * such special handling. This means that if you want to force
- * one of those filters to be used, you could just precede it with
- * an instance of {@link EventFilter} configured as a pass-through.
- * You might need to do that if you are using an {@link NSFilter}
- * subclass to fix names found in attributes or character data.
+ * <li> The first consumer which is not one of those classes stops
+ * such special handling. This means that if you want to force
+ * one of those filters to be used, you could just precede it with
+ * an instance of {@link EventFilter} configured as a pass-through.
+ * You might need to do that if you are using an {@link NSFilter}
+ * subclass to fix names found in attributes or character data.
*
- * </ul>
+ * </ul>
*
* <p> Other than that, this method works with any kind of event consumer,
* not just event filters. Note that in all cases, the standard handlers
* are assigned; any previous handler assignments for the handler will
* be overridden.
*
- * @param producer will deliver events to the specified consumer
+ * @param producer will deliver events to the specified consumer
* @param consumer pipeline supplying event handlers to be associated
- * with the producer (may not be null)
+ * with the producer (may not be null)
*/
public static void bind (XMLReader producer, EventConsumer consumer)
{
- Class klass = null;
- boolean prefixes;
-
- if (!loaded)
- loadClasses ();
-
- // DOM building, printing, layered validation, and other
- // things don't work well when prefix info is discarded.
- // Include it by default, whenever possible.
- try {
- producer.setFeature (FEATURE_URI + "namespace-prefixes",
- true);
- prefixes = true;
- } catch (SAXException e) {
- prefixes = false;
- }
-
- // NOTE: This loop doesn't use "instanceof", since that
- // would prevent compiling/linking without those classes
- // being present.
- while (consumer != null) {
- klass = consumer.getClass ();
-
- // we might have already changed this problematic SAX2 default.
- if (nsClass != null && nsClass.isAssignableFrom (klass)) {
- if (!prefixes)
- break;
- consumer = ((EventFilter)consumer).getNext ();
-
- // the parser _might_ do DTD validation by default ...
- // if not, maybe we can change this setting.
- } else if (validClass != null
- && validClass.isAssignableFrom (klass)) {
- try {
- producer.setFeature (FEATURE_URI + "validation",
- true);
- consumer = ((ValidationConsumer)consumer).getNext ();
- } catch (SAXException e) {
- break;
- }
-
- // parsers are required not to have such bugs
- } else if (wfClass != null && wfClass.isAssignableFrom (klass)) {
- consumer = ((WellFormednessFilter)consumer).getNext ();
-
- // stop on the first pipeline stage we can't remove
- } else
- break;
-
- if (consumer == null)
- klass = null;
- }
-
- // the actual setting here doesn't matter as much
- // as that producer and consumer agree
- if (xincClass != null && klass != null
- && xincClass.isAssignableFrom (klass))
- ((XIncludeFilter)consumer).setSavingPrefixes (prefixes);
-
- // Some SAX parsers can't handle null handlers -- bleech
- DefaultHandler2 h = new DefaultHandler2 ();
-
- if (consumer != null && consumer.getContentHandler () != null)
- producer.setContentHandler (consumer.getContentHandler ());
- else
- producer.setContentHandler (h);
- if (consumer != null && consumer.getDTDHandler () != null)
- producer.setDTDHandler (consumer.getDTDHandler ());
- else
- producer.setDTDHandler (h);
-
- try {
- Object dh;
-
- if (consumer != null)
- dh = consumer.getProperty (DECL_HANDLER);
- else
- dh = null;
- if (dh == null)
- dh = h;
- producer.setProperty (DECL_HANDLER, dh);
- } catch (Exception e) { /* ignore */ }
- try {
- Object lh;
-
- if (consumer != null)
- lh = consumer.getProperty (LEXICAL_HANDLER);
- else
- lh = null;
- if (lh == null)
- lh = h;
- producer.setProperty (LEXICAL_HANDLER, lh);
- } catch (Exception e) { /* ignore */ }
-
- // this binding goes the other way around
- if (producer.getErrorHandler () == null)
- producer.setErrorHandler (h);
- if (consumer != null)
- consumer.setErrorHandler (producer.getErrorHandler ());
- }
-
+ Class klass = null;
+ boolean prefixes;
+
+ if (!loaded)
+ loadClasses ();
+
+ // DOM building, printing, layered validation, and other
+ // things don't work well when prefix info is discarded.
+ // Include it by default, whenever possible.
+ try {
+ producer.setFeature (FEATURE_URI + "namespace-prefixes",
+ true);
+ prefixes = true;
+ } catch (SAXException e) {
+ prefixes = false;
+ }
+
+ // NOTE: This loop doesn't use "instanceof", since that
+ // would prevent compiling/linking without those classes
+ // being present.
+ while (consumer != null) {
+ klass = consumer.getClass ();
+
+ // we might have already changed this problematic SAX2 default.
+ if (nsClass != null && nsClass.isAssignableFrom (klass)) {
+ if (!prefixes)
+ break;
+ consumer = ((EventFilter)consumer).getNext ();
+
+ // the parser _might_ do DTD validation by default ...
+ // if not, maybe we can change this setting.
+ } else if (validClass != null
+ && validClass.isAssignableFrom (klass)) {
+ try {
+ producer.setFeature (FEATURE_URI + "validation",
+ true);
+ consumer = ((ValidationConsumer)consumer).getNext ();
+ } catch (SAXException e) {
+ break;
+ }
+
+ // parsers are required not to have such bugs
+ } else if (wfClass != null && wfClass.isAssignableFrom (klass)) {
+ consumer = ((WellFormednessFilter)consumer).getNext ();
+
+ // stop on the first pipeline stage we can't remove
+ } else
+ break;
+
+ if (consumer == null)
+ klass = null;
+ }
+
+ // the actual setting here doesn't matter as much
+ // as that producer and consumer agree
+ if (xincClass != null && klass != null
+ && xincClass.isAssignableFrom (klass))
+ ((XIncludeFilter)consumer).setSavingPrefixes (prefixes);
+
+ // Some SAX parsers can't handle null handlers -- bleech
+ DefaultHandler2 h = new DefaultHandler2 ();
+
+ if (consumer != null && consumer.getContentHandler () != null)
+ producer.setContentHandler (consumer.getContentHandler ());
+ else
+ producer.setContentHandler (h);
+ if (consumer != null && consumer.getDTDHandler () != null)
+ producer.setDTDHandler (consumer.getDTDHandler ());
+ else
+ producer.setDTDHandler (h);
+
+ try {
+ Object dh;
+
+ if (consumer != null)
+ dh = consumer.getProperty (DECL_HANDLER);
+ else
+ dh = null;
+ if (dh == null)
+ dh = h;
+ producer.setProperty (DECL_HANDLER, dh);
+ } catch (Exception e) { /* ignore */ }
+ try {
+ Object lh;
+
+ if (consumer != null)
+ lh = consumer.getProperty (LEXICAL_HANDLER);
+ else
+ lh = null;
+ if (lh == null)
+ lh = h;
+ producer.setProperty (LEXICAL_HANDLER, lh);
+ } catch (Exception e) { /* ignore */ }
+
+ // this binding goes the other way around
+ if (producer.getErrorHandler () == null)
+ producer.setErrorHandler (h);
+ if (consumer != null)
+ consumer.setErrorHandler (producer.getErrorHandler ());
+ }
+
/**
* Initializes all handlers to null.
*/
- // constructor used by PipelineFactory
+ // constructor used by PipelineFactory
public EventFilter () { }
@@ -394,30 +394,30 @@ public class EventFilter
* the specified consumer, making it easy to pass events through.
* If the consumer is null, all handlers are initialzed to null.
*/
- // constructor used by PipelineFactory
+ // constructor used by PipelineFactory
public EventFilter (EventConsumer consumer)
{
- if (consumer == null)
- return;
+ if (consumer == null)
+ return;
- next = consumer;
+ next = consumer;
- // We delegate through the "xxNext" handlers, and
- // report the "xxHandler" ones on our input side.
+ // We delegate through the "xxNext" handlers, and
+ // report the "xxHandler" ones on our input side.
- // Normally a subclass would both override handler
- // methods and register itself as the "xxHandler".
+ // Normally a subclass would both override handler
+ // methods and register itself as the "xxHandler".
- docHandler = docNext = consumer.getContentHandler ();
- dtdHandler = dtdNext = consumer.getDTDHandler ();
- try {
- declHandler = declNext = (DeclHandler)
- consumer.getProperty (DECL_HANDLER);
- } catch (SAXException e) { /* leave value null */ }
- try {
- lexHandler = lexNext = (LexicalHandler)
- consumer.getProperty (LEXICAL_HANDLER);
- } catch (SAXException e) { /* leave value null */ }
+ docHandler = docNext = consumer.getContentHandler ();
+ dtdHandler = dtdNext = consumer.getDTDHandler ();
+ try {
+ declHandler = declNext = (DeclHandler)
+ consumer.getProperty (DECL_HANDLER);
+ } catch (SAXException e) { /* leave value null */ }
+ try {
+ lexHandler = lexNext = (LexicalHandler)
+ consumer.getProperty (LEXICAL_HANDLER);
+ } catch (SAXException e) { /* leave value null */ }
}
/**
@@ -442,33 +442,33 @@ public class EventFilter
*
* @param next the next downstream component of the pipeline.
* @exception IllegalStateException if the "next" consumer has
- * already been set through the constructor.
+ * already been set through the constructor.
*/
public void chainTo (XMLFilterImpl next)
{
- if (this.next != null)
- throw new IllegalStateException ();
+ if (this.next != null)
+ throw new IllegalStateException ();
- docNext = next.getContentHandler ();
- if (docHandler == null)
- docHandler = docNext;
- dtdNext = next.getDTDHandler ();
- if (dtdHandler == null)
- dtdHandler = dtdNext;
+ docNext = next.getContentHandler ();
+ if (docHandler == null)
+ docHandler = docNext;
+ dtdNext = next.getDTDHandler ();
+ if (dtdHandler == null)
+ dtdHandler = dtdNext;
- try {
- declNext = (DeclHandler) next.getProperty (DECL_HANDLER);
- if (declHandler == null)
- declHandler = declNext;
- } catch (SAXException e) { /* leave value null */ }
- try {
- lexNext = (LexicalHandler) next.getProperty (LEXICAL_HANDLER);
- if (lexHandler == null)
- lexHandler = lexNext;
- } catch (SAXException e) { /* leave value null */ }
+ try {
+ declNext = (DeclHandler) next.getProperty (DECL_HANDLER);
+ if (declHandler == null)
+ declHandler = declNext;
+ } catch (SAXException e) { /* leave value null */ }
+ try {
+ lexNext = (LexicalHandler) next.getProperty (LEXICAL_HANDLER);
+ if (lexHandler == null)
+ lexHandler = lexNext;
+ } catch (SAXException e) { /* leave value null */ }
- if (errHandler != null)
- next.setErrorHandler (errHandler);
+ if (errHandler != null)
+ next.setErrorHandler (errHandler);
}
/**
@@ -477,9 +477,9 @@ public class EventFilter
*/
final public void setErrorHandler (ErrorHandler handler)
{
- errHandler = handler;
- if (next != null)
- next.setErrorHandler (handler);
+ errHandler = handler;
+ if (next != null)
+ next.setErrorHandler (handler);
}
/**
@@ -488,7 +488,7 @@ public class EventFilter
*/
final public ErrorHandler getErrorHandler ()
{
- return errHandler;
+ return errHandler;
}
@@ -497,7 +497,7 @@ public class EventFilter
* is no such handler.
*/
final public EventConsumer getNext ()
- { return next; }
+ { return next; }
/**
@@ -508,13 +508,13 @@ public class EventFilter
*/
final public void setContentHandler (ContentHandler h)
{
- docHandler = h;
+ docHandler = h;
}
/** Returns the content handler being used. */
final public ContentHandler getContentHandler ()
{
- return docHandler;
+ return docHandler;
}
/**
@@ -524,12 +524,12 @@ public class EventFilter
* probably pointed to the next consumer by the base class constructor.
*/
final public void setDTDHandler (DTDHandler h)
- { dtdHandler = h; }
+ { dtdHandler = h; }
/** Returns the dtd handler being used. */
final public DTDHandler getDTDHandler ()
{
- return dtdHandler;
+ return dtdHandler;
}
/**
@@ -541,36 +541,36 @@ public class EventFilter
final public void setProperty (String id, Object o)
throws SAXNotRecognizedException, SAXNotSupportedException
{
- try {
- Object value = getProperty (id);
-
- if (value == o)
- return;
- if (DECL_HANDLER.equals (id)) {
- declHandler = (DeclHandler) o;
- return;
- }
- if (LEXICAL_HANDLER.equals (id)) {
- lexHandler = (LexicalHandler) o;
- return;
- }
- throw new SAXNotSupportedException (id);
-
- } catch (ClassCastException e) {
- throw new SAXNotSupportedException (id);
- }
+ try {
+ Object value = getProperty (id);
+
+ if (value == o)
+ return;
+ if (DECL_HANDLER.equals (id)) {
+ declHandler = (DeclHandler) o;
+ return;
+ }
+ if (LEXICAL_HANDLER.equals (id)) {
+ lexHandler = (LexicalHandler) o;
+ return;
+ }
+ throw new SAXNotSupportedException (id);
+
+ } catch (ClassCastException e) {
+ throw new SAXNotSupportedException (id);
+ }
}
/** Retrieves a property of unknown intent (usually a handler) */
final public Object getProperty (String id)
throws SAXNotRecognizedException
{
- if (DECL_HANDLER.equals (id))
- return declHandler;
- if (LEXICAL_HANDLER.equals (id))
- return lexHandler;
+ if (DECL_HANDLER.equals (id))
+ return declHandler;
+ if (LEXICAL_HANDLER.equals (id))
+ return lexHandler;
- throw new SAXNotRecognizedException (id);
+ throw new SAXNotRecognizedException (id);
}
/**
@@ -578,7 +578,7 @@ public class EventFilter
* (or a subclass) is handling {@link ContentHandler } events.
*/
public Locator getDocumentLocator ()
- { return locator; }
+ { return locator; }
// CONTENT HANDLER DELEGATIONS
@@ -586,113 +586,113 @@ public class EventFilter
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void setDocumentLocator (Locator locator)
{
- this.locator = locator;
- if (docNext != null)
- docNext.setDocumentLocator (locator);
+ this.locator = locator;
+ if (docNext != null)
+ docNext.setDocumentLocator (locator);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void startDocument () throws SAXException
{
- if (docNext != null)
- docNext.startDocument ();
+ if (docNext != null)
+ docNext.startDocument ();
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void skippedEntity (String name) throws SAXException
{
- if (docNext != null)
- docNext.skippedEntity (name);
+ if (docNext != null)
+ docNext.skippedEntity (name);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void processingInstruction (String target, String data)
throws SAXException
{
- if (docNext != null)
- docNext.processingInstruction (target, data);
+ if (docNext != null)
+ docNext.processingInstruction (target, data);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void characters (char ch [], int start, int length)
throws SAXException
{
- if (docNext != null)
- docNext.characters (ch, start, length);
+ if (docNext != null)
+ docNext.characters (ch, start, length);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void ignorableWhitespace (char ch [], int start, int length)
throws SAXException
{
- if (docNext != null)
- docNext.ignorableWhitespace (ch, start, length);
+ if (docNext != null)
+ docNext.ignorableWhitespace (ch, start, length);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void startPrefixMapping (String prefix, String uri)
throws SAXException
{
- if (docNext != null)
- docNext.startPrefixMapping (prefix, uri);
+ if (docNext != null)
+ docNext.startPrefixMapping (prefix, uri);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void startElement (
- String uri, String localName,
- String qName, Attributes atts
+ String uri, String localName,
+ String qName, Attributes atts
) throws SAXException
{
- if (docNext != null)
- docNext.startElement (uri, localName, qName, atts);
+ if (docNext != null)
+ docNext.startElement (uri, localName, qName, atts);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void endElement (String uri, String localName, String qName)
throws SAXException
{
- if (docNext != null)
- docNext.endElement (uri, localName, qName);
+ if (docNext != null)
+ docNext.endElement (uri, localName, qName);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void endPrefixMapping (String prefix) throws SAXException
{
- if (docNext != null)
- docNext.endPrefixMapping (prefix);
+ if (docNext != null)
+ docNext.endPrefixMapping (prefix);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void endDocument () throws SAXException
{
- if (docNext != null)
- docNext.endDocument ();
- locator = null;
+ if (docNext != null)
+ docNext.endDocument ();
+ locator = null;
}
// DTD HANDLER DELEGATIONS
-
+
/** <b>SAX1:</b> passes this callback to the next consumer, if any */
public void unparsedEntityDecl (
- String name,
- String publicId,
- String systemId,
- String notationName
+ String name,
+ String publicId,
+ String systemId,
+ String notationName
) throws SAXException
{
- if (dtdNext != null)
- dtdNext.unparsedEntityDecl (name, publicId, systemId, notationName);
+ if (dtdNext != null)
+ dtdNext.unparsedEntityDecl (name, publicId, systemId, notationName);
}
-
+
/** <b>SAX1:</b> passes this callback to the next consumer, if any */
public void notationDecl (String name, String publicId, String systemId)
throws SAXException
{
- if (dtdNext != null)
- dtdNext.notationDecl (name, publicId, systemId);
+ if (dtdNext != null)
+ dtdNext.notationDecl (name, publicId, systemId);
}
-
+
// LEXICAL HANDLER DELEGATIONS
@@ -700,40 +700,40 @@ public class EventFilter
public void startDTD (String name, String publicId, String systemId)
throws SAXException
{
- if (lexNext != null)
- lexNext.startDTD (name, publicId, systemId);
+ if (lexNext != null)
+ lexNext.startDTD (name, publicId, systemId);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void endDTD ()
throws SAXException
{
- if (lexNext != null)
- lexNext.endDTD ();
+ if (lexNext != null)
+ lexNext.endDTD ();
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void comment (char ch [], int start, int length)
throws SAXException
{
- if (lexNext != null)
- lexNext.comment (ch, start, length);
+ if (lexNext != null)
+ lexNext.comment (ch, start, length);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void startCDATA ()
throws SAXException
{
- if (lexNext != null)
- lexNext.startCDATA ();
+ if (lexNext != null)
+ lexNext.startCDATA ();
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void endCDATA ()
throws SAXException
{
- if (lexNext != null)
- lexNext.endCDATA ();
+ if (lexNext != null)
+ lexNext.endCDATA ();
}
/**
@@ -742,8 +742,8 @@ public class EventFilter
public void startEntity (String name)
throws SAXException
{
- if (lexNext != null)
- lexNext.startEntity (name);
+ if (lexNext != null)
+ lexNext.startEntity (name);
}
/**
@@ -752,10 +752,10 @@ public class EventFilter
public void endEntity (String name)
throws SAXException
{
- if (lexNext != null)
- lexNext.endEntity (name);
+ if (lexNext != null)
+ lexNext.endEntity (name);
}
-
+
// DECLARATION HANDLER DELEGATIONS
@@ -764,33 +764,33 @@ public class EventFilter
public void elementDecl (String name, String model)
throws SAXException
{
- if (declNext != null)
- declNext.elementDecl (name, model);
+ if (declNext != null)
+ declNext.elementDecl (name, model);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void attributeDecl (String eName, String aName,
- String type, String mode, String value)
+ String type, String mode, String value)
throws SAXException
{
- if (declNext != null)
- declNext.attributeDecl (eName, aName, type, mode, value);
+ if (declNext != null)
+ declNext.attributeDecl (eName, aName, type, mode, value);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void externalEntityDecl (String name,
- String publicId, String systemId)
+ String publicId, String systemId)
throws SAXException
{
- if (declNext != null)
- declNext.externalEntityDecl (name, publicId, systemId);
+ if (declNext != null)
+ declNext.externalEntityDecl (name, publicId, systemId);
}
/** <b>SAX2:</b> passes this callback to the next consumer, if any */
public void internalEntityDecl (String name, String value)
throws SAXException
{
- if (declNext != null)
- declNext.internalEntityDecl (name, value);
+ if (declNext != null)
+ declNext.internalEntityDecl (name, value);
}
}
diff --git a/gnu/xml/pipeline/LinkFilter.java b/gnu/xml/pipeline/LinkFilter.java
index ddb9fda2e..e11a5eca6 100644
--- a/gnu/xml/pipeline/LinkFilter.java
+++ b/gnu/xml/pipeline/LinkFilter.java
@@ -1,4 +1,4 @@
-/* LinkFilter.java --
+/* LinkFilter.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.xml.pipeline;
import java.io.IOException;
-import java.net.URL;
+import java.net.URL;
import java.util.Enumeration;
import java.util.Vector;
@@ -65,21 +65,21 @@ import org.xml.sax.SAXException;
public class LinkFilter extends EventFilter
{
// for storing URIs
- private Vector vector = new Vector ();
+ private Vector vector = new Vector ();
- // struct for "full" link record (tbd)
- // these for troubleshooting original source:
- // original uri
- // uri as resolved (base, relative, etc)
- // URI of originating doc
- // line #
- // original element + attrs (img src, desc, etc)
+ // struct for "full" link record (tbd)
+ // these for troubleshooting original source:
+ // original uri
+ // uri as resolved (base, relative, etc)
+ // URI of originating doc
+ // line #
+ // original element + attrs (img src, desc, etc)
- // XLink model of the link ... for inter-site pairups ?
+ // XLink model of the link ... for inter-site pairups ?
- private String baseURI;
+ private String baseURI;
- private boolean siteRestricted = false;
+ private boolean siteRestricted = false;
//
// XXX leverage blacklist info (like robots.txt)
@@ -93,10 +93,10 @@ public class LinkFilter extends EventFilter
* Constructs a new event filter, which collects links in private data
* structure for later enumeration.
*/
- // constructor used by PipelineFactory
+ // constructor used by PipelineFactory
public LinkFilter ()
{
- super.setContentHandler (this);
+ super.setContentHandler (this);
}
@@ -105,11 +105,11 @@ public class LinkFilter extends EventFilter
* structure for later enumeration and passes all events, unmodified,
* to the next consumer.
*/
- // constructor used by PipelineFactory
+ // constructor used by PipelineFactory
public LinkFilter (EventConsumer next)
{
- super (next);
- super.setContentHandler (this);
+ super (next);
+ super.setContentHandler (this);
}
@@ -121,7 +121,7 @@ public class LinkFilter extends EventFilter
*/
public Enumeration getLinks ()
{
- return vector.elements ();
+ return vector.elements ();
}
/**
@@ -130,7 +130,7 @@ public class LinkFilter extends EventFilter
*/
public void removeAllLinks ()
{
- vector = new Vector ();
+ vector = new Vector ();
}
@@ -138,84 +138,84 @@ public class LinkFilter extends EventFilter
* Collects URIs for (X)HTML content from elements which hold them.
*/
public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
+ String uri,
+ String localName,
+ String qName,
+ Attributes atts
) throws SAXException
{
- String link;
-
- // Recognize XHTML links.
- if ("http://www.w3.org/1999/xhtml".equals (uri)) {
-
- if ("a".equals (localName) || "base".equals (localName)
- || "area".equals (localName))
- link = atts.getValue ("href");
- else if ("iframe".equals (localName) || "frame".equals (localName))
- link = atts.getValue ("src");
- else if ("blockquote".equals (localName) || "q".equals (localName)
- || "ins".equals (localName) || "del".equals (localName))
- link = atts.getValue ("cite");
- else
- link = null;
- link = maybeAddLink (link);
-
- // "base" modifies designated baseURI
- if ("base".equals (localName) && link != null)
- baseURI = link;
-
- if ("iframe".equals (localName) || "img".equals (localName))
- maybeAddLink (atts.getValue ("longdesc"));
- }
-
- super.startElement (uri, localName, qName, atts);
+ String link;
+
+ // Recognize XHTML links.
+ if ("http://www.w3.org/1999/xhtml".equals (uri)) {
+
+ if ("a".equals (localName) || "base".equals (localName)
+ || "area".equals (localName))
+ link = atts.getValue ("href");
+ else if ("iframe".equals (localName) || "frame".equals (localName))
+ link = atts.getValue ("src");
+ else if ("blockquote".equals (localName) || "q".equals (localName)
+ || "ins".equals (localName) || "del".equals (localName))
+ link = atts.getValue ("cite");
+ else
+ link = null;
+ link = maybeAddLink (link);
+
+ // "base" modifies designated baseURI
+ if ("base".equals (localName) && link != null)
+ baseURI = link;
+
+ if ("iframe".equals (localName) || "img".equals (localName))
+ maybeAddLink (atts.getValue ("longdesc"));
+ }
+
+ super.startElement (uri, localName, qName, atts);
}
private String maybeAddLink (String link)
{
- int index;
-
- // ignore empty links and fragments inside docs
- if (link == null)
- return null;
- if ((index = link.indexOf ("#")) >= 0)
- link = link.substring (0, index);
- if (link.equals (""))
- return null;
-
- try {
- // get the real URI
- URL base = new URL ((baseURI != null)
- ? baseURI
- : getDocumentLocator ().getSystemId ());
- URL url = new URL (base, link);
-
- link = url.toString ();
-
- // ignore duplicates
- if (vector.contains (link))
- return link;
-
- // other than what "base" does, stick to original site:
- if (siteRestricted) {
- // don't switch protocols
- if (!base.getProtocol ().equals (url.getProtocol ()))
- return link;
- // don't switch servers
- if (base.getHost () != null
- && !base.getHost ().equals (url.getHost ()))
- return link;
- }
-
- vector.addElement (link);
-
- return link;
-
- } catch (IOException e) {
- // bad URLs we don't want
- }
- return null;
+ int index;
+
+ // ignore empty links and fragments inside docs
+ if (link == null)
+ return null;
+ if ((index = link.indexOf ("#")) >= 0)
+ link = link.substring (0, index);
+ if (link.equals (""))
+ return null;
+
+ try {
+ // get the real URI
+ URL base = new URL ((baseURI != null)
+ ? baseURI
+ : getDocumentLocator ().getSystemId ());
+ URL url = new URL (base, link);
+
+ link = url.toString ();
+
+ // ignore duplicates
+ if (vector.contains (link))
+ return link;
+
+ // other than what "base" does, stick to original site:
+ if (siteRestricted) {
+ // don't switch protocols
+ if (!base.getProtocol ().equals (url.getProtocol ()))
+ return link;
+ // don't switch servers
+ if (base.getHost () != null
+ && !base.getHost ().equals (url.getHost ()))
+ return link;
+ }
+
+ vector.addElement (link);
+
+ return link;
+
+ } catch (IOException e) {
+ // bad URLs we don't want
+ }
+ return null;
}
/**
@@ -224,8 +224,8 @@ public class LinkFilter extends EventFilter
public void startDocument ()
throws SAXException
{
- if (getDocumentLocator () == null)
- throw new SAXException ("no Locator!");
+ if (getDocumentLocator () == null)
+ throw new SAXException ("no Locator!");
}
/**
@@ -236,7 +236,7 @@ public class LinkFilter extends EventFilter
public void endDocument ()
throws SAXException
{
- baseURI = null;
- super.endDocument ();
+ baseURI = null;
+ super.endDocument ();
}
}
diff --git a/gnu/xml/pipeline/NSFilter.java b/gnu/xml/pipeline/NSFilter.java
index db875e1de..0fa4621d3 100644
--- a/gnu/xml/pipeline/NSFilter.java
+++ b/gnu/xml/pipeline/NSFilter.java
@@ -1,4 +1,4 @@
-/* NSFilter.java --
+/* NSFilter.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,23 +56,23 @@ import org.xml.sax.helpers.NamespaceSupport;
* information using XML. There are various common ways that such data
* gets discarded: <ul>
*
- * <li> By default, SAX2 parsers must discard the "xmlns*"
- * attributes, and may also choose not to report properly prefixed
- * names for elements or attributes. (Some parsers may support
- * changing the <em>namespace-prefixes</em> value from the default
- * to <em>true</em>, effectively eliminating the need to use this
- * filter on their output.)
+ * <li> By default, SAX2 parsers must discard the "xmlns*"
+ * attributes, and may also choose not to report properly prefixed
+ * names for elements or attributes. (Some parsers may support
+ * changing the <em>namespace-prefixes</em> value from the default
+ * to <em>true</em>, effectively eliminating the need to use this
+ * filter on their output.)
*
- * <li> When event streams are generated from a DOM tree, they may
- * have never have had prefixes or declarations for namespaces; or
- * the existing prefixes or declarations may have been invalidated
- * by structural modifications to that DOM tree.
+ * <li> When event streams are generated from a DOM tree, they may
+ * have never have had prefixes or declarations for namespaces; or
+ * the existing prefixes or declarations may have been invalidated
+ * by structural modifications to that DOM tree.
*
- * <li> Other software writing SAX event streams won't necessarily
- * be worrying about prefix management, and so they will need to
- * have a transparent solution for managing them.
+ * <li> Other software writing SAX event streams won't necessarily
+ * be worrying about prefix management, and so they will need to
+ * have a transparent solution for managing them.
*
- * </ul>
+ * </ul>
*
* <p> This filter uses a heuristic to choose the prefix to assign to any
* particular name which wasn't already corectly prefixed. The associated
@@ -91,55 +91,55 @@ import org.xml.sax.helpers.NamespaceSupport;
*/
public class NSFilter extends EventFilter
{
- private NamespaceSupport nsStack = new NamespaceSupport ();
- private Stack elementStack = new Stack ();
+ private NamespaceSupport nsStack = new NamespaceSupport ();
+ private Stack elementStack = new Stack ();
- private boolean pushedContext;
- private String nsTemp [] = new String [3];
- private AttributesImpl attributes = new AttributesImpl ();
- private boolean usedDefault;
+ private boolean pushedContext;
+ private String nsTemp [] = new String [3];
+ private AttributesImpl attributes = new AttributesImpl ();
+ private boolean usedDefault;
// gensymmed prefixes use this root name
- private static final String prefixRoot = "prefix-";
+ private static final String prefixRoot = "prefix-";
+
-
/**
* Passes events through to the specified consumer, after first
* processing them.
*
* @param next the next event consumer to receive events.
*/
- // constructor used by PipelineFactory
+ // constructor used by PipelineFactory
public NSFilter (EventConsumer next)
{
- super (next);
+ super (next);
- setContentHandler (this);
+ setContentHandler (this);
}
private void fatalError (String message)
throws SAXException
{
- SAXParseException e;
- ErrorHandler handler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
-
- if (locator == null)
- e = new SAXParseException (message, null, null, -1, -1);
- else
- e = new SAXParseException (message, locator);
- if (handler != null)
- handler.fatalError (e);
- throw e;
+ SAXParseException e;
+ ErrorHandler handler = getErrorHandler ();
+ Locator locator = getDocumentLocator ();
+
+ if (locator == null)
+ e = new SAXParseException (message, null, null, -1, -1);
+ else
+ e = new SAXParseException (message, locator);
+ if (handler != null)
+ handler.fatalError (e);
+ throw e;
}
public void startDocument () throws SAXException
{
- elementStack.removeAllElements ();
- nsStack.reset ();
- pushedContext = false;
- super.startDocument ();
+ elementStack.removeAllElements ();
+ nsStack.reset ();
+ pushedContext = false;
+ super.startDocument ();
}
/**
@@ -151,176 +151,176 @@ public class NSFilter extends EventFilter
public void startPrefixMapping (String prefix, String uri)
throws SAXException
{
- if (pushedContext == false) {
- nsStack.pushContext ();
- pushedContext = true;
- }
-
- // this check is awkward, but the paranoia prevents big trouble
- for (Enumeration e = nsStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- /* NOP */ ) {
- String declared = (String) e.nextElement ();
-
- if (!declared.equals (prefix))
- continue;
- if (uri.equals (nsStack.getURI (prefix)))
- return;
- fatalError ("inconsistent binding for prefix '" + prefix
- + "' ... " + uri + " (was " + nsStack.getURI (prefix) + ")");
- }
-
- if (!nsStack.declarePrefix (prefix, uri))
- fatalError ("illegal prefix declared: " + prefix);
+ if (pushedContext == false) {
+ nsStack.pushContext ();
+ pushedContext = true;
+ }
+
+ // this check is awkward, but the paranoia prevents big trouble
+ for (Enumeration e = nsStack.getDeclaredPrefixes ();
+ e.hasMoreElements ();
+ /* NOP */ ) {
+ String declared = (String) e.nextElement ();
+
+ if (!declared.equals (prefix))
+ continue;
+ if (uri.equals (nsStack.getURI (prefix)))
+ return;
+ fatalError ("inconsistent binding for prefix '" + prefix
+ + "' ... " + uri + " (was " + nsStack.getURI (prefix) + ")");
+ }
+
+ if (!nsStack.declarePrefix (prefix, uri))
+ fatalError ("illegal prefix declared: " + prefix);
}
private String fixName (String ns, String l, String name, boolean isAttr)
throws SAXException
{
- if ("".equals (name) || name == null) {
- name = l;
- if ("".equals (name) || name == null)
- fatalError ("empty/null name");
- }
-
- // can we correctly process the name as-is?
- // handles "element scope" attribute names here.
- if (nsStack.processName (name, nsTemp, isAttr) != null
- && nsTemp [0].equals (ns)
- ) {
- return nsTemp [2];
- }
-
- // nope, gotta modify the name or declare a default mapping
- int temp;
-
- // get rid of any current prefix
- if ((temp = name.indexOf (':')) >= 0) {
- name = name.substring (temp + 1);
-
- // ... maybe that's enough (use/prefer default namespace) ...
- if (!isAttr && nsStack.processName (name, nsTemp, false) != null
- && nsTemp [0].equals (ns)
- ) {
- return nsTemp [2];
- }
- }
-
- // must we define and use the default/undefined prefix?
- if ("".equals (ns)) {
- if (isAttr)
- fatalError ("processName bug");
- if (attributes.getIndex ("xmlns") != -1)
- fatalError ("need to undefine default NS, but it's bound: "
- + attributes.getValue ("xmlns"));
-
- nsStack.declarePrefix ("", "");
- attributes.addAttribute ("", "", "xmlns", "CDATA", "");
- return name;
- }
-
- // is there at least one non-null prefix we can use?
- for (Enumeration e = nsStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- /* NOP */) {
- String prefix = (String) e.nextElement ();
- String uri = nsStack.getURI (prefix);
-
- if (uri == null || !uri.equals (ns))
- continue;
- return prefix + ":" + name;
- }
-
- // no such luck. create a prefix name, declare it, use it.
- for (temp = 0; temp >= 0; temp++) {
- String prefix = prefixRoot + temp;
-
- if (nsStack.getURI (prefix) == null) {
- nsStack.declarePrefix (prefix, ns);
- attributes.addAttribute ("", "", "xmlns:" + prefix,
- "CDATA", ns);
- return prefix + ":" + name;
- }
- }
- fatalError ("too many prefixes genned");
- // NOTREACHED
- return null;
+ if ("".equals (name) || name == null) {
+ name = l;
+ if ("".equals (name) || name == null)
+ fatalError ("empty/null name");
+ }
+
+ // can we correctly process the name as-is?
+ // handles "element scope" attribute names here.
+ if (nsStack.processName (name, nsTemp, isAttr) != null
+ && nsTemp [0].equals (ns)
+ ) {
+ return nsTemp [2];
+ }
+
+ // nope, gotta modify the name or declare a default mapping
+ int temp;
+
+ // get rid of any current prefix
+ if ((temp = name.indexOf (':')) >= 0) {
+ name = name.substring (temp + 1);
+
+ // ... maybe that's enough (use/prefer default namespace) ...
+ if (!isAttr && nsStack.processName (name, nsTemp, false) != null
+ && nsTemp [0].equals (ns)
+ ) {
+ return nsTemp [2];
+ }
+ }
+
+ // must we define and use the default/undefined prefix?
+ if ("".equals (ns)) {
+ if (isAttr)
+ fatalError ("processName bug");
+ if (attributes.getIndex ("xmlns") != -1)
+ fatalError ("need to undefine default NS, but it's bound: "
+ + attributes.getValue ("xmlns"));
+
+ nsStack.declarePrefix ("", "");
+ attributes.addAttribute ("", "", "xmlns", "CDATA", "");
+ return name;
+ }
+
+ // is there at least one non-null prefix we can use?
+ for (Enumeration e = nsStack.getDeclaredPrefixes ();
+ e.hasMoreElements ();
+ /* NOP */) {
+ String prefix = (String) e.nextElement ();
+ String uri = nsStack.getURI (prefix);
+
+ if (uri == null || !uri.equals (ns))
+ continue;
+ return prefix + ":" + name;
+ }
+
+ // no such luck. create a prefix name, declare it, use it.
+ for (temp = 0; temp >= 0; temp++) {
+ String prefix = prefixRoot + temp;
+
+ if (nsStack.getURI (prefix) == null) {
+ nsStack.declarePrefix (prefix, ns);
+ attributes.addAttribute ("", "", "xmlns:" + prefix,
+ "CDATA", ns);
+ return prefix + ":" + name;
+ }
+ }
+ fatalError ("too many prefixes genned");
+ // NOTREACHED
+ return null;
}
public void startElement (
- String uri, String localName,
- String qName, Attributes atts
+ String uri, String localName,
+ String qName, Attributes atts
) throws SAXException
{
- if (!pushedContext)
- nsStack.pushContext ();
- pushedContext = false;
-
- // make sure we have all NS declarations handy before we start
- int length = atts.getLength ();
-
- for (int i = 0; i < length; i++) {
- String aName = atts.getQName (i);
-
- if (!aName.startsWith ("xmlns"))
- continue;
-
- String prefix;
-
- if ("xmlns".equals (aName))
- prefix = "";
- else if (aName.indexOf (':') == 5)
- prefix = aName.substring (6);
- else // "xmlnsfoo" etc.
- continue;
- startPrefixMapping (prefix, atts.getValue (i));
- }
-
- // put namespace decls at the start of our regenned attlist
- attributes.clear ();
- for (Enumeration e = nsStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- /* NOP */) {
- String prefix = (String) e.nextElement ();
-
- attributes.addAttribute ("", "",
- ("".equals (prefix)
- ? "xmlns"
- : "xmlns:" + prefix),
- "CDATA",
- nsStack.getURI (prefix));
- }
-
- // name fixups: element, then attributes.
- // fixName may declare a new prefix or, for the element,
- // redeclare the default (if element name needs it).
- qName = fixName (uri, localName, qName, false);
-
- for (int i = 0; i < length; i++) {
- String aName = atts.getQName (i);
- String aNS = atts.getURI (i);
- String aLocal = atts.getLocalName (i);
- String aType = atts.getType (i);
- String aValue = atts.getValue (i);
-
- if (aName.startsWith ("xmlns"))
- continue;
- aName = fixName (aNS, aLocal, aName, true);
- attributes.addAttribute (aNS, aLocal, aName, aType, aValue);
- }
-
- elementStack.push (qName);
-
- // pass event along, with cleaned-up names and decls.
- super.startElement (uri, localName, qName, attributes);
+ if (!pushedContext)
+ nsStack.pushContext ();
+ pushedContext = false;
+
+ // make sure we have all NS declarations handy before we start
+ int length = atts.getLength ();
+
+ for (int i = 0; i < length; i++) {
+ String aName = atts.getQName (i);
+
+ if (!aName.startsWith ("xmlns"))
+ continue;
+
+ String prefix;
+
+ if ("xmlns".equals (aName))
+ prefix = "";
+ else if (aName.indexOf (':') == 5)
+ prefix = aName.substring (6);
+ else // "xmlnsfoo" etc.
+ continue;
+ startPrefixMapping (prefix, atts.getValue (i));
+ }
+
+ // put namespace decls at the start of our regenned attlist
+ attributes.clear ();
+ for (Enumeration e = nsStack.getDeclaredPrefixes ();
+ e.hasMoreElements ();
+ /* NOP */) {
+ String prefix = (String) e.nextElement ();
+
+ attributes.addAttribute ("", "",
+ ("".equals (prefix)
+ ? "xmlns"
+ : "xmlns:" + prefix),
+ "CDATA",
+ nsStack.getURI (prefix));
+ }
+
+ // name fixups: element, then attributes.
+ // fixName may declare a new prefix or, for the element,
+ // redeclare the default (if element name needs it).
+ qName = fixName (uri, localName, qName, false);
+
+ for (int i = 0; i < length; i++) {
+ String aName = atts.getQName (i);
+ String aNS = atts.getURI (i);
+ String aLocal = atts.getLocalName (i);
+ String aType = atts.getType (i);
+ String aValue = atts.getValue (i);
+
+ if (aName.startsWith ("xmlns"))
+ continue;
+ aName = fixName (aNS, aLocal, aName, true);
+ attributes.addAttribute (aNS, aLocal, aName, aType, aValue);
+ }
+
+ elementStack.push (qName);
+
+ // pass event along, with cleaned-up names and decls.
+ super.startElement (uri, localName, qName, attributes);
}
public void endElement (String uri, String localName, String qName)
throws SAXException
{
- nsStack.popContext ();
- qName = (String) elementStack.pop ();
- super.endElement (uri, localName, qName);
+ nsStack.popContext ();
+ qName = (String) elementStack.pop ();
+ super.endElement (uri, localName, qName);
}
/**
@@ -330,12 +330,12 @@ public class NSFilter extends EventFilter
*/
public void endPrefixMapping (String prefix)
throws SAXException
- { }
+ { }
public void endDocument () throws SAXException
{
- elementStack.removeAllElements ();
- nsStack.reset ();
- super.endDocument ();
+ elementStack.removeAllElements ();
+ nsStack.reset ();
+ super.endDocument ();
}
}
diff --git a/gnu/xml/pipeline/PipelineFactory.java b/gnu/xml/pipeline/PipelineFactory.java
index f88ab1643..c2adab021 100644
--- a/gnu/xml/pipeline/PipelineFactory.java
+++ b/gnu/xml/pipeline/PipelineFactory.java
@@ -1,4 +1,4 @@
-/* PipelineFactory.java --
+/* PipelineFactory.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -69,120 +69,120 @@ import org.xml.sax.ext.*;
* The stage identifiers are either class names, or are one of the following
* short identifiers built into this class. (Most of these identifiers are
* no more than aliases for classes.) The built-in identifiers include:</p>
-
+
<table border="1" cellpadding="3" cellspacing="0">
<tr bgcolor="#ccccff" class="TableHeadingColor">
- <th align="center" width="5%">Stage</th>
- <th align="center" width="9%">Parameter</th>
- <th align="center" width="1%">Terminus</th>
- <th align="center">Description</th>
+ <th align="center" width="5%">Stage</th>
+ <th align="center" width="9%">Parameter</th>
+ <th align="center" width="1%">Terminus</th>
+ <th align="center">Description</th>
</tr>
<tr valign="top" align="center">
- <td><a href="../dom/Consumer.html">dom</a></td>
- <td><em>none</em></td>
- <td> yes </td>
- <td align="left"> Applications code can access a DOM Document built
- from the input event stream. When used as a filter, this buffers
- data up to an <em>endDocument</em> call, and then uses a DOM parser
- to report everything that has been recorded (which can easily be
- less than what was reported to it). </td>
+ <td><a href="../dom/Consumer.html">dom</a></td>
+ <td><em>none</em></td>
+ <td> yes </td>
+ <td align="left"> Applications code can access a DOM Document built
+ from the input event stream. When used as a filter, this buffers
+ data up to an <em>endDocument</em> call, and then uses a DOM parser
+ to report everything that has been recorded (which can easily be
+ less than what was reported to it). </td>
</tr>
<tr valign="top" align="center">
- <td><a href="NSFilter.html">nsfix</a></td>
- <td><em>none</em></td>
- <td>no</td>
- <td align="left">This stage ensures that the XML element and attribute
- names in its output use namespace prefixes and declarations correctly.
- That is, so that they match the "Namespace plus LocalName" naming data
- with which each XML element and attribute is already associated. </td>
+ <td><a href="NSFilter.html">nsfix</a></td>
+ <td><em>none</em></td>
+ <td>no</td>
+ <td align="left">This stage ensures that the XML element and attribute
+ names in its output use namespace prefixes and declarations correctly.
+ That is, so that they match the "Namespace plus LocalName" naming data
+ with which each XML element and attribute is already associated. </td>
</tr>
<tr valign="top" align="center">
- <td><a href="EventFilter.html">null</a></td>
- <td><em>none</em></td>
- <td>yes</td>
- <td align="left">This stage ignores all input event data.</td>
+ <td><a href="EventFilter.html">null</a></td>
+ <td><em>none</em></td>
+ <td>yes</td>
+ <td align="left">This stage ignores all input event data.</td>
</tr>
<tr valign="top" align="center">
- <td><a href="CallFilter.html">server</a></td>
- <td><em>required</em><br> server URL </td>
- <td>no</td>
- <td align="left">Sends its input as XML request to a remote server,
- normally a web application server using the HTTP or HTTPS protocols.
- The output of this stage is the parsed response from that server.</td>
+ <td><a href="CallFilter.html">server</a></td>
+ <td><em>required</em><br> server URL </td>
+ <td>no</td>
+ <td align="left">Sends its input as XML request to a remote server,
+ normally a web application server using the HTTP or HTTPS protocols.
+ The output of this stage is the parsed response from that server.</td>
</tr>
<tr valign="top" align="center">
- <td><a href="TeeConsumer.html">tee</a></td>
- <td><em>required</em><br> first pipeline</td>
- <td>no</td>
- <td align="left">This sends its events down two paths; its parameter
- is a pipeline descriptor for the first path, and the second path
- is the output of this stage.</td>
+ <td><a href="TeeConsumer.html">tee</a></td>
+ <td><em>required</em><br> first pipeline</td>
+ <td>no</td>
+ <td align="left">This sends its events down two paths; its parameter
+ is a pipeline descriptor for the first path, and the second path
+ is the output of this stage.</td>
</tr>
<tr valign="top" align="center">
- <td><a href="ValidationConsumer.html">validate</a></td>
- <td><em>none</em></td>
- <td>yes</td>
- <td align="left">This checks for validity errors, and reports them
- through its error handler. The input must include declaration events
- and some lexical events. </td>
+ <td><a href="ValidationConsumer.html">validate</a></td>
+ <td><em>none</em></td>
+ <td>yes</td>
+ <td align="left">This checks for validity errors, and reports them
+ through its error handler. The input must include declaration events
+ and some lexical events. </td>
</tr>
<tr valign="top" align="center">
- <td><a href="WellFormednessFilter.html">wf</a></td>
- <td><em>none</em></td>
- <td>yes</td>
- <td align="left"> This class provides some basic "well formedness"
- tests on the input event stream, and reports a fatal error if any
- of them fail. One example: start/end calls for elements must match.
- No SAX parser is permitted to produce malformed output, but other
- components can easily do so.</td>
+ <td><a href="WellFormednessFilter.html">wf</a></td>
+ <td><em>none</em></td>
+ <td>yes</td>
+ <td align="left"> This class provides some basic "well formedness"
+ tests on the input event stream, and reports a fatal error if any
+ of them fail. One example: start/end calls for elements must match.
+ No SAX parser is permitted to produce malformed output, but other
+ components can easily do so.</td>
</tr>
<tr valign="top" align="center">
- <td>write</td>
- <td><em>required</em><br> "stdout", "stderr", or filename</td>
- <td>yes</td>
- <td align="left"> Writes its input to the specified output, as pretty
- printed XML text encoded using UTF-8. Input events must be well
- formed and "namespace fixed", else the output won't be XML (or possibly
- namespace) conformant. The symbolic names represent
- <em>System.out</em> and <em>System.err</em> respectively; names must
- correspond to files which don't yet exist.</td>
+ <td>write</td>
+ <td><em>required</em><br> "stdout", "stderr", or filename</td>
+ <td>yes</td>
+ <td align="left"> Writes its input to the specified output, as pretty
+ printed XML text encoded using UTF-8. Input events must be well
+ formed and "namespace fixed", else the output won't be XML (or possibly
+ namespace) conformant. The symbolic names represent
+ <em>System.out</em> and <em>System.err</em> respectively; names must
+ correspond to files which don't yet exist.</td>
</tr>
<tr valign="top" align="center">
- <td>xhtml</td>
- <td><em>required</em><br> "stdout", "stderr", or filename</td>
- <td>yes</td>
- <td align="left"> Like <em>write</em> (above), except that XHTML rules
- are followed. The XHTML 1.0 Transitional document type is declared,
- and only ASCII characters are written (for interoperability). Other
- characters are written as entity or character references; the text is
- pretty printed.</td>
+ <td>xhtml</td>
+ <td><em>required</em><br> "stdout", "stderr", or filename</td>
+ <td>yes</td>
+ <td align="left"> Like <em>write</em> (above), except that XHTML rules
+ are followed. The XHTML 1.0 Transitional document type is declared,
+ and only ASCII characters are written (for interoperability). Other
+ characters are written as entity or character references; the text is
+ pretty printed.</td>
</tr>
<tr valign="top" align="center">
- <td><a href="XIncludeFilter.html">xinclude</a></td>
- <td><em>none</em></td>
- <td>no</td>
- <td align="left">This stage handles XInclude processing.
- This is like entity inclusion, except that the included content
- is declared in-line rather than in the DTD at the beginning of
- a document.
- </td>
+ <td><a href="XIncludeFilter.html">xinclude</a></td>
+ <td><em>none</em></td>
+ <td>no</td>
+ <td align="left">This stage handles XInclude processing.
+ This is like entity inclusion, except that the included content
+ is declared in-line rather than in the DTD at the beginning of
+ a document.
+ </td>
</tr>
<tr valign="top" align="center">
- <td><a href="XsltFilter.html">xslt</a></td>
- <td><em>required</em><br> XSLT stylesheet URI</td>
- <td>no</td>
- <td align="left">This stage handles XSLT transformation
- according to a stylesheet.
- The implementation of the transformation may not actually
- stream data, although if such an XSLT engine is in use
- then that can happen.
- </td>
+ <td><a href="XsltFilter.html">xslt</a></td>
+ <td><em>required</em><br> XSLT stylesheet URI</td>
+ <td>no</td>
+ <td align="left">This stage handles XSLT transformation
+ according to a stylesheet.
+ The implementation of the transformation may not actually
+ stream data, although if such an XSLT engine is in use
+ then that can happen.
+ </td>
</tr>
</table>
-
+
* <p> Note that {@link EventFilter#bind} can automatically eliminate
* some filters by setting SAX2 parser features appropriately. This means
* that you can routinely put filters like "nsfix", "validate", or "wf" at the
@@ -200,7 +200,7 @@ public class PipelineFactory
public static EventConsumer createPipeline (String description)
throws IOException
{
- return createPipeline (description, null);
+ return createPipeline (description, null);
}
/**
@@ -211,25 +211,25 @@ public class PipelineFactory
* segments with easily configured ones.
*/
public static EventConsumer createPipeline (
- String description,
- EventConsumer next
+ String description,
+ EventConsumer next
) throws IOException
{
- // tokens are (for now) what's separated by whitespace;
- // very easy to parse, but IDs never have spaces.
+ // tokens are (for now) what's separated by whitespace;
+ // very easy to parse, but IDs never have spaces.
- StringTokenizer tokenizer;
- String tokens [];
+ StringTokenizer tokenizer;
+ String tokens [];
- tokenizer = new StringTokenizer (description);
- tokens = new String [tokenizer.countTokens ()];
- for (int i = 0; i < tokens.length; i++)
- tokens [i] = tokenizer.nextToken ();
+ tokenizer = new StringTokenizer (description);
+ tokens = new String [tokenizer.countTokens ()];
+ for (int i = 0; i < tokens.length; i++)
+ tokens [i] = tokenizer.nextToken ();
- PipelineFactory factory = new PipelineFactory ();
- Pipeline pipeline = factory.parsePipeline (tokens, next);
+ PipelineFactory factory = new PipelineFactory ();
+ Pipeline pipeline = factory.parsePipeline (tokens, next);
- return pipeline.createPipeline ();
+ return pipeline.createPipeline ();
}
@@ -242,70 +242,70 @@ public class PipelineFactory
* predefined aliases) left and right parenthesis, and the vertical bar.
*/
public static EventConsumer createPipeline (
- String tokens [],
- EventConsumer next
+ String tokens [],
+ EventConsumer next
) throws IOException
{
- PipelineFactory factory = new PipelineFactory ();
- Pipeline pipeline = factory.parsePipeline (tokens, next);
+ PipelineFactory factory = new PipelineFactory ();
+ Pipeline pipeline = factory.parsePipeline (tokens, next);
- return pipeline.createPipeline ();
+ return pipeline.createPipeline ();
}
- private String tokens [];
- private int index;
+ private String tokens [];
+ private int index;
private Pipeline parsePipeline (String toks [], EventConsumer next)
{
- tokens = toks;
- index = 0;
-
- Pipeline retval = parsePipeline (next);
-
- if (index != toks.length)
- throw new ArrayIndexOutOfBoundsException (
- "extra token: " + tokens [index]);
- return retval;
+ tokens = toks;
+ index = 0;
+
+ Pipeline retval = parsePipeline (next);
+
+ if (index != toks.length)
+ throw new ArrayIndexOutOfBoundsException (
+ "extra token: " + tokens [index]);
+ return retval;
}
// pipeline ::= stage | stage '|' pipeline
private Pipeline parsePipeline (EventConsumer next)
{
- Pipeline retval = new Pipeline (parseStage ());
-
- // minimal pipelines: "stage" and "... | id"
- if (index > (tokens.length - 2)
- || !"|".equals (tokens [index])
- ) {
- retval.next = next;
- return retval;
- }
- index++;
- retval.rest = parsePipeline (next);
- return retval;
+ Pipeline retval = new Pipeline (parseStage ());
+
+ // minimal pipelines: "stage" and "... | id"
+ if (index > (tokens.length - 2)
+ || !"|".equals (tokens [index])
+ ) {
+ retval.next = next;
+ return retval;
+ }
+ index++;
+ retval.rest = parsePipeline (next);
+ return retval;
}
// stage ::= id | id '(' pipeline ')'
private Stage parseStage ()
{
- Stage retval = new Stage (tokens [index++]);
-
- // minimal stages: "id" and "id ( id )"
- if (index > (tokens.length - 2)
- || !"(".equals (tokens [index]) /*)*/
- )
- return retval;
-
- index++;
- retval.param = parsePipeline (null);
- if (index >= tokens.length)
- throw new ArrayIndexOutOfBoundsException (
- "missing right paren");
- if (/*(*/ !")".equals (tokens [index++]))
- throw new ArrayIndexOutOfBoundsException (
- "required right paren, not: " + tokens [index - 1]);
- return retval;
+ Stage retval = new Stage (tokens [index++]);
+
+ // minimal stages: "id" and "id ( id )"
+ if (index > (tokens.length - 2)
+ || !"(".equals (tokens [index]) /*)*/
+ )
+ return retval;
+
+ index++;
+ retval.param = parsePipeline (null);
+ if (index >= tokens.length)
+ throw new ArrayIndexOutOfBoundsException (
+ "missing right paren");
+ if (/*(*/ !")".equals (tokens [index++]))
+ throw new ArrayIndexOutOfBoundsException (
+ "required right paren, not: " + tokens [index - 1]);
+ return retval;
}
@@ -313,12 +313,12 @@ public class PipelineFactory
// these classes obey the conventions for constructors, so they're
// only built in to this table of shortnames
//
- // - filter (one or two types of arglist)
- // * last constructor is 'next' element
- // * optional (first) string parameter
+ // - filter (one or two types of arglist)
+ // * last constructor is 'next' element
+ // * optional (first) string parameter
//
- // - terminus (one or types of arglist)
- // * optional (only) string parameter
+ // - terminus (one or types of arglist)
+ // * optional (only) string parameter
//
// terminus stages are transformed into filters if needed, by
// creating a "tee". filter stages aren't turned to terminus
@@ -326,397 +326,397 @@ public class PipelineFactory
// terminus explicitly.
//
private static final String builtinStages [][] = {
- { "dom", "gnu.xml.dom.Consumer" },
- { "nsfix", "gnu.xml.pipeline.NSFilter" },
- { "null", "gnu.xml.pipeline.EventFilter" },
- { "server", "gnu.xml.pipeline.CallFilter" },
- { "tee", "gnu.xml.pipeline.TeeConsumer" },
- { "validate", "gnu.xml.pipeline.ValidationConsumer" },
- { "wf", "gnu.xml.pipeline.WellFormednessFilter" },
- { "xinclude", "gnu.xml.pipeline.XIncludeFilter" },
- { "xslt", "gnu.xml.pipeline.XsltFilter" },
+ { "dom", "gnu.xml.dom.Consumer" },
+ { "nsfix", "gnu.xml.pipeline.NSFilter" },
+ { "null", "gnu.xml.pipeline.EventFilter" },
+ { "server", "gnu.xml.pipeline.CallFilter" },
+ { "tee", "gnu.xml.pipeline.TeeConsumer" },
+ { "validate", "gnu.xml.pipeline.ValidationConsumer" },
+ { "wf", "gnu.xml.pipeline.WellFormednessFilter" },
+ { "xinclude", "gnu.xml.pipeline.XIncludeFilter" },
+ { "xslt", "gnu.xml.pipeline.XsltFilter" },
// XXX want: option for validate, to preload external part of a DTD
- // xhtml, write ... nyet generic-ready
+ // xhtml, write ... nyet generic-ready
};
private static class Stage
{
- String id;
- Pipeline param;
-
- Stage (String name)
- { id = name; }
-
- public String toString ()
- {
- if (param == null)
- return id;
- return id + " ( " + param + " )";
- }
-
- private void fail (String message)
- throws IOException
- {
- throw new IOException ("in '" + id
- + "' stage of pipeline, " + message);
- }
-
- EventConsumer createStage (EventConsumer next)
- throws IOException
- {
- String name = id;
-
- // most builtins are just class aliases
- for (int i = 0; i < builtinStages.length; i++) {
- if (id.equals (builtinStages [i][0])) {
- name = builtinStages [i][1];
- break;
- }
- }
-
- // Save output as XML or XHTML text
- if ("write".equals (name) || "xhtml".equals (name)) {
- String filename;
- boolean isXhtml = "xhtml".equals (name);
- OutputStream out = null;
- TextConsumer consumer;
-
- if (param == null)
- fail ("parameter is required");
-
- filename = param.toString ();
- if ("stdout".equals (filename))
- out = System.out;
- else if ("stderr".equals (filename))
- out = System.err;
- else {
- File f = new File (filename);
+ String id;
+ Pipeline param;
+
+ Stage (String name)
+ { id = name; }
+
+ public String toString ()
+ {
+ if (param == null)
+ return id;
+ return id + " ( " + param + " )";
+ }
+
+ private void fail (String message)
+ throws IOException
+ {
+ throw new IOException ("in '" + id
+ + "' stage of pipeline, " + message);
+ }
+
+ EventConsumer createStage (EventConsumer next)
+ throws IOException
+ {
+ String name = id;
+
+ // most builtins are just class aliases
+ for (int i = 0; i < builtinStages.length; i++) {
+ if (id.equals (builtinStages [i][0])) {
+ name = builtinStages [i][1];
+ break;
+ }
+ }
+
+ // Save output as XML or XHTML text
+ if ("write".equals (name) || "xhtml".equals (name)) {
+ String filename;
+ boolean isXhtml = "xhtml".equals (name);
+ OutputStream out = null;
+ TextConsumer consumer;
+
+ if (param == null)
+ fail ("parameter is required");
+
+ filename = param.toString ();
+ if ("stdout".equals (filename))
+ out = System.out;
+ else if ("stderr".equals (filename))
+ out = System.err;
+ else {
+ File f = new File (filename);
/*
- if (!f.isAbsolute ())
- fail ("require absolute file paths");
+ if (!f.isAbsolute ())
+ fail ("require absolute file paths");
*/
- if (f.exists ())
- fail ("file already exists: " + f.getName ());
+ if (f.exists ())
+ fail ("file already exists: " + f.getName ());
// XXX this races against the existence test
- out = new FileOutputStream (f);
- }
-
- if (!isXhtml)
- consumer = new TextConsumer (out);
- else
- consumer = new TextConsumer (
- new OutputStreamWriter (out, "8859_1"),
- true);
-
- consumer.setPrettyPrinting (true);
- if (next == null)
- return consumer;
- return new TeeConsumer (consumer, next);
-
- } else {
- //
- // Here go all the builtins that are just aliases for
- // classes, and all stage IDs that started out as such
- // class names. The following logic relies on several
- // documented conventions for constructor invocation.
- //
- String msg = null;
-
- try {
- Class klass = Class.forName (name);
- Class argTypes [] = null;
- Constructor constructor = null;
- boolean filter = false;
- Object params [] = null;
- Object obj = null;
-
- // do we need a filter stage?
- if (next != null) {
- // "next" consumer is always passed, with
- // or without the optional string param
- if (param == null) {
- argTypes = new Class [1];
- argTypes [0] = EventConsumer.class;
-
- params = new Object [1];
- params [0] = next;
-
- msg = "no-param filter";
- } else {
- argTypes = new Class [2];
- argTypes [0] = String.class;
- argTypes [1] = EventConsumer.class;
-
- params = new Object [2];
- params [0] = param.toString ();
- params [1] = next;
-
- msg = "one-param filter";
- }
-
-
- try {
- constructor = klass.getConstructor (argTypes);
- } catch (NoSuchMethodException e) {
- // try creating a filter from a
- // terminus and a tee
- filter = true;
- msg += " built from ";
- }
- }
-
- // build from a terminus stage, with or
- // without the optional string param
- if (constructor == null) {
- String tmp;
-
- if (param == null) {
- argTypes = new Class [0];
- params = new Object [0];
-
- tmp = "no-param terminus";
- } else {
- argTypes = new Class [1];
- argTypes [0] = String.class;
-
- params = new Object [1];
- params [0] = param.toString ();
-
- tmp = "one-param terminus";
- }
- if (msg == null)
- msg = tmp;
- else
- msg += tmp;
- constructor = klass.getConstructor (argTypes);
- // NOT creating terminus by dead-ending
- // filters ... users should think about
- // that one, something's likely wrong
- }
-
- obj = constructor.newInstance (params);
-
- // return EventConsumers directly, perhaps after
- // turning them into a filter
- if (obj instanceof EventConsumer) {
- if (filter)
- return new TeeConsumer ((EventConsumer) obj, next);
- return (EventConsumer) obj;
- }
-
- // if it's not a handler, it's an error
- // we can wrap handlers in a filter
- EventFilter retval = new EventFilter ();
- boolean updated = false;
-
- if (obj instanceof ContentHandler) {
- retval.setContentHandler ((ContentHandler) obj);
- updated = true;
- }
- if (obj instanceof DTDHandler) {
- retval.setDTDHandler ((DTDHandler) obj);
- updated = true;
- }
- if (obj instanceof LexicalHandler) {
- retval.setProperty (
- EventFilter.PROPERTY_URI + "lexical-handler",
- obj);
- updated = true;
- }
- if (obj instanceof DeclHandler) {
- retval.setProperty (
- EventFilter.PROPERTY_URI + "declaration-handler",
- obj);
- updated = true;
- }
-
- if (!updated)
- fail ("class is neither Consumer nor Handler");
-
- if (filter)
- return new TeeConsumer (retval, next);
- return retval;
-
- } catch (IOException e) {
- throw e;
-
- } catch (NoSuchMethodException e) {
- fail (name + " constructor missing -- " + msg);
-
- } catch (ClassNotFoundException e) {
- fail (name + " class not found");
-
- } catch (Exception e) {
- // e.printStackTrace ();
- fail ("stage not available: " + e.getMessage ());
- }
- }
- // NOTREACHED
- return null;
- }
+ out = new FileOutputStream (f);
+ }
+
+ if (!isXhtml)
+ consumer = new TextConsumer (out);
+ else
+ consumer = new TextConsumer (
+ new OutputStreamWriter (out, "8859_1"),
+ true);
+
+ consumer.setPrettyPrinting (true);
+ if (next == null)
+ return consumer;
+ return new TeeConsumer (consumer, next);
+
+ } else {
+ //
+ // Here go all the builtins that are just aliases for
+ // classes, and all stage IDs that started out as such
+ // class names. The following logic relies on several
+ // documented conventions for constructor invocation.
+ //
+ String msg = null;
+
+ try {
+ Class klass = Class.forName (name);
+ Class argTypes [] = null;
+ Constructor constructor = null;
+ boolean filter = false;
+ Object params [] = null;
+ Object obj = null;
+
+ // do we need a filter stage?
+ if (next != null) {
+ // "next" consumer is always passed, with
+ // or without the optional string param
+ if (param == null) {
+ argTypes = new Class [1];
+ argTypes [0] = EventConsumer.class;
+
+ params = new Object [1];
+ params [0] = next;
+
+ msg = "no-param filter";
+ } else {
+ argTypes = new Class [2];
+ argTypes [0] = String.class;
+ argTypes [1] = EventConsumer.class;
+
+ params = new Object [2];
+ params [0] = param.toString ();
+ params [1] = next;
+
+ msg = "one-param filter";
+ }
+
+
+ try {
+ constructor = klass.getConstructor (argTypes);
+ } catch (NoSuchMethodException e) {
+ // try creating a filter from a
+ // terminus and a tee
+ filter = true;
+ msg += " built from ";
+ }
+ }
+
+ // build from a terminus stage, with or
+ // without the optional string param
+ if (constructor == null) {
+ String tmp;
+
+ if (param == null) {
+ argTypes = new Class [0];
+ params = new Object [0];
+
+ tmp = "no-param terminus";
+ } else {
+ argTypes = new Class [1];
+ argTypes [0] = String.class;
+
+ params = new Object [1];
+ params [0] = param.toString ();
+
+ tmp = "one-param terminus";
+ }
+ if (msg == null)
+ msg = tmp;
+ else
+ msg += tmp;
+ constructor = klass.getConstructor (argTypes);
+ // NOT creating terminus by dead-ending
+ // filters ... users should think about
+ // that one, something's likely wrong
+ }
+
+ obj = constructor.newInstance (params);
+
+ // return EventConsumers directly, perhaps after
+ // turning them into a filter
+ if (obj instanceof EventConsumer) {
+ if (filter)
+ return new TeeConsumer ((EventConsumer) obj, next);
+ return (EventConsumer) obj;
+ }
+
+ // if it's not a handler, it's an error
+ // we can wrap handlers in a filter
+ EventFilter retval = new EventFilter ();
+ boolean updated = false;
+
+ if (obj instanceof ContentHandler) {
+ retval.setContentHandler ((ContentHandler) obj);
+ updated = true;
+ }
+ if (obj instanceof DTDHandler) {
+ retval.setDTDHandler ((DTDHandler) obj);
+ updated = true;
+ }
+ if (obj instanceof LexicalHandler) {
+ retval.setProperty (
+ EventFilter.PROPERTY_URI + "lexical-handler",
+ obj);
+ updated = true;
+ }
+ if (obj instanceof DeclHandler) {
+ retval.setProperty (
+ EventFilter.PROPERTY_URI + "declaration-handler",
+ obj);
+ updated = true;
+ }
+
+ if (!updated)
+ fail ("class is neither Consumer nor Handler");
+
+ if (filter)
+ return new TeeConsumer (retval, next);
+ return retval;
+
+ } catch (IOException e) {
+ throw e;
+
+ } catch (NoSuchMethodException e) {
+ fail (name + " constructor missing -- " + msg);
+
+ } catch (ClassNotFoundException e) {
+ fail (name + " class not found");
+
+ } catch (Exception e) {
+ // e.printStackTrace ();
+ fail ("stage not available: " + e.getMessage ());
+ }
+ }
+ // NOTREACHED
+ return null;
+ }
}
private static class Pipeline
{
- Stage stage;
-
- // rest may be null
- Pipeline rest;
- EventConsumer next;
-
- Pipeline (Stage s)
- { stage = s; }
-
- public String toString ()
- {
- if (rest == null && next == null)
- return stage.toString ();
- if (rest != null)
- return stage + " | " + rest;
- throw new IllegalArgumentException ("next");
- }
-
- EventConsumer createPipeline ()
- throws IOException
- {
- if (next == null) {
- if (rest == null)
- next = stage.createStage (null);
- else
- next = stage.createStage (rest.createPipeline ());
- }
- return next;
- }
+ Stage stage;
+
+ // rest may be null
+ Pipeline rest;
+ EventConsumer next;
+
+ Pipeline (Stage s)
+ { stage = s; }
+
+ public String toString ()
+ {
+ if (rest == null && next == null)
+ return stage.toString ();
+ if (rest != null)
+ return stage + " | " + rest;
+ throw new IllegalArgumentException ("next");
+ }
+
+ EventConsumer createPipeline ()
+ throws IOException
+ {
+ if (next == null) {
+ if (rest == null)
+ next = stage.createStage (null);
+ else
+ next = stage.createStage (rest.createPipeline ());
+ }
+ return next;
+ }
}
/*
public static void main (String argv [])
{
- try {
- // three basic terminus cases
- createPipeline ("null");
- createPipeline ("validate");
- createPipeline ("write ( stdout )");
-
- // four basic filters
- createPipeline ("nsfix | write ( stderr )");
- createPipeline ("wf | null");
- createPipeline ("null | null");
- createPipeline (
+ try {
+ // three basic terminus cases
+ createPipeline ("null");
+ createPipeline ("validate");
+ createPipeline ("write ( stdout )");
+
+ // four basic filters
+ createPipeline ("nsfix | write ( stderr )");
+ createPipeline ("wf | null");
+ createPipeline ("null | null");
+ createPipeline (
"call ( http://www.example.com/services/xml-1a ) | xhtml ( stdout )");
- // tee junctions
- createPipeline ("tee ( validate ) | write ( stdout )");
- createPipeline ("tee ( nsfix | write ( stdout ) ) | validate");
-
- // longer pipeline
- createPipeline ("nsfix | tee ( validate ) | write ( stdout )");
- createPipeline (
- "null | wf | nsfix | tee ( validate ) | write ( stdout )");
-
- // try some parsing error cases
- try {
- createPipeline ("null ("); // extra token '('
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("nsfix |"); // extra token '|'
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("xhtml ( foo"); // missing right paren
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("xhtml ( foo bar"); // required right paren
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("tee ( nsfix | validate");// missing right paren
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- // try some construction error cases
-
- try {
- createPipeline ("call"); // missing param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("call ( foobar )"); // broken param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("nsfix ( foobar )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("null ( foobar )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("wf ( foobar )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("xhtml ( foobar.html )");
- new File ("foobar.html").delete ();
- // now supported
- } catch (Exception e) {
- System.err.println ("** err: " + e.getMessage ()); }
- try {
- createPipeline ("xhtml"); // missing param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("write ( stdout ) | null"); // nonterminal
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("validate | null");
- // now supported
- } catch (Exception e) {
- System.err.println ("** err: " + e.getMessage ()); }
- try {
- createPipeline ("validate ( foo )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("tee"); // missing param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- // only builtins so far
- createPipeline ("com.example.xml.FilterClass");
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- } catch (Exception e) {
- e.printStackTrace ();
- }
+ // tee junctions
+ createPipeline ("tee ( validate ) | write ( stdout )");
+ createPipeline ("tee ( nsfix | write ( stdout ) ) | validate");
+
+ // longer pipeline
+ createPipeline ("nsfix | tee ( validate ) | write ( stdout )");
+ createPipeline (
+ "null | wf | nsfix | tee ( validate ) | write ( stdout )");
+
+ // try some parsing error cases
+ try {
+ createPipeline ("null ("); // extra token '('
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+
+ try {
+ createPipeline ("nsfix |"); // extra token '|'
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+
+ try {
+ createPipeline ("xhtml ( foo"); // missing right paren
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+
+ try {
+ createPipeline ("xhtml ( foo bar"); // required right paren
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+
+ try {
+ createPipeline ("tee ( nsfix | validate");// missing right paren
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+
+ // try some construction error cases
+
+ try {
+ createPipeline ("call"); // missing param
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+ try {
+ createPipeline ("call ( foobar )"); // broken param
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+ try {
+ createPipeline ("nsfix ( foobar )"); // illegal param
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+ try {
+ createPipeline ("null ( foobar )"); // illegal param
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+ try {
+ createPipeline ("wf ( foobar )"); // illegal param
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+ try {
+ createPipeline ("xhtml ( foobar.html )");
+ new File ("foobar.html").delete ();
+ // now supported
+ } catch (Exception e) {
+ System.err.println ("** err: " + e.getMessage ()); }
+ try {
+ createPipeline ("xhtml"); // missing param
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+ try {
+ createPipeline ("write ( stdout ) | null"); // nonterminal
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+ try {
+ createPipeline ("validate | null");
+ // now supported
+ } catch (Exception e) {
+ System.err.println ("** err: " + e.getMessage ()); }
+ try {
+ createPipeline ("validate ( foo )"); // illegal param
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+ try {
+ createPipeline ("tee"); // missing param
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+ try {
+ // only builtins so far
+ createPipeline ("com.example.xml.FilterClass");
+ System.err.println ("** didn't report error");
+ } catch (Exception e) {
+ System.err.println ("== err: " + e.getMessage ()); }
+
+ } catch (Exception e) {
+ e.printStackTrace ();
+ }
}
/**/
diff --git a/gnu/xml/pipeline/TeeConsumer.java b/gnu/xml/pipeline/TeeConsumer.java
index 8186de4df..3ac860575 100644
--- a/gnu/xml/pipeline/TeeConsumer.java
+++ b/gnu/xml/pipeline/TeeConsumer.java
@@ -1,4 +1,4 @@
-/* TeeConsumer.java --
+/* TeeConsumer.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -68,16 +68,16 @@ import org.xml.sax.ext.LexicalHandler;
* @author David Brownell
*/
final public class TeeConsumer
- implements EventConsumer,
- ContentHandler, DTDHandler,
- LexicalHandler,DeclHandler
+ implements EventConsumer,
+ ContentHandler, DTDHandler,
+ LexicalHandler,DeclHandler
{
- private EventConsumer first, rest;
+ private EventConsumer first, rest;
// cached to minimize time overhead
- private ContentHandler docFirst, docRest;
- private DeclHandler declFirst, declRest;
- private LexicalHandler lexFirst, lexRest;
+ private ContentHandler docFirst, docRest;
+ private DeclHandler declFirst, declRest;
+ private LexicalHandler lexFirst, lexRest;
/**
@@ -91,39 +91,39 @@ final public class TeeConsumer
*/
public TeeConsumer (EventConsumer car, EventConsumer cdr)
{
- if (car == null || cdr == null)
- throw new NullPointerException ();
- first = car;
- rest = cdr;
-
- //
- // Cache the handlers.
- //
- docFirst = first.getContentHandler ();
- docRest = rest.getContentHandler ();
- // DTD handler isn't cached (rarely needed)
-
- try {
- declFirst = null;
- declFirst = (DeclHandler) first.getProperty (
- EventFilter.DECL_HANDLER);
- } catch (SAXException e) {}
- try {
- declRest = null;
- declRest = (DeclHandler) rest.getProperty (
- EventFilter.DECL_HANDLER);
- } catch (SAXException e) {}
-
- try {
- lexFirst = null;
- lexFirst = (LexicalHandler) first.getProperty (
- EventFilter.LEXICAL_HANDLER);
- } catch (SAXException e) {}
- try {
- lexRest = null;
- lexRest = (LexicalHandler) rest.getProperty (
- EventFilter.LEXICAL_HANDLER);
- } catch (SAXException e) {}
+ if (car == null || cdr == null)
+ throw new NullPointerException ();
+ first = car;
+ rest = cdr;
+
+ //
+ // Cache the handlers.
+ //
+ docFirst = first.getContentHandler ();
+ docRest = rest.getContentHandler ();
+ // DTD handler isn't cached (rarely needed)
+
+ try {
+ declFirst = null;
+ declFirst = (DeclHandler) first.getProperty (
+ EventFilter.DECL_HANDLER);
+ } catch (SAXException e) {}
+ try {
+ declRest = null;
+ declRest = (DeclHandler) rest.getProperty (
+ EventFilter.DECL_HANDLER);
+ } catch (SAXException e) {}
+
+ try {
+ lexFirst = null;
+ lexFirst = (LexicalHandler) first.getProperty (
+ EventFilter.LEXICAL_HANDLER);
+ } catch (SAXException e) {}
+ try {
+ lexRest = null;
+ lexRest = (LexicalHandler) rest.getProperty (
+ EventFilter.LEXICAL_HANDLER);
+ } catch (SAXException e) {}
}
/* FIXME
@@ -132,78 +132,78 @@ final public class TeeConsumer
* two-consumer constructor for this class.
*
* @param first Description of the first pipeline to get events,
- * which will be passed to {@link PipelineFactory#createPipeline}
+ * which will be passed to {@link PipelineFactory#createPipeline}
* @param rest The second pipeline to get the events
* /
- // constructor used by PipelineFactory
+ // constructor used by PipelineFactory
public TeeConsumer (String first, EventConsumer rest)
throws IOException
{
- this (PipelineFactory.createPipeline (first), rest);
+ this (PipelineFactory.createPipeline (first), rest);
}
*/
/** Returns the first pipeline to get event calls. */
public EventConsumer getFirst ()
- { return first; }
+ { return first; }
/** Returns the second pipeline to get event calls. */
public EventConsumer getRest ()
- { return rest; }
+ { return rest; }
/** Returns the content handler being used. */
final public ContentHandler getContentHandler ()
{
- if (docRest == null)
- return docFirst;
- if (docFirst == null)
- return docRest;
- return this;
+ if (docRest == null)
+ return docFirst;
+ if (docFirst == null)
+ return docRest;
+ return this;
}
/** Returns the dtd handler being used. */
final public DTDHandler getDTDHandler ()
{
- // not cached (hardly used)
- if (rest.getDTDHandler () == null)
- return first.getDTDHandler ();
- if (first.getDTDHandler () == null)
- return rest.getDTDHandler ();
- return this;
+ // not cached (hardly used)
+ if (rest.getDTDHandler () == null)
+ return first.getDTDHandler ();
+ if (first.getDTDHandler () == null)
+ return rest.getDTDHandler ();
+ return this;
}
/** Returns the declaration or lexical handler being used. */
final public Object getProperty (String id)
throws SAXNotRecognizedException
{
- //
- // in degenerate cases, we have no work to do.
- //
- Object firstProp = null, restProp = null;
-
- try { firstProp = first.getProperty (id); }
- catch (SAXNotRecognizedException e) { /* ignore */ }
- try { restProp = rest.getProperty (id); }
- catch (SAXNotRecognizedException e) { /* ignore */ }
-
- if (restProp == null)
- return firstProp;
- if (firstProp == null)
- return restProp;
-
- //
- // we've got work to do; handle two builtin cases.
- //
- if (EventFilter.DECL_HANDLER.equals (id))
- return this;
- if (EventFilter.LEXICAL_HANDLER.equals (id))
- return this;
-
- //
- // non-degenerate, handled by both consumers, but we don't know
- // how to handle this.
- //
- throw new SAXNotRecognizedException ("can't tee: " + id);
+ //
+ // in degenerate cases, we have no work to do.
+ //
+ Object firstProp = null, restProp = null;
+
+ try { firstProp = first.getProperty (id); }
+ catch (SAXNotRecognizedException e) { /* ignore */ }
+ try { restProp = rest.getProperty (id); }
+ catch (SAXNotRecognizedException e) { /* ignore */ }
+
+ if (restProp == null)
+ return firstProp;
+ if (firstProp == null)
+ return restProp;
+
+ //
+ // we've got work to do; handle two builtin cases.
+ //
+ if (EventFilter.DECL_HANDLER.equals (id))
+ return this;
+ if (EventFilter.LEXICAL_HANDLER.equals (id))
+ return this;
+
+ //
+ // non-degenerate, handled by both consumers, but we don't know
+ // how to handle this.
+ //
+ throw new SAXNotRecognizedException ("can't tee: " + id);
}
/**
@@ -212,8 +212,8 @@ final public class TeeConsumer
*/
public void setErrorHandler (ErrorHandler handler)
{
- first.setErrorHandler (handler);
- rest.setErrorHandler (handler);
+ first.setErrorHandler (handler);
+ rest.setErrorHandler (handler);
}
@@ -222,83 +222,83 @@ final public class TeeConsumer
//
public void setDocumentLocator (Locator locator)
{
- // this call is not made by all parsers
- docFirst.setDocumentLocator (locator);
- docRest.setDocumentLocator (locator);
+ // this call is not made by all parsers
+ docFirst.setDocumentLocator (locator);
+ docRest.setDocumentLocator (locator);
}
public void startDocument ()
throws SAXException
{
- docFirst.startDocument ();
- docRest.startDocument ();
+ docFirst.startDocument ();
+ docRest.startDocument ();
}
public void endDocument ()
throws SAXException
{
- try {
- docFirst.endDocument ();
- } finally {
- docRest.endDocument ();
- }
+ try {
+ docFirst.endDocument ();
+ } finally {
+ docRest.endDocument ();
+ }
}
public void startPrefixMapping (String prefix, String uri)
throws SAXException
{
- docFirst.startPrefixMapping (prefix, uri);
- docRest.startPrefixMapping (prefix, uri);
+ docFirst.startPrefixMapping (prefix, uri);
+ docRest.startPrefixMapping (prefix, uri);
}
public void endPrefixMapping (String prefix)
throws SAXException
{
- docFirst.endPrefixMapping (prefix);
- docRest.endPrefixMapping (prefix);
+ docFirst.endPrefixMapping (prefix);
+ docRest.endPrefixMapping (prefix);
}
public void skippedEntity (String name)
throws SAXException
{
- docFirst.skippedEntity (name);
- docRest.skippedEntity (name);
+ docFirst.skippedEntity (name);
+ docRest.skippedEntity (name);
}
public void startElement (String uri, String localName,
- String qName, Attributes atts)
+ String qName, Attributes atts)
throws SAXException
{
- docFirst.startElement (uri, localName, qName, atts);
- docRest.startElement (uri, localName, qName, atts);
+ docFirst.startElement (uri, localName, qName, atts);
+ docRest.startElement (uri, localName, qName, atts);
}
public void endElement (String uri, String localName, String qName)
throws SAXException
{
- docFirst.endElement (uri, localName, qName);
- docRest.endElement (uri, localName, qName);
+ docFirst.endElement (uri, localName, qName);
+ docRest.endElement (uri, localName, qName);
}
public void processingInstruction (String target, String data)
throws SAXException
{
- docFirst.processingInstruction (target, data);
- docRest.processingInstruction (target, data);
+ docFirst.processingInstruction (target, data);
+ docRest.processingInstruction (target, data);
}
public void characters (char ch [], int start, int length)
throws SAXException
{
- docFirst.characters (ch, start, length);
- docRest.characters (ch, start, length);
+ docFirst.characters (ch, start, length);
+ docRest.characters (ch, start, length);
}
public void ignorableWhitespace (char ch [], int start, int length)
throws SAXException
{
- docFirst.ignorableWhitespace (ch, start, length);
- docRest.ignorableWhitespace (ch, start, length);
+ docFirst.ignorableWhitespace (ch, start, length);
+ docRest.ignorableWhitespace (ch, start, length);
}
@@ -308,23 +308,23 @@ final public class TeeConsumer
public void notationDecl (String name, String publicId, String systemId)
throws SAXException
{
- DTDHandler l1 = first.getDTDHandler ();
- DTDHandler l2 = rest.getDTDHandler ();
+ DTDHandler l1 = first.getDTDHandler ();
+ DTDHandler l2 = rest.getDTDHandler ();
- l1.notationDecl (name, publicId, systemId);
- l2.notationDecl (name, publicId, systemId);
+ l1.notationDecl (name, publicId, systemId);
+ l2.notationDecl (name, publicId, systemId);
}
public void unparsedEntityDecl (String name,
- String publicId, String systemId,
- String notationName
+ String publicId, String systemId,
+ String notationName
) throws SAXException
{
- DTDHandler l1 = first.getDTDHandler ();
- DTDHandler l2 = rest.getDTDHandler ();
+ DTDHandler l1 = first.getDTDHandler ();
+ DTDHandler l2 = rest.getDTDHandler ();
- l1.unparsedEntityDecl (name, publicId, systemId, notationName);
- l2.unparsedEntityDecl (name, publicId, systemId, notationName);
+ l1.unparsedEntityDecl (name, publicId, systemId, notationName);
+ l2.unparsedEntityDecl (name, publicId, systemId, notationName);
}
@@ -332,34 +332,34 @@ final public class TeeConsumer
// DeclHandler
//
public void attributeDecl (String eName, String aName,
- String type,
- String mode, String value)
+ String type,
+ String mode, String value)
throws SAXException
{
- declFirst.attributeDecl (eName, aName, type, mode, value);
- declRest.attributeDecl (eName, aName, type, mode, value);
+ declFirst.attributeDecl (eName, aName, type, mode, value);
+ declRest.attributeDecl (eName, aName, type, mode, value);
}
public void elementDecl (String name, String model)
throws SAXException
{
- declFirst.elementDecl (name, model);
- declRest.elementDecl (name, model);
+ declFirst.elementDecl (name, model);
+ declRest.elementDecl (name, model);
}
public void externalEntityDecl (String name,
- String publicId, String systemId)
+ String publicId, String systemId)
throws SAXException
{
- declFirst.externalEntityDecl (name, publicId, systemId);
- declRest.externalEntityDecl (name, publicId, systemId);
+ declFirst.externalEntityDecl (name, publicId, systemId);
+ declRest.externalEntityDecl (name, publicId, systemId);
}
public void internalEntityDecl (String name, String value)
throws SAXException
{
- declFirst.internalEntityDecl (name, value);
- declRest.internalEntityDecl (name, value);
+ declFirst.internalEntityDecl (name, value);
+ declRest.internalEntityDecl (name, value);
}
@@ -369,49 +369,49 @@ final public class TeeConsumer
public void comment (char ch [], int start, int length)
throws SAXException
{
- lexFirst.comment (ch, start, length);
- lexRest.comment (ch, start, length);
+ lexFirst.comment (ch, start, length);
+ lexRest.comment (ch, start, length);
}
-
+
public void startCDATA ()
throws SAXException
{
- lexFirst.startCDATA ();
- lexRest.startCDATA ();
+ lexFirst.startCDATA ();
+ lexRest.startCDATA ();
}
-
+
public void endCDATA ()
throws SAXException
{
- lexFirst.endCDATA ();
- lexRest.endCDATA ();
+ lexFirst.endCDATA ();
+ lexRest.endCDATA ();
}
-
+
public void startEntity (String name)
throws SAXException
{
- lexFirst.startEntity (name);
- lexRest.startEntity (name);
+ lexFirst.startEntity (name);
+ lexRest.startEntity (name);
}
-
+
public void endEntity (String name)
throws SAXException
{
- lexFirst.endEntity (name);
- lexRest.endEntity (name);
+ lexFirst.endEntity (name);
+ lexRest.endEntity (name);
}
-
+
public void startDTD (String name, String publicId, String systemId)
throws SAXException
{
- lexFirst.startDTD (name, publicId, systemId);
- lexRest.startDTD (name, publicId, systemId);
+ lexFirst.startDTD (name, publicId, systemId);
+ lexRest.startDTD (name, publicId, systemId);
}
-
+
public void endDTD ()
throws SAXException
{
- lexFirst.endDTD ();
- lexRest.endDTD ();
+ lexFirst.endDTD ();
+ lexRest.endDTD ();
}
}
diff --git a/gnu/xml/pipeline/TextConsumer.java b/gnu/xml/pipeline/TextConsumer.java
index 67bd23b00..13dcfa7f6 100644
--- a/gnu/xml/pipeline/TextConsumer.java
+++ b/gnu/xml/pipeline/TextConsumer.java
@@ -1,4 +1,4 @@
-/* TextConsumer.java --
+/* TextConsumer.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -72,8 +72,8 @@ public class TextConsumer extends XMLWriter implements EventConsumer
public TextConsumer (Writer w, boolean isXhtml)
throws IOException
{
- super (w, isXhtml ? "US-ASCII" : null);
- setXhtml (isXhtml);
+ super (w, isXhtml ? "US-ASCII" : null);
+ setXhtml (isXhtml);
}
/**
@@ -83,9 +83,9 @@ public class TextConsumer extends XMLWriter implements EventConsumer
public TextConsumer (Writer w)
throws IOException
{
- this (w, false);
+ this (w, false);
}
-
+
/**
* Constructs a consumer that writes its input as XML text,
* encoded in UTF-8. XHTML rules are not followed.
@@ -93,25 +93,25 @@ public class TextConsumer extends XMLWriter implements EventConsumer
public TextConsumer (OutputStream out)
throws IOException
{
- this (new OutputStreamWriter (out, "UTF8"), false);
+ this (new OutputStreamWriter (out, "UTF8"), false);
}
/** <b>EventConsumer</b> Returns the document handler being used. */
public ContentHandler getContentHandler ()
- { return this; }
+ { return this; }
/** <b>EventConsumer</b> Returns the dtd handler being used. */
public DTDHandler getDTDHandler ()
- { return this; }
+ { return this; }
/** <b>XMLReader</b>Retrieves a property (lexical and decl handlers) */
public Object getProperty (String propertyId)
throws SAXNotRecognizedException
{
- if (EventFilter.LEXICAL_HANDLER.equals (propertyId))
- return this;
- if (EventFilter.DECL_HANDLER.equals (propertyId))
- return this;
- throw new SAXNotRecognizedException (propertyId);
+ if (EventFilter.LEXICAL_HANDLER.equals (propertyId))
+ return this;
+ if (EventFilter.DECL_HANDLER.equals (propertyId))
+ return this;
+ throw new SAXNotRecognizedException (propertyId);
}
}
diff --git a/gnu/xml/pipeline/ValidationConsumer.java b/gnu/xml/pipeline/ValidationConsumer.java
index 839176749..0346984d3 100644
--- a/gnu/xml/pipeline/ValidationConsumer.java
+++ b/gnu/xml/pipeline/ValidationConsumer.java
@@ -1,4 +1,4 @@
-/* ValidationConsumer.java --
+/* ValidationConsumer.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -62,24 +62,24 @@ import org.xml.sax.helpers.XMLReaderFactory;
* both a filter and a terminus on an event pipeline. It relies on the
* producer of SAX events to: </p> <ol>
*
- * <li> Conform to the specification of a non-validating XML parser that
- * reads all external entities, reported using SAX2 events. </li>
+ * <li> Conform to the specification of a non-validating XML parser that
+ * reads all external entities, reported using SAX2 events. </li>
*
- * <li> Report ignorable whitespace as such (through the ContentHandler
- * interface). This is, strictly speaking, optional for nonvalidating
- * XML processors. </li>
+ * <li> Report ignorable whitespace as such (through the ContentHandler
+ * interface). This is, strictly speaking, optional for nonvalidating
+ * XML processors. </li>
*
- * <li> Make SAX2 DeclHandler callbacks, with default
- * attribute values already normalized (and without "&lt;").</li>
+ * <li> Make SAX2 DeclHandler callbacks, with default
+ * attribute values already normalized (and without "&lt;").</li>
*
- * <li> Make SAX2 LexicalHandler startDTD() and endDTD ()
- * callbacks. </li>
+ * <li> Make SAX2 LexicalHandler startDTD() and endDTD ()
+ * callbacks. </li>
*
- * <li> Act as if the <em>(URI)/namespace-prefixes</em> property were
- * set to true, by providing XML 1.0 names and all <code>xmlns*</code>
- * attributes (rather than omitting either or both). </li>
+ * <li> Act as if the <em>(URI)/namespace-prefixes</em> property were
+ * set to true, by providing XML 1.0 names and all <code>xmlns*</code>
+ * attributes (rather than omitting either or both). </li>
*
- * </ol>
+ * </ol>
*
* <p> At this writing, the major SAX2 parsers (such as &AElig;lfred2,
* Crimson, and Xerces) meet these requirements, and this validation
@@ -128,51 +128,51 @@ import org.xml.sax.helpers.XMLReaderFactory;
* of them) or discarded (popular for the standalone declaration); in short,
* that these are bugs in the XML specification (not all via SGML): </p><ul>
*
- * <li> The <em>Proper Declaration/PE Nesting</em> and
- * <em>Proper Group/PE Nesting</em> VCs can't be tested because they
- * require access to particularly low level lexical level information.
- * In essence, the reason XML isn't a simple thing to parse is that
- * it's not a context free grammar, and these constraints elevate that
- * SGML-derived context sensitivity to the level of a semantic rule.
+ * <li> The <em>Proper Declaration/PE Nesting</em> and
+ * <em>Proper Group/PE Nesting</em> VCs can't be tested because they
+ * require access to particularly low level lexical level information.
+ * In essence, the reason XML isn't a simple thing to parse is that
+ * it's not a context free grammar, and these constraints elevate that
+ * SGML-derived context sensitivity to the level of a semantic rule.
*
- * <li> The <em>Standalone Document Declaration</em> VC can't be
- * tested. This is for two reasons. First, this flag isn't made
- * available through SAX2. Second, it also requires breaking that
- * lexical layering boundary. (If you ever wondered why classes
- * in compiler construction or language design barely mention the
- * existence of context-sensitive grammars, it's because of messy
- * issues like these.)
+ * <li> The <em>Standalone Document Declaration</em> VC can't be
+ * tested. This is for two reasons. First, this flag isn't made
+ * available through SAX2. Second, it also requires breaking that
+ * lexical layering boundary. (If you ever wondered why classes
+ * in compiler construction or language design barely mention the
+ * existence of context-sensitive grammars, it's because of messy
+ * issues like these.)
*
- * <li> The <em>Entity Declared</em> VC can't be tested, because it
- * also requires breaking that lexical layering boundary! There's also
- * another issue: the VC wording (and seemingly intent) is ambiguous.
- * (This is still true in the "Second edition" XML spec.)
- * Since there is a WFC of the same name, everyone's life would be
- * easier if references to undeclared parsed entities were always well
- * formedness errors, regardless of whether they're parameter entities
- * or not. (Note that nonvalidating parsers are not required
- * to report all such well formedness errors if they don't read external
- * parameter entities, although currently most XML parsers read them
- * in an attempt to avoid problems from inconsistent parser behavior.)
+ * <li> The <em>Entity Declared</em> VC can't be tested, because it
+ * also requires breaking that lexical layering boundary! There's also
+ * another issue: the VC wording (and seemingly intent) is ambiguous.
+ * (This is still true in the "Second edition" XML spec.)
+ * Since there is a WFC of the same name, everyone's life would be
+ * easier if references to undeclared parsed entities were always well
+ * formedness errors, regardless of whether they're parameter entities
+ * or not. (Note that nonvalidating parsers are not required
+ * to report all such well formedness errors if they don't read external
+ * parameter entities, although currently most XML parsers read them
+ * in an attempt to avoid problems from inconsistent parser behavior.)
*
- * </ul>
+ * </ul>
*
* <p> The second category of limitations on this validation represent
* constraints associated with information that is not guaranteed to be
* available (or in one case, <em>is guaranteed not to be available</em>,
* through the SAX2 API: </p><ul>
*
- * <li> The <em>Unique Element Type Declaration</em> VC may not be
- * reportable, if the underlying parser happens not to expose
- * multiple declarations. (&AElig;lfred2 reports these validity
- * errors directly.)</li>
+ * <li> The <em>Unique Element Type Declaration</em> VC may not be
+ * reportable, if the underlying parser happens not to expose
+ * multiple declarations. (&AElig;lfred2 reports these validity
+ * errors directly.)</li>
*
- * <li> Similarly, the <em>Unique Notation Name</em> VC, added in the
- * 14-January-2000 XML spec errata to restrict typing models used by
- * elements, may not be reportable. (&AElig;lfred reports these
- * validity errors directly.) </li>
+ * <li> Similarly, the <em>Unique Notation Name</em> VC, added in the
+ * 14-January-2000 XML spec errata to restrict typing models used by
+ * elements, may not be reportable. (&AElig;lfred reports these
+ * validity errors directly.) </li>
*
- * </ul>
+ * </ul>
*
* <p> A third category relates to ease of implementation. (Think of this
* as "bugs".) The most notable issue here is character handling. Rather
@@ -199,15 +199,15 @@ public final class ValidationConsumer extends EventFilter
{
// report error if we happen to notice a non-deterministic choice?
// we won't report buggy content models; just buggy instances
- private static final boolean warnNonDeterministic = false;
+ private static final boolean warnNonDeterministic = false;
// for tracking active content models
- private String rootName;
- private Stack contentStack = new Stack ();
+ private String rootName;
+ private Stack contentStack = new Stack ();
// flags for "saved DTD" processing
- private boolean disableDeclarations;
- private boolean disableReset;
+ private boolean disableDeclarations;
+ private boolean disableReset;
//
// most VCs get tested when we see element start tags. the per-element
@@ -217,25 +217,25 @@ public final class ValidationConsumer extends EventFilter
//
// key = element name; value = ElementInfo
- private Hashtable elements = new Hashtable ();
+ private Hashtable elements = new Hashtable ();
// some VCs relate to ID/IDREF/IDREFS attributes
// key = id; value = boolean true (defd) or false (refd)
- private Hashtable ids = new Hashtable ();
+ private Hashtable ids = new Hashtable ();
// we just record declared notation and unparsed entity names.
// the implementation here is simple/slow; these features
// are seldom used, one hopes they'll wither away soon
- private Vector notations = new Vector (5, 5);
- private Vector nDeferred = new Vector (5, 5);
- private Vector unparsed = new Vector (5, 5);
- private Vector uDeferred = new Vector (5, 5);
-
- // note: DocBk 3.1.7 XML defines over 2 dozen notations,
- // used when defining unparsed entities for graphics
- // (and maybe in other places)
+ private Vector notations = new Vector (5, 5);
+ private Vector nDeferred = new Vector (5, 5);
+ private Vector unparsed = new Vector (5, 5);
+ private Vector uDeferred = new Vector (5, 5);
+
+ // note: DocBk 3.1.7 XML defines over 2 dozen notations,
+ // used when defining unparsed entities for graphics
+ // (and maybe in other places)
+
-
/**
* Creates a pipeline terminus which consumes all events passed to
@@ -244,11 +244,11 @@ public final class ValidationConsumer extends EventFilter
*
* @see #setErrorHandler
*/
- // constructor used by PipelineFactory
- // ... and want one taking system ID of an external subset
+ // constructor used by PipelineFactory
+ // ... and want one taking system ID of an external subset
public ValidationConsumer ()
{
- this (null);
+ this (null);
}
/**
@@ -257,25 +257,25 @@ public final class ValidationConsumer extends EventFilter
*
* @see #setErrorHandler
*/
- // constructor used by PipelineFactory
- // ... and want one taking system ID of an external subset
- // (which won't send declaration events)
+ // constructor used by PipelineFactory
+ // ... and want one taking system ID of an external subset
+ // (which won't send declaration events)
public ValidationConsumer (EventConsumer next)
{
- super (next);
-
- setContentHandler (this);
- setDTDHandler (this);
- try { setProperty (DECL_HANDLER, this); }
- catch (Exception e) { /* "can't happen" */ }
- try { setProperty (LEXICAL_HANDLER, this); }
- catch (Exception e) { /* "can't happen" */ }
+ super (next);
+
+ setContentHandler (this);
+ setDTDHandler (this);
+ try { setProperty (DECL_HANDLER, this); }
+ catch (Exception e) { /* "can't happen" */ }
+ try { setProperty (LEXICAL_HANDLER, this); }
+ catch (Exception e) { /* "can't happen" */ }
}
-
- private static final String fakeRootName
- = ":Nobody:in:their_Right.Mind_would:use:this-name:1x:";
-
+
+ private static final String fakeRootName
+ = ":Nobody:in:their_Right.Mind_would:use:this-name:1x:";
+
/**
* Creates a validation consumer which is preloaded with the DTD provided.
* It does this by constructing a document with that DTD, then parsing
@@ -287,182 +287,182 @@ public final class ValidationConsumer extends EventFilter
* in a document being parsed.
*
* @param rootName The name of the required root element; if this is
- * null, any root element name will be accepted.
+ * null, any root element name will be accepted.
* @param publicId If non-null and there is a non-null systemId, this
- * identifier provides an alternate access identifier for the DTD's
- * external subset.
+ * identifier provides an alternate access identifier for the DTD's
+ * external subset.
* @param systemId If non-null, this is a URI (normally URL) that
- * may be used to access the DTD's external subset.
+ * may be used to access the DTD's external subset.
* @param internalSubset If non-null, holds literal markup declarations
- * comprising the DTD's internal subset.
+ * comprising the DTD's internal subset.
* @param resolver If non-null, this will be provided to the parser for
- * use when resolving parameter entities (including any external subset).
+ * use when resolving parameter entities (including any external subset).
* @param resolver If non-null, this will be provided to the parser for
- * use when resolving parameter entities (including any external subset).
+ * use when resolving parameter entities (including any external subset).
* @param minimalElement If non-null, a minimal valid document.
*
* @exception SAXNotSupportedException If the default SAX parser does
- * not support the standard lexical or declaration handlers.
+ * not support the standard lexical or declaration handlers.
* @exception SAXParseException If the specified DTD has either
- * well-formedness or validity errors
+ * well-formedness or validity errors
* @exception IOException If the specified DTD can't be read for
- * some reason
+ * some reason
*/
public ValidationConsumer (
- String rootName,
- String publicId,
- String systemId,
- String internalSubset,
- EntityResolver resolver,
- String minimalDocument
+ String rootName,
+ String publicId,
+ String systemId,
+ String internalSubset,
+ EntityResolver resolver,
+ String minimalDocument
) throws SAXException, IOException
{
- this (null);
-
- disableReset = true;
- if (rootName == null)
- rootName = fakeRootName;
-
- //
- // Synthesize document with that DTD; is it possible to do
- // better for the declaration of the root element?
- //
- // NOTE: can't use SAX2 to write internal subsets.
- //
- StringWriter writer = new StringWriter ();
-
- writer.write ("<!DOCTYPE ");
- writer.write (rootName);
- if (systemId != null) {
- writer.write ("\n ");
- if (publicId != null) {
- writer.write ("PUBLIC '");
- writer.write (publicId);
- writer.write ("'\n\t'");
- } else
- writer.write ("SYSTEM '");
- writer.write (systemId);
- writer.write ("'");
- }
- writer.write (" [ ");
- if (rootName == fakeRootName) {
- writer.write ("\n<!ELEMENT ");
- writer.write (rootName);
- writer.write (" EMPTY>");
- }
- if (internalSubset != null)
- writer.write (internalSubset);
- writer.write ("\n ]>");
-
- if (minimalDocument != null) {
- writer.write ("\n");
- writer.write (minimalDocument);
- writer.write ("\n");
- } else {
- writer.write (" <");
- writer.write (rootName);
- writer.write ("/>\n");
- }
- minimalDocument = writer.toString ();
-
- //
- // OK, load it
- //
- XMLReader producer;
-
- producer = XMLReaderFactory.createXMLReader ();
- bind (producer, this);
-
- if (resolver != null)
- producer.setEntityResolver (resolver);
-
- InputSource in;
-
- in = new InputSource (new StringReader (minimalDocument));
- producer.parse (in);
-
- disableDeclarations = true;
- if (rootName == fakeRootName)
- this.rootName = null;
+ this (null);
+
+ disableReset = true;
+ if (rootName == null)
+ rootName = fakeRootName;
+
+ //
+ // Synthesize document with that DTD; is it possible to do
+ // better for the declaration of the root element?
+ //
+ // NOTE: can't use SAX2 to write internal subsets.
+ //
+ StringWriter writer = new StringWriter ();
+
+ writer.write ("<!DOCTYPE ");
+ writer.write (rootName);
+ if (systemId != null) {
+ writer.write ("\n ");
+ if (publicId != null) {
+ writer.write ("PUBLIC '");
+ writer.write (publicId);
+ writer.write ("'\n\t'");
+ } else
+ writer.write ("SYSTEM '");
+ writer.write (systemId);
+ writer.write ("'");
+ }
+ writer.write (" [ ");
+ if (rootName == fakeRootName) {
+ writer.write ("\n<!ELEMENT ");
+ writer.write (rootName);
+ writer.write (" EMPTY>");
+ }
+ if (internalSubset != null)
+ writer.write (internalSubset);
+ writer.write ("\n ]>");
+
+ if (minimalDocument != null) {
+ writer.write ("\n");
+ writer.write (minimalDocument);
+ writer.write ("\n");
+ } else {
+ writer.write (" <");
+ writer.write (rootName);
+ writer.write ("/>\n");
+ }
+ minimalDocument = writer.toString ();
+
+ //
+ // OK, load it
+ //
+ XMLReader producer;
+
+ producer = XMLReaderFactory.createXMLReader ();
+ bind (producer, this);
+
+ if (resolver != null)
+ producer.setEntityResolver (resolver);
+
+ InputSource in;
+
+ in = new InputSource (new StringReader (minimalDocument));
+ producer.parse (in);
+
+ disableDeclarations = true;
+ if (rootName == fakeRootName)
+ this.rootName = null;
}
private void resetState ()
{
- if (!disableReset) {
- rootName = null;
- contentStack.removeAllElements ();
- elements.clear ();
- ids.clear ();
-
- notations.removeAllElements ();
- nDeferred.removeAllElements ();
- unparsed.removeAllElements ();
- uDeferred.removeAllElements ();
- }
+ if (!disableReset) {
+ rootName = null;
+ contentStack.removeAllElements ();
+ elements.clear ();
+ ids.clear ();
+
+ notations.removeAllElements ();
+ nDeferred.removeAllElements ();
+ unparsed.removeAllElements ();
+ uDeferred.removeAllElements ();
+ }
}
private void warning (String description)
throws SAXException
{
- ErrorHandler errHandler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
- SAXParseException err;
-
- if (errHandler == null)
- return;
-
- if (locator == null)
- err = new SAXParseException (description, null, null, -1, -1);
- else
- err = new SAXParseException (description, locator);
- errHandler.warning (err);
+ ErrorHandler errHandler = getErrorHandler ();
+ Locator locator = getDocumentLocator ();
+ SAXParseException err;
+
+ if (errHandler == null)
+ return;
+
+ if (locator == null)
+ err = new SAXParseException (description, null, null, -1, -1);
+ else
+ err = new SAXParseException (description, locator);
+ errHandler.warning (err);
}
// package private (for ChildrenRecognizer)
private void error (String description)
throws SAXException
{
- ErrorHandler errHandler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
- SAXParseException err;
-
- if (locator == null)
- err = new SAXParseException (description, null, null, -1, -1);
- else
- err = new SAXParseException (description, locator);
- if (errHandler != null)
- errHandler.error (err);
- else // else we always treat it as fatal!
- throw err;
+ ErrorHandler errHandler = getErrorHandler ();
+ Locator locator = getDocumentLocator ();
+ SAXParseException err;
+
+ if (locator == null)
+ err = new SAXParseException (description, null, null, -1, -1);
+ else
+ err = new SAXParseException (description, locator);
+ if (errHandler != null)
+ errHandler.error (err);
+ else // else we always treat it as fatal!
+ throw err;
}
private void fatalError (String description)
throws SAXException
{
- ErrorHandler errHandler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
- SAXParseException err;
-
- if (locator != null)
- err = new SAXParseException (description, locator);
- else
- err = new SAXParseException (description, null, null, -1, -1);
- if (errHandler != null)
- errHandler.fatalError (err);
- // we always treat this as fatal, regardless of the handler
- throw err;
+ ErrorHandler errHandler = getErrorHandler ();
+ Locator locator = getDocumentLocator ();
+ SAXParseException err;
+
+ if (locator != null)
+ err = new SAXParseException (description, locator);
+ else
+ err = new SAXParseException (description, null, null, -1, -1);
+ if (errHandler != null)
+ errHandler.fatalError (err);
+ // we always treat this as fatal, regardless of the handler
+ throw err;
}
private static boolean isExtender (char c)
{
- // [88] Extender ::= ...
- return c == 0x00b7 || c == 0x02d0 || c == 0x02d1 || c == 0x0387
- || c == 0x0640 || c == 0x0e46 || c == 0x0ec6 || c == 0x3005
- || (c >= 0x3031 && c <= 0x3035)
- || (c >= 0x309d && c <= 0x309e)
- || (c >= 0x30fc && c <= 0x30fe);
+ // [88] Extender ::= ...
+ return c == 0x00b7 || c == 0x02d0 || c == 0x02d1 || c == 0x0387
+ || c == 0x0640 || c == 0x0e46 || c == 0x0ec6 || c == 0x3005
+ || (c >= 0x3031 && c <= 0x3035)
+ || (c >= 0x309d && c <= 0x309e)
+ || (c >= 0x30fc && c <= 0x30fe);
}
@@ -470,86 +470,86 @@ public final class ValidationConsumer extends EventFilter
private boolean isName (String name, String context, String id)
throws SAXException
{
- char buf [] = name.toCharArray ();
- boolean pass = true;
-
- if (!Character.isUnicodeIdentifierStart (buf [0])
- && ":_".indexOf (buf [0]) == -1)
- pass = false;
- else {
- int max = buf.length;
- for (int i = 1; pass && i < max; i++) {
- char c = buf [i];
- if (!Character.isUnicodeIdentifierPart (c)
- && ":-_.".indexOf (c) == -1
- && !isExtender (c))
- pass = false;
- }
- }
-
- if (!pass)
- error ("In " + context + " for " + id
- + ", '" + name + "' is not a name");
- return pass; // true == OK
+ char buf [] = name.toCharArray ();
+ boolean pass = true;
+
+ if (!Character.isUnicodeIdentifierStart (buf [0])
+ && ":_".indexOf (buf [0]) == -1)
+ pass = false;
+ else {
+ int max = buf.length;
+ for (int i = 1; pass && i < max; i++) {
+ char c = buf [i];
+ if (!Character.isUnicodeIdentifierPart (c)
+ && ":-_.".indexOf (c) == -1
+ && !isExtender (c))
+ pass = false;
+ }
+ }
+
+ if (!pass)
+ error ("In " + context + " for " + id
+ + ", '" + name + "' is not a name");
+ return pass; // true == OK
}
// use augmented Unicode rules, not full XML rules
private boolean isNmtoken (String nmtoken, String context, String id)
throws SAXException
{
- char buf [] = nmtoken.toCharArray ();
- boolean pass = true;
- int max = buf.length;
-
- // XXX make this share code with isName
-
- for (int i = 0; pass && i < max; i++) {
- char c = buf [i];
- if (!Character.isUnicodeIdentifierPart (c)
- && ":-_.".indexOf (c) == -1
- && !isExtender (c))
- pass = false;
- }
-
- if (!pass)
- error ("In " + context + " for " + id
- + ", '" + nmtoken + "' is not a name token");
- return pass; // true == OK
+ char buf [] = nmtoken.toCharArray ();
+ boolean pass = true;
+ int max = buf.length;
+
+ // XXX make this share code with isName
+
+ for (int i = 0; pass && i < max; i++) {
+ char c = buf [i];
+ if (!Character.isUnicodeIdentifierPart (c)
+ && ":-_.".indexOf (c) == -1
+ && !isExtender (c))
+ pass = false;
+ }
+
+ if (!pass)
+ error ("In " + context + " for " + id
+ + ", '" + nmtoken + "' is not a name token");
+ return pass; // true == OK
}
private void checkEnumeration (String value, String type, String name)
throws SAXException
{
- if (!hasMatch (value, type))
- // VC: Enumeration
- error ("Value '" + value
- + "' for attribute '" + name
- + "' is not permitted: " + type);
+ if (!hasMatch (value, type))
+ // VC: Enumeration
+ error ("Value '" + value
+ + "' for attribute '" + name
+ + "' is not permitted: " + type);
}
// used to test enumerated attributes and mixed content models
// package private
static boolean hasMatch (String value, String orList)
{
- int len = value.length ();
- int max = orList.length () - len;
-
- for (int start = 0;
- (start = orList.indexOf (value, start)) != -1;
- start++) {
- char c;
-
- if (start > max)
- break;
- c = orList.charAt (start - 1);
- if (c != '|' && c != '('/*)*/)
- continue;
- c = orList.charAt (start + len);
- if (c != '|' && /*(*/ c != ')')
- continue;
- return true;
- }
- return false;
+ int len = value.length ();
+ int max = orList.length () - len;
+
+ for (int start = 0;
+ (start = orList.indexOf (value, start)) != -1;
+ start++) {
+ char c;
+
+ if (start > max)
+ break;
+ c = orList.charAt (start - 1);
+ if (c != '|' && c != '('/*)*/)
+ continue;
+ c = orList.charAt (start + len);
+ if (c != '|' && /*(*/ c != ')')
+ continue;
+ return true;
+ }
+ return false;
}
/**
@@ -561,11 +561,11 @@ public final class ValidationConsumer extends EventFilter
public void startDTD (String name, String publicId, String systemId)
throws SAXException
{
- if (disableDeclarations)
- return;
+ if (disableDeclarations)
+ return;
- rootName = name;
- super.startDTD (name, publicId, systemId);
+ rootName = name;
+ super.startDTD (name, publicId, systemId);
}
/**
@@ -577,37 +577,37 @@ public final class ValidationConsumer extends EventFilter
public void endDTD ()
throws SAXException
{
- if (disableDeclarations)
- return;
-
- // this is a convenient hook for end-of-dtd checks, but we
- // could also trigger it in the first startElement call.
- // locator info is more appropriate here though.
-
- // VC: Notation Declared (NDATA can refer to them before decls,
- // as can NOTATION attribute enumerations and defaults)
- int length = nDeferred.size ();
- for (int i = 0; i < length; i++) {
- String notation = (String) nDeferred.elementAt (i);
- if (!notations.contains (notation)) {
- error ("A declaration referred to notation '" + notation
- + "' which was never declared");
- }
- }
- nDeferred.removeAllElements ();
-
- // VC: Entity Name (attribute values can refer to them
- // before they're declared); VC Attribute Default Legal
- length = uDeferred.size ();
- for (int i = 0; i < length; i++) {
- String entity = (String) uDeferred.elementAt (i);
- if (!unparsed.contains (entity)) {
- error ("An attribute default referred to entity '" + entity
- + "' which was never declared");
- }
- }
- uDeferred.removeAllElements ();
- super.endDTD ();
+ if (disableDeclarations)
+ return;
+
+ // this is a convenient hook for end-of-dtd checks, but we
+ // could also trigger it in the first startElement call.
+ // locator info is more appropriate here though.
+
+ // VC: Notation Declared (NDATA can refer to them before decls,
+ // as can NOTATION attribute enumerations and defaults)
+ int length = nDeferred.size ();
+ for (int i = 0; i < length; i++) {
+ String notation = (String) nDeferred.elementAt (i);
+ if (!notations.contains (notation)) {
+ error ("A declaration referred to notation '" + notation
+ + "' which was never declared");
+ }
+ }
+ nDeferred.removeAllElements ();
+
+ // VC: Entity Name (attribute values can refer to them
+ // before they're declared); VC Attribute Default Legal
+ length = uDeferred.size ();
+ for (int i = 0; i < length; i++) {
+ String entity = (String) uDeferred.elementAt (i);
+ if (!unparsed.contains (entity)) {
+ error ("An attribute default referred to entity '" + entity
+ + "' which was never declared");
+ }
+ }
+ uDeferred.removeAllElements ();
+ super.endDTD ();
}
@@ -615,10 +615,10 @@ public final class ValidationConsumer extends EventFilter
// all attributes except enumerations ...
// "(this|or|that|...)" and "NOTATION (this|or|that|...)"
static final String types [] = {
- "CDATA",
- "ID", "IDREF", "IDREFS",
- "NMTOKEN", "NMTOKENS",
- "ENTITY", "ENTITIES"
+ "CDATA",
+ "ID", "IDREF", "IDREFS",
+ "NMTOKEN", "NMTOKENS",
+ "ENTITY", "ENTITIES"
};
@@ -630,172 +630,172 @@ public final class ValidationConsumer extends EventFilter
* preloaded with a particular DTD.
*/
public void attributeDecl (
- String eName,
- String aName,
- String type,
- String mode,
- String value
+ String eName,
+ String aName,
+ String type,
+ String mode,
+ String value
) throws SAXException
{
- if (disableDeclarations)
- return;
-
- ElementInfo info = (ElementInfo) elements.get (eName);
- AttributeInfo ainfo = new AttributeInfo ();
- boolean checkOne = false;
- boolean interned = false;
-
- // cheap interning of type names and #FIXED, #REQUIRED
- // for faster startElement (we can use "==")
- for (int i = 0; i < types.length; i++) {
- if (types [i].equals (type)) {
- type = types [i];
- interned = true;
- break;
- }
- }
- if ("#FIXED".equals (mode))
- mode = "#FIXED";
- else if ("#REQUIRED".equals (mode))
- mode = "#REQUIRED";
-
- ainfo.type = type;
- ainfo.mode = mode;
- ainfo.value = value;
-
- // we might not have seen the content model yet
- if (info == null) {
- info = new ElementInfo (eName);
- elements.put (eName, info);
- }
- if ("ID" == type) {
- checkOne = true;
- if (!("#REQUIRED" == mode || "#IMPLIED".equals (mode))) {
- // VC: ID Attribute Default
- error ("ID attribute '" + aName
- + "' must be #IMPLIED or #REQUIRED");
- }
-
- } else if (!interned && type.startsWith ("NOTATION ")) {
- checkOne = true;
-
- // VC: Notation Attributes (notations must be declared)
- StringTokenizer tokens = new StringTokenizer (
- type.substring (10, type.lastIndexOf (')')),
- "|");
- while (tokens.hasMoreTokens ()) {
- String token = tokens.nextToken ();
- if (!notations.contains (token))
- nDeferred.addElement (token);
- }
- }
- if (checkOne) {
- for (Enumeration e = info.attributes.keys ();
- e.hasMoreElements ();
- /* NOP */) {
- String name;
- AttributeInfo ainfo2;
-
- name = (String) e.nextElement ();
- ainfo2 = (AttributeInfo) info.attributes.get (name);
- if (type == ainfo2.type || !interned /* NOTATION */) {
- // VC: One ID per Element Type
- // VC: One Notation per Element TYpe
- error ("Element '" + eName
- + "' already has an attribute of type "
- + (interned ? "NOTATION" : type)
- + " ('" + name
- + "') so '" + aName
- + "' is a validity error");
- }
- }
- }
-
- // VC: Attribute Default Legal
- if (value != null) {
-
- if ("CDATA" == type) {
- // event source rejected '<'
-
- } else if ("NMTOKEN" == type) {
- // VC: Name Token (is a nmtoken)
- isNmtoken (value, "attribute default", aName);
-
- } else if ("NMTOKENS" == type) {
- // VC: Name Token (is a nmtoken; at least one value)
- StringTokenizer tokens = new StringTokenizer (value);
- if (!tokens.hasMoreTokens ())
- error ("Default for attribute '" + aName
- + "' must have at least one name token.");
- else do {
- String token = tokens.nextToken ();
- isNmtoken (token, "attribute default", aName);
- } while (tokens.hasMoreTokens ());
-
- } else if ("IDREF" == type || "ENTITY" == type) {
- // VC: Entity Name (is a name)
- // VC: IDREF (is a name) (is declared)
- isName (value, "attribute default", aName);
- if ("ENTITY" == type && !unparsed.contains (value))
- uDeferred.addElement (value);
-
- } else if ("IDREFS" == type || "ENTITIES" == type) {
- // VC: Entity Name (is a name; at least one value)
- // VC: IDREF (is a name; at least one value)
- StringTokenizer names = new StringTokenizer (value);
- if (!names.hasMoreTokens ())
- error ("Default for attribute '" + aName
- + "' must have at least one name.");
- else do {
- String name = names.nextToken ();
- isName (name, "attribute default", aName);
- if ("ENTITIES" == type && !unparsed.contains (name))
- uDeferred.addElement (value);
- } while (names.hasMoreTokens ());
-
- } else if (type.charAt (0) == '(' /*)*/ ) {
- // VC: Enumeration (must match)
- checkEnumeration (value, type, aName);
-
- } else if (!interned && checkOne) { /* NOTATION */
- // VC: Notation attributes (must be names)
- isName (value, "attribute default", aName);
-
- // VC: Notation attributes (must be declared)
- if (!notations.contains (value))
- nDeferred.addElement (value);
-
- // VC: Enumeration (must match)
- checkEnumeration (value, type, aName);
-
- } else if ("ID" != type)
- throw new RuntimeException ("illegal attribute type: " + type);
- }
-
- if (info.attributes.get (aName) == null)
- info.attributes.put (aName, ainfo);
- /*
- else
- warning ("Element '" + eName
- + "' already has an attribute named '" + aName + "'");
- */
-
- if ("xml:space".equals (aName)) {
- if (!("(default|preserve)".equals (type)
- || "(preserve|default)".equals (type)
- // these next two are arguable; XHTML's DTD doesn't
- // deserve errors. After all, it's not like any
- // illegal _value_ could pass ...
- || "(preserve)".equals (type)
- || "(default)".equals (type)
- ))
- error (
- "xml:space attribute type must be like '(default|preserve)'"
- + " not '" + type + "'"
- );
-
- }
- super.attributeDecl (eName, aName, type, mode, value);
+ if (disableDeclarations)
+ return;
+
+ ElementInfo info = (ElementInfo) elements.get (eName);
+ AttributeInfo ainfo = new AttributeInfo ();
+ boolean checkOne = false;
+ boolean interned = false;
+
+ // cheap interning of type names and #FIXED, #REQUIRED
+ // for faster startElement (we can use "==")
+ for (int i = 0; i < types.length; i++) {
+ if (types [i].equals (type)) {
+ type = types [i];
+ interned = true;
+ break;
+ }
+ }
+ if ("#FIXED".equals (mode))
+ mode = "#FIXED";
+ else if ("#REQUIRED".equals (mode))
+ mode = "#REQUIRED";
+
+ ainfo.type = type;
+ ainfo.mode = mode;
+ ainfo.value = value;
+
+ // we might not have seen the content model yet
+ if (info == null) {
+ info = new ElementInfo (eName);
+ elements.put (eName, info);
+ }
+ if ("ID" == type) {
+ checkOne = true;
+ if (!("#REQUIRED" == mode || "#IMPLIED".equals (mode))) {
+ // VC: ID Attribute Default
+ error ("ID attribute '" + aName
+ + "' must be #IMPLIED or #REQUIRED");
+ }
+
+ } else if (!interned && type.startsWith ("NOTATION ")) {
+ checkOne = true;
+
+ // VC: Notation Attributes (notations must be declared)
+ StringTokenizer tokens = new StringTokenizer (
+ type.substring (10, type.lastIndexOf (')')),
+ "|");
+ while (tokens.hasMoreTokens ()) {
+ String token = tokens.nextToken ();
+ if (!notations.contains (token))
+ nDeferred.addElement (token);
+ }
+ }
+ if (checkOne) {
+ for (Enumeration e = info.attributes.keys ();
+ e.hasMoreElements ();
+ /* NOP */) {
+ String name;
+ AttributeInfo ainfo2;
+
+ name = (String) e.nextElement ();
+ ainfo2 = (AttributeInfo) info.attributes.get (name);
+ if (type == ainfo2.type || !interned /* NOTATION */) {
+ // VC: One ID per Element Type
+ // VC: One Notation per Element TYpe
+ error ("Element '" + eName
+ + "' already has an attribute of type "
+ + (interned ? "NOTATION" : type)
+ + " ('" + name
+ + "') so '" + aName
+ + "' is a validity error");
+ }
+ }
+ }
+
+ // VC: Attribute Default Legal
+ if (value != null) {
+
+ if ("CDATA" == type) {
+ // event source rejected '<'
+
+ } else if ("NMTOKEN" == type) {
+ // VC: Name Token (is a nmtoken)
+ isNmtoken (value, "attribute default", aName);
+
+ } else if ("NMTOKENS" == type) {
+ // VC: Name Token (is a nmtoken; at least one value)
+ StringTokenizer tokens = new StringTokenizer (value);
+ if (!tokens.hasMoreTokens ())
+ error ("Default for attribute '" + aName
+ + "' must have at least one name token.");
+ else do {
+ String token = tokens.nextToken ();
+ isNmtoken (token, "attribute default", aName);
+ } while (tokens.hasMoreTokens ());
+
+ } else if ("IDREF" == type || "ENTITY" == type) {
+ // VC: Entity Name (is a name)
+ // VC: IDREF (is a name) (is declared)
+ isName (value, "attribute default", aName);
+ if ("ENTITY" == type && !unparsed.contains (value))
+ uDeferred.addElement (value);
+
+ } else if ("IDREFS" == type || "ENTITIES" == type) {
+ // VC: Entity Name (is a name; at least one value)
+ // VC: IDREF (is a name; at least one value)
+ StringTokenizer names = new StringTokenizer (value);
+ if (!names.hasMoreTokens ())
+ error ("Default for attribute '" + aName
+ + "' must have at least one name.");
+ else do {
+ String name = names.nextToken ();
+ isName (name, "attribute default", aName);
+ if ("ENTITIES" == type && !unparsed.contains (name))
+ uDeferred.addElement (value);
+ } while (names.hasMoreTokens ());
+
+ } else if (type.charAt (0) == '(' /*)*/ ) {
+ // VC: Enumeration (must match)
+ checkEnumeration (value, type, aName);
+
+ } else if (!interned && checkOne) { /* NOTATION */
+ // VC: Notation attributes (must be names)
+ isName (value, "attribute default", aName);
+
+ // VC: Notation attributes (must be declared)
+ if (!notations.contains (value))
+ nDeferred.addElement (value);
+
+ // VC: Enumeration (must match)
+ checkEnumeration (value, type, aName);
+
+ } else if ("ID" != type)
+ throw new RuntimeException ("illegal attribute type: " + type);
+ }
+
+ if (info.attributes.get (aName) == null)
+ info.attributes.put (aName, ainfo);
+ /*
+ else
+ warning ("Element '" + eName
+ + "' already has an attribute named '" + aName + "'");
+ */
+
+ if ("xml:space".equals (aName)) {
+ if (!("(default|preserve)".equals (type)
+ || "(preserve|default)".equals (type)
+ // these next two are arguable; XHTML's DTD doesn't
+ // deserve errors. After all, it's not like any
+ // illegal _value_ could pass ...
+ || "(preserve)".equals (type)
+ || "(default)".equals (type)
+ ))
+ error (
+ "xml:space attribute type must be like '(default|preserve)'"
+ + " not '" + type + "'"
+ );
+
+ }
+ super.attributeDecl (eName, aName, type, mode, value);
}
/**
@@ -807,29 +807,29 @@ public final class ValidationConsumer extends EventFilter
public void elementDecl (String name, String model)
throws SAXException
{
- if (disableDeclarations)
- return;
-
- ElementInfo info = (ElementInfo) elements.get (name);
-
- // we might have seen an attribute decl already
- if (info == null) {
- info = new ElementInfo (name);
- elements.put (name, info);
- }
- if (info.model != null) {
- // NOTE: not all parsers can report such duplicates.
- // VC: Unique Element Type Declaration
- error ("Element type '" + name
- + "' was already declared.");
- } else {
- info.model = model;
-
- // VC: No Duplicate Types (in mixed content models)
- if (model.charAt (1) == '#') // (#PCDATA...
- info.getRecognizer (this);
- }
- super.elementDecl (name, model);
+ if (disableDeclarations)
+ return;
+
+ ElementInfo info = (ElementInfo) elements.get (name);
+
+ // we might have seen an attribute decl already
+ if (info == null) {
+ info = new ElementInfo (name);
+ elements.put (name, info);
+ }
+ if (info.model != null) {
+ // NOTE: not all parsers can report such duplicates.
+ // VC: Unique Element Type Declaration
+ error ("Element type '" + name
+ + "' was already declared.");
+ } else {
+ info.model = model;
+
+ // VC: No Duplicate Types (in mixed content models)
+ if (model.charAt (1) == '#') // (#PCDATA...
+ info.getRecognizer (this);
+ }
+ super.elementDecl (name, model);
}
/**
@@ -839,8 +839,8 @@ public final class ValidationConsumer extends EventFilter
public void internalEntityDecl (String name, String value)
throws SAXException
{
- if (!disableDeclarations)
- super.internalEntityDecl (name, value);
+ if (!disableDeclarations)
+ super.internalEntityDecl (name, value);
}
/**
@@ -848,11 +848,11 @@ public final class ValidationConsumer extends EventFilter
* one was preloaded with a particular DTD
*/
public void externalEntityDecl (String name,
- String publicId, String systemId)
+ String publicId, String systemId)
throws SAXException
{
- if (!disableDeclarations)
- super.externalEntityDecl (name, publicId, systemId);
+ if (!disableDeclarations)
+ super.externalEntityDecl (name, publicId, systemId);
}
@@ -865,11 +865,11 @@ public final class ValidationConsumer extends EventFilter
public void notationDecl (String name, String publicId, String systemId)
throws SAXException
{
- if (disableDeclarations)
- return;
+ if (disableDeclarations)
+ return;
- notations.addElement (name);
- super.notationDecl (name, publicId, systemId);
+ notations.addElement (name);
+ super.notationDecl (name, publicId, systemId);
}
/**
@@ -879,22 +879,22 @@ public final class ValidationConsumer extends EventFilter
* unless this one was preloaded with a particular DTD.
*/
public void unparsedEntityDecl (
- String name,
- String publicId,
- String systemId,
- String notationName
+ String name,
+ String publicId,
+ String systemId,
+ String notationName
) throws SAXException
{
- if (disableDeclarations)
- return;
+ if (disableDeclarations)
+ return;
- unparsed.addElement (name);
- if (!notations.contains (notationName))
- nDeferred.addElement (notationName);
- super.unparsedEntityDecl (name, publicId, systemId, notationName);
+ unparsed.addElement (name);
+ if (!notations.contains (notationName))
+ nDeferred.addElement (notationName);
+ super.unparsedEntityDecl (name, publicId, systemId, notationName);
}
-
-
+
+
/**
* <b>ContentHandler</b> Ensures that state from any previous parse
* has been deleted.
@@ -903,14 +903,14 @@ public final class ValidationConsumer extends EventFilter
public void startDocument ()
throws SAXException
{
- resetState ();
- super.startDocument ();
+ resetState ();
+ super.startDocument ();
}
private static boolean isAsciiLetter (char c)
{
- return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}
@@ -921,7 +921,7 @@ public final class ValidationConsumer extends EventFilter
public void skippedEntity (String name)
throws SAXException
{
- fatalError ("may not skip entities");
+ fatalError ("may not skip entities");
}
/*
@@ -930,14 +930,14 @@ public final class ValidationConsumer extends EventFilter
private String expandDefaultRefs (String s)
throws SAXException
{
- if (s.indexOf ('&') < 0)
- return s;
-
+ if (s.indexOf ('&') < 0)
+ return s;
+
// FIXME: handle &#nn; &#xnn; &name;
- String message = "Can't expand refs in attribute default: " + s;
- warning (message);
+ String message = "Can't expand refs in attribute default: " + s;
+ warning (message);
- return s;
+ return s;
}
/**
@@ -946,248 +946,248 @@ public final class ValidationConsumer extends EventFilter
* Passed to the next consumer.
*/
public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
+ String uri,
+ String localName,
+ String qName,
+ Attributes atts
) throws SAXException
{
- //
- // First check content model for the enclosing scope.
- //
- if (contentStack.isEmpty ()) {
- // VC: Root Element Type
- if (!qName.equals (rootName)) {
- if (rootName == null)
- warning ("This document has no DTD, can't be valid");
- else
- error ("Root element type '" + qName
- + "' was declared to be '" + rootName + "'");
- }
- } else {
- Recognizer state = (Recognizer) contentStack.peek ();
-
- if (state != null) {
- Recognizer newstate = state.acceptElement (qName);
-
- if (newstate == null)
- error ("Element type '" + qName
- + "' in element '" + state.type.name
- + "' violates content model " + state.type.model
- );
- if (newstate != state) {
- contentStack.pop ();
- contentStack.push (newstate);
- }
- }
- }
-
- //
- // Then check that this element was declared, and push the
- // object used to validate its content model onto our stack.
- //
- // This is where the recognizer gets created, if needed; if
- // it's a "children" (elements) content model, an NDFA is
- // created. (One recognizer is used per content type, no
- // matter how complex that recognizer is.)
- //
- ElementInfo info;
-
- info = (ElementInfo) elements.get (qName);
- if (info == null || info.model == null) {
- // VC: Element Valid (base clause)
- error ("Element type '" + qName + "' was not declared");
- contentStack.push (null);
-
- // for less diagnostic noise, fake a declaration.
- elementDecl (qName, "ANY");
- } else
- contentStack.push (info.getRecognizer (this));
-
- //
- // Then check each attribute present
- //
- int len;
- String aname;
- AttributeInfo ainfo;
-
- if (atts != null)
- len = atts.getLength ();
- else
- len = 0;
-
- for (int i = 0; i < len; i++) {
- aname = atts.getQName (i);
-
- if (info == null
- || (ainfo = (AttributeInfo) info.attributes.get (aname))
- == null) {
- // VC: Attribute Value Type
- error ("Attribute '" + aname
- + "' was not declared for element type " + qName);
- continue;
- }
-
- String value = atts.getValue (i);
-
- // note that "==" for type names and "#FIXED" is correct
- // (and fast) since we've interned those literals.
-
- if ("#FIXED" == ainfo.mode) {
- String expanded = expandDefaultRefs (ainfo.value);
-
- // VC: Fixed Attribute Default
- if (!value.equals (expanded)) {
- error ("Attribute '" + aname
- + "' must match " + expanded
- );
- continue;
- }
- }
-
- if ("CDATA" == ainfo.type)
- continue;
-
- //
- // For all other attribute types, there are various
- // rules to follow.
- //
-
- if ("ID" == ainfo.type) {
- // VC: ID (must be a name)
- if (isName (value, "ID attribute", aname)) {
- if (Boolean.TRUE == ids.get (value))
- // VC: ID (appears once)
- error ("ID attribute " + aname
- + " uses an ID value '" + value
- + "' which was already declared.");
- else
- // any forward refs are no longer problems
- ids.put (value, Boolean.TRUE);
- }
- continue;
- }
-
- if ("IDREF" == ainfo.type) {
- // VC: IDREF (value must be a name)
- if (isName (value, "IDREF attribute", aname)) {
- // VC: IDREF (must match some ID attribute)
- if (ids.get (value) == null)
- // new -- assume it's a forward ref
- ids.put (value, Boolean.FALSE);
- }
- continue;
- }
-
- if ("IDREFS" == ainfo.type) {
- StringTokenizer tokens = new StringTokenizer (value, " ");
-
- if (!tokens.hasMoreTokens ()) {
- // VC: IDREF (one or more values)
- error ("IDREFS attribute " + aname
- + " must have at least one ID ref");
- } else do {
- String id = tokens.nextToken ();
-
- // VC: IDREF (value must be a name)
- if (isName (id, "IDREFS attribute", aname)) {
- // VC: IDREF (must match some ID attribute)
- if (ids.get (id) == null)
- // new -- assume it's a forward ref
- ids.put (id, Boolean.FALSE);
- }
- } while (tokens.hasMoreTokens ());
- continue;
- }
-
- if ("NMTOKEN" == ainfo.type) {
- // VC: Name Token (is a name token)
- isNmtoken (value, "NMTOKEN attribute", aname);
- continue;
- }
-
- if ("NMTOKENS" == ainfo.type) {
- StringTokenizer tokens = new StringTokenizer (value, " ");
-
- if (!tokens.hasMoreTokens ()) {
- // VC: Name Token (one or more values)
- error ("NMTOKENS attribute " + aname
- + " must have at least one name token");
- } else do {
- String token = tokens.nextToken ();
-
- // VC: Name Token (is a name token)
- isNmtoken (token, "NMTOKENS attribute", aname);
- } while (tokens.hasMoreTokens ());
- continue;
- }
-
- if ("ENTITY" == ainfo.type) {
- if (!unparsed.contains (value))
- // VC: Entity Name
- error ("Value of attribute '" + aname
- + "' refers to unparsed entity '" + value
- + "' which was not declared.");
- continue;
- }
-
- if ("ENTITIES" == ainfo.type) {
- StringTokenizer tokens = new StringTokenizer (value, " ");
-
- if (!tokens.hasMoreTokens ()) {
- // VC: Entity Name (one or more values)
- error ("ENTITIES attribute " + aname
- + " must have at least one name token");
- } else do {
- String entity = tokens.nextToken ();
-
- if (!unparsed.contains (entity))
- // VC: Entity Name
- error ("Value of attribute '" + aname
- + "' refers to unparsed entity '" + entity
- + "' which was not declared.");
- } while (tokens.hasMoreTokens ());
- continue;
- }
-
- //
- // check for enumerations last; more expensive
- //
- if (ainfo.type.charAt (0) == '(' /*)*/
- || ainfo.type.startsWith ("NOTATION ")
- ) {
- // VC: Enumeration (value must be defined)
- checkEnumeration (value, ainfo.type, aname);
- continue;
- }
- }
-
- //
- // Last, check that all #REQUIRED attributes were provided
- //
- if (info != null) {
- Hashtable table = info.attributes;
-
- if (table.size () != 0) {
- Enumeration e = table.keys ();
-
- // XXX table.keys uses the heap, bleech -- slows things
-
- while (e.hasMoreElements ()) {
- aname = (String) e.nextElement ();
- ainfo = (AttributeInfo) table.get (aname);
-
- // "#REQUIRED" mode was interned in attributeDecl
- if ("#REQUIRED" == ainfo.mode
- && atts.getValue (aname) == null) {
- // VC: Required Attribute
- error ("Attribute '" + aname + "' must be specified "
- + "for element type " + qName);
- }
- }
- }
- }
- super.startElement (uri, localName, qName, atts);
+ //
+ // First check content model for the enclosing scope.
+ //
+ if (contentStack.isEmpty ()) {
+ // VC: Root Element Type
+ if (!qName.equals (rootName)) {
+ if (rootName == null)
+ warning ("This document has no DTD, can't be valid");
+ else
+ error ("Root element type '" + qName
+ + "' was declared to be '" + rootName + "'");
+ }
+ } else {
+ Recognizer state = (Recognizer) contentStack.peek ();
+
+ if (state != null) {
+ Recognizer newstate = state.acceptElement (qName);
+
+ if (newstate == null)
+ error ("Element type '" + qName
+ + "' in element '" + state.type.name
+ + "' violates content model " + state.type.model
+ );
+ if (newstate != state) {
+ contentStack.pop ();
+ contentStack.push (newstate);
+ }
+ }
+ }
+
+ //
+ // Then check that this element was declared, and push the
+ // object used to validate its content model onto our stack.
+ //
+ // This is where the recognizer gets created, if needed; if
+ // it's a "children" (elements) content model, an NDFA is
+ // created. (One recognizer is used per content type, no
+ // matter how complex that recognizer is.)
+ //
+ ElementInfo info;
+
+ info = (ElementInfo) elements.get (qName);
+ if (info == null || info.model == null) {
+ // VC: Element Valid (base clause)
+ error ("Element type '" + qName + "' was not declared");
+ contentStack.push (null);
+
+ // for less diagnostic noise, fake a declaration.
+ elementDecl (qName, "ANY");
+ } else
+ contentStack.push (info.getRecognizer (this));
+
+ //
+ // Then check each attribute present
+ //
+ int len;
+ String aname;
+ AttributeInfo ainfo;
+
+ if (atts != null)
+ len = atts.getLength ();
+ else
+ len = 0;
+
+ for (int i = 0; i < len; i++) {
+ aname = atts.getQName (i);
+
+ if (info == null
+ || (ainfo = (AttributeInfo) info.attributes.get (aname))
+ == null) {
+ // VC: Attribute Value Type
+ error ("Attribute '" + aname
+ + "' was not declared for element type " + qName);
+ continue;
+ }
+
+ String value = atts.getValue (i);
+
+ // note that "==" for type names and "#FIXED" is correct
+ // (and fast) since we've interned those literals.
+
+ if ("#FIXED" == ainfo.mode) {
+ String expanded = expandDefaultRefs (ainfo.value);
+
+ // VC: Fixed Attribute Default
+ if (!value.equals (expanded)) {
+ error ("Attribute '" + aname
+ + "' must match " + expanded
+ );
+ continue;
+ }
+ }
+
+ if ("CDATA" == ainfo.type)
+ continue;
+
+ //
+ // For all other attribute types, there are various
+ // rules to follow.
+ //
+
+ if ("ID" == ainfo.type) {
+ // VC: ID (must be a name)
+ if (isName (value, "ID attribute", aname)) {
+ if (Boolean.TRUE == ids.get (value))
+ // VC: ID (appears once)
+ error ("ID attribute " + aname
+ + " uses an ID value '" + value
+ + "' which was already declared.");
+ else
+ // any forward refs are no longer problems
+ ids.put (value, Boolean.TRUE);
+ }
+ continue;
+ }
+
+ if ("IDREF" == ainfo.type) {
+ // VC: IDREF (value must be a name)
+ if (isName (value, "IDREF attribute", aname)) {
+ // VC: IDREF (must match some ID attribute)
+ if (ids.get (value) == null)
+ // new -- assume it's a forward ref
+ ids.put (value, Boolean.FALSE);
+ }
+ continue;
+ }
+
+ if ("IDREFS" == ainfo.type) {
+ StringTokenizer tokens = new StringTokenizer (value, " ");
+
+ if (!tokens.hasMoreTokens ()) {
+ // VC: IDREF (one or more values)
+ error ("IDREFS attribute " + aname
+ + " must have at least one ID ref");
+ } else do {
+ String id = tokens.nextToken ();
+
+ // VC: IDREF (value must be a name)
+ if (isName (id, "IDREFS attribute", aname)) {
+ // VC: IDREF (must match some ID attribute)
+ if (ids.get (id) == null)
+ // new -- assume it's a forward ref
+ ids.put (id, Boolean.FALSE);
+ }
+ } while (tokens.hasMoreTokens ());
+ continue;
+ }
+
+ if ("NMTOKEN" == ainfo.type) {
+ // VC: Name Token (is a name token)
+ isNmtoken (value, "NMTOKEN attribute", aname);
+ continue;
+ }
+
+ if ("NMTOKENS" == ainfo.type) {
+ StringTokenizer tokens = new StringTokenizer (value, " ");
+
+ if (!tokens.hasMoreTokens ()) {
+ // VC: Name Token (one or more values)
+ error ("NMTOKENS attribute " + aname
+ + " must have at least one name token");
+ } else do {
+ String token = tokens.nextToken ();
+
+ // VC: Name Token (is a name token)
+ isNmtoken (token, "NMTOKENS attribute", aname);
+ } while (tokens.hasMoreTokens ());
+ continue;
+ }
+
+ if ("ENTITY" == ainfo.type) {
+ if (!unparsed.contains (value))
+ // VC: Entity Name
+ error ("Value of attribute '" + aname
+ + "' refers to unparsed entity '" + value
+ + "' which was not declared.");
+ continue;
+ }
+
+ if ("ENTITIES" == ainfo.type) {
+ StringTokenizer tokens = new StringTokenizer (value, " ");
+
+ if (!tokens.hasMoreTokens ()) {
+ // VC: Entity Name (one or more values)
+ error ("ENTITIES attribute " + aname
+ + " must have at least one name token");
+ } else do {
+ String entity = tokens.nextToken ();
+
+ if (!unparsed.contains (entity))
+ // VC: Entity Name
+ error ("Value of attribute '" + aname
+ + "' refers to unparsed entity '" + entity
+ + "' which was not declared.");
+ } while (tokens.hasMoreTokens ());
+ continue;
+ }
+
+ //
+ // check for enumerations last; more expensive
+ //
+ if (ainfo.type.charAt (0) == '(' /*)*/
+ || ainfo.type.startsWith ("NOTATION ")
+ ) {
+ // VC: Enumeration (value must be defined)
+ checkEnumeration (value, ainfo.type, aname);
+ continue;
+ }
+ }
+
+ //
+ // Last, check that all #REQUIRED attributes were provided
+ //
+ if (info != null) {
+ Hashtable table = info.attributes;
+
+ if (table.size () != 0) {
+ Enumeration e = table.keys ();
+
+ // XXX table.keys uses the heap, bleech -- slows things
+
+ while (e.hasMoreElements ()) {
+ aname = (String) e.nextElement ();
+ ainfo = (AttributeInfo) table.get (aname);
+
+ // "#REQUIRED" mode was interned in attributeDecl
+ if ("#REQUIRED" == ainfo.mode
+ && atts.getValue (aname) == null) {
+ // VC: Required Attribute
+ error ("Attribute '" + aname + "' must be specified "
+ + "for element type " + qName);
+ }
+ }
+ }
+ }
+ super.startElement (uri, localName, qName, atts);
}
/**
@@ -1198,25 +1198,25 @@ public final class ValidationConsumer extends EventFilter
public void characters (char ch [], int start, int length)
throws SAXException
{
- Recognizer state;
-
- if (contentStack.empty ())
- state = null;
- else
- state = (Recognizer) contentStack.peek ();
-
- // NOTE: if this ever supports with SAX parsers that don't
- // report ignorable whitespace as such (only XP?), this class
- // needs to morph it into ignorableWhitespace() as needed ...
-
- if (state != null && !state.acceptCharacters ())
- // VC: Element Valid (clauses three, four -- see recognizer)
- error ("Character content not allowed in element "
- + state.type.name);
-
- super.characters (ch, start, length);
+ Recognizer state;
+
+ if (contentStack.empty ())
+ state = null;
+ else
+ state = (Recognizer) contentStack.peek ();
+
+ // NOTE: if this ever supports with SAX parsers that don't
+ // report ignorable whitespace as such (only XP?), this class
+ // needs to morph it into ignorableWhitespace() as needed ...
+
+ if (state != null && !state.acceptCharacters ())
+ // VC: Element Valid (clauses three, four -- see recognizer)
+ error ("Character content not allowed in element "
+ + state.type.name);
+
+ super.characters (ch, start, length);
}
-
+
/**
* <b>ContentHandler</b> Reports a validity error if the element's content
@@ -1227,95 +1227,95 @@ public final class ValidationConsumer extends EventFilter
public void endElement (String uri, String localName, String qName)
throws SAXException
{
- try {
- Recognizer state = (Recognizer) contentStack.pop ();
-
- if (state != null && !state.completed ())
- // VC: Element valid (clauses two, three, four; see Recognizer)
- error ("Premature end for element '"
- + state.type.name
- + "', content model "
- + state.type.model);
-
- // could insist on match of start element, but that's
- // something the input stream must to guarantee.
-
- } catch (EmptyStackException e) {
- fatalError ("endElement without startElement: " + qName
- + ((uri == null)
- ? ""
- : ( " { '" + uri + "', " + localName + " }")));
- }
- super.endElement (uri, localName, qName);
+ try {
+ Recognizer state = (Recognizer) contentStack.pop ();
+
+ if (state != null && !state.completed ())
+ // VC: Element valid (clauses two, three, four; see Recognizer)
+ error ("Premature end for element '"
+ + state.type.name
+ + "', content model "
+ + state.type.model);
+
+ // could insist on match of start element, but that's
+ // something the input stream must to guarantee.
+
+ } catch (EmptyStackException e) {
+ fatalError ("endElement without startElement: " + qName
+ + ((uri == null)
+ ? ""
+ : ( " { '" + uri + "', " + localName + " }")));
+ }
+ super.endElement (uri, localName, qName);
}
/**
* <b>ContentHandler</b> Checks whether all ID values that were
- * referenced have been declared, and releases all resources.
+ * referenced have been declared, and releases all resources.
* Passed to the next consumer.
- *
+ *
* @see #setDocumentLocator
*/
public void endDocument ()
throws SAXException
{
- for (Enumeration idNames = ids.keys ();
- idNames.hasMoreElements ();
- /* NOP */) {
- String id = (String) idNames.nextElement ();
-
- if (Boolean.FALSE == ids.get (id)) {
- // VC: IDREF (must match ID)
- error ("Undeclared ID value '" + id
- + "' was referred to by an IDREF/IDREFS attribute");
- }
- }
-
- resetState ();
- super.endDocument ();
+ for (Enumeration idNames = ids.keys ();
+ idNames.hasMoreElements ();
+ /* NOP */) {
+ String id = (String) idNames.nextElement ();
+
+ if (Boolean.FALSE == ids.get (id)) {
+ // VC: IDREF (must match ID)
+ error ("Undeclared ID value '" + id
+ + "' was referred to by an IDREF/IDREFS attribute");
+ }
+ }
+
+ resetState ();
+ super.endDocument ();
}
/** Holds per-element declarations */
static private final class ElementInfo
{
- String name;
- String model;
-
- // key = attribute name; value = AttributeInfo
- Hashtable attributes = new Hashtable (11);
-
- ElementInfo (String n) { name = n; }
-
- private Recognizer recognizer;
-
- // for validating content models: one per type, shared,
- // and constructed only on demand ... so unused elements do
- // not need to consume resources.
- Recognizer getRecognizer (ValidationConsumer consumer)
- throws SAXException
- {
- if (recognizer == null) {
- if ("ANY".equals (model))
- recognizer = ANY;
- else if ("EMPTY".equals (model))
- recognizer = new EmptyRecognizer (this);
- else if ('#' == model.charAt (1))
- // n.b. this constructor does a validity check
- recognizer = new MixedRecognizer (this, consumer);
- else
- recognizer = new ChildrenRecognizer (this, consumer);
- }
- return recognizer;
- }
+ String name;
+ String model;
+
+ // key = attribute name; value = AttributeInfo
+ Hashtable attributes = new Hashtable (11);
+
+ ElementInfo (String n) { name = n; }
+
+ private Recognizer recognizer;
+
+ // for validating content models: one per type, shared,
+ // and constructed only on demand ... so unused elements do
+ // not need to consume resources.
+ Recognizer getRecognizer (ValidationConsumer consumer)
+ throws SAXException
+ {
+ if (recognizer == null) {
+ if ("ANY".equals (model))
+ recognizer = ANY;
+ else if ("EMPTY".equals (model))
+ recognizer = new EmptyRecognizer (this);
+ else if ('#' == model.charAt (1))
+ // n.b. this constructor does a validity check
+ recognizer = new MixedRecognizer (this, consumer);
+ else
+ recognizer = new ChildrenRecognizer (this, consumer);
+ }
+ return recognizer;
+ }
}
/** Holds per-attribute declarations */
static private final class AttributeInfo
{
- String type;
- String mode; // #REQUIRED, etc (or null)
- String value; // or null
+ String type;
+ String mode; // #REQUIRED, etc (or null)
+ String value; // or null
}
@@ -1323,120 +1323,120 @@ public final class ValidationConsumer extends EventFilter
// Content model validation
//
- static private final Recognizer ANY = new Recognizer (null);
+ static private final Recognizer ANY = new Recognizer (null);
// Base class defines the calls used to validate content,
// and supports the "ANY" content model
static private class Recognizer
{
- final ElementInfo type;
-
- Recognizer (ElementInfo t) { type = t; }
-
- // return true iff character data is legal here
- boolean acceptCharacters ()
- throws SAXException
- // VC: Element Valid (third and fourth clauses)
- { return true; }
-
- // null return = failure
- // otherwise, next state (like an FSM)
- // prerequisite: tested that name was declared
- Recognizer acceptElement (String name)
- throws SAXException
- // VC: Element Valid (fourth clause)
- { return this; }
-
- // return true iff model is completed, can finish
- boolean completed ()
- throws SAXException
- // VC: Element Valid (fourth clause)
- { return true; }
-
- public String toString ()
- // n.b. "children" is the interesting case!
- { return (type == null) ? "ANY" : type.model; }
+ final ElementInfo type;
+
+ Recognizer (ElementInfo t) { type = t; }
+
+ // return true iff character data is legal here
+ boolean acceptCharacters ()
+ throws SAXException
+ // VC: Element Valid (third and fourth clauses)
+ { return true; }
+
+ // null return = failure
+ // otherwise, next state (like an FSM)
+ // prerequisite: tested that name was declared
+ Recognizer acceptElement (String name)
+ throws SAXException
+ // VC: Element Valid (fourth clause)
+ { return this; }
+
+ // return true iff model is completed, can finish
+ boolean completed ()
+ throws SAXException
+ // VC: Element Valid (fourth clause)
+ { return true; }
+
+ public String toString ()
+ // n.b. "children" is the interesting case!
+ { return (type == null) ? "ANY" : type.model; }
}
// "EMPTY" content model -- no characters or elements
private static final class EmptyRecognizer extends Recognizer
{
- public EmptyRecognizer (ElementInfo type)
- { super (type); }
+ public EmptyRecognizer (ElementInfo type)
+ { super (type); }
- // VC: Element Valid (first clause)
- boolean acceptCharacters ()
- { return false; }
+ // VC: Element Valid (first clause)
+ boolean acceptCharacters ()
+ { return false; }
- // VC: Element Valid (first clause)
- Recognizer acceptElement (String name)
- { return null; }
+ // VC: Element Valid (first clause)
+ Recognizer acceptElement (String name)
+ { return null; }
}
// "Mixed" content model -- ANY, but restricts elements
private static final class MixedRecognizer extends Recognizer
{
- private String permitted [];
-
- // N.B. constructor tests for duplicated element names (VC)
- public MixedRecognizer (ElementInfo t, ValidationConsumer v)
- throws SAXException
- {
- super (t);
-
- // (#PCDATA...)* or (#PCDATA) ==> ... or empty
- // with the "..." being "|elname|..."
- StringTokenizer tokens = new StringTokenizer (
- t.model.substring (8, t.model.lastIndexOf (')')),
- "|");
- Vector vec = new Vector ();
-
- while (tokens.hasMoreTokens ()) {
- String token = tokens.nextToken ();
-
- if (vec.contains (token))
- v.error ("element " + token
- + " is repeated in mixed content model: "
- + t.model);
- else
- vec.addElement (token.intern ());
- }
- permitted = new String [vec.size ()];
- for (int i = 0; i < permitted.length; i++)
- permitted [i] = (String) vec.elementAt (i);
-
- // in one large machine-derived DTD sample, most of about
- // 250 mixed content models were empty, and 25 had ten or
- // more entries. 2 had over a hundred elements. Linear
- // search isn't obviously wrong.
- }
-
- // VC: Element Valid (third clause)
- Recognizer acceptElement (String name)
- {
- int length = permitted.length;
-
- // first pass -- optimistic w.r.t. event source interning
- // (and document validity)
- for (int i = 0; i < length; i++)
- if (permitted [i] == name)
- return this;
- // second pass -- pessimistic w.r.t. event source interning
- for (int i = 0; i < length; i++)
- if (permitted [i].equals (name))
- return this;
- return null;
- }
+ private String permitted [];
+
+ // N.B. constructor tests for duplicated element names (VC)
+ public MixedRecognizer (ElementInfo t, ValidationConsumer v)
+ throws SAXException
+ {
+ super (t);
+
+ // (#PCDATA...)* or (#PCDATA) ==> ... or empty
+ // with the "..." being "|elname|..."
+ StringTokenizer tokens = new StringTokenizer (
+ t.model.substring (8, t.model.lastIndexOf (')')),
+ "|");
+ Vector vec = new Vector ();
+
+ while (tokens.hasMoreTokens ()) {
+ String token = tokens.nextToken ();
+
+ if (vec.contains (token))
+ v.error ("element " + token
+ + " is repeated in mixed content model: "
+ + t.model);
+ else
+ vec.addElement (token.intern ());
+ }
+ permitted = new String [vec.size ()];
+ for (int i = 0; i < permitted.length; i++)
+ permitted [i] = (String) vec.elementAt (i);
+
+ // in one large machine-derived DTD sample, most of about
+ // 250 mixed content models were empty, and 25 had ten or
+ // more entries. 2 had over a hundred elements. Linear
+ // search isn't obviously wrong.
+ }
+
+ // VC: Element Valid (third clause)
+ Recognizer acceptElement (String name)
+ {
+ int length = permitted.length;
+
+ // first pass -- optimistic w.r.t. event source interning
+ // (and document validity)
+ for (int i = 0; i < length; i++)
+ if (permitted [i] == name)
+ return this;
+ // second pass -- pessimistic w.r.t. event source interning
+ for (int i = 0; i < length; i++)
+ if (permitted [i].equals (name))
+ return this;
+ return null;
+ }
}
// recognizer loop flags, see later
- private static final int F_LOOPHEAD = 0x01;
- private static final int F_LOOPNEXT = 0x02;
+ private static final int F_LOOPHEAD = 0x01;
+ private static final int F_LOOPNEXT = 0x02;
// for debugging -- used to label/count nodes in toString()
- private static int nodeCount;
+ private static int nodeCount;
/**
* "Children" content model -- these are nodes in NDFA state graphs.
@@ -1463,466 +1463,466 @@ public final class ValidationConsumer extends EventFilter
* graph to have one exit node (or more EMPTY nodes).
*/
private static final class ChildrenRecognizer extends Recognizer
- implements Cloneable
+ implements Cloneable
{
- // for reporting non-deterministic content models
- // ... a waste of space if we're not reporting those!
- // ... along with the 'model' member (in base class)
- private ValidationConsumer consumer;
-
- // for CHOICE nodes -- each component is an arc that
- // accepts a different NAME (or is EMPTY indicating
- // NDFA termination).
- private Recognizer components [];
-
- // for NAME/SEQUENCE nodes -- accepts that NAME and
- // then goes to the next node (CHOICE, NAME, EMPTY).
- private String name;
- private Recognizer next;
-
- // loops always point back to a CHOICE node. we mark such choice
- // nodes (F_LOOPHEAD) for diagnostics and faster deep cloning.
- // We also mark nodes before back pointers (F_LOOPNEXT), to ensure
- // termination when we patch sequences and loops.
- private int flags;
-
-
- // prevent a needless indirection between 'this' and 'node'
- private void copyIn (ChildrenRecognizer node)
- {
- // model & consumer are already set
- components = node.components;
- name = node.name;
- next = node.next;
- flags = node.flags;
- }
-
- // used to construct top level "children" content models,
- public ChildrenRecognizer (ElementInfo type, ValidationConsumer vc)
- {
- this (vc, type);
- populate (type.model.toCharArray (), 0);
- patchNext (new EmptyRecognizer (type), null);
- }
-
- // used internally; populating is separate
- private ChildrenRecognizer (ValidationConsumer vc, ElementInfo type)
- {
- super (type);
- consumer = vc;
- }
-
-
- //
- // When rewriting some graph nodes we need deep clones in one case;
- // mostly shallow clones (what the JVM handles for us) are fine.
- //
- private ChildrenRecognizer shallowClone ()
- {
- try {
- return (ChildrenRecognizer) clone ();
- } catch (CloneNotSupportedException e) {
- throw new Error ("clone");
- }
- }
-
- private ChildrenRecognizer deepClone ()
- {
- return deepClone (new Hashtable (37));
- }
-
- private ChildrenRecognizer deepClone (Hashtable table)
- {
- ChildrenRecognizer retval;
-
- if ((flags & F_LOOPHEAD) != 0) {
- retval = (ChildrenRecognizer) table.get (this);
- if (retval != null)
- return this;
-
- retval = shallowClone ();
- table.put (this, retval);
- } else
- retval = shallowClone ();
-
- if (next != null) {
- if (next instanceof ChildrenRecognizer)
- retval.next = ((ChildrenRecognizer)next)
- .deepClone (table);
- else if (!(next instanceof EmptyRecognizer))
- throw new RuntimeException ("deepClone");
- }
-
- if (components != null) {
- retval.components = new Recognizer [components.length];
- for (int i = 0; i < components.length; i++) {
- Recognizer temp = components [i];
-
- if (temp == null)
- retval.components [i] = null;
- else if (temp instanceof ChildrenRecognizer)
- retval.components [i] = ((ChildrenRecognizer)temp)
- .deepClone (table);
- else if (!(temp instanceof EmptyRecognizer))
- throw new RuntimeException ("deepClone");
- }
- }
-
- return retval;
- }
-
- // connect subgraphs, first to next (sequencing)
- private void patchNext (Recognizer theNext, Hashtable table)
- {
- // backpointers must not be repatched or followed
- if ((flags & F_LOOPNEXT) != 0)
- return;
-
- // XXX this table "shouldn't" be needed, right?
- // but some choice nodes looped if it isn't there.
- if (table != null && table.get (this) != null)
- return;
- if (table == null)
- table = new Hashtable ();
-
- // NAME/SEQUENCE
- if (name != null) {
- if (next == null)
- next = theNext;
- else if (next instanceof ChildrenRecognizer) {
- ((ChildrenRecognizer)next).patchNext (theNext, table);
- } else if (!(next instanceof EmptyRecognizer))
- throw new RuntimeException ("patchNext");
- return;
- }
-
- // CHOICE
- for (int i = 0; i < components.length; i++) {
- if (components [i] == null)
- components [i] = theNext;
- else if (components [i] instanceof ChildrenRecognizer) {
- ((ChildrenRecognizer)components [i])
- .patchNext (theNext, table);
- } else if (!(components [i] instanceof EmptyRecognizer))
- throw new RuntimeException ("patchNext");
- }
-
- if (table != null && (flags & F_LOOPHEAD) != 0)
- table.put (this, this);
- }
-
- /**
- * Parses a 'children' spec (or recursively 'cp') and makes this
- * become a regular graph node.
- *
- * @return index after this particle
- */
- private int populate (char parseBuf [], int startPos)
- {
- int nextPos = startPos + 1;
- char c;
-
- if (nextPos < 0 || nextPos >= parseBuf.length)
- throw new IndexOutOfBoundsException ();
-
- // Grammar of the string is from the XML spec, but
- // with whitespace removed by the SAX parser.
-
- // children ::= (choice | seq) ('?' | '*' | '+')?
- // cp ::= (Name | choice | seq) ('?' | '*' | '+')?
- // choice ::= '(' cp ('|' choice)* ')'
- // seq ::= '(' cp (',' choice)* ')'
-
- // interior nodes only
- // cp ::= name ...
- if (parseBuf [startPos] != '('/*)*/) {
- boolean done = false;
- do {
- switch (c = parseBuf [nextPos]) {
- case '?': case '*': case '+':
- case '|': case ',':
- case /*(*/ ')':
- done = true;
- continue;
- default:
- nextPos++;
- continue;
- }
- } while (!done);
- name = new String (parseBuf, startPos, nextPos - startPos);
-
- // interior OR toplevel nodes
- // cp ::= choice ..
- // cp ::= seq ..
- } else {
- // collect everything as a separate list, and merge it
- // into "this" later if we can (SEQUENCE or singleton)
- ChildrenRecognizer first;
-
- first = new ChildrenRecognizer (consumer, type);
- nextPos = first.populate (parseBuf, nextPos);
- c = parseBuf [nextPos++];
-
- if (c == ',' || c == '|') {
- ChildrenRecognizer current = first;
- char separator = c;
- Vector v = null;
-
- if (separator == '|') {
- v = new Vector ();
- v.addElement (first);
- }
-
- do {
- ChildrenRecognizer link;
-
- link = new ChildrenRecognizer (consumer, type);
- nextPos = link.populate (parseBuf, nextPos);
-
- if (separator == ',') {
- current.patchNext (link, null);
- current = link;
- } else
- v.addElement (link);
-
- c = parseBuf [nextPos++];
- } while (c == separator);
-
- // choice ... collect everything into one array.
- if (separator == '|') {
- // assert v.size() > 1
- components = new Recognizer [v.size ()];
- for (int i = 0; i < components.length; i++) {
- components [i] = (Recognizer)
- v.elementAt (i);
- }
- // assert flags == 0
-
- // sequence ... merge into "this" to be smaller.
- } else
- copyIn (first);
-
- // treat singletons like one-node sequences.
- } else
- copyIn (first);
-
- if (c != /*(*/ ')')
- throw new RuntimeException ("corrupt content model");
- }
-
- //
- // Arity is optional, and the root of all fun. We keep the
- // FSM state graph simple by only having NAME/SEQUENCE and
- // CHOICE nodes (or EMPTY to terminate a model), easily
- // evaluated. So we rewrite each node that has arity, using
- // those primitives. We create loops here, if needed.
- //
- if (nextPos < parseBuf.length) {
- c = parseBuf [nextPos];
- if (c == '?' || c == '*' || c == '+') {
- nextPos++;
-
- // Rewrite 'zero-or-one' "?" arity to a CHOICE:
- // - SEQUENCE (clone, what's next)
- // - or, what's next
- // Size cost: N --> N + 1
- if (c == '?') {
- Recognizer once = shallowClone ();
-
- components = new Recognizer [2];
- components [0] = once;
- // components [1] initted to null
- name = null;
- next = null;
- flags = 0;
-
-
- // Rewrite 'zero-or-more' "*" arity to a CHOICE.
- // - LOOP (clone, back to this CHOICE)
- // - or, what's next
- // Size cost: N --> N + 1
- } else if (c == '*') {
- ChildrenRecognizer loop = shallowClone ();
-
- loop.patchNext (this, null);
- loop.flags |= F_LOOPNEXT;
- flags = F_LOOPHEAD;
-
- components = new Recognizer [2];
- components [0] = loop;
- // components [1] initted to null
- name = null;
- next = null;
-
-
- // Rewrite 'one-or-more' "+" arity to a SEQUENCE.
- // Basically (a)+ --> ((a),(a)*).
- // - this
- // - CHOICE
- // * LOOP (clone, back to the CHOICE)
- // * or, whatever's next
- // Size cost: N --> 2N + 1
- } else if (c == '+') {
- ChildrenRecognizer loop = deepClone ();
- ChildrenRecognizer choice;
-
- choice = new ChildrenRecognizer (consumer, type);
- loop.patchNext (choice, null);
- loop.flags |= F_LOOPNEXT;
- choice.flags = F_LOOPHEAD;
-
- choice.components = new Recognizer [2];
- choice.components [0] = loop;
- // choice.components [1] initted to null
- // choice.name, choice.next initted to null
-
- patchNext (choice, null);
- }
- }
- }
-
- return nextPos;
- }
-
- // VC: Element Valid (second clause)
- boolean acceptCharacters ()
- { return false; }
-
- // VC: Element Valid (second clause)
- Recognizer acceptElement (String type)
- throws SAXException
- {
- // NAME/SEQUENCE
- if (name != null) {
- if (name.equals (type))
- return next;
- return null;
- }
-
- // CHOICE ... optionally reporting nondeterminism we
- // run across. we won't check out every transition
- // for nondeterminism; only the ones we follow.
- Recognizer retval = null;
-
- for (int i = 0; i < components.length; i++) {
- Recognizer temp = components [i].acceptElement (type);
-
- if (temp == null)
- continue;
- else if (!warnNonDeterministic)
- return temp;
- else if (retval == null)
- retval = temp;
- else if (retval != temp)
- consumer.error ("Content model " + this.type.model
- + " is non-deterministic for " + type);
- }
- return retval;
- }
-
- // VC: Element Valid (second clause)
- boolean completed ()
- throws SAXException
- {
- // expecting a specific element
- if (name != null)
- return false;
-
- // choice, some sequences
- for (int i = 0; i < components.length; i++) {
- if (components [i].completed ())
- return true;
- }
-
- return false;
- }
+ // for reporting non-deterministic content models
+ // ... a waste of space if we're not reporting those!
+ // ... along with the 'model' member (in base class)
+ private ValidationConsumer consumer;
+
+ // for CHOICE nodes -- each component is an arc that
+ // accepts a different NAME (or is EMPTY indicating
+ // NDFA termination).
+ private Recognizer components [];
+
+ // for NAME/SEQUENCE nodes -- accepts that NAME and
+ // then goes to the next node (CHOICE, NAME, EMPTY).
+ private String name;
+ private Recognizer next;
+
+ // loops always point back to a CHOICE node. we mark such choice
+ // nodes (F_LOOPHEAD) for diagnostics and faster deep cloning.
+ // We also mark nodes before back pointers (F_LOOPNEXT), to ensure
+ // termination when we patch sequences and loops.
+ private int flags;
+
+
+ // prevent a needless indirection between 'this' and 'node'
+ private void copyIn (ChildrenRecognizer node)
+ {
+ // model & consumer are already set
+ components = node.components;
+ name = node.name;
+ next = node.next;
+ flags = node.flags;
+ }
+
+ // used to construct top level "children" content models,
+ public ChildrenRecognizer (ElementInfo type, ValidationConsumer vc)
+ {
+ this (vc, type);
+ populate (type.model.toCharArray (), 0);
+ patchNext (new EmptyRecognizer (type), null);
+ }
+
+ // used internally; populating is separate
+ private ChildrenRecognizer (ValidationConsumer vc, ElementInfo type)
+ {
+ super (type);
+ consumer = vc;
+ }
+
+
+ //
+ // When rewriting some graph nodes we need deep clones in one case;
+ // mostly shallow clones (what the JVM handles for us) are fine.
+ //
+ private ChildrenRecognizer shallowClone ()
+ {
+ try {
+ return (ChildrenRecognizer) clone ();
+ } catch (CloneNotSupportedException e) {
+ throw new Error ("clone");
+ }
+ }
+
+ private ChildrenRecognizer deepClone ()
+ {
+ return deepClone (new Hashtable (37));
+ }
+
+ private ChildrenRecognizer deepClone (Hashtable table)
+ {
+ ChildrenRecognizer retval;
+
+ if ((flags & F_LOOPHEAD) != 0) {
+ retval = (ChildrenRecognizer) table.get (this);
+ if (retval != null)
+ return this;
+
+ retval = shallowClone ();
+ table.put (this, retval);
+ } else
+ retval = shallowClone ();
+
+ if (next != null) {
+ if (next instanceof ChildrenRecognizer)
+ retval.next = ((ChildrenRecognizer)next)
+ .deepClone (table);
+ else if (!(next instanceof EmptyRecognizer))
+ throw new RuntimeException ("deepClone");
+ }
+
+ if (components != null) {
+ retval.components = new Recognizer [components.length];
+ for (int i = 0; i < components.length; i++) {
+ Recognizer temp = components [i];
+
+ if (temp == null)
+ retval.components [i] = null;
+ else if (temp instanceof ChildrenRecognizer)
+ retval.components [i] = ((ChildrenRecognizer)temp)
+ .deepClone (table);
+ else if (!(temp instanceof EmptyRecognizer))
+ throw new RuntimeException ("deepClone");
+ }
+ }
+
+ return retval;
+ }
+
+ // connect subgraphs, first to next (sequencing)
+ private void patchNext (Recognizer theNext, Hashtable table)
+ {
+ // backpointers must not be repatched or followed
+ if ((flags & F_LOOPNEXT) != 0)
+ return;
+
+ // XXX this table "shouldn't" be needed, right?
+ // but some choice nodes looped if it isn't there.
+ if (table != null && table.get (this) != null)
+ return;
+ if (table == null)
+ table = new Hashtable ();
+
+ // NAME/SEQUENCE
+ if (name != null) {
+ if (next == null)
+ next = theNext;
+ else if (next instanceof ChildrenRecognizer) {
+ ((ChildrenRecognizer)next).patchNext (theNext, table);
+ } else if (!(next instanceof EmptyRecognizer))
+ throw new RuntimeException ("patchNext");
+ return;
+ }
+
+ // CHOICE
+ for (int i = 0; i < components.length; i++) {
+ if (components [i] == null)
+ components [i] = theNext;
+ else if (components [i] instanceof ChildrenRecognizer) {
+ ((ChildrenRecognizer)components [i])
+ .patchNext (theNext, table);
+ } else if (!(components [i] instanceof EmptyRecognizer))
+ throw new RuntimeException ("patchNext");
+ }
+
+ if (table != null && (flags & F_LOOPHEAD) != 0)
+ table.put (this, this);
+ }
+
+ /**
+ * Parses a 'children' spec (or recursively 'cp') and makes this
+ * become a regular graph node.
+ *
+ * @return index after this particle
+ */
+ private int populate (char parseBuf [], int startPos)
+ {
+ int nextPos = startPos + 1;
+ char c;
+
+ if (nextPos < 0 || nextPos >= parseBuf.length)
+ throw new IndexOutOfBoundsException ();
+
+ // Grammar of the string is from the XML spec, but
+ // with whitespace removed by the SAX parser.
+
+ // children ::= (choice | seq) ('?' | '*' | '+')?
+ // cp ::= (Name | choice | seq) ('?' | '*' | '+')?
+ // choice ::= '(' cp ('|' choice)* ')'
+ // seq ::= '(' cp (',' choice)* ')'
+
+ // interior nodes only
+ // cp ::= name ...
+ if (parseBuf [startPos] != '('/*)*/) {
+ boolean done = false;
+ do {
+ switch (c = parseBuf [nextPos]) {
+ case '?': case '*': case '+':
+ case '|': case ',':
+ case /*(*/ ')':
+ done = true;
+ continue;
+ default:
+ nextPos++;
+ continue;
+ }
+ } while (!done);
+ name = new String (parseBuf, startPos, nextPos - startPos);
+
+ // interior OR toplevel nodes
+ // cp ::= choice ..
+ // cp ::= seq ..
+ } else {
+ // collect everything as a separate list, and merge it
+ // into "this" later if we can (SEQUENCE or singleton)
+ ChildrenRecognizer first;
+
+ first = new ChildrenRecognizer (consumer, type);
+ nextPos = first.populate (parseBuf, nextPos);
+ c = parseBuf [nextPos++];
+
+ if (c == ',' || c == '|') {
+ ChildrenRecognizer current = first;
+ char separator = c;
+ Vector v = null;
+
+ if (separator == '|') {
+ v = new Vector ();
+ v.addElement (first);
+ }
+
+ do {
+ ChildrenRecognizer link;
+
+ link = new ChildrenRecognizer (consumer, type);
+ nextPos = link.populate (parseBuf, nextPos);
+
+ if (separator == ',') {
+ current.patchNext (link, null);
+ current = link;
+ } else
+ v.addElement (link);
+
+ c = parseBuf [nextPos++];
+ } while (c == separator);
+
+ // choice ... collect everything into one array.
+ if (separator == '|') {
+ // assert v.size() > 1
+ components = new Recognizer [v.size ()];
+ for (int i = 0; i < components.length; i++) {
+ components [i] = (Recognizer)
+ v.elementAt (i);
+ }
+ // assert flags == 0
+
+ // sequence ... merge into "this" to be smaller.
+ } else
+ copyIn (first);
+
+ // treat singletons like one-node sequences.
+ } else
+ copyIn (first);
+
+ if (c != /*(*/ ')')
+ throw new RuntimeException ("corrupt content model");
+ }
+
+ //
+ // Arity is optional, and the root of all fun. We keep the
+ // FSM state graph simple by only having NAME/SEQUENCE and
+ // CHOICE nodes (or EMPTY to terminate a model), easily
+ // evaluated. So we rewrite each node that has arity, using
+ // those primitives. We create loops here, if needed.
+ //
+ if (nextPos < parseBuf.length) {
+ c = parseBuf [nextPos];
+ if (c == '?' || c == '*' || c == '+') {
+ nextPos++;
+
+ // Rewrite 'zero-or-one' "?" arity to a CHOICE:
+ // - SEQUENCE (clone, what's next)
+ // - or, what's next
+ // Size cost: N --> N + 1
+ if (c == '?') {
+ Recognizer once = shallowClone ();
+
+ components = new Recognizer [2];
+ components [0] = once;
+ // components [1] initted to null
+ name = null;
+ next = null;
+ flags = 0;
+
+
+ // Rewrite 'zero-or-more' "*" arity to a CHOICE.
+ // - LOOP (clone, back to this CHOICE)
+ // - or, what's next
+ // Size cost: N --> N + 1
+ } else if (c == '*') {
+ ChildrenRecognizer loop = shallowClone ();
+
+ loop.patchNext (this, null);
+ loop.flags |= F_LOOPNEXT;
+ flags = F_LOOPHEAD;
+
+ components = new Recognizer [2];
+ components [0] = loop;
+ // components [1] initted to null
+ name = null;
+ next = null;
+
+
+ // Rewrite 'one-or-more' "+" arity to a SEQUENCE.
+ // Basically (a)+ --> ((a),(a)*).
+ // - this
+ // - CHOICE
+ // * LOOP (clone, back to the CHOICE)
+ // * or, whatever's next
+ // Size cost: N --> 2N + 1
+ } else if (c == '+') {
+ ChildrenRecognizer loop = deepClone ();
+ ChildrenRecognizer choice;
+
+ choice = new ChildrenRecognizer (consumer, type);
+ loop.patchNext (choice, null);
+ loop.flags |= F_LOOPNEXT;
+ choice.flags = F_LOOPHEAD;
+
+ choice.components = new Recognizer [2];
+ choice.components [0] = loop;
+ // choice.components [1] initted to null
+ // choice.name, choice.next initted to null
+
+ patchNext (choice, null);
+ }
+ }
+ }
+
+ return nextPos;
+ }
+
+ // VC: Element Valid (second clause)
+ boolean acceptCharacters ()
+ { return false; }
+
+ // VC: Element Valid (second clause)
+ Recognizer acceptElement (String type)
+ throws SAXException
+ {
+ // NAME/SEQUENCE
+ if (name != null) {
+ if (name.equals (type))
+ return next;
+ return null;
+ }
+
+ // CHOICE ... optionally reporting nondeterminism we
+ // run across. we won't check out every transition
+ // for nondeterminism; only the ones we follow.
+ Recognizer retval = null;
+
+ for (int i = 0; i < components.length; i++) {
+ Recognizer temp = components [i].acceptElement (type);
+
+ if (temp == null)
+ continue;
+ else if (!warnNonDeterministic)
+ return temp;
+ else if (retval == null)
+ retval = temp;
+ else if (retval != temp)
+ consumer.error ("Content model " + this.type.model
+ + " is non-deterministic for " + type);
+ }
+ return retval;
+ }
+
+ // VC: Element Valid (second clause)
+ boolean completed ()
+ throws SAXException
+ {
+ // expecting a specific element
+ if (name != null)
+ return false;
+
+ // choice, some sequences
+ for (int i = 0; i < components.length; i++) {
+ if (components [i].completed ())
+ return true;
+ }
+
+ return false;
+ }
/** /
- // FOR DEBUGGING ... flattens the graph for printing.
-
- public String toString ()
- {
- StringBuffer buf = new StringBuffer ();
-
- // only one set of loop labels can be generated
- // at a time...
- synchronized (ANY) {
- nodeCount = 0;
-
- toString (buf, new Hashtable ());
- return buf.toString ();
- }
- }
-
- private void toString (StringBuffer buf, Hashtable table)
- {
- // When we visit a node, label and count it.
- // Nodes are never visited/counted more than once.
- // For small models labels waste space, but if arity
- // mappings were used the savings are substantial.
- // (Plus, the output can be more readily understood.)
- String temp = (String) table.get (this);
-
- if (temp != null) {
- buf.append ('{');
- buf.append (temp);
- buf.append ('}');
- return;
- } else {
- StringBuffer scratch = new StringBuffer (15);
-
- if ((flags & F_LOOPHEAD) != 0)
- scratch.append ("loop");
- else
- scratch.append ("node");
- scratch.append ('-');
- scratch.append (++nodeCount);
- temp = scratch.toString ();
-
- table.put (this, temp);
- buf.append ('[');
- buf.append (temp);
- buf.append (']');
- buf.append (':');
- }
-
- // NAME/SEQUENCE
- if (name != null) {
- // n.b. some output encodings turn some name chars into '?'
- // e.g. with Japanese names and ASCII output
- buf.append (name);
- if (components != null) // bug!
- buf.append ('$');
- if (next == null)
- buf.append (",*");
- else if (next instanceof EmptyRecognizer) // patch-to-next
- buf.append (",{}");
- else if (next instanceof ChildrenRecognizer) {
- buf.append (',');
- ((ChildrenRecognizer)next).toString (buf, table);
- } else // bug!
- buf.append (",+");
- return;
- }
-
- // CHOICE
- buf.append ("<");
- for (int i = 0; i < components.length; i++) {
- if (i != 0)
- buf.append ("|");
- if (components [i] instanceof EmptyRecognizer) {
- buf.append ("{}");
- } else if (components [i] == null) { // patch-to-next
- buf.append ('*');
- } else {
- ChildrenRecognizer r;
-
- r = (ChildrenRecognizer) components [i];
- r.toString (buf, table);
- }
- }
- buf.append (">");
- }
+ // FOR DEBUGGING ... flattens the graph for printing.
+
+ public String toString ()
+ {
+ StringBuffer buf = new StringBuffer ();
+
+ // only one set of loop labels can be generated
+ // at a time...
+ synchronized (ANY) {
+ nodeCount = 0;
+
+ toString (buf, new Hashtable ());
+ return buf.toString ();
+ }
+ }
+
+ private void toString (StringBuffer buf, Hashtable table)
+ {
+ // When we visit a node, label and count it.
+ // Nodes are never visited/counted more than once.
+ // For small models labels waste space, but if arity
+ // mappings were used the savings are substantial.
+ // (Plus, the output can be more readily understood.)
+ String temp = (String) table.get (this);
+
+ if (temp != null) {
+ buf.append ('{');
+ buf.append (temp);
+ buf.append ('}');
+ return;
+ } else {
+ StringBuffer scratch = new StringBuffer (15);
+
+ if ((flags & F_LOOPHEAD) != 0)
+ scratch.append ("loop");
+ else
+ scratch.append ("node");
+ scratch.append ('-');
+ scratch.append (++nodeCount);
+ temp = scratch.toString ();
+
+ table.put (this, temp);
+ buf.append ('[');
+ buf.append (temp);
+ buf.append (']');
+ buf.append (':');
+ }
+
+ // NAME/SEQUENCE
+ if (name != null) {
+ // n.b. some output encodings turn some name chars into '?'
+ // e.g. with Japanese names and ASCII output
+ buf.append (name);
+ if (components != null) // bug!
+ buf.append ('$');
+ if (next == null)
+ buf.append (",*");
+ else if (next instanceof EmptyRecognizer) // patch-to-next
+ buf.append (",{}");
+ else if (next instanceof ChildrenRecognizer) {
+ buf.append (',');
+ ((ChildrenRecognizer)next).toString (buf, table);
+ } else // bug!
+ buf.append (",+");
+ return;
+ }
+
+ // CHOICE
+ buf.append ("<");
+ for (int i = 0; i < components.length; i++) {
+ if (i != 0)
+ buf.append ("|");
+ if (components [i] instanceof EmptyRecognizer) {
+ buf.append ("{}");
+ } else if (components [i] == null) { // patch-to-next
+ buf.append ('*');
+ } else {
+ ChildrenRecognizer r;
+
+ r = (ChildrenRecognizer) components [i];
+ r.toString (buf, table);
+ }
+ }
+ buf.append (">");
+ }
/**/
}
}
diff --git a/gnu/xml/pipeline/WellFormednessFilter.java b/gnu/xml/pipeline/WellFormednessFilter.java
index ef4301652..7a3db6593 100644
--- a/gnu/xml/pipeline/WellFormednessFilter.java
+++ b/gnu/xml/pipeline/WellFormednessFilter.java
@@ -1,4 +1,4 @@
-/* WellFormednessFilter.java --
+/* WellFormednessFilter.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,27 +50,27 @@ import org.xml.sax.SAXParseException;
* This filter reports fatal exceptions in the case of event streams that
* are not well formed. The rules currently tested include: <ul>
*
- * <li>setDocumentLocator ... may be called only before startDocument
+ * <li>setDocumentLocator ... may be called only before startDocument
*
- * <li>startDocument/endDocument ... must be paired, and all other
- * calls (except setDocumentLocator) must be nested within these.
+ * <li>startDocument/endDocument ... must be paired, and all other
+ * calls (except setDocumentLocator) must be nested within these.
*
- * <li>startElement/endElement ... must be correctly paired, and
- * may never appear within CDATA sections.
+ * <li>startElement/endElement ... must be correctly paired, and
+ * may never appear within CDATA sections.
*
- * <li>comment ... can't contain "--"
+ * <li>comment ... can't contain "--"
*
- * <li>character data ... can't contain "]]&gt;"
+ * <li>character data ... can't contain "]]&gt;"
*
- * <li>whitespace ... can't contain CR
+ * <li>whitespace ... can't contain CR
*
- * <li>whitespace and character data must be within an element
+ * <li>whitespace and character data must be within an element
*
- * <li>processing instruction ... can't contain "?&gt;" or CR
+ * <li>processing instruction ... can't contain "?&gt;" or CR
*
- * <li>startCDATA/endCDATA ... must be correctly paired.
+ * <li>startCDATA/endCDATA ... must be correctly paired.
*
- * </ul>
+ * </ul>
*
* <p> Other checks for event stream correctness may be provided in
* the future. For example, insisting that
@@ -84,35 +84,35 @@ import org.xml.sax.SAXParseException;
*/
public final class WellFormednessFilter extends EventFilter
{
- private boolean startedDoc;
- private Stack elementStack = new Stack ();
- private boolean startedCDATA;
- private String dtdState = "before";
+ private boolean startedDoc;
+ private Stack elementStack = new Stack ();
+ private boolean startedCDATA;
+ private String dtdState = "before";
+
-
/**
* Swallows all events after performing well formedness checks.
*/
- // constructor used by PipelineFactory
+ // constructor used by PipelineFactory
public WellFormednessFilter ()
- { this (null); }
+ { this (null); }
/**
* Passes events through to the specified consumer, after first
* processing them.
*/
- // constructor used by PipelineFactory
+ // constructor used by PipelineFactory
public WellFormednessFilter (EventConsumer consumer)
{
- super (consumer);
-
- setContentHandler (this);
- setDTDHandler (this);
-
- try {
- setProperty (LEXICAL_HANDLER, this);
- } catch (SAXException e) { /* can't happen */ }
+ super (consumer);
+
+ setContentHandler (this);
+ setDTDHandler (this);
+
+ try {
+ setProperty (LEXICAL_HANDLER, this);
+ } catch (SAXException e) { /* can't happen */ }
}
/**
@@ -122,123 +122,123 @@ public final class WellFormednessFilter extends EventFilter
*/
public void reset ()
{
- startedDoc = false;
- startedCDATA = false;
- elementStack.removeAllElements ();
+ startedDoc = false;
+ startedCDATA = false;
+ elementStack.removeAllElements ();
}
private SAXParseException getException (String message)
{
- SAXParseException e;
- Locator locator = getDocumentLocator ();
+ SAXParseException e;
+ Locator locator = getDocumentLocator ();
- if (locator == null)
- return new SAXParseException (message, null, null, -1, -1);
- else
- return new SAXParseException (message, locator);
+ if (locator == null)
+ return new SAXParseException (message, null, null, -1, -1);
+ else
+ return new SAXParseException (message, locator);
}
private void fatalError (String message)
throws SAXException
{
- SAXParseException e = getException (message);
- ErrorHandler handler = getErrorHandler ();
+ SAXParseException e = getException (message);
+ ErrorHandler handler = getErrorHandler ();
- if (handler != null)
- handler.fatalError (e);
- throw e;
+ if (handler != null)
+ handler.fatalError (e);
+ throw e;
}
/**
* Throws an exception when called after startDocument.
*
* @param locator the locator, to be used in error reporting or relative
- * URI resolution.
+ * URI resolution.
*
* @exception IllegalStateException when called after the document
- * has already been started
+ * has already been started
*/
public void setDocumentLocator (Locator locator)
{
- if (startedDoc)
- throw new IllegalStateException (
- "setDocumentLocator called after startDocument");
- super.setDocumentLocator (locator);
+ if (startedDoc)
+ throw new IllegalStateException (
+ "setDocumentLocator called after startDocument");
+ super.setDocumentLocator (locator);
}
public void startDocument () throws SAXException
{
- if (startedDoc)
- fatalError ("startDocument called more than once");
- startedDoc = true;
- startedCDATA = false;
- elementStack.removeAllElements ();
- super.startDocument ();
+ if (startedDoc)
+ fatalError ("startDocument called more than once");
+ startedDoc = true;
+ startedCDATA = false;
+ elementStack.removeAllElements ();
+ super.startDocument ();
}
public void startElement (
- String uri, String localName,
- String qName, Attributes atts
+ String uri, String localName,
+ String qName, Attributes atts
) throws SAXException
{
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if ("inside".equals (dtdState))
- fatalError ("element inside DTD?");
- else
- dtdState = "after";
- if (startedCDATA)
- fatalError ("element inside CDATA section");
- if (qName == null || "".equals (qName))
- fatalError ("startElement name missing");
- elementStack.push (qName);
- super.startElement (uri, localName, qName, atts);
+ if (!startedDoc)
+ fatalError ("callback outside of document?");
+ if ("inside".equals (dtdState))
+ fatalError ("element inside DTD?");
+ else
+ dtdState = "after";
+ if (startedCDATA)
+ fatalError ("element inside CDATA section");
+ if (qName == null || "".equals (qName))
+ fatalError ("startElement name missing");
+ elementStack.push (qName);
+ super.startElement (uri, localName, qName, atts);
}
public void endElement (String uri, String localName, String qName)
throws SAXException
{
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (startedCDATA)
- fatalError ("element inside CDATA section");
- if (qName == null || "".equals (qName))
- fatalError ("endElement name missing");
-
- try {
- String top = (String) elementStack.pop ();
-
- if (!qName.equals (top))
- fatalError ("<" + top + " ...>...</" + qName + ">");
- // XXX could record/test namespace info
- } catch (EmptyStackException e) {
- fatalError ("endElement without startElement: </" + qName + ">");
- }
- super.endElement (uri, localName, qName);
+ if (!startedDoc)
+ fatalError ("callback outside of document?");
+ if (startedCDATA)
+ fatalError ("element inside CDATA section");
+ if (qName == null || "".equals (qName))
+ fatalError ("endElement name missing");
+
+ try {
+ String top = (String) elementStack.pop ();
+
+ if (!qName.equals (top))
+ fatalError ("<" + top + " ...>...</" + qName + ">");
+ // XXX could record/test namespace info
+ } catch (EmptyStackException e) {
+ fatalError ("endElement without startElement: </" + qName + ">");
+ }
+ super.endElement (uri, localName, qName);
}
public void endDocument () throws SAXException
{
- if (!startedDoc)
- fatalError ("callback outside of document?");
- dtdState = "before";
- startedDoc = false;
- super.endDocument ();
+ if (!startedDoc)
+ fatalError ("callback outside of document?");
+ dtdState = "before";
+ startedDoc = false;
+ super.endDocument ();
}
public void startDTD (String root, String publicId, String systemId)
throws SAXException
{
- if (!startedDoc)
- fatalError ("callback outside of document?");
+ if (!startedDoc)
+ fatalError ("callback outside of document?");
if ("before" != dtdState)
- fatalError ("two DTDs?");
- if (!elementStack.empty ())
- fatalError ("DTD must precede root element");
- dtdState = "inside";
- super.startDTD (root, publicId, systemId);
+ fatalError ("two DTDs?");
+ if (!elementStack.empty ())
+ fatalError ("DTD must precede root element");
+ dtdState = "inside";
+ super.startDTD (root, publicId, systemId);
}
public void notationDecl (String name, String publicId, String systemId)
@@ -247,19 +247,19 @@ public final class WellFormednessFilter extends EventFilter
// FIXME: not all parsers will report startDTD() ...
// we'd rather insist we're "inside".
if ("after" == dtdState)
- fatalError ("not inside DTD");
- super.notationDecl (name, publicId, systemId);
+ fatalError ("not inside DTD");
+ super.notationDecl (name, publicId, systemId);
}
public void unparsedEntityDecl (String name,
- String publicId, String systemId, String notationName)
+ String publicId, String systemId, String notationName)
throws SAXException
{
// FIXME: not all parsers will report startDTD() ...
// we'd rather insist we're "inside".
if ("after" == dtdState)
- fatalError ("not inside DTD");
- super.unparsedEntityDecl (name, publicId, systemId, notationName);
+ fatalError ("not inside DTD");
+ super.unparsedEntityDecl (name, publicId, systemId, notationName);
}
// FIXME: add the four DeclHandler calls too
@@ -267,97 +267,97 @@ public final class WellFormednessFilter extends EventFilter
public void endDTD ()
throws SAXException
{
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if ("inside" != dtdState)
- fatalError ("DTD ends without start?");
- dtdState = "after";
- super.endDTD ();
+ if (!startedDoc)
+ fatalError ("callback outside of document?");
+ if ("inside" != dtdState)
+ fatalError ("DTD ends without start?");
+ dtdState = "after";
+ super.endDTD ();
}
public void characters (char ch [], int start, int length)
throws SAXException
{
- int here = start, end = start + length;
- if (elementStack.empty ())
- fatalError ("characters must be in an element");
- while (here < end) {
- if (ch [here++] != ']')
- continue;
- if (here == end) // potential problem ...
- continue;
- if (ch [here++] != ']')
- continue;
- if (here == end) // potential problem ...
- continue;
- if (ch [here++] == '>')
- fatalError ("character data can't contain \"]]>\"");
- }
- super.characters (ch, start, length);
+ int here = start, end = start + length;
+ if (elementStack.empty ())
+ fatalError ("characters must be in an element");
+ while (here < end) {
+ if (ch [here++] != ']')
+ continue;
+ if (here == end) // potential problem ...
+ continue;
+ if (ch [here++] != ']')
+ continue;
+ if (here == end) // potential problem ...
+ continue;
+ if (ch [here++] == '>')
+ fatalError ("character data can't contain \"]]>\"");
+ }
+ super.characters (ch, start, length);
}
public void ignorableWhitespace (char ch [], int start, int length)
throws SAXException
{
- int here = start, end = start + length;
- if (elementStack.empty ())
- fatalError ("characters must be in an element");
- while (here < end) {
- if (ch [here++] == '\r')
- fatalError ("whitespace can't contain CR");
- }
- super.ignorableWhitespace (ch, start, length);
+ int here = start, end = start + length;
+ if (elementStack.empty ())
+ fatalError ("characters must be in an element");
+ while (here < end) {
+ if (ch [here++] == '\r')
+ fatalError ("whitespace can't contain CR");
+ }
+ super.ignorableWhitespace (ch, start, length);
}
public void processingInstruction (String target, String data)
throws SAXException
{
- if (data.indexOf ('\r') > 0)
- fatalError ("PIs can't contain CR");
- if (data.indexOf ("?>") > 0)
- fatalError ("PIs can't contain \"?>\"");
+ if (data.indexOf ('\r') > 0)
+ fatalError ("PIs can't contain CR");
+ if (data.indexOf ("?>") > 0)
+ fatalError ("PIs can't contain \"?>\"");
}
public void comment (char ch [], int start, int length)
throws SAXException
{
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (startedCDATA)
- fatalError ("comments can't nest in CDATA");
- int here = start, end = start + length;
- while (here < end) {
- if (ch [here] == '\r')
- fatalError ("comments can't contain CR");
- if (ch [here++] != '-')
- continue;
- if (here == end)
- fatalError ("comments can't end with \"--->\"");
- if (ch [here++] == '-')
- fatalError ("comments can't contain \"--\"");
- }
- super.comment (ch, start, length);
+ if (!startedDoc)
+ fatalError ("callback outside of document?");
+ if (startedCDATA)
+ fatalError ("comments can't nest in CDATA");
+ int here = start, end = start + length;
+ while (here < end) {
+ if (ch [here] == '\r')
+ fatalError ("comments can't contain CR");
+ if (ch [here++] != '-')
+ continue;
+ if (here == end)
+ fatalError ("comments can't end with \"--->\"");
+ if (ch [here++] == '-')
+ fatalError ("comments can't contain \"--\"");
+ }
+ super.comment (ch, start, length);
}
public void startCDATA ()
throws SAXException
{
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (startedCDATA)
- fatalError ("CDATA starts can't nest");
- startedCDATA = true;
- super.startCDATA ();
+ if (!startedDoc)
+ fatalError ("callback outside of document?");
+ if (startedCDATA)
+ fatalError ("CDATA starts can't nest");
+ startedCDATA = true;
+ super.startCDATA ();
}
public void endCDATA ()
throws SAXException
{
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (!startedCDATA)
- fatalError ("CDATA end without start?");
- startedCDATA = false;
- super.endCDATA ();
+ if (!startedDoc)
+ fatalError ("callback outside of document?");
+ if (!startedCDATA)
+ fatalError ("CDATA end without start?");
+ startedCDATA = false;
+ super.endCDATA ();
}
}
diff --git a/gnu/xml/pipeline/XIncludeFilter.java b/gnu/xml/pipeline/XIncludeFilter.java
index 02607a4e0..a1445fa0c 100644
--- a/gnu/xml/pipeline/XIncludeFilter.java
+++ b/gnu/xml/pipeline/XIncludeFilter.java
@@ -1,4 +1,4 @@
-/* XIncludeFilter.java --
+/* XIncludeFilter.java --
Copyright (C) 2001,2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,8 +40,8 @@ package gnu.xml.pipeline;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.net.URL;
-import java.net.URLConnection;
+import java.net.URL;
+import java.net.URLConnection;
import java.util.Hashtable;
import java.util.Stack;
import java.util.Vector;
@@ -77,7 +77,7 @@ import gnu.xml.util.Resolver;
* currently supported.
*
* <li> DTDs are not supported in included files, since the SAX DTD events
- * must have completely preceded any included file.
+ * must have completely preceded any included file.
* The CR explicitly allows the DTD related portions of the infoset to
* grow as an effect of including XML documents.
*
@@ -101,33 +101,33 @@ import gnu.xml.util.Resolver;
*/
public class XIncludeFilter extends EventFilter implements Locator
{
- private Hashtable extEntities = new Hashtable (5, 5);
- private int ignoreCount;
- private Stack uris = new Stack ();
- private Locator locator;
- private Vector inclusions = new Vector (5, 5);
- private boolean savingPrefixes;
+ private Hashtable extEntities = new Hashtable (5, 5);
+ private int ignoreCount;
+ private Stack uris = new Stack ();
+ private Locator locator;
+ private Vector inclusions = new Vector (5, 5);
+ private boolean savingPrefixes;
/**
*/
public XIncludeFilter (EventConsumer next)
throws SAXException
{
- super (next);
- setContentHandler (this);
- // DTDHandler callbacks pass straight through
- setProperty (DECL_HANDLER, this);
- setProperty (LEXICAL_HANDLER, this);
+ super (next);
+ setContentHandler (this);
+ // DTDHandler callbacks pass straight through
+ setProperty (DECL_HANDLER, this);
+ setProperty (LEXICAL_HANDLER, this);
}
private void fatal (SAXParseException e) throws SAXException
{
- ErrorHandler eh;
-
- eh = getErrorHandler ();
- if (eh != null)
- eh.fatalError (e);
- throw e;
+ ErrorHandler eh;
+
+ eh = getErrorHandler ();
+ if (eh != null)
+ eh.fatalError (e);
+ throw e;
}
/**
@@ -135,29 +135,29 @@ public class XIncludeFilter extends EventFilter implements Locator
*/
public void setDocumentLocator (Locator locator)
{
- this.locator = locator;
- super.setDocumentLocator (this);
+ this.locator = locator;
+ super.setDocumentLocator (this);
}
/** Used for proxy locator; do not call directly. */
public String getSystemId ()
- { return (locator == null) ? null : locator.getSystemId (); }
+ { return (locator == null) ? null : locator.getSystemId (); }
/** Used for proxy locator; do not call directly. */
public String getPublicId ()
- { return (locator == null) ? null : locator.getPublicId (); }
+ { return (locator == null) ? null : locator.getPublicId (); }
/** Used for proxy locator; do not call directly. */
public int getLineNumber ()
- { return (locator == null) ? -1 : locator.getLineNumber (); }
+ { return (locator == null) ? -1 : locator.getLineNumber (); }
/** Used for proxy locator; do not call directly. */
public int getColumnNumber ()
- { return (locator == null) ? -1 : locator.getColumnNumber (); }
+ { return (locator == null) ? -1 : locator.getColumnNumber (); }
/**
* Assigns the flag controlling the setting of the SAX2
* <em>namespace-prefixes</em> flag.
*/
public void setSavingPrefixes (boolean flag)
- { savingPrefixes = flag; }
+ { savingPrefixes = flag; }
/**
* Returns the flag controlling the setting of the SAX2
@@ -166,49 +166,49 @@ public class XIncludeFilter extends EventFilter implements Locator
* information that can be useful.
*/
public boolean isSavingPrefixes ()
- { return savingPrefixes; }
+ { return savingPrefixes; }
//
// Two mechanisms are interacting here.
- //
- // - XML Base implies a stack of base URIs, updated both by
- // "real entity" boundaries and element boundaries.
//
- // - Active "Real Entities" (for document and general entities,
- // and by xincluded files) are tracked to prevent circular
- // inclusions.
+ // - XML Base implies a stack of base URIs, updated both by
+ // "real entity" boundaries and element boundaries.
+ //
+ // - Active "Real Entities" (for document and general entities,
+ // and by xincluded files) are tracked to prevent circular
+ // inclusions.
//
private String addMarker (String uri)
throws SAXException
{
- if (locator != null && locator.getSystemId () != null)
- uri = locator.getSystemId ();
-
- // guard against InputSource objects without system IDs
- if (uri == null)
- fatal (new SAXParseException ("Entity URI is unknown", locator));
-
- try {
- URL url = new URL (uri);
-
- uri = url.toString ();
- if (inclusions.contains (uri))
- fatal (new SAXParseException (
- "XInclude, circular inclusion", locator));
- inclusions.addElement (uri);
- uris.push (url);
- } catch (IOException e) {
- // guard against illegal relative URIs (Xerces)
- fatal (new SAXParseException ("parser bug: relative URI",
- locator, e));
- }
- return uri;
+ if (locator != null && locator.getSystemId () != null)
+ uri = locator.getSystemId ();
+
+ // guard against InputSource objects without system IDs
+ if (uri == null)
+ fatal (new SAXParseException ("Entity URI is unknown", locator));
+
+ try {
+ URL url = new URL (uri);
+
+ uri = url.toString ();
+ if (inclusions.contains (uri))
+ fatal (new SAXParseException (
+ "XInclude, circular inclusion", locator));
+ inclusions.addElement (uri);
+ uris.push (url);
+ } catch (IOException e) {
+ // guard against illegal relative URIs (Xerces)
+ fatal (new SAXParseException ("parser bug: relative URI",
+ locator, e));
+ }
+ return uri;
}
private void pop (String uri)
{
- inclusions.removeElement (uri);
- uris.pop ();
+ inclusions.removeElement (uri);
+ uris.pop ();
}
//
@@ -216,66 +216,66 @@ public class XIncludeFilter extends EventFilter implements Locator
//
public void startDocument () throws SAXException
{
- ignoreCount = 0;
- addMarker (null);
- super.startDocument ();
+ ignoreCount = 0;
+ addMarker (null);
+ super.startDocument ();
}
public void endDocument () throws SAXException
{
- inclusions.setSize (0);
- extEntities.clear ();
- uris.setSize (0);
- super.endDocument ();
+ inclusions.setSize (0);
+ extEntities.clear ();
+ uris.setSize (0);
+ super.endDocument ();
}
//
// External general entity boundaries get both treatments.
//
public void externalEntityDecl (String name,
- String publicId, String systemId)
+ String publicId, String systemId)
throws SAXException
{
- if (name.charAt (0) == '%')
- return;
- try {
- URL url = new URL (locator.getSystemId ());
- systemId = new URL (url, systemId).toString ();
- } catch (IOException e) {
- // what could we do?
- }
- extEntities.put (name, systemId);
+ if (name.charAt (0) == '%')
+ return;
+ try {
+ URL url = new URL (locator.getSystemId ());
+ systemId = new URL (url, systemId).toString ();
+ } catch (IOException e) {
+ // what could we do?
+ }
+ extEntities.put (name, systemId);
}
public void startEntity (String name)
throws SAXException
{
- if (ignoreCount != 0) {
- ignoreCount++;
- return;
- }
-
- String uri = (String) extEntities.get (name);
- if (uri != null)
- addMarker (uri);
- super.startEntity (name);
+ if (ignoreCount != 0) {
+ ignoreCount++;
+ return;
+ }
+
+ String uri = (String) extEntities.get (name);
+ if (uri != null)
+ addMarker (uri);
+ super.startEntity (name);
}
public void endEntity (String name)
throws SAXException
{
- if (ignoreCount != 0) {
- if (--ignoreCount != 0)
- return;
- }
+ if (ignoreCount != 0) {
+ if (--ignoreCount != 0)
+ return;
+ }
- String uri = (String) extEntities.get (name);
+ String uri = (String) extEntities.get (name);
- if (uri != null)
- pop (uri);
- super.endEntity (name);
+ if (uri != null)
+ pop (uri);
+ super.endEntity (name);
}
-
+
//
// element boundaries only affect the base URI stack,
// unless they're XInclude elements.
@@ -284,103 +284,103 @@ public class XIncludeFilter extends EventFilter implements Locator
startElement (String uri, String localName, String qName, Attributes atts)
throws SAXException
{
- if (ignoreCount != 0) {
- ignoreCount++;
- return;
- }
-
- URL baseURI = (URL) uris.peek ();
- String base;
-
- base = atts.getValue ("http://www.w3.org/XML/1998/namespace", "base");
- if (base == null)
- uris.push (baseURI);
- else {
- URL url;
-
- if (base.indexOf ('#') != -1)
- fatal (new SAXParseException (
- "xml:base with fragment: " + base,
- locator));
-
- try {
- baseURI = new URL (baseURI, base);
- uris.push (baseURI);
- } catch (Exception e) {
- fatal (new SAXParseException (
- "xml:base with illegal uri: " + base,
- locator, e));
- }
- }
-
- if (!"http://www.w3.org/2001/XInclude".equals (uri)) {
- super.startElement (uri, localName, qName, atts);
- return;
- }
-
- if ("include".equals (localName)) {
- String href = atts.getValue ("href");
- String parse = atts.getValue ("parse");
- String encoding = atts.getValue ("encoding");
- URL url = (URL) uris.peek ();
- SAXParseException x = null;
-
- if (href == null)
- fatal (new SAXParseException (
- "XInclude missing href",
- locator));
- if (href.indexOf ('#') != -1)
- fatal (new SAXParseException (
- "XInclude with fragment: " + href,
- locator));
-
- if (parse == null || "xml".equals (parse))
- x = xinclude (url, href);
- else if ("text".equals (parse))
- x = readText (url, href, encoding);
- else
- fatal (new SAXParseException (
- "unknown XInclude parsing mode: " + parse,
- locator));
- if (x == null) {
- // strip out all child content
- ignoreCount++;
- return;
- }
-
- // FIXME the 17-Sept-2002 CR of XInclude says we "must"
- // use xi:fallback elements to handle resource errors,
- // if they exist.
- fatal (x);
-
- } else if ("fallback".equals (localName)) {
- fatal (new SAXParseException (
- "illegal top level XInclude 'fallback' element",
- locator));
- } else {
- ErrorHandler eh = getErrorHandler ();
-
- // CR doesn't say this is an error
- if (eh != null)
- eh.warning (new SAXParseException (
- "unrecognized toplevel XInclude element: " + localName,
- locator));
- super.startElement (uri, localName, qName, atts);
- }
+ if (ignoreCount != 0) {
+ ignoreCount++;
+ return;
+ }
+
+ URL baseURI = (URL) uris.peek ();
+ String base;
+
+ base = atts.getValue ("http://www.w3.org/XML/1998/namespace", "base");
+ if (base == null)
+ uris.push (baseURI);
+ else {
+ URL url;
+
+ if (base.indexOf ('#') != -1)
+ fatal (new SAXParseException (
+ "xml:base with fragment: " + base,
+ locator));
+
+ try {
+ baseURI = new URL (baseURI, base);
+ uris.push (baseURI);
+ } catch (Exception e) {
+ fatal (new SAXParseException (
+ "xml:base with illegal uri: " + base,
+ locator, e));
+ }
+ }
+
+ if (!"http://www.w3.org/2001/XInclude".equals (uri)) {
+ super.startElement (uri, localName, qName, atts);
+ return;
+ }
+
+ if ("include".equals (localName)) {
+ String href = atts.getValue ("href");
+ String parse = atts.getValue ("parse");
+ String encoding = atts.getValue ("encoding");
+ URL url = (URL) uris.peek ();
+ SAXParseException x = null;
+
+ if (href == null)
+ fatal (new SAXParseException (
+ "XInclude missing href",
+ locator));
+ if (href.indexOf ('#') != -1)
+ fatal (new SAXParseException (
+ "XInclude with fragment: " + href,
+ locator));
+
+ if (parse == null || "xml".equals (parse))
+ x = xinclude (url, href);
+ else if ("text".equals (parse))
+ x = readText (url, href, encoding);
+ else
+ fatal (new SAXParseException (
+ "unknown XInclude parsing mode: " + parse,
+ locator));
+ if (x == null) {
+ // strip out all child content
+ ignoreCount++;
+ return;
+ }
+
+ // FIXME the 17-Sept-2002 CR of XInclude says we "must"
+ // use xi:fallback elements to handle resource errors,
+ // if they exist.
+ fatal (x);
+
+ } else if ("fallback".equals (localName)) {
+ fatal (new SAXParseException (
+ "illegal top level XInclude 'fallback' element",
+ locator));
+ } else {
+ ErrorHandler eh = getErrorHandler ();
+
+ // CR doesn't say this is an error
+ if (eh != null)
+ eh.warning (new SAXParseException (
+ "unrecognized toplevel XInclude element: " + localName,
+ locator));
+ super.startElement (uri, localName, qName, atts);
+ }
}
public void endElement (String uri, String localName, String qName)
throws SAXException
{
- if (ignoreCount != 0) {
- if (--ignoreCount != 0)
- return;
- }
-
- uris.pop ();
- if (!("http://www.w3.org/2001/XInclude".equals (uri)
- && "include".equals (localName)))
- super.endElement (uri, localName, qName);
+ if (ignoreCount != 0) {
+ if (--ignoreCount != 0)
+ return;
+ }
+
+ uris.pop ();
+ if (!("http://www.w3.org/2001/XInclude".equals (uri)
+ && "include".equals (localName)))
+ super.endElement (uri, localName, qName);
}
//
@@ -389,66 +389,66 @@ public class XIncludeFilter extends EventFilter implements Locator
public void characters (char ch [], int start, int length)
throws SAXException
{
- if (ignoreCount == 0)
- super.characters (ch, start, length);
+ if (ignoreCount == 0)
+ super.characters (ch, start, length);
}
public void processingInstruction (String target, String value)
throws SAXException
{
- if (ignoreCount == 0)
- super.processingInstruction (target, value);
+ if (ignoreCount == 0)
+ super.processingInstruction (target, value);
}
public void ignorableWhitespace (char ch [], int start, int length)
throws SAXException
{
- if (ignoreCount == 0)
- super.ignorableWhitespace (ch, start, length);
+ if (ignoreCount == 0)
+ super.ignorableWhitespace (ch, start, length);
}
public void comment (char ch [], int start, int length)
throws SAXException
{
- if (ignoreCount == 0)
- super.comment (ch, start, length);
+ if (ignoreCount == 0)
+ super.comment (ch, start, length);
}
public void startCDATA () throws SAXException
{
- if (ignoreCount == 0)
- super.startCDATA ();
+ if (ignoreCount == 0)
+ super.startCDATA ();
}
public void endCDATA () throws SAXException
{
- if (ignoreCount == 0)
- super.endCDATA ();
+ if (ignoreCount == 0)
+ super.endCDATA ();
}
public void startPrefixMapping (String prefix, String uri)
throws SAXException
{
- if (ignoreCount == 0)
- super.startPrefixMapping (prefix, uri);
+ if (ignoreCount == 0)
+ super.startPrefixMapping (prefix, uri);
}
public void endPrefixMapping (String prefix) throws SAXException
{
- if (ignoreCount == 0)
- super.endPrefixMapping (prefix);
+ if (ignoreCount == 0)
+ super.endPrefixMapping (prefix);
}
public void skippedEntity (String name) throws SAXException
{
- if (ignoreCount == 0)
- super.skippedEntity (name);
+ if (ignoreCount == 0)
+ super.skippedEntity (name);
}
// JDK 1.1 seems to need it to be done this way, sigh
void setLocator (Locator l) { locator = l; }
Locator getLocator () { return locator; }
-
+
//
// for XIncluded entities, manage the current locator and
@@ -456,45 +456,45 @@ public class XIncludeFilter extends EventFilter implements Locator
//
private class Scrubber extends EventFilter
{
- Scrubber (EventFilter f)
- throws SAXException
- {
- // delegation passes to next in chain
- super (f);
-
- // process all content events
- super.setContentHandler (this);
- super.setProperty (LEXICAL_HANDLER, this);
-
- // drop all DTD events
- super.setDTDHandler (null);
- super.setProperty (DECL_HANDLER, null);
- }
-
- // maintain proxy locator
- // only one startDocument()/endDocument() pair per event stream
- public void setDocumentLocator (Locator l)
- { setLocator (l); }
- public void startDocument ()
- { }
- public void endDocument ()
- { }
-
- private void reject (String message) throws SAXException
- { fatal (new SAXParseException (message, getLocator ())); }
-
- // only the DTD from the "base document" gets reported
- public void startDTD (String root, String publicId, String systemId)
- throws SAXException
- { reject ("XIncluded DTD: " + systemId); }
- public void endDTD ()
- throws SAXException
- { reject ("XIncluded DTD"); }
- // ... so this should never happen
- public void skippedEntity (String name) throws SAXException
- { reject ("XInclude skipped entity: " + name); }
-
- // since we rejected DTDs, only builtin entities can be reported
+ Scrubber (EventFilter f)
+ throws SAXException
+ {
+ // delegation passes to next in chain
+ super (f);
+
+ // process all content events
+ super.setContentHandler (this);
+ super.setProperty (LEXICAL_HANDLER, this);
+
+ // drop all DTD events
+ super.setDTDHandler (null);
+ super.setProperty (DECL_HANDLER, null);
+ }
+
+ // maintain proxy locator
+ // only one startDocument()/endDocument() pair per event stream
+ public void setDocumentLocator (Locator l)
+ { setLocator (l); }
+ public void startDocument ()
+ { }
+ public void endDocument ()
+ { }
+
+ private void reject (String message) throws SAXException
+ { fatal (new SAXParseException (message, getLocator ())); }
+
+ // only the DTD from the "base document" gets reported
+ public void startDTD (String root, String publicId, String systemId)
+ throws SAXException
+ { reject ("XIncluded DTD: " + systemId); }
+ public void endDTD ()
+ throws SAXException
+ { reject ("XIncluded DTD"); }
+ // ... so this should never happen
+ public void skippedEntity (String name) throws SAXException
+ { reject ("XInclude skipped entity: " + name); }
+
+ // since we rejected DTDs, only builtin entities can be reported
}
// <xi:include parse='xml' ...>
@@ -502,40 +502,40 @@ public class XIncludeFilter extends EventFilter implements Locator
private SAXParseException xinclude (URL url, String href)
throws SAXException
{
- XMLReader helper;
- Scrubber scrubber;
- Locator savedLocator = locator;
-
- // start with a parser acting just like our input
- // modulo DTD-ish stuff (validation flag, entity resolver)
- helper = XMLReaderFactory.createXMLReader ();
- helper.setErrorHandler (getErrorHandler ());
- helper.setFeature (FEATURE_URI + "namespace-prefixes", true);
-
- // Set up the proxy locator and event filter.
- scrubber = new Scrubber (this);
- locator = null;
- bind (helper, scrubber);
-
- // Merge the included document, except its DTD
- try {
- url = new URL (url, href);
- href = url.toString ();
-
- if (inclusions.contains (href))
- fatal (new SAXParseException (
- "XInclude, circular inclusion", locator));
-
- inclusions.addElement (href);
- uris.push (url);
- helper.parse (new InputSource (href));
- return null;
- } catch (java.io.IOException e) {
- return new SAXParseException (href, locator, e);
- } finally {
- pop (href);
- locator = savedLocator;
- }
+ XMLReader helper;
+ Scrubber scrubber;
+ Locator savedLocator = locator;
+
+ // start with a parser acting just like our input
+ // modulo DTD-ish stuff (validation flag, entity resolver)
+ helper = XMLReaderFactory.createXMLReader ();
+ helper.setErrorHandler (getErrorHandler ());
+ helper.setFeature (FEATURE_URI + "namespace-prefixes", true);
+
+ // Set up the proxy locator and event filter.
+ scrubber = new Scrubber (this);
+ locator = null;
+ bind (helper, scrubber);
+
+ // Merge the included document, except its DTD
+ try {
+ url = new URL (url, href);
+ href = url.toString ();
+
+ if (inclusions.contains (href))
+ fatal (new SAXParseException (
+ "XInclude, circular inclusion", locator));
+
+ inclusions.addElement (href);
+ uris.push (url);
+ helper.parse (new InputSource (href));
+ return null;
+ } catch (java.io.IOException e) {
+ return new SAXParseException (href, locator, e);
+ } finally {
+ pop (href);
+ locator = savedLocator;
+ }
}
// <xi:include parse='text' ...>
@@ -543,37 +543,37 @@ public class XIncludeFilter extends EventFilter implements Locator
private SAXParseException readText (URL url, String href, String encoding)
throws SAXException
{
- InputStream in = null;
-
- try {
- URLConnection conn;
- InputStreamReader reader;
- char buf [] = new char [4096];
- int count;
-
- url = new URL (url, href);
- conn = url.openConnection ();
- in = conn.getInputStream ();
- if (encoding == null)
- encoding = Resolver.getEncoding (conn.getContentType ());
- if (encoding == null) {
- ErrorHandler eh = getErrorHandler ();
- if (eh != null)
- eh.warning (new SAXParseException (
- "guessing text encoding for URL: " + url,
- locator));
- reader = new InputStreamReader (in);
- } else
- reader = new InputStreamReader (in, encoding);
-
- while ((count = reader.read (buf, 0, buf.length)) != -1)
- super.characters (buf, 0, count);
- in.close ();
- return null;
- } catch (IOException e) {
- return new SAXParseException (
- "can't XInclude text",
- locator, e);
- }
+ InputStream in = null;
+
+ try {
+ URLConnection conn;
+ InputStreamReader reader;
+ char buf [] = new char [4096];
+ int count;
+
+ url = new URL (url, href);
+ conn = url.openConnection ();
+ in = conn.getInputStream ();
+ if (encoding == null)
+ encoding = Resolver.getEncoding (conn.getContentType ());
+ if (encoding == null) {
+ ErrorHandler eh = getErrorHandler ();
+ if (eh != null)
+ eh.warning (new SAXParseException (
+ "guessing text encoding for URL: " + url,
+ locator));
+ reader = new InputStreamReader (in);
+ } else
+ reader = new InputStreamReader (in, encoding);
+
+ while ((count = reader.read (buf, 0, buf.length)) != -1)
+ super.characters (buf, 0, count);
+ in.close ();
+ return null;
+ } catch (IOException e) {
+ return new SAXParseException (
+ "can't XInclude text",
+ locator, e);
+ }
}
}
diff --git a/gnu/xml/pipeline/XsltFilter.java b/gnu/xml/pipeline/XsltFilter.java
index 0a1872c5a..86b6190c5 100644
--- a/gnu/xml/pipeline/XsltFilter.java
+++ b/gnu/xml/pipeline/XsltFilter.java
@@ -1,4 +1,4 @@
-/* XsltFilter.java --
+/* XsltFilter.java --
Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,8 +49,8 @@ import org.xml.sax.ext.LexicalHandler;
/**
- * Packages an XSLT transform as a pipeline component.
- * Note that all DTD events (callbacks to DeclHandler and DTDHandler
+ * Packages an XSLT transform as a pipeline component.
+ * Note that all DTD events (callbacks to DeclHandler and DTDHandler
* interfaces) are discarded, although XSLT transforms may be set up to
* use the LexicalHandler to write DTDs with only an external subset.
* Not every XSLT engine will necessarily be usable with this filter,
@@ -72,59 +72,59 @@ final public class XsltFilter extends EventFilter
* or ErrorHandler support.
*
* @param stylesheet URI for the stylesheet specifying the
- * XSLT transform
+ * XSLT transform
* @param next provides the ContentHandler and LexicalHandler
- * to receive XSLT output.
+ * to receive XSLT output.
* @exception SAXException if the stylesheet can't be parsed
* @exception IOException if there are difficulties
- * bootstrapping the XSLT engine, such as it not supporting
- * SAX well enough to use this way.
+ * bootstrapping the XSLT engine, such as it not supporting
+ * SAX well enough to use this way.
*/
public XsltFilter (String stylesheet, EventConsumer next)
throws SAXException, IOException
{
- // First, get a transformer with the stylesheet preloaded
- TransformerFactory tf = null;
- TransformerHandler th;
-
- try {
- SAXTransformerFactory stf;
-
- tf = TransformerFactory.newInstance ();
- if (!tf.getFeature (SAXTransformerFactory.FEATURE) // sax inputs
- || !tf.getFeature (SAXResult.FEATURE) // sax outputs
- || !tf.getFeature (StreamSource.FEATURE) // stylesheet
- )
- throw new IOException ("XSLT factory ("
- + tf.getClass ().getName ()
- + ") does not support SAX");
- stf = (SAXTransformerFactory) tf;
- th = stf.newTransformerHandler (new StreamSource (stylesheet));
- } catch (TransformerConfigurationException e) {
- throw new IOException ("XSLT factory ("
- + (tf == null
- ? "none available"
- : tf.getClass ().getName ())
- + ") configuration error, "
- + e.getMessage ()
- );
- }
-
- // Hook its outputs up to the pipeline ...
- SAXResult out = new SAXResult ();
-
- out.setHandler (next.getContentHandler ());
- try {
- LexicalHandler lh;
- lh = (LexicalHandler) next.getProperty (LEXICAL_HANDLER);
- out.setLexicalHandler (lh);
- } catch (Exception e) {
- // ignore
- }
- th.setResult (out);
-
- // ... and make sure its inputs look like ours.
- setContentHandler (th);
- setProperty (LEXICAL_HANDLER, th);
+ // First, get a transformer with the stylesheet preloaded
+ TransformerFactory tf = null;
+ TransformerHandler th;
+
+ try {
+ SAXTransformerFactory stf;
+
+ tf = TransformerFactory.newInstance ();
+ if (!tf.getFeature (SAXTransformerFactory.FEATURE) // sax inputs
+ || !tf.getFeature (SAXResult.FEATURE) // sax outputs
+ || !tf.getFeature (StreamSource.FEATURE) // stylesheet
+ )
+ throw new IOException ("XSLT factory ("
+ + tf.getClass ().getName ()
+ + ") does not support SAX");
+ stf = (SAXTransformerFactory) tf;
+ th = stf.newTransformerHandler (new StreamSource (stylesheet));
+ } catch (TransformerConfigurationException e) {
+ throw new IOException ("XSLT factory ("
+ + (tf == null
+ ? "none available"
+ : tf.getClass ().getName ())
+ + ") configuration error, "
+ + e.getMessage ()
+ );
+ }
+
+ // Hook its outputs up to the pipeline ...
+ SAXResult out = new SAXResult ();
+
+ out.setHandler (next.getContentHandler ());
+ try {
+ LexicalHandler lh;
+ lh = (LexicalHandler) next.getProperty (LEXICAL_HANDLER);
+ out.setLexicalHandler (lh);
+ } catch (Exception e) {
+ // ignore
+ }
+ th.setResult (out);
+
+ // ... and make sure its inputs look like ours.
+ setContentHandler (th);
+ setProperty (LEXICAL_HANDLER, th);
}
}
diff --git a/gnu/xml/stream/AttributeImpl.java b/gnu/xml/stream/AttributeImpl.java
index f74aebd35..58a0dbe21 100644
--- a/gnu/xml/stream/AttributeImpl.java
+++ b/gnu/xml/stream/AttributeImpl.java
@@ -1,4 +1,4 @@
-/* AttributeImpl.java --
+/* AttributeImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -94,7 +94,7 @@ public class AttributeImpl
{
return specified;
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
@@ -119,6 +119,5 @@ public class AttributeImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/BufferedReader.java b/gnu/xml/stream/BufferedReader.java
index f8287e823..dc69fb34b 100644
--- a/gnu/xml/stream/BufferedReader.java
+++ b/gnu/xml/stream/BufferedReader.java
@@ -1,4 +1,4 @@
-/* BufferedReader.java --
+/* BufferedReader.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,7 +59,7 @@ class BufferedReader
{
this(in, DEFAULT_BUFFER_SIZE);
}
-
+
BufferedReader(Reader in, int bufferSize)
{
if (bufferSize < 1)
@@ -110,19 +110,19 @@ class BufferedReader
{
if (off < 0 || len < 0 || b.length - off < len)
throw new IndexOutOfBoundsException();
-
+
if (len == 0)
return 0;
-
+
if (pos >= count && !refill())
return -1;
-
+
int ret = Math.min(count - pos, len);
System.arraycopy(buf, pos, b, off, ret);
pos += ret;
off += ret;
len -= ret;
-
+
while (len > 0 && refill())
{
int remain = Math.min(count - pos, len);
@@ -132,7 +132,7 @@ class BufferedReader
len -= remain;
ret += remain;
}
-
+
return ret;
}
@@ -177,7 +177,7 @@ class BufferedReader
{
char[] newbuf = buf;
if (markpos < bufferSize)
- {
+ {
newbuf = new char[count - markpos + bufferSize];
}
System.arraycopy(buf, markpos, newbuf, 0, markcount);
diff --git a/gnu/xml/stream/CRLFReader.java b/gnu/xml/stream/CRLFReader.java
index dad02b94a..7f3cf4d74 100644
--- a/gnu/xml/stream/CRLFReader.java
+++ b/gnu/xml/stream/CRLFReader.java
@@ -1,4 +1,4 @@
-/* CRLFReader.java --
+/* CRLFReader.java --
Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -115,7 +115,7 @@ class CRLFReader
}
else
l = in.read(b, off, len); // CR(s) but no LF
- }
+ }
}
return l;
}
@@ -178,4 +178,3 @@ class CRLFReader
}
}
-
diff --git a/gnu/xml/stream/CharactersImpl.java b/gnu/xml/stream/CharactersImpl.java
index 6df06582b..2107a5a6d 100644
--- a/gnu/xml/stream/CharactersImpl.java
+++ b/gnu/xml/stream/CharactersImpl.java
@@ -1,4 +1,4 @@
-/* CharactersImpl.java --
+/* CharactersImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -88,12 +88,12 @@ public class CharactersImpl
{
return cdata;
}
-
+
public boolean isIgnorableWhiteSpace()
{
return ignorableWhitespace;
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
@@ -105,7 +105,7 @@ public class CharactersImpl
writer.write(data);
writer.write("]]>");
}
- else
+ else
writer.write(encode(data, false));
}
catch (IOException e)
@@ -115,6 +115,5 @@ public class CharactersImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/CommentImpl.java b/gnu/xml/stream/CommentImpl.java
index 5863fb05a..118ac7a57 100644
--- a/gnu/xml/stream/CommentImpl.java
+++ b/gnu/xml/stream/CommentImpl.java
@@ -1,4 +1,4 @@
-/* CommentImpl.java --
+/* CommentImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,7 +70,7 @@ public class CommentImpl
{
return text;
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
@@ -87,6 +87,5 @@ public class CommentImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/DTDImpl.java b/gnu/xml/stream/DTDImpl.java
index 8e008aaed..cf049d362 100644
--- a/gnu/xml/stream/DTDImpl.java
+++ b/gnu/xml/stream/DTDImpl.java
@@ -1,4 +1,4 @@
-/* DTDImpl.java --
+/* DTDImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -93,7 +93,7 @@ public class DTDImpl
{
return entities;
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
@@ -110,6 +110,5 @@ public class DTDImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/EndDocumentImpl.java b/gnu/xml/stream/EndDocumentImpl.java
index 0e3ed9630..13877c5c9 100644
--- a/gnu/xml/stream/EndDocumentImpl.java
+++ b/gnu/xml/stream/EndDocumentImpl.java
@@ -1,4 +1,4 @@
-/* EndDocumentImpl.java --
+/* EndDocumentImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,11 +61,10 @@ public class EndDocumentImpl
{
return END_DOCUMENT;
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
}
-
-}
+}
diff --git a/gnu/xml/stream/EndElementImpl.java b/gnu/xml/stream/EndElementImpl.java
index 7b5382ec5..71f6aa0bc 100644
--- a/gnu/xml/stream/EndElementImpl.java
+++ b/gnu/xml/stream/EndElementImpl.java
@@ -1,4 +1,4 @@
-/* EndElementImpl.java --
+/* EndElementImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,7 +80,7 @@ public class EndElementImpl
{
return namespaces.iterator();
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
@@ -103,6 +103,5 @@ public class EndElementImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/EntityDeclarationImpl.java b/gnu/xml/stream/EntityDeclarationImpl.java
index 41ec2fb9b..b6e33e8d2 100644
--- a/gnu/xml/stream/EntityDeclarationImpl.java
+++ b/gnu/xml/stream/EntityDeclarationImpl.java
@@ -1,4 +1,4 @@
-/* EntityDeclarationImpl.java --
+/* EntityDeclarationImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -159,6 +159,5 @@ public class EntityDeclarationImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/EntityReferenceImpl.java b/gnu/xml/stream/EntityReferenceImpl.java
index 38e1f00b1..6f8a11c80 100644
--- a/gnu/xml/stream/EntityReferenceImpl.java
+++ b/gnu/xml/stream/EntityReferenceImpl.java
@@ -1,4 +1,4 @@
-/* EntityReferenceImpl.java --
+/* EntityReferenceImpl.java --
Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -99,4 +99,3 @@ public class EntityReferenceImpl
}
}
-
diff --git a/gnu/xml/stream/FilteredEventReader.java b/gnu/xml/stream/FilteredEventReader.java
index fd6fe8b07..1ddb469df 100644
--- a/gnu/xml/stream/FilteredEventReader.java
+++ b/gnu/xml/stream/FilteredEventReader.java
@@ -1,4 +1,4 @@
-/* FilteredEventReader.java --
+/* FilteredEventReader.java --
Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -72,7 +72,7 @@ class FilteredEventReader
while (!filter.accept(ret));
return ret;
}
-
+
public Object next()
{
try
@@ -86,7 +86,7 @@ class FilteredEventReader
throw e2;
}
}
-
+
public XMLEvent peek()
throws XMLStreamException
{
@@ -98,7 +98,7 @@ class FilteredEventReader
while (!filter.accept(ret));
return ret;
}
-
+
public XMLEvent nextTag()
throws XMLStreamException
{
@@ -110,6 +110,5 @@ class FilteredEventReader
while (!filter.accept(ret));
return ret;
}
-
-}
+}
diff --git a/gnu/xml/stream/FilteredStreamReader.java b/gnu/xml/stream/FilteredStreamReader.java
index 90ebb330d..62d96488e 100644
--- a/gnu/xml/stream/FilteredStreamReader.java
+++ b/gnu/xml/stream/FilteredStreamReader.java
@@ -1,4 +1,4 @@
-/* FilteredStreamReader.java --
+/* FilteredStreamReader.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -74,7 +74,7 @@ class FilteredStreamReader
while (!filter.accept(reader));
return ret;
}
-
+
public int nextTag()
throws XMLStreamException
{
@@ -86,6 +86,5 @@ class FilteredStreamReader
while (!filter.accept(reader));
return ret;
}
-
-}
+}
diff --git a/gnu/xml/stream/NamespaceImpl.java b/gnu/xml/stream/NamespaceImpl.java
index 1a595ee83..241f980b6 100644
--- a/gnu/xml/stream/NamespaceImpl.java
+++ b/gnu/xml/stream/NamespaceImpl.java
@@ -1,4 +1,4 @@
-/* NamespaceImpl.java --
+/* NamespaceImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -109,7 +109,7 @@ public class NamespaceImpl
{
return (prefix == null || "".equals(prefix));
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
@@ -133,6 +133,5 @@ public class NamespaceImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/NotationDeclarationImpl.java b/gnu/xml/stream/NotationDeclarationImpl.java
index 2d08599f5..a338237ee 100644
--- a/gnu/xml/stream/NotationDeclarationImpl.java
+++ b/gnu/xml/stream/NotationDeclarationImpl.java
@@ -1,4 +1,4 @@
-/* NotationDeclarationImpl.java --
+/* NotationDeclarationImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -86,7 +86,7 @@ public class NotationDeclarationImpl
{
return systemId;
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
@@ -121,6 +121,5 @@ public class NotationDeclarationImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/ProcessingInstructionImpl.java b/gnu/xml/stream/ProcessingInstructionImpl.java
index 6a5028956..4ce0badc8 100644
--- a/gnu/xml/stream/ProcessingInstructionImpl.java
+++ b/gnu/xml/stream/ProcessingInstructionImpl.java
@@ -1,4 +1,4 @@
-/* ProcessingInstructionImpl.java --
+/* ProcessingInstructionImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -78,7 +78,7 @@ public class ProcessingInstructionImpl
{
return data;
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
@@ -100,6 +100,5 @@ public class ProcessingInstructionImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/SAXParser.java b/gnu/xml/stream/SAXParser.java
index ab1f86e49..b71d98ed3 100644
--- a/gnu/xml/stream/SAXParser.java
+++ b/gnu/xml/stream/SAXParser.java
@@ -1,4 +1,4 @@
-/* SAXParser.java --
+/* SAXParser.java --
Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -131,13 +131,13 @@ public class SAXParser
}
// -- SAXParser --
-
+
public Parser getParser()
throws SAXException
{
return null;
}
-
+
public XMLReader getXMLReader()
throws SAXException
{
@@ -365,11 +365,11 @@ public class SAXParser
}
reader = parser;
baseURI = systemId;
-
+
if (xIncludeAware)
reader = new XIncludeFilter(parser, systemId, namespaceAware,
validating, true);
-
+
if (contentHandler != null)
contentHandler.setDocumentLocator(this);
boolean startDocumentDone = false;
@@ -864,7 +864,7 @@ public class SAXParser
}
// -- Locator2 --
-
+
public int getColumnNumber()
{
Location l = reader.getLocation();
@@ -888,7 +888,7 @@ public class SAXParser
Location l = reader.getLocation();
return l.getSystemId();
}
-
+
public String getEncoding()
{
return encoding;
@@ -900,7 +900,7 @@ public class SAXParser
}
// -- XMLResolver --
-
+
public Object resolveEntity(String publicId, String systemId,
String baseURI, String namespace)
throws XMLStreamException
@@ -1037,5 +1037,5 @@ public class SAXParser
pos++;
}
}
-
+
}
diff --git a/gnu/xml/stream/SAXParserFactory.java b/gnu/xml/stream/SAXParserFactory.java
index a2ccea1e6..ebaeb3cb2 100644
--- a/gnu/xml/stream/SAXParserFactory.java
+++ b/gnu/xml/stream/SAXParserFactory.java
@@ -1,4 +1,4 @@
-/* SAXParserFactory.java --
+/* SAXParserFactory.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -92,13 +92,13 @@ public class SAXParserFactory
features.put(name, value ? Boolean.TRUE : Boolean.FALSE);
}
- public boolean getFeature(String name)
- throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException
+ public boolean getFeature(String name)
+ throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException
{
if (!FEATURE_NAMES.contains(name))
throw new SAXNotSupportedException(name);
Boolean value = (Boolean) features.get(name);
return (value == null) ? false : value.booleanValue();
}
-
+
}
diff --git a/gnu/xml/stream/StartDocumentImpl.java b/gnu/xml/stream/StartDocumentImpl.java
index dc4251dd9..d2e590cfc 100644
--- a/gnu/xml/stream/StartDocumentImpl.java
+++ b/gnu/xml/stream/StartDocumentImpl.java
@@ -1,4 +1,4 @@
-/* StartDocumentImpl.java --
+/* StartDocumentImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -109,7 +109,7 @@ public class StartDocumentImpl
{
return xmlVersion;
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
@@ -139,6 +139,5 @@ public class StartDocumentImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/StartElementImpl.java b/gnu/xml/stream/StartElementImpl.java
index 48f886560..66e68d560 100644
--- a/gnu/xml/stream/StartElementImpl.java
+++ b/gnu/xml/stream/StartElementImpl.java
@@ -1,4 +1,4 @@
-/* StartElementImpl.java --
+/* StartElementImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -115,7 +115,7 @@ public class StartElementImpl
{
return namespaceContext.getNamespaceURI(prefix);
}
-
+
public void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException
{
@@ -148,6 +148,5 @@ public class StartElementImpl
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/stream/UnicodeReader.java b/gnu/xml/stream/UnicodeReader.java
index 9350cb2e0..aa2a95422 100644
--- a/gnu/xml/stream/UnicodeReader.java
+++ b/gnu/xml/stream/UnicodeReader.java
@@ -1,4 +1,4 @@
-/* UnicodeReader.java --
+/* UnicodeReader.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -201,5 +201,5 @@ public class UnicodeReader
}
return buf;
}
-
+
}
diff --git a/gnu/xml/stream/XIncludeFilter.java b/gnu/xml/stream/XIncludeFilter.java
index aed9d9a0f..6d955c492 100644
--- a/gnu/xml/stream/XIncludeFilter.java
+++ b/gnu/xml/stream/XIncludeFilter.java
@@ -1,4 +1,4 @@
-/* XIncludeFilter.java --
+/* XIncludeFilter.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -107,7 +107,7 @@ class XIncludeFilter
HashSet seen = new HashSet();
boolean backtracking;
boolean lookahead;
-
+
Reader includedText;
char[] buf;
int len = -1;
@@ -677,7 +677,7 @@ class XIncludeFilter
String base = (String) getParent().getProperty("gnu.xml.stream.baseURI");
return (base == null) ? systemId : base;
}
-
+
boolean includeResource(String href, String parse, String xpointer,
String encoding, String accept,
String acceptLanguage)
@@ -700,7 +700,7 @@ class XIncludeFilter
walker = null;
current = null;
backtracking = false;
-
+
URLConnection connection = getURLConnection(href, accept,
acceptLanguage);
InputStream in = connection.getInputStream();
@@ -927,5 +927,5 @@ class XIncludeFilter
}
return null;
}
-
+
}
diff --git a/gnu/xml/stream/XMLEventAllocatorImpl.java b/gnu/xml/stream/XMLEventAllocatorImpl.java
index dd2b18c94..a1824bfc5 100644
--- a/gnu/xml/stream/XMLEventAllocatorImpl.java
+++ b/gnu/xml/stream/XMLEventAllocatorImpl.java
@@ -1,4 +1,4 @@
-/* XMLEventAllocatorImpl.java --
+/* XMLEventAllocatorImpl.java --
Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -188,7 +188,7 @@ public class XMLEventAllocatorImpl
{
return new XMLEventAllocatorImpl();
}
-
+
protected boolean isWhitespace(String text)
{
int len = text.length();
@@ -200,6 +200,5 @@ public class XMLEventAllocatorImpl
}
return true;
}
-
-}
+}
diff --git a/gnu/xml/stream/XMLEventFactoryImpl.java b/gnu/xml/stream/XMLEventFactoryImpl.java
index 5ca1aab7c..12f7f2c79 100644
--- a/gnu/xml/stream/XMLEventFactoryImpl.java
+++ b/gnu/xml/stream/XMLEventFactoryImpl.java
@@ -1,4 +1,4 @@
-/* XMLEventFactoryImpl.java --
+/* XMLEventFactoryImpl.java --
Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -81,7 +81,7 @@ public class XMLEventFactoryImpl
new QName(namespaceURI, localName, prefix),
value, "CDATA", true);
}
-
+
public Attribute createAttribute(String localName, String value)
{
return new AttributeImpl(location,
@@ -117,7 +117,7 @@ public class XMLEventFactoryImpl
createLinkedList(namespaces),
null);
}
-
+
public StartElement createStartElement(String prefix,
String namespaceUri,
String localName)
@@ -155,7 +155,7 @@ public class XMLEventFactoryImpl
createLinkedList(namespaces),
context);
}
-
+
public EndElement createEndElement(QName name,
Iterator namespaces)
{
@@ -171,7 +171,7 @@ public class XMLEventFactoryImpl
new QName(namespaceUri, localName, prefix),
Collections.EMPTY_LIST);
}
-
+
public EndElement createEndElement(String prefix,
String namespaceUri,
String localName,
@@ -215,7 +215,7 @@ public class XMLEventFactoryImpl
return new StartDocumentImpl(location, null, encoding, version,
standalone, true, true);
}
-
+
public StartDocument createStartDocument(String encoding,
String version)
{
@@ -265,6 +265,5 @@ public class XMLEventFactoryImpl
ret.add(i.next());
return ret;
}
-
-}
+}
diff --git a/gnu/xml/stream/XMLEventImpl.java b/gnu/xml/stream/XMLEventImpl.java
index 8d73b1774..2e650bf74 100644
--- a/gnu/xml/stream/XMLEventImpl.java
+++ b/gnu/xml/stream/XMLEventImpl.java
@@ -1,4 +1,4 @@
-/* XMLEventImpl.java --
+/* XMLEventImpl.java --
Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -136,7 +136,7 @@ public abstract class XMLEventImpl
{
return null;
}
-
+
public abstract void writeAsEncodedUnicode(Writer writer)
throws XMLStreamException;
@@ -192,8 +192,7 @@ public abstract class XMLEventImpl
buf.append(c);
}
}
- return (buf == null) ? text : buf.toString();
+ return (buf == null) ? text : buf.toString();
}
}
-
diff --git a/gnu/xml/stream/XMLEventReaderImpl.java b/gnu/xml/stream/XMLEventReaderImpl.java
index bb64b1e3f..bab6d9378 100644
--- a/gnu/xml/stream/XMLEventReaderImpl.java
+++ b/gnu/xml/stream/XMLEventReaderImpl.java
@@ -1,4 +1,4 @@
-/* XMLEventReaderImpl.java --
+/* XMLEventReaderImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -102,7 +102,7 @@ public class XMLEventReaderImpl
return false;
}
}
-
+
public XMLEvent peek()
throws XMLStreamException
{
@@ -155,4 +155,3 @@ public class XMLEventReaderImpl
}
}
-
diff --git a/gnu/xml/stream/XMLEventWriterImpl.java b/gnu/xml/stream/XMLEventWriterImpl.java
index 72b7adce2..33b1dce31 100644
--- a/gnu/xml/stream/XMLEventWriterImpl.java
+++ b/gnu/xml/stream/XMLEventWriterImpl.java
@@ -1,4 +1,4 @@
-/* XMLEventWriterImpl.java --
+/* XMLEventWriterImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -62,7 +62,7 @@ import javax.xml.stream.events.XMLEvent;
public class XMLEventWriterImpl
implements XMLEventWriter
{
-
+
protected final XMLStreamWriter writer;
protected XMLEventWriterImpl(XMLStreamWriter writer)
@@ -181,11 +181,10 @@ public class XMLEventWriterImpl
{
writer.setNamespaceContext(context);
}
-
+
public NamespaceContext getNamespaceContext()
{
return writer.getNamespaceContext();
}
-
-}
+}
diff --git a/gnu/xml/stream/XMLInputFactoryImpl.java b/gnu/xml/stream/XMLInputFactoryImpl.java
index 5f72e361e..87aa32107 100644
--- a/gnu/xml/stream/XMLInputFactoryImpl.java
+++ b/gnu/xml/stream/XMLInputFactoryImpl.java
@@ -1,4 +1,4 @@
-/* XMLInputFactoryImpl.java --
+/* XMLInputFactoryImpl.java --
Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -91,7 +91,7 @@ public class XMLInputFactoryImpl
{
return createXMLStreamReader(null, reader);
}
-
+
public XMLStreamReader createXMLStreamReader(Source source)
throws XMLStreamException
{
@@ -114,13 +114,13 @@ public class XMLInputFactoryImpl
replacingEntityReferences);
return ret;
}
-
+
public XMLStreamReader createXMLStreamReader(InputStream in)
throws XMLStreamException
{
return createXMLStreamReader(null, in);
}
-
+
public XMLStreamReader createXMLStreamReader(InputStream in, String encoding)
throws XMLStreamException
{
@@ -175,34 +175,34 @@ public class XMLInputFactoryImpl
XMLStreamReader sr = createXMLStreamReader(reader);
return new XMLEventReaderImpl(sr, allocator, null);
}
-
+
public XMLEventReader createXMLEventReader(String systemId, Reader reader)
throws XMLStreamException
{
XMLStreamReader sr = createXMLStreamReader(systemId, reader);
return new XMLEventReaderImpl(sr, allocator, null);
}
-
+
public XMLEventReader createXMLEventReader(XMLStreamReader reader)
throws XMLStreamException
{
return new XMLEventReaderImpl(reader, allocator, null);
}
-
+
public XMLEventReader createXMLEventReader(Source source)
throws XMLStreamException
{
XMLStreamReader sr = createXMLStreamReader(source);
return new XMLEventReaderImpl(sr, allocator, null);
}
-
+
public XMLEventReader createXMLEventReader(InputStream in)
throws XMLStreamException
{
XMLStreamReader sr = createXMLStreamReader(in);
return new XMLEventReaderImpl(sr, allocator, null);
}
-
+
public XMLEventReader createXMLEventReader(InputStream in, String encoding)
throws XMLStreamException
{
@@ -216,7 +216,7 @@ public class XMLInputFactoryImpl
XMLStreamReader sr = createXMLStreamReader(systemId, in);
return new XMLEventReaderImpl(sr, allocator, null);
}
-
+
public XMLStreamReader createFilteredReader(XMLStreamReader reader,
StreamFilter filter)
throws XMLStreamException
@@ -240,7 +240,7 @@ public class XMLInputFactoryImpl
{
this.resolver = resolver;
}
-
+
public XMLReporter getXMLReporter()
{
return reporter;
@@ -327,7 +327,7 @@ public class XMLInputFactoryImpl
name.equals("gnu.xml.stream.baseAware") ||
name.equals("gnu.xml.stream.xIncludeAware");
}
-
+
public void setEventAllocator(XMLEventAllocator allocator)
{
this.allocator = allocator;
@@ -393,6 +393,5 @@ public class XMLInputFactoryImpl
}
return in;
}
-
-}
+}
diff --git a/gnu/xml/stream/XMLOutputFactoryImpl.java b/gnu/xml/stream/XMLOutputFactoryImpl.java
index c8c651fb1..d849e8ba5 100644
--- a/gnu/xml/stream/XMLOutputFactoryImpl.java
+++ b/gnu/xml/stream/XMLOutputFactoryImpl.java
@@ -1,4 +1,4 @@
-/* XMLOutputFactoryImpl.java --
+/* XMLOutputFactoryImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -149,7 +149,7 @@ public class XMLOutputFactoryImpl
}
throw new UnsupportedOperationException();
}
-
+
public void setProperty(String name, Object value)
throws IllegalArgumentException
{
@@ -183,6 +183,5 @@ public class XMLOutputFactoryImpl
{
prefixDefaulting = value;
}
-
-}
+}
diff --git a/gnu/xml/stream/XMLParser.java b/gnu/xml/stream/XMLParser.java
index 6072a9c73..71e876569 100644
--- a/gnu/xml/stream/XMLParser.java
+++ b/gnu/xml/stream/XMLParser.java
@@ -1,4 +1,4 @@
-/* XMLParser.java --
+/* XMLParser.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -113,7 +113,7 @@ import gnu.classpath.debug.TeeReader;
* @see http://www.w3.org/TR/REC-xml-names
* @see http://www.w3.org/TR/xml-names11
* @see http://www.w3.org/TR/xmlbase/
- *
+ *
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class XMLParser
@@ -168,7 +168,7 @@ public class XMLParser
* Stack of end-entity events to be reported.
*/
private LinkedList endEntityStack = new LinkedList();
-
+
/**
* Current parser state within the main state machine.
*/
@@ -224,7 +224,7 @@ public class XMLParser
* Temporary Unicode character buffer used during character data reads.
*/
private int[] tmpBuf = new int[1024];
-
+
/**
* The element content model for the current element.
*/
@@ -682,7 +682,7 @@ public class XMLParser
String elementName = buf.toString();
return doctype.isAttributeDeclared(elementName, qn);
}
-
+
public String getCharacterEncodingScheme()
{
return xmlEncoding;
@@ -1022,7 +1022,7 @@ public class XMLParser
{
return (event != XMLStreamConstants.END_DOCUMENT && event != -1);
}
-
+
public int next()
throws XMLStreamException
{
@@ -1253,7 +1253,7 @@ public class XMLParser
{
return input.read(b, off, len);
}
-
+
/**
* Parsed character read.
*/
@@ -1415,7 +1415,7 @@ public class XMLParser
"U+" + Integer.toHexString(c));
}
else if (!isChar(c))
- error("illegal XML character",
+ error("illegal XML character",
"U+" + Integer.toHexString(c));
buf.append(Character.toChars(c));
}
@@ -1635,7 +1635,7 @@ public class XMLParser
// We can't use java.net.URL here to do the parsing, as it searches for
// a protocol handler. A protocol handler may not be registered for the
// URL scheme here. Do it manually.
- //
+ //
// Set aside scheme and host portion of base URL
String basePrefix = null;
ci = base.indexOf(':');
@@ -1780,7 +1780,7 @@ public class XMLParser
throws IOException, XMLStreamException
{
final int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
-
+
requireWhitespace();
require("version");
readEq();
@@ -1791,9 +1791,9 @@ public class XMLParser
input.xml11 = true;
else
throw new XMLStreamException("illegal XML version: " + xmlVersion);
-
+
boolean white = tryWhitespace();
-
+
if (tryRead("encoding"))
{
if (!white)
@@ -1802,7 +1802,7 @@ public class XMLParser
xmlEncoding = readLiteral(flags, false);
white = tryWhitespace();
}
-
+
if (tryRead("standalone"))
{
if (!white)
@@ -1837,7 +1837,7 @@ public class XMLParser
ExternalIds ids = readExternalIds(false, true);
doctype =
this.new Doctype(rootName, ids.publicId, ids.systemId);
-
+
// Parse internal subset first
skipWhitespace();
if (tryRead('['))
@@ -2075,7 +2075,7 @@ public class XMLParser
{
int separator;
ElementContentModel model = new ElementContentModel();
-
+
// Parse first content particle
skipWhitespace();
model.addContentParticle(readContentParticle(acc));
@@ -2375,7 +2375,7 @@ public class XMLParser
int flags = LIT_ATTRIBUTE;
String value = null, defaultType = null;
boolean saved = expandPE;
-
+
if (!"CDATA".equals(type))
flags |= LIT_NORMALIZE;
@@ -2599,7 +2599,7 @@ public class XMLParser
int c;
int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
ExternalIds ids = new ExternalIds();
-
+
if (tryRead("PUBLIC"))
{
requireWhitespace();
@@ -3300,7 +3300,7 @@ public class XMLParser
*/
private void readEq()
throws IOException, XMLStreamException
- {
+ {
skipWhitespace();
require('=');
skipWhitespace();
@@ -3569,7 +3569,7 @@ public class XMLParser
{
return readNmtoken(isName, nmtokenBuf);
}
-
+
/**
* Parses an NMTOKEN or Name production using the specified buffer.
* @param isName if a Name, otherwise an NMTOKEN
@@ -4123,7 +4123,7 @@ public class XMLParser
(c >= 0x10000 && c < 0x110000) ||
c == 0xa || c == 0x9 || c == 0xd;
}
-
+
/**
* Interns the specified text or not, depending on the value of
* stringInterning.
@@ -4141,7 +4141,7 @@ public class XMLParser
{
error(message, null);
}
-
+
/**
* Report a parsing error.
*/
@@ -4403,7 +4403,7 @@ public class XMLParser
{
event = reader.next();
Location loc = reader.getLocation();
- System.out.print(loc.getLineNumber() + ":" +
+ System.out.print(loc.getLineNumber() + ":" +
loc.getColumnNumber() + " ");
switch (event)
{
@@ -4579,7 +4579,7 @@ public class XMLParser
String uri = getNamespaceURI(prefix);
if (uri == null && (auri == null ||
(input.xml11 && "".equals(auri))))
- return true;
+ return true;
if (uri != null)
{
if ("".equals(uri) && input.xml11 && "".equals(auri))
@@ -4615,7 +4615,7 @@ public class XMLParser
buf.append(']');
return buf.toString();
}
-
+
}
/**
@@ -4661,7 +4661,7 @@ public class XMLParser
/**
* Map of anonymous keys to comments.
- */
+ */
private final LinkedHashMap comments = new LinkedHashMap();
/**
@@ -4753,7 +4753,7 @@ public class XMLParser
if (inExternalSubset)
externalEntities.add(name);
}
-
+
/**
* Adds an entity declaration.
* @param name the entity name
@@ -4916,7 +4916,7 @@ public class XMLParser
{
return entries.iterator();
}
-
+
}
/**
@@ -4950,7 +4950,7 @@ public class XMLParser
static final int ANY = 1;
static final int ELEMENT = 2;
static final int MIXED = 3;
-
+
int min;
int max;
final int type;
@@ -4963,7 +4963,7 @@ public class XMLParser
min = 1;
max = 1;
}
-
+
}
/**
@@ -4972,14 +4972,14 @@ public class XMLParser
class EmptyContentModel
extends ContentModel
{
-
+
EmptyContentModel()
{
super(ContentModel.EMPTY);
min = 0;
max = 0;
}
-
+
}
/**
@@ -4988,14 +4988,14 @@ public class XMLParser
class AnyContentModel
extends ContentModel
{
-
+
AnyContentModel()
{
super(ContentModel.ANY);
min = 0;
max = -1;
}
-
+
}
/**
@@ -5008,7 +5008,7 @@ public class XMLParser
LinkedList contentParticles;
boolean or;
String regex; // regular expression cache
-
+
ElementContentModel()
{
super(ContentModel.ELEMENT);
@@ -5019,7 +5019,7 @@ public class XMLParser
{
contentParticles.add(cp);
}
-
+
}
class ContentParticle
@@ -5028,7 +5028,7 @@ public class XMLParser
int min = 1;
int max = 1;
Object content; // Name (String) or ElementContentModel
-
+
}
/**
@@ -5039,7 +5039,7 @@ public class XMLParser
{
private HashSet names;
-
+
MixedContentModel()
{
super(ContentModel.MIXED);
@@ -5055,7 +5055,7 @@ public class XMLParser
{
return names.contains(name);
}
-
+
}
/**
@@ -5063,7 +5063,7 @@ public class XMLParser
*/
class AttributeDecl
{
-
+
/**
* The attribute type (CDATA, ID, etc).
*/
@@ -5105,7 +5105,7 @@ public class XMLParser
this.values = values;
this.external = external;
}
-
+
}
/**
@@ -5114,14 +5114,14 @@ public class XMLParser
static class Input
implements Location
{
-
+
int line = 1, markLine;
int column, markColumn;
int offset, markOffset;
final String publicId, systemId, name;
final boolean report; // report start- and end-entity
final boolean normalize; // normalize CR, etc to LF
-
+
InputStream in;
Reader reader;
UnicodeReader unicodeReader;
@@ -5161,12 +5161,12 @@ public class XMLParser
}
// -- Location --
-
+
public int getCharacterOffset()
{
return offset;
}
-
+
public int getColumnNumber()
{
return column;
@@ -5295,7 +5295,7 @@ public class XMLParser
}
// Detection of input encoding
-
+
private static final int[] SIGNATURE_UCS_4_1234 =
new int[] { 0x00, 0x00, 0x00, 0x3c };
private static final int[] SIGNATURE_UCS_4_4321 =
@@ -5316,7 +5316,7 @@ public class XMLParser
new int[] { 0x3c, 0x3f, 0x78, 0x6d };
private static final int[] SIGNATURE_UTF_8_BOM =
new int[] { 0xef, 0xbb, 0xbf };
-
+
/**
* Detect the input encoding.
*/
@@ -5351,7 +5351,7 @@ public class XMLParser
else if (equals(SIGNATURE_UCS_4_2143, signature) ||
equals(SIGNATURE_UCS_4_3412, signature))
throw new UnsupportedEncodingException("unsupported UCS-4 byte ordering");
-
+
// 2-byte encodings
else if (equals(SIGNATURE_UCS_2_12, signature))
{
@@ -5401,7 +5401,7 @@ public class XMLParser
}
return true;
}
-
+
void setInputEncoding(String encoding)
throws IOException
{
@@ -5432,4 +5432,3 @@ public class XMLParser
}
}
-
diff --git a/gnu/xml/stream/XMLStreamWriterImpl.java b/gnu/xml/stream/XMLStreamWriterImpl.java
index 1549420c9..83b8f7239 100644
--- a/gnu/xml/stream/XMLStreamWriterImpl.java
+++ b/gnu/xml/stream/XMLStreamWriterImpl.java
@@ -1,4 +1,4 @@
-/* XMLStreamWriterImpl.java --
+/* XMLStreamWriterImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -84,7 +84,7 @@ public class XMLStreamWriterImpl
* in scope.
*/
protected NamespaceContext namespaceContext;
-
+
/**
* The stack of elements in scope.
* Used to close the remaining elements.
@@ -100,7 +100,7 @@ public class XMLStreamWriterImpl
* Whether we are in an empty element.
*/
private boolean emptyElement;
-
+
private NamespaceSupport namespaces;
private int count = 0;
@@ -153,10 +153,10 @@ public class XMLStreamWriterImpl
endStartElement();
namespaces.pushContext();
-
+
writer.write('<');
writer.write(localName);
-
+
elements.addLast(new String[] { null, localName });
inStartElement = true;
}
@@ -180,7 +180,7 @@ public class XMLStreamWriterImpl
endStartElement();
namespaces.pushContext();
-
+
String prefix = getPrefix(namespaceURI);
boolean isDeclared = (prefix != null);
if (!isDeclared)
@@ -203,7 +203,7 @@ public class XMLStreamWriterImpl
{
writeNamespaceImpl(prefix, namespaceURI);
}
-
+
elements.addLast(new String[] { prefix, localName });
}
catch (IOException e)
@@ -249,7 +249,7 @@ public class XMLStreamWriterImpl
endStartElement();
namespaces.pushContext();
-
+
String currentPrefix = getPrefix(namespaceURI);
boolean isCurrent = prefix.equals(currentPrefix);
writer.write('<');
@@ -263,7 +263,7 @@ public class XMLStreamWriterImpl
{
writeNamespaceImpl(prefix, namespaceURI);
}
-
+
elements.addLast(new String[] { prefix, localName });
inStartElement = true;
}
@@ -451,7 +451,7 @@ public class XMLStreamWriterImpl
throw new IllegalArgumentException("illegal Name: " + localName);
if (!isChars(value))
throw new IllegalArgumentException("illegal character: " + value);
-
+
String prefix = getPrefix(namespaceURI);
if (prefix == null)
{
@@ -522,7 +522,7 @@ public class XMLStreamWriterImpl
prefix = XMLConstants.DEFAULT_NS_PREFIX;
setPrefix(prefix, namespaceURI);
-
+
writer.write(' ');
writer.write("xmlns");
if (!XMLConstants.DEFAULT_NS_PREFIX.equals(prefix))
@@ -566,7 +566,7 @@ public class XMLStreamWriterImpl
throw new IllegalArgumentException("illegal comment: " + data);
endStartElement();
-
+
writer.write("<!--");
if (hasXML11RestrictedChars)
{
@@ -651,7 +651,7 @@ public class XMLStreamWriterImpl
throw new IllegalArgumentException("illegal XML character: " + data);
if (data.indexOf("]]") != -1)
throw new IllegalArgumentException("illegal CDATA section: " + data);
-
+
endStartElement();
writer.write("<![CDATA[");
@@ -1012,7 +1012,5 @@ public class XMLStreamWriterImpl
}
return true;
}
-
-}
-
+}
diff --git a/gnu/xml/transform/AbstractNumberNode.java b/gnu/xml/transform/AbstractNumberNode.java
index fb953e4f6..6e478bdc4 100644
--- a/gnu/xml/transform/AbstractNumberNode.java
+++ b/gnu/xml/transform/AbstractNumberNode.java
@@ -1,4 +1,4 @@
-/* AbstractNumberNode.java --
+/* AbstractNumberNode.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -102,7 +102,7 @@ abstract class AbstractNumberNode
// xsl:number doesn't process children
if (next != null)
{
- next.apply(stylesheet, mode,
+ next.apply(stylesheet, mode,
context, pos, len,
parent, nextSibling);
}
@@ -148,7 +148,7 @@ abstract class AbstractNumberNode
for (int i = 0; i < len; i++)
{
String token = (i < 0) ? "." : (String) tokens.get(i);
- boolean alpha = (i < 0) ? true :
+ boolean alpha = (i < 0) ? true :
((Boolean) types.get(i)).booleanValue();
if (!alpha)
{
@@ -304,7 +304,7 @@ abstract class AbstractNumberNode
}
return upper ? buf.toString().toUpperCase() : buf.toString();
}
-
+
abstract int[] compute(Stylesheet stylesheet, Node context, int pos, int len)
throws TransformerException;
diff --git a/gnu/xml/transform/ApplyImportsNode.java b/gnu/xml/transform/ApplyImportsNode.java
index 4b06eea10..298c49da4 100644
--- a/gnu/xml/transform/ApplyImportsNode.java
+++ b/gnu/xml/transform/ApplyImportsNode.java
@@ -1,4 +1,4 @@
-/* ApplyImportsNode.java --
+/* ApplyImportsNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,7 +59,7 @@ final class ApplyImportsNode
ret.next = next.clone(stylesheet);
return ret;
}
-
+
void doApply(Stylesheet stylesheet, QName mode,
Node context, int pos, int len,
Node parent, Node nextSibling)
@@ -80,4 +80,3 @@ final class ApplyImportsNode
}
}
-
diff --git a/gnu/xml/transform/ApplyTemplatesNode.java b/gnu/xml/transform/ApplyTemplatesNode.java
index 0daaa7aec..6aa36954a 100644
--- a/gnu/xml/transform/ApplyTemplatesNode.java
+++ b/gnu/xml/transform/ApplyTemplatesNode.java
@@ -1,4 +1,4 @@
-/* ApplyTemplatesNode.java --
+/* ApplyTemplatesNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -191,7 +191,7 @@ final class ApplyTemplatesNode
}
return super.references(var);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder("apply-templates");
@@ -215,5 +215,5 @@ final class ApplyTemplatesNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/AttributeNode.java b/gnu/xml/transform/AttributeNode.java
index bbc4e0805..4c71f6a92 100644
--- a/gnu/xml/transform/AttributeNode.java
+++ b/gnu/xml/transform/AttributeNode.java
@@ -1,4 +1,4 @@
-/* AttributeNode.java --
+/* AttributeNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,7 +61,7 @@ final class AttributeNode
final TemplateNode name;
final TemplateNode namespace;
final Node source;
-
+
AttributeNode(TemplateNode name,
TemplateNode namespace, Node source)
{
@@ -98,10 +98,10 @@ final class AttributeNode
fragment, null);
// Use XPath string-value of fragment
String nameValue = Expr.stringValue(fragment);
-
+
String namespaceValue = null;
if (namespace != null)
- {
+ {
// Create a document fragment to hold the namespace
fragment = doc.createDocumentFragment();
// Apply namespace to the fragment
@@ -113,7 +113,7 @@ final class AttributeNode
if (namespaceValue.length() == 0)
namespaceValue = null;
}
-
+
String prefix = getPrefix(nameValue);
if (namespaceValue == null)
{
@@ -230,7 +230,7 @@ final class AttributeNode
return true;
return super.references(var);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder("attribute");
@@ -240,5 +240,5 @@ final class AttributeNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/AttributeSet.java b/gnu/xml/transform/AttributeSet.java
index 3ece9c83f..ced50f11c 100644
--- a/gnu/xml/transform/AttributeSet.java
+++ b/gnu/xml/transform/AttributeSet.java
@@ -1,4 +1,4 @@
-/* AttributeSet.java --
+/* AttributeSet.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -62,6 +62,5 @@ final class AttributeSet
children.clone(stylesheet),
name, uas);
}
-
-}
+}
diff --git a/gnu/xml/transform/Bindings.java b/gnu/xml/transform/Bindings.java
index ab790523f..37d45880c 100644
--- a/gnu/xml/transform/Bindings.java
+++ b/gnu/xml/transform/Bindings.java
@@ -1,4 +1,4 @@
-/* Bindings.java --
+/* Bindings.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -202,7 +202,7 @@ public class Bindings
if (ret == null)
{
for (Iterator<Map<QName,Object>> i = variables.iterator();
- i.hasNext() && ret == null; )
+ i.hasNext() && ret == null; )
{
Map<QName,Object> vctx = i.next();
ret = vctx.get(name);
@@ -212,7 +212,7 @@ public class Bindings
if (ret == null)
{
for (Iterator<Map<QName,Object>> i = parameters.iterator();
- i.hasNext() && ret == null; )
+ i.hasNext() && ret == null; )
{
Map<QName,Object> pctx = i.next();
ret = pctx.get(name);
@@ -260,7 +260,7 @@ public class Bindings
{
return get(qName, null, 1, 1);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder();
@@ -311,7 +311,7 @@ public class Bindings
buf.append(entry.getValue());
seen.add(key);
}
- }
+ }
}
buf.append('}');
next = false;
@@ -337,7 +337,7 @@ public class Bindings
buf.append(entry.getValue());
seen.add(key);
}
- }
+ }
}
buf.append(']');
return buf.toString();
diff --git a/gnu/xml/transform/CallTemplateNode.java b/gnu/xml/transform/CallTemplateNode.java
index fe0eea74e..cc08d93e3 100644
--- a/gnu/xml/transform/CallTemplateNode.java
+++ b/gnu/xml/transform/CallTemplateNode.java
@@ -1,4 +1,4 @@
-/* CallTemplateNode.java --
+/* CallTemplateNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -132,17 +132,17 @@ final class CallTemplateNode
context, pos, len,
parent, nextSibling);
}
-
+
public boolean references(QName var)
{
for (Iterator i = withParams.iterator(); i.hasNext(); )
{
- if (((WithParam) i.next()).references(var))
- return true;
+ if (((WithParam) i.next()).references(var))
+ return true;
}
return super.references(var);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder("call-template");
@@ -152,5 +152,5 @@ final class CallTemplateNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/ChooseNode.java b/gnu/xml/transform/ChooseNode.java
index fe2dc0c2f..262cde144 100644
--- a/gnu/xml/transform/ChooseNode.java
+++ b/gnu/xml/transform/ChooseNode.java
@@ -1,4 +1,4 @@
-/* ChooseNode.java --
+/* ChooseNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,7 +76,7 @@ final class ChooseNode
context, pos, len,
parent, nextSibling);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder("choose");
@@ -84,5 +84,5 @@ final class ChooseNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/CommentNode.java b/gnu/xml/transform/CommentNode.java
index 8131fb286..1c14e5fa8 100644
--- a/gnu/xml/transform/CommentNode.java
+++ b/gnu/xml/transform/CommentNode.java
@@ -1,4 +1,4 @@
-/* CommentNode.java --
+/* CommentNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -94,10 +94,10 @@ final class CommentNode
context, pos, len,
parent, nextSibling);
}
-
+
public String toString()
{
return "comment";
}
-
+
}
diff --git a/gnu/xml/transform/CopyNode.java b/gnu/xml/transform/CopyNode.java
index bae628d96..9cc2fdecd 100644
--- a/gnu/xml/transform/CopyNode.java
+++ b/gnu/xml/transform/CopyNode.java
@@ -1,4 +1,4 @@
-/* CopyNode.java --
+/* CopyNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -127,7 +127,7 @@ final class CopyNode
context, pos, len,
parent, nextSibling);
}
-
+
void addAttributeSet(Stylesheet stylesheet, QName mode,
Node context, int pos, int len,
Node parent, Node nextSibling, String attributeSet)
diff --git a/gnu/xml/transform/CopyOfNode.java b/gnu/xml/transform/CopyOfNode.java
index 4ce84329f..2b06fed4d 100644
--- a/gnu/xml/transform/CopyOfNode.java
+++ b/gnu/xml/transform/CopyOfNode.java
@@ -1,4 +1,4 @@
-/* CopyOfNode.java --
+/* CopyOfNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -153,14 +153,14 @@ final class CopyOfNode
context, pos, len,
parent, nextSibling);
}
-
+
public boolean references(QName var)
{
if (select != null && select.references(var))
return true;
return super.references(var);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder("copy-of");
@@ -170,5 +170,5 @@ final class CopyOfNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/CurrentFunction.java b/gnu/xml/transform/CurrentFunction.java
index 0395396bc..96899679a 100644
--- a/gnu/xml/transform/CurrentFunction.java
+++ b/gnu/xml/transform/CurrentFunction.java
@@ -1,4 +1,4 @@
-/* CurrentFunction.java --
+/* CurrentFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -101,4 +101,3 @@ final class CurrentFunction
}
}
-
diff --git a/gnu/xml/transform/DOMSourceLocator.java b/gnu/xml/transform/DOMSourceLocator.java
index 9bc8fb1b6..fbf31de55 100644
--- a/gnu/xml/transform/DOMSourceLocator.java
+++ b/gnu/xml/transform/DOMSourceLocator.java
@@ -1,4 +1,4 @@
-/* DOMSourceLocator.java --
+/* DOMSourceLocator.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,5 +80,5 @@ class DOMSourceLocator
{
return -1;
}
-
+
}
diff --git a/gnu/xml/transform/DocumentFunction.java b/gnu/xml/transform/DocumentFunction.java
index 29f3d4a45..d0aee25b3 100644
--- a/gnu/xml/transform/DocumentFunction.java
+++ b/gnu/xml/transform/DocumentFunction.java
@@ -1,4 +1,4 @@
-/* DocumentFunction.java --
+/* DocumentFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -86,7 +86,7 @@ final class DocumentFunction
{
this.args = args;
}
-
+
public Object evaluate(Node context, int pos, int len)
{
int arity = args.size();
@@ -165,7 +165,7 @@ final class DocumentFunction
{
if ("".equals(uri) || uri == null)
uri = this.base.getBaseURI();
-
+
// Get fragment
Expr fragment = null;
int hi = uri.indexOf('#');
@@ -240,5 +240,5 @@ final class DocumentFunction
}
return false;
}
-
+
}
diff --git a/gnu/xml/transform/ElementAvailableFunction.java b/gnu/xml/transform/ElementAvailableFunction.java
index aa1598169..6a9d256be 100644
--- a/gnu/xml/transform/ElementAvailableFunction.java
+++ b/gnu/xml/transform/ElementAvailableFunction.java
@@ -1,4 +1,4 @@
-/* ElementAvailableFunction.java --
+/* ElementAvailableFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -148,7 +148,7 @@ class ElementAvailableFunction
// TODO extension elements
return Boolean.FALSE;
}
-
+
public Expr clone(Object context)
{
NamespaceContext n = nsctx;
@@ -179,4 +179,3 @@ class ElementAvailableFunction
}
}
-
diff --git a/gnu/xml/transform/ElementNode.java b/gnu/xml/transform/ElementNode.java
index c5a4dd20d..78a2007b7 100644
--- a/gnu/xml/transform/ElementNode.java
+++ b/gnu/xml/transform/ElementNode.java
@@ -1,4 +1,4 @@
-/* ElementNode.java --
+/* ElementNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -68,7 +68,7 @@ final class ElementNode
final String uas;
final Node source;
final Collection elementExcludeResultPrefixes;
-
+
ElementNode(TemplateNode name,
TemplateNode namespace, String uas, Node source)
{
@@ -134,7 +134,7 @@ final class ElementNode
namespaceValue = null;
}
else
- {
+ {
String prefix = getPrefix(nameValue);
if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix))
{
@@ -169,7 +169,7 @@ final class ElementNode
}
}
}
-
+
// Create element
Element element = (namespaceValue != null) ?
doc.createElementNS(namespaceValue, nameValue) :
@@ -237,7 +237,7 @@ final class ElementNode
return true;
return super.references(var);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder("element");
@@ -257,5 +257,5 @@ final class ElementNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/ErrorListenerErrorHandler.java b/gnu/xml/transform/ErrorListenerErrorHandler.java
index d79bb1546..8a28795c4 100644
--- a/gnu/xml/transform/ErrorListenerErrorHandler.java
+++ b/gnu/xml/transform/ErrorListenerErrorHandler.java
@@ -1,4 +1,4 @@
-/* ErrorListenerErrorHandler.java --
+/* ErrorListenerErrorHandler.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,7 +71,7 @@ class ErrorListenerErrorHandler
throw new SAXException(e2);
}
}
-
+
public void error(SAXParseException e)
throws SAXException
{
@@ -84,7 +84,7 @@ class ErrorListenerErrorHandler
throw new SAXException(e2);
}
}
-
+
public void fatalError(SAXParseException e)
throws SAXException
{
@@ -97,5 +97,5 @@ class ErrorListenerErrorHandler
throw new SAXException(e2);
}
}
-
+
}
diff --git a/gnu/xml/transform/ForEachNode.java b/gnu/xml/transform/ForEachNode.java
index 8908114cc..1613f768b 100644
--- a/gnu/xml/transform/ForEachNode.java
+++ b/gnu/xml/transform/ForEachNode.java
@@ -1,4 +1,4 @@
-/* ForEachNode.java --
+/* ForEachNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -97,25 +97,25 @@ final class ForEachNode
//System.err.println(toString() + ": " + context+" -> "+ret);
if (ret instanceof Collection)
{
- /* Suppression is safe, as we know context produces Collection<Node> */
- @SuppressWarnings("unchecked")
- Collection<Node> ns = (Collection<Node>) ret;
+ /* Suppression is safe, as we know context produces Collection<Node> */
+ @SuppressWarnings("unchecked")
+ Collection<Node> ns = (Collection<Node>) ret;
List<Node> list = new ArrayList<Node>(ns);
- if (!sortKeys.isEmpty())
- {
- for (SortKey sortKey : sortKeys)
- {
- sortKey.init(stylesheet, mode, context, pos, len, parent,
- nextSibling);
- }
- Collections.sort(list, new XSLComparator(sortKeys));
- }
- else
+ if (!sortKeys.isEmpty())
+ {
+ for (SortKey sortKey : sortKeys)
+ {
+ sortKey.init(stylesheet, mode, context, pos, len, parent,
+ nextSibling);
+ }
+ Collections.sort(list, new XSLComparator(sortKeys));
+ }
+ else
Collections.sort(list, documentOrderComparator);
// Perform children for each node
int l = list.size();
int p = 1;
- for (Node node : list)
+ for (Node node : list)
{
stylesheet.current = node;
children.apply(stylesheet, mode,
@@ -139,8 +139,8 @@ final class ForEachNode
return true;
for (Iterator<SortKey> i = sortKeys.iterator(); i.hasNext(); )
{
- if (i.next().references(var))
- return true;
+ if (i.next().references(var))
+ return true;
}
return super.references(var);
}
@@ -155,5 +155,5 @@ final class ForEachNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/FormatNumberFunction.java b/gnu/xml/transform/FormatNumberFunction.java
index 34717b39c..82872be77 100644
--- a/gnu/xml/transform/FormatNumberFunction.java
+++ b/gnu/xml/transform/FormatNumberFunction.java
@@ -1,4 +1,4 @@
-/* FormatNumberFunction.java --
+/* FormatNumberFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -143,4 +143,3 @@ final class FormatNumberFunction
}
}
-
diff --git a/gnu/xml/transform/FunctionAvailableFunction.java b/gnu/xml/transform/FunctionAvailableFunction.java
index ab86401d0..1ac50327e 100644
--- a/gnu/xml/transform/FunctionAvailableFunction.java
+++ b/gnu/xml/transform/FunctionAvailableFunction.java
@@ -1,4 +1,4 @@
-/* FunctionAvailableFunction.java --
+/* FunctionAvailableFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -159,7 +159,7 @@ class FunctionAvailableFunction
// TODO extension functions
return Boolean.FALSE;
}
-
+
public Expr clone(Object context)
{
NamespaceContext n = nsctx;
@@ -190,4 +190,3 @@ class FunctionAvailableFunction
}
}
-
diff --git a/gnu/xml/transform/GenerateIdFunction.java b/gnu/xml/transform/GenerateIdFunction.java
index f0d3e6dd9..efc583cc8 100644
--- a/gnu/xml/transform/GenerateIdFunction.java
+++ b/gnu/xml/transform/GenerateIdFunction.java
@@ -1,4 +1,4 @@
-/* GenerateIdFunction.java --
+/* GenerateIdFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -137,4 +137,3 @@ final class GenerateIdFunction
}
}
-
diff --git a/gnu/xml/transform/IfNode.java b/gnu/xml/transform/IfNode.java
index eeb294138..f31fed555 100644
--- a/gnu/xml/transform/IfNode.java
+++ b/gnu/xml/transform/IfNode.java
@@ -1,4 +1,4 @@
-/* IfNode.java --
+/* IfNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -91,14 +91,14 @@ final class IfNode
context, pos, len,
parent, nextSibling);
}
-
+
public boolean references(QName var)
{
if (test != null && test.references(var))
return true;
return super.references(var);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder("if");
@@ -108,5 +108,5 @@ final class IfNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/Key.java b/gnu/xml/transform/Key.java
index 72bd90aed..18d83394f 100644
--- a/gnu/xml/transform/Key.java
+++ b/gnu/xml/transform/Key.java
@@ -1,4 +1,4 @@
-/* Key.java --
+/* Key.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -66,6 +66,5 @@ class Key
(Pattern) match.clone(stylesheet),
use.clone(stylesheet));
}
-
-}
+}
diff --git a/gnu/xml/transform/KeyFunction.java b/gnu/xml/transform/KeyFunction.java
index a705dc6b0..b962626c9 100644
--- a/gnu/xml/transform/KeyFunction.java
+++ b/gnu/xml/transform/KeyFunction.java
@@ -1,4 +1,4 @@
-/* KeyFunction.java --
+/* KeyFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -104,7 +104,7 @@ final class KeyFunction
// Expand qualified name
String uri = keyName.getNamespaceURI();
String prefix = keyName.getPrefix();
- if ((uri == null || uri.length() == 0) &&
+ if ((uri == null || uri.length() == 0) &&
(prefix != null && prefix.length() > 0))
{
uri = stylesheet.getNamespaceURI(prefix);
@@ -158,7 +158,7 @@ final class KeyFunction
addKeyNodes(ctx, keySet, value, acc);
}
}
-
+
final void addKeyNodeIfMatch(Node node, Collection keySet,
String value, Collection acc)
{
@@ -225,4 +225,3 @@ final class KeyFunction
}
}
-
diff --git a/gnu/xml/transform/LiteralNode.java b/gnu/xml/transform/LiteralNode.java
index d4e283a65..3405b3364 100644
--- a/gnu/xml/transform/LiteralNode.java
+++ b/gnu/xml/transform/LiteralNode.java
@@ -1,4 +1,4 @@
-/* LiteralNode.java --
+/* LiteralNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -198,5 +198,5 @@ final class LiteralNode
{
return source.toString();
}
-
+
}
diff --git a/gnu/xml/transform/MessageNode.java b/gnu/xml/transform/MessageNode.java
index a7eeeeef6..3e4899aeb 100644
--- a/gnu/xml/transform/MessageNode.java
+++ b/gnu/xml/transform/MessageNode.java
@@ -1,4 +1,4 @@
-/* MessageNode.java --
+/* MessageNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -106,5 +106,5 @@ final class MessageNode
}
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/NamespaceProxy.java b/gnu/xml/transform/NamespaceProxy.java
index b3c233cd7..695fbeb52 100644
--- a/gnu/xml/transform/NamespaceProxy.java
+++ b/gnu/xml/transform/NamespaceProxy.java
@@ -1,4 +1,4 @@
-/* NamespaceProxy.java --
+/* NamespaceProxy.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ class NamespaceProxy
{
this.node = node;
}
-
+
public String getNamespaceURI(String prefix)
{
return (node == null) ? null : node.lookupNamespaceURI(prefix);
diff --git a/gnu/xml/transform/NodeNumberNode.java b/gnu/xml/transform/NodeNumberNode.java
index 0427686de..6663db371 100644
--- a/gnu/xml/transform/NodeNumberNode.java
+++ b/gnu/xml/transform/NodeNumberNode.java
@@ -1,4 +1,4 @@
-/* NodeNumberNode.java --
+/* NodeNumberNode.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -265,5 +265,5 @@ final class NodeNumberNode
while (node != null);
return index;
}
-
+
}
diff --git a/gnu/xml/transform/NumberNode.java b/gnu/xml/transform/NumberNode.java
index b19a7b5e9..cec594b99 100644
--- a/gnu/xml/transform/NumberNode.java
+++ b/gnu/xml/transform/NumberNode.java
@@ -1,4 +1,4 @@
-/* NumberNode.java --
+/* NumberNode.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -84,5 +84,5 @@ final class NumberNode
new Double(Expr._number(context, ret));
return new int[] { d.intValue() };
}
-
+
}
diff --git a/gnu/xml/transform/OtherwiseNode.java b/gnu/xml/transform/OtherwiseNode.java
index 9d8168ce4..09057840d 100644
--- a/gnu/xml/transform/OtherwiseNode.java
+++ b/gnu/xml/transform/OtherwiseNode.java
@@ -1,4 +1,4 @@
-/* OtherwiseNode.java --
+/* OtherwiseNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -74,10 +74,10 @@ final class OtherwiseNode
context, pos, len,
parent, nextSibling);
}
-
+
public String toString()
{
return "otherwise";
}
-
+
}
diff --git a/gnu/xml/transform/ParameterNode.java b/gnu/xml/transform/ParameterNode.java
index 431fbd3b1..4f3dc7569 100644
--- a/gnu/xml/transform/ParameterNode.java
+++ b/gnu/xml/transform/ParameterNode.java
@@ -1,4 +1,4 @@
-/* ParameterNode.java --
+/* ParameterNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -73,8 +73,8 @@ final class ParameterNode
ParameterNode clone(Stylesheet stylesheet)
{
ParameterNode ret = new ParameterNode(name,
- select == null ? null : select.clone(stylesheet),
- type);
+ select == null ? null : select.clone(stylesheet),
+ type);
if (children != null)
ret.children = children.clone(stylesheet);
if (next != null)
@@ -106,7 +106,7 @@ final class ParameterNode
// pop the variable context
stylesheet.bindings.pop(type);
}
-
+
Object getValue(Stylesheet stylesheet, QName mode,
Node context, int pos, int len)
throws TransformerException
@@ -124,7 +124,7 @@ final class ParameterNode
else
return null;
}
-
+
public boolean references(QName var)
{
if (select != null && select.references(var))
@@ -144,7 +144,7 @@ final class ParameterNode
return -1;
return 0;
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder();
@@ -170,4 +170,3 @@ final class ParameterNode
}
}
-
diff --git a/gnu/xml/transform/ProcessingInstructionNode.java b/gnu/xml/transform/ProcessingInstructionNode.java
index 655f51f01..1e723a8d4 100644
--- a/gnu/xml/transform/ProcessingInstructionNode.java
+++ b/gnu/xml/transform/ProcessingInstructionNode.java
@@ -1,4 +1,4 @@
-/* ProcessingInstructionNode.java --
+/* ProcessingInstructionNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -104,7 +104,7 @@ final class ProcessingInstructionNode
context, pos, len,
parent, nextSibling);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder("processing-instruction");
@@ -114,5 +114,5 @@ final class ProcessingInstructionNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/SAXSerializer.java b/gnu/xml/transform/SAXSerializer.java
index 9650e3e05..2bd1f97ab 100644
--- a/gnu/xml/transform/SAXSerializer.java
+++ b/gnu/xml/transform/SAXSerializer.java
@@ -1,4 +1,4 @@
-/* SAXSerializer.java --
+/* SAXSerializer.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/transform/SAXTemplatesHandler.java b/gnu/xml/transform/SAXTemplatesHandler.java
index 2c5a4686f..24464c067 100644
--- a/gnu/xml/transform/SAXTemplatesHandler.java
+++ b/gnu/xml/transform/SAXTemplatesHandler.java
@@ -1,4 +1,4 @@
-/* SAXTemplatesHandler.java --
+/* SAXTemplatesHandler.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/transform/SAXTransformerHandler.java b/gnu/xml/transform/SAXTransformerHandler.java
index 83cc3754b..890e15100 100644
--- a/gnu/xml/transform/SAXTransformerHandler.java
+++ b/gnu/xml/transform/SAXTransformerHandler.java
@@ -1,4 +1,4 @@
-/* SAXTransformerHandler.java --
+/* SAXTransformerHandler.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -107,5 +107,5 @@ class SAXTransformerHandler
throw e2;
}
}
-
+
}
diff --git a/gnu/xml/transform/SortKey.java b/gnu/xml/transform/SortKey.java
index 72934a5b7..dd57df986 100644
--- a/gnu/xml/transform/SortKey.java
+++ b/gnu/xml/transform/SortKey.java
@@ -1,4 +1,4 @@
-/* SortKey.java --
+/* SortKey.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -95,7 +95,7 @@ final class SortKey
* @param caseOrder the treatment of case when the data type is a string. This
* may be "upper-first", "lower-first" or {@code null} if
* unspecified.
- */
+ */
SortKey(Expr select, TemplateNode lang, TemplateNode dataType,
TemplateNode order, TemplateNode caseOrder)
{
@@ -215,10 +215,10 @@ final class SortKey
SortKey clone(Stylesheet stylesheet)
{
return new SortKey(select.clone(stylesheet),
- langTemplate == null ? null : cloneAttributeValueTemplate(langTemplate, stylesheet),
- dataTypeTemplate == null ? null : cloneAttributeValueTemplate(dataTypeTemplate, stylesheet),
- orderTemplate == null ? null : cloneAttributeValueTemplate(orderTemplate, stylesheet),
- caseOrderTemplate == null ? null : cloneAttributeValueTemplate(caseOrderTemplate, stylesheet));
+ langTemplate == null ? null : cloneAttributeValueTemplate(langTemplate, stylesheet),
+ dataTypeTemplate == null ? null : cloneAttributeValueTemplate(dataTypeTemplate, stylesheet),
+ orderTemplate == null ? null : cloneAttributeValueTemplate(orderTemplate, stylesheet),
+ caseOrderTemplate == null ? null : cloneAttributeValueTemplate(caseOrderTemplate, stylesheet));
}
/**
diff --git a/gnu/xml/transform/StreamSerializer.java b/gnu/xml/transform/StreamSerializer.java
index 289967218..a5705f891 100644
--- a/gnu/xml/transform/StreamSerializer.java
+++ b/gnu/xml/transform/StreamSerializer.java
@@ -1,4 +1,4 @@
-/* StreamSerializer.java --
+/* StreamSerializer.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,7 +67,7 @@ import org.w3c.dom.Node;
*/
public class StreamSerializer
{
-
+
static final int SPACE = 0x20;
static final int BANG = 0x21; // !
static final int APOS = 0x27; // '
@@ -83,7 +83,7 @@ public class StreamSerializer
static
{
HashSet set;
-
+
set = new HashSet();
set.add("nohref");
HTML_BOOLEAN_ATTRIBUTES.put("area", set);
@@ -95,11 +95,11 @@ public class StreamSerializer
set = new HashSet();
set.add("declare");
HTML_BOOLEAN_ATTRIBUTES.put("object", set);
-
+
set = new HashSet();
set.add("noshade");
HTML_BOOLEAN_ATTRIBUTES.put("hr", set);
-
+
set = new HashSet();
set.add("compact");
HTML_BOOLEAN_ATTRIBUTES.put("dl", set);
@@ -107,46 +107,46 @@ public class StreamSerializer
HTML_BOOLEAN_ATTRIBUTES.put("ul", set);
HTML_BOOLEAN_ATTRIBUTES.put("dir", set);
HTML_BOOLEAN_ATTRIBUTES.put("menu", set);
-
+
set = new HashSet();
set.add("checked");
set.add("disabled");
set.add("readonly");
set.add("ismap");
HTML_BOOLEAN_ATTRIBUTES.put("input", set);
-
+
set = new HashSet();
set.add("multiple");
set.add("disabled");
HTML_BOOLEAN_ATTRIBUTES.put("select", set);
-
+
set = new HashSet();
set.add("disabled");
HTML_BOOLEAN_ATTRIBUTES.put("optgroup", set);
-
+
set = new HashSet();
set.add("selected");
set.add("disabled");
HTML_BOOLEAN_ATTRIBUTES.put("option", set);
-
+
set = new HashSet();
set.add("disabled");
set.add("readonly");
HTML_BOOLEAN_ATTRIBUTES.put("textarea", set);
-
+
set = new HashSet();
set.add("disabled");
HTML_BOOLEAN_ATTRIBUTES.put("button", set);
-
+
set = new HashSet();
set.add("nowrap");
HTML_BOOLEAN_ATTRIBUTES.put("th", set);
HTML_BOOLEAN_ATTRIBUTES.put("td", set);
-
+
set = new HashSet();
set.add("noresize");
HTML_BOOLEAN_ATTRIBUTES.put("frame", set);
-
+
set = new HashSet();
set.add("defer");
HTML_BOOLEAN_ATTRIBUTES.put("script", set);
@@ -168,7 +168,7 @@ public class StreamSerializer
protected boolean discardDefaultContent;
protected boolean xmlDeclaration = true;
-
+
// has a META element with the encoding been added?
private boolean htmlEncoded;
@@ -204,7 +204,7 @@ public class StreamSerializer
{
serialize(node, out, false);
}
-
+
void serialize(Node node, final OutputStream out,
boolean convertToCdata)
throws IOException
diff --git a/gnu/xml/transform/StrippingInstruction.java b/gnu/xml/transform/StrippingInstruction.java
index c6391b9c5..27e9fc8ca 100644
--- a/gnu/xml/transform/StrippingInstruction.java
+++ b/gnu/xml/transform/StrippingInstruction.java
@@ -1,4 +1,4 @@
-/* StrippingInstruction.java --
+/* StrippingInstruction.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ class StrippingInstruction
final NameTest element;
final int precedence;
-
+
StrippingInstruction(NameTest element, int precedence)
{
this.element = element;
@@ -69,5 +69,5 @@ class StrippingInstruction
else
return 0.0f;
}
-
+
}
diff --git a/gnu/xml/transform/Stylesheet.java b/gnu/xml/transform/Stylesheet.java
index 30bd95349..786b258f5 100644
--- a/gnu/xml/transform/Stylesheet.java
+++ b/gnu/xml/transform/Stylesheet.java
@@ -1,4 +1,4 @@
-/* Stylesheet.java --
+/* Stylesheet.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -91,7 +91,7 @@ class Stylesheet
static final String XSL_NS = "http://www.w3.org/1999/XSL/Transform";
private static final NameTest STYLESHEET_PRESERVE_TEXT =
new NameTest(new QName(XSL_NS, "text"), false, false);
-
+
static final int OUTPUT_XML = 0;
static final int OUTPUT_HTML = 1;
static final int OUTPUT_TEXT = 2;
@@ -147,7 +147,7 @@ class Stylesheet
* Decimal formats.
*/
Map<String,DecimalFormat> decimalFormats;
-
+
/**
* Namespace aliases.
*/
@@ -256,16 +256,16 @@ class Stylesheet
builtInTextTemplate =
new ValueOfNode(new Selector(Selector.SELF, tests),
false);
-
+
parse(doc.getDocumentElement(), true);
current = doc; // Alow namespace resolution during processing
-
+
debug = ("yes".equals(System.getProperty("xsl.debug")));
if (debug)
{
System.err.println("Stylesheet: " + doc.getDocumentURI());
- for (Template t : templates)
+ for (Template t : templates)
{
t.list(System.err);
System.err.println("--------------------");
@@ -280,7 +280,7 @@ class Stylesheet
stylesheet = stylesheet.parent;
return stylesheet;
}
-
+
void initDefaultDecimalFormat()
{
DecimalFormat defaultDecimalFormat = new DecimalFormat();
@@ -298,7 +298,7 @@ class Stylesheet
defaultDecimalFormat.setDecimalFormatSymbols(symbols);
decimalFormats.put(null, defaultDecimalFormat);
}
-
+
// -- Cloneable --
public Object clone()
@@ -309,33 +309,33 @@ class Stylesheet
clone.bindings = (Bindings) bindings.clone();
LinkedList<Template> templates2 = new LinkedList<Template>();
- for (Template t : templates)
+ for (Template t : templates)
{
templates2.add(t.clone(clone));
}
clone.templates = templates2;
LinkedList<AttributeSet> attributeSets2 = new LinkedList<AttributeSet>();
- for (AttributeSet as : attributeSets)
+ for (AttributeSet as : attributeSets)
{
attributeSets2.add(as.clone(clone));
}
clone.attributeSets = attributeSets2;
LinkedList<ParameterNode> variables2 = new LinkedList<ParameterNode>();
- for (ParameterNode var : variables)
+ for (ParameterNode var : variables)
{
variables2.add(var.clone(clone));
}
clone.variables = variables2;
LinkedList<Key> keys2 = new LinkedList<Key>();
- for (Key k : keys)
+ for (Key k : keys)
{
keys2.add(k.clone(clone));
}
clone.keys = keys2;
-
+
return clone;
}
catch (CloneNotSupportedException e)
@@ -395,9 +395,9 @@ class Stylesheet
}
return new QName(uri, localName, prefix);
}
-
+
// -- Template selection --
-
+
TemplateNode getTemplate(QName mode, Node context, boolean applyImports)
throws TransformerException
{
@@ -632,7 +632,7 @@ class Stylesheet
Node attr = attrs.getNamedItem(name);
return (attr == null) ? def : attr.getNodeValue();
}
-
+
/**
* namespace-alias
*/
@@ -777,7 +777,7 @@ class Stylesheet
while (st.hasMoreTokens())
{
NameTest element = parseNameTest(st.nextToken());
- stripSpace.add(new StrippingInstruction(element,
+ stripSpace.add(new StrippingInstruction(element,
precedence));
}
}
@@ -923,7 +923,7 @@ class Stylesheet
tokens.add(value.substring(off));
types.add(Boolean.FALSE);
}
-
+
// Construct template node tree
TemplateNode ret = null;
Document doc = source.getOwnerDocument();
@@ -983,7 +983,7 @@ class Stylesheet
{
// Conflict resolution
StrippingInstruction ssi = null, psi = null;
- for (StrippingInstruction si : stripSpace)
+ for (StrippingInstruction si : stripSpace)
{
if (si.element.matches(ctx, 1, 1))
{
@@ -998,7 +998,7 @@ class Stylesheet
ssi = si;
}
}
- for (StrippingInstruction si : preserveSpace)
+ for (StrippingInstruction si : preserveSpace)
{
if (si.element.matches(ctx, 1, 1))
{
@@ -1090,7 +1090,7 @@ class Stylesheet
}
return null;
}
-
+
// -- Parsing --
/**
@@ -1126,7 +1126,7 @@ class Stylesheet
List<WithParam> withParams = parseWithParams(children);
return new CallTemplateNode(name, withParams);
}
-
+
/**
* value-of
*/
@@ -1140,7 +1140,7 @@ class Stylesheet
Expr select = (Expr) xpath.compile(s);
return new ValueOfNode(select, d);
}
-
+
/**
* for-each
*/
@@ -1156,7 +1156,7 @@ class Stylesheet
ret.children = parse(children);
return ret;
}
-
+
/**
* if
*/
@@ -1171,7 +1171,7 @@ class Stylesheet
ret.children = parse(children);
return ret;
}
-
+
/**
* when
*/
@@ -1186,7 +1186,7 @@ class Stylesheet
ret.children = parse(children);
return ret;
}
-
+
/**
* element
*/
@@ -1223,7 +1223,7 @@ class Stylesheet
ret.children = parse(children);
return ret;
}
-
+
/**
* text
*/
@@ -1238,7 +1238,7 @@ class Stylesheet
ret.children = parse(children);
return ret;
}
-
+
/**
* copy
*/
@@ -1252,7 +1252,7 @@ class Stylesheet
ret.children = parse(children);
return ret;
}
-
+
/**
* processing-instruction
*/
@@ -1266,7 +1266,7 @@ class Stylesheet
ret.children = parse(children);
return ret;
}
-
+
/**
* number
*/
@@ -1340,7 +1340,7 @@ class Stylesheet
ret.children = parse(children);
return ret;
}
-
+
/**
* copy-of
*/
@@ -1355,7 +1355,7 @@ class Stylesheet
ret.children = parse(children);
return ret;
}
-
+
/**
* message
*/
@@ -1370,7 +1370,7 @@ class Stylesheet
ret.children = parse(children);
return ret;
}
-
+
/**
* Parse template-level elements.
*/
@@ -1461,7 +1461,7 @@ class Stylesheet
NamedNodeMap attrs = node.getAttributes();
Node children = node.getFirstChild();
TemplateNode content = parse(children);
- QName paramName =
+ QName paramName =
getQName(getRequiredAttribute(attrs, "name", node));
String select = getAttribute(attrs, "select");
ParameterNode ret;
@@ -1770,4 +1770,3 @@ class Stylesheet
}
}
-
diff --git a/gnu/xml/transform/SystemPropertyFunction.java b/gnu/xml/transform/SystemPropertyFunction.java
index 038df0169..f314227e6 100644
--- a/gnu/xml/transform/SystemPropertyFunction.java
+++ b/gnu/xml/transform/SystemPropertyFunction.java
@@ -1,4 +1,4 @@
-/* SystemPropertyFunction.java --
+/* SystemPropertyFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -138,4 +138,3 @@ final class SystemPropertyFunction
}
}
-
diff --git a/gnu/xml/transform/Template.java b/gnu/xml/transform/Template.java
index 7ddef0ae5..09d1a997c 100644
--- a/gnu/xml/transform/Template.java
+++ b/gnu/xml/transform/Template.java
@@ -1,4 +1,4 @@
-/* Template.java --
+/* Template.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,7 +70,7 @@ class Template
final QName mode;
final boolean isAnyNode; // is the match simply "node()"?
- Template(Stylesheet stylesheet,
+ Template(Stylesheet stylesheet,
QName name, Pattern match, TemplateNode node,
int precedence, String priorityAttr, QName mode)
{
@@ -80,7 +80,7 @@ class Template
this.node = node;
this.precedence = precedence;
this.mode = mode;
-
+
double p = DEFAULT_PRIORITY;
boolean a = false;
if (priorityAttr != null)
@@ -126,8 +126,8 @@ class Template
this.priority = p;
this.isAnyNode = a;
}
-
- private Template(Stylesheet stylesheet,
+
+ private Template(Stylesheet stylesheet,
QName name, Pattern match, TemplateNode node,
int precedence, double priority, QName mode, boolean isAnyNode)
{
@@ -155,7 +155,7 @@ class Template
mode,
isAnyNode);
}
-
+
public int compareTo(Object other)
{
if (other instanceof Template)
@@ -249,7 +249,7 @@ class Template
buf.append(node);
buf.append(']');
return buf.toString();
-
+
//return (name != null) ? name.toString() : match.toString();
}
diff --git a/gnu/xml/transform/TemplateNode.java b/gnu/xml/transform/TemplateNode.java
index ad80c59f9..d4c223e01 100644
--- a/gnu/xml/transform/TemplateNode.java
+++ b/gnu/xml/transform/TemplateNode.java
@@ -1,4 +1,4 @@
-/* TemplateNode.java --
+/* TemplateNode.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/transform/TemplatesImpl.java b/gnu/xml/transform/TemplatesImpl.java
index e5395f6fb..fc741bc81 100644
--- a/gnu/xml/transform/TemplatesImpl.java
+++ b/gnu/xml/transform/TemplatesImpl.java
@@ -1,4 +1,4 @@
-/* TemplatesImpl.java --
+/* TemplatesImpl.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/transform/TextNode.java b/gnu/xml/transform/TextNode.java
index 93d1d5417..8263ef5bc 100644
--- a/gnu/xml/transform/TextNode.java
+++ b/gnu/xml/transform/TextNode.java
@@ -1,4 +1,4 @@
-/* TextNode.java --
+/* TextNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -117,5 +117,5 @@ final class TextNode
}
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/TransformerFactoryImpl.java b/gnu/xml/transform/TransformerFactoryImpl.java
index 1e8fea3e3..972e8a282 100644
--- a/gnu/xml/transform/TransformerFactoryImpl.java
+++ b/gnu/xml/transform/TransformerFactoryImpl.java
@@ -1,4 +1,4 @@
-/* TransformerFactoryImpl.java --
+/* TransformerFactoryImpl.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -148,7 +148,7 @@ public class TransformerFactoryImpl
}
return new Stylesheet(this, parent, doc, systemId, precedence);
}
-
+
public Source getAssociatedStylesheet(Source source,
String media,
String title,
@@ -365,14 +365,14 @@ public class TransformerFactoryImpl
Transformer transformer = newTransformer();
return new SAXTransformerHandler(this, transformer);
}
-
+
public TransformerHandler newTransformerHandler(Source source)
throws TransformerConfigurationException
{
Transformer transformer = newTransformer(source);
return new SAXTransformerHandler(this, transformer);
}
-
+
public TransformerHandler newTransformerHandler(Templates templates)
throws TransformerConfigurationException
{
@@ -391,7 +391,7 @@ public class TransformerFactoryImpl
{
throw new UnsupportedOperationException();
}
-
+
// -- SAXTransformerFactory end --
/**
@@ -434,5 +434,5 @@ public class TransformerFactoryImpl
out.close();
}
}
-
+
}
diff --git a/gnu/xml/transform/TransformerImpl.java b/gnu/xml/transform/TransformerImpl.java
index a975c691f..eb6a5dea1 100644
--- a/gnu/xml/transform/TransformerImpl.java
+++ b/gnu/xml/transform/TransformerImpl.java
@@ -1,4 +1,4 @@
-/* TransformerImpl.java --
+/* TransformerImpl.java --
Copyright (C) 2004,2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -231,9 +231,9 @@ class TransformerImpl
String publicId = outputProperties.getProperty(OutputKeys.DOCTYPE_PUBLIC);
String systemId = outputProperties.getProperty(OutputKeys.DOCTYPE_SYSTEM);
String version = outputProperties.getProperty(OutputKeys.VERSION);
- boolean omitXmlDeclaration =
+ boolean omitXmlDeclaration =
"yes".equals(outputProperties.getProperty(OutputKeys.OMIT_XML_DECLARATION));
- boolean standalone =
+ boolean standalone =
"yes".equals(outputProperties.getProperty(OutputKeys.STANDALONE));
String mediaType = outputProperties.getProperty(OutputKeys.MEDIA_TYPE);
String cdataSectionElements =
diff --git a/gnu/xml/transform/TransformerOutputProperties.java b/gnu/xml/transform/TransformerOutputProperties.java
index 9ac5cdc04..ddaa260c4 100644
--- a/gnu/xml/transform/TransformerOutputProperties.java
+++ b/gnu/xml/transform/TransformerOutputProperties.java
@@ -1,4 +1,4 @@
-/* TransformerOutputProperties.java --
+/* TransformerOutputProperties.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,7 +54,7 @@ import javax.xml.transform.OutputKeys;
class TransformerOutputProperties
extends Properties
{
-
+
final Properties defaultProperties;
final Stylesheet stylesheet;
boolean dirty;
@@ -170,7 +170,7 @@ class TransformerOutputProperties
"yes".equals(getProperty(OutputKeys.STANDALONE));
stylesheet.outputPublicId = getProperty(OutputKeys.DOCTYPE_PUBLIC);
stylesheet.outputSystemId = getProperty(OutputKeys.DOCTYPE_SYSTEM);
- StringTokenizer st =
+ StringTokenizer st =
new StringTokenizer(getProperty(OutputKeys.CDATA_SECTION_ELEMENTS));
Collection acc = new LinkedHashSet();
while (st.hasMoreTokens())
@@ -184,4 +184,3 @@ class TransformerOutputProperties
}
}
-
diff --git a/gnu/xml/transform/URIResolverEntityResolver.java b/gnu/xml/transform/URIResolverEntityResolver.java
index 762416fde..49193a473 100644
--- a/gnu/xml/transform/URIResolverEntityResolver.java
+++ b/gnu/xml/transform/URIResolverEntityResolver.java
@@ -1,4 +1,4 @@
-/* URIResolverEntityResolver.java --
+/* URIResolverEntityResolver.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -79,5 +79,5 @@ class URIResolverEntityResolver
throw new SAXException(e);
}
}
-
+
}
diff --git a/gnu/xml/transform/UnparsedEntityUriFunction.java b/gnu/xml/transform/UnparsedEntityUriFunction.java
index 7ba0eae21..5eae78cb2 100644
--- a/gnu/xml/transform/UnparsedEntityUriFunction.java
+++ b/gnu/xml/transform/UnparsedEntityUriFunction.java
@@ -1,4 +1,4 @@
-/* UnparsedEntityUriFunction.java --
+/* UnparsedEntityUriFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -130,4 +130,3 @@ final class UnparsedEntityUriFunction
}
}
-
diff --git a/gnu/xml/transform/ValueOfNode.java b/gnu/xml/transform/ValueOfNode.java
index 156affa77..0d9a656e7 100644
--- a/gnu/xml/transform/ValueOfNode.java
+++ b/gnu/xml/transform/ValueOfNode.java
@@ -1,4 +1,4 @@
-/* ValueOfNode.java --
+/* ValueOfNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,7 +76,7 @@ final class ValueOfNode
ret.next = next.clone(stylesheet);
return ret;
}
-
+
@Override
void doApply(Stylesheet stylesheet, QName mode,
Node context, int pos, int len,
@@ -125,7 +125,7 @@ final class ValueOfNode
return true;
return super.references(var);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder("value-of");
@@ -137,5 +137,5 @@ final class ValueOfNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/WhenNode.java b/gnu/xml/transform/WhenNode.java
index fc9d5b187..abfe796fd 100644
--- a/gnu/xml/transform/WhenNode.java
+++ b/gnu/xml/transform/WhenNode.java
@@ -1,4 +1,4 @@
-/* WhenNode.java --
+/* WhenNode.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -94,14 +94,14 @@ final class WhenNode
parent, nextSibling);
}
}
-
+
public boolean references(QName var)
{
if (test != null && test.references(var))
return true;
return super.references(var);
}
-
+
public String toString()
{
CPStringBuilder buf = new CPStringBuilder("when");
@@ -111,5 +111,5 @@ final class WhenNode
buf.append(']');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/transform/WithParam.java b/gnu/xml/transform/WithParam.java
index bcfe1e9b7..2e726fb82 100644
--- a/gnu/xml/transform/WithParam.java
+++ b/gnu/xml/transform/WithParam.java
@@ -1,4 +1,4 @@
-/* WithParam.java --
+/* WithParam.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/transform/XSLComparator.java b/gnu/xml/transform/XSLComparator.java
index 88243693d..1fd0b20e6 100644
--- a/gnu/xml/transform/XSLComparator.java
+++ b/gnu/xml/transform/XSLComparator.java
@@ -1,4 +1,4 @@
-/* XSLComparator.java --
+/* XSLComparator.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,54 +65,54 @@ class XSLComparator
{
for (SortKey sortKey : sortKeys)
{
- String k1 = sortKey.key(n1);
- String k2 = sortKey.key(n2);
- if ("text".equals(sortKey.dataType))
- {
- Locale locale = (sortKey.lang == null) ? Locale.getDefault() :
- new Locale(sortKey.lang);
- Collator collator = Collator.getInstance(locale);
- int d = collator.compare(k1, k2);
- if (d != 0)
- {
- switch (sortKey.caseOrder)
- {
- case SortKey.UPPER_FIRST:
- // TODO
- break;
- case SortKey.LOWER_FIRST:
- // TODO
- break;
- }
- if (sortKey.descending)
- {
- d = -d;
- }
- return d;
- }
- }
- else if ("number".equals(sortKey.dataType))
- {
- double kn1 = Expr._number(n1, k1);
- double kn2 = Expr._number(n2, k2);
- int d;
- if (Double.isNaN(kn1) || Double.isInfinite(kn2))
- {
- d = -1;
- }
- else if (Double.isNaN(kn2) || Double.isInfinite(kn1))
- {
- d = 1;
- }
- else
- {
- // conversion to int may give 0 for small numbers
- d = (kn1 > kn2) ? 1 : (kn1 < kn2) ? -1 : 0;
- }
- return (sortKey.descending) ? -d : d;
- }
+ String k1 = sortKey.key(n1);
+ String k2 = sortKey.key(n2);
+ if ("text".equals(sortKey.dataType))
+ {
+ Locale locale = (sortKey.lang == null) ? Locale.getDefault() :
+ new Locale(sortKey.lang);
+ Collator collator = Collator.getInstance(locale);
+ int d = collator.compare(k1, k2);
+ if (d != 0)
+ {
+ switch (sortKey.caseOrder)
+ {
+ case SortKey.UPPER_FIRST:
+ // TODO
+ break;
+ case SortKey.LOWER_FIRST:
+ // TODO
+ break;
+ }
+ if (sortKey.descending)
+ {
+ d = -d;
+ }
+ return d;
+ }
+ }
+ else if ("number".equals(sortKey.dataType))
+ {
+ double kn1 = Expr._number(n1, k1);
+ double kn2 = Expr._number(n2, k2);
+ int d;
+ if (Double.isNaN(kn1) || Double.isInfinite(kn2))
+ {
+ d = -1;
+ }
+ else if (Double.isNaN(kn2) || Double.isInfinite(kn1))
+ {
+ d = 1;
+ }
+ else
+ {
+ // conversion to int may give 0 for small numbers
+ d = (kn1 > kn2) ? 1 : (kn1 < kn2) ? -1 : 0;
+ }
+ return (sortKey.descending) ? -d : d;
+ }
}
return 0;
}
-
+
}
diff --git a/gnu/xml/transform/XSLURIResolver.java b/gnu/xml/transform/XSLURIResolver.java
index c1379211a..cf596c1e6 100644
--- a/gnu/xml/transform/XSLURIResolver.java
+++ b/gnu/xml/transform/XSLURIResolver.java
@@ -1,4 +1,4 @@
-/* XSLURIResolver.java --
+/* XSLURIResolver.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -168,7 +168,7 @@ class XSLURIResolver
}
conn.connect();
lastModified = conn.getLastModified();
- if (node != null &&
+ if (node != null &&
lastModified > 0L &&
lastModified <= lastLastModified)
{
@@ -266,7 +266,7 @@ class XSLURIResolver
return (file == null) ? null : file.toURL();
}
}
-
+
DocumentBuilder getDocumentBuilder()
throws TransformerException
{
@@ -317,6 +317,5 @@ class XSLURIResolver
((DomDocument) doc).setDocumentURI(systemId);
return new DOMSource(doc, systemId);
}
-
-}
+}
diff --git a/gnu/xml/util/DoParse.java b/gnu/xml/util/DoParse.java
index a8f509691..02c80d3a2 100644
--- a/gnu/xml/util/DoParse.java
+++ b/gnu/xml/util/DoParse.java
@@ -1,4 +1,4 @@
-/* DoParse.java --
+/* DoParse.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -101,11 +101,11 @@ final public class DoParse
private DoParse () { /* no instances allowed */ }
// first reported nonrecoverable error
- private static SAXParseException fatal;
+ private static SAXParseException fatal;
// error categories
- private static int errorCount;
- private static int fatalCount;
+ private static int errorCount;
+ private static int fatalCount;
/**
* Command line invoker for this class; pass a filename or URL
@@ -121,182 +121,182 @@ final public class DoParse
public static void main (String argv [])
throws IOException
{
- int exitStatus = 1;
-
- if (argv.length != 2) {
- System.err.println ("Usage: DoParse [filename|URL] pipeline-spec");
- System.err.println ("Example pipeline specs:");
- System.err.println (" 'nsfix | validate'");
- System.err.println (
- " ... restore namespace syntax, validate");
- System.err.println (" 'nsfix | write ( stdout )'");
- System.err.println (
- " ... restore namespace syntax, write to stdout as XML"
- );
- System.exit (1);
- }
-
- try {
- //
- // Get input source for specified document (or try ;-)
- //
- argv [0] = Resolver.getURL (argv [0]);
- InputSource input = new InputSource (argv [0]);
-
- //
- // Get the producer, using the system default parser (which
- // can be overridden for this particular invocation).
- //
- // And the pipeline, using commandline options.
- //
- XMLReader producer;
- EventConsumer consumer;
-
- producer = XMLReaderFactory.createXMLReader ();
-
- //
- // XXX pipeline factory now has a pre-tokenized input
- // method, use it ... that way at least some params
- // can be written using quotes (have spaces, ...)
- //
- consumer = PipelineFactory.createPipeline (argv [1]);
-
- //
- // XXX want commandline option for tweaking error handler.
- // Want to be able to present warnings.
- //
- producer.setErrorHandler (new MyErrorHandler ());
-
- // XXX need facility enabling resolving to local DTDs
-
- //
- // Parse. The pipeline may get optimized a bit, so we
- // can't always fail cleanly for validation without taking
- // a look at the filter stages.
- //
- EventFilter.bind (producer, consumer);
- producer.parse (input);
-
- try {
- if (producer.getFeature (
- "http://org.xml/sax/features/validation"))
- exitStatus = ((errorCount + fatalCount) > 0) ? 1 : 0;
- else if (fatalCount == 0)
- exitStatus = 0;
- } catch (SAXException e) {
- if (hasValidator (consumer))
- exitStatus = ((errorCount + fatalCount) > 0) ? 1 : 0;
- else if (fatalCount == 0)
- exitStatus = 0;
- }
-
- } catch (java.net.MalformedURLException e) {
- System.err.println ("** Malformed URL: " + e.getMessage ());
- System.err.println ("Is '" + argv [0] + "' a non-existent file?");
- e.printStackTrace ();
- // e.g. FNF
-
- } catch (SAXParseException e) {
- if (e != fatal) {
- System.err.print (printParseException ("Parsing Aborted", e));
- e.printStackTrace ();
- if (e.getException () != null) {
- System.err.println ("++ Wrapped exception:");
- e.getException ().printStackTrace ();
- }
- }
-
- } catch (SAXException e) {
- Exception x = e;
- if (e.getException () != null)
- x = e.getException ();
- x.printStackTrace ();
-
- } catch (Throwable t) {
- t.printStackTrace ();
- }
-
- System.exit (exitStatus);
+ int exitStatus = 1;
+
+ if (argv.length != 2) {
+ System.err.println ("Usage: DoParse [filename|URL] pipeline-spec");
+ System.err.println ("Example pipeline specs:");
+ System.err.println (" 'nsfix | validate'");
+ System.err.println (
+ " ... restore namespace syntax, validate");
+ System.err.println (" 'nsfix | write ( stdout )'");
+ System.err.println (
+ " ... restore namespace syntax, write to stdout as XML"
+ );
+ System.exit (1);
+ }
+
+ try {
+ //
+ // Get input source for specified document (or try ;-)
+ //
+ argv [0] = Resolver.getURL (argv [0]);
+ InputSource input = new InputSource (argv [0]);
+
+ //
+ // Get the producer, using the system default parser (which
+ // can be overridden for this particular invocation).
+ //
+ // And the pipeline, using commandline options.
+ //
+ XMLReader producer;
+ EventConsumer consumer;
+
+ producer = XMLReaderFactory.createXMLReader ();
+
+ //
+ // XXX pipeline factory now has a pre-tokenized input
+ // method, use it ... that way at least some params
+ // can be written using quotes (have spaces, ...)
+ //
+ consumer = PipelineFactory.createPipeline (argv [1]);
+
+ //
+ // XXX want commandline option for tweaking error handler.
+ // Want to be able to present warnings.
+ //
+ producer.setErrorHandler (new MyErrorHandler ());
+
+ // XXX need facility enabling resolving to local DTDs
+
+ //
+ // Parse. The pipeline may get optimized a bit, so we
+ // can't always fail cleanly for validation without taking
+ // a look at the filter stages.
+ //
+ EventFilter.bind (producer, consumer);
+ producer.parse (input);
+
+ try {
+ if (producer.getFeature (
+ "http://org.xml/sax/features/validation"))
+ exitStatus = ((errorCount + fatalCount) > 0) ? 1 : 0;
+ else if (fatalCount == 0)
+ exitStatus = 0;
+ } catch (SAXException e) {
+ if (hasValidator (consumer))
+ exitStatus = ((errorCount + fatalCount) > 0) ? 1 : 0;
+ else if (fatalCount == 0)
+ exitStatus = 0;
+ }
+
+ } catch (java.net.MalformedURLException e) {
+ System.err.println ("** Malformed URL: " + e.getMessage ());
+ System.err.println ("Is '" + argv [0] + "' a non-existent file?");
+ e.printStackTrace ();
+ // e.g. FNF
+
+ } catch (SAXParseException e) {
+ if (e != fatal) {
+ System.err.print (printParseException ("Parsing Aborted", e));
+ e.printStackTrace ();
+ if (e.getException () != null) {
+ System.err.println ("++ Wrapped exception:");
+ e.getException ().printStackTrace ();
+ }
+ }
+
+ } catch (SAXException e) {
+ Exception x = e;
+ if (e.getException () != null)
+ x = e.getException ();
+ x.printStackTrace ();
+
+ } catch (Throwable t) {
+ t.printStackTrace ();
+ }
+
+ System.exit (exitStatus);
}
// returns true if saw a validator (before end or unrecognized node)
// false otherwise
private static boolean hasValidator (EventConsumer e)
{
- if (e == null)
- return false;
- if (e instanceof ValidationConsumer)
- return true;
- if (e instanceof TeeConsumer) {
- TeeConsumer t = (TeeConsumer) e;
- return hasValidator (t.getFirst ())
- || hasValidator (t.getRest ());
- }
- if (e instanceof WellFormednessFilter
- || e instanceof NSFilter
- )
- return hasValidator (((EventFilter)e).getNext ());
-
- // else ... gee, we can't know. Assume not.
-
- return false;
+ if (e == null)
+ return false;
+ if (e instanceof ValidationConsumer)
+ return true;
+ if (e instanceof TeeConsumer) {
+ TeeConsumer t = (TeeConsumer) e;
+ return hasValidator (t.getFirst ())
+ || hasValidator (t.getRest ());
+ }
+ if (e instanceof WellFormednessFilter
+ || e instanceof NSFilter
+ )
+ return hasValidator (((EventFilter)e).getNext ());
+
+ // else ... gee, we can't know. Assume not.
+
+ return false;
}
static class MyErrorHandler implements ErrorHandler
{
- // dump validation errors, but continue
- public void error (SAXParseException e)
- throws SAXParseException
- {
- errorCount++;
- System.err.print (printParseException ("Error", e));
- }
-
- public void warning (SAXParseException e)
- throws SAXParseException
- {
- // System.err.print (printParseException ("Warning", e));
- }
-
- // try to continue fatal errors, in case a parser reports more
- public void fatalError (SAXParseException e)
- throws SAXParseException
- {
- fatalCount++;
- if (fatal == null)
- fatal = e;
- System.err.print (printParseException ("Nonrecoverable Error", e));
- }
+ // dump validation errors, but continue
+ public void error (SAXParseException e)
+ throws SAXParseException
+ {
+ errorCount++;
+ System.err.print (printParseException ("Error", e));
+ }
+
+ public void warning (SAXParseException e)
+ throws SAXParseException
+ {
+ // System.err.print (printParseException ("Warning", e));
+ }
+
+ // try to continue fatal errors, in case a parser reports more
+ public void fatalError (SAXParseException e)
+ throws SAXParseException
+ {
+ fatalCount++;
+ if (fatal == null)
+ fatal = e;
+ System.err.print (printParseException ("Nonrecoverable Error", e));
+ }
}
static private String printParseException (
- String label,
- SAXParseException e
+ String label,
+ SAXParseException e
) {
- CPStringBuilder buf = new CPStringBuilder ();
- int temp;
-
- buf.append ("** ");
- buf.append (label);
- buf.append (": ");
- buf.append (e.getMessage ());
- buf.append ('\n');
- if (e.getSystemId () != null) {
- buf.append (" URI: ");
- buf.append (e.getSystemId ());
- buf.append ('\n');
- }
- if ((temp = e.getLineNumber ()) != -1) {
- buf.append (" line: ");
- buf.append (temp);
- buf.append ('\n');
- }
- if ((temp = e.getColumnNumber ()) != -1) {
- buf.append (" char: ");
- buf.append (temp);
- buf.append ('\n');
- }
-
- return buf.toString ();
+ CPStringBuilder buf = new CPStringBuilder ();
+ int temp;
+
+ buf.append ("** ");
+ buf.append (label);
+ buf.append (": ");
+ buf.append (e.getMessage ());
+ buf.append ('\n');
+ if (e.getSystemId () != null) {
+ buf.append (" URI: ");
+ buf.append (e.getSystemId ());
+ buf.append ('\n');
+ }
+ if ((temp = e.getLineNumber ()) != -1) {
+ buf.append (" line: ");
+ buf.append (temp);
+ buf.append ('\n');
+ }
+ if ((temp = e.getColumnNumber ()) != -1) {
+ buf.append (" char: ");
+ buf.append (temp);
+ buf.append ('\n');
+ }
+
+ return buf.toString ();
}
}
diff --git a/gnu/xml/util/DomParser.java b/gnu/xml/util/DomParser.java
index b28b6103b..66e3f1d87 100644
--- a/gnu/xml/util/DomParser.java
+++ b/gnu/xml/util/DomParser.java
@@ -1,4 +1,4 @@
-/* DomParser.java --
+/* DomParser.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,50 +60,50 @@ import org.w3c.dom.*;
*
* <table border="1" width='100%' cellpadding='3' cellspacing='0'>
* <tr bgcolor='#ccccff'>
- * <th><font size='+1'>Name</font></th>
- * <th><font size='+1'>Notes</font></th></tr>
+ * <th><font size='+1'>Name</font></th>
+ * <th><font size='+1'>Notes</font></th></tr>
*
* <tr><td colspan=2><center><em>Features ... URL prefix is
* <b>http://xml.org/sax/features/</b></em></center></td></tr>
*
* <tr><td>(URL)/external-general-entities</td>
- * <td>false (does no parsing)</td></tr>
+ * <td>false (does no parsing)</td></tr>
* <tr><td>(URL)/external-parameter-entities</td>
- * <td>false (does no parsing)</td></tr>
+ * <td>false (does no parsing)</td></tr>
* <tr><td>(URL)/namespaces</td>
- * <td>Value is fixed at <em>true</em></td></tr>
+ * <td>Value is fixed at <em>true</em></td></tr>
* <tr><td>(URL)/namespace-prefixes</td>
- * <td>Value is settable, defaulting to <em>false</em>
- * (<code>xmlns</code> attributes hidden, and names aren't prefixed)
- * </td></tr>
+ * <td>Value is settable, defaulting to <em>false</em>
+ * (<code>xmlns</code> attributes hidden, and names aren't prefixed)
+ * </td></tr>
* <tr><td>(URL)/string-interning</td>
- * <td>Value is fixed at <em>false</em> (DOM provides no
- * guarantees as to interning)</td></tr>
+ * <td>Value is fixed at <em>false</em> (DOM provides no
+ * guarantees as to interning)</td></tr>
* <tr><td>(URL)/validation</td>
- * <td>false (does no parsing)</td></tr>
+ * <td>false (does no parsing)</td></tr>
* <tr><td>(URL)/lexical-handler/parameter-entities</td>
- * <td>false (DOM doesn't do parameter entities)</td></tr>
+ * <td>false (DOM doesn't do parameter entities)</td></tr>
*
* <tr><td colspan=2><center><em>Properties ... URL prefix is
* <b>http://xml.org/sax/properties/</b></em></center></td></tr>
*
*
* <tr><td>(URL)/dom-node</td>
- * <td>This property may be set before parsing to hold a DOM
- * <em>Document</em> node; any arguments given to <em>parse</em>
- * methods are ignored. When retrieved
- * during a parse, this value contains the "current" DOM node.
- * </td></tr>
+ * <td>This property may be set before parsing to hold a DOM
+ * <em>Document</em> node; any arguments given to <em>parse</em>
+ * methods are ignored. When retrieved
+ * during a parse, this value contains the "current" DOM node.
+ * </td></tr>
* <tr><td>(URL)/declaration-handler</td>
- * <td>A declaration handler may be provided. Declaration of external
- * general entities is exposed, but not parameter entities; none of the
- * entity names reported here will begin with "%". </td></tr>
+ * <td>A declaration handler may be provided. Declaration of external
+ * general entities is exposed, but not parameter entities; none of the
+ * entity names reported here will begin with "%". </td></tr>
* <tr><td>(URL)/lexical-handler</td>
- * <td>A lexical handler may be provided. While the start and end of
- * any external subset are reported, expansion of other parameter
- * entities (e.g. inside attribute list declarations) is not exposed.
- * Expansion of general entities within attributes is also not exposed
- * (see below).</td></tr>
+ * <td>A lexical handler may be provided. While the start and end of
+ * any external subset are reported, expansion of other parameter
+ * entities (e.g. inside attribute list declarations) is not exposed.
+ * Expansion of general entities within attributes is also not exposed
+ * (see below).</td></tr>
* </table>
*
* <P> The consequences of modifying a DOM document tree as it is being walked
@@ -114,34 +114,34 @@ import org.w3c.dom.*;
final public class DomParser implements XMLReader
{
// Stuff used internally to route events correctly
- private DefaultHandler2 defaultHandler = new DefaultHandler2 ();
+ private DefaultHandler2 defaultHandler = new DefaultHandler2 ();
// per-parse SAX stuff
- private ContentHandler contentHandler = defaultHandler;
- private DTDHandler dtdHandler = defaultHandler;
- private DeclHandler declHandler = defaultHandler;
- private LexicalHandler lexicalHandler = defaultHandler;
+ private ContentHandler contentHandler = defaultHandler;
+ private DTDHandler dtdHandler = defaultHandler;
+ private DeclHandler declHandler = defaultHandler;
+ private LexicalHandler lexicalHandler = defaultHandler;
// shared context
- private ErrorHandler errHandler = defaultHandler;
- private EntityResolver resolver = defaultHandler;
- private Locale locale = Locale.getDefault ();
+ private ErrorHandler errHandler = defaultHandler;
+ private EntityResolver resolver = defaultHandler;
+ private Locale locale = Locale.getDefault ();
// parser state
- private Node start;
- private Node current;
- private boolean isL2;
- private boolean showNamespaces = true;
- private boolean showXML1_0 = false;
- private NamespaceSupport prefixStack = new NamespaceSupport ();
- private boolean isDocument;
+ private Node start;
+ private Node current;
+ private boolean isL2;
+ private boolean showNamespaces = true;
+ private boolean showXML1_0 = false;
+ private NamespaceSupport prefixStack = new NamespaceSupport ();
+ private boolean isDocument;
/**
* Constructs an unitialized <b>SAX2</b> parser.
*/
public DomParser () {
- }
+ }
/**
* Constructs an <b>SAX2</b> parser initialized to traverse the specified
@@ -149,8 +149,8 @@ final public class DomParser implements XMLReader
* endDocument() calls bracket the calls exposing children.
*/
public DomParser (Node node) {
- setStart (node);
- }
+ setStart (node);
+ }
// stuff that most components in an application should be sharing:
@@ -162,7 +162,7 @@ final public class DomParser implements XMLReader
*/
public EntityResolver getEntityResolver ()
{
- return resolver;
+ return resolver;
}
/**
@@ -171,9 +171,9 @@ final public class DomParser implements XMLReader
*/
public void setEntityResolver (EntityResolver resolver)
{
- if (resolver == null)
- resolver = defaultHandler;
- this.resolver = resolver;
+ if (resolver == null)
+ resolver = defaultHandler;
+ this.resolver = resolver;
}
/**
@@ -181,17 +181,17 @@ final public class DomParser implements XMLReader
* diagnostics it provides.
*
* @exception SAXException as defined in the specification for
- * <em>org.xml.sax.Parser.setLocale()</em>
+ * <em>org.xml.sax.Parser.setLocale()</em>
*/
public void setLocale (Locale locale)
throws SAXException
{
- if (locale == null)
- locale = Locale.getDefault ();
- this.locale = locale;
+ if (locale == null)
+ locale = Locale.getDefault ();
+ this.locale = locale;
}
-
+
// different modules will tend to handle error handling the same,
// but it may not be the same through the whole app
@@ -201,7 +201,7 @@ final public class DomParser implements XMLReader
*/
public ErrorHandler getErrorHandler ()
{
- return errHandler;
+ return errHandler;
}
/**
@@ -210,9 +210,9 @@ final public class DomParser implements XMLReader
*/
public void setErrorHandler (ErrorHandler handler)
{
- if (handler == null)
- handler = defaultHandler;
- errHandler = handler;
+ if (handler == null)
+ handler = defaultHandler;
+ errHandler = handler;
}
@@ -224,7 +224,7 @@ final public class DomParser implements XMLReader
*/
public ContentHandler getContentHandler ()
{
- return contentHandler;
+ return contentHandler;
}
/**
@@ -233,9 +233,9 @@ final public class DomParser implements XMLReader
*/
public void setContentHandler (ContentHandler handler)
{
- if (handler == null)
- handler = defaultHandler;
- contentHandler = handler;
+ if (handler == null)
+ handler = defaultHandler;
+ contentHandler = handler;
}
/**
@@ -244,7 +244,7 @@ final public class DomParser implements XMLReader
*/
public DTDHandler getDTDHandler ()
{
- return dtdHandler;
+ return dtdHandler;
}
/**
@@ -253,9 +253,9 @@ final public class DomParser implements XMLReader
*/
public void setDTDHandler (DTDHandler handler)
{
- if (handler == null)
- handler = defaultHandler;
- dtdHandler = handler;
+ if (handler == null)
+ handler = defaultHandler;
+ dtdHandler = handler;
}
@@ -266,11 +266,11 @@ final public class DomParser implements XMLReader
*
* @param uri ignored (pass an empty string)
* @exception SAXException as defined in the specification for
- * <em>org.xml.sax.Parser.parse()</em>
+ * <em>org.xml.sax.Parser.parse()</em>
*/
public void parse (String uri) throws SAXException
{
- parse ();
+ parse ();
}
/**
@@ -280,38 +280,38 @@ final public class DomParser implements XMLReader
*
* @param input ignored
* @exception SAXException as defined in the specification for
- * <em>org.xml.sax.Parser.parse()</em>
+ * <em>org.xml.sax.Parser.parse()</em>
*/
public void parse (InputSource input) throws SAXException
{
- parse ();
+ parse ();
}
private void parse () throws SAXException
{
- try {
- walk ();
- } finally {
- if (isDocument)
- contentHandler.endDocument ();
- current = null;
- prefixStack.reset ();
- }
+ try {
+ walk ();
+ } finally {
+ if (isDocument)
+ contentHandler.endDocument ();
+ current = null;
+ prefixStack.reset ();
+ }
}
private boolean getIsL2 (Node node)
{
- DOMImplementation impl;
- Document doc;
-
- if (node instanceof Document)
- doc = (Document) node;
- else
- doc = node.getOwnerDocument ();
- if (doc == null)
- throw new RuntimeException ("? unowned node - L2 DTD ?");
- impl = doc.getImplementation ();
- return impl.hasFeature ("XML", "2.0");
+ DOMImplementation impl;
+ Document doc;
+
+ if (node instanceof Document)
+ doc = (Document) node;
+ else
+ doc = node.getOwnerDocument ();
+ if (doc == null)
+ throw new RuntimeException ("? unowned node - L2 DTD ?");
+ impl = doc.getImplementation ();
+ return impl.hasFeature ("XML", "2.0");
}
@@ -324,26 +324,26 @@ final public class DomParser implements XMLReader
public boolean getFeature (String name)
throws SAXNotRecognizedException, SAXNotSupportedException
{
- // basically, none are relevant -- they relate more to
- // parsing than to walking a "parse tree".
-
- // FIXME: DOM feature to expose interning?
-
- if ((FEATURES + "validation").equals (name)
- || (FEATURES + "external-general-entities")
- .equals (name)
- || (FEATURES + "external-parameter-entities")
- .equals (name)
- || (FEATURES + "string-interning").equals (name)
- )
- return false;
-
- if ((FEATURES + "namespaces").equals (name))
- return showNamespaces;
- if ((FEATURES + "namespace-prefixes").equals (name))
- return showXML1_0;
-
- throw new SAXNotRecognizedException (name);
+ // basically, none are relevant -- they relate more to
+ // parsing than to walking a "parse tree".
+
+ // FIXME: DOM feature to expose interning?
+
+ if ((FEATURES + "validation").equals (name)
+ || (FEATURES + "external-general-entities")
+ .equals (name)
+ || (FEATURES + "external-parameter-entities")
+ .equals (name)
+ || (FEATURES + "string-interning").equals (name)
+ )
+ return false;
+
+ if ((FEATURES + "namespaces").equals (name))
+ return showNamespaces;
+ if ((FEATURES + "namespace-prefixes").equals (name))
+ return showXML1_0;
+
+ throw new SAXNotRecognizedException (name);
}
/**
@@ -354,16 +354,16 @@ final public class DomParser implements XMLReader
public Object getProperty (String name)
throws SAXNotRecognizedException, SAXNotSupportedException
{
- if ((HANDLERS + "declaration-handler").equals (name))
- return declHandler == defaultHandler ? null : declHandler;
- if ((HANDLERS + "lexical-handler").equals (name))
- return lexicalHandler == defaultHandler ? null : lexicalHandler;
+ if ((HANDLERS + "declaration-handler").equals (name))
+ return declHandler == defaultHandler ? null : declHandler;
+ if ((HANDLERS + "lexical-handler").equals (name))
+ return lexicalHandler == defaultHandler ? null : lexicalHandler;
- if ((HANDLERS + "dom-node").equals (name))
- return current;
+ if ((HANDLERS + "dom-node").equals (name))
+ return current;
- // unknown properties
- throw new SAXNotRecognizedException (name);
+ // unknown properties
+ throw new SAXNotRecognizedException (name);
}
/**
@@ -373,30 +373,30 @@ final public class DomParser implements XMLReader
public void setFeature (String name, boolean state)
throws SAXNotRecognizedException, SAXNotSupportedException
{
- if (current != null)
- throw new IllegalStateException ("feature change midparse");
-
- boolean value = getFeature (name);
-
- if (value == state)
- return;
-
- if ((FEATURES + "namespaces").equals (name)) {
- if (!showXML1_0 && state == false)
- throw new SAXNotSupportedException ("Illegal namespace "
- + "processing configuration");
- showNamespaces = state;
- return;
- }
- if ((FEATURES + "namespace-prefixes").equals (name)) {
- if (!showNamespaces && state == false)
- throw new SAXNotSupportedException ("Illegal namespace "
- + "processing configuration");
- showXML1_0 = state;
- return;
- }
-
- throw new SAXNotSupportedException (name);
+ if (current != null)
+ throw new IllegalStateException ("feature change midparse");
+
+ boolean value = getFeature (name);
+
+ if (value == state)
+ return;
+
+ if ((FEATURES + "namespaces").equals (name)) {
+ if (!showXML1_0 && state == false)
+ throw new SAXNotSupportedException ("Illegal namespace "
+ + "processing configuration");
+ showNamespaces = state;
+ return;
+ }
+ if ((FEATURES + "namespace-prefixes").equals (name)) {
+ if (!showNamespaces && state == false)
+ throw new SAXNotSupportedException ("Illegal namespace "
+ + "processing configuration");
+ showXML1_0 = state;
+ return;
+ }
+
+ throw new SAXNotSupportedException (name);
}
/**
@@ -410,42 +410,42 @@ final public class DomParser implements XMLReader
public void setProperty (String name, Object state)
throws SAXNotRecognizedException, SAXNotSupportedException
{
- if ((HANDLERS + "declaration-handler").equals (name)) {
- if (!(state instanceof DeclHandler || state == null))
- throw new SAXNotSupportedException (name);
- declHandler = (DeclHandler) state;
- return;
- }
-
- if ((HANDLERS + "lexical-handler").equals (name)) {
- if (!(state instanceof LexicalHandler || state == null))
- throw new SAXNotSupportedException (name);
- lexicalHandler = (LexicalHandler) state;
- return;
- }
-
- if ((HANDLERS + "dom-node").equals (name)) {
- if (state == null || state instanceof Node) {
- if (current != null)
- throw new SAXNotSupportedException (
- "property is readonly during parse: " + name);
- setStart ((Node) state);
- return;
- }
- throw new SAXNotSupportedException ("not a DOM Node");
- }
-
- // unknown properties
- throw new SAXNotRecognizedException (name);
+ if ((HANDLERS + "declaration-handler").equals (name)) {
+ if (!(state instanceof DeclHandler || state == null))
+ throw new SAXNotSupportedException (name);
+ declHandler = (DeclHandler) state;
+ return;
+ }
+
+ if ((HANDLERS + "lexical-handler").equals (name)) {
+ if (!(state instanceof LexicalHandler || state == null))
+ throw new SAXNotSupportedException (name);
+ lexicalHandler = (LexicalHandler) state;
+ return;
+ }
+
+ if ((HANDLERS + "dom-node").equals (name)) {
+ if (state == null || state instanceof Node) {
+ if (current != null)
+ throw new SAXNotSupportedException (
+ "property is readonly during parse: " + name);
+ setStart ((Node) state);
+ return;
+ }
+ throw new SAXNotSupportedException ("not a DOM Node");
+ }
+
+ // unknown properties
+ throw new SAXNotRecognizedException (name);
}
private void setStart (Node property)
{
- start = property;
- if (start != null) {
- isL2 = getIsL2 (start);
- isDocument = (start instanceof Document);
- }
+ start = property;
+ if (start != null) {
+ isL2 = getIsL2 (start);
+ isDocument = (start instanceof Document);
+ }
}
//
@@ -454,351 +454,351 @@ final public class DomParser implements XMLReader
private void walk ()
throws SAXException
{
- int type;
- NamedNodeMap nodes;
- int length;
- AttributesImpl attrs = new AttributesImpl ();
- char chars [];
- String ns, local;
-
- synchronized (this) {
- if (current != null)
- throw new IllegalStateException ("already walking tree");
-
- // JVM guarantees assignments are atomic; so no other
- // thread could get this far till this walk's done.
- current = start;
- }
-
- for (;;) {
- type = current.getNodeType ();
-
- //
- // First, visit the current node, including any "start" calls
- //
- switch (type) {
-
- case Node.DOCUMENT_NODE:
- contentHandler.startDocument ();
- break;
-
- case Node.ELEMENT_NODE:
- nodes = current.getAttributes ();
- length = nodes.getLength ();
- prefixStack.pushContext ();
- for (int i = 0; i < length; i++) {
- Attr attr = (Attr) nodes.item (i);
- String name = attr.getNodeName ();
-
- if (showNamespaces && name.startsWith ("xmlns")) {
- String prefix;
- String uri;
-
- // NOTE: DOM L2 (CR2+ and REC) violate the
- // Namespaces REC, treat "xmlns" like a strange
- // attribute instead of a magic token
- if ("xmlns".equals (name))
- prefix = "";
- else
- prefix = name.substring (6);
- uri = attr.getNodeValue ();
-
- prefixStack.declarePrefix (prefix, uri);
- contentHandler.startPrefixMapping (prefix, uri);
-
- if (!showXML1_0)
- continue;
- }
-
- //
- // NOTE: DOM doesn't record the attribute type info
- // which SAX exposes; so this always reports CDATA.
- //
- // NOTE: SAX doesn't expose the isSpecified info which
- // DOM exposes; that's discarded here. Similarly with
- // the information DOM hides inside itself about what
- // the default values for an attribute are.
- //
- if (showNamespaces) {
- if (isL2) {
- if ((ns = attr.getNamespaceURI ()) == null)
- ns = "";
- // Note: SAX2 and DOM handle "local" names
- // differently
- if ((local = attr.getLocalName ()) == null)
- local = name;
- } else {
+ int type;
+ NamedNodeMap nodes;
+ int length;
+ AttributesImpl attrs = new AttributesImpl ();
+ char chars [];
+ String ns, local;
+
+ synchronized (this) {
+ if (current != null)
+ throw new IllegalStateException ("already walking tree");
+
+ // JVM guarantees assignments are atomic; so no other
+ // thread could get this far till this walk's done.
+ current = start;
+ }
+
+ for (;;) {
+ type = current.getNodeType ();
+
+ //
+ // First, visit the current node, including any "start" calls
+ //
+ switch (type) {
+
+ case Node.DOCUMENT_NODE:
+ contentHandler.startDocument ();
+ break;
+
+ case Node.ELEMENT_NODE:
+ nodes = current.getAttributes ();
+ length = nodes.getLength ();
+ prefixStack.pushContext ();
+ for (int i = 0; i < length; i++) {
+ Attr attr = (Attr) nodes.item (i);
+ String name = attr.getNodeName ();
+
+ if (showNamespaces && name.startsWith ("xmlns")) {
+ String prefix;
+ String uri;
+
+ // NOTE: DOM L2 (CR2+ and REC) violate the
+ // Namespaces REC, treat "xmlns" like a strange
+ // attribute instead of a magic token
+ if ("xmlns".equals (name))
+ prefix = "";
+ else
+ prefix = name.substring (6);
+ uri = attr.getNodeValue ();
+
+ prefixStack.declarePrefix (prefix, uri);
+ contentHandler.startPrefixMapping (prefix, uri);
+
+ if (!showXML1_0)
+ continue;
+ }
+
+ //
+ // NOTE: DOM doesn't record the attribute type info
+ // which SAX exposes; so this always reports CDATA.
+ //
+ // NOTE: SAX doesn't expose the isSpecified info which
+ // DOM exposes; that's discarded here. Similarly with
+ // the information DOM hides inside itself about what
+ // the default values for an attribute are.
+ //
+ if (showNamespaces) {
+ if (isL2) {
+ if ((ns = attr.getNamespaceURI ()) == null)
+ ns = "";
+ // Note: SAX2 and DOM handle "local" names
+ // differently
+ if ((local = attr.getLocalName ()) == null)
+ local = name;
+ } else {
// XXX
- throw new RuntimeException (
- "NYI, ns lookup when parsing L1 DOM");
- }
- } else
- ns = local = "";
- attrs.addAttribute (ns, local, name,
- "CDATA", attr.getNodeValue ());
- }
- if (showNamespaces) {
- if (isL2) {
- if ((ns = current.getNamespaceURI ()) == null)
- ns = "";
- // Note: SAX2 and DOM handle "local" names differently
- if ((local = current.getLocalName ()) == null)
- local = current.getNodeName ();
- } else {
+ throw new RuntimeException (
+ "NYI, ns lookup when parsing L1 DOM");
+ }
+ } else
+ ns = local = "";
+ attrs.addAttribute (ns, local, name,
+ "CDATA", attr.getNodeValue ());
+ }
+ if (showNamespaces) {
+ if (isL2) {
+ if ((ns = current.getNamespaceURI ()) == null)
+ ns = "";
+ // Note: SAX2 and DOM handle "local" names differently
+ if ((local = current.getLocalName ()) == null)
+ local = current.getNodeName ();
+ } else {
// XXX
- throw new RuntimeException (
- "NYI, ns lookup when parsing L1 DOM");
- }
- } else
- ns = local = "";
- contentHandler.startElement (ns, local,
- current.getNodeName (), attrs);
- if (length != 0)
- attrs.clear ();
- break;
-
- case Node.CDATA_SECTION_NODE:
- lexicalHandler.startCDATA ();
- chars = current.getNodeValue ().toCharArray ();
- contentHandler.characters (chars, 0, chars.length);
- lexicalHandler.endCDATA ();
- break;
-
- case Node.COMMENT_NODE:
- chars = current.getNodeValue ().toCharArray ();
- lexicalHandler.comment (chars, 0, chars.length);
- break;
-
- case Node.DOCUMENT_TYPE_NODE:
- {
- DocumentType doctype = (DocumentType) current;
-
- //
- // Only DOM L2 supports recreating even some DTDs in full.
- //
- if (isL2) {
- lexicalHandler.startDTD (doctype.getName (),
- doctype.getPublicId (),
- doctype.getSystemId ());
- } else
- lexicalHandler.startDTD (doctype.getName (),
- null, null);
-
- //
- // The only sure way to recreate is to provide both the
- // internal and external subsets. Otherwise, only part
- // of the job can be done ... because from the DTD, DOM
- // discards both the critical data, like the attribute and
- // element declarations, as well as the PIs and comments
- // that are used to hold their documentation.
- //
- // Even the entity and notation declarations that it can
- // expose can't be recorded without proprietary extensions.
- //
- // We construct a comment to tell what we know about how
- // (in)complete this particular really DTD is.
- //
- {
- String message;
- char buf [];
-
- //
- // Though DOM L2 lets the whole doctype be recreated,
- // SAX2 can't represent it (input or output).
- // So this will be the typical case.
- //
- if (isL2 && doctype.getInternalSubset () != null)
- message =
- " Full DTD known; can't be shown using SAX2. ";
-
- //
- // Otherwise, we'll concoct a partial DTD. If there's
- // any more data here at all, it was provided using a
- // (proprietary) extension to DOM.
- //
- else
- message =
- " This DTD was was recreated using incomplete DOM L2 records. ";
-
- buf = message.toCharArray ();
- lexicalHandler.comment (buf, 0, buf.length);
- }
-
- // report notations first
- nodes = doctype.getNotations ();
- length = nodes.getLength ();
- for (int i = 0; i < length; i++) {
- Notation notation = (Notation) nodes.item (i);
- dtdHandler.notationDecl (
- notation.getNodeName (),
- notation.getPublicId (),
- notation.getSystemId ());
- }
-
- // then parsed and unparsed external general entities
- nodes = doctype.getEntities ();
- length = nodes.getLength ();
- for (int i = 0; i < length; i++) {
- Entity entity = (Entity) nodes.item (i);
- String notation = entity.getNotationName ();
-
- if (notation != null)
- dtdHandler.unparsedEntityDecl (
- entity.getNodeName (),
- entity.getPublicId (),
- entity.getSystemId (),
- notation);
- else if (entity.getSystemId () != null)
- declHandler.externalEntityDecl (
- entity.getNodeName (),
- entity.getPublicId (),
- entity.getSystemId ());
-
- //
- // NOTE: DOM doesn't clearly provide internal
- // entity support; but in case someone tries to
- // fudge such support, we defend ourselves above.
- //
- // NOTE: DOM doesn't expose parameter entities
- // (thank you thank you thank you thank you)
- //
- }
-
- //
- // NOTE: DOM (levels 1 and 2) doesn't expose real
- // typing information (element or attribute decls),
- // as exposed by SAX2 declaration handlers.
- //
- lexicalHandler.endDTD ();
- }
- break;
-
- case Node.ENTITY_REFERENCE_NODE:
- // this isn't done except (a) in content, and
- // (b) not within a start tag (att value)
- lexicalHandler.startEntity (current.getNodeName ());
- break;
-
- case Node.PROCESSING_INSTRUCTION_NODE:
- contentHandler.processingInstruction (
- current.getNodeName (), current.getNodeValue ());
- break;
-
- case Node.TEXT_NODE:
- chars = current.getNodeValue ().toCharArray ();
- contentHandler.characters (chars, 0, chars.length);
- break;
-
- default:
- // e.g. fragments, entities, notations, attributes
- throw new SAXException ("Illegal DOM Node type in Document: "
- + current.getNodeType ());
- }
-
- //
- // Then, pick the next node to visit. If the next node isn't
- // a child, an "end" call may be needed before moving on.
- // If there's no next node, we're done.
- //
- Node next;
-
- switch (type) {
- case Node.DOCUMENT_NODE:
- case Node.ELEMENT_NODE:
- case Node.ENTITY_REFERENCE_NODE:
- //
- // For elements that can have children, visit those
- // children before any siblings (i.e. depth first)
- // and after visiting this node (i.e. preorder)
- //
- next = current.getFirstChild ();
- if (next != null) {
- current = next;
- break;
- }
- //
- // Else treat this like other childless nodes, but
- // handle this node's "end" immediately.
- //
- callEnd (current);
-
- // FALLTHROUGH
-
- case Node.CDATA_SECTION_NODE:
- case Node.COMMENT_NODE:
- case Node.DOCUMENT_TYPE_NODE:
- case Node.ENTITY_NODE:
- case Node.PROCESSING_INSTRUCTION_NODE:
- case Node.TEXT_NODE:
- //
- // Use next sibling, if there is one.
- // Else, climb up a level (calling "end")
- // until we find an ancestral sibling
- // or until we we climb off the top (FINISH)
- //
- for (;;) {
- if ((next = current.getNextSibling ()) != null)
- break;
- current = current.getParentNode ();
- if (current == null || current == start)
- return;
- callEnd (current);
- }
- current = next;
- break;
-
- default:
- throw new SAXException (
- "Illegal DOM Node type found: " + current.getNodeType ());
- }
- }
+ throw new RuntimeException (
+ "NYI, ns lookup when parsing L1 DOM");
+ }
+ } else
+ ns = local = "";
+ contentHandler.startElement (ns, local,
+ current.getNodeName (), attrs);
+ if (length != 0)
+ attrs.clear ();
+ break;
+
+ case Node.CDATA_SECTION_NODE:
+ lexicalHandler.startCDATA ();
+ chars = current.getNodeValue ().toCharArray ();
+ contentHandler.characters (chars, 0, chars.length);
+ lexicalHandler.endCDATA ();
+ break;
+
+ case Node.COMMENT_NODE:
+ chars = current.getNodeValue ().toCharArray ();
+ lexicalHandler.comment (chars, 0, chars.length);
+ break;
+
+ case Node.DOCUMENT_TYPE_NODE:
+ {
+ DocumentType doctype = (DocumentType) current;
+
+ //
+ // Only DOM L2 supports recreating even some DTDs in full.
+ //
+ if (isL2) {
+ lexicalHandler.startDTD (doctype.getName (),
+ doctype.getPublicId (),
+ doctype.getSystemId ());
+ } else
+ lexicalHandler.startDTD (doctype.getName (),
+ null, null);
+
+ //
+ // The only sure way to recreate is to provide both the
+ // internal and external subsets. Otherwise, only part
+ // of the job can be done ... because from the DTD, DOM
+ // discards both the critical data, like the attribute and
+ // element declarations, as well as the PIs and comments
+ // that are used to hold their documentation.
+ //
+ // Even the entity and notation declarations that it can
+ // expose can't be recorded without proprietary extensions.
+ //
+ // We construct a comment to tell what we know about how
+ // (in)complete this particular really DTD is.
+ //
+ {
+ String message;
+ char buf [];
+
+ //
+ // Though DOM L2 lets the whole doctype be recreated,
+ // SAX2 can't represent it (input or output).
+ // So this will be the typical case.
+ //
+ if (isL2 && doctype.getInternalSubset () != null)
+ message =
+ " Full DTD known; can't be shown using SAX2. ";
+
+ //
+ // Otherwise, we'll concoct a partial DTD. If there's
+ // any more data here at all, it was provided using a
+ // (proprietary) extension to DOM.
+ //
+ else
+ message =
+ " This DTD was was recreated using incomplete DOM L2 records. ";
+
+ buf = message.toCharArray ();
+ lexicalHandler.comment (buf, 0, buf.length);
+ }
+
+ // report notations first
+ nodes = doctype.getNotations ();
+ length = nodes.getLength ();
+ for (int i = 0; i < length; i++) {
+ Notation notation = (Notation) nodes.item (i);
+ dtdHandler.notationDecl (
+ notation.getNodeName (),
+ notation.getPublicId (),
+ notation.getSystemId ());
+ }
+
+ // then parsed and unparsed external general entities
+ nodes = doctype.getEntities ();
+ length = nodes.getLength ();
+ for (int i = 0; i < length; i++) {
+ Entity entity = (Entity) nodes.item (i);
+ String notation = entity.getNotationName ();
+
+ if (notation != null)
+ dtdHandler.unparsedEntityDecl (
+ entity.getNodeName (),
+ entity.getPublicId (),
+ entity.getSystemId (),
+ notation);
+ else if (entity.getSystemId () != null)
+ declHandler.externalEntityDecl (
+ entity.getNodeName (),
+ entity.getPublicId (),
+ entity.getSystemId ());
+
+ //
+ // NOTE: DOM doesn't clearly provide internal
+ // entity support; but in case someone tries to
+ // fudge such support, we defend ourselves above.
+ //
+ // NOTE: DOM doesn't expose parameter entities
+ // (thank you thank you thank you thank you)
+ //
+ }
+
+ //
+ // NOTE: DOM (levels 1 and 2) doesn't expose real
+ // typing information (element or attribute decls),
+ // as exposed by SAX2 declaration handlers.
+ //
+ lexicalHandler.endDTD ();
+ }
+ break;
+
+ case Node.ENTITY_REFERENCE_NODE:
+ // this isn't done except (a) in content, and
+ // (b) not within a start tag (att value)
+ lexicalHandler.startEntity (current.getNodeName ());
+ break;
+
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ contentHandler.processingInstruction (
+ current.getNodeName (), current.getNodeValue ());
+ break;
+
+ case Node.TEXT_NODE:
+ chars = current.getNodeValue ().toCharArray ();
+ contentHandler.characters (chars, 0, chars.length);
+ break;
+
+ default:
+ // e.g. fragments, entities, notations, attributes
+ throw new SAXException ("Illegal DOM Node type in Document: "
+ + current.getNodeType ());
+ }
+
+ //
+ // Then, pick the next node to visit. If the next node isn't
+ // a child, an "end" call may be needed before moving on.
+ // If there's no next node, we're done.
+ //
+ Node next;
+
+ switch (type) {
+ case Node.DOCUMENT_NODE:
+ case Node.ELEMENT_NODE:
+ case Node.ENTITY_REFERENCE_NODE:
+ //
+ // For elements that can have children, visit those
+ // children before any siblings (i.e. depth first)
+ // and after visiting this node (i.e. preorder)
+ //
+ next = current.getFirstChild ();
+ if (next != null) {
+ current = next;
+ break;
+ }
+ //
+ // Else treat this like other childless nodes, but
+ // handle this node's "end" immediately.
+ //
+ callEnd (current);
+
+ // FALLTHROUGH
+
+ case Node.CDATA_SECTION_NODE:
+ case Node.COMMENT_NODE:
+ case Node.DOCUMENT_TYPE_NODE:
+ case Node.ENTITY_NODE:
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ case Node.TEXT_NODE:
+ //
+ // Use next sibling, if there is one.
+ // Else, climb up a level (calling "end")
+ // until we find an ancestral sibling
+ // or until we we climb off the top (FINISH)
+ //
+ for (;;) {
+ if ((next = current.getNextSibling ()) != null)
+ break;
+ current = current.getParentNode ();
+ if (current == null || current == start)
+ return;
+ callEnd (current);
+ }
+ current = next;
+ break;
+
+ default:
+ throw new SAXException (
+ "Illegal DOM Node type found: " + current.getNodeType ());
+ }
+ }
}
private void callEnd (Node node) throws SAXException
{
- switch (node.getNodeType ()) {
- // only these three container types may ever be found
- // directly inside a Document.
- case Node.DOCUMENT_NODE:
- // for SAX conformance, endDocument must always
- // be called ... it's done in a "finally" clause)
- return;
-
- case Node.ELEMENT_NODE:
- if (showNamespaces) {
- if (isL2)
- contentHandler.endElement (
- node.getNamespaceURI (),
- node.getLocalName (),
- node.getNodeName ());
- else
+ switch (node.getNodeType ()) {
+ // only these three container types may ever be found
+ // directly inside a Document.
+ case Node.DOCUMENT_NODE:
+ // for SAX conformance, endDocument must always
+ // be called ... it's done in a "finally" clause)
+ return;
+
+ case Node.ELEMENT_NODE:
+ if (showNamespaces) {
+ if (isL2)
+ contentHandler.endElement (
+ node.getNamespaceURI (),
+ node.getLocalName (),
+ node.getNodeName ());
+ else
// XXX
- throw new RuntimeException (
- "NYI, ns lookup when parsing L1 DOM");
- for (Enumeration e = prefixStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- ) {
- contentHandler.endPrefixMapping ((String) e.nextElement ());
- }
- } else
- contentHandler.endElement ("", "", node.getNodeName ());
- prefixStack.popContext ();
- return;
-
- case Node.ENTITY_REFERENCE_NODE:
- // see above -- in content, outside start tags.
- lexicalHandler.endEntity (node.getNodeName ());
- return;
-
- // these can be given at the top level
- case Node.DOCUMENT_FRAGMENT_NODE:
- case Node.ATTRIBUTE_NODE:
- return;
-
- default:
- throw new SAXException (
- "Illegal DOM container type found: "
- + current.getNodeType ());
- }
+ throw new RuntimeException (
+ "NYI, ns lookup when parsing L1 DOM");
+ for (Enumeration e = prefixStack.getDeclaredPrefixes ();
+ e.hasMoreElements ();
+ ) {
+ contentHandler.endPrefixMapping ((String) e.nextElement ());
+ }
+ } else
+ contentHandler.endElement ("", "", node.getNodeName ());
+ prefixStack.popContext ();
+ return;
+
+ case Node.ENTITY_REFERENCE_NODE:
+ // see above -- in content, outside start tags.
+ lexicalHandler.endEntity (node.getNodeName ());
+ return;
+
+ // these can be given at the top level
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ case Node.ATTRIBUTE_NODE:
+ return;
+
+ default:
+ throw new SAXException (
+ "Illegal DOM container type found: "
+ + current.getNodeType ());
+ }
}
}
diff --git a/gnu/xml/util/Resolver.java b/gnu/xml/util/Resolver.java
index 02c4693ae..b16f9617f 100644
--- a/gnu/xml/util/Resolver.java
+++ b/gnu/xml/util/Resolver.java
@@ -1,4 +1,4 @@
-/* Resolver.java --
+/* Resolver.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,46 +60,46 @@ public class Resolver implements EntityResolver, Cloneable
* so that it uses the mappings in a specified directory.
*
* @param mappings Array of string pairs, where the first member
- * of each pair is a PUBLIC identifier and the second is the
- * name of a file, relative to the specified directory.
+ * of each pair is a PUBLIC identifier and the second is the
+ * name of a file, relative to the specified directory.
* @param directory File holding the specified files.
*/
public static void addDirectoryMapping (
- Dictionary table,
- String mappings [][],
- File directory
+ Dictionary table,
+ String mappings [][],
+ File directory
) throws IOException
{
- for (int i = 0; i < mappings.length; i++) {
- File file = new File (directory, mappings [i][1]);
- String temp;
+ for (int i = 0; i < mappings.length; i++) {
+ File file = new File (directory, mappings [i][1]);
+ String temp;
- if (!file.exists ()) // ?? log a warning ??
- continue;
+ if (!file.exists ()) // ?? log a warning ??
+ continue;
- temp = fileToURL (file);
- table.put (mappings [i][0], temp);
- }
+ temp = fileToURL (file);
+ table.put (mappings [i][0], temp);
+ }
}
- // FIXME: these *URL routines don't quite belong here, except
- // that they're all in the same spirit of making it easy to
- // use local filesystem URIs with XML parsers.
+ // FIXME: these *URL routines don't quite belong here, except
+ // that they're all in the same spirit of making it easy to
+ // use local filesystem URIs with XML parsers.
/**
* Provides the URL for a named file, without relying on the JDK 1.2
* {@link java.io.File#toURL File.toURL}() utility method.
*
* @param filename the file name to convert. Relative file names
- * are resolved the way the JVM resolves them (current to the
- * process-global current working directory).
+ * are resolved the way the JVM resolves them (current to the
+ * process-global current working directory).
*
* @exception IOException if the file does not exist
*/
public static String fileNameToURL (String filename)
throws IOException
{
- return fileToURL (new File (filename));
+ return fileToURL (new File (filename));
}
/**
@@ -107,40 +107,40 @@ public class Resolver implements EntityResolver, Cloneable
* {@link java.io.File#toURL File.toURL}() utility method.
*
* @param f the file to convert. Relative file names
- * are resolved the way the JVM resolves them (current to the
- * process-global current working directory).
+ * are resolved the way the JVM resolves them (current to the
+ * process-global current working directory).
*
* @exception IOException if the file does not exist
*/
public static String fileToURL (File f)
throws IOException
{
- String temp;
-
- // NOTE: the javax.xml.parsers.DocumentBuilder and
- // javax.xml.transform.stream.StreamSource versions
- // of this don't have this test. Some JVM versions
- // don't report this error sanely through URL code.
- if (!f.exists ())
- throw new IOException ("no such file: " + f.getName ());
-
- // FIXME: getAbsolutePath() seems buggy; I'm seeing components
- // like "/foo/../" which are clearly not "absolute"
- // and should have been resolved with the filesystem.
-
- // Substituting "/" would be wrong, "foo" may have been
- // symlinked ... the URL code will make that change
- // later, so that things can get _really_ broken!
-
- temp = f.getAbsolutePath ();
-
- if (File.separatorChar != '/')
- temp = temp.replace (File.separatorChar, '/');
- if (!temp.startsWith ("/"))
- temp = "/" + temp;
- if (!temp.endsWith ("/") && f.isDirectory ())
- temp = temp + "/";
- return "file:" + temp;
+ String temp;
+
+ // NOTE: the javax.xml.parsers.DocumentBuilder and
+ // javax.xml.transform.stream.StreamSource versions
+ // of this don't have this test. Some JVM versions
+ // don't report this error sanely through URL code.
+ if (!f.exists ())
+ throw new IOException ("no such file: " + f.getName ());
+
+ // FIXME: getAbsolutePath() seems buggy; I'm seeing components
+ // like "/foo/../" which are clearly not "absolute"
+ // and should have been resolved with the filesystem.
+
+ // Substituting "/" would be wrong, "foo" may have been
+ // symlinked ... the URL code will make that change
+ // later, so that things can get _really_ broken!
+
+ temp = f.getAbsolutePath ();
+
+ if (File.separatorChar != '/')
+ temp = temp.replace (File.separatorChar, '/');
+ if (!temp.startsWith ("/"))
+ temp = "/" + temp;
+ if (!temp.endsWith ("/") && f.isDirectory ())
+ temp = temp + "/";
+ return "file:" + temp;
}
@@ -150,34 +150,34 @@ public class Resolver implements EntityResolver, Cloneable
* malformed.
*
* @param fileOrURL If this is the name of a file which exists,
- * then its URL is returned. Otherwise the argument is returned.
+ * then its URL is returned. Otherwise the argument is returned.
*/
public static String getURL (String fileOrURL)
{
- try {
- return fileNameToURL (fileOrURL);
- } catch (Exception e) {
- return fileOrURL;
- }
+ try {
+ return fileNameToURL (fileOrURL);
+ } catch (Exception e) {
+ return fileOrURL;
+ }
}
// note: cloneable, this is just copied; unguarded against mods
- private Dictionary pubidMapping;
+ private Dictionary pubidMapping;
/**
* Constructs a resolver which understands how to map PUBLIC identifiers
* to other URIs, typically for local copies of standard DTD components.
- *
+ *
* @param dict maps PUBLIC identifiers to URIs. This is not
- * copied; subsequent modifications will be reported through the
- * resolution operations.
+ * copied; subsequent modifications will be reported through the
+ * resolution operations.
*/
public Resolver (Dictionary dict)
- { pubidMapping = dict; }
+ { pubidMapping = dict; }
+
-
// FIXME: want notion of a "system default" resolver, presumably
// loaded with all sorts of useful stuff. At the same time need
// a notion of resolver chaining (failure --> next) so that subsystems
@@ -191,48 +191,48 @@ public class Resolver implements EntityResolver, Cloneable
* content typing.
*
* @param contentType the MIME content type that will be parsed; must
- * not be null.
+ * not be null.
* @return the appropriate encoding, or null if the content type is
- * not text and there's no <code>charset=...</code> attribute
+ * not text and there's no <code>charset=...</code> attribute
*/
static public String getEncoding (String contentType)
{
- // currently a dumb parsing algorithm that works "mostly" and handles
- // ..anything...charset=ABC
- // ..anything...charset=ABC;otherAttr=DEF
- // ..anything...charset=ABC (comment);otherAttr=DEF
- // ..anything...charset= "ABC" (comment);otherAttr=DEF
-
- int temp;
- String encoding;
- String defValue = null;
-
- if (contentType.startsWith ("text/"))
- defValue = contentType.startsWith ("text/html")
- ? "ISO-8859-1" : "US-ASCII";
-
- // Assumes 'charset' is only an attribute name, not part
- // of a value, comment, or other attribute name
- // ALSO assumes no escaped values like "\;" or "\)"
- if ((temp = contentType.indexOf ("charset")) != -1) {
- // strip out everything up to '=' ...
- temp = contentType.indexOf ('=', temp);
- if (temp == -1)
- return defValue;
- encoding = contentType.substring (temp + 1);
- // ... and any subsequent attributes
- if ((temp = encoding.indexOf (';')) != -1)
- encoding = encoding.substring (0, temp);
- // ... and any comments after value
- if ((temp = encoding.indexOf ('(')) != -1)
- encoding = encoding.substring (0, temp);
- // ... then whitespace, and any (double) quotes
- encoding = encoding.trim ();
- if (encoding.charAt (0) == '"')
- encoding = encoding.substring (1, encoding.length () - 1);
- } else
- encoding = defValue;
- return encoding;
+ // currently a dumb parsing algorithm that works "mostly" and handles
+ // ..anything...charset=ABC
+ // ..anything...charset=ABC;otherAttr=DEF
+ // ..anything...charset=ABC (comment);otherAttr=DEF
+ // ..anything...charset= "ABC" (comment);otherAttr=DEF
+
+ int temp;
+ String encoding;
+ String defValue = null;
+
+ if (contentType.startsWith ("text/"))
+ defValue = contentType.startsWith ("text/html")
+ ? "ISO-8859-1" : "US-ASCII";
+
+ // Assumes 'charset' is only an attribute name, not part
+ // of a value, comment, or other attribute name
+ // ALSO assumes no escaped values like "\;" or "\)"
+ if ((temp = contentType.indexOf ("charset")) != -1) {
+ // strip out everything up to '=' ...
+ temp = contentType.indexOf ('=', temp);
+ if (temp == -1)
+ return defValue;
+ encoding = contentType.substring (temp + 1);
+ // ... and any subsequent attributes
+ if ((temp = encoding.indexOf (';')) != -1)
+ encoding = encoding.substring (0, temp);
+ // ... and any comments after value
+ if ((temp = encoding.indexOf ('(')) != -1)
+ encoding = encoding.substring (0, temp);
+ // ... then whitespace, and any (double) quotes
+ encoding = encoding.trim ();
+ if (encoding.charAt (0) == '"')
+ encoding = encoding.substring (1, encoding.length () - 1);
+ } else
+ encoding = defValue;
+ return encoding;
}
@@ -243,21 +243,21 @@ public class Resolver implements EntityResolver, Cloneable
public InputSource resolveEntity (String publicId, String systemId)
throws IOException, SAXException
{
- InputSource retval = null;
- String uri;
+ InputSource retval = null;
+ String uri;
- if (publicId != null
- && ((uri = (String) pubidMapping.get (publicId)) != null)) {
- retval = new InputSource (uri);
- retval.setPublicId (publicId);
- }
+ if (publicId != null
+ && ((uri = (String) pubidMapping.get (publicId)) != null)) {
+ retval = new InputSource (uri);
+ retval.setPublicId (publicId);
+ }
- // Could do URN resolution here
+ // Could do URN resolution here
- // URL resolution always done by parser
+ // URL resolution always done by parser
- // FIXME: chain to "next" resolver
+ // FIXME: chain to "next" resolver
- return retval;
+ return retval;
}
}
diff --git a/gnu/xml/util/SAXNullTransformerFactory.java b/gnu/xml/util/SAXNullTransformerFactory.java
index 81ad82312..3a97678e0 100644
--- a/gnu/xml/util/SAXNullTransformerFactory.java
+++ b/gnu/xml/util/SAXNullTransformerFactory.java
@@ -1,4 +1,4 @@
-/* SAXNullTransformerFactory.java --
+/* SAXNullTransformerFactory.java --
Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -95,17 +95,17 @@ import org.xml.sax.helpers.LocatorImpl;
*/
public class SAXNullTransformerFactory extends SAXTransformerFactory
{
-
- private ErrorListener errListener;
- private URIResolver uriResolver;
-
+
+ private ErrorListener errListener;
+ private URIResolver uriResolver;
+
/** Default constructor */
public SAXNullTransformerFactory () { }
-
+
//
// only has stuff that makes sense with null transforms
//
-
+
/**
* Returns true if the requested feature is supported.
* All three kinds of input and output are accepted:
@@ -172,14 +172,14 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
public TransformerHandler newTransformerHandler ()
throws TransformerConfigurationException
{
- NullTransformer transformer = new NullTransformer ();
+ NullTransformer transformer = new NullTransformer ();
return transformer.handler;
}
//
// Stuff that depends on XSLT support, which we don't provide
//
- private static final String noXSLT = "No XSLT support";
+ private static final String noXSLT = "No XSLT support";
/** Throws an exception (XSLT is not supported). */
public Transformer newTransformer (Source stylesheet)
@@ -271,15 +271,15 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
super (DomDocument.class);
setHandler (new DomHandler (this, result));
}
-
+
}
static class DomHandler
extends Consumer.Backdoor
{
-
- private DOMResult result;
-
+
+ private DOMResult result;
+
DomHandler (DomConsumer c, DOMResult r)
throws SAXException
{
@@ -294,33 +294,33 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
super.endDocument ();
result.setNode (getDocument ());
}
-
+
}
private static OutputStream getOutputStream (String uri)
throws IOException
{
- // JDK stupidity: file "protocol does not support output" ...
+ // JDK stupidity: file "protocol does not support output" ...
if (uri.startsWith ("file:"))
return new FileOutputStream (uri.substring (5));
-
+
// Otherwise ...
- URL url = new URL (uri);
- URLConnection conn = url.openConnection ();
-
+ URL url = new URL (uri);
+ URLConnection conn = url.openConnection ();
+
conn.setDoOutput (true);
return conn.getOutputStream ();
}
-
+
static class NullHandler
extends EventFilter
implements TransformerHandler
{
-
- private String systemId;
- private Transformer transformer;
-
+
+ private String systemId;
+ private Transformer transformer;
+
NullHandler (Transformer t)
{
transformer = t;
@@ -345,24 +345,24 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
{
if (result.getSystemId () != null)
systemId = result.getSystemId ();
-
+
try
{
-
+
// output to partial SAX event stream?
if (result instanceof SAXResult)
{
- SAXResult r = (SAXResult) result;
-
+ SAXResult r = (SAXResult) result;
+
setContentHandler (r.getHandler ());
setProperty (LEXICAL_HANDLER, r.getLexicalHandler ());
// DTD info is filtered out by javax.transform
-
+
// output to DOM tree?
}
else if (result instanceof DOMResult)
{
- DomTerminus out = new DomTerminus ((DOMResult) result);
+ DomTerminus out = new DomTerminus ((DOMResult) result);
setContentHandler (out.getContentHandler ());
setProperty (LEXICAL_HANDLER,
@@ -378,8 +378,8 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
}
else if (result instanceof StreamResult)
{
- StreamResult r = (StreamResult) result;
- XMLWriter out;
+ StreamResult r = (StreamResult) result;
+ XMLWriter out;
// FIXME: when do output properties take effect?
// encoding, standalone decl, xml/xhtml/... ...
@@ -416,7 +416,7 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
setDTDHandler (out);
setProperty (DECL_HANDLER, out);
}
-
+
}
catch (SAXException e)
{
@@ -434,7 +434,7 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
extends LocatorImpl
implements SourceLocator
{
-
+
LocatorAdapter (SAXParseException e)
{
setSystemId (e.getSystemId ());
@@ -442,21 +442,21 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
setLineNumber (e.getLineNumber ());
setColumnNumber (e.getColumnNumber ());
}
-
+
}
// another interface that adds no value
static class ListenerAdapter
implements ErrorHandler
{
-
- NullTransformer transformer;
-
+
+ NullTransformer transformer;
+
ListenerAdapter (NullTransformer t)
{
transformer = t;
}
-
+
private TransformerException map (SAXParseException e)
{
return new TransformerException (
@@ -514,36 +514,36 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
static class NullTransformer
extends Transformer
{
-
- private URIResolver uriResolver;
- private Properties props = new Properties ();
- private Hashtable params = new Hashtable (7);
-
- ErrorListener errListener = null;
- TransformerException ex = null;
- NullHandler handler;
-
+
+ private URIResolver uriResolver;
+ private Properties props = new Properties ();
+ private Hashtable params = new Hashtable (7);
+
+ ErrorListener errListener = null;
+ TransformerException ex = null;
+ NullHandler handler;
+
NullTransformer ()
{
super ();
handler = new NullHandler (this);
}
-
+
public ErrorListener getErrorListener ()
{
return errListener;
}
-
+
public void setErrorListener (ErrorListener e)
{
errListener = e;
}
-
+
public URIResolver getURIResolver ()
{
return uriResolver;
}
-
+
public void setURIResolver (URIResolver u)
{
uriResolver = u;
@@ -553,7 +553,7 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
{
props = (Properties) p.clone ();
}
-
+
public Properties getOutputProperties ()
{
return (Properties) props.clone ();
@@ -563,7 +563,7 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
{
props.setProperty (name, value);
}
-
+
public String getOutputProperty (String name)
{
return props.getProperty (name);
@@ -573,12 +573,12 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
{
params.clear ();
}
-
+
public void setParameter (String name, Object value)
{
props.put (name, value);
}
-
+
public Object getParameter (String name)
{
return props.get (name);
@@ -589,29 +589,29 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
{
try
{
- XMLReader producer;
- InputSource input;
-
+ XMLReader producer;
+ InputSource input;
+
// Input from DOM?
if (in instanceof DOMSource)
{
- DOMSource source = (DOMSource) in;
-
+ DOMSource source = (DOMSource) in;
+
if (source.getNode () == null)
throw new IllegalArgumentException ("no DOM node");
producer = new DomParser (source.getNode ());
input = null;
-
+
// Input from SAX?
}
else if (in instanceof SAXSource)
{
- SAXSource source = (SAXSource) in;
-
+ SAXSource source = (SAXSource) in;
+
producer = source.getXMLReader ();
if (producer == null)
producer = XMLReaderFactory.createXMLReader ();
-
+
input = source.getInputSource ();
if (input == null)
{
@@ -621,7 +621,7 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
throw new IllegalArgumentException (
"missing SAX input");
}
-
+
// Input from a stream or something?
}
else
@@ -631,7 +631,7 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
if (input == null)
throw new IllegalArgumentException ("missing input");
}
-
+
// preserve original namespace prefixes
try
{
@@ -644,19 +644,19 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
/* ignore */
// FIXME if we couldn't, "NsFix" stage before the output ..
}
-
+
// arrange the output
handler.setResult (out);
EventFilter.bind (producer, handler);
-
+
// then parse ... single element pipeline
producer.parse (input);
-
+
}
catch (IOException e)
{
throw new TransformerException ("transform failed", e);
-
+
}
catch (SAXException e)
{
@@ -664,7 +664,7 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory
throw ex;
else
throw new TransformerException ("transform failed", e);
-
+
}
finally
{
diff --git a/gnu/xml/util/XCat.java b/gnu/xml/util/XCat.java
index 93127f442..ea23ad682 100644
--- a/gnu/xml/util/XCat.java
+++ b/gnu/xml/util/XCat.java
@@ -1,4 +1,4 @@
-/* XCat.java --
+/* XCat.java --
Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,15 +76,15 @@ import org.xml.sax.helpers.XMLReaderFactory;
* <p> This has three main operational modes. The primary intended mode is
* to create a resolver, then preloading it with one or more site-standard
* catalogs before using it with one or more SAX parsers: <pre>
- * XCat catalog = new XCat ();
- * catalog.setErrorHandler (diagnosticErrorHandler);
- * catalog.loadCatalog ("file:/local/catalogs/catalog.cat");
- * catalog.loadCatalog ("http://shared/catalog.cat");
- * ...
- * catalog.disableLoading ();
- * parser1.setEntityResolver (catalog);
- * parser2.setEntityResolver (catalog);
- * ...</pre>
+ * XCat catalog = new XCat ();
+ * catalog.setErrorHandler (diagnosticErrorHandler);
+ * catalog.loadCatalog ("file:/local/catalogs/catalog.cat");
+ * catalog.loadCatalog ("http://shared/catalog.cat");
+ * ...
+ * catalog.disableLoading ();
+ * parser1.setEntityResolver (catalog);
+ * parser2.setEntityResolver (catalog);
+ * ...</pre>
*
* <p>A second mode is to arrange that your application uses instances of
* this class as its entity resolver, and automatically loads catalogs
@@ -127,25 +127,25 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/
public class XCat implements EntityResolver2
{
- private Catalog catalogs [];
- private boolean usingPublic = true;
- private boolean loadingPermitted = true;
- private boolean unified = true;
- private String parserClass;
- private ErrorHandler errorHandler;
+ private Catalog catalogs [];
+ private boolean usingPublic = true;
+ private boolean loadingPermitted = true;
+ private boolean unified = true;
+ private String parserClass;
+ private ErrorHandler errorHandler;
- // private EntityResolver next; // chain to next if we fail...
+ // private EntityResolver next; // chain to next if we fail...
//
// NOTE: This is a straightforward implementation, and if
// there are lots of "nextCatalog" or "delegate*" entries
// in use, two tweaks would be worth considering:
//
- // - Centralize some sort of cache (key by URI) for individual
- // resolvers. That'd avoid multiple copies of a given catalog.
+ // - Centralize some sort of cache (key by URI) for individual
+ // resolvers. That'd avoid multiple copies of a given catalog.
//
- // - Have resolution track what catalogs (+modes) have been
- // searched. This would support loop detection.
+ // - Have resolution track what catalogs (+modes) have been
+ // searched. This would support loop detection.
//
@@ -170,7 +170,7 @@ public class XCat implements EntityResolver2
*/
public XCat (String uri)
throws SAXException, IOException
- { loadCatalog (uri); }
+ { loadCatalog (uri); }
/**
@@ -188,7 +188,7 @@ public class XCat implements EntityResolver2
*
* <p>Note that catalogs referenced by this one will not be loaded
* at this time. Catalogs referenced through <em>nextCatalog</em>
- * or <em>delegate*</em> elements are normally loaded only if needed.
+ * or <em>delegate*</em> elements are normally loaded only if needed.
*
* @see #setErrorHandler
* @see #setParserClass
@@ -197,44 +197,44 @@ public class XCat implements EntityResolver2
* @param uri absolute URI for the catalog file.
*
* @exception IOException As thrown by the parser, typically to
- * indicate problems reading data from that URI.
+ * indicate problems reading data from that URI.
* @exception SAXException As thrown by the parser, typically to
- * indicate problems parsing data from that URI. It may also
- * be thrown if the parser doesn't support necessary handlers.
+ * indicate problems parsing data from that URI. It may also
+ * be thrown if the parser doesn't support necessary handlers.
* @exception IllegalStateException When attempting to load a
- * catalog after loading has been {@link #disableLoading disabled},
- * such as after any entity or URI lookup has been performed.
+ * catalog after loading has been {@link #disableLoading disabled},
+ * such as after any entity or URI lookup has been performed.
*/
public synchronized void loadCatalog (String uri)
throws SAXException, IOException
{
- Catalog catalog;
- int index = -1;
-
- if (!loadingPermitted)
- throw new IllegalStateException ();
-
- uri = normalizeURI (uri);
- if (catalogs != null) {
- // maybe just reload
- for (index = 0; index < catalogs.length; index++)
- if (uri.equals (catalogs [index].catalogURI))
- break;
- }
- catalog = loadCatalog (parserClass, errorHandler, uri, unified);
-
- // add to list of catalogs
- if (catalogs == null) {
- index = 0;
- catalogs = new Catalog [1];
- } else if (index == catalogs.length) {
- Catalog tmp [];
-
- tmp = new Catalog [index + 1];
- System.arraycopy (catalogs, 0, tmp, 0, index);
- catalogs = tmp;
- }
- catalogs [index] = catalog;
+ Catalog catalog;
+ int index = -1;
+
+ if (!loadingPermitted)
+ throw new IllegalStateException ();
+
+ uri = normalizeURI (uri);
+ if (catalogs != null) {
+ // maybe just reload
+ for (index = 0; index < catalogs.length; index++)
+ if (uri.equals (catalogs [index].catalogURI))
+ break;
+ }
+ catalog = loadCatalog (parserClass, errorHandler, uri, unified);
+
+ // add to list of catalogs
+ if (catalogs == null) {
+ index = 0;
+ catalogs = new Catalog [1];
+ } else if (index == catalogs.length) {
+ Catalog tmp [];
+
+ tmp = new Catalog [index + 1];
+ System.arraycopy (catalogs, 0, tmp, 0, index);
+ catalogs = tmp;
+ }
+ catalogs [index] = catalog;
}
@@ -251,38 +251,38 @@ public class XCat implements EntityResolver2
* @param publicId Either a normalized public ID, or null.
* @param baseURI Absolute base URI associated with systemId.
* @param systemId URI found in entity declaration (may be
- * relative to baseURI).
+ * relative to baseURI).
*
* @return Input source for accessing the external entity, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
+ * if no mapping was found. The input source may have opened
+ * the stream, and will have a fully resolved URI.
*
* @see #getExternalSubset
*/
public InputSource resolveEntity (
- String name, // UNUSED ... systemId is always non-null
- String publicId,
- String baseURI, // UNUSED ... it just lets sysId be relative
- String systemId
+ String name, // UNUSED ... systemId is always non-null
+ String publicId,
+ String baseURI, // UNUSED ... it just lets sysId be relative
+ String systemId
) throws SAXException, IOException
{
- if (loadingPermitted)
- disableLoading ();
-
- try {
- // steps as found in OASIS XML catalog spec 7.1.2
- // steps 1, 8 involve looping over the list of catalogs
- for (int i = 0; i < catalogs.length; i++) {
- InputSource retval;
- retval = catalogs [i].resolve (usingPublic, publicId, systemId);
- if (retval != null)
- return retval;
- }
- } catch (DoneDelegation x) {
- // done!
- }
- // step 9 involves returning "no match"
- return null;
+ if (loadingPermitted)
+ disableLoading ();
+
+ try {
+ // steps as found in OASIS XML catalog spec 7.1.2
+ // steps 1, 8 involve looping over the list of catalogs
+ for (int i = 0; i < catalogs.length; i++) {
+ InputSource retval;
+ retval = catalogs [i].resolve (usingPublic, publicId, systemId);
+ if (retval != null)
+ return retval;
+ }
+ } catch (DoneDelegation x) {
+ // done!
+ }
+ // step 9 involves returning "no match"
+ return null;
}
@@ -302,28 +302,28 @@ public class XCat implements EntityResolver2
* certain well formedess errors.
*
* @param name Name of the document element, either as declared in
- * a DOCTYPE declaration or as observed in the text.
+ * a DOCTYPE declaration or as observed in the text.
* @param baseURI Document's base URI (absolute).
*
* @return Input source for accessing the external subset, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
+ * if no mapping was found. The input source may have opened
+ * the stream, and will have a fully resolved URI.
*/
public InputSource getExternalSubset (String name, String baseURI)
throws SAXException, IOException
{
- if (loadingPermitted)
- disableLoading ();
- try {
- for (int i = 0; i < catalogs.length; i++) {
- InputSource retval = catalogs [i].getExternalSubset (name);
- if (retval != null)
- return retval;
- }
- } catch (DoneDelegation x) {
- // done!
- }
- return null;
+ if (loadingPermitted)
+ disableLoading ();
+ try {
+ for (int i = 0; i < catalogs.length; i++) {
+ InputSource retval = catalogs [i].getExternalSubset (name);
+ if (retval != null)
+ return retval;
+ }
+ } catch (DoneDelegation x) {
+ // done!
+ }
+ return null;
}
@@ -335,23 +335,23 @@ public class XCat implements EntityResolver2
*
* <p>The functional limitations of this interface include:</p><ul>
*
- * <li>Since system IDs will be absolutized before the resolver
- * sees them, matching against relative URIs won't work.
- * This may affect <em>system</em>, <em>rewriteSystem</em>,
- * and <em>delegateSystem</em> catalog entries.
+ * <li>Since system IDs will be absolutized before the resolver
+ * sees them, matching against relative URIs won't work.
+ * This may affect <em>system</em>, <em>rewriteSystem</em>,
+ * and <em>delegateSystem</em> catalog entries.
*
- * <li>Because of that absolutization, documents declaring entities
- * with system IDs using URI schemes that the JVM does not recognize
- * may be unparsable. URI schemes such as <em>file:/</em>,
- * <em>http://</em>, <em>https://</em>, and <em>ftp://</em>
- * will usually work reliably.
+ * <li>Because of that absolutization, documents declaring entities
+ * with system IDs using URI schemes that the JVM does not recognize
+ * may be unparsable. URI schemes such as <em>file:/</em>,
+ * <em>http://</em>, <em>https://</em>, and <em>ftp://</em>
+ * will usually work reliably.
*
- * <li>Because missing external subsets can't be provided, the
- * <em>doctype</em> catalog entries will be ignored.
- * (The {@link #getExternalSubset getExternalSubset()} method is
- * a "New Style" resolution option.)
+ * <li>Because missing external subsets can't be provided, the
+ * <em>doctype</em> catalog entries will be ignored.
+ * (The {@link #getExternalSubset getExternalSubset()} method is
+ * a "New Style" resolution option.)
*
- * </ul>
+ * </ul>
*
* <p>Applications can tell whether this limited functionality will be
* used: if the feature flag associated with the {@link EntityResolver2}
@@ -365,13 +365,13 @@ public class XCat implements EntityResolver2
* @param systemId Always an absolute URI.
*
* @return Input source for accessing the external entity, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
+ * if no mapping was found. The input source may have opened
+ * the stream, and will have a fully resolved URI.
*/
final public InputSource resolveEntity (String publicId, String systemId)
throws SAXException, IOException
{
- return resolveEntity (null, publicId, null, systemId);
+ return resolveEntity (null, publicId, null, systemId);
}
@@ -398,40 +398,40 @@ public class XCat implements EntityResolver2
* @see #setUnified
*
* @param baseURI The relevant base URI as specified by the XML Base
- * specification. This recognizes <em>xml:base</em> attributes
- * as overriding the actual (physical) base URI.
+ * specification. This recognizes <em>xml:base</em> attributes
+ * as overriding the actual (physical) base URI.
* @param uri Either an absolute URI, or one relative to baseURI
*
* @return Input source for accessing the mapped URI, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
+ * if no mapping was found. The input source may have opened
+ * the stream, and will have a fully resolved URI.
*/
public InputSource resolveURI (String baseURI, String uri)
throws SAXException, IOException
{
- if (loadingPermitted)
- disableLoading ();
-
- // NOTE: baseURI isn't used here, but caller MUST have it,
- // and heuristics _might_ use it in the future ... plus,
- // it's symmetric with resolveEntity ().
-
- // steps 1, 6 involve looping
- try {
- for (int i = 0; i < catalogs.length; i++) {
- InputSource tmp = catalogs [i].resolveURI (uri);
- if (tmp != null)
- return tmp;
- }
- } catch (DoneDelegation x) {
- // done
- }
- // step 7 reports no match
- return null;
+ if (loadingPermitted)
+ disableLoading ();
+
+ // NOTE: baseURI isn't used here, but caller MUST have it,
+ // and heuristics _might_ use it in the future ... plus,
+ // it's symmetric with resolveEntity ().
+
+ // steps 1, 6 involve looping
+ try {
+ for (int i = 0; i < catalogs.length; i++) {
+ InputSource tmp = catalogs [i].resolveURI (uri);
+ if (tmp != null)
+ return tmp;
+ }
+ } catch (DoneDelegation x) {
+ // done
+ }
+ // step 7 reports no match
+ return null;
}
- /**
+ /**
* Records that catalog loading is no longer permitted.
* Loading is automatically disabled when lookups are performed,
* and should be manually disabled when <em>startDTD()</em> (or
@@ -440,12 +440,12 @@ public class XCat implements EntityResolver2
*/
public synchronized void disableLoading ()
{
- // NOTE: this method and loadCatalog() are synchronized
- // so that it's impossible to load (top level) catalogs
- // after lookups start. Likewise, deferred loading is also
- // synchronized (for "next" and delegated catalogs) to
- // ensure that parsers can share resolvers.
- loadingPermitted = false;
+ // NOTE: this method and loadCatalog() are synchronized
+ // so that it's impossible to load (top level) catalogs
+ // after lookups start. Likewise, deferred loading is also
+ // synchronized (for "next" and delegated catalogs) to
+ // ensure that parsers can share resolvers.
+ loadingPermitted = false;
}
@@ -457,12 +457,12 @@ public class XCat implements EntityResolver2
* @see #setErrorHandler
*/
public ErrorHandler getErrorHandler ()
- { return errorHandler; }
+ { return errorHandler; }
/**
* Assigns the error handler used to report catalog errors.
* These errors may come either from the SAX2 parser or
- * from the catalog parsing code driven by the parser.
+ * from the catalog parsing code driven by the parser.
*
* <p> If you're sharing the resolver between parsers, don't
* change this once lookups have begun.
@@ -470,10 +470,10 @@ public class XCat implements EntityResolver2
* @see #getErrorHandler
*
* @param parser The error handler, or null saying to use the default
- * (no diagnostics, and only fatal errors terminate loading).
+ * (no diagnostics, and only fatal errors terminate loading).
*/
public void setErrorHandler (ErrorHandler handler)
- { errorHandler = handler; }
+ { errorHandler = handler; }
/**
@@ -482,7 +482,7 @@ public class XCat implements EntityResolver2
* @see #setParserClass
*/
public String getParserClass ()
- { return parserClass; }
+ { return parserClass; }
/**
* Names the SAX2 parser class used to parse catalogs.
@@ -498,10 +498,10 @@ public class XCat implements EntityResolver2
* @see #getParserClass
*
* @param parser The parser class name, or null saying to use the
- * system default SAX2 parser.
+ * system default SAX2 parser.
*/
public void setParserClass (String parser)
- { parserClass = parser; }
+ { parserClass = parser; }
/**
@@ -527,7 +527,7 @@ public class XCat implements EntityResolver2
* @see #setUnified
*/
public boolean isUnified ()
- { return unified; }
+ { return unified; }
/**
* Assigns the value of the flag returned by {@link #isUnified}.
@@ -540,7 +540,7 @@ public class XCat implements EntityResolver2
* @param value new flag setting
*/
public void setUnified (boolean value)
- { unified = value; }
+ { unified = value; }
/**
@@ -556,7 +556,7 @@ public class XCat implements EntityResolver2
* @see #setUsingPublic
*/
public boolean isUsingPublic ()
- { return usingPublic; }
+ { return usingPublic; }
/**
* Specifies which catalog search mode is used.
@@ -572,150 +572,150 @@ public class XCat implements EntityResolver2
* @see #isUsingPublic
*
* @param value true to always use public identifier mappings,
- * false to only use them for system ids using the <em>urn:publicid:</em>
- * URI scheme.
+ * false to only use them for system ids using the <em>urn:publicid:</em>
+ * URI scheme.
*/
public void setUsingPublic (boolean value)
- { usingPublic = value; }
+ { usingPublic = value; }
// hmm, what's this do? :)
private static Catalog loadCatalog (
- String parserClass,
- ErrorHandler eh,
- String uri,
- boolean unified
+ String parserClass,
+ ErrorHandler eh,
+ String uri,
+ boolean unified
) throws SAXException, IOException
{
- XMLReader parser;
- Loader loader;
- boolean doesIntern = false;
-
- if (parserClass == null)
- parser = XMLReaderFactory.createXMLReader ();
- else
- parser = XMLReaderFactory.createXMLReader (parserClass);
- if (eh != null)
- parser.setErrorHandler (eh);
- // resolve-dtd-entities is at default value (unrecognized == true)
-
- try {
- doesIntern = parser.getFeature (
- "http://xml.org/sax/features/string-interning");
- } catch (SAXNotRecognizedException e) { }
-
- loader = new Loader (doesIntern, eh, unified);
- loader.cat.parserClass = parserClass;
- loader.cat.catalogURI = uri;
-
- parser.setContentHandler (loader);
- parser.setProperty (
- "http://xml.org/sax/properties/declaration-handler",
- loader);
- parser.setProperty (
- "http://xml.org/sax/properties/lexical-handler",
- loader);
- parser.parse (uri);
-
- return loader.cat;
+ XMLReader parser;
+ Loader loader;
+ boolean doesIntern = false;
+
+ if (parserClass == null)
+ parser = XMLReaderFactory.createXMLReader ();
+ else
+ parser = XMLReaderFactory.createXMLReader (parserClass);
+ if (eh != null)
+ parser.setErrorHandler (eh);
+ // resolve-dtd-entities is at default value (unrecognized == true)
+
+ try {
+ doesIntern = parser.getFeature (
+ "http://xml.org/sax/features/string-interning");
+ } catch (SAXNotRecognizedException e) { }
+
+ loader = new Loader (doesIntern, eh, unified);
+ loader.cat.parserClass = parserClass;
+ loader.cat.catalogURI = uri;
+
+ parser.setContentHandler (loader);
+ parser.setProperty (
+ "http://xml.org/sax/properties/declaration-handler",
+ loader);
+ parser.setProperty (
+ "http://xml.org/sax/properties/lexical-handler",
+ loader);
+ parser.parse (uri);
+
+ return loader.cat;
}
// perform one or both the normalizations for public ids
private static String normalizePublicId (boolean full, String publicId)
{
- if (publicId.startsWith ("urn:publicid:")) {
- CPStringBuilder buf = new CPStringBuilder ();
- char chars [] = publicId.toCharArray ();
+ if (publicId.startsWith ("urn:publicid:")) {
+ CPStringBuilder buf = new CPStringBuilder ();
+ char chars [] = publicId.toCharArray ();
boolean hasbug = false;
- for (int i = 13; i < chars.length; i++) {
- switch (chars [i]) {
- case '+': buf.append (' '); continue;
- case ':': buf.append ("//"); continue;
- case ';': buf.append ("::"); continue;
- case '%':
+ for (int i = 13; i < chars.length; i++) {
+ switch (chars [i]) {
+ case '+': buf.append (' '); continue;
+ case ':': buf.append ("//"); continue;
+ case ';': buf.append ("::"); continue;
+ case '%':
// FIXME unhex that char! meanwhile, warn and fallthrough ...
- hasbug = true;
- default: buf.append (chars [i]); continue;
- }
- }
- publicId = buf.toString ();
+ hasbug = true;
+ default: buf.append (chars [i]); continue;
+ }
+ }
+ publicId = buf.toString ();
if (hasbug)
System.err.println ("nyet unhexing public id: " + publicId);
- full = true;
- }
-
- // SAX parsers do everything except that URN mapping, but
- // we can't trust other sources to normalize correctly
- if (full) {
- StringTokenizer tokens;
- String token;
-
- tokens = new StringTokenizer (publicId, " \r\n");
- publicId = null;
- while (tokens.hasMoreTokens ()) {
- if (publicId == null)
- publicId = tokens.nextToken ();
- else
- publicId += " " + tokens.nextToken ();
- }
- }
- return publicId;
+ full = true;
+ }
+
+ // SAX parsers do everything except that URN mapping, but
+ // we can't trust other sources to normalize correctly
+ if (full) {
+ StringTokenizer tokens;
+ String token;
+
+ tokens = new StringTokenizer (publicId, " \r\n");
+ publicId = null;
+ while (tokens.hasMoreTokens ()) {
+ if (publicId == null)
+ publicId = tokens.nextToken ();
+ else
+ publicId += " " + tokens.nextToken ();
+ }
+ }
+ return publicId;
}
private static boolean isUriExcluded (int c)
- { return c <= 0x20 || c >= 0x7f || "\"<>^`{|}".indexOf (c) != -1; }
+ { return c <= 0x20 || c >= 0x7f || "\"<>^`{|}".indexOf (c) != -1; }
private static int hexNibble (int c)
{
- if (c < 10)
- return c + '0';
- return ('a' - 10) + c;
+ if (c < 10)
+ return c + '0';
+ return ('a' - 10) + c;
}
// handles URIs with "excluded" characters
private static String normalizeURI (String systemId)
{
- int length = systemId.length ();
-
- for (int i = 0; i < length; i++) {
- char c = systemId.charAt (i);
-
- // escape non-ASCII plus "excluded" characters
- if (isUriExcluded (c)) {
- byte buf [];
- ByteArrayOutputStream out;
- int b;
-
- // a JVM that doesn't know UTF8 and 8859_1 is unusable!
- try {
- buf = systemId.getBytes ("UTF8");
- out = new ByteArrayOutputStream (buf.length + 10);
-
- for (i = 0; i < buf.length; i++) {
- b = buf [i] & 0x0ff;
- if (isUriExcluded (b)) {
- out.write ((int) '%');
- out.write (hexNibble (b >> 4));
- out.write (hexNibble (b & 0x0f));
- } else
- out.write (b);
- }
- return out.toString ("8859_1");
- } catch (IOException e) {
- throw new RuntimeException (
- "can't normalize URI: " + e.getMessage ());
- }
- }
- }
- return systemId;
+ int length = systemId.length ();
+
+ for (int i = 0; i < length; i++) {
+ char c = systemId.charAt (i);
+
+ // escape non-ASCII plus "excluded" characters
+ if (isUriExcluded (c)) {
+ byte buf [];
+ ByteArrayOutputStream out;
+ int b;
+
+ // a JVM that doesn't know UTF8 and 8859_1 is unusable!
+ try {
+ buf = systemId.getBytes ("UTF8");
+ out = new ByteArrayOutputStream (buf.length + 10);
+
+ for (i = 0; i < buf.length; i++) {
+ b = buf [i] & 0x0ff;
+ if (isUriExcluded (b)) {
+ out.write ((int) '%');
+ out.write (hexNibble (b >> 4));
+ out.write (hexNibble (b & 0x0f));
+ } else
+ out.write (b);
+ }
+ return out.toString ("8859_1");
+ } catch (IOException e) {
+ throw new RuntimeException (
+ "can't normalize URI: " + e.getMessage ());
+ }
+ }
+ }
+ return systemId;
}
// thrown to mark authoritative end of a search
private static class DoneDelegation extends SAXException
{
- DoneDelegation () { }
+ DoneDelegation () { }
}
@@ -725,359 +725,359 @@ System.err.println ("nyet unhexing public id: " + publicId);
*/
private static class Catalog
{
- // loading infrastructure
- String catalogURI;
- ErrorHandler eh;
- boolean unified;
- String parserClass;
-
- // catalog data
- boolean hasPreference;
- boolean usingPublic;
-
- Hashtable publicIds;
- Hashtable publicDelegations;
-
- Hashtable systemIds;
- Hashtable systemRewrites;
- Hashtable systemDelegations;
-
- Hashtable uris;
- Hashtable uriRewrites;
- Hashtable uriDelegations;
-
- Hashtable doctypes;
-
- Vector next;
-
- // nonpublic!
- Catalog () { }
-
-
- // steps as found in OASIS XML catalog spec 7.1.2
- private InputSource locatePublicId (String publicId)
- throws SAXException, IOException
- {
- // 5. return (first) 'public' entry
- if (publicIds != null) {
- String retval = (String) publicIds.get (publicId);
- if (retval != null) {
- // IF the URI is accessible ...
- return new InputSource (retval);
- }
- }
-
- // 6. return delegatePublic catalog match [complex]
- if (publicDelegations != null)
- return checkDelegations (publicDelegations, publicId,
- publicId, null);
-
- return null;
- }
-
- // steps as found in OASIS XML catalog spec 7.1.2 or 7.2.2
- private InputSource mapURI (
- String uri,
- Hashtable ids,
- Hashtable rewrites,
- Hashtable delegations
- ) throws SAXException, IOException
- {
- // 7.1.2: 2. return (first) 'system' entry
- // 7.2.2: 2. return (first) 'uri' entry
- if (ids != null) {
- String retval = (String) ids.get (uri);
- if (retval != null) {
- // IF the URI is accessible ...
- return new InputSource (retval);
- }
- }
-
- // 7.1.2: 3. return 'rewriteSystem' entries
- // 7.2.2: 3. return 'rewriteURI' entries
- if (rewrites != null) {
- String prefix = null;
- String replace = null;
- int prefixLen = -1;
-
- for (Enumeration e = rewrites.keys ();
- e.hasMoreElements ();
- /* NOP */) {
- String temp = (String) e.nextElement ();
- int len = -1;
-
- if (!uri.startsWith (temp))
- continue;
- if (prefix != null
- && (len = temp.length ()) < prefixLen)
- continue;
- prefix = temp;
- prefixLen = len;
- replace = (String) rewrites.get (temp);
- }
- if (prefix != null) {
- CPStringBuilder buf = new CPStringBuilder (replace);
- buf.append (uri.substring (prefixLen));
- // IF the URI is accessible ...
- return new InputSource (buf.toString ());
- }
- }
-
- // 7.1.2: 4. return 'delegateSystem' catalog match [complex]
- // 7.2.2: 4. return 'delegateURI' catalog match [complex]
- if (delegations != null)
- return checkDelegations (delegations, uri, null, uri);
-
- return null;
- }
-
-
- /**
- * Returns a URI for an external entity.
- */
- public InputSource resolve (
- boolean usingPublic,
- String publicId,
- String systemId
- ) throws SAXException, IOException
- {
- boolean preferSystem;
- InputSource retval;
-
- if (hasPreference)
- preferSystem = !this.usingPublic;
- else
- preferSystem = !usingPublic;
-
- if (publicId != null)
- publicId = normalizePublicId (false, publicId);
-
- // behavior here matches section 7.1.1 of the oasis spec
- if (systemId != null) {
- if (systemId.startsWith ("urn:publicid:")) {
- String temp = normalizePublicId (true, systemId);
- if (publicId == null) {
- publicId = temp;
- systemId = null;
- } else if (!publicId.equals (temp)) {
- // error; ok to recover by:
- systemId = null;
- }
- } else
- systemId = normalizeURI (systemId);
- }
-
- if (systemId == null && publicId == null)
- return null;
-
- if (systemId != null) {
- retval = mapURI (systemId, systemIds, systemRewrites,
- systemDelegations);
- if (retval != null) {
- retval.setPublicId (publicId);
- return retval;
- }
- }
-
- if (publicId != null
- && !(systemId != null && preferSystem)) {
- retval = locatePublicId (publicId);
- if (retval != null) {
- retval.setPublicId (publicId);
- return retval;
- }
- }
-
- // 7. apply nextCatalog entries
- if (next != null) {
- int length = next.size ();
- for (int i = 0; i < length; i++) {
- Catalog n = getNext (i);
- retval = n.resolve (usingPublic, publicId, systemId);
- if (retval != null)
- return retval;
- }
- }
-
- return null;
- }
-
- /**
- * Maps one URI into another, for resources that are not defined
- * using XML external entity or notation syntax.
- */
- public InputSource resolveURI (String uri)
- throws SAXException, IOException
- {
- if (uri.startsWith ("urn:publicid:"))
- return resolve (true, normalizePublicId (true, uri), null);
-
- InputSource retval;
-
- uri = normalizeURI (uri);
-
- // 7.2.2 steps 2-4
- retval = mapURI (uri, uris, uriRewrites, uriDelegations);
- if (retval != null)
- return retval;
-
- // 7.2.2 step 5. apply nextCatalog entries
- if (next != null) {
- int length = next.size ();
- for (int i = 0; i < length; i++) {
- Catalog n = getNext (i);
- retval = n.resolveURI (uri);
- if (retval != null)
- return retval;
- }
- }
-
- return null;
- }
-
-
- /**
- * Finds the external subset associated with a given root element.
- */
- public InputSource getExternalSubset (String name)
- throws SAXException, IOException
- {
- if (doctypes != null) {
- String value = (String) doctypes.get (name);
- if (value != null) {
- // IF the URI is accessible ...
- return new InputSource (value);
- }
- }
- if (next != null) {
- int length = next.size ();
- for (int i = 0; i < length; i++) {
- Catalog n = getNext (i);
- if (n == null)
- continue;
- InputSource retval = n.getExternalSubset (name);
- if (retval != null)
- return retval;
- }
- }
- return null;
- }
-
- private synchronized Catalog getNext (int i)
- throws SAXException, IOException
- {
- Object obj;
-
- if (next == null || i < 0 || i >= next.size ())
- return null;
- obj = next.elementAt (i);
- if (obj instanceof Catalog)
- return (Catalog) obj;
-
- // ok, we deferred reading that catalog till now.
- // load and cache it.
- Catalog cat = null;
-
- try {
- cat = loadCatalog (parserClass, eh, (String) obj, unified);
- next.setElementAt (cat, i);
- } catch (SAXException e) {
- // must fail quietly, says the OASIS spec
- } catch (IOException e) {
- // same applies here
- }
- return cat;
- }
-
- private InputSource checkDelegations (
- Hashtable delegations,
- String id,
- String publicId, // only one of public/system
- String systemId // will be non-null...
- ) throws SAXException, IOException
- {
- Vector matches = null;
- int length = 0;
-
- // first, see if any prefixes match.
- for (Enumeration e = delegations.keys ();
- e.hasMoreElements ();
- /* NOP */) {
- String prefix = (String) e.nextElement ();
-
- if (!id.startsWith (prefix))
- continue;
- if (matches == null)
- matches = new Vector ();
-
- // maintain in longer->shorter sorted order
- // NOTE: assumes not many matches will fire!
- int index;
-
- for (index = 0; index < length; index++) {
- String temp = (String) matches.elementAt (index);
- if (prefix.length () > temp.length ()) {
- matches.insertElementAt (prefix, index);
- break;
- }
- }
- if (index == length)
- matches.addElement (prefix);
- length++;
- }
- if (matches == null)
- return null;
-
- // now we know the list of catalogs to replace our "top level"
- // list ... we use it here, rather than somehow going back and
- // restarting, since this helps avoid reading most catalogs.
- // this assumes stackspace won't be a problem.
- for (int i = 0; i < length; i++) {
- Catalog catalog = null;
- InputSource result;
-
- // get this catalog. we may not have read it yet.
- synchronized (delegations) {
- Object prefix = matches.elementAt (i);
- Object cat = delegations.get (prefix);
-
- if (cat instanceof Catalog)
- catalog = (Catalog) cat;
- else {
- try {
- // load and cache that catalog
- catalog = loadCatalog (parserClass, eh,
- (String) cat, unified);
- delegations.put (prefix, catalog);
- } catch (SAXException e) {
- // must ignore, says the OASIS spec
- } catch (IOException e) {
- // same applies here
- }
- }
- }
-
- // ignore failed loads, and proceed
- if (catalog == null)
- continue;
-
- // we have a catalog ... resolve!
- // usingPublic value can't matter, there's no choice
- result = catalog.resolve (true, publicId, systemId);
- if (result != null)
- return result;
- }
-
- // if there were no successes, the entire
- // lookup failed (all the way to top level)
- throw new DoneDelegation ();
- }
+ // loading infrastructure
+ String catalogURI;
+ ErrorHandler eh;
+ boolean unified;
+ String parserClass;
+
+ // catalog data
+ boolean hasPreference;
+ boolean usingPublic;
+
+ Hashtable publicIds;
+ Hashtable publicDelegations;
+
+ Hashtable systemIds;
+ Hashtable systemRewrites;
+ Hashtable systemDelegations;
+
+ Hashtable uris;
+ Hashtable uriRewrites;
+ Hashtable uriDelegations;
+
+ Hashtable doctypes;
+
+ Vector next;
+
+ // nonpublic!
+ Catalog () { }
+
+
+ // steps as found in OASIS XML catalog spec 7.1.2
+ private InputSource locatePublicId (String publicId)
+ throws SAXException, IOException
+ {
+ // 5. return (first) 'public' entry
+ if (publicIds != null) {
+ String retval = (String) publicIds.get (publicId);
+ if (retval != null) {
+ // IF the URI is accessible ...
+ return new InputSource (retval);
+ }
+ }
+
+ // 6. return delegatePublic catalog match [complex]
+ if (publicDelegations != null)
+ return checkDelegations (publicDelegations, publicId,
+ publicId, null);
+
+ return null;
+ }
+
+ // steps as found in OASIS XML catalog spec 7.1.2 or 7.2.2
+ private InputSource mapURI (
+ String uri,
+ Hashtable ids,
+ Hashtable rewrites,
+ Hashtable delegations
+ ) throws SAXException, IOException
+ {
+ // 7.1.2: 2. return (first) 'system' entry
+ // 7.2.2: 2. return (first) 'uri' entry
+ if (ids != null) {
+ String retval = (String) ids.get (uri);
+ if (retval != null) {
+ // IF the URI is accessible ...
+ return new InputSource (retval);
+ }
+ }
+
+ // 7.1.2: 3. return 'rewriteSystem' entries
+ // 7.2.2: 3. return 'rewriteURI' entries
+ if (rewrites != null) {
+ String prefix = null;
+ String replace = null;
+ int prefixLen = -1;
+
+ for (Enumeration e = rewrites.keys ();
+ e.hasMoreElements ();
+ /* NOP */) {
+ String temp = (String) e.nextElement ();
+ int len = -1;
+
+ if (!uri.startsWith (temp))
+ continue;
+ if (prefix != null
+ && (len = temp.length ()) < prefixLen)
+ continue;
+ prefix = temp;
+ prefixLen = len;
+ replace = (String) rewrites.get (temp);
+ }
+ if (prefix != null) {
+ CPStringBuilder buf = new CPStringBuilder (replace);
+ buf.append (uri.substring (prefixLen));
+ // IF the URI is accessible ...
+ return new InputSource (buf.toString ());
+ }
+ }
+
+ // 7.1.2: 4. return 'delegateSystem' catalog match [complex]
+ // 7.2.2: 4. return 'delegateURI' catalog match [complex]
+ if (delegations != null)
+ return checkDelegations (delegations, uri, null, uri);
+
+ return null;
+ }
+
+
+ /**
+ * Returns a URI for an external entity.
+ */
+ public InputSource resolve (
+ boolean usingPublic,
+ String publicId,
+ String systemId
+ ) throws SAXException, IOException
+ {
+ boolean preferSystem;
+ InputSource retval;
+
+ if (hasPreference)
+ preferSystem = !this.usingPublic;
+ else
+ preferSystem = !usingPublic;
+
+ if (publicId != null)
+ publicId = normalizePublicId (false, publicId);
+
+ // behavior here matches section 7.1.1 of the oasis spec
+ if (systemId != null) {
+ if (systemId.startsWith ("urn:publicid:")) {
+ String temp = normalizePublicId (true, systemId);
+ if (publicId == null) {
+ publicId = temp;
+ systemId = null;
+ } else if (!publicId.equals (temp)) {
+ // error; ok to recover by:
+ systemId = null;
+ }
+ } else
+ systemId = normalizeURI (systemId);
+ }
+
+ if (systemId == null && publicId == null)
+ return null;
+
+ if (systemId != null) {
+ retval = mapURI (systemId, systemIds, systemRewrites,
+ systemDelegations);
+ if (retval != null) {
+ retval.setPublicId (publicId);
+ return retval;
+ }
+ }
+
+ if (publicId != null
+ && !(systemId != null && preferSystem)) {
+ retval = locatePublicId (publicId);
+ if (retval != null) {
+ retval.setPublicId (publicId);
+ return retval;
+ }
+ }
+
+ // 7. apply nextCatalog entries
+ if (next != null) {
+ int length = next.size ();
+ for (int i = 0; i < length; i++) {
+ Catalog n = getNext (i);
+ retval = n.resolve (usingPublic, publicId, systemId);
+ if (retval != null)
+ return retval;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Maps one URI into another, for resources that are not defined
+ * using XML external entity or notation syntax.
+ */
+ public InputSource resolveURI (String uri)
+ throws SAXException, IOException
+ {
+ if (uri.startsWith ("urn:publicid:"))
+ return resolve (true, normalizePublicId (true, uri), null);
+
+ InputSource retval;
+
+ uri = normalizeURI (uri);
+
+ // 7.2.2 steps 2-4
+ retval = mapURI (uri, uris, uriRewrites, uriDelegations);
+ if (retval != null)
+ return retval;
+
+ // 7.2.2 step 5. apply nextCatalog entries
+ if (next != null) {
+ int length = next.size ();
+ for (int i = 0; i < length; i++) {
+ Catalog n = getNext (i);
+ retval = n.resolveURI (uri);
+ if (retval != null)
+ return retval;
+ }
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Finds the external subset associated with a given root element.
+ */
+ public InputSource getExternalSubset (String name)
+ throws SAXException, IOException
+ {
+ if (doctypes != null) {
+ String value = (String) doctypes.get (name);
+ if (value != null) {
+ // IF the URI is accessible ...
+ return new InputSource (value);
+ }
+ }
+ if (next != null) {
+ int length = next.size ();
+ for (int i = 0; i < length; i++) {
+ Catalog n = getNext (i);
+ if (n == null)
+ continue;
+ InputSource retval = n.getExternalSubset (name);
+ if (retval != null)
+ return retval;
+ }
+ }
+ return null;
+ }
+
+ private synchronized Catalog getNext (int i)
+ throws SAXException, IOException
+ {
+ Object obj;
+
+ if (next == null || i < 0 || i >= next.size ())
+ return null;
+ obj = next.elementAt (i);
+ if (obj instanceof Catalog)
+ return (Catalog) obj;
+
+ // ok, we deferred reading that catalog till now.
+ // load and cache it.
+ Catalog cat = null;
+
+ try {
+ cat = loadCatalog (parserClass, eh, (String) obj, unified);
+ next.setElementAt (cat, i);
+ } catch (SAXException e) {
+ // must fail quietly, says the OASIS spec
+ } catch (IOException e) {
+ // same applies here
+ }
+ return cat;
+ }
+
+ private InputSource checkDelegations (
+ Hashtable delegations,
+ String id,
+ String publicId, // only one of public/system
+ String systemId // will be non-null...
+ ) throws SAXException, IOException
+ {
+ Vector matches = null;
+ int length = 0;
+
+ // first, see if any prefixes match.
+ for (Enumeration e = delegations.keys ();
+ e.hasMoreElements ();
+ /* NOP */) {
+ String prefix = (String) e.nextElement ();
+
+ if (!id.startsWith (prefix))
+ continue;
+ if (matches == null)
+ matches = new Vector ();
+
+ // maintain in longer->shorter sorted order
+ // NOTE: assumes not many matches will fire!
+ int index;
+
+ for (index = 0; index < length; index++) {
+ String temp = (String) matches.elementAt (index);
+ if (prefix.length () > temp.length ()) {
+ matches.insertElementAt (prefix, index);
+ break;
+ }
+ }
+ if (index == length)
+ matches.addElement (prefix);
+ length++;
+ }
+ if (matches == null)
+ return null;
+
+ // now we know the list of catalogs to replace our "top level"
+ // list ... we use it here, rather than somehow going back and
+ // restarting, since this helps avoid reading most catalogs.
+ // this assumes stackspace won't be a problem.
+ for (int i = 0; i < length; i++) {
+ Catalog catalog = null;
+ InputSource result;
+
+ // get this catalog. we may not have read it yet.
+ synchronized (delegations) {
+ Object prefix = matches.elementAt (i);
+ Object cat = delegations.get (prefix);
+
+ if (cat instanceof Catalog)
+ catalog = (Catalog) cat;
+ else {
+ try {
+ // load and cache that catalog
+ catalog = loadCatalog (parserClass, eh,
+ (String) cat, unified);
+ delegations.put (prefix, catalog);
+ } catch (SAXException e) {
+ // must ignore, says the OASIS spec
+ } catch (IOException e) {
+ // same applies here
+ }
+ }
+ }
+
+ // ignore failed loads, and proceed
+ if (catalog == null)
+ continue;
+
+ // we have a catalog ... resolve!
+ // usingPublic value can't matter, there's no choice
+ result = catalog.resolve (true, publicId, systemId);
+ if (result != null)
+ return result;
+ }
+
+ // if there were no successes, the entire
+ // lookup failed (all the way to top level)
+ throw new DoneDelegation ();
+ }
}
/** This is the namespace URI used for OASIS XML Catalogs. */
- private static final String catalogNamespace =
- "urn:oasis:names:tc:entity:xmlns:xml:catalog";
+ private static final String catalogNamespace =
+ "urn:oasis:names:tc:entity:xmlns:xml:catalog";
/**
@@ -1085,527 +1085,527 @@ System.err.println ("nyet unhexing public id: " + publicId);
*/
private static class Loader extends DefaultHandler2
{
- private boolean preInterned;
- private ErrorHandler handler;
- private boolean unified;
- private int ignoreDepth;
- private Locator locator;
- private boolean started;
- private Hashtable externals;
- private Stack bases;
-
- Catalog cat = new Catalog ();
-
-
- /**
- * Constructor.
- * @param flag true iff the parser already interns strings.
- * @param eh Errors and warnings are delegated to this.
- * @param unified true keeps one table for URI mappings;
- * false matches OASIS spec, storing mappings
- * for URIs and SYSTEM ids in parallel tables.
- */
- Loader (boolean flag, ErrorHandler eh, boolean unified)
- {
- preInterned = flag;
- handler = eh;
- this.unified = unified;
- cat.unified = unified;
- cat.eh = eh;
- }
-
-
- // strips out fragments
- private String nofrag (String uri)
- throws SAXException
- {
- if (uri.indexOf ('#') != -1) {
- warn ("URI with fragment: " + uri);
- uri = uri.substring (0, uri.indexOf ('#'));
- }
- return uri;
- }
-
- // absolutizes relative URIs
- private String absolutize (String uri)
- throws SAXException
- {
- // avoid creating URLs if they're already absolutized,
- // or if the URI is already using a known scheme
- if (uri.startsWith ("file:/")
- || uri.startsWith ("http:/")
- || uri.startsWith ("https:/")
- || uri.startsWith ("ftp:/")
- || uri.startsWith ("urn:")
- )
- return uri;
-
- // otherwise, let's hope the JDK handles this URI scheme.
- try {
- URL base = (URL) bases.peek ();
- return new URL (base, uri).toString ();
- } catch (Exception e) {
- fatal ("can't absolutize URI: " + uri);
- return null;
- }
- }
-
- // recoverable error
- private void error (String message)
- throws SAXException
- {
- if (handler == null)
- return;
- handler.error (new SAXParseException (message, locator));
- }
-
- // nonrecoverable error
- private void fatal (String message)
- throws SAXException
- {
- SAXParseException spe;
-
- spe = new SAXParseException (message, locator);
- if (handler != null)
- handler.fatalError (spe);
- throw spe;
- }
-
- // low severity problem
- private void warn (String message)
- throws SAXException
- {
- if (handler == null)
- return;
- handler.warning (new SAXParseException (message, locator));
- }
-
- // callbacks:
-
- public void setDocumentLocator (Locator l)
- { locator = l; }
-
- public void startDocument ()
- throws SAXException
- {
- if (locator == null)
- error ("no locator!");
- bases = new Stack ();
- String uri = locator.getSystemId ();
- try {
- bases.push (new URL (uri));
- } catch (IOException e) {
- fatal ("bad document base URI: " + uri);
- }
- }
-
- public void endDocument ()
- throws SAXException
- {
- try {
- if (!started)
- error ("not a catalog!");
- } finally {
- locator = null;
- handler = null;
- externals = null;
- bases = null;
- }
- }
-
- // XML Base support for external entities.
-
- // NOTE: expects parser is in default "resolve-dtd-uris" mode.
- public void externalEntityDecl (String name, String pub, String sys)
- throws SAXException
- {
- if (externals == null)
- externals = new Hashtable ();
- if (externals.get (name) == null)
- externals.put (name, pub);
- }
-
- public void startEntity (String name)
- throws SAXException
- {
- if (externals == null)
- return;
- String uri = (String) externals.get (name);
-
- // NOTE: breaks if an EntityResolver substitutes these URIs.
- // If toplevel loader supports one, must intercept calls...
- if (uri != null) {
- try {
- bases.push (new URL (uri));
- } catch (IOException e) {
- fatal ("entity '" + name + "', bad URI: " + uri);
- }
- }
- }
-
- public void endEntity (String name)
- {
- if (externals == null)
- return;
- String value = (String) externals.get (name);
-
- if (value != null)
- bases.pop ();
- }
-
- /**
- * Processes catalog elements, saving their data.
- */
- public void startElement (String namespace, String local,
- String qName, Attributes atts)
- throws SAXException
- {
- // must ignore non-catalog elements, and their contents
- if (ignoreDepth != 0 || !catalogNamespace.equals (namespace)) {
- ignoreDepth++;
- return;
- }
-
- // basic sanity checks
- if (!preInterned)
- local = local.intern ();
- if (!started) {
- started = true;
- if ("catalog" != local)
- fatal ("root element not 'catalog': " + local);
- }
-
- // Handle any xml:base attribute
- String xmlbase = atts.getValue ("xml:base");
-
- if (xmlbase != null) {
- URL base = (URL) bases.peek ();
- try {
- base = new URL (base, xmlbase);
- } catch (IOException e) {
- fatal ("can't resolve xml:base attribute: " + xmlbase);
- }
- bases.push (base);
- } else
- bases.push (bases.peek ());
-
- // fetch multi-element attributes, apply standard tweaks
- // values (uri, catalog, rewritePrefix) get normalized too,
- // as a precaution and since we may compare the values
- String catalog = atts.getValue ("catalog");
- if (catalog != null)
- catalog = normalizeURI (absolutize (catalog));
-
- String rewritePrefix = atts.getValue ("rewritePrefix");
- if (rewritePrefix != null)
- rewritePrefix = normalizeURI (absolutize (rewritePrefix));
-
- String systemIdStartString;
- systemIdStartString = atts.getValue ("systemIdStartString");
- if (systemIdStartString != null) {
- systemIdStartString = normalizeURI (systemIdStartString);
- // unmatchable <rewriteSystemId>, <delegateSystemId> elements
- if (systemIdStartString.startsWith ("urn:publicid:")) {
- error ("systemIdStartString is really a publicId!!");
- return;
- }
- }
-
- String uri = atts.getValue ("uri");
- if (uri != null)
- uri = normalizeURI (absolutize (uri));
-
- String uriStartString;
- uriStartString = atts.getValue ("uriStartString");
- if (uriStartString != null) {
- uriStartString = normalizeURI (uriStartString);
- // unmatchable <rewriteURI>, <delegateURI> elements
- if (uriStartString.startsWith ("urn:publicid:")) {
- error ("uriStartString is really a publicId!!");
- return;
- }
- }
-
- // strictly speaking "group" and "catalog" shouldn't nest
- // ... arbitrary restriction, no evident motivation
+ private boolean preInterned;
+ private ErrorHandler handler;
+ private boolean unified;
+ private int ignoreDepth;
+ private Locator locator;
+ private boolean started;
+ private Hashtable externals;
+ private Stack bases;
+
+ Catalog cat = new Catalog ();
+
+
+ /**
+ * Constructor.
+ * @param flag true iff the parser already interns strings.
+ * @param eh Errors and warnings are delegated to this.
+ * @param unified true keeps one table for URI mappings;
+ * false matches OASIS spec, storing mappings
+ * for URIs and SYSTEM ids in parallel tables.
+ */
+ Loader (boolean flag, ErrorHandler eh, boolean unified)
+ {
+ preInterned = flag;
+ handler = eh;
+ this.unified = unified;
+ cat.unified = unified;
+ cat.eh = eh;
+ }
+
+
+ // strips out fragments
+ private String nofrag (String uri)
+ throws SAXException
+ {
+ if (uri.indexOf ('#') != -1) {
+ warn ("URI with fragment: " + uri);
+ uri = uri.substring (0, uri.indexOf ('#'));
+ }
+ return uri;
+ }
+
+ // absolutizes relative URIs
+ private String absolutize (String uri)
+ throws SAXException
+ {
+ // avoid creating URLs if they're already absolutized,
+ // or if the URI is already using a known scheme
+ if (uri.startsWith ("file:/")
+ || uri.startsWith ("http:/")
+ || uri.startsWith ("https:/")
+ || uri.startsWith ("ftp:/")
+ || uri.startsWith ("urn:")
+ )
+ return uri;
+
+ // otherwise, let's hope the JDK handles this URI scheme.
+ try {
+ URL base = (URL) bases.peek ();
+ return new URL (base, uri).toString ();
+ } catch (Exception e) {
+ fatal ("can't absolutize URI: " + uri);
+ return null;
+ }
+ }
+
+ // recoverable error
+ private void error (String message)
+ throws SAXException
+ {
+ if (handler == null)
+ return;
+ handler.error (new SAXParseException (message, locator));
+ }
+
+ // nonrecoverable error
+ private void fatal (String message)
+ throws SAXException
+ {
+ SAXParseException spe;
+
+ spe = new SAXParseException (message, locator);
+ if (handler != null)
+ handler.fatalError (spe);
+ throw spe;
+ }
+
+ // low severity problem
+ private void warn (String message)
+ throws SAXException
+ {
+ if (handler == null)
+ return;
+ handler.warning (new SAXParseException (message, locator));
+ }
+
+ // callbacks:
+
+ public void setDocumentLocator (Locator l)
+ { locator = l; }
+
+ public void startDocument ()
+ throws SAXException
+ {
+ if (locator == null)
+ error ("no locator!");
+ bases = new Stack ();
+ String uri = locator.getSystemId ();
+ try {
+ bases.push (new URL (uri));
+ } catch (IOException e) {
+ fatal ("bad document base URI: " + uri);
+ }
+ }
+
+ public void endDocument ()
+ throws SAXException
+ {
+ try {
+ if (!started)
+ error ("not a catalog!");
+ } finally {
+ locator = null;
+ handler = null;
+ externals = null;
+ bases = null;
+ }
+ }
+
+ // XML Base support for external entities.
+
+ // NOTE: expects parser is in default "resolve-dtd-uris" mode.
+ public void externalEntityDecl (String name, String pub, String sys)
+ throws SAXException
+ {
+ if (externals == null)
+ externals = new Hashtable ();
+ if (externals.get (name) == null)
+ externals.put (name, pub);
+ }
+
+ public void startEntity (String name)
+ throws SAXException
+ {
+ if (externals == null)
+ return;
+ String uri = (String) externals.get (name);
+
+ // NOTE: breaks if an EntityResolver substitutes these URIs.
+ // If toplevel loader supports one, must intercept calls...
+ if (uri != null) {
+ try {
+ bases.push (new URL (uri));
+ } catch (IOException e) {
+ fatal ("entity '" + name + "', bad URI: " + uri);
+ }
+ }
+ }
+
+ public void endEntity (String name)
+ {
+ if (externals == null)
+ return;
+ String value = (String) externals.get (name);
+
+ if (value != null)
+ bases.pop ();
+ }
+
+ /**
+ * Processes catalog elements, saving their data.
+ */
+ public void startElement (String namespace, String local,
+ String qName, Attributes atts)
+ throws SAXException
+ {
+ // must ignore non-catalog elements, and their contents
+ if (ignoreDepth != 0 || !catalogNamespace.equals (namespace)) {
+ ignoreDepth++;
+ return;
+ }
+
+ // basic sanity checks
+ if (!preInterned)
+ local = local.intern ();
+ if (!started) {
+ started = true;
+ if ("catalog" != local)
+ fatal ("root element not 'catalog': " + local);
+ }
+
+ // Handle any xml:base attribute
+ String xmlbase = atts.getValue ("xml:base");
+
+ if (xmlbase != null) {
+ URL base = (URL) bases.peek ();
+ try {
+ base = new URL (base, xmlbase);
+ } catch (IOException e) {
+ fatal ("can't resolve xml:base attribute: " + xmlbase);
+ }
+ bases.push (base);
+ } else
+ bases.push (bases.peek ());
+
+ // fetch multi-element attributes, apply standard tweaks
+ // values (uri, catalog, rewritePrefix) get normalized too,
+ // as a precaution and since we may compare the values
+ String catalog = atts.getValue ("catalog");
+ if (catalog != null)
+ catalog = normalizeURI (absolutize (catalog));
+
+ String rewritePrefix = atts.getValue ("rewritePrefix");
+ if (rewritePrefix != null)
+ rewritePrefix = normalizeURI (absolutize (rewritePrefix));
+
+ String systemIdStartString;
+ systemIdStartString = atts.getValue ("systemIdStartString");
+ if (systemIdStartString != null) {
+ systemIdStartString = normalizeURI (systemIdStartString);
+ // unmatchable <rewriteSystemId>, <delegateSystemId> elements
+ if (systemIdStartString.startsWith ("urn:publicid:")) {
+ error ("systemIdStartString is really a publicId!!");
+ return;
+ }
+ }
+
+ String uri = atts.getValue ("uri");
+ if (uri != null)
+ uri = normalizeURI (absolutize (uri));
+
+ String uriStartString;
+ uriStartString = atts.getValue ("uriStartString");
+ if (uriStartString != null) {
+ uriStartString = normalizeURI (uriStartString);
+ // unmatchable <rewriteURI>, <delegateURI> elements
+ if (uriStartString.startsWith ("urn:publicid:")) {
+ error ("uriStartString is really a publicId!!");
+ return;
+ }
+ }
+
+ // strictly speaking "group" and "catalog" shouldn't nest
+ // ... arbitrary restriction, no evident motivation
// FIXME stack "prefer" settings (two elements only!) and use
// them to populate different public mapping/delegation tables
- if ("catalog" == local || "group" == local) {
- String prefer = atts.getValue ("prefer");
-
- if (prefer != null && !"public".equals (prefer)) {
- if (!"system".equals (prefer)) {
- error ("in <" + local + " ... prefer='...'>, "
- + "assuming 'public'");
- prefer = "public";
- }
- }
- if (prefer != null) {
- if ("catalog" == local) {
- cat.hasPreference = true;
- cat.usingPublic = "public".equals (prefer);
- } else {
- if (!cat.hasPreference || cat.usingPublic
- != "public".equals (prefer)) {
+ if ("catalog" == local || "group" == local) {
+ String prefer = atts.getValue ("prefer");
+
+ if (prefer != null && !"public".equals (prefer)) {
+ if (!"system".equals (prefer)) {
+ error ("in <" + local + " ... prefer='...'>, "
+ + "assuming 'public'");
+ prefer = "public";
+ }
+ }
+ if (prefer != null) {
+ if ("catalog" == local) {
+ cat.hasPreference = true;
+ cat.usingPublic = "public".equals (prefer);
+ } else {
+ if (!cat.hasPreference || cat.usingPublic
+ != "public".equals (prefer)) {
fatal ("<group prefer=...> case not handled");
- }
- }
- } else if ("group" == local && cat.hasPreference) {
+ }
+ }
+ } else if ("group" == local && cat.hasPreference) {
fatal ("<group prefer=...> case not handled");
- }
-
- //
- // PUBLIC ids: cleanly set up for id substitution
- //
- } else if ("public" == local) {
- String publicId = atts.getValue ("publicId");
- String value = null;
-
- if (publicId == null || uri == null) {
- error ("expecting <public publicId=... uri=.../>");
- return;
- }
- publicId = normalizePublicId (true, publicId);
- uri = nofrag (uri);
- if (cat.publicIds == null)
- cat.publicIds = new Hashtable ();
- else
- value = (String) cat.publicIds.get (publicId);
- if (value != null) {
- if (!value.equals (uri))
- warn ("ignoring <public...> entry for " + publicId);
- } else
- cat.publicIds.put (publicId, uri);
-
- } else if ("delegatePublic" == local) {
- String publicIdStartString;
- Object value = null;
-
- publicIdStartString = atts.getValue ("publicIdStartString");
- if (publicIdStartString == null || catalog == null) {
- error ("expecting <delegatePublic "
- + "publicIdStartString=... catalog=.../>");
- return;
- }
- publicIdStartString = normalizePublicId (true,
- publicIdStartString);
- if (cat.publicDelegations == null)
- cat.publicDelegations = new Hashtable ();
- else
- value = cat.publicDelegations.get (publicIdStartString);
- if (value != null) {
- if (!value.equals (catalog))
- warn ("ignoring <delegatePublic...> entry for "
- + uriStartString);
- } else
- cat.publicDelegations.put (publicIdStartString, catalog);
-
-
- //
- // SYSTEM ids: need substitution due to operational issues
- //
- } else if ("system" == local) {
- String systemId = atts.getValue ("systemId");
- String value = null;
-
- if (systemId == null || uri == null) {
- error ("expecting <system systemId=... uri=.../>");
- return;
- }
- systemId = normalizeURI (systemId);
- uri = nofrag (uri);
- if (systemId.startsWith ("urn:publicid:")) {
- error ("systemId is really a publicId!!");
- return;
- }
- if (cat.systemIds == null) {
- cat.systemIds = new Hashtable ();
- if (unified)
- cat.uris = cat.systemIds;
- } else
- value = (String) cat.systemIds.get (systemId);
- if (value != null) {
- if (!value.equals (uri))
- warn ("ignoring <system...> entry for " + systemId);
- } else
- cat.systemIds.put (systemId, uri);
-
- } else if ("rewriteSystem" == local) {
- String value = null;
-
- if (systemIdStartString == null || rewritePrefix == null
- || systemIdStartString.length () == 0
- || rewritePrefix.length () == 0
- ) {
- error ("expecting <rewriteSystem "
- + "systemIdStartString=... rewritePrefix=.../>");
- return;
- }
- if (cat.systemRewrites == null) {
- cat.systemRewrites = new Hashtable ();
- if (unified)
- cat.uriRewrites = cat.systemRewrites;
- } else
- value = (String) cat.systemRewrites.get (
- systemIdStartString);
- if (value != null) {
- if (!value.equals (rewritePrefix))
- warn ("ignoring <rewriteSystem...> entry for "
- + systemIdStartString);
- } else
- cat.systemRewrites.put (systemIdStartString,
- rewritePrefix);
-
- } else if ("delegateSystem" == local) {
- Object value = null;
-
- if (systemIdStartString == null || catalog == null) {
- error ("expecting <delegateSystem "
- + "systemIdStartString=... catalog=.../>");
- return;
- }
- if (cat.systemDelegations == null) {
- cat.systemDelegations = new Hashtable ();
- if (unified)
- cat.uriDelegations = cat.systemDelegations;
- } else
- value = cat.systemDelegations.get (systemIdStartString);
- if (value != null) {
- if (!value.equals (catalog))
- warn ("ignoring <delegateSystem...> entry for "
- + uriStartString);
- } else
- cat.systemDelegations.put (systemIdStartString, catalog);
-
-
- //
- // URI: just like "system" ID support, except that
- // fragment IDs are disallowed in "system" elements.
- //
- } else if ("uri" == local) {
- String name = atts.getValue ("name");
- String value = null;
-
- if (name == null || uri == null) {
- error ("expecting <uri name=... uri=.../>");
- return;
- }
- if (name.startsWith ("urn:publicid:")) {
- error ("name is really a publicId!!");
- return;
- }
- name = normalizeURI (name);
- if (cat.uris == null) {
- cat.uris = new Hashtable ();
- if (unified)
- cat.systemIds = cat.uris;
- } else
- value = (String) cat.uris.get (name);
- if (value != null) {
- if (!value.equals (uri))
- warn ("ignoring <uri...> entry for " + name);
- } else
- cat.uris.put (name, uri);
-
- } else if ("rewriteURI" == local) {
- String value = null;
-
- if (uriStartString == null || rewritePrefix == null
- || uriStartString.length () == 0
- || rewritePrefix.length () == 0
- ) {
- error ("expecting <rewriteURI "
- + "uriStartString=... rewritePrefix=.../>");
- return;
- }
- if (cat.uriRewrites == null) {
- cat.uriRewrites = new Hashtable ();
- if (unified)
- cat.systemRewrites = cat.uriRewrites;
- } else
- value = (String) cat.uriRewrites.get (uriStartString);
- if (value != null) {
- if (!value.equals (rewritePrefix))
- warn ("ignoring <rewriteURI...> entry for "
- + uriStartString);
- } else
- cat.uriRewrites.put (uriStartString, rewritePrefix);
-
- } else if ("delegateURI" == local) {
- Object value = null;
-
- if (uriStartString == null || catalog == null) {
- error ("expecting <delegateURI "
- + "uriStartString=... catalog=.../>");
- return;
- }
- if (cat.uriDelegations == null) {
- cat.uriDelegations = new Hashtable ();
- if (unified)
- cat.systemDelegations = cat.uriDelegations;
- } else
- value = cat.uriDelegations.get (uriStartString);
- if (value != null) {
- if (!value.equals (catalog))
- warn ("ignoring <delegateURI...> entry for "
- + uriStartString);
- } else
- cat.uriDelegations.put (uriStartString, catalog);
-
- //
- // NON-DELEGATING approach to modularity
- //
- } else if ("nextCatalog" == local) {
- if (catalog == null) {
- error ("expecting <nextCatalog catalog=.../>");
- return;
- }
- if (cat.next == null)
- cat.next = new Vector ();
- cat.next.addElement (catalog);
-
- //
- // EXTENSIONS from appendix E
- //
- } else if ("doctype" == local) {
- String name = atts.getValue ("name");
- String value = null;
-
- if (name == null || uri == null) {
- error ("expecting <doctype name=... uri=.../>");
- return;
- }
- name = normalizeURI (name);
- if (cat.doctypes == null)
- cat.doctypes = new Hashtable ();
- else
- value = (String) cat.doctypes.get (name);
- if (value != null) {
- if (!value.equals (uri))
- warn ("ignoring <doctype...> entry for "
- + uriStartString);
- } else
- cat.doctypes.put (name, uri);
-
-
- //
- // RESERVED ... ignore (like reserved attributes) but warn
- //
- } else {
- warn ("ignoring unknown catalog element: " + local);
- ignoreDepth++;
- }
- }
-
- public void endElement (String uri, String local, String qName)
- throws SAXException
- {
- if (ignoreDepth != 0)
- ignoreDepth--;
- else
- bases.pop ();
- }
+ }
+
+ //
+ // PUBLIC ids: cleanly set up for id substitution
+ //
+ } else if ("public" == local) {
+ String publicId = atts.getValue ("publicId");
+ String value = null;
+
+ if (publicId == null || uri == null) {
+ error ("expecting <public publicId=... uri=.../>");
+ return;
+ }
+ publicId = normalizePublicId (true, publicId);
+ uri = nofrag (uri);
+ if (cat.publicIds == null)
+ cat.publicIds = new Hashtable ();
+ else
+ value = (String) cat.publicIds.get (publicId);
+ if (value != null) {
+ if (!value.equals (uri))
+ warn ("ignoring <public...> entry for " + publicId);
+ } else
+ cat.publicIds.put (publicId, uri);
+
+ } else if ("delegatePublic" == local) {
+ String publicIdStartString;
+ Object value = null;
+
+ publicIdStartString = atts.getValue ("publicIdStartString");
+ if (publicIdStartString == null || catalog == null) {
+ error ("expecting <delegatePublic "
+ + "publicIdStartString=... catalog=.../>");
+ return;
+ }
+ publicIdStartString = normalizePublicId (true,
+ publicIdStartString);
+ if (cat.publicDelegations == null)
+ cat.publicDelegations = new Hashtable ();
+ else
+ value = cat.publicDelegations.get (publicIdStartString);
+ if (value != null) {
+ if (!value.equals (catalog))
+ warn ("ignoring <delegatePublic...> entry for "
+ + uriStartString);
+ } else
+ cat.publicDelegations.put (publicIdStartString, catalog);
+
+
+ //
+ // SYSTEM ids: need substitution due to operational issues
+ //
+ } else if ("system" == local) {
+ String systemId = atts.getValue ("systemId");
+ String value = null;
+
+ if (systemId == null || uri == null) {
+ error ("expecting <system systemId=... uri=.../>");
+ return;
+ }
+ systemId = normalizeURI (systemId);
+ uri = nofrag (uri);
+ if (systemId.startsWith ("urn:publicid:")) {
+ error ("systemId is really a publicId!!");
+ return;
+ }
+ if (cat.systemIds == null) {
+ cat.systemIds = new Hashtable ();
+ if (unified)
+ cat.uris = cat.systemIds;
+ } else
+ value = (String) cat.systemIds.get (systemId);
+ if (value != null) {
+ if (!value.equals (uri))
+ warn ("ignoring <system...> entry for " + systemId);
+ } else
+ cat.systemIds.put (systemId, uri);
+
+ } else if ("rewriteSystem" == local) {
+ String value = null;
+
+ if (systemIdStartString == null || rewritePrefix == null
+ || systemIdStartString.length () == 0
+ || rewritePrefix.length () == 0
+ ) {
+ error ("expecting <rewriteSystem "
+ + "systemIdStartString=... rewritePrefix=.../>");
+ return;
+ }
+ if (cat.systemRewrites == null) {
+ cat.systemRewrites = new Hashtable ();
+ if (unified)
+ cat.uriRewrites = cat.systemRewrites;
+ } else
+ value = (String) cat.systemRewrites.get (
+ systemIdStartString);
+ if (value != null) {
+ if (!value.equals (rewritePrefix))
+ warn ("ignoring <rewriteSystem...> entry for "
+ + systemIdStartString);
+ } else
+ cat.systemRewrites.put (systemIdStartString,
+ rewritePrefix);
+
+ } else if ("delegateSystem" == local) {
+ Object value = null;
+
+ if (systemIdStartString == null || catalog == null) {
+ error ("expecting <delegateSystem "
+ + "systemIdStartString=... catalog=.../>");
+ return;
+ }
+ if (cat.systemDelegations == null) {
+ cat.systemDelegations = new Hashtable ();
+ if (unified)
+ cat.uriDelegations = cat.systemDelegations;
+ } else
+ value = cat.systemDelegations.get (systemIdStartString);
+ if (value != null) {
+ if (!value.equals (catalog))
+ warn ("ignoring <delegateSystem...> entry for "
+ + uriStartString);
+ } else
+ cat.systemDelegations.put (systemIdStartString, catalog);
+
+
+ //
+ // URI: just like "system" ID support, except that
+ // fragment IDs are disallowed in "system" elements.
+ //
+ } else if ("uri" == local) {
+ String name = atts.getValue ("name");
+ String value = null;
+
+ if (name == null || uri == null) {
+ error ("expecting <uri name=... uri=.../>");
+ return;
+ }
+ if (name.startsWith ("urn:publicid:")) {
+ error ("name is really a publicId!!");
+ return;
+ }
+ name = normalizeURI (name);
+ if (cat.uris == null) {
+ cat.uris = new Hashtable ();
+ if (unified)
+ cat.systemIds = cat.uris;
+ } else
+ value = (String) cat.uris.get (name);
+ if (value != null) {
+ if (!value.equals (uri))
+ warn ("ignoring <uri...> entry for " + name);
+ } else
+ cat.uris.put (name, uri);
+
+ } else if ("rewriteURI" == local) {
+ String value = null;
+
+ if (uriStartString == null || rewritePrefix == null
+ || uriStartString.length () == 0
+ || rewritePrefix.length () == 0
+ ) {
+ error ("expecting <rewriteURI "
+ + "uriStartString=... rewritePrefix=.../>");
+ return;
+ }
+ if (cat.uriRewrites == null) {
+ cat.uriRewrites = new Hashtable ();
+ if (unified)
+ cat.systemRewrites = cat.uriRewrites;
+ } else
+ value = (String) cat.uriRewrites.get (uriStartString);
+ if (value != null) {
+ if (!value.equals (rewritePrefix))
+ warn ("ignoring <rewriteURI...> entry for "
+ + uriStartString);
+ } else
+ cat.uriRewrites.put (uriStartString, rewritePrefix);
+
+ } else if ("delegateURI" == local) {
+ Object value = null;
+
+ if (uriStartString == null || catalog == null) {
+ error ("expecting <delegateURI "
+ + "uriStartString=... catalog=.../>");
+ return;
+ }
+ if (cat.uriDelegations == null) {
+ cat.uriDelegations = new Hashtable ();
+ if (unified)
+ cat.systemDelegations = cat.uriDelegations;
+ } else
+ value = cat.uriDelegations.get (uriStartString);
+ if (value != null) {
+ if (!value.equals (catalog))
+ warn ("ignoring <delegateURI...> entry for "
+ + uriStartString);
+ } else
+ cat.uriDelegations.put (uriStartString, catalog);
+
+ //
+ // NON-DELEGATING approach to modularity
+ //
+ } else if ("nextCatalog" == local) {
+ if (catalog == null) {
+ error ("expecting <nextCatalog catalog=.../>");
+ return;
+ }
+ if (cat.next == null)
+ cat.next = new Vector ();
+ cat.next.addElement (catalog);
+
+ //
+ // EXTENSIONS from appendix E
+ //
+ } else if ("doctype" == local) {
+ String name = atts.getValue ("name");
+ String value = null;
+
+ if (name == null || uri == null) {
+ error ("expecting <doctype name=... uri=.../>");
+ return;
+ }
+ name = normalizeURI (name);
+ if (cat.doctypes == null)
+ cat.doctypes = new Hashtable ();
+ else
+ value = (String) cat.doctypes.get (name);
+ if (value != null) {
+ if (!value.equals (uri))
+ warn ("ignoring <doctype...> entry for "
+ + uriStartString);
+ } else
+ cat.doctypes.put (name, uri);
+
+
+ //
+ // RESERVED ... ignore (like reserved attributes) but warn
+ //
+ } else {
+ warn ("ignoring unknown catalog element: " + local);
+ ignoreDepth++;
+ }
+ }
+
+ public void endElement (String uri, String local, String qName)
+ throws SAXException
+ {
+ if (ignoreDepth != 0)
+ ignoreDepth--;
+ else
+ bases.pop ();
+ }
}
}
diff --git a/gnu/xml/util/XHTMLWriter.java b/gnu/xml/util/XHTMLWriter.java
index 02a0afca8..3a0c1adb7 100644
--- a/gnu/xml/util/XHTMLWriter.java
+++ b/gnu/xml/util/XHTMLWriter.java
@@ -1,4 +1,4 @@
-/* XHTMLWriter.java --
+/* XHTMLWriter.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,7 +67,7 @@ public class XHTMLWriter extends XMLWriter
public XHTMLWriter ()
throws IOException
{
- this (System.out);
+ this (System.out);
}
/**
@@ -75,15 +75,15 @@ public class XHTMLWriter extends XMLWriter
* is used to write SAX events in the US-ASCII encoding, as XHTML.
*
* @param out Where US-ASCII encoding of the stream of SAX
- * events will be sent.
+ * events will be sent.
*/
public XHTMLWriter (OutputStream out)
throws IOException
{
- // not all JVMs understand "ASCII" as an encoding name, so
- // we use 8859_1 (they all seem to handle that one) and
- // make the echo handler filter out non-ASCII characters
- this (new OutputStreamWriter (out, "8859_1"), "US-ASCII");
+ // not all JVMs understand "ASCII" as an encoding name, so
+ // we use 8859_1 (they all seem to handle that one) and
+ // make the echo handler filter out non-ASCII characters
+ this (new OutputStreamWriter (out, "8859_1"), "US-ASCII");
}
/**
@@ -94,7 +94,7 @@ public class XHTMLWriter extends XMLWriter
*/
public XHTMLWriter (Writer out)
{
- this (out, null);
+ this (out, null);
}
/**
@@ -104,11 +104,11 @@ public class XHTMLWriter extends XMLWriter
*
* @param out Where the stream of SAX events will be written.
* @param encoding If non-null, this names the encoding to be
- * placed in the encoding declaration.
+ * placed in the encoding declaration.
*/
public XHTMLWriter (Writer out, String encoding)
{
- super (out, encoding);
- setXhtml (true);
+ super (out, encoding);
+ setXhtml (true);
}
}
diff --git a/gnu/xml/util/XMLWriter.java b/gnu/xml/util/XMLWriter.java
index 274594720..a371debff 100644
--- a/gnu/xml/util/XMLWriter.java
+++ b/gnu/xml/util/XMLWriter.java
@@ -1,4 +1,4 @@
-/* XMLWriter.java --
+/* XMLWriter.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -111,74 +111,74 @@ public class XMLWriter
implements ContentHandler, LexicalHandler, DTDHandler, DeclHandler
{
// text prints/escapes differently depending on context
- // CTX_ENTITY ... entity literal value
- // CTX_ATTRIBUTE ... attribute literal value
- // CTX_CONTENT ... content of an element
- // CTX_UNPARSED ... CDATA, comment, PI, names, etc
+ // CTX_ENTITY ... entity literal value
+ // CTX_ATTRIBUTE ... attribute literal value
+ // CTX_CONTENT ... content of an element
+ // CTX_UNPARSED ... CDATA, comment, PI, names, etc
// CTX_NAME ... name or nmtoken, no escapes possible
- private static final int CTX_ENTITY = 1;
- private static final int CTX_ATTRIBUTE = 2;
- private static final int CTX_CONTENT = 3;
- private static final int CTX_UNPARSED = 4;
- private static final int CTX_NAME = 5;
+ private static final int CTX_ENTITY = 1;
+ private static final int CTX_ATTRIBUTE = 2;
+ private static final int CTX_CONTENT = 3;
+ private static final int CTX_UNPARSED = 4;
+ private static final int CTX_NAME = 5;
// FIXME: names (element, attribute, PI, notation, etc) are not
// currently written out with range checks (escapeChars).
// In non-XHTML, some names can't be directly written; panic!
- private static String sysEOL;
+ private static String sysEOL;
static {
- try {
- sysEOL = System.getProperty ("line.separator", "\n");
+ try {
+ sysEOL = System.getProperty ("line.separator", "\n");
- // don't use the system's EOL if it's illegal XML.
- if (!isLineEnd (sysEOL))
- sysEOL = "\n";
+ // don't use the system's EOL if it's illegal XML.
+ if (!isLineEnd (sysEOL))
+ sysEOL = "\n";
- } catch (SecurityException e) {
- sysEOL = "\n";
- }
+ } catch (SecurityException e) {
+ sysEOL = "\n";
+ }
}
private static boolean isLineEnd (String eol)
{
- return "\n".equals (eol)
- || "\r".equals (eol)
- || "\r\n".equals (eol);
+ return "\n".equals (eol)
+ || "\r".equals (eol)
+ || "\r\n".equals (eol);
}
- private Writer out;
- private boolean inCDATA;
- private int elementNestLevel;
- private String eol = sysEOL;
+ private Writer out;
+ private boolean inCDATA;
+ private int elementNestLevel;
+ private String eol = sysEOL;
- private short dangerMask;
- private CPStringBuilder stringBuf;
- private Locator locator;
- private ErrorHandler errHandler;
+ private short dangerMask;
+ private CPStringBuilder stringBuf;
+ private Locator locator;
+ private ErrorHandler errHandler;
- private boolean expandingEntities = false;
- private int entityNestLevel;
- private boolean xhtml;
- private boolean startedDoctype;
- private String encoding;
+ private boolean expandingEntities = false;
+ private int entityNestLevel;
+ private boolean xhtml;
+ private boolean startedDoctype;
+ private String encoding;
- private boolean canonical;
- private boolean inDoctype;
- private boolean inEpilogue;
+ private boolean canonical;
+ private boolean inDoctype;
+ private boolean inEpilogue;
// pretty printing controls
- private boolean prettyPrinting;
- private int column;
- private boolean noWrap;
- private Stack space = new Stack ();
+ private boolean prettyPrinting;
+ private int column;
+ private boolean noWrap;
+ private Stack space = new Stack ();
// this is not a hard'n'fast rule -- longer lines are OK,
// but are to be avoided. Here, prettyprinting is more to
// show structure "cleanly" than to be precise about it.
// better to have ragged layout than one line 24Kb long.
- private static final int lineLength = 75;
+ private static final int lineLength = 75;
/**
@@ -187,7 +187,7 @@ public class XMLWriter
* it's safe to close System.out at the end of the document.
*/
public XMLWriter () throws IOException
- { this (System.out); }
+ { this (System.out); }
/**
* Constructs a handler which writes all input to the output stream
@@ -198,7 +198,7 @@ public class XMLWriter
*/
public XMLWriter (OutputStream out) throws IOException
{
- this (new OutputStreamWriter (out, "UTF8"));
+ this (new OutputStreamWriter (out, "UTF8"));
}
/**
@@ -215,7 +215,7 @@ public class XMLWriter
*/
public XMLWriter (Writer writer)
{
- this (writer, null);
+ this (writer, null);
}
/**
@@ -248,53 +248,53 @@ public class XMLWriter
*
* @param writer XML text is written to this writer.
* @param encoding if non-null, and an XML declaration is written,
- * this is the name that will be used for the character encoding.
+ * this is the name that will be used for the character encoding.
*/
public XMLWriter (Writer writer, String encoding)
{
- setWriter (writer, encoding);
+ setWriter (writer, encoding);
}
-
+
private void setEncoding (String encoding)
{
- if (encoding == null && out instanceof OutputStreamWriter)
- encoding = ((OutputStreamWriter)out).getEncoding ();
-
- if (encoding != null) {
- encoding = encoding.toUpperCase ();
-
- // Use official encoding names where we know them,
- // avoiding the Java-only names. When using common
- // encodings where we can easily tell if characters
- // are out of range, we'll escape out-of-range
- // characters using character refs for safety.
-
- // I _think_ these are all the main synonyms for these!
- if ("UTF8".equals (encoding)) {
- encoding = "UTF-8";
- } else if ("US-ASCII".equals (encoding)
- || "ASCII".equals (encoding)) {
- dangerMask = (short) 0xff80;
- encoding = "US-ASCII";
- } else if ("ISO-8859-1".equals (encoding)
- || "8859_1".equals (encoding)
- || "ISO8859_1".equals (encoding)) {
- dangerMask = (short) 0xff00;
- encoding = "ISO-8859-1";
- } else if ("UNICODE".equals (encoding)
- || "UNICODE-BIG".equals (encoding)
- || "UNICODE-LITTLE".equals (encoding)) {
- encoding = "UTF-16";
-
- // TODO: UTF-16BE, UTF-16LE ... no BOM; what
- // release of JDK supports those Unicode names?
- }
-
- if (dangerMask != 0)
- stringBuf = new CPStringBuilder ();
- }
-
- this.encoding = encoding;
+ if (encoding == null && out instanceof OutputStreamWriter)
+ encoding = ((OutputStreamWriter)out).getEncoding ();
+
+ if (encoding != null) {
+ encoding = encoding.toUpperCase ();
+
+ // Use official encoding names where we know them,
+ // avoiding the Java-only names. When using common
+ // encodings where we can easily tell if characters
+ // are out of range, we'll escape out-of-range
+ // characters using character refs for safety.
+
+ // I _think_ these are all the main synonyms for these!
+ if ("UTF8".equals (encoding)) {
+ encoding = "UTF-8";
+ } else if ("US-ASCII".equals (encoding)
+ || "ASCII".equals (encoding)) {
+ dangerMask = (short) 0xff80;
+ encoding = "US-ASCII";
+ } else if ("ISO-8859-1".equals (encoding)
+ || "8859_1".equals (encoding)
+ || "ISO8859_1".equals (encoding)) {
+ dangerMask = (short) 0xff00;
+ encoding = "ISO-8859-1";
+ } else if ("UNICODE".equals (encoding)
+ || "UNICODE-BIG".equals (encoding)
+ || "UNICODE-LITTLE".equals (encoding)) {
+ encoding = "UTF-16";
+
+ // TODO: UTF-16BE, UTF-16LE ... no BOM; what
+ // release of JDK supports those Unicode names?
+ }
+
+ if (dangerMask != 0)
+ stringBuf = new CPStringBuilder ();
+ }
+
+ this.encoding = encoding;
}
@@ -303,37 +303,37 @@ public class XMLWriter
*
* @param writer XML text is written to this writer.
* @param encoding if non-null, and an XML declaration is written,
- * this is the name that will be used for the character encoding.
+ * this is the name that will be used for the character encoding.
*
* @exception IllegalStateException if the current
- * document hasn't yet ended (with {@link #endDocument})
+ * document hasn't yet ended (with {@link #endDocument})
*/
final public void setWriter (Writer writer, String encoding)
{
- if (out != null)
- throw new IllegalStateException (
- "can't change stream in mid course");
- out = writer;
- if (out != null)
- setEncoding (encoding);
- if (!(out instanceof BufferedWriter))
- out = new BufferedWriter (out);
- space.push ("default");
+ if (out != null)
+ throw new IllegalStateException (
+ "can't change stream in mid course");
+ out = writer;
+ if (out != null)
+ setEncoding (encoding);
+ if (!(out instanceof BufferedWriter))
+ out = new BufferedWriter (out);
+ space.push ("default");
}
/**
* Assigns the line ending style to be used on output.
* @param eolString null to use the system default; else
- * "\n", "\r", or "\r\n".
+ * "\n", "\r", or "\r\n".
*/
final public void setEOL (String eolString)
{
- if (eolString == null)
- eol = sysEOL;
- else if (!isLineEnd (eolString))
- eol = eolString;
- else
- throw new IllegalArgumentException (eolString);
+ if (eolString == null)
+ eol = sysEOL;
+ else if (!isLineEnd (eolString))
+ eol = eolString;
+ else
+ throw new IllegalArgumentException (eolString);
}
/**
@@ -342,7 +342,7 @@ public class XMLWriter
*/
public void setErrorHandler (ErrorHandler handler)
{
- errHandler = handler;
+ errHandler = handler;
}
/**
@@ -355,15 +355,15 @@ public class XMLWriter
protected void fatal (String message, Exception e)
throws SAXException
{
- SAXParseException x;
-
- if (locator == null)
- x = new SAXParseException (message, null, null, -1, -1, e);
- else
- x = new SAXParseException (message, locator, e);
- if (errHandler != null)
- errHandler.fatalError (x);
- throw x;
+ SAXParseException x;
+
+ if (locator == null)
+ x = new SAXParseException (message, null, null, -1, -1, e);
+ else
+ x = new SAXParseException (message, locator, e);
+ if (errHandler != null)
+ errHandler.fatalError (x);
+ throw x;
}
@@ -385,47 +385,47 @@ public class XMLWriter
* be careful of in all cases, as described in the appendix referenced
* above, include: <ul>
*
- * <li> Element and attribute names must be in lower case, both
- * in the document and in any CSS style sheet.
- * <li> All XML constructs must be valid as defined by the XHTML
- * "transitional" DTD (including all familiar constructs,
- * even deprecated ones).
- * <li> The root element must be "html".
- * <li> Elements that must be empty (such as <em>&lt;br&gt;</em>
- * must have no content.
- * <li> Use both <em>lang</em> and <em>xml:lang</em> attributes
- * when specifying language.
- * <li> Similarly, use both <em>id</em> and <em>name</em> attributes
- * when defining elements that may be referred to through
- * URI fragment identifiers ... and make sure that the
- * value is a legal NMTOKEN, since not all such HTML 4.0
- * identifiers are valid in XML.
- * <li> Be careful with character encodings; make sure you provide
- * a <em>&lt;meta http-equiv="Content-type"
- * content="text/xml;charset=..." /&gt;</em> element in
- * the HTML "head" element, naming the same encoding
- * used to create this handler. Also, if that encoding
- * is anything other than US-ASCII, make sure that if
- * the document is given a MIME content type, it has
- * a <em>charset=...</em> attribute with that encoding.
- * </ul>
+ * <li> Element and attribute names must be in lower case, both
+ * in the document and in any CSS style sheet.
+ * <li> All XML constructs must be valid as defined by the XHTML
+ * "transitional" DTD (including all familiar constructs,
+ * even deprecated ones).
+ * <li> The root element must be "html".
+ * <li> Elements that must be empty (such as <em>&lt;br&gt;</em>
+ * must have no content.
+ * <li> Use both <em>lang</em> and <em>xml:lang</em> attributes
+ * when specifying language.
+ * <li> Similarly, use both <em>id</em> and <em>name</em> attributes
+ * when defining elements that may be referred to through
+ * URI fragment identifiers ... and make sure that the
+ * value is a legal NMTOKEN, since not all such HTML 4.0
+ * identifiers are valid in XML.
+ * <li> Be careful with character encodings; make sure you provide
+ * a <em>&lt;meta http-equiv="Content-type"
+ * content="text/xml;charset=..." /&gt;</em> element in
+ * the HTML "head" element, naming the same encoding
+ * used to create this handler. Also, if that encoding
+ * is anything other than US-ASCII, make sure that if
+ * the document is given a MIME content type, it has
+ * a <em>charset=...</em> attribute with that encoding.
+ * </ul>
*
* <p> Additionally, some of the oldest browsers have additional
* quirks, to address with guidelines such as: <ul>
*
- * <li> Processing instructions may be rendered, so avoid them.
- * (Similarly for an XML declaration.)
- * <li> Embedded style sheets and scripts should not contain XML
- * markup delimiters: &amp;, &lt;, and ]]&gt; are trouble.
- * <li> Attribute values should not have line breaks or multiple
- * consecutive white space characters.
- * <li> Use no more than one of the deprecated (transitional)
- * <em>&lt;isindex&gt;</em> elements.
- * <li> Some boolean attributes (such as <em>compact, checked,
- * disabled, readonly, selected,</em> and more) confuse
- * some browsers, since they only understand minimized
- * versions which are illegal in XML.
- * </ul>
+ * <li> Processing instructions may be rendered, so avoid them.
+ * (Similarly for an XML declaration.)
+ * <li> Embedded style sheets and scripts should not contain XML
+ * markup delimiters: &amp;, &lt;, and ]]&gt; are trouble.
+ * <li> Attribute values should not have line breaks or multiple
+ * consecutive white space characters.
+ * <li> Use no more than one of the deprecated (transitional)
+ * <em>&lt;isindex&gt;</em> elements.
+ * <li> Some boolean attributes (such as <em>compact, checked,
+ * disabled, readonly, selected,</em> and more) confuse
+ * some browsers, since they only understand minimized
+ * versions which are illegal in XML.
+ * </ul>
*
* <p> Also, some characteristics of the resulting output may be
* a function of whether the document is later given a MIME
@@ -437,11 +437,11 @@ public class XMLWriter
*/
final public void setXhtml (boolean value)
{
- if (locator != null)
- throw new IllegalStateException ("started parsing");
- xhtml = value;
- if (xhtml)
- canonical = false;
+ if (locator != null)
+ throw new IllegalStateException ("started parsing");
+ xhtml = value;
+ if (xhtml)
+ canonical = false;
}
/**
@@ -452,7 +452,7 @@ public class XMLWriter
*/
final public boolean isXhtml ()
{
- return xhtml;
+ return xhtml;
}
/**
@@ -462,11 +462,11 @@ public class XMLWriter
*/
final public void setExpandingEntities (boolean value)
{
- if (locator != null)
- throw new IllegalStateException ("started parsing");
- expandingEntities = value;
- if (!expandingEntities)
- canonical = false;
+ if (locator != null)
+ throw new IllegalStateException ("started parsing");
+ expandingEntities = value;
+ if (!expandingEntities)
+ canonical = false;
}
/**
@@ -475,7 +475,7 @@ public class XMLWriter
*/
final public boolean isExpandingEntities ()
{
- return expandingEntities;
+ return expandingEntities;
}
/**
@@ -499,15 +499,15 @@ public class XMLWriter
* to make this be more strictly formatted!
*
* @exception IllegalStateException thrown if this method is invoked
- * after output has begun.
+ * after output has begun.
*/
final public void setPrettyPrinting (boolean value)
{
- if (locator != null)
- throw new IllegalStateException ("started parsing");
- prettyPrinting = value;
- if (prettyPrinting)
- canonical = false;
+ if (locator != null)
+ throw new IllegalStateException ("started parsing");
+ prettyPrinting = value;
+ if (prettyPrinting)
+ canonical = false;
}
/**
@@ -515,7 +515,7 @@ public class XMLWriter
*/
final public boolean isPrettyPrinting ()
{
- return prettyPrinting;
+ return prettyPrinting;
}
@@ -524,31 +524,31 @@ public class XMLWriter
* meet requirements that are slightly more stringent than the
* basic well-formedness ones, and include: <ul>
*
- * <li> Namespace prefixes must not have been changed from those
- * in the original document. (This may only be ensured by setting
- * the SAX2 XMLReader <em>namespace-prefixes</em> feature flag;
- * by default, it is cleared.)
+ * <li> Namespace prefixes must not have been changed from those
+ * in the original document. (This may only be ensured by setting
+ * the SAX2 XMLReader <em>namespace-prefixes</em> feature flag;
+ * by default, it is cleared.)
*
- * <li> Redundant namespace declaration attributes have been
- * removed. (If an ancestor element defines a namespace prefix
- * and that declaration hasn't been overriden, an element must
- * not redeclare it.)
+ * <li> Redundant namespace declaration attributes have been
+ * removed. (If an ancestor element defines a namespace prefix
+ * and that declaration hasn't been overriden, an element must
+ * not redeclare it.)
*
- * <li> If comments are not to be included in the canonical output,
- * they must first be removed from the input event stream; this
- * <em>Canonical XML with comments</em> by default.
+ * <li> If comments are not to be included in the canonical output,
+ * they must first be removed from the input event stream; this
+ * <em>Canonical XML with comments</em> by default.
*
- * <li> If the input character encoding was not UCS-based, the
- * character data must have been normalized using Unicode
- * Normalization Form C. (UTF-8 and UTF-16 are UCS-based.)
+ * <li> If the input character encoding was not UCS-based, the
+ * character data must have been normalized using Unicode
+ * Normalization Form C. (UTF-8 and UTF-16 are UCS-based.)
*
- * <li> Attribute values must have been normalized, as is done
- * by any conformant XML processor which processes all external
- * parameter entities.
+ * <li> Attribute values must have been normalized, as is done
+ * by any conformant XML processor which processes all external
+ * parameter entities.
*
- * <li> Similarly, attribute value defaulting has been performed.
+ * <li> Similarly, attribute value defaulting has been performed.
*
- * </ul>
+ * </ul>
*
* <p> Note that fragments of XML documents, as specified by an XPath
* node set, may be canonicalized. In such cases, elements may need
@@ -556,18 +556,18 @@ public class XMLWriter
* context).
*
* @exception IllegalArgumentException if the output encoding
- * is anything other than UTF-8.
+ * is anything other than UTF-8.
*/
final public void setCanonical (boolean value)
{
- if (value && !"UTF-8".equals (encoding))
- throw new IllegalArgumentException ("encoding != UTF-8");
- canonical = value;
- if (canonical) {
- prettyPrinting = xhtml = false;
- expandingEntities = true;
- eol = "\n";
- }
+ if (value && !"UTF-8".equals (encoding))
+ throw new IllegalArgumentException ("encoding != UTF-8");
+ canonical = value;
+ if (canonical) {
+ prettyPrinting = xhtml = false;
+ expandingEntities = true;
+ eol = "\n";
+ }
}
@@ -576,7 +576,7 @@ public class XMLWriter
*/
final public boolean isCanonical ()
{
- return canonical;
+ return canonical;
}
@@ -588,8 +588,8 @@ public class XMLWriter
final public void flush ()
throws IOException
{
- if (out != null)
- out.flush ();
+ if (out != null)
+ out.flush ();
}
@@ -597,7 +597,7 @@ public class XMLWriter
// FIXME: probably want a subclass that holds a lot of these...
// and maybe more!
-
+
/**
* Writes the string as if characters() had been called on the contents
* of the string. This is particularly useful when applications act as
@@ -606,8 +606,8 @@ public class XMLWriter
final public void write (String data)
throws SAXException
{
- char buf [] = data.toCharArray ();
- characters (buf, 0, buf.length);
+ char buf [] = data.toCharArray ();
+ characters (buf, 0, buf.length);
}
@@ -617,21 +617,21 @@ public class XMLWriter
* @see #startElement
*/
public void writeElement (
- String uri,
- String localName,
- String qName,
- Attributes atts,
- String content
+ String uri,
+ String localName,
+ String qName,
+ Attributes atts,
+ String content
) throws SAXException
{
- if (content == null || content.length () == 0) {
- writeEmptyElement (uri, localName, qName, atts);
- return;
- }
- startElement (uri, localName, qName, atts);
- char chars [] = content.toCharArray ();
- characters (chars, 0, chars.length);
- endElement (uri, localName, qName);
+ if (content == null || content.length () == 0) {
+ writeEmptyElement (uri, localName, qName, atts);
+ return;
+ }
+ startElement (uri, localName, qName, atts);
+ char chars [] = content.toCharArray ();
+ characters (chars, 0, chars.length);
+ endElement (uri, localName, qName);
}
@@ -642,14 +642,14 @@ public class XMLWriter
* @see #startElement
*/
public void writeElement (
- String uri,
- String localName,
- String qName,
- Attributes atts,
- int content
+ String uri,
+ String localName,
+ String qName,
+ Attributes atts,
+ int content
) throws SAXException
{
- writeElement (uri, localName, qName, atts, Integer.toString (content));
+ writeElement (uri, localName, qName, atts, Integer.toString (content));
}
@@ -657,7 +657,7 @@ public class XMLWriter
/** <b>SAX1</b>: provides parser status information */
final public void setDocumentLocator (Locator l)
{
- locator = l;
+ locator = l;
}
@@ -665,7 +665,7 @@ public class XMLWriter
private static final String xhtmlFullDTD =
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
-
+
/**
* <b>SAX1</b>: indicates the beginning of a document parse.
* If you're writing (well formed) fragments of XML, neither
@@ -675,60 +675,60 @@ public class XMLWriter
public void startDocument ()
throws SAXException
{
- try {
- if (out == null)
- throw new IllegalStateException (
- "null Writer given to XMLWriter");
-
- // Not all parsers provide the locator we want; this also
- // flags whether events are being sent to this object yet.
- // We could only have this one call if we only printed whole
- // documents ... but we also print fragments, so most of the
- // callbacks here replicate this test.
-
- if (locator == null)
- locator = new LocatorImpl ();
-
- // Unless the data is in US-ASCII or we're canonicalizing, write
- // the XML declaration if we know the encoding. US-ASCII won't
- // normally get mangled by web server confusion about the
- // character encodings used. Plus, it's an easy way to
- // ensure we can write ASCII that's unlikely to confuse
- // elderly HTML parsers.
-
- if (!canonical
- && dangerMask != (short) 0xff80
- && encoding != null) {
- rawWrite ("<?xml version='1.0'");
- rawWrite (" encoding='" + encoding + "'");
- rawWrite ("?>");
- newline ();
- }
-
- if (xhtml) {
-
- rawWrite ("<!DOCTYPE html PUBLIC");
- newline ();
- rawWrite (" '-//W3C//DTD XHTML 1.0 Transitional//EN'");
- newline ();
- rawWrite (" '");
- // NOTE: URL (above) matches the REC
- rawWrite (xhtmlFullDTD);
- rawWrite ("'>");
- newline ();
- newline ();
-
- // fake the rest of the handler into ignoring
- // everything until the root element, so any
- // XHTML DTD comments, PIs, etc are ignored
- startedDoctype = true;
- }
-
- entityNestLevel = 0;
-
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ try {
+ if (out == null)
+ throw new IllegalStateException (
+ "null Writer given to XMLWriter");
+
+ // Not all parsers provide the locator we want; this also
+ // flags whether events are being sent to this object yet.
+ // We could only have this one call if we only printed whole
+ // documents ... but we also print fragments, so most of the
+ // callbacks here replicate this test.
+
+ if (locator == null)
+ locator = new LocatorImpl ();
+
+ // Unless the data is in US-ASCII or we're canonicalizing, write
+ // the XML declaration if we know the encoding. US-ASCII won't
+ // normally get mangled by web server confusion about the
+ // character encodings used. Plus, it's an easy way to
+ // ensure we can write ASCII that's unlikely to confuse
+ // elderly HTML parsers.
+
+ if (!canonical
+ && dangerMask != (short) 0xff80
+ && encoding != null) {
+ rawWrite ("<?xml version='1.0'");
+ rawWrite (" encoding='" + encoding + "'");
+ rawWrite ("?>");
+ newline ();
+ }
+
+ if (xhtml) {
+
+ rawWrite ("<!DOCTYPE html PUBLIC");
+ newline ();
+ rawWrite (" '-//W3C//DTD XHTML 1.0 Transitional//EN'");
+ newline ();
+ rawWrite (" '");
+ // NOTE: URL (above) matches the REC
+ rawWrite (xhtmlFullDTD);
+ rawWrite ("'>");
+ newline ();
+ newline ();
+
+ // fake the rest of the handler into ignoring
+ // everything until the root element, so any
+ // XHTML DTD comments, PIs, etc are ignored
+ startedDoctype = true;
+ }
+
+ entityNestLevel = 0;
+
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/**
@@ -740,164 +740,164 @@ public class XMLWriter
public void endDocument ()
throws SAXException
{
- try {
- if (!canonical) {
- newline ();
- newline ();
- }
- out.close ();
- out = null;
- locator = null;
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ try {
+ if (!canonical) {
+ newline ();
+ newline ();
+ }
+ out.close ();
+ out = null;
+ locator = null;
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
// XHTML elements declared as EMPTY print differently
final private static boolean isEmptyElementTag (String tag)
{
- switch (tag.charAt (0)) {
- case 'a': return "area".equals (tag);
- case 'b': return "base".equals (tag)
- || "basefont".equals (tag)
- || "br".equals (tag);
- case 'c': return "col".equals (tag);
- case 'f': return "frame".equals (tag);
- case 'h': return "hr".equals (tag);
- case 'i': return "img".equals (tag)
- || "input".equals (tag)
- || "isindex".equals (tag);
- case 'l': return "link".equals (tag);
- case 'm': return "meta".equals (tag);
- case 'p': return "param".equals (tag);
- }
- return false;
+ switch (tag.charAt (0)) {
+ case 'a': return "area".equals (tag);
+ case 'b': return "base".equals (tag)
+ || "basefont".equals (tag)
+ || "br".equals (tag);
+ case 'c': return "col".equals (tag);
+ case 'f': return "frame".equals (tag);
+ case 'h': return "hr".equals (tag);
+ case 'i': return "img".equals (tag)
+ || "input".equals (tag)
+ || "isindex".equals (tag);
+ case 'l': return "link".equals (tag);
+ case 'm': return "meta".equals (tag);
+ case 'p': return "param".equals (tag);
+ }
+ return false;
}
private static boolean indentBefore (String tag)
{
- // basically indent before block content
- // and within structure like tables, lists
- switch (tag.charAt (0)) {
- case 'a': return "applet".equals (tag);
- case 'b': return "body".equals (tag)
- || "blockquote".equals (tag);
- case 'c': return "center".equals (tag);
- case 'f': return "frame".equals (tag)
- || "frameset".equals (tag);
- case 'h': return "head".equals (tag);
- case 'm': return "meta".equals (tag);
- case 'o': return "object".equals (tag);
- case 'p': return "param".equals (tag)
- || "pre".equals (tag);
- case 's': return "style".equals (tag);
- case 't': return "title".equals (tag)
- || "td".equals (tag)
- || "th".equals (tag);
- }
- // ... but not inline elements like "em", "b", "font"
- return false;
+ // basically indent before block content
+ // and within structure like tables, lists
+ switch (tag.charAt (0)) {
+ case 'a': return "applet".equals (tag);
+ case 'b': return "body".equals (tag)
+ || "blockquote".equals (tag);
+ case 'c': return "center".equals (tag);
+ case 'f': return "frame".equals (tag)
+ || "frameset".equals (tag);
+ case 'h': return "head".equals (tag);
+ case 'm': return "meta".equals (tag);
+ case 'o': return "object".equals (tag);
+ case 'p': return "param".equals (tag)
+ || "pre".equals (tag);
+ case 's': return "style".equals (tag);
+ case 't': return "title".equals (tag)
+ || "td".equals (tag)
+ || "th".equals (tag);
+ }
+ // ... but not inline elements like "em", "b", "font"
+ return false;
}
private static boolean spaceBefore (String tag)
{
- // blank line AND INDENT before certain structural content
- switch (tag.charAt (0)) {
- case 'h': return "h1".equals (tag)
- || "h2".equals (tag)
- || "h3".equals (tag)
- || "h4".equals (tag)
- || "h5".equals (tag)
- || "h6".equals (tag)
- || "hr".equals (tag);
- case 'l': return "li".equals (tag);
- case 'o': return "ol".equals (tag);
- case 'p': return "p".equals (tag);
- case 't': return "table".equals (tag)
- || "tr".equals (tag);
- case 'u': return "ul".equals (tag);
- }
- return false;
+ // blank line AND INDENT before certain structural content
+ switch (tag.charAt (0)) {
+ case 'h': return "h1".equals (tag)
+ || "h2".equals (tag)
+ || "h3".equals (tag)
+ || "h4".equals (tag)
+ || "h5".equals (tag)
+ || "h6".equals (tag)
+ || "hr".equals (tag);
+ case 'l': return "li".equals (tag);
+ case 'o': return "ol".equals (tag);
+ case 'p': return "p".equals (tag);
+ case 't': return "table".equals (tag)
+ || "tr".equals (tag);
+ case 'u': return "ul".equals (tag);
+ }
+ return false;
}
// XHTML DTDs say these three have xml:space="preserve"
private static boolean spacePreserve (String tag)
{
- return "pre".equals (tag)
- || "style".equals (tag)
- || "script".equals (tag);
+ return "pre".equals (tag)
+ || "style".equals (tag)
+ || "script".equals (tag);
}
/**
* <b>SAX2</b>: ignored.
*/
final public void startPrefixMapping (String prefix, String uri)
- {}
+ {}
/**
* <b>SAX2</b>: ignored.
*/
final public void endPrefixMapping (String prefix)
- {}
+ {}
private void writeStartTag (
- String name,
- Attributes atts,
- boolean isEmpty
+ String name,
+ Attributes atts,
+ boolean isEmpty
) throws SAXException, IOException
{
- rawWrite ('<');
- rawWrite (name);
+ rawWrite ('<');
+ rawWrite (name);
- // write out attributes ... sorting is particularly useful
- // with output that's been heavily defaulted.
- if (atts != null && atts.getLength () != 0) {
+ // write out attributes ... sorting is particularly useful
+ // with output that's been heavily defaulted.
+ if (atts != null && atts.getLength () != 0) {
- // Set up to write, with optional sorting
- int indices [] = new int [atts.getLength ()];
+ // Set up to write, with optional sorting
+ int indices [] = new int [atts.getLength ()];
- for (int i= 0; i < indices.length; i++)
- indices [i] = i;
-
- // optionally sort
+ for (int i= 0; i < indices.length; i++)
+ indices [i] = i;
+
+ // optionally sort
// FIXME: canon xml demands xmlns nodes go first,
// and sorting by URI first (empty first) then localname
// it should maybe use a different sort
- if (canonical || prettyPrinting) {
-
- // insertion sort by attribute name
- for (int i = 1; i < indices.length; i++) {
- int n = indices [i], j;
- String s = atts.getQName (n);
-
- for (j = i - 1; j >= 0; j--) {
- if (s.compareTo (atts.getQName (indices [j]))
- >= 0)
- break;
- indices [j + 1] = indices [j];
- }
- indices [j + 1] = n;
- }
- }
-
- // write, sorted or no
- for (int i= 0; i < indices.length; i++) {
- String s = atts.getQName (indices [i]);
-
- if (s == null || "".equals (s))
- throw new IllegalArgumentException ("no XML name");
- rawWrite (" ");
- rawWrite (s);
- rawWrite ("=");
- writeQuotedValue (atts.getValue (indices [i]),
- CTX_ATTRIBUTE);
- }
- }
- if (isEmpty)
- rawWrite (" /");
- rawWrite ('>');
+ if (canonical || prettyPrinting) {
+
+ // insertion sort by attribute name
+ for (int i = 1; i < indices.length; i++) {
+ int n = indices [i], j;
+ String s = atts.getQName (n);
+
+ for (j = i - 1; j >= 0; j--) {
+ if (s.compareTo (atts.getQName (indices [j]))
+ >= 0)
+ break;
+ indices [j + 1] = indices [j];
+ }
+ indices [j + 1] = n;
+ }
+ }
+
+ // write, sorted or no
+ for (int i= 0; i < indices.length; i++) {
+ String s = atts.getQName (indices [i]);
+
+ if (s == null || "".equals (s))
+ throw new IllegalArgumentException ("no XML name");
+ rawWrite (" ");
+ rawWrite (s);
+ rawWrite ("=");
+ writeQuotedValue (atts.getValue (indices [i]),
+ CTX_ATTRIBUTE);
+ }
+ }
+ if (isEmpty)
+ rawWrite (" /");
+ rawWrite ('>');
}
/**
@@ -907,59 +907,59 @@ public class XMLWriter
* not all user agents handle them correctly.
*/
final public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
+ String uri,
+ String localName,
+ String qName,
+ Attributes atts
) throws SAXException
{
- startedDoctype = false;
-
- if (locator == null)
- locator = new LocatorImpl ();
-
- if (qName == null || "".equals (qName))
- throw new IllegalArgumentException ("no XML name");
-
- try {
- if (entityNestLevel != 0)
- return;
- if (prettyPrinting) {
- String whitespace = null;
-
- if (xhtml && spacePreserve (qName))
- whitespace = "preserve";
- else if (atts != null)
- whitespace = atts.getValue ("xml:space");
- if (whitespace == null)
- whitespace = (String) space.peek ();
- space.push (whitespace);
-
- if ("default".equals (whitespace)) {
- if (xhtml) {
- if (spaceBefore (qName)) {
- newline ();
- doIndent ();
- } else if (indentBefore (qName))
- doIndent ();
- // else it's inlined, modulo line length
- // FIXME: incrementing element nest level
- // for inlined elements causes ugliness
- } else
- doIndent ();
- }
- }
- elementNestLevel++;
- writeStartTag (qName, atts, xhtml && isEmptyElementTag (qName));
-
- if (xhtml) {
+ startedDoctype = false;
+
+ if (locator == null)
+ locator = new LocatorImpl ();
+
+ if (qName == null || "".equals (qName))
+ throw new IllegalArgumentException ("no XML name");
+
+ try {
+ if (entityNestLevel != 0)
+ return;
+ if (prettyPrinting) {
+ String whitespace = null;
+
+ if (xhtml && spacePreserve (qName))
+ whitespace = "preserve";
+ else if (atts != null)
+ whitespace = atts.getValue ("xml:space");
+ if (whitespace == null)
+ whitespace = (String) space.peek ();
+ space.push (whitespace);
+
+ if ("default".equals (whitespace)) {
+ if (xhtml) {
+ if (spaceBefore (qName)) {
+ newline ();
+ doIndent ();
+ } else if (indentBefore (qName))
+ doIndent ();
+ // else it's inlined, modulo line length
+ // FIXME: incrementing element nest level
+ // for inlined elements causes ugliness
+ } else
+ doIndent ();
+ }
+ }
+ elementNestLevel++;
+ writeStartTag (qName, atts, xhtml && isEmptyElementTag (qName));
+
+ if (xhtml) {
// FIXME: if this is an XHTML "pre" element, turn
// off automatic wrapping.
- }
+ }
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/**
@@ -967,22 +967,22 @@ public class XMLWriter
* @see #startElement
*/
public void writeEmptyElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
+ String uri,
+ String localName,
+ String qName,
+ Attributes atts
) throws SAXException
{
- if (canonical) {
- startElement (uri, localName, qName, atts);
- endElement (uri, localName, qName);
- } else {
- try {
- writeStartTag (qName, atts, true);
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
+ if (canonical) {
+ startElement (uri, localName, qName, atts);
+ endElement (uri, localName, qName);
+ } else {
+ try {
+ writeStartTag (qName, atts, true);
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
+ }
}
@@ -990,68 +990,68 @@ public class XMLWriter
final public void endElement (String uri, String localName, String qName)
throws SAXException
{
- if (qName == null || "".equals (qName))
- throw new IllegalArgumentException ("no XML name");
-
- try {
- elementNestLevel--;
- if (entityNestLevel != 0)
- return;
- if (xhtml && isEmptyElementTag (qName))
- return;
- rawWrite ("</");
- rawWrite (qName);
- rawWrite ('>');
-
- if (prettyPrinting) {
- if (!space.empty ())
- space.pop ();
- else
- fatal ("stack discipline", null);
- }
- if (elementNestLevel == 0)
- inEpilogue = true;
-
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (qName == null || "".equals (qName))
+ throw new IllegalArgumentException ("no XML name");
+
+ try {
+ elementNestLevel--;
+ if (entityNestLevel != 0)
+ return;
+ if (xhtml && isEmptyElementTag (qName))
+ return;
+ rawWrite ("</");
+ rawWrite (qName);
+ rawWrite ('>');
+
+ if (prettyPrinting) {
+ if (!space.empty ())
+ space.pop ();
+ else
+ fatal ("stack discipline", null);
+ }
+ if (elementNestLevel == 0)
+ inEpilogue = true;
+
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/** <b>SAX1</b>: reports content characters */
final public void characters (char ch [], int start, int length)
throws SAXException
{
- if (locator == null)
- locator = new LocatorImpl ();
-
- try {
- if (entityNestLevel != 0)
- return;
- if (inCDATA) {
- escapeChars (ch, start, length, CTX_UNPARSED);
- } else {
- escapeChars (ch, start, length, CTX_CONTENT);
- }
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (locator == null)
+ locator = new LocatorImpl ();
+
+ try {
+ if (entityNestLevel != 0)
+ return;
+ if (inCDATA) {
+ escapeChars (ch, start, length, CTX_UNPARSED);
+ } else {
+ escapeChars (ch, start, length, CTX_CONTENT);
+ }
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/** <b>SAX1</b>: reports ignorable whitespace */
final public void ignorableWhitespace (char ch [], int start, int length)
throws SAXException
{
- if (locator == null)
- locator = new LocatorImpl ();
-
- try {
- if (entityNestLevel != 0)
- return;
- // don't forget to map NL to CRLF, CR, etc
- escapeChars (ch, start, length, CTX_CONTENT);
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (locator == null)
+ locator = new LocatorImpl ();
+
+ try {
+ if (entityNestLevel != 0)
+ return;
+ // don't forget to map NL to CRLF, CR, etc
+ escapeChars (ch, start, length, CTX_CONTENT);
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/**
@@ -1063,44 +1063,44 @@ public class XMLWriter
final public void processingInstruction (String target, String data)
throws SAXException
{
- if (locator == null)
- locator = new LocatorImpl ();
-
- // don't print internal subset for XHTML
- if (xhtml && startedDoctype)
- return;
-
- // ancient HTML browsers might render these ... their loss.
- // to prevent: "if (xhtml) return;".
-
- try {
- if (entityNestLevel != 0)
- return;
- if (canonical && inEpilogue)
- newline ();
- rawWrite ("<?");
- rawWrite (target);
- rawWrite (' ');
- escapeChars (data.toCharArray (), -1, -1, CTX_UNPARSED);
- rawWrite ("?>");
- if (elementNestLevel == 0 && !(canonical && inEpilogue))
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (locator == null)
+ locator = new LocatorImpl ();
+
+ // don't print internal subset for XHTML
+ if (xhtml && startedDoctype)
+ return;
+
+ // ancient HTML browsers might render these ... their loss.
+ // to prevent: "if (xhtml) return;".
+
+ try {
+ if (entityNestLevel != 0)
+ return;
+ if (canonical && inEpilogue)
+ newline ();
+ rawWrite ("<?");
+ rawWrite (target);
+ rawWrite (' ');
+ escapeChars (data.toCharArray (), -1, -1, CTX_UNPARSED);
+ rawWrite ("?>");
+ if (elementNestLevel == 0 && !(canonical && inEpilogue))
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/** <b>SAX1</b>: indicates a non-expanded entity reference */
public void skippedEntity (String name)
throws SAXException
{
- try {
- rawWrite ("&");
- rawWrite (name);
- rawWrite (";");
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ try {
+ rawWrite ("&");
+ rawWrite (name);
+ rawWrite (";");
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
// SAX2 LexicalHandler
@@ -1109,35 +1109,35 @@ public class XMLWriter
final public void startCDATA ()
throws SAXException
{
- if (locator == null)
- locator = new LocatorImpl ();
-
- if (canonical)
- return;
-
- try {
- inCDATA = true;
- if (entityNestLevel == 0)
- rawWrite ("<![CDATA[");
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (locator == null)
+ locator = new LocatorImpl ();
+
+ if (canonical)
+ return;
+
+ try {
+ inCDATA = true;
+ if (entityNestLevel == 0)
+ rawWrite ("<![CDATA[");
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/** <b>SAX2</b>: called after parsing CDATA characters */
final public void endCDATA ()
throws SAXException
{
- if (canonical)
- return;
-
- try {
- inCDATA = false;
- if (entityNestLevel == 0)
- rawWrite ("]]>");
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (canonical)
+ return;
+
+ try {
+ inCDATA = false;
+ if (entityNestLevel == 0)
+ rawWrite ("]]>");
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/**
@@ -1148,45 +1148,45 @@ public class XMLWriter
final public void startDTD (String name, String publicId, String systemId)
throws SAXException
{
- if (locator == null)
- locator = new LocatorImpl ();
- if (xhtml)
- return;
- try {
- inDoctype = startedDoctype = true;
- if (canonical)
- return;
- rawWrite ("<!DOCTYPE ");
- rawWrite (name);
- rawWrite (' ');
-
- if (!expandingEntities) {
- if (publicId != null)
- rawWrite ("PUBLIC '" + publicId + "' '" + systemId + "' ");
- else if (systemId != null)
- rawWrite ("SYSTEM '" + systemId + "' ");
- }
-
- rawWrite ('[');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (locator == null)
+ locator = new LocatorImpl ();
+ if (xhtml)
+ return;
+ try {
+ inDoctype = startedDoctype = true;
+ if (canonical)
+ return;
+ rawWrite ("<!DOCTYPE ");
+ rawWrite (name);
+ rawWrite (' ');
+
+ if (!expandingEntities) {
+ if (publicId != null)
+ rawWrite ("PUBLIC '" + publicId + "' '" + systemId + "' ");
+ else if (systemId != null)
+ rawWrite ("SYSTEM '" + systemId + "' ");
+ }
+
+ rawWrite ('[');
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/** <b>SAX2</b>: called after the doctype is parsed */
final public void endDTD ()
throws SAXException
{
- inDoctype = false;
- if (canonical || xhtml)
- return;
- try {
- rawWrite ("]>");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ inDoctype = false;
+ if (canonical || xhtml)
+ return;
+ try {
+ rawWrite ("]>");
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/**
@@ -1195,30 +1195,30 @@ public class XMLWriter
final public void startEntity (String name)
throws SAXException
{
- try {
- boolean writeEOL = true;
-
- // Predefined XHTML entities (for characters) will get
- // mapped back later.
- if (xhtml || expandingEntities)
- return;
-
- entityNestLevel++;
- if (name.equals ("[dtd]"))
- return;
- if (entityNestLevel != 1)
- return;
- if (!name.startsWith ("%")) {
- writeEOL = false;
- rawWrite ('&');
- }
- rawWrite (name);
- rawWrite (';');
- if (writeEOL)
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ try {
+ boolean writeEOL = true;
+
+ // Predefined XHTML entities (for characters) will get
+ // mapped back later.
+ if (xhtml || expandingEntities)
+ return;
+
+ entityNestLevel++;
+ if (name.equals ("[dtd]"))
+ return;
+ if (entityNestLevel != 1)
+ return;
+ if (!name.startsWith ("%")) {
+ writeEOL = false;
+ rawWrite ('&');
+ }
+ rawWrite (name);
+ rawWrite (';');
+ if (writeEOL)
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/**
@@ -1227,9 +1227,9 @@ public class XMLWriter
final public void endEntity (String name)
throws SAXException
{
- if (xhtml || expandingEntities)
- return;
- entityNestLevel--;
+ if (xhtml || expandingEntities)
+ return;
+ entityNestLevel--;
}
/**
@@ -1243,294 +1243,294 @@ public class XMLWriter
final public void comment (char ch [], int start, int length)
throws SAXException
{
- if (locator == null)
- locator = new LocatorImpl ();
-
- // don't print internal subset for XHTML
- if (xhtml && startedDoctype)
- return;
- // don't print comment in doctype for canon xml
- if (canonical && inDoctype)
- return;
-
- try {
- boolean indent;
-
- if (prettyPrinting && space.empty ())
- fatal ("stack discipline", null);
- indent = prettyPrinting && "default".equals (space.peek ());
- if (entityNestLevel != 0)
- return;
- if (indent)
- doIndent ();
- if (canonical && inEpilogue)
- newline ();
- rawWrite ("<!--");
- escapeChars (ch, start, length, CTX_UNPARSED);
- rawWrite ("-->");
- if (indent)
- doIndent ();
- if (elementNestLevel == 0 && !(canonical && inEpilogue))
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (locator == null)
+ locator = new LocatorImpl ();
+
+ // don't print internal subset for XHTML
+ if (xhtml && startedDoctype)
+ return;
+ // don't print comment in doctype for canon xml
+ if (canonical && inDoctype)
+ return;
+
+ try {
+ boolean indent;
+
+ if (prettyPrinting && space.empty ())
+ fatal ("stack discipline", null);
+ indent = prettyPrinting && "default".equals (space.peek ());
+ if (entityNestLevel != 0)
+ return;
+ if (indent)
+ doIndent ();
+ if (canonical && inEpilogue)
+ newline ();
+ rawWrite ("<!--");
+ escapeChars (ch, start, length, CTX_UNPARSED);
+ rawWrite ("-->");
+ if (indent)
+ doIndent ();
+ if (elementNestLevel == 0 && !(canonical && inEpilogue))
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
// SAX1 DTDHandler
/** <b>SAX1</b>: called on notation declarations */
final public void notationDecl (String name,
- String publicId, String systemId)
+ String publicId, String systemId)
throws SAXException
{
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
-
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!NOTATION " + name + " ");
- if (publicId != null)
- rawWrite ("PUBLIC \"" + publicId + '"');
- else
- rawWrite ("SYSTEM ");
- if (systemId != null)
- rawWrite ('"' + systemId + '"');
- rawWrite (">");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (xhtml)
+ return;
+ try {
+ // At this time, only SAX2 callbacks start these.
+ if (!startedDoctype)
+ return;
+
+ if (entityNestLevel != 0)
+ return;
+ rawWrite ("<!NOTATION " + name + " ");
+ if (publicId != null)
+ rawWrite ("PUBLIC \"" + publicId + '"');
+ else
+ rawWrite ("SYSTEM ");
+ if (systemId != null)
+ rawWrite ('"' + systemId + '"');
+ rawWrite (">");
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/** <b>SAX1</b>: called on unparsed entity declarations */
final public void unparsedEntityDecl (String name,
- String publicId, String systemId,
- String notationName)
+ String publicId, String systemId,
+ String notationName)
throws SAXException
{
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype) {
- // FIXME: write to temporary buffer, and make the start
- // of the root element write these declarations.
- return;
- }
-
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!ENTITY " + name + " ");
- if (publicId != null)
- rawWrite ("PUBLIC \"" + publicId + '"');
- else
- rawWrite ("SYSTEM ");
- rawWrite ('"' + systemId + '"');
- rawWrite (" NDATA " + notationName + ">");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (xhtml)
+ return;
+ try {
+ // At this time, only SAX2 callbacks start these.
+ if (!startedDoctype) {
+ // FIXME: write to temporary buffer, and make the start
+ // of the root element write these declarations.
+ return;
+ }
+
+ if (entityNestLevel != 0)
+ return;
+ rawWrite ("<!ENTITY " + name + " ");
+ if (publicId != null)
+ rawWrite ("PUBLIC \"" + publicId + '"');
+ else
+ rawWrite ("SYSTEM ");
+ rawWrite ('"' + systemId + '"');
+ rawWrite (" NDATA " + notationName + ">");
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
// SAX2 DeclHandler
/** <b>SAX2</b>: called on attribute declarations */
final public void attributeDecl (String eName, String aName,
- String type, String mode, String value)
+ String type, String mode, String value)
throws SAXException
{
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!ATTLIST " + eName + ' ' + aName + ' ');
- rawWrite (type);
- rawWrite (' ');
- if (mode != null)
- rawWrite (mode + ' ');
- if (value != null)
- writeQuotedValue (value, CTX_ATTRIBUTE);
- rawWrite ('>');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (xhtml)
+ return;
+ try {
+ // At this time, only SAX2 callbacks start these.
+ if (!startedDoctype)
+ return;
+ if (entityNestLevel != 0)
+ return;
+ rawWrite ("<!ATTLIST " + eName + ' ' + aName + ' ');
+ rawWrite (type);
+ rawWrite (' ');
+ if (mode != null)
+ rawWrite (mode + ' ');
+ if (value != null)
+ writeQuotedValue (value, CTX_ATTRIBUTE);
+ rawWrite ('>');
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/** <b>SAX2</b>: called on element declarations */
final public void elementDecl (String name, String model)
throws SAXException
{
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!ELEMENT " + name + ' ' + model + '>');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (xhtml)
+ return;
+ try {
+ // At this time, only SAX2 callbacks start these.
+ if (!startedDoctype)
+ return;
+ if (entityNestLevel != 0)
+ return;
+ rawWrite ("<!ELEMENT " + name + ' ' + model + '>');
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/** <b>SAX2</b>: called on external entity declarations */
final public void externalEntityDecl (
- String name,
- String publicId,
- String systemId)
+ String name,
+ String publicId,
+ String systemId)
throws SAXException
{
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!ENTITY ");
- if (name.startsWith ("%")) {
- rawWrite ("% ");
- rawWrite (name.substring (1));
- } else
- rawWrite (name);
- if (publicId != null)
- rawWrite (" PUBLIC \"" + publicId + '"');
- else
- rawWrite (" SYSTEM ");
- rawWrite ('"' + systemId + "\">");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (xhtml)
+ return;
+ try {
+ // At this time, only SAX2 callbacks start these.
+ if (!startedDoctype)
+ return;
+ if (entityNestLevel != 0)
+ return;
+ rawWrite ("<!ENTITY ");
+ if (name.startsWith ("%")) {
+ rawWrite ("% ");
+ rawWrite (name.substring (1));
+ } else
+ rawWrite (name);
+ if (publicId != null)
+ rawWrite (" PUBLIC \"" + publicId + '"');
+ else
+ rawWrite (" SYSTEM ");
+ rawWrite ('"' + systemId + "\">");
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
/** <b>SAX2</b>: called on internal entity declarations */
final public void internalEntityDecl (String name, String value)
throws SAXException
{
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!ENTITY ");
- if (name.startsWith ("%")) {
- rawWrite ("% ");
- rawWrite (name.substring (1));
- } else
- rawWrite (name);
- rawWrite (' ');
- writeQuotedValue (value, CTX_ENTITY);
- rawWrite ('>');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
+ if (xhtml)
+ return;
+ try {
+ // At this time, only SAX2 callbacks start these.
+ if (!startedDoctype)
+ return;
+ if (entityNestLevel != 0)
+ return;
+ rawWrite ("<!ENTITY ");
+ if (name.startsWith ("%")) {
+ rawWrite ("% ");
+ rawWrite (name.substring (1));
+ } else
+ rawWrite (name);
+ rawWrite (' ');
+ writeQuotedValue (value, CTX_ENTITY);
+ rawWrite ('>');
+ newline ();
+ } catch (IOException e) {
+ fatal ("can't write", e);
+ }
}
private void writeQuotedValue (String value, int code)
throws SAXException, IOException
{
- char buf [] = value.toCharArray ();
- int off = 0, len = buf.length;
-
- // we can't add line breaks to attribute/entity/... values
- noWrap = true;
- rawWrite ('"');
- escapeChars (buf, off, len, code);
- rawWrite ('"');
- noWrap = false;
+ char buf [] = value.toCharArray ();
+ int off = 0, len = buf.length;
+
+ // we can't add line breaks to attribute/entity/... values
+ noWrap = true;
+ rawWrite ('"');
+ escapeChars (buf, off, len, code);
+ rawWrite ('"');
+ noWrap = false;
}
-
+
// From "HTMLlat1x.ent" ... names of entities for ISO-8859-1
// (Latin/1) characters, all codes: 160-255 (0xA0-0xFF).
// Codes 128-159 have no assigned values.
private static final String HTMLlat1x [] = {
- // 160
- "nbsp", "iexcl", "cent", "pound", "curren",
- "yen", "brvbar", "sect", "uml", "copy",
+ // 160
+ "nbsp", "iexcl", "cent", "pound", "curren",
+ "yen", "brvbar", "sect", "uml", "copy",
- // 170
- "ordf", "laquo", "not", "shy", "reg",
- "macr", "deg", "plusmn", "sup2", "sup3",
+ // 170
+ "ordf", "laquo", "not", "shy", "reg",
+ "macr", "deg", "plusmn", "sup2", "sup3",
- // 180
- "acute", "micro", "para", "middot", "cedil",
- "sup1", "ordm", "raquo", "frac14", "frac12",
+ // 180
+ "acute", "micro", "para", "middot", "cedil",
+ "sup1", "ordm", "raquo", "frac14", "frac12",
- // 190
- "frac34", "iquest", "Agrave", "Aacute", "Acirc",
- "Atilde", "Auml", "Aring", "AElig", "Ccedil",
+ // 190
+ "frac34", "iquest", "Agrave", "Aacute", "Acirc",
+ "Atilde", "Auml", "Aring", "AElig", "Ccedil",
- // 200
- "Egrave", "Eacute", "Ecirc", "Euml", "Igrave",
- "Iacute", "Icirc", "Iuml", "ETH", "Ntilde",
+ // 200
+ "Egrave", "Eacute", "Ecirc", "Euml", "Igrave",
+ "Iacute", "Icirc", "Iuml", "ETH", "Ntilde",
- // 210
- "Ograve", "Oacute", "Ocirc", "Otilde", "Ouml",
- "times", "Oslash", "Ugrave", "Uacute", "Ucirc",
+ // 210
+ "Ograve", "Oacute", "Ocirc", "Otilde", "Ouml",
+ "times", "Oslash", "Ugrave", "Uacute", "Ucirc",
- // 220
- "Uuml", "Yacute", "THORN", "szlig", "agrave",
- "aacute", "acirc", "atilde", "auml", "aring",
+ // 220
+ "Uuml", "Yacute", "THORN", "szlig", "agrave",
+ "aacute", "acirc", "atilde", "auml", "aring",
- // 230
- "aelig", "ccedil", "egrave", "eacute", "ecirc",
- "euml", "igrave", "iacute", "icirc", "iuml",
+ // 230
+ "aelig", "ccedil", "egrave", "eacute", "ecirc",
+ "euml", "igrave", "iacute", "icirc", "iuml",
- // 240
- "eth", "ntilde", "ograve", "oacute", "ocirc",
- "otilde", "ouml", "divide", "oslash", "ugrave",
+ // 240
+ "eth", "ntilde", "ograve", "oacute", "ocirc",
+ "otilde", "ouml", "divide", "oslash", "ugrave",
- // 250
- "uacute", "ucirc", "uuml", "yacute", "thorn",
- "yuml"
+ // 250
+ "uacute", "ucirc", "uuml", "yacute", "thorn",
+ "yuml"
};
// From "HTMLsymbolx.ent" ... some of the symbols that
// we can conveniently handle. Entities for the Greek.
// alphabet (upper and lower cases) are compact.
private static final String HTMLsymbolx_GR [] = {
- // 913
- "Alpha", "Beta", "Gamma", "Delta", "Epsilon",
- "Zeta", "Eta", "Theta", "Iota", "Kappa",
+ // 913
+ "Alpha", "Beta", "Gamma", "Delta", "Epsilon",
+ "Zeta", "Eta", "Theta", "Iota", "Kappa",
- // 923
- "Lambda", "Mu", "Nu", "Xi", "Omicron",
- "Pi", "Rho", null, "Sigma", "Tau",
+ // 923
+ "Lambda", "Mu", "Nu", "Xi", "Omicron",
+ "Pi", "Rho", null, "Sigma", "Tau",
- // 933
- "Upsilon", "Phi", "Chi", "Psi", "Omega"
+ // 933
+ "Upsilon", "Phi", "Chi", "Psi", "Omega"
};
private static final String HTMLsymbolx_gr [] = {
- // 945
- "alpha", "beta", "gamma", "delta", "epsilon",
- "zeta", "eta", "theta", "iota", "kappa",
+ // 945
+ "alpha", "beta", "gamma", "delta", "epsilon",
+ "zeta", "eta", "theta", "iota", "kappa",
- // 955
- "lambda", "mu", "nu", "xi", "omicron",
- "pi", "rho", "sigmaf", "sigma", "tau",
+ // 955
+ "lambda", "mu", "nu", "xi", "omicron",
+ "pi", "rho", "sigmaf", "sigma", "tau",
- // 965
- "upsilon", "phi", "chi", "psi", "omega"
+ // 965
+ "upsilon", "phi", "chi", "psi", "omega"
};
@@ -1539,268 +1539,268 @@ public class XMLWriter
private void escapeChars (char buf [], int off, int len, int code)
throws SAXException, IOException
{
- int first = 0;
-
- if (off < 0) {
- off = 0;
- len = buf.length;
- }
- for (int i = 0; i < len; i++) {
- String esc;
- char c = buf [off + i];
-
- switch (c) {
- // Note that CTX_ATTRIBUTE isn't explicitly tested here;
- // all syntax delimiters are escaped in CTX_ATTRIBUTE,
- // otherwise it's similar to CTX_CONTENT
-
- // ampersand flags entity references; entity replacement
- // text has unexpanded references, other text doesn't.
- case '&':
- if (code == CTX_ENTITY || code == CTX_UNPARSED)
- continue;
- esc = "amp";
- break;
-
- // attributes and text may NOT have literal '<', but
- // entities may have markup constructs
- case '<':
- if (code == CTX_ENTITY || code == CTX_UNPARSED)
- continue;
- esc = "lt";
- break;
-
- // as above re markup constructs; but otherwise
- // except when canonicalizing, this is for consistency
- case '>':
- if (code == CTX_ENTITY || code == CTX_UNPARSED)
- continue;
- esc = "gt";
- break;
- case '\'':
- if (code == CTX_CONTENT || code == CTX_UNPARSED)
- continue;
- if (canonical)
- continue;
- esc = "apos";
- break;
-
- // needed when printing quoted attribute/entity values
- case '"':
- if (code == CTX_CONTENT || code == CTX_UNPARSED)
- continue;
- esc = "quot";
- break;
-
- // make line ends work per host OS convention
- case '\n':
- esc = eol;
- break;
-
- //
- // No other characters NEED special treatment ... except
- // for encoding-specific issues, like whether the character
- // can really be represented in that encoding.
- //
- default:
- //
- // There are characters we can never write safely; getting
- // them is an error.
- //
- // (a) They're never legal in XML ... detected by range
- // checks, and (eventually) by remerging surrogate
- // pairs on output. (Easy error for apps to prevent.)
- //
- // (b) This encoding can't represent them, and we
- // can't make reference substitution (e.g. inside
- // CDATA sections, names, PI data, etc). (Hard for
- // apps to prevent, except by using UTF-8 or UTF-16
- // as their output encoding.)
- //
- // We know a very little bit about what characters
- // the US-ASCII and ISO-8859-1 encodings support. For
- // other encodings we can't detect the second type of
- // error at all. (Never an issue for UTF-8 or UTF-16.)
- //
+ int first = 0;
+
+ if (off < 0) {
+ off = 0;
+ len = buf.length;
+ }
+ for (int i = 0; i < len; i++) {
+ String esc;
+ char c = buf [off + i];
+
+ switch (c) {
+ // Note that CTX_ATTRIBUTE isn't explicitly tested here;
+ // all syntax delimiters are escaped in CTX_ATTRIBUTE,
+ // otherwise it's similar to CTX_CONTENT
+
+ // ampersand flags entity references; entity replacement
+ // text has unexpanded references, other text doesn't.
+ case '&':
+ if (code == CTX_ENTITY || code == CTX_UNPARSED)
+ continue;
+ esc = "amp";
+ break;
+
+ // attributes and text may NOT have literal '<', but
+ // entities may have markup constructs
+ case '<':
+ if (code == CTX_ENTITY || code == CTX_UNPARSED)
+ continue;
+ esc = "lt";
+ break;
+
+ // as above re markup constructs; but otherwise
+ // except when canonicalizing, this is for consistency
+ case '>':
+ if (code == CTX_ENTITY || code == CTX_UNPARSED)
+ continue;
+ esc = "gt";
+ break;
+ case '\'':
+ if (code == CTX_CONTENT || code == CTX_UNPARSED)
+ continue;
+ if (canonical)
+ continue;
+ esc = "apos";
+ break;
+
+ // needed when printing quoted attribute/entity values
+ case '"':
+ if (code == CTX_CONTENT || code == CTX_UNPARSED)
+ continue;
+ esc = "quot";
+ break;
+
+ // make line ends work per host OS convention
+ case '\n':
+ esc = eol;
+ break;
+
+ //
+ // No other characters NEED special treatment ... except
+ // for encoding-specific issues, like whether the character
+ // can really be represented in that encoding.
+ //
+ default:
+ //
+ // There are characters we can never write safely; getting
+ // them is an error.
+ //
+ // (a) They're never legal in XML ... detected by range
+ // checks, and (eventually) by remerging surrogate
+ // pairs on output. (Easy error for apps to prevent.)
+ //
+ // (b) This encoding can't represent them, and we
+ // can't make reference substitution (e.g. inside
+ // CDATA sections, names, PI data, etc). (Hard for
+ // apps to prevent, except by using UTF-8 or UTF-16
+ // as their output encoding.)
+ //
+ // We know a very little bit about what characters
+ // the US-ASCII and ISO-8859-1 encodings support. For
+ // other encodings we can't detect the second type of
+ // error at all. (Never an issue for UTF-8 or UTF-16.)
+ //
// FIXME: CR in CDATA is an error; in text, turn to a char ref
// FIXME: CR/LF/TAB in attributes should become char refs
- if ((c > 0xfffd)
- || ((c < 0x0020) && !((c == 0x0009)
- || (c == 0x000A) || (c == 0x000D)))
- || (((c & dangerMask) != 0)
- && (code == CTX_UNPARSED))) {
-
- // if case (b) in CDATA, we might end the section,
- // write a reference, then restart ... possible
- // in one DOM L3 draft.
-
- throw new CharConversionException (
- "Illegal or non-writable character: U+"
- + Integer.toHexString (c));
- }
-
- //
- // If the output encoding represents the character
- // directly, let it do so! Else we'll escape it.
- //
- if ((c & dangerMask) == 0)
- continue;
- esc = null;
-
- // Avoid numeric refs where symbolic ones exist, as
- // symbolic ones make more sense to humans reading!
- if (xhtml) {
- // all the HTMLlat1x.ent entities
- // (all the "ISO-8859-1" characters)
- if (c >= 160 && c <= 255)
- esc = HTMLlat1x [c - 160];
-
- // not quite half the HTMLsymbolx.ent entities
- else if (c >= 913 && c <= 937)
- esc = HTMLsymbolx_GR [c - 913];
- else if (c >= 945 && c <= 969)
- esc = HTMLsymbolx_gr [c - 945];
-
- else switch (c) {
- // all of the HTMLspecialx.ent entities
- case 338: esc = "OElig"; break;
- case 339: esc = "oelig"; break;
- case 352: esc = "Scaron"; break;
- case 353: esc = "scaron"; break;
- case 376: esc = "Yuml"; break;
- case 710: esc = "circ"; break;
- case 732: esc = "tilde"; break;
- case 8194: esc = "ensp"; break;
- case 8195: esc = "emsp"; break;
- case 8201: esc = "thinsp"; break;
- case 8204: esc = "zwnj"; break;
- case 8205: esc = "zwj"; break;
- case 8206: esc = "lrm"; break;
- case 8207: esc = "rlm"; break;
- case 8211: esc = "ndash"; break;
- case 8212: esc = "mdash"; break;
- case 8216: esc = "lsquo"; break;
- case 8217: esc = "rsquo"; break;
- case 8218: esc = "sbquo"; break;
- case 8220: esc = "ldquo"; break;
- case 8221: esc = "rdquo"; break;
- case 8222: esc = "bdquo"; break;
- case 8224: esc = "dagger"; break;
- case 8225: esc = "Dagger"; break;
- case 8240: esc = "permil"; break;
- case 8249: esc = "lsaquo"; break;
- case 8250: esc = "rsaquo"; break;
- case 8364: esc = "euro"; break;
-
- // the other HTMLsymbox.ent entities
- case 402: esc = "fnof"; break;
- case 977: esc = "thetasym"; break;
- case 978: esc = "upsih"; break;
- case 982: esc = "piv"; break;
- case 8226: esc = "bull"; break;
- case 8230: esc = "hellip"; break;
- case 8242: esc = "prime"; break;
- case 8243: esc = "Prime"; break;
- case 8254: esc = "oline"; break;
- case 8260: esc = "frasl"; break;
- case 8472: esc = "weierp"; break;
- case 8465: esc = "image"; break;
- case 8476: esc = "real"; break;
- case 8482: esc = "trade"; break;
- case 8501: esc = "alefsym"; break;
- case 8592: esc = "larr"; break;
- case 8593: esc = "uarr"; break;
- case 8594: esc = "rarr"; break;
- case 8595: esc = "darr"; break;
- case 8596: esc = "harr"; break;
- case 8629: esc = "crarr"; break;
- case 8656: esc = "lArr"; break;
- case 8657: esc = "uArr"; break;
- case 8658: esc = "rArr"; break;
- case 8659: esc = "dArr"; break;
- case 8660: esc = "hArr"; break;
- case 8704: esc = "forall"; break;
- case 8706: esc = "part"; break;
- case 8707: esc = "exist"; break;
- case 8709: esc = "empty"; break;
- case 8711: esc = "nabla"; break;
- case 8712: esc = "isin"; break;
- case 8713: esc = "notin"; break;
- case 8715: esc = "ni"; break;
- case 8719: esc = "prod"; break;
- case 8721: esc = "sum"; break;
- case 8722: esc = "minus"; break;
- case 8727: esc = "lowast"; break;
- case 8730: esc = "radic"; break;
- case 8733: esc = "prop"; break;
- case 8734: esc = "infin"; break;
- case 8736: esc = "ang"; break;
- case 8743: esc = "and"; break;
- case 8744: esc = "or"; break;
- case 8745: esc = "cap"; break;
- case 8746: esc = "cup"; break;
- case 8747: esc = "int"; break;
- case 8756: esc = "there4"; break;
- case 8764: esc = "sim"; break;
- case 8773: esc = "cong"; break;
- case 8776: esc = "asymp"; break;
- case 8800: esc = "ne"; break;
- case 8801: esc = "equiv"; break;
- case 8804: esc = "le"; break;
- case 8805: esc = "ge"; break;
- case 8834: esc = "sub"; break;
- case 8835: esc = "sup"; break;
- case 8836: esc = "nsub"; break;
- case 8838: esc = "sube"; break;
- case 8839: esc = "supe"; break;
- case 8853: esc = "oplus"; break;
- case 8855: esc = "otimes"; break;
- case 8869: esc = "perp"; break;
- case 8901: esc = "sdot"; break;
- case 8968: esc = "lceil"; break;
- case 8969: esc = "rceil"; break;
- case 8970: esc = "lfloor"; break;
- case 8971: esc = "rfloor"; break;
- case 9001: esc = "lang"; break;
- case 9002: esc = "rang"; break;
- case 9674: esc = "loz"; break;
- case 9824: esc = "spades"; break;
- case 9827: esc = "clubs"; break;
- case 9829: esc = "hearts"; break;
- case 9830: esc = "diams"; break;
- }
- }
-
- // else escape with numeric char refs
- if (esc == null) {
- stringBuf.setLength (0);
- stringBuf.append ("#x");
- stringBuf.append (Integer.toHexString (c).toUpperCase ());
- esc = stringBuf.toString ();
-
- // FIXME: We don't write surrogate pairs correctly.
- // They should work as one ref per character, since
- // each pair is one character. For reading back into
- // Unicode, it matters beginning in Unicode 3.1 ...
- }
- break;
- }
- if (i != first)
- rawWrite (buf, off + first, i - first);
- first = i + 1;
- if (esc == eol)
- newline ();
- else {
- rawWrite ('&');
- rawWrite (esc);
- rawWrite (';');
- }
- }
- if (first < len)
- rawWrite (buf, off + first, len - first);
+ if ((c > 0xfffd)
+ || ((c < 0x0020) && !((c == 0x0009)
+ || (c == 0x000A) || (c == 0x000D)))
+ || (((c & dangerMask) != 0)
+ && (code == CTX_UNPARSED))) {
+
+ // if case (b) in CDATA, we might end the section,
+ // write a reference, then restart ... possible
+ // in one DOM L3 draft.
+
+ throw new CharConversionException (
+ "Illegal or non-writable character: U+"
+ + Integer.toHexString (c));
+ }
+
+ //
+ // If the output encoding represents the character
+ // directly, let it do so! Else we'll escape it.
+ //
+ if ((c & dangerMask) == 0)
+ continue;
+ esc = null;
+
+ // Avoid numeric refs where symbolic ones exist, as
+ // symbolic ones make more sense to humans reading!
+ if (xhtml) {
+ // all the HTMLlat1x.ent entities
+ // (all the "ISO-8859-1" characters)
+ if (c >= 160 && c <= 255)
+ esc = HTMLlat1x [c - 160];
+
+ // not quite half the HTMLsymbolx.ent entities
+ else if (c >= 913 && c <= 937)
+ esc = HTMLsymbolx_GR [c - 913];
+ else if (c >= 945 && c <= 969)
+ esc = HTMLsymbolx_gr [c - 945];
+
+ else switch (c) {
+ // all of the HTMLspecialx.ent entities
+ case 338: esc = "OElig"; break;
+ case 339: esc = "oelig"; break;
+ case 352: esc = "Scaron"; break;
+ case 353: esc = "scaron"; break;
+ case 376: esc = "Yuml"; break;
+ case 710: esc = "circ"; break;
+ case 732: esc = "tilde"; break;
+ case 8194: esc = "ensp"; break;
+ case 8195: esc = "emsp"; break;
+ case 8201: esc = "thinsp"; break;
+ case 8204: esc = "zwnj"; break;
+ case 8205: esc = "zwj"; break;
+ case 8206: esc = "lrm"; break;
+ case 8207: esc = "rlm"; break;
+ case 8211: esc = "ndash"; break;
+ case 8212: esc = "mdash"; break;
+ case 8216: esc = "lsquo"; break;
+ case 8217: esc = "rsquo"; break;
+ case 8218: esc = "sbquo"; break;
+ case 8220: esc = "ldquo"; break;
+ case 8221: esc = "rdquo"; break;
+ case 8222: esc = "bdquo"; break;
+ case 8224: esc = "dagger"; break;
+ case 8225: esc = "Dagger"; break;
+ case 8240: esc = "permil"; break;
+ case 8249: esc = "lsaquo"; break;
+ case 8250: esc = "rsaquo"; break;
+ case 8364: esc = "euro"; break;
+
+ // the other HTMLsymbox.ent entities
+ case 402: esc = "fnof"; break;
+ case 977: esc = "thetasym"; break;
+ case 978: esc = "upsih"; break;
+ case 982: esc = "piv"; break;
+ case 8226: esc = "bull"; break;
+ case 8230: esc = "hellip"; break;
+ case 8242: esc = "prime"; break;
+ case 8243: esc = "Prime"; break;
+ case 8254: esc = "oline"; break;
+ case 8260: esc = "frasl"; break;
+ case 8472: esc = "weierp"; break;
+ case 8465: esc = "image"; break;
+ case 8476: esc = "real"; break;
+ case 8482: esc = "trade"; break;
+ case 8501: esc = "alefsym"; break;
+ case 8592: esc = "larr"; break;
+ case 8593: esc = "uarr"; break;
+ case 8594: esc = "rarr"; break;
+ case 8595: esc = "darr"; break;
+ case 8596: esc = "harr"; break;
+ case 8629: esc = "crarr"; break;
+ case 8656: esc = "lArr"; break;
+ case 8657: esc = "uArr"; break;
+ case 8658: esc = "rArr"; break;
+ case 8659: esc = "dArr"; break;
+ case 8660: esc = "hArr"; break;
+ case 8704: esc = "forall"; break;
+ case 8706: esc = "part"; break;
+ case 8707: esc = "exist"; break;
+ case 8709: esc = "empty"; break;
+ case 8711: esc = "nabla"; break;
+ case 8712: esc = "isin"; break;
+ case 8713: esc = "notin"; break;
+ case 8715: esc = "ni"; break;
+ case 8719: esc = "prod"; break;
+ case 8721: esc = "sum"; break;
+ case 8722: esc = "minus"; break;
+ case 8727: esc = "lowast"; break;
+ case 8730: esc = "radic"; break;
+ case 8733: esc = "prop"; break;
+ case 8734: esc = "infin"; break;
+ case 8736: esc = "ang"; break;
+ case 8743: esc = "and"; break;
+ case 8744: esc = "or"; break;
+ case 8745: esc = "cap"; break;
+ case 8746: esc = "cup"; break;
+ case 8747: esc = "int"; break;
+ case 8756: esc = "there4"; break;
+ case 8764: esc = "sim"; break;
+ case 8773: esc = "cong"; break;
+ case 8776: esc = "asymp"; break;
+ case 8800: esc = "ne"; break;
+ case 8801: esc = "equiv"; break;
+ case 8804: esc = "le"; break;
+ case 8805: esc = "ge"; break;
+ case 8834: esc = "sub"; break;
+ case 8835: esc = "sup"; break;
+ case 8836: esc = "nsub"; break;
+ case 8838: esc = "sube"; break;
+ case 8839: esc = "supe"; break;
+ case 8853: esc = "oplus"; break;
+ case 8855: esc = "otimes"; break;
+ case 8869: esc = "perp"; break;
+ case 8901: esc = "sdot"; break;
+ case 8968: esc = "lceil"; break;
+ case 8969: esc = "rceil"; break;
+ case 8970: esc = "lfloor"; break;
+ case 8971: esc = "rfloor"; break;
+ case 9001: esc = "lang"; break;
+ case 9002: esc = "rang"; break;
+ case 9674: esc = "loz"; break;
+ case 9824: esc = "spades"; break;
+ case 9827: esc = "clubs"; break;
+ case 9829: esc = "hearts"; break;
+ case 9830: esc = "diams"; break;
+ }
+ }
+
+ // else escape with numeric char refs
+ if (esc == null) {
+ stringBuf.setLength (0);
+ stringBuf.append ("#x");
+ stringBuf.append (Integer.toHexString (c).toUpperCase ());
+ esc = stringBuf.toString ();
+
+ // FIXME: We don't write surrogate pairs correctly.
+ // They should work as one ref per character, since
+ // each pair is one character. For reading back into
+ // Unicode, it matters beginning in Unicode 3.1 ...
+ }
+ break;
+ }
+ if (i != first)
+ rawWrite (buf, off + first, i - first);
+ first = i + 1;
+ if (esc == eol)
+ newline ();
+ else {
+ rawWrite ('&');
+ rawWrite (esc);
+ rawWrite (';');
+ }
+ }
+ if (first < len)
+ rawWrite (buf, off + first, len - first);
}
@@ -1808,45 +1808,45 @@ public class XMLWriter
private void newline ()
throws SAXException, IOException
{
- out.write (eol);
- column = 0;
+ out.write (eol);
+ column = 0;
}
private void doIndent ()
throws SAXException, IOException
{
- int space = elementNestLevel * 2;
-
- newline ();
- column = space;
- // track tabs only at line starts
- while (space > 8) {
- out.write ("\t");
- space -= 8;
- }
- while (space > 0) {
- out.write (" ");
- space -= 2;
- }
+ int space = elementNestLevel * 2;
+
+ newline ();
+ column = space;
+ // track tabs only at line starts
+ while (space > 8) {
+ out.write ("\t");
+ space -= 8;
+ }
+ while (space > 0) {
+ out.write (" ");
+ space -= 2;
+ }
}
private void rawWrite (char c)
throws IOException
{
- out.write (c);
- column++;
+ out.write (c);
+ column++;
}
private void rawWrite (String s)
throws SAXException, IOException
{
- if (prettyPrinting && "default".equals (space.peek ())) {
- char data [] = s.toCharArray ();
- rawWrite (data, 0, data.length);
- } else {
- out.write (s);
- column += s.length ();
- }
+ if (prettyPrinting && "default".equals (space.peek ())) {
+ char data [] = s.toCharArray ();
+ rawWrite (data, 0, data.length);
+ } else {
+ out.write (s);
+ column += s.length ();
+ }
}
// NOTE: if xhtml, the REC gives some rules about whitespace
@@ -1862,70 +1862,70 @@ public class XMLWriter
private void rawWrite (char buf [], int offset, int length)
throws SAXException, IOException
{
- boolean wrap;
-
- if (prettyPrinting && space.empty ())
- fatal ("stack discipline", null);
-
- wrap = prettyPrinting && "default".equals (space.peek ());
- if (!wrap) {
- out.write (buf, offset, length);
- column += length;
- return;
- }
-
- // we're pretty printing and want to fill lines out only
- // to the desired line length.
- while (length > 0) {
- int target = lineLength - column;
- boolean wrote = false;
-
- // Do we even have a problem?
- if (target > length || noWrap) {
- out.write (buf, offset, length);
- column += length;
- return;
- }
-
- // break the line at a space character, trying to fill
- // as much of the line as possible.
- char c;
-
- for (int i = target - 1; i >= 0; i--) {
- if ((c = buf [offset + i]) == ' ' || c == '\t') {
- i++;
- out.write (buf, offset, i);
- doIndent ();
- offset += i;
- length -= i;
- wrote = true;
- break;
- }
- }
- if (wrote)
- continue;
-
- // no space character permitting break before target
- // line length is filled. So, take the next one.
- if (target < 0)
- target = 0;
- for (int i = target; i < length; i++)
- if ((c = buf [offset + i]) == ' ' || c == '\t') {
- i++;
- out.write (buf, offset, i);
- doIndent ();
- offset += i;
- length -= i;
- wrote = true;
- break;
- }
- if (wrote)
- continue;
-
- // no such luck.
- out.write (buf, offset, length);
- column += length;
- break;
- }
+ boolean wrap;
+
+ if (prettyPrinting && space.empty ())
+ fatal ("stack discipline", null);
+
+ wrap = prettyPrinting && "default".equals (space.peek ());
+ if (!wrap) {
+ out.write (buf, offset, length);
+ column += length;
+ return;
+ }
+
+ // we're pretty printing and want to fill lines out only
+ // to the desired line length.
+ while (length > 0) {
+ int target = lineLength - column;
+ boolean wrote = false;
+
+ // Do we even have a problem?
+ if (target > length || noWrap) {
+ out.write (buf, offset, length);
+ column += length;
+ return;
+ }
+
+ // break the line at a space character, trying to fill
+ // as much of the line as possible.
+ char c;
+
+ for (int i = target - 1; i >= 0; i--) {
+ if ((c = buf [offset + i]) == ' ' || c == '\t') {
+ i++;
+ out.write (buf, offset, i);
+ doIndent ();
+ offset += i;
+ length -= i;
+ wrote = true;
+ break;
+ }
+ }
+ if (wrote)
+ continue;
+
+ // no space character permitting break before target
+ // line length is filled. So, take the next one.
+ if (target < 0)
+ target = 0;
+ for (int i = target; i < length; i++)
+ if ((c = buf [offset + i]) == ' ' || c == '\t') {
+ i++;
+ out.write (buf, offset, i);
+ doIndent ();
+ offset += i;
+ length -= i;
+ wrote = true;
+ break;
+ }
+ if (wrote)
+ continue;
+
+ // no such luck.
+ out.write (buf, offset, length);
+ column += length;
+ break;
+ }
}
}
diff --git a/gnu/xml/validation/datatype/Annotation.java b/gnu/xml/validation/datatype/Annotation.java
index cba6954b6..6438e2ebb 100644
--- a/gnu/xml/validation/datatype/Annotation.java
+++ b/gnu/xml/validation/datatype/Annotation.java
@@ -1,4 +1,4 @@
-/* Annotation.java --
+/* Annotation.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,6 +56,5 @@ public class Annotation
{
return documentation;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/AnySimpleType.java b/gnu/xml/validation/datatype/AnySimpleType.java
index 63441c70a..36fb98daa 100644
--- a/gnu/xml/validation/datatype/AnySimpleType.java
+++ b/gnu/xml/validation/datatype/AnySimpleType.java
@@ -1,4 +1,4 @@
-/* AnySimpleType.java --
+/* AnySimpleType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import javax.xml.namespace.QName;
final class AnySimpleType
extends SimpleType
{
-
+
AnySimpleType()
{
super(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "anySimpleType"),
@@ -56,4 +56,3 @@ final class AnySimpleType
}
}
-
diff --git a/gnu/xml/validation/datatype/AnyType.java b/gnu/xml/validation/datatype/AnyType.java
index f26a0756d..2a3f116dd 100644
--- a/gnu/xml/validation/datatype/AnyType.java
+++ b/gnu/xml/validation/datatype/AnyType.java
@@ -1,4 +1,4 @@
-/* AnyType.java --
+/* AnyType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ import javax.xml.namespace.QName;
final class AnyType
extends SimpleType
{
-
+
AnyType()
{
super(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "anyType"),
@@ -55,4 +55,3 @@ final class AnyType
}
}
-
diff --git a/gnu/xml/validation/datatype/AnyURIType.java b/gnu/xml/validation/datatype/AnyURIType.java
index 56c0a0658..ef409b99c 100644
--- a/gnu/xml/validation/datatype/AnyURIType.java
+++ b/gnu/xml/validation/datatype/AnyURIType.java
@@ -1,4 +1,4 @@
-/* AnyURIType.java --
+/* AnyURIType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -89,6 +89,5 @@ final class AnyURIType
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/AtomicSimpleType.java b/gnu/xml/validation/datatype/AtomicSimpleType.java
index d685e5cf0..38528eecf 100644
--- a/gnu/xml/validation/datatype/AtomicSimpleType.java
+++ b/gnu/xml/validation/datatype/AtomicSimpleType.java
@@ -1,4 +1,4 @@
-/* AtomicSimpleType.java --
+/* AtomicSimpleType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ import org.relaxng.datatype.ValidationContext;
public class AtomicSimpleType
extends SimpleType
{
-
+
public AtomicSimpleType(QName name,
Set facets,
int fundamentalFacets,
@@ -73,6 +73,5 @@ public class AtomicSimpleType
if (baseType != null)
baseType.checkValid(value, context);
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/Base64BinaryType.java b/gnu/xml/validation/datatype/Base64BinaryType.java
index 2fc4c33b9..3f3442f8c 100644
--- a/gnu/xml/validation/datatype/Base64BinaryType.java
+++ b/gnu/xml/validation/datatype/Base64BinaryType.java
@@ -1,4 +1,4 @@
-/* Base64BinaryType.java --
+/* Base64BinaryType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -98,7 +98,7 @@ final class Base64BinaryType
char c1 = value.charAt(i--);
if (c1 == ' ')
c1 = value.charAt(i--);
-
+
if (c4 == '=')
{
if (c3 == '=')
@@ -124,6 +124,5 @@ final class Base64BinaryType
throw new DatatypeException("illegal BASE64");
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/BooleanType.java b/gnu/xml/validation/datatype/BooleanType.java
index 25e488a05..5d98d2412 100644
--- a/gnu/xml/validation/datatype/BooleanType.java
+++ b/gnu/xml/validation/datatype/BooleanType.java
@@ -1,4 +1,4 @@
-/* BooleanType.java --
+/* BooleanType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,11 +80,10 @@ final class BooleanType
if (!VALUE_SPACE.contains(value))
throw new DatatypeException("invalid boolean value");
}
-
+
public Object createValue(String literal, ValidationContext context) {
return ("1".equals(literal) || "true".equals(literal)) ? Boolean.TRUE :
Boolean.FALSE;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/ByteType.java b/gnu/xml/validation/datatype/ByteType.java
index 539dba29a..9bce45bf9 100644
--- a/gnu/xml/validation/datatype/ByteType.java
+++ b/gnu/xml/validation/datatype/ByteType.java
@@ -1,4 +1,4 @@
-/* ByteType.java --
+/* ByteType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -117,7 +117,7 @@ final class ByteType
throw new DatatypeException(i, "invalid byte value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -128,6 +128,5 @@ final class ByteType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/DateTimeType.java b/gnu/xml/validation/datatype/DateTimeType.java
index 749ba8106..81d2785bc 100644
--- a/gnu/xml/validation/datatype/DateTimeType.java
+++ b/gnu/xml/validation/datatype/DateTimeType.java
@@ -1,4 +1,4 @@
-/* DateTimeType.java --
+/* DateTimeType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -213,7 +213,7 @@ final class DateTimeType
throw new DatatypeException(len, "invalid dateTime value");
}
}
-
+
public Object createValue(String value, ValidationContext context) {
int len = value.length();
int state = 0;
@@ -330,6 +330,5 @@ final class DateTimeType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/DateType.java b/gnu/xml/validation/datatype/DateType.java
index 6a4e1d771..8e6e3c35a 100644
--- a/gnu/xml/validation/datatype/DateType.java
+++ b/gnu/xml/validation/datatype/DateType.java
@@ -1,4 +1,4 @@
-/* DateType.java --
+/* DateType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -128,7 +128,7 @@ final class DateType
throw new DatatypeException("invalid date value");
}
}
-
+
public Object createValue(String value, ValidationContext context) {
int len = value.length();
int state = 0;
@@ -217,6 +217,5 @@ final class DateType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/DecimalType.java b/gnu/xml/validation/datatype/DecimalType.java
index b895c44b2..43a26a399 100644
--- a/gnu/xml/validation/datatype/DecimalType.java
+++ b/gnu/xml/validation/datatype/DecimalType.java
@@ -1,4 +1,4 @@
-/* DecimalType.java --
+/* DecimalType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -103,7 +103,7 @@ final class DecimalType
throw new DatatypeException(i, "invalid decimal value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -114,6 +114,5 @@ final class DecimalType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/DoubleType.java b/gnu/xml/validation/datatype/DoubleType.java
index 5d2d8662d..dfaa7c8cb 100644
--- a/gnu/xml/validation/datatype/DoubleType.java
+++ b/gnu/xml/validation/datatype/DoubleType.java
@@ -1,4 +1,4 @@
-/* DoubleType.java --
+/* DoubleType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -95,7 +95,7 @@ final class DoubleType
throw e2;
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -106,6 +106,5 @@ final class DoubleType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/DurationType.java b/gnu/xml/validation/datatype/DurationType.java
index 2cb92baae..6c0f7b889 100644
--- a/gnu/xml/validation/datatype/DurationType.java
+++ b/gnu/xml/validation/datatype/DurationType.java
@@ -1,4 +1,4 @@
-/* DurationType.java --
+/* DurationType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -103,7 +103,7 @@ final class DurationType
}
return 0;
}
-
+
}
static final int[] CONSTRAINING_FACETS = {
@@ -170,7 +170,7 @@ final class DurationType
throw new DatatypeException(i, "illegal duration value");
}
}
-
+
public Object createValue(String value, ValidationContext context) {
boolean negative = false;
int days = 0, months = 0, years = 0;
@@ -236,4 +236,3 @@ final class DurationType
}
}
-
diff --git a/gnu/xml/validation/datatype/EntitiesType.java b/gnu/xml/validation/datatype/EntitiesType.java
index d16106e00..5415e88e2 100644
--- a/gnu/xml/validation/datatype/EntitiesType.java
+++ b/gnu/xml/validation/datatype/EntitiesType.java
@@ -1,4 +1,4 @@
-/* EntitiesType.java --
+/* EntitiesType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -104,6 +104,5 @@ final class EntitiesType
{
return true;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/EntityType.java b/gnu/xml/validation/datatype/EntityType.java
index f1443bcb9..f4a10bd50 100644
--- a/gnu/xml/validation/datatype/EntityType.java
+++ b/gnu/xml/validation/datatype/EntityType.java
@@ -1,4 +1,4 @@
-/* EntityType.java --
+/* EntityType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -83,6 +83,5 @@ final class EntityType
{
return true;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/EnumerationFacet.java b/gnu/xml/validation/datatype/EnumerationFacet.java
index 0ad3d3fa4..45b9c2378 100644
--- a/gnu/xml/validation/datatype/EnumerationFacet.java
+++ b/gnu/xml/validation/datatype/EnumerationFacet.java
@@ -1,4 +1,4 @@
-/* EnumerationFacet.java --
+/* EnumerationFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package gnu.xml.validation.datatype;
public final class EnumerationFacet
extends Facet
{
-
+
public final String value;
public EnumerationFacet(String value, Annotation annotation)
@@ -64,6 +64,5 @@ public final class EnumerationFacet
return (other instanceof EnumerationFacet &&
((EnumerationFacet) other).value.equals(value));
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/Facet.java b/gnu/xml/validation/datatype/Facet.java
index 490abf8ee..9f18bedc8 100644
--- a/gnu/xml/validation/datatype/Facet.java
+++ b/gnu/xml/validation/datatype/Facet.java
@@ -1,4 +1,4 @@
-/* Facet.java --
+/* Facet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -73,6 +73,5 @@ public abstract class Facet
this.type = type;
this.annotation = annotation;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/FloatType.java b/gnu/xml/validation/datatype/FloatType.java
index 372e38871..8dbb4aa56 100644
--- a/gnu/xml/validation/datatype/FloatType.java
+++ b/gnu/xml/validation/datatype/FloatType.java
@@ -1,4 +1,4 @@
-/* FloatType.java --
+/* FloatType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -95,7 +95,7 @@ final class FloatType
throw e2;
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -106,6 +106,5 @@ final class FloatType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/FractionDigitsFacet.java b/gnu/xml/validation/datatype/FractionDigitsFacet.java
index efd986200..c0d714578 100644
--- a/gnu/xml/validation/datatype/FractionDigitsFacet.java
+++ b/gnu/xml/validation/datatype/FractionDigitsFacet.java
@@ -1,4 +1,4 @@
-/* FractionDigitsFacet.java --
+/* FractionDigitsFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package gnu.xml.validation.datatype;
public final class FractionDigitsFacet
extends Facet
{
-
+
public final int value;
public final boolean fixed;
@@ -56,7 +56,7 @@ public final class FractionDigitsFacet
this.value = value;
this.fixed = fixed;
}
-
+
public int hashCode()
{
return value;
@@ -67,6 +67,5 @@ public final class FractionDigitsFacet
return (other instanceof FractionDigitsFacet &&
((FractionDigitsFacet) other).value == value);
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/GDayType.java b/gnu/xml/validation/datatype/GDayType.java
index 009af3585..cc6b8e3d4 100644
--- a/gnu/xml/validation/datatype/GDayType.java
+++ b/gnu/xml/validation/datatype/GDayType.java
@@ -1,4 +1,4 @@
-/* GDayType.java --
+/* GDayType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,7 +80,7 @@ final class GDayType
}
return 0;
}
-
+
}
static final int[] CONSTRAINING_FACETS = {
@@ -157,7 +157,7 @@ final class GDayType
throw new DatatypeException("invalid GDay value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -170,6 +170,5 @@ final class GDayType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/GMonthDayType.java b/gnu/xml/validation/datatype/GMonthDayType.java
index a39a1cc43..d293d9b57 100644
--- a/gnu/xml/validation/datatype/GMonthDayType.java
+++ b/gnu/xml/validation/datatype/GMonthDayType.java
@@ -1,4 +1,4 @@
-/* GMonthDayType.java --
+/* GMonthDayType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -88,7 +88,7 @@ final class GMonthDayType
}
return 0;
}
-
+
}
static final int[] CONSTRAINING_FACETS = {
@@ -165,7 +165,7 @@ final class GMonthDayType
throw new DatatypeException("illegal GMonthDay type");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -179,6 +179,5 @@ final class GMonthDayType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/GMonthType.java b/gnu/xml/validation/datatype/GMonthType.java
index 5a08af287..9450874b9 100644
--- a/gnu/xml/validation/datatype/GMonthType.java
+++ b/gnu/xml/validation/datatype/GMonthType.java
@@ -1,4 +1,4 @@
-/* GMonthType.java --
+/* GMonthType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,7 +80,7 @@ final class GMonthType
}
return 0;
}
-
+
}
static final int[] CONSTRAINING_FACETS = {
@@ -146,7 +146,7 @@ final class GMonthType
throw new DatatypeException("illegal GMonth value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -159,6 +159,5 @@ final class GMonthType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/GYearMonthType.java b/gnu/xml/validation/datatype/GYearMonthType.java
index 9ec38c0e7..9aabfb61c 100644
--- a/gnu/xml/validation/datatype/GYearMonthType.java
+++ b/gnu/xml/validation/datatype/GYearMonthType.java
@@ -1,4 +1,4 @@
-/* GYearMonthType.java --
+/* GYearMonthType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -88,7 +88,7 @@ final class GYearMonthType
}
return 0;
}
-
+
}
static final int[] CONSTRAINING_FACETS = {
@@ -155,7 +155,7 @@ final class GYearMonthType
throw new DatatypeException("illegal GYear value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -172,6 +172,5 @@ final class GYearMonthType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/GYearType.java b/gnu/xml/validation/datatype/GYearType.java
index 6dea89b76..5b1e03232 100644
--- a/gnu/xml/validation/datatype/GYearType.java
+++ b/gnu/xml/validation/datatype/GYearType.java
@@ -1,4 +1,4 @@
-/* GYearType.java --
+/* GYearType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,7 +80,7 @@ final class GYearType
}
return 0;
}
-
+
}
static final int[] CONSTRAINING_FACETS = {
@@ -134,7 +134,7 @@ final class GYearType
throw new DatatypeException("invalid GYear value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -147,6 +147,5 @@ final class GYearType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/HexBinaryType.java b/gnu/xml/validation/datatype/HexBinaryType.java
index 8a92b15f6..5f133e322 100644
--- a/gnu/xml/validation/datatype/HexBinaryType.java
+++ b/gnu/xml/validation/datatype/HexBinaryType.java
@@ -1,4 +1,4 @@
-/* HexBinaryType.java --
+/* HexBinaryType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -85,6 +85,5 @@ final class HexBinaryType
throw new DatatypeException(i, "invalid hexBinary value");
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/IDRefType.java b/gnu/xml/validation/datatype/IDRefType.java
index 8ea9805b0..932089549 100644
--- a/gnu/xml/validation/datatype/IDRefType.java
+++ b/gnu/xml/validation/datatype/IDRefType.java
@@ -1,4 +1,4 @@
-/* IDRefType.java --
+/* IDRefType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -82,6 +82,5 @@ final class IDRefType
{
return ID_TYPE_IDREF;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/IDRefsType.java b/gnu/xml/validation/datatype/IDRefsType.java
index 57f7e56d7..6adaed13b 100644
--- a/gnu/xml/validation/datatype/IDRefsType.java
+++ b/gnu/xml/validation/datatype/IDRefsType.java
@@ -1,4 +1,4 @@
-/* IDRefsType.java --
+/* IDRefsType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -82,6 +82,5 @@ final class IDRefsType
{
return ID_TYPE_IDREFS;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/IDType.java b/gnu/xml/validation/datatype/IDType.java
index c55601aaf..792601d78 100644
--- a/gnu/xml/validation/datatype/IDType.java
+++ b/gnu/xml/validation/datatype/IDType.java
@@ -1,4 +1,4 @@
-/* IDType.java --
+/* IDType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -82,6 +82,5 @@ final class IDType
{
return ID_TYPE_ID;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/IntType.java b/gnu/xml/validation/datatype/IntType.java
index 6bf786604..c8f756832 100644
--- a/gnu/xml/validation/datatype/IntType.java
+++ b/gnu/xml/validation/datatype/IntType.java
@@ -1,4 +1,4 @@
-/* IntType.java --
+/* IntType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -117,7 +117,7 @@ final class IntType
throw new DatatypeException(i, "invalid int value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -128,6 +128,5 @@ final class IntType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/IntegerType.java b/gnu/xml/validation/datatype/IntegerType.java
index 2098a7d8d..b9a2a564a 100644
--- a/gnu/xml/validation/datatype/IntegerType.java
+++ b/gnu/xml/validation/datatype/IntegerType.java
@@ -1,4 +1,4 @@
-/* IntegerType.java --
+/* IntegerType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -94,7 +94,7 @@ final class IntegerType
throw new DatatypeException(i, "invalid integer value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -105,6 +105,5 @@ final class IntegerType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/LanguageType.java b/gnu/xml/validation/datatype/LanguageType.java
index 3df903c48..d30cc538f 100644
--- a/gnu/xml/validation/datatype/LanguageType.java
+++ b/gnu/xml/validation/datatype/LanguageType.java
@@ -1,4 +1,4 @@
-/* LanguageType.java --
+/* LanguageType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -82,6 +82,5 @@ final class LanguageType
if (!PATTERN.matcher(value).matches())
throw new DatatypeException("invalid language value");
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/LengthFacet.java b/gnu/xml/validation/datatype/LengthFacet.java
index cab4496b1..d6eaacd71 100644
--- a/gnu/xml/validation/datatype/LengthFacet.java
+++ b/gnu/xml/validation/datatype/LengthFacet.java
@@ -1,4 +1,4 @@
-/* LengthFacet.java --
+/* LengthFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package gnu.xml.validation.datatype;
public final class LengthFacet
extends Facet
{
-
+
public final int value;
public final boolean fixed;
@@ -56,7 +56,7 @@ public final class LengthFacet
this.value = value;
this.fixed = fixed;
}
-
+
public int hashCode()
{
return value;
@@ -67,6 +67,5 @@ public final class LengthFacet
return (other instanceof LengthFacet &&
((LengthFacet) other).value == value);
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/ListSimpleType.java b/gnu/xml/validation/datatype/ListSimpleType.java
index 1f0cb76fa..1e0d41d01 100644
--- a/gnu/xml/validation/datatype/ListSimpleType.java
+++ b/gnu/xml/validation/datatype/ListSimpleType.java
@@ -1,4 +1,4 @@
-/* ListSimpleType.java --
+/* ListSimpleType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,7 +56,7 @@ public class ListSimpleType
* The type of the items in this list (atomic or union).
*/
public final SimpleType itemType;
-
+
public ListSimpleType(QName name, Set facets,
int fundamentalFacets, SimpleType baseType,
Annotation annotation, SimpleType itemType)
@@ -64,7 +64,7 @@ public class ListSimpleType
super(name, LIST, facets, fundamentalFacets, baseType, annotation);
this.itemType = itemType;
}
-
+
public void checkValid(String value, ValidationContext context)
throws DatatypeException
{
@@ -78,6 +78,5 @@ public class ListSimpleType
itemType.checkValid(token, context);
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/LongType.java b/gnu/xml/validation/datatype/LongType.java
index eaf69df38..781b17f62 100644
--- a/gnu/xml/validation/datatype/LongType.java
+++ b/gnu/xml/validation/datatype/LongType.java
@@ -1,4 +1,4 @@
-/* LongType.java --
+/* LongType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -117,7 +117,7 @@ final class LongType
throw new DatatypeException(i, "invalid long value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -128,6 +128,5 @@ final class LongType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/MaxExclusiveFacet.java b/gnu/xml/validation/datatype/MaxExclusiveFacet.java
index 7aac1f743..90e940371 100644
--- a/gnu/xml/validation/datatype/MaxExclusiveFacet.java
+++ b/gnu/xml/validation/datatype/MaxExclusiveFacet.java
@@ -1,4 +1,4 @@
-/* MaxExclusiveFacet.java --
+/* MaxExclusiveFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ import java.util.Date;
public final class MaxExclusiveFacet
extends Facet
{
-
+
public final Object value; // date or number
public final boolean fixed;
@@ -60,7 +60,7 @@ public final class MaxExclusiveFacet
this.value = value;
this.fixed = fixed;
}
-
+
public int hashCode()
{
return value.hashCode();
@@ -106,6 +106,5 @@ public final class MaxExclusiveFacet
return false;
return ((Number) test).doubleValue() < nvalue.doubleValue();
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/MaxInclusiveFacet.java b/gnu/xml/validation/datatype/MaxInclusiveFacet.java
index bb145ed41..c260113da 100644
--- a/gnu/xml/validation/datatype/MaxInclusiveFacet.java
+++ b/gnu/xml/validation/datatype/MaxInclusiveFacet.java
@@ -1,4 +1,4 @@
-/* MaxInclusiveFacet.java --
+/* MaxInclusiveFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ import java.util.Date;
public final class MaxInclusiveFacet
extends Facet
{
-
+
public final Object value;
public final boolean fixed;
@@ -60,7 +60,7 @@ public final class MaxInclusiveFacet
this.value = value;
this.fixed = fixed;
}
-
+
public int hashCode()
{
return value.hashCode();
@@ -71,7 +71,7 @@ public final class MaxInclusiveFacet
return (other instanceof MaxInclusiveFacet &&
((MaxInclusiveFacet) other).value.equals(value));
}
-
+
boolean matches(Object test)
{
if (value instanceof Date)
@@ -107,6 +107,5 @@ public final class MaxInclusiveFacet
return false;
return ((Number) test).doubleValue() <= nvalue.doubleValue();
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/MaxLengthFacet.java b/gnu/xml/validation/datatype/MaxLengthFacet.java
index d03326311..ba77ff2df 100644
--- a/gnu/xml/validation/datatype/MaxLengthFacet.java
+++ b/gnu/xml/validation/datatype/MaxLengthFacet.java
@@ -1,4 +1,4 @@
-/* MaxLengthFacet.java --
+/* MaxLengthFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,6 +67,5 @@ public final class MaxLengthFacet
return (other instanceof MaxLengthFacet &&
((MaxLengthFacet) other).value == value);
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/MinExclusiveFacet.java b/gnu/xml/validation/datatype/MinExclusiveFacet.java
index 2289bb11c..a779d09d8 100644
--- a/gnu/xml/validation/datatype/MinExclusiveFacet.java
+++ b/gnu/xml/validation/datatype/MinExclusiveFacet.java
@@ -1,4 +1,4 @@
-/* MinExclusiveFacet.java --
+/* MinExclusiveFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ import java.util.Date;
public final class MinExclusiveFacet
extends Facet
{
-
+
public final Object value;
public final boolean fixed;
@@ -60,7 +60,7 @@ public final class MinExclusiveFacet
this.value = value;
this.fixed = fixed;
}
-
+
public int hashCode()
{
return value.hashCode();
@@ -71,7 +71,7 @@ public final class MinExclusiveFacet
return (other instanceof MinExclusiveFacet &&
((MinExclusiveFacet) other).value.equals(value));
}
-
+
boolean matches(Object test)
{
if (value instanceof Date)
@@ -106,6 +106,5 @@ public final class MinExclusiveFacet
return false;
return ((Number) test).doubleValue() > nvalue.doubleValue();
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/MinInclusiveFacet.java b/gnu/xml/validation/datatype/MinInclusiveFacet.java
index 6c07c3644..6138c9af8 100644
--- a/gnu/xml/validation/datatype/MinInclusiveFacet.java
+++ b/gnu/xml/validation/datatype/MinInclusiveFacet.java
@@ -1,4 +1,4 @@
-/* MinInclusiveFacet.java --
+/* MinInclusiveFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ import java.util.Date;
public final class MinInclusiveFacet
extends Facet
{
-
+
public final Object value;
public final boolean fixed;
@@ -60,7 +60,7 @@ public final class MinInclusiveFacet
this.value = value;
this.fixed = fixed;
}
-
+
public int hashCode()
{
return value.hashCode();
@@ -71,7 +71,7 @@ public final class MinInclusiveFacet
return (other instanceof MinInclusiveFacet &&
((MinInclusiveFacet) other).value.equals(value));
}
-
+
boolean matches(Object test)
{
if (value instanceof Date)
@@ -107,6 +107,5 @@ public final class MinInclusiveFacet
return false;
return ((Number) test).doubleValue() >= nvalue.doubleValue();
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/MinLengthFacet.java b/gnu/xml/validation/datatype/MinLengthFacet.java
index c7dee200b..f13e80b62 100644
--- a/gnu/xml/validation/datatype/MinLengthFacet.java
+++ b/gnu/xml/validation/datatype/MinLengthFacet.java
@@ -1,4 +1,4 @@
-/* MinLengthFacet.java --
+/* MinLengthFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,6 +67,5 @@ public final class MinLengthFacet
return (other instanceof MinLengthFacet &&
((MinLengthFacet) other).value == value);
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/NCNameType.java b/gnu/xml/validation/datatype/NCNameType.java
index 4188d886a..3f2088f9b 100644
--- a/gnu/xml/validation/datatype/NCNameType.java
+++ b/gnu/xml/validation/datatype/NCNameType.java
@@ -1,4 +1,4 @@
-/* NCNameType.java --
+/* NCNameType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -106,6 +106,5 @@ final class NCNameType
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/NMTokenType.java b/gnu/xml/validation/datatype/NMTokenType.java
index 4498fecfa..ca3271fef 100644
--- a/gnu/xml/validation/datatype/NMTokenType.java
+++ b/gnu/xml/validation/datatype/NMTokenType.java
@@ -1,4 +1,4 @@
-/* NMTokenType.java --
+/* NMTokenType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -97,6 +97,5 @@ final class NMTokenType
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/NMTokensType.java b/gnu/xml/validation/datatype/NMTokensType.java
index d49964561..388b451db 100644
--- a/gnu/xml/validation/datatype/NMTokensType.java
+++ b/gnu/xml/validation/datatype/NMTokensType.java
@@ -1,4 +1,4 @@
-/* NMTokensType.java --
+/* NMTokensType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -120,7 +120,6 @@ final class NMTokensType
throw e2;
}
}
-
-
-}
+
+}
diff --git a/gnu/xml/validation/datatype/NameType.java b/gnu/xml/validation/datatype/NameType.java
index a2fbb9d5b..70349aed8 100644
--- a/gnu/xml/validation/datatype/NameType.java
+++ b/gnu/xml/validation/datatype/NameType.java
@@ -1,4 +1,4 @@
-/* NameType.java --
+/* NameType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -99,6 +99,5 @@ final class NameType
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/NegativeIntegerType.java b/gnu/xml/validation/datatype/NegativeIntegerType.java
index fd436cb55..1e6439c99 100644
--- a/gnu/xml/validation/datatype/NegativeIntegerType.java
+++ b/gnu/xml/validation/datatype/NegativeIntegerType.java
@@ -1,4 +1,4 @@
-/* NegativeIntegerType.java --
+/* NegativeIntegerType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -95,7 +95,7 @@ final class NegativeIntegerType
throw new DatatypeException(i, "invalid negative integer value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -106,6 +106,5 @@ final class NegativeIntegerType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/NonNegativeIntegerType.java b/gnu/xml/validation/datatype/NonNegativeIntegerType.java
index 857778582..c5192f346 100644
--- a/gnu/xml/validation/datatype/NonNegativeIntegerType.java
+++ b/gnu/xml/validation/datatype/NonNegativeIntegerType.java
@@ -1,4 +1,4 @@
-/* NonNegativeIntegerType.java --
+/* NonNegativeIntegerType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -105,7 +105,7 @@ final class NonNegativeIntegerType
throw new DatatypeException(i, "invalid non-negative integer value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -116,6 +116,5 @@ final class NonNegativeIntegerType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/NonPositiveIntegerType.java b/gnu/xml/validation/datatype/NonPositiveIntegerType.java
index 0b43d5227..e418c0615 100644
--- a/gnu/xml/validation/datatype/NonPositiveIntegerType.java
+++ b/gnu/xml/validation/datatype/NonPositiveIntegerType.java
@@ -1,4 +1,4 @@
-/* NonPositiveIntegerType.java --
+/* NonPositiveIntegerType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -105,7 +105,7 @@ final class NonPositiveIntegerType
throw new DatatypeException(i, "invalid non-positive integer value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -116,6 +116,5 @@ final class NonPositiveIntegerType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/NormalizedStringType.java b/gnu/xml/validation/datatype/NormalizedStringType.java
index a74312d11..9009f648a 100644
--- a/gnu/xml/validation/datatype/NormalizedStringType.java
+++ b/gnu/xml/validation/datatype/NormalizedStringType.java
@@ -1,4 +1,4 @@
-/* NormalizedStringType.java --
+/* NormalizedStringType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -83,6 +83,5 @@ final class NormalizedStringType
throw new DatatypeException(i, "invalid normalized-string value");
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/NotationType.java b/gnu/xml/validation/datatype/NotationType.java
index e9d7c9fda..b661cb4e1 100644
--- a/gnu/xml/validation/datatype/NotationType.java
+++ b/gnu/xml/validation/datatype/NotationType.java
@@ -1,4 +1,4 @@
-/* NotationType.java --
+/* NotationType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -83,6 +83,5 @@ final class NotationType
{
return true;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/PatternFacet.java b/gnu/xml/validation/datatype/PatternFacet.java
index d594b26b9..9c1cb7e30 100644
--- a/gnu/xml/validation/datatype/PatternFacet.java
+++ b/gnu/xml/validation/datatype/PatternFacet.java
@@ -1,4 +1,4 @@
-/* PatternFacet.java --
+/* PatternFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -66,6 +66,5 @@ public final class PatternFacet
return (other instanceof PatternFacet &&
((PatternFacet) other).value.equals(value));
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/PositiveIntegerType.java b/gnu/xml/validation/datatype/PositiveIntegerType.java
index 0c10df3ab..15d0febfc 100644
--- a/gnu/xml/validation/datatype/PositiveIntegerType.java
+++ b/gnu/xml/validation/datatype/PositiveIntegerType.java
@@ -1,4 +1,4 @@
-/* PositiveIntegerType.java --
+/* PositiveIntegerType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -95,7 +95,7 @@ final class PositiveIntegerType
throw new DatatypeException(i, "invalid positive integer value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -106,6 +106,5 @@ final class PositiveIntegerType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/QNameType.java b/gnu/xml/validation/datatype/QNameType.java
index 1eaa51895..bdc40c97f 100644
--- a/gnu/xml/validation/datatype/QNameType.java
+++ b/gnu/xml/validation/datatype/QNameType.java
@@ -1,4 +1,4 @@
-/* QNameType.java --
+/* QNameType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -117,6 +117,5 @@ final class QNameType
{
return true;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/ShortType.java b/gnu/xml/validation/datatype/ShortType.java
index 3179c8dae..43255571d 100644
--- a/gnu/xml/validation/datatype/ShortType.java
+++ b/gnu/xml/validation/datatype/ShortType.java
@@ -1,4 +1,4 @@
-/* ShortType.java --
+/* ShortType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -117,7 +117,7 @@ final class ShortType
throw new DatatypeException(i, "invalid short value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -128,6 +128,5 @@ final class ShortType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/SimpleType.java b/gnu/xml/validation/datatype/SimpleType.java
index 1b8479922..1233723bd 100644
--- a/gnu/xml/validation/datatype/SimpleType.java
+++ b/gnu/xml/validation/datatype/SimpleType.java
@@ -1,4 +1,4 @@
-/* SimpleType.java --
+/* SimpleType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,12 +60,12 @@ public class SimpleType
* The variety of the <code>anySimpleType</code> datatype.
*/
public static final int ANY = 0;
-
+
/**
* The atomic variety.
*/
public static final int ATOMIC = 1;
-
+
/**
* The list variety.
*/
@@ -229,15 +229,15 @@ public class SimpleType
{
throw new UnsupportedOperationException();
}
-
+
public Object createValue(String literal, ValidationContext context) {
return literal;
}
-
+
public boolean sameValue(Object value1, Object value2) {
return value1.equals(value2);
}
-
+
public int valueHashCode(Object value) {
return value.hashCode();
}
@@ -253,4 +253,3 @@ public class SimpleType
}
}
-
diff --git a/gnu/xml/validation/datatype/StringType.java b/gnu/xml/validation/datatype/StringType.java
index 593c265dc..e20d1b87e 100644
--- a/gnu/xml/validation/datatype/StringType.java
+++ b/gnu/xml/validation/datatype/StringType.java
@@ -1,4 +1,4 @@
-/* StringType.java --
+/* StringType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,4 +70,3 @@ final class StringType
}
}
-
diff --git a/gnu/xml/validation/datatype/TimeType.java b/gnu/xml/validation/datatype/TimeType.java
index 0152e1171..83ada5bc6 100644
--- a/gnu/xml/validation/datatype/TimeType.java
+++ b/gnu/xml/validation/datatype/TimeType.java
@@ -1,4 +1,4 @@
-/* TimeType.java --
+/* TimeType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -86,7 +86,7 @@ final class TimeType
}
return 0;
}
-
+
}
static final int[] CONSTRAINING_FACETS = {
@@ -217,7 +217,7 @@ final class TimeType
throw new DatatypeException(len, "invalid time value");
}
}
-
+
public Object createValue(String value, ValidationContext context) {
int len = value.length();
int state = 3;
@@ -298,6 +298,5 @@ final class TimeType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/TokenType.java b/gnu/xml/validation/datatype/TokenType.java
index 18e1e8ad5..dfe5f14ce 100644
--- a/gnu/xml/validation/datatype/TokenType.java
+++ b/gnu/xml/validation/datatype/TokenType.java
@@ -1,4 +1,4 @@
-/* TokenType.java --
+/* TokenType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -91,6 +91,5 @@ final class TokenType
last = c;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/TotalDigitsFacet.java b/gnu/xml/validation/datatype/TotalDigitsFacet.java
index 4debc638e..25b50cd6f 100644
--- a/gnu/xml/validation/datatype/TotalDigitsFacet.java
+++ b/gnu/xml/validation/datatype/TotalDigitsFacet.java
@@ -1,4 +1,4 @@
-/* TotalDigitsFacet.java --
+/* TotalDigitsFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package gnu.xml.validation.datatype;
public final class TotalDigitsFacet
extends Facet
{
-
+
public final int value;
public final boolean fixed;
@@ -56,7 +56,7 @@ public final class TotalDigitsFacet
this.value = value;
this.fixed = fixed;
}
-
+
public int hashCode()
{
return value;
@@ -67,6 +67,5 @@ public final class TotalDigitsFacet
return (other instanceof TotalDigitsFacet &&
((TotalDigitsFacet) other).value == value);
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/Type.java b/gnu/xml/validation/datatype/Type.java
index be6f0a0b4..ebd650933 100644
--- a/gnu/xml/validation/datatype/Type.java
+++ b/gnu/xml/validation/datatype/Type.java
@@ -1,4 +1,4 @@
-/* Type.java --
+/* Type.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,6 +58,5 @@ public abstract class Type
{
this.name = name;
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/TypeBuilder.java b/gnu/xml/validation/datatype/TypeBuilder.java
index 054eb8a55..087333153 100644
--- a/gnu/xml/validation/datatype/TypeBuilder.java
+++ b/gnu/xml/validation/datatype/TypeBuilder.java
@@ -1,4 +1,4 @@
-/* TypeBuilder.java --
+/* TypeBuilder.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,7 +54,7 @@ public class TypeBuilder
{
final SimpleType type;
-
+
TypeBuilder(SimpleType type)
{
this.type = type;
@@ -136,7 +136,7 @@ public class TypeBuilder
}
return new MaxLengthFacet(Integer.parseInt(value), fixed, null);
}
-
+
PatternFacet parsePatternFacet(String value)
throws DatatypeException
{
@@ -185,7 +185,7 @@ public class TypeBuilder
}
return new MaxInclusiveFacet(type.createValue(value, context), fixed, null);
}
-
+
MaxExclusiveFacet parseMaxExclusiveFacet(String value,
ValidationContext context)
throws DatatypeException
@@ -201,7 +201,7 @@ public class TypeBuilder
}
return new MaxExclusiveFacet(type.createValue(value, context), fixed, null);
}
-
+
MinExclusiveFacet parseMinExclusiveFacet(String value,
ValidationContext context)
throws DatatypeException
@@ -217,7 +217,7 @@ public class TypeBuilder
}
return new MinExclusiveFacet(type.createValue(value, context), fixed, null);
}
-
+
MinInclusiveFacet parseMinInclusiveFacet(String value,
ValidationContext context)
throws DatatypeException
@@ -233,7 +233,7 @@ public class TypeBuilder
}
return new MinInclusiveFacet(type.createValue(value, context), fixed, null);
}
-
+
TotalDigitsFacet parseTotalDigitsFacet(String value)
throws DatatypeException
{
@@ -251,7 +251,7 @@ public class TypeBuilder
throw new DatatypeException("value must be a positiveInteger");
return new TotalDigitsFacet(val, fixed, null);
}
-
+
FractionDigitsFacet parseFractionDigitsFacet(String value)
throws DatatypeException
{
@@ -269,10 +269,10 @@ public class TypeBuilder
throw new DatatypeException("value must be a positiveInteger");
return new FractionDigitsFacet(val, fixed, null);
}
-
+
public Datatype createDatatype()
{
return type;
}
-
+
}
diff --git a/gnu/xml/validation/datatype/TypeLibrary.java b/gnu/xml/validation/datatype/TypeLibrary.java
index f1daecebd..4db48f799 100644
--- a/gnu/xml/validation/datatype/TypeLibrary.java
+++ b/gnu/xml/validation/datatype/TypeLibrary.java
@@ -1,4 +1,4 @@
-/* TypeLibrary.java --
+/* TypeLibrary.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import org.relaxng.datatype.DatatypeLibrary;
public class TypeLibrary
implements DatatypeLibrary
{
-
+
public static final SimpleType ANY_SIMPLE_TYPE = new AnySimpleType();
public static final SimpleType STRING = new StringType();
@@ -169,5 +169,5 @@ public class TypeLibrary
throw new DatatypeException("Unknown type name: " + typeLocalName);
return type;
}
-
+
}
diff --git a/gnu/xml/validation/datatype/TypeLibraryFactory.java b/gnu/xml/validation/datatype/TypeLibraryFactory.java
index 21ee64224..2f9bbd3c6 100644
--- a/gnu/xml/validation/datatype/TypeLibraryFactory.java
+++ b/gnu/xml/validation/datatype/TypeLibraryFactory.java
@@ -1,4 +1,4 @@
-/* TypeLibraryFactory.java --
+/* TypeLibraryFactory.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,5 +56,5 @@ public class TypeLibraryFactory
return new TypeLibrary();
return null;
}
-
+
}
diff --git a/gnu/xml/validation/datatype/UnionSimpleType.java b/gnu/xml/validation/datatype/UnionSimpleType.java
index d87c2aa7a..253e1df7b 100644
--- a/gnu/xml/validation/datatype/UnionSimpleType.java
+++ b/gnu/xml/validation/datatype/UnionSimpleType.java
@@ -1,4 +1,4 @@
-/* UnionSimpleType.java --
+/* UnionSimpleType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ public class UnionSimpleType
* The member types in this union.
*/
public final List memberTypes;
-
+
public UnionSimpleType(QName name, Set facets,
int fundamentalFacets, SimpleType baseType,
Annotation annotation, List memberTypes)
@@ -78,6 +78,5 @@ public class UnionSimpleType
}
throw new DatatypeException("invalid union type value");
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/UnsignedByteType.java b/gnu/xml/validation/datatype/UnsignedByteType.java
index 772c9cc0a..cf12abe3a 100644
--- a/gnu/xml/validation/datatype/UnsignedByteType.java
+++ b/gnu/xml/validation/datatype/UnsignedByteType.java
@@ -1,4 +1,4 @@
-/* UnsignedByteType.java --
+/* UnsignedByteType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -105,7 +105,7 @@ final class UnsignedByteType
throw new DatatypeException(i, "invalid unsigned byte value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -116,6 +116,5 @@ final class UnsignedByteType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/UnsignedIntType.java b/gnu/xml/validation/datatype/UnsignedIntType.java
index a4e8a6820..b634442bb 100644
--- a/gnu/xml/validation/datatype/UnsignedIntType.java
+++ b/gnu/xml/validation/datatype/UnsignedIntType.java
@@ -1,4 +1,4 @@
-/* UnsignedIntType.java --
+/* UnsignedIntType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -105,7 +105,7 @@ final class UnsignedIntType
throw new DatatypeException(i, "invalid unsigned int value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -116,6 +116,5 @@ final class UnsignedIntType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/UnsignedLongType.java b/gnu/xml/validation/datatype/UnsignedLongType.java
index 5a36d8a31..784b86663 100644
--- a/gnu/xml/validation/datatype/UnsignedLongType.java
+++ b/gnu/xml/validation/datatype/UnsignedLongType.java
@@ -1,4 +1,4 @@
-/* UnsignedLongType.java --
+/* UnsignedLongType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -105,7 +105,7 @@ final class UnsignedLongType
throw new DatatypeException(i, "invalid unsigned long value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -116,6 +116,5 @@ final class UnsignedLongType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/UnsignedShortType.java b/gnu/xml/validation/datatype/UnsignedShortType.java
index 49f621be7..ececb608c 100644
--- a/gnu/xml/validation/datatype/UnsignedShortType.java
+++ b/gnu/xml/validation/datatype/UnsignedShortType.java
@@ -1,4 +1,4 @@
-/* UnsignedShortType.java --
+/* UnsignedShortType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -106,7 +106,7 @@ final class UnsignedShortType
throw new DatatypeException(i, "invalid unsigned short value");
}
}
-
+
public Object createValue(String literal, ValidationContext context) {
try
{
@@ -117,6 +117,5 @@ final class UnsignedShortType
return null;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/datatype/WhiteSpaceFacet.java b/gnu/xml/validation/datatype/WhiteSpaceFacet.java
index 5920e1c88..0f2109cfc 100644
--- a/gnu/xml/validation/datatype/WhiteSpaceFacet.java
+++ b/gnu/xml/validation/datatype/WhiteSpaceFacet.java
@@ -1,4 +1,4 @@
-/* WhiteSpaceFacet.java --
+/* WhiteSpaceFacet.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,11 +45,11 @@ package gnu.xml.validation.datatype;
public final class WhiteSpaceFacet
extends Facet
{
-
+
public static final int PRESERVE = 0;
public static final int REPLACE = 1;
public static final int COLLAPSE = 2;
-
+
public final int value;
public final boolean fixed;
@@ -59,7 +59,7 @@ public final class WhiteSpaceFacet
this.value = value;
this.fixed = fixed;
}
-
+
public int hashCode()
{
return value;
@@ -70,6 +70,5 @@ public final class WhiteSpaceFacet
return (other instanceof WhiteSpaceFacet &&
((WhiteSpaceFacet) other).value == value);
}
-
-}
+}
diff --git a/gnu/xml/validation/relaxng/AnyNameNameClass.java b/gnu/xml/validation/relaxng/AnyNameNameClass.java
index ecc016d4b..7b27a3c98 100644
--- a/gnu/xml/validation/relaxng/AnyNameNameClass.java
+++ b/gnu/xml/validation/relaxng/AnyNameNameClass.java
@@ -1,4 +1,4 @@
-/* AnyNameNameClass.java --
+/* AnyNameNameClass.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ class AnyNameNameClass
{
NameClass exceptNameClass;
-
+
boolean matchesName(String uri, String localName)
{
return (exceptNameClass == null) ? true :
@@ -55,4 +55,3 @@ class AnyNameNameClass
}
}
-
diff --git a/gnu/xml/validation/relaxng/AttributePattern.java b/gnu/xml/validation/relaxng/AttributePattern.java
index 48443d61b..54e414dc5 100644
--- a/gnu/xml/validation/relaxng/AttributePattern.java
+++ b/gnu/xml/validation/relaxng/AttributePattern.java
@@ -1,4 +1,4 @@
-/* AttributePattern.java --
+/* AttributePattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,4 +50,3 @@ class AttributePattern
Pattern pattern;
}
-
diff --git a/gnu/xml/validation/relaxng/ChoiceNameClass.java b/gnu/xml/validation/relaxng/ChoiceNameClass.java
index e196cd4ee..9c762b926 100644
--- a/gnu/xml/validation/relaxng/ChoiceNameClass.java
+++ b/gnu/xml/validation/relaxng/ChoiceNameClass.java
@@ -1,4 +1,4 @@
-/* ChoiceNameClass.java --
+/* ChoiceNameClass.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,6 +54,5 @@ class ChoiceNameClass
return name1.matchesName(uri, localName) ||
name2.matchesName(uri, localName);
}
-
-}
+}
diff --git a/gnu/xml/validation/relaxng/ChoicePattern.java b/gnu/xml/validation/relaxng/ChoicePattern.java
index 54739b270..48c96b2fb 100644
--- a/gnu/xml/validation/relaxng/ChoicePattern.java
+++ b/gnu/xml/validation/relaxng/ChoicePattern.java
@@ -1,4 +1,4 @@
-/* ChoicePattern.java --
+/* ChoicePattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,4 +50,3 @@ class ChoicePattern
Pattern pattern2;
}
-
diff --git a/gnu/xml/validation/relaxng/DataPattern.java b/gnu/xml/validation/relaxng/DataPattern.java
index 2315b2ce6..f4e36c726 100644
--- a/gnu/xml/validation/relaxng/DataPattern.java
+++ b/gnu/xml/validation/relaxng/DataPattern.java
@@ -1,4 +1,4 @@
-/* DataPattern.java --
+/* DataPattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,6 +55,5 @@ class DataPattern
DatatypeLibrary datatypeLibrary;
List params = new LinkedList();
Pattern exceptPattern;
-
-}
+}
diff --git a/gnu/xml/validation/relaxng/Define.java b/gnu/xml/validation/relaxng/Define.java
index 8801d581e..ffb1d41ee 100644
--- a/gnu/xml/validation/relaxng/Define.java
+++ b/gnu/xml/validation/relaxng/Define.java
@@ -1,4 +1,4 @@
-/* Define.java --
+/* Define.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,6 +47,5 @@ class Define
String name;
ElementPattern element;
-
-}
+}
diff --git a/gnu/xml/validation/relaxng/ElementPattern.java b/gnu/xml/validation/relaxng/ElementPattern.java
index 9ff357075..e02731968 100644
--- a/gnu/xml/validation/relaxng/ElementPattern.java
+++ b/gnu/xml/validation/relaxng/ElementPattern.java
@@ -1,4 +1,4 @@
-/* ElementPattern.java --
+/* ElementPattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,4 +50,3 @@ class ElementPattern
Pattern pattern;
}
-
diff --git a/gnu/xml/validation/relaxng/EmptyPattern.java b/gnu/xml/validation/relaxng/EmptyPattern.java
index ce568f84b..13c2d3f61 100644
--- a/gnu/xml/validation/relaxng/EmptyPattern.java
+++ b/gnu/xml/validation/relaxng/EmptyPattern.java
@@ -1,4 +1,4 @@
-/* EmptyPattern.java --
+/* EmptyPattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,4 +49,3 @@ class EmptyPattern
static final EmptyPattern INSTANCE = new EmptyPattern();
}
-
diff --git a/gnu/xml/validation/relaxng/FullSyntaxBuilder.java b/gnu/xml/validation/relaxng/FullSyntaxBuilder.java
index 78e9f8533..bb73c4f38 100644
--- a/gnu/xml/validation/relaxng/FullSyntaxBuilder.java
+++ b/gnu/xml/validation/relaxng/FullSyntaxBuilder.java
@@ -1,4 +1,4 @@
-/* FullSyntaxBuilder.java --
+/* FullSyntaxBuilder.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -97,7 +97,7 @@ class FullSyntaxBuilder
defineAttrs.add("name");
defineAttrs.add("combine");
Set nsAttrs = Collections.singleton("ns");
-
+
VOCABULARY.put("element", elementAttrs);
VOCABULARY.put("attribute", elementAttrs);
VOCABULARY.put("group", Collections.EMPTY_SET);
@@ -164,10 +164,10 @@ class FullSyntaxBuilder
{
urls = new HashSet();
refCount = 1;
-
+
doc.normalizeDocument(); // Normalize XML document
transform(doc); // Apply transformation rules to provide simple syntax
-
+
// 4.18. grammar element
Element p = doc.getDocumentElement();
Element grammar =
@@ -248,7 +248,7 @@ class FullSyntaxBuilder
}
transform2(p); // Apply second stage transformation rules
-
+
Grammar ret = parseGrammar(grammar);
datatypeLibraries = null; // free datatype libraries cache
return ret;
@@ -463,7 +463,7 @@ class FullSyntaxBuilder
!"grammar".equals(eName))
throw new GrammarException("included element is not " +
"a grammar");
-
+
transform(element);
urls.remove(href);
// handle components
@@ -513,9 +513,9 @@ class FullSyntaxBuilder
}
// transform to div element
Document doc = include.getOwnerDocument();
- Element includeDiv =
+ Element includeDiv =
doc.createElementNS(XMLConstants.RELAXNG_NS_URI, "div");
- Element grammarDiv =
+ Element grammarDiv =
doc.createElementNS(XMLConstants.RELAXNG_NS_URI, "div");
// XXX copy include non-href attributes (none defined?)
element = (Element) doc.importNode(element, true);
@@ -849,7 +849,7 @@ class FullSyntaxBuilder
}
}
}
-
+
break;
case Node.TEXT_NODE:
case Node.CDATA_SECTION_NODE:
@@ -935,7 +935,7 @@ class FullSyntaxBuilder
Node grammar = grammar2;
if ("parentRef".equals(elementName))
grammar = grammar1;
-
+
String name = ((Element) node).getAttribute("name");
if (name != null)
throw new GrammarException("no name attribute on " +
@@ -1240,7 +1240,7 @@ class FullSyntaxBuilder
}
node.appendChild(child);
}
-
+
private static Element getFirstChildElement(Node node)
{
Node ctx = node.getFirstChild();
@@ -1485,7 +1485,7 @@ class FullSyntaxBuilder
value.value = node.getTextContent();
return value;
}
-
+
ListPattern parseList(Element node)
throws GrammarException
{
diff --git a/gnu/xml/validation/relaxng/Grammar.java b/gnu/xml/validation/relaxng/Grammar.java
index 76eff4f3a..c2407da2b 100644
--- a/gnu/xml/validation/relaxng/Grammar.java
+++ b/gnu/xml/validation/relaxng/Grammar.java
@@ -1,4 +1,4 @@
-/* Grammar.java --
+/* Grammar.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,6 +65,5 @@ class Grammar
// TODO
return null;
}
-
-}
+}
diff --git a/gnu/xml/validation/relaxng/GrammarException.java b/gnu/xml/validation/relaxng/GrammarException.java
index 71d03de97..167cf6482 100644
--- a/gnu/xml/validation/relaxng/GrammarException.java
+++ b/gnu/xml/validation/relaxng/GrammarException.java
@@ -1,4 +1,4 @@
-/* GrammarException.java --
+/* GrammarException.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,5 +52,5 @@ class GrammarException
{
super(message);
}
-
+
}
diff --git a/gnu/xml/validation/relaxng/GrammarValidator.java b/gnu/xml/validation/relaxng/GrammarValidator.java
index d811aeec9..e4ff3dab4 100644
--- a/gnu/xml/validation/relaxng/GrammarValidator.java
+++ b/gnu/xml/validation/relaxng/GrammarValidator.java
@@ -1,4 +1,4 @@
-/* GrammarValidator.java --
+/* GrammarValidator.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -93,5 +93,5 @@ class GrammarValidator
{
// TODO
}
-
+
}
diff --git a/gnu/xml/validation/relaxng/GroupPattern.java b/gnu/xml/validation/relaxng/GroupPattern.java
index b01090efa..b63c7aaa7 100644
--- a/gnu/xml/validation/relaxng/GroupPattern.java
+++ b/gnu/xml/validation/relaxng/GroupPattern.java
@@ -1,4 +1,4 @@
-/* GroupPattern.java --
+/* GroupPattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,6 +48,5 @@ class GroupPattern
Pattern pattern1;
Pattern pattern2;
-
-}
+}
diff --git a/gnu/xml/validation/relaxng/InterleavePattern.java b/gnu/xml/validation/relaxng/InterleavePattern.java
index aa7c28e5e..8a877d7af 100644
--- a/gnu/xml/validation/relaxng/InterleavePattern.java
+++ b/gnu/xml/validation/relaxng/InterleavePattern.java
@@ -1,4 +1,4 @@
-/* InterleavePattern.java --
+/* InterleavePattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,6 +48,5 @@ class InterleavePattern
Pattern pattern1;
Pattern pattern2;
-
-}
+}
diff --git a/gnu/xml/validation/relaxng/ListPattern.java b/gnu/xml/validation/relaxng/ListPattern.java
index 4c0393ae5..e16d5f6e5 100644
--- a/gnu/xml/validation/relaxng/ListPattern.java
+++ b/gnu/xml/validation/relaxng/ListPattern.java
@@ -1,4 +1,4 @@
-/* ListPattern.java --
+/* ListPattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,4 +49,3 @@ class ListPattern
Pattern pattern;
}
-
diff --git a/gnu/xml/validation/relaxng/NSNameNameClass.java b/gnu/xml/validation/relaxng/NSNameNameClass.java
index f485e9970..2f620c1d0 100644
--- a/gnu/xml/validation/relaxng/NSNameNameClass.java
+++ b/gnu/xml/validation/relaxng/NSNameNameClass.java
@@ -1,4 +1,4 @@
-/* NSNameNameClass.java --
+/* NSNameNameClass.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,6 +56,5 @@ class NSNameNameClass
return (exceptNameClass == null) ? true :
!exceptNameClass.matchesName(uri, localName);
}
-
-}
+}
diff --git a/gnu/xml/validation/relaxng/NameClass.java b/gnu/xml/validation/relaxng/NameClass.java
index 2a3dc83e5..0ef9ef131 100644
--- a/gnu/xml/validation/relaxng/NameClass.java
+++ b/gnu/xml/validation/relaxng/NameClass.java
@@ -1,4 +1,4 @@
-/* NameClass.java --
+/* NameClass.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,5 +46,5 @@ abstract class NameClass
{
abstract boolean matchesName(String uri, String localName);
-
+
}
diff --git a/gnu/xml/validation/relaxng/NameNameClass.java b/gnu/xml/validation/relaxng/NameNameClass.java
index d5a0c5f04..b2d0e04ee 100644
--- a/gnu/xml/validation/relaxng/NameNameClass.java
+++ b/gnu/xml/validation/relaxng/NameNameClass.java
@@ -1,4 +1,4 @@
-/* NameNameClass.java --
+/* NameNameClass.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,4 +57,3 @@ class NameNameClass
}
}
-
diff --git a/gnu/xml/validation/relaxng/NotAllowedPattern.java b/gnu/xml/validation/relaxng/NotAllowedPattern.java
index 8263a4573..d56afb2d7 100644
--- a/gnu/xml/validation/relaxng/NotAllowedPattern.java
+++ b/gnu/xml/validation/relaxng/NotAllowedPattern.java
@@ -1,4 +1,4 @@
-/* NotAllowedPattern.java --
+/* NotAllowedPattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,5 +49,3 @@ class NotAllowedPattern
static final NotAllowedPattern INSTANCE = new NotAllowedPattern();
}
-
-
diff --git a/gnu/xml/validation/relaxng/OneOrMorePattern.java b/gnu/xml/validation/relaxng/OneOrMorePattern.java
index 99864d72a..0545130ad 100644
--- a/gnu/xml/validation/relaxng/OneOrMorePattern.java
+++ b/gnu/xml/validation/relaxng/OneOrMorePattern.java
@@ -1,4 +1,4 @@
-/* OneOrMorePattern.java --
+/* OneOrMorePattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,4 +49,3 @@ class OneOrMorePattern
Pattern pattern;
}
-
diff --git a/gnu/xml/validation/relaxng/Param.java b/gnu/xml/validation/relaxng/Param.java
index 246ad20b7..65a1b6689 100644
--- a/gnu/xml/validation/relaxng/Param.java
+++ b/gnu/xml/validation/relaxng/Param.java
@@ -1,4 +1,4 @@
-/* Param.java --
+/* Param.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,4 +49,3 @@ class Param
String value;
}
-
diff --git a/gnu/xml/validation/relaxng/Pattern.java b/gnu/xml/validation/relaxng/Pattern.java
index 3bf9a9919..157f22316 100644
--- a/gnu/xml/validation/relaxng/Pattern.java
+++ b/gnu/xml/validation/relaxng/Pattern.java
@@ -1,4 +1,4 @@
-/* Pattern.java --
+/* Pattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,4 +45,3 @@ package gnu.xml.validation.relaxng;
abstract class Pattern
{
}
-
diff --git a/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java b/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java
index 890ca8eeb..c0c9bd887 100644
--- a/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java
+++ b/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java
@@ -1,4 +1,4 @@
-/* RelaxNGSchemaFactory.java --
+/* RelaxNGSchemaFactory.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -75,7 +75,7 @@ public class RELAXNGSchemaFactory
public void setResourceResolver(LSResourceResolver resourceResolver)
{
this.resourceResolver = resourceResolver;
- }
+ }
public ErrorHandler getErrorHandler()
{
@@ -84,7 +84,7 @@ public class RELAXNGSchemaFactory
public void setErrorHandler(ErrorHandler errorHandler)
{
- this.errorHandler = errorHandler;
+ this.errorHandler = errorHandler;
}
public boolean isSchemaLanguageSupported(String schemaLanguage)
@@ -159,5 +159,5 @@ public class RELAXNGSchemaFactory
throw e2;
}
}
-
+
}
diff --git a/gnu/xml/validation/relaxng/RefPattern.java b/gnu/xml/validation/relaxng/RefPattern.java
index d7de09542..8c1ff8539 100644
--- a/gnu/xml/validation/relaxng/RefPattern.java
+++ b/gnu/xml/validation/relaxng/RefPattern.java
@@ -1,4 +1,4 @@
-/* RefPattern.java --
+/* RefPattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,4 +49,3 @@ class RefPattern
String name;
}
-
diff --git a/gnu/xml/validation/relaxng/TextPattern.java b/gnu/xml/validation/relaxng/TextPattern.java
index 06af3c34a..81c502820 100644
--- a/gnu/xml/validation/relaxng/TextPattern.java
+++ b/gnu/xml/validation/relaxng/TextPattern.java
@@ -1,4 +1,4 @@
-/* TextPattern.java --
+/* TextPattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,4 +49,3 @@ class TextPattern
static final TextPattern INSTANCE = new TextPattern();
}
-
diff --git a/gnu/xml/validation/relaxng/ValuePattern.java b/gnu/xml/validation/relaxng/ValuePattern.java
index 81260b0ca..8b63d79ae 100644
--- a/gnu/xml/validation/relaxng/ValuePattern.java
+++ b/gnu/xml/validation/relaxng/ValuePattern.java
@@ -1,4 +1,4 @@
-/* ValuePattern.java --
+/* ValuePattern.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,6 +53,5 @@ class ValuePattern
Datatype type;
String ns;
String value;
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/AnyAttribute.java b/gnu/xml/validation/xmlschema/AnyAttribute.java
index df90dc626..6f94bfe28 100644
--- a/gnu/xml/validation/xmlschema/AnyAttribute.java
+++ b/gnu/xml/validation/xmlschema/AnyAttribute.java
@@ -1,4 +1,4 @@
-/* AnyAttribute.java --
+/* AnyAttribute.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -62,6 +62,5 @@ final class AnyAttribute
this.namespace = namespace;
this.processContents = processContents;
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/AttributeDeclaration.java b/gnu/xml/validation/xmlschema/AttributeDeclaration.java
index 98b322bee..c475b368d 100644
--- a/gnu/xml/validation/xmlschema/AttributeDeclaration.java
+++ b/gnu/xml/validation/xmlschema/AttributeDeclaration.java
@@ -1,4 +1,4 @@
-/* AttributeDeclaration.java --
+/* AttributeDeclaration.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,7 +63,7 @@ class AttributeDeclaration
* One of NONE, DEFAULT, FIXED.
*/
final int type;
-
+
/**
* The value constraint.
*/
@@ -78,7 +78,7 @@ class AttributeDeclaration
* The type definition corresponding to this attribute.
*/
final SimpleType datatype;
-
+
/**
* The annotation associated with this attribute declaration, if any.
*/
@@ -94,6 +94,5 @@ class AttributeDeclaration
this.datatype = datatype;
this.annotation = annotation;
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/AttributeUse.java b/gnu/xml/validation/xmlschema/AttributeUse.java
index f8bb11b91..937076338 100644
--- a/gnu/xml/validation/xmlschema/AttributeUse.java
+++ b/gnu/xml/validation/xmlschema/AttributeUse.java
@@ -1,4 +1,4 @@
-/* AttributeUse.java --
+/* AttributeUse.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,7 +55,7 @@ class AttributeUse
* One of NONE, DEFAULT, FIXED.
*/
final int type;
-
+
/**
* The value constraint.
*/
@@ -74,6 +74,5 @@ class AttributeUse
this.value = value;
this.declaration = declaration;
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/ComplexType.java b/gnu/xml/validation/xmlschema/ComplexType.java
index 2c7acb10a..826ba32d9 100644
--- a/gnu/xml/validation/xmlschema/ComplexType.java
+++ b/gnu/xml/validation/xmlschema/ComplexType.java
@@ -1,4 +1,4 @@
-/* ComplexType.java --
+/* ComplexType.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -97,6 +97,5 @@ class ComplexType
this.finality = finality;
attributeUses = new LinkedHashSet();
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/ElementDeclaration.java b/gnu/xml/validation/xmlschema/ElementDeclaration.java
index d41f5e536..7392ca596 100644
--- a/gnu/xml/validation/xmlschema/ElementDeclaration.java
+++ b/gnu/xml/validation/xmlschema/ElementDeclaration.java
@@ -1,4 +1,4 @@
-/* ElementDeclaration.java --
+/* ElementDeclaration.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,7 +58,7 @@ class ElementDeclaration
* The type definition corresponding to this element.
*/
Type datatype;
-
+
/**
* The scope of this schema component.
* One of GLOBAL, LOCAL, or ABSENT.
@@ -75,7 +75,7 @@ class ElementDeclaration
* One of NONE, DEFAULT, FIXED.
*/
final int type;
-
+
/**
* The value constraint.
*/
@@ -84,7 +84,7 @@ class ElementDeclaration
final boolean nillable;
// TODO identity-constraint definitions
-
+
final QName substitutionGroup;
final int substitutionGroupExclusions;
@@ -120,6 +120,5 @@ class ElementDeclaration
this.disallowedSubstitutions = disallowedSubstitutions;
this.isAbstract = isAbstract;
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/Particle.java b/gnu/xml/validation/xmlschema/Particle.java
index 995c4ff09..5fe49203e 100644
--- a/gnu/xml/validation/xmlschema/Particle.java
+++ b/gnu/xml/validation/xmlschema/Particle.java
@@ -1,4 +1,4 @@
-/* Particle.java --
+/* Particle.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,6 +56,5 @@ class Particle
this.maxOccurs = maxOccurs;
this.term = term;
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/ValidationException.java b/gnu/xml/validation/xmlschema/ValidationException.java
index f2d684309..716ba8800 100644
--- a/gnu/xml/validation/xmlschema/ValidationException.java
+++ b/gnu/xml/validation/xmlschema/ValidationException.java
@@ -1,4 +1,4 @@
-/* ValidationException.java --
+/* ValidationException.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,6 +53,5 @@ class ValidationException
{
super(message, locator);
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/XMLSchema.java b/gnu/xml/validation/xmlschema/XMLSchema.java
index 647cbdeff..fb8eb88b1 100644
--- a/gnu/xml/validation/xmlschema/XMLSchema.java
+++ b/gnu/xml/validation/xmlschema/XMLSchema.java
@@ -1,4 +1,4 @@
-/* XMLSchema.java --
+/* XMLSchema.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,7 +58,7 @@ final class XMLSchema
static final int FINAL_LIST = 0x04;
static final int FINAL_UNION = 0x08;
static final int FINAL_ALL = 0x0f;
-
+
static final int BLOCK_NONE = 0x00;
static final int BLOCK_EXTENSION = 0x01;
static final int BLOCK_RESTRICTION = 0x02;
@@ -129,6 +129,5 @@ final class XMLSchema
//return new XMLSchemaValidatorHandler(this);
return null;
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaAttributeTypeInfo.java b/gnu/xml/validation/xmlschema/XMLSchemaAttributeTypeInfo.java
index 45064075a..ba83973df 100644
--- a/gnu/xml/validation/xmlschema/XMLSchemaAttributeTypeInfo.java
+++ b/gnu/xml/validation/xmlschema/XMLSchemaAttributeTypeInfo.java
@@ -1,4 +1,4 @@
-/* XMLSchemaAttributeTypeInfo.java --
+/* XMLSchemaAttributeTypeInfo.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -94,6 +94,5 @@ final class XMLSchemaAttributeTypeInfo
derivationMethod);
}
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java b/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java
index ecf3ad3b8..a7bad3129 100644
--- a/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java
+++ b/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java
@@ -1,4 +1,4 @@
-/* XMLSchemaBuilder.java --
+/* XMLSchemaBuilder.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -209,7 +209,7 @@ class XMLSchemaBuilder
datatype,
annotation);
}
- else
+ else
{
boolean required = "required".equals(use);
// TODO ref
@@ -427,7 +427,7 @@ class XMLSchemaBuilder
String sgNamespace = node.lookupNamespaceURI(sgPrefix);
substitutionGroup = new QName(sgNamespace, sgName);
}
-
+
String block = getAttribute(attrs, "block");
int substitutionGroupExclusions = (block == null) ?
schema.blockDefault :
@@ -436,10 +436,10 @@ class XMLSchemaBuilder
int disallowedSubstitutions = (final_ == null) ?
schema.finalDefault :
parseFullDerivationSet(final_);
-
+
boolean nillable = "true".equals(getAttribute(attrs, "nillable"));
boolean isAbstract = "true".equals(getAttribute(attrs, "abstract"));
-
+
if (notTopLevel)
{
minOccurs = getOccurrence(getAttribute(attrs, "minOccurs"));
@@ -463,11 +463,11 @@ class XMLSchemaBuilder
scope, parent,
constraintType, constraintValue,
nillable,
- substitutionGroup,
- substitutionGroupExclusions,
+ substitutionGroup,
+ substitutionGroupExclusions,
disallowedSubstitutions,
isAbstract);
-
+
for (Node child = node.getFirstChild(); child != null;
child = child.getNextSibling())
{
@@ -623,7 +623,7 @@ class XMLSchemaBuilder
if (mixed)
{
type.contentType = XMLSchema.CONTENT_MIXED;
- }
+ }
return type;
}
@@ -835,6 +835,5 @@ class XMLSchemaBuilder
}
return name;
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaElementTypeInfo.java b/gnu/xml/validation/xmlschema/XMLSchemaElementTypeInfo.java
index a65133c20..99a59f39d 100644
--- a/gnu/xml/validation/xmlschema/XMLSchemaElementTypeInfo.java
+++ b/gnu/xml/validation/xmlschema/XMLSchemaElementTypeInfo.java
@@ -1,4 +1,4 @@
-/* XMLSchemaElementTypeInfo.java --
+/* XMLSchemaElementTypeInfo.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -87,6 +87,5 @@ final class XMLSchemaElementTypeInfo
return false;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java b/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java
index 2b985a28c..18e91f28d 100644
--- a/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java
+++ b/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java
@@ -1,4 +1,4 @@
-/* XMLSchemaSchemaFactory.java --
+/* XMLSchemaSchemaFactory.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -77,7 +77,7 @@ public class XMLSchemaSchemaFactory
{
this.resourceResolver = resourceResolver;
}
-
+
public ErrorHandler getErrorHandler()
{
return this.errorHandler;
@@ -85,7 +85,7 @@ public class XMLSchemaSchemaFactory
public void setErrorHandler(ErrorHandler errorHandler)
{
- this.errorHandler = errorHandler;
+ this.errorHandler = errorHandler;
}
@@ -167,6 +167,5 @@ public class XMLSchemaSchemaFactory
throw e2;
}
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaTypeInfo.java b/gnu/xml/validation/xmlschema/XMLSchemaTypeInfo.java
index 60cc25fc4..c1ca95114 100644
--- a/gnu/xml/validation/xmlschema/XMLSchemaTypeInfo.java
+++ b/gnu/xml/validation/xmlschema/XMLSchemaTypeInfo.java
@@ -1,4 +1,4 @@
-/* XMLSchemaTypeInfo.java --
+/* XMLSchemaTypeInfo.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -72,6 +72,5 @@ abstract class XMLSchemaTypeInfo
}
return false;
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaTypeInfoProvider.java b/gnu/xml/validation/xmlschema/XMLSchemaTypeInfoProvider.java
index 9b20c0c8d..4fc80d34b 100644
--- a/gnu/xml/validation/xmlschema/XMLSchemaTypeInfoProvider.java
+++ b/gnu/xml/validation/xmlschema/XMLSchemaTypeInfoProvider.java
@@ -1,4 +1,4 @@
-/* XMLSchemaTypeInfoProvider.java --
+/* XMLSchemaTypeInfoProvider.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -77,6 +77,5 @@ final class XMLSchemaTypeInfoProvider
{
return handler.isSpecified(index);
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaValidator.java b/gnu/xml/validation/xmlschema/XMLSchemaValidator.java
index 056babf64..6239ba6c6 100644
--- a/gnu/xml/validation/xmlschema/XMLSchemaValidator.java
+++ b/gnu/xml/validation/xmlschema/XMLSchemaValidator.java
@@ -1,4 +1,4 @@
-/* XMLSchemaValidator.java --
+/* XMLSchemaValidator.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,7 +58,7 @@ final class XMLSchemaValidator
ErrorHandler errorHandler;
LSResourceResolver resourceResolver;
-
+
XMLSchemaValidator(XMLSchema schema)
{
this.schema = schema;
@@ -93,6 +93,5 @@ final class XMLSchemaValidator
{
this.resourceResolver = resourceResolver;
}
-
-}
+}
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaValidatorHandler.java b/gnu/xml/validation/xmlschema/XMLSchemaValidatorHandler.java
index 9e6d8e9a9..6c4f1f392 100644
--- a/gnu/xml/validation/xmlschema/XMLSchemaValidatorHandler.java
+++ b/gnu/xml/validation/xmlschema/XMLSchemaValidatorHandler.java
@@ -1,4 +1,4 @@
-/* XMLSchemaValidatorHandler.java --
+/* XMLSchemaValidatorHandler.java --
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -260,7 +260,7 @@ final class XMLSchemaValidatorHandler
}
}
// TODO 5, 6, 7
-
+
// parent
if (!context.isEmpty())
{
@@ -300,7 +300,7 @@ final class XMLSchemaValidatorHandler
XMLSchemaAttributeTypeInfo attTypeInfo =
new XMLSchemaAttributeTypeInfo(schema, attDecl, true);
attributes.add(attTypeInfo);
-
+
atts2.addAttribute(attUri, attLocalName, attQName, attType, attValue);
atts2.setDeclared(count, declared);
atts2.setSpecified(count, true);
@@ -363,7 +363,7 @@ final class XMLSchemaValidatorHandler
contentHandler.processingInstruction(target, data);
}
}
-
+
public void skippedEntity(String name)
throws SAXException
{
@@ -389,6 +389,5 @@ final class XMLSchemaValidatorHandler
return Type.ANY_TYPE;
return (SimpleType) typeLibrary.createDatatype(localName);
}
-
-}
+}
diff --git a/gnu/xml/xpath/AndExpr.java b/gnu/xml/xpath/AndExpr.java
index dd2e1c9a1..9213a40cc 100644
--- a/gnu/xml/xpath/AndExpr.java
+++ b/gnu/xml/xpath/AndExpr.java
@@ -1,4 +1,4 @@
-/* AndExpr.java --
+/* AndExpr.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -83,5 +83,5 @@ public final class AndExpr
{
return lhs + " and " + rhs;
}
-
+
}
diff --git a/gnu/xml/xpath/ArithmeticExpr.java b/gnu/xml/xpath/ArithmeticExpr.java
index 61098d6e4..a7bc62f2e 100644
--- a/gnu/xml/xpath/ArithmeticExpr.java
+++ b/gnu/xml/xpath/ArithmeticExpr.java
@@ -1,4 +1,4 @@
-/* ArithmeticExpr.java --
+/* ArithmeticExpr.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -72,8 +72,8 @@ final class ArithmeticExpr
case MULTIPLY:
case DIVIDE:
case MODULO:
- this.op = op;
- break;
+ this.op = op;
+ break;
default:
throw new IllegalArgumentException();
}
@@ -166,5 +166,5 @@ final class ArithmeticExpr
buf.append(rhs);
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/xpath/BooleanFunction.java b/gnu/xml/xpath/BooleanFunction.java
index f661b2ac2..05e0bd5bc 100644
--- a/gnu/xml/xpath/BooleanFunction.java
+++ b/gnu/xml/xpath/BooleanFunction.java
@@ -1,4 +1,4 @@
-/* BooleanFunction.java --
+/* BooleanFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,7 +60,7 @@ final class BooleanFunction
{
final Expr arg;
-
+
BooleanFunction(List<Expr> args)
{
this(args.get(0));
@@ -70,7 +70,7 @@ final class BooleanFunction
{
this.arg = arg;
}
-
+
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
@@ -86,10 +86,10 @@ final class BooleanFunction
{
return arg.references(var);
}
-
+
public String toString()
{
return "boolean(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/CeilingFunction.java b/gnu/xml/xpath/CeilingFunction.java
index 153988422..aa906e0dd 100644
--- a/gnu/xml/xpath/CeilingFunction.java
+++ b/gnu/xml/xpath/CeilingFunction.java
@@ -1,4 +1,4 @@
-/* CeilingFunction.java --
+/* CeilingFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,17 +53,17 @@ final class CeilingFunction
{
final Expr arg;
-
+
CeilingFunction(List<Expr> args)
{
this(args.get(0));
}
-
+
CeilingFunction(Expr arg)
{
this.arg = arg;
}
-
+
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
@@ -80,10 +80,10 @@ final class CeilingFunction
{
return arg.references(var);
}
-
+
public String toString()
{
return "ceiling(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/ConcatFunction.java b/gnu/xml/xpath/ConcatFunction.java
index a61a45477..58096e5ac 100644
--- a/gnu/xml/xpath/ConcatFunction.java
+++ b/gnu/xml/xpath/ConcatFunction.java
@@ -1,4 +1,4 @@
-/* ConcatFunction.java --
+/* ConcatFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -111,5 +111,5 @@ final class ConcatFunction
buf.append(')');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/xpath/Constant.java b/gnu/xml/xpath/Constant.java
index d5ca764a1..5ed39cc05 100644
--- a/gnu/xml/xpath/Constant.java
+++ b/gnu/xml/xpath/Constant.java
@@ -1,4 +1,4 @@
-/* Constant.java --
+/* Constant.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -94,5 +94,5 @@ public final class Constant
}
return ret;
}
-
-}
+
+}
diff --git a/gnu/xml/xpath/ContainsFunction.java b/gnu/xml/xpath/ContainsFunction.java
index 620606b3f..473d2532f 100644
--- a/gnu/xml/xpath/ContainsFunction.java
+++ b/gnu/xml/xpath/ContainsFunction.java
@@ -1,4 +1,4 @@
-/* ContainsFunction.java --
+/* ContainsFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -89,5 +89,5 @@ final class ContainsFunction
{
return "contains(" + arg1 + "," + arg2 + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/CountFunction.java b/gnu/xml/xpath/CountFunction.java
index f29d83310..e1892a058 100644
--- a/gnu/xml/xpath/CountFunction.java
+++ b/gnu/xml/xpath/CountFunction.java
@@ -1,4 +1,4 @@
-/* CountFunction.java --
+/* CountFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ final class CountFunction
this.arg = arg;
}
- @Override
+ @Override
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
@@ -85,5 +85,5 @@ final class CountFunction
{
return "count(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/DocumentOrderComparator.java b/gnu/xml/xpath/DocumentOrderComparator.java
index 605749d09..c4471c120 100644
--- a/gnu/xml/xpath/DocumentOrderComparator.java
+++ b/gnu/xml/xpath/DocumentOrderComparator.java
@@ -1,4 +1,4 @@
-/* DocumentOrderComparator.java --
+/* DocumentOrderComparator.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import org.w3c.dom.Node;
public class DocumentOrderComparator
implements Comparator<Node>
{
-
+
public int compare(Node n1, Node n2)
{
return (int) n1.compareDocumentPosition(n2);
diff --git a/gnu/xml/xpath/EqualityExpr.java b/gnu/xml/xpath/EqualityExpr.java
index 3b6fd568a..133e1ff20 100644
--- a/gnu/xml/xpath/EqualityExpr.java
+++ b/gnu/xml/xpath/EqualityExpr.java
@@ -1,4 +1,4 @@
-/* EqualityExpr.java --
+/* EqualityExpr.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -91,20 +91,20 @@ final class EqualityExpr
boolean frns = right instanceof Collection;
if (flns && frns)
{
- /* Suppression is safe, as we know context produces Collection<Node> */
- @SuppressWarnings("unchecked")
- Collection<Node> lns = (Collection<Node>) left;
- @SuppressWarnings("unchecked")
- Collection<Node> rns = (Collection<Node>) right;
+ /* Suppression is safe, as we know context produces Collection<Node> */
+ @SuppressWarnings("unchecked")
+ Collection<Node> lns = (Collection<Node>) left;
+ @SuppressWarnings("unchecked")
+ Collection<Node> rns = (Collection<Node>) right;
if (lns.isEmpty())
{
return false;
}
boolean all = true;
- for (Node ltest : lns)
- {
- for (Node rtest : rns)
- {
+ for (Node ltest : lns)
+ {
+ for (Node rtest : rns)
+ {
if (ltest == rtest || ltest.equals(rtest))
{
// much shorter
@@ -128,7 +128,7 @@ final class EqualityExpr
}
return all;
}
- /*
+ /*
* If one object to be compared is a node-set and the other is a number,
* then the comparison will be true if and only if there is a node in
* the node-set such that the result of performing the comparison on the
@@ -140,13 +140,13 @@ final class EqualityExpr
boolean frn = right instanceof Double;
if ((flns && frn) || (frns && fln))
{
- /* Suppression is safe, as we know context produces Collection<Node> */
- @SuppressWarnings("unchecked")
- Collection<Node> ns = flns ? (Collection<Node>) left : (Collection<Node>) right;
+ /* Suppression is safe, as we know context produces Collection<Node> */
+ @SuppressWarnings("unchecked")
+ Collection<Node> ns = flns ? (Collection<Node>) left : (Collection<Node>) right;
double n = fln ? ((Double) left).doubleValue() :
((Double) right).doubleValue();
boolean all = true;
- for (Node test : ns)
+ for (Node test : ns)
{
double nn = _number(context, stringValue(test));
if (nn == n)
@@ -174,12 +174,12 @@ final class EqualityExpr
boolean frs = right instanceof String;
if ((flns && frs) || (frns && fls))
{
- /* Suppression is safe, as we know context produces Collection<Node> */
- @SuppressWarnings("unchecked")
- Collection<Node> ns = flns ? (Collection<Node>) left : (Collection<Node>) right;
+ /* Suppression is safe, as we know context produces Collection<Node> */
+ @SuppressWarnings("unchecked")
+ Collection<Node> ns = flns ? (Collection<Node>) left : (Collection<Node>) right;
String s = fls ? (String) left : (String) right;
boolean all = true;
- for (Node test : ns)
+ for (Node test : ns)
{
if (stringValue(test).equals(s))
{
@@ -206,9 +206,9 @@ final class EqualityExpr
boolean frb = right instanceof Boolean;
if ((flns && frb) || (frns && flb))
{
- /* Suppression is safe, as we know context produces Collection<Node> */
- @SuppressWarnings("unchecked")
- Collection<Node> ns = flns ? (Collection<Node>) left : (Collection<Node>) right;
+ /* Suppression is safe, as we know context produces Collection<Node> */
+ @SuppressWarnings("unchecked")
+ Collection<Node> ns = flns ? (Collection<Node>) left : (Collection<Node>) right;
boolean b = flb ? ((Boolean) left).booleanValue() :
((Boolean) right).booleanValue();
return _boolean(context, ns) == b;
@@ -270,5 +270,5 @@ final class EqualityExpr
return lhs + " = " + rhs;
}
}
-
+
}
diff --git a/gnu/xml/xpath/Expr.java b/gnu/xml/xpath/Expr.java
index 87ce3dfb6..0e98f43f5 100644
--- a/gnu/xml/xpath/Expr.java
+++ b/gnu/xml/xpath/Expr.java
@@ -1,4 +1,4 @@
-/* Expr.java --
+/* Expr.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -112,7 +112,7 @@ public abstract class Expr
return null;
}
}
-
+
}
public Object evaluate(Object item, QName returnType)
@@ -143,10 +143,10 @@ public abstract class Expr
{
if (ret instanceof Collection)
{
- /* Suppression is safe, as we know context
- produces Collection<Node> */
- @SuppressWarnings("unchecked")
- Collection<Node> ns = (Collection<Node>) ret;
+ /* Suppression is safe, as we know context
+ produces Collection<Node> */
+ @SuppressWarnings("unchecked")
+ Collection<Node> ns = (Collection<Node>) ret;
switch (ns.size())
{
case 0:
@@ -171,12 +171,12 @@ public abstract class Expr
throw new XPathExpressionException("return value is not a node-set");
}
if (ret != null)
- {
- /* Suppression is safe, as we know context produces Collection<Node> */
- @SuppressWarnings("unchecked")
- Collection<Node> nodes = (Collection<Node>) ret;
- ret = new ExprNodeSet(nodes);
- }
+ {
+ /* Suppression is safe, as we know context produces Collection<Node> */
+ @SuppressWarnings("unchecked")
+ Collection<Node> nodes = (Collection<Node>) ret;
+ ret = new ExprNodeSet(nodes);
+ }
}
}
return ret;
@@ -185,7 +185,7 @@ public abstract class Expr
public String evaluate(Object item)
throws XPathExpressionException
{
- return (String) evaluate(item, XPathConstants.STRING);
+ return (String) evaluate(item, XPathConstants.STRING);
}
public Object evaluate(InputSource source, QName returnType)
@@ -201,15 +201,15 @@ public abstract class Expr
}
catch (ParserConfigurationException e)
{
- throw new XPathExpressionException(e);
+ throw new XPathExpressionException(e);
}
catch (SAXException e)
{
- throw new XPathExpressionException(e);
+ throw new XPathExpressionException(e);
}
catch (IOException e)
{
- throw new XPathExpressionException(e);
+ throw new XPathExpressionException(e);
}
}
@@ -224,7 +224,7 @@ public abstract class Expr
public abstract Expr clone(Object context);
public abstract boolean references(QName var);
-
+
/* -- 4.1 Node Set Functions -- */
/**
@@ -244,9 +244,9 @@ public abstract class Expr
Set<Node> ret = new HashSet<Node>();
if (object instanceof Collection)
{
- /* Suppression is safe, as the iteration will check each value is a Node */
- @SuppressWarnings("unchecked")
- Collection<Node> nodeSet = (Collection<Node>) object;
+ /* Suppression is safe, as the iteration will check each value is a Node */
+ @SuppressWarnings("unchecked")
+ Collection<Node> nodeSet = (Collection<Node>) object;
for (Iterator<Node> i = nodeSet.iterator(); i.hasNext(); )
{
String string = stringValue(i.next());
@@ -303,7 +303,7 @@ public abstract class Expr
String ret = node.getNamespaceURI();
return (ret == null) ? "" : ret;
}
-
+
/**
* The name function returns a string containing a QName representing the
* expanded-name of the node in the argument node-set that is first in
@@ -391,7 +391,7 @@ public abstract class Expr
{
String ret = decimalFormat.format(d);
if (ret.endsWith (".0"))
- {
+ {
ret = ret.substring(0, ret.length() - 2);
}
return ret;
@@ -399,10 +399,10 @@ public abstract class Expr
}
if (object instanceof Collection)
{
- /* Suppression is safe, as we fail immediately if the
- * first element is not a Node and don't use the rest */
- @SuppressWarnings("unchecked")
- Collection<Node> nodeSet = (Collection<Node>) object;
+ /* Suppression is safe, as we fail immediately if the
+ * first element is not a Node and don't use the rest */
+ @SuppressWarnings("unchecked")
+ Collection<Node> nodeSet = (Collection<Node>) object;
if (nodeSet.isEmpty())
{
return "";
@@ -414,7 +414,7 @@ public abstract class Expr
}
/* -- 4.3 Boolean Functions -- */
-
+
/**
* Implementation of the XPath <code>boolean</code> function.
*/
@@ -463,10 +463,10 @@ public abstract class Expr
}
if (object instanceof Collection)
{
- /* Suppression is safe, as we fail immediately if one
- * of the elements is not a Node */
- @SuppressWarnings("unchecked")
- Collection<Node> nodeSet = (Collection<Node>) object;
+ /* Suppression is safe, as we fail immediately if one
+ * of the elements is not a Node */
+ @SuppressWarnings("unchecked")
+ Collection<Node> nodeSet = (Collection<Node>) object;
// Convert node-set to string
object = stringValue(nodeSet);
}
@@ -505,7 +505,7 @@ public abstract class Expr
{
return stringValue(node, false);
}
-
+
static String stringValue(Node node, boolean elementMode)
{
switch (node.getNodeType())
diff --git a/gnu/xml/xpath/FalseFunction.java b/gnu/xml/xpath/FalseFunction.java
index 87660ec81..9a20f9163 100644
--- a/gnu/xml/xpath/FalseFunction.java
+++ b/gnu/xml/xpath/FalseFunction.java
@@ -1,4 +1,4 @@
-/* FalseFunction.java --
+/* FalseFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -68,5 +68,5 @@ final class FalseFunction
{
return "false()";
}
-
+
}
diff --git a/gnu/xml/xpath/FloorFunction.java b/gnu/xml/xpath/FloorFunction.java
index bbf56c911..ed61742a3 100644
--- a/gnu/xml/xpath/FloorFunction.java
+++ b/gnu/xml/xpath/FloorFunction.java
@@ -1,4 +1,4 @@
-/* FloorFunction.java --
+/* FloorFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -86,5 +86,5 @@ final class FloorFunction
{
return "floor(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/Function.java b/gnu/xml/xpath/Function.java
index 12e2e1141..f9eab2b73 100644
--- a/gnu/xml/xpath/Function.java
+++ b/gnu/xml/xpath/Function.java
@@ -1,4 +1,4 @@
-/* Function.java --
+/* Function.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,4 +54,3 @@ public interface Function
void setArguments(List<Expr> args);
}
-
diff --git a/gnu/xml/xpath/FunctionCall.java b/gnu/xml/xpath/FunctionCall.java
index e811f53a2..977482a8f 100644
--- a/gnu/xml/xpath/FunctionCall.java
+++ b/gnu/xml/xpath/FunctionCall.java
@@ -1,4 +1,4 @@
-/* FunctionCall.java --
+/* FunctionCall.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -83,7 +83,7 @@ public final class FunctionCall
if (resolver != null)
{
QName qname = QName.valueOf(name);
- int arity = args.size();
+ int arity = args.size();
XPathFunction function = resolver.resolveFunction(qname, arity);
if (function != null)
{
@@ -165,5 +165,5 @@ public final class FunctionCall
buf.append(')');
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/xpath/IdFunction.java b/gnu/xml/xpath/IdFunction.java
index b3d2208c8..7b6c6ac25 100644
--- a/gnu/xml/xpath/IdFunction.java
+++ b/gnu/xml/xpath/IdFunction.java
@@ -1,4 +1,4 @@
-/* IdFunction.java --
+/* IdFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -99,5 +99,5 @@ public final class IdFunction
{
return "id(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/LangFunction.java b/gnu/xml/xpath/LangFunction.java
index 33cf8b0a2..5a8d32fc0 100644
--- a/gnu/xml/xpath/LangFunction.java
+++ b/gnu/xml/xpath/LangFunction.java
@@ -1,4 +1,4 @@
-/* LangFunction.java --
+/* LangFunction.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -104,7 +104,7 @@ final class LangFunction
}
return null;
}
-
+
public Expr clone(Object context)
{
return new IdFunction(arg.clone(context));
@@ -119,5 +119,5 @@ final class LangFunction
{
return "lang(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/LastFunction.java b/gnu/xml/xpath/LastFunction.java
index 751a0a9c1..51f988f3c 100644
--- a/gnu/xml/xpath/LastFunction.java
+++ b/gnu/xml/xpath/LastFunction.java
@@ -1,4 +1,4 @@
-/* LastFunction.java --
+/* LastFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -69,5 +69,5 @@ final class LastFunction
{
return "last()";
}
-
+
}
diff --git a/gnu/xml/xpath/LocalNameFunction.java b/gnu/xml/xpath/LocalNameFunction.java
index dbad9d3b4..d829075c7 100644
--- a/gnu/xml/xpath/LocalNameFunction.java
+++ b/gnu/xml/xpath/LocalNameFunction.java
@@ -1,4 +1,4 @@
-/* LocalNameFunction.java --
+/* LocalNameFunction.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -69,7 +69,7 @@ final class LocalNameFunction
this.arg = arg;
}
- @Override
+ @Override
public Object evaluate(Node context, int pos, int len)
{
/* Suppression is safe, as we know context produces Collection<Node> */
@@ -94,5 +94,5 @@ final class LocalNameFunction
{
return (arg == null) ? "local-name()" : "local-name(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/NameFunction.java b/gnu/xml/xpath/NameFunction.java
index 239a53453..7db0be531 100644
--- a/gnu/xml/xpath/NameFunction.java
+++ b/gnu/xml/xpath/NameFunction.java
@@ -1,4 +1,4 @@
-/* NameFunction.java --
+/* NameFunction.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -77,7 +77,7 @@ final class NameFunction
this.arg = arg;
}
- @Override
+ @Override
public Object evaluate(Node context, int pos, int len)
{
/* Suppression is safe, as we know context produces Collection<Node> */
@@ -93,17 +93,17 @@ final class NameFunction
return new NameFunction((arg == null) ? null :
arg.clone(context));
}
-
+
@Override
public boolean references(QName var)
{
return (arg == null) ? false : arg.references(var);
}
-
+
@Override
public String toString()
{
return (arg == null) ? "name()" : "name(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/NameTest.java b/gnu/xml/xpath/NameTest.java
index 171010390..8bd06bd3b 100644
--- a/gnu/xml/xpath/NameTest.java
+++ b/gnu/xml/xpath/NameTest.java
@@ -1,4 +1,4 @@
-/* NameTest.java --
+/* NameTest.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -139,5 +139,5 @@ public final class NameTest
return "*";
return qName.toString();
}
-
+
}
diff --git a/gnu/xml/xpath/NamespaceTest.java b/gnu/xml/xpath/NamespaceTest.java
index d93b76d9d..2f4fec179 100644
--- a/gnu/xml/xpath/NamespaceTest.java
+++ b/gnu/xml/xpath/NamespaceTest.java
@@ -1,4 +1,4 @@
-/* NamespaceTest.java --
+/* NamespaceTest.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -116,5 +116,5 @@ public final class NamespaceTest
return "*";
return qName.toString();
}
-
+
}
diff --git a/gnu/xml/xpath/NamespaceUriFunction.java b/gnu/xml/xpath/NamespaceUriFunction.java
index 56da90f8c..4972b0607 100644
--- a/gnu/xml/xpath/NamespaceUriFunction.java
+++ b/gnu/xml/xpath/NamespaceUriFunction.java
@@ -1,4 +1,4 @@
-/* NamespaceUriFunction.java --
+/* NamespaceUriFunction.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,13 +63,13 @@ final class NamespaceUriFunction
{
this(args.size() > 0 ? args.get(0) : null);
}
-
+
NamespaceUriFunction(Expr arg)
{
this.arg = arg;
}
- @Override
+ @Override
public Object evaluate(Node context, int pos, int len)
{
/* Suppression is safe, as we know context produces Collection<Node> */
@@ -89,10 +89,10 @@ final class NamespaceUriFunction
{
return (arg == null) ? false : arg.references(var);
}
-
+
public String toString()
{
return (arg == null) ? "namespace-uri()" : "namespace-uri(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/NegativeExpr.java b/gnu/xml/xpath/NegativeExpr.java
index 9e24aff81..215ef3fa9 100644
--- a/gnu/xml/xpath/NegativeExpr.java
+++ b/gnu/xml/xpath/NegativeExpr.java
@@ -1,4 +1,4 @@
-/* NegativeExpr.java --
+/* NegativeExpr.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -77,5 +77,5 @@ final class NegativeExpr
{
return "-" + expr;
}
-
+
}
diff --git a/gnu/xml/xpath/NodeTypeTest.java b/gnu/xml/xpath/NodeTypeTest.java
index 4fe164625..43e26994b 100644
--- a/gnu/xml/xpath/NodeTypeTest.java
+++ b/gnu/xml/xpath/NodeTypeTest.java
@@ -1,4 +1,4 @@
-/* NodeTypeTest.java --
+/* NodeTypeTest.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -137,5 +137,5 @@ public final class NodeTypeTest
throw new IllegalStateException();
}
}
-
+
}
diff --git a/gnu/xml/xpath/NormalizeSpaceFunction.java b/gnu/xml/xpath/NormalizeSpaceFunction.java
index 30069acdc..6d728d9e7 100644
--- a/gnu/xml/xpath/NormalizeSpaceFunction.java
+++ b/gnu/xml/xpath/NormalizeSpaceFunction.java
@@ -1,4 +1,4 @@
-/* NormalizeSpaceFunction.java --
+/* NormalizeSpaceFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,7 +65,7 @@ final class NormalizeSpaceFunction
{
this(args.get(0));
}
-
+
NormalizeSpaceFunction(Expr arg)
{
this.arg = arg;
@@ -80,7 +80,7 @@ final class NormalizeSpaceFunction
CPStringBuilder buf = new CPStringBuilder();
if (st.hasMoreTokens())
{
- buf.append(st.nextToken());
+ buf.append(st.nextToken());
while (st.hasMoreTokens())
{
buf.append(' ');
@@ -104,5 +104,5 @@ final class NormalizeSpaceFunction
{
return (arg == null) ? "normalize-space()" : "normalize-space(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/NotFunction.java b/gnu/xml/xpath/NotFunction.java
index 188b3dbc4..a7c20a0c1 100644
--- a/gnu/xml/xpath/NotFunction.java
+++ b/gnu/xml/xpath/NotFunction.java
@@ -1,4 +1,4 @@
-/* NotFunction.java --
+/* NotFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -84,5 +84,5 @@ final class NotFunction
{
return "not(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/NumberFunction.java b/gnu/xml/xpath/NumberFunction.java
index 8804a7886..08831020b 100644
--- a/gnu/xml/xpath/NumberFunction.java
+++ b/gnu/xml/xpath/NumberFunction.java
@@ -1,4 +1,4 @@
-/* NumberFunction.java --
+/* NumberFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -99,5 +99,5 @@ final class NumberFunction
{
return "number(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/OrExpr.java b/gnu/xml/xpath/OrExpr.java
index 1085f5112..937dedf6a 100644
--- a/gnu/xml/xpath/OrExpr.java
+++ b/gnu/xml/xpath/OrExpr.java
@@ -1,4 +1,4 @@
-/* OrExpr.java --
+/* OrExpr.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -83,5 +83,5 @@ public final class OrExpr
{
return lhs + " or " + rhs;
}
-
+
}
diff --git a/gnu/xml/xpath/ParenthesizedExpr.java b/gnu/xml/xpath/ParenthesizedExpr.java
index adadd6745..e8ceb5aa5 100644
--- a/gnu/xml/xpath/ParenthesizedExpr.java
+++ b/gnu/xml/xpath/ParenthesizedExpr.java
@@ -1,4 +1,4 @@
-/* ParenthesizedExpr.java --
+/* ParenthesizedExpr.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,16 +60,16 @@ final class ParenthesizedExpr
this.expr = expr;
}
- @Override
+ @Override
public Object evaluate(Node context, int pos, int len)
{
Object ret = expr.evaluate(context, pos, len);
if (ret instanceof Collection)
{
- /* Suppression is safe, as we know context produces
- Collection<Node> */
- @SuppressWarnings("unchecked")
- Collection<Node> nodes = (Collection<Node>) ret;
+ /* Suppression is safe, as we know context produces
+ Collection<Node> */
+ @SuppressWarnings("unchecked")
+ Collection<Node> nodes = (Collection<Node>) ret;
List<Node> list = new ArrayList<Node>(nodes);
Collections.sort(list, documentOrderComparator);
ret = list;
@@ -91,5 +91,5 @@ final class ParenthesizedExpr
{
return "(" + expr + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/Path.java b/gnu/xml/xpath/Path.java
index 809f965cc..f19759567 100644
--- a/gnu/xml/xpath/Path.java
+++ b/gnu/xml/xpath/Path.java
@@ -1,4 +1,4 @@
-/* Path.java --
+/* Path.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,5 +50,5 @@ abstract class Path
{
abstract Collection<Node> evaluate(Node context, Collection<Node> nodeSet);
-
+
}
diff --git a/gnu/xml/xpath/Pattern.java b/gnu/xml/xpath/Pattern.java
index 859ab5692..ca03cda37 100644
--- a/gnu/xml/xpath/Pattern.java
+++ b/gnu/xml/xpath/Pattern.java
@@ -1,4 +1,4 @@
-/* Pattern.java --
+/* Pattern.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,4 +51,3 @@ public abstract class Pattern
public abstract boolean matches(Node context);
}
-
diff --git a/gnu/xml/xpath/PositionFunction.java b/gnu/xml/xpath/PositionFunction.java
index 3060eeaed..28ead3af0 100644
--- a/gnu/xml/xpath/PositionFunction.java
+++ b/gnu/xml/xpath/PositionFunction.java
@@ -1,4 +1,4 @@
-/* PositionFunction.java --
+/* PositionFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -69,5 +69,5 @@ final class PositionFunction
{
return "position()";
}
-
+
}
diff --git a/gnu/xml/xpath/Predicate.java b/gnu/xml/xpath/Predicate.java
index 5538c55aa..a02e22b94 100644
--- a/gnu/xml/xpath/Predicate.java
+++ b/gnu/xml/xpath/Predicate.java
@@ -1,4 +1,4 @@
-/* Predicate.java --
+/* Predicate.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,10 +76,10 @@ class Predicate
{
return expr.references(var);
}
-
+
public String toString()
{
return "[" + expr + "]";
}
-
+
}
diff --git a/gnu/xml/xpath/RelationalExpr.java b/gnu/xml/xpath/RelationalExpr.java
index 5cbb6bb22..ac79d5049 100644
--- a/gnu/xml/xpath/RelationalExpr.java
+++ b/gnu/xml/xpath/RelationalExpr.java
@@ -1,4 +1,4 @@
-/* RelationalExpr.java --
+/* RelationalExpr.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -103,5 +103,5 @@ final class RelationalExpr
{
return lhs + " " + (lt ? "<" : ">") + (eq ? "=" : "") + " " + rhs;
}
-
+
}
diff --git a/gnu/xml/xpath/Root.java b/gnu/xml/xpath/Root.java
index cbcb24999..8eef3408f 100644
--- a/gnu/xml/xpath/Root.java
+++ b/gnu/xml/xpath/Root.java
@@ -1,4 +1,4 @@
-/* Root.java --
+/* Root.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -87,5 +87,5 @@ public final class Root
{
return "/";
}
-
+
}
diff --git a/gnu/xml/xpath/RoundFunction.java b/gnu/xml/xpath/RoundFunction.java
index 2d1bd5447..3b79e3e21 100644
--- a/gnu/xml/xpath/RoundFunction.java
+++ b/gnu/xml/xpath/RoundFunction.java
@@ -1,4 +1,4 @@
-/* RoundFunction.java --
+/* RoundFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -93,5 +93,5 @@ final class RoundFunction
{
return "round(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/Selector.java b/gnu/xml/xpath/Selector.java
index 429b3f7e2..2146f26f5 100644
--- a/gnu/xml/xpath/Selector.java
+++ b/gnu/xml/xpath/Selector.java
@@ -1,4 +1,4 @@
-/* Selector.java --
+/* Selector.java --
Copyright (C) 2004,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -115,7 +115,7 @@ public final class Selector
getContextPosition(context),
getContextSize(context));
}
-
+
boolean matches(Node context, int pos, int len)
{
short nodeType = context.getNodeType();
@@ -499,5 +499,5 @@ public final class Selector
}
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/xpath/StartsWithFunction.java b/gnu/xml/xpath/StartsWithFunction.java
index 2dc2c409d..6f9716a2d 100644
--- a/gnu/xml/xpath/StartsWithFunction.java
+++ b/gnu/xml/xpath/StartsWithFunction.java
@@ -1,4 +1,4 @@
-/* StartsWithFunction.java --
+/* StartsWithFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -88,5 +88,5 @@ final class StartsWithFunction
{
return "starts-with(" + arg1 + "," + arg2 + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/Steps.java b/gnu/xml/xpath/Steps.java
index 427fbe201..75644541c 100644
--- a/gnu/xml/xpath/Steps.java
+++ b/gnu/xml/xpath/Steps.java
@@ -1,4 +1,4 @@
-/* Steps.java --
+/* Steps.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -86,7 +86,7 @@ public final class Steps
if (pos > 0)
{
Pattern left = (Pattern) path.get(pos - 1);
- for (Node candidate : possibleContexts(right, context))
+ for (Node candidate : possibleContexts(right, context))
{
if (left.matches(candidate) &&
matches(candidate, pos - 1))
@@ -160,7 +160,7 @@ public final class Steps
return Collections.emptySet();
}
- @Override
+ @Override
public Object evaluate(Node context, int pos, int len)
{
//System.err.println(toString()+" evaluate");
@@ -172,16 +172,16 @@ public final class Steps
while (val instanceof Collection && i.hasNext())
{
Path rhs = (Path) i.next();
- /* Suppression is safe, as we know context produces Collection<Node> */
+ /* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
- Collection<Node> nodes = (Collection<Node>) val;
- val = rhs.evaluate(context, nodes);
+ Collection<Node> nodes = (Collection<Node>) val;
+ val = rhs.evaluate(context, nodes);
//System.err.println("\tevaluate "+rhs+" = "+val);
}
return val;
}
- @Override
+ @Override
Collection<Node> evaluate(Node context, Collection<Node> ns)
{
// Left to right
@@ -195,14 +195,14 @@ public final class Steps
{
Set<Node> acc = new LinkedHashSet<Node>();
int pos = 1, len = ns.size();
- for (Node node : ns)
+ for (Node node : ns)
{
Object ret = lhs.evaluate(node, pos++, len);
if (ret instanceof Collection)
{
- /* Suppression is safe, as we know context produces Collection<Node> */
- @SuppressWarnings("unchecked")
- Collection<Node> nodes = (Collection<Node>) ret;
+ /* Suppression is safe, as we know context produces Collection<Node> */
+ @SuppressWarnings("unchecked")
+ Collection<Node> nodes = (Collection<Node>) ret;
acc.addAll(nodes);
}
}
diff --git a/gnu/xml/xpath/StringFunction.java b/gnu/xml/xpath/StringFunction.java
index b8cba3798..b2b3cecf7 100644
--- a/gnu/xml/xpath/StringFunction.java
+++ b/gnu/xml/xpath/StringFunction.java
@@ -1,4 +1,4 @@
-/* StringFunction.java --
+/* StringFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -88,7 +88,7 @@ final class StringFunction
{
this(args.size() > 0 ? args.get(0) : null);
}
-
+
StringFunction(Expr arg)
{
this.arg = arg;
@@ -115,5 +115,5 @@ final class StringFunction
{
return (arg == null) ? "string()" : "string(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/StringLengthFunction.java b/gnu/xml/xpath/StringLengthFunction.java
index 561537e99..c72b0d9bc 100644
--- a/gnu/xml/xpath/StringLengthFunction.java
+++ b/gnu/xml/xpath/StringLengthFunction.java
@@ -1,4 +1,4 @@
-/* StringLengthFunction.java --
+/* StringLengthFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,7 +59,7 @@ final class StringLengthFunction
{
this(args.isEmpty() ? null : (Expr) args.get(0));
}
-
+
StringLengthFunction(Expr arg)
{
this.arg = arg;
@@ -88,5 +88,5 @@ final class StringLengthFunction
{
return (arg == null) ? "string-length()" : "string-length(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/SubstringAfterFunction.java b/gnu/xml/xpath/SubstringAfterFunction.java
index ad75f2e3c..4f10723a7 100644
--- a/gnu/xml/xpath/SubstringAfterFunction.java
+++ b/gnu/xml/xpath/SubstringAfterFunction.java
@@ -1,4 +1,4 @@
-/* SubstringAfterFunction.java --
+/* SubstringAfterFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -94,5 +94,5 @@ final class SubstringAfterFunction
{
return "substring-after(" + arg1 + "," + arg2 + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/SubstringBeforeFunction.java b/gnu/xml/xpath/SubstringBeforeFunction.java
index 1bf165777..1a5a04c4f 100644
--- a/gnu/xml/xpath/SubstringBeforeFunction.java
+++ b/gnu/xml/xpath/SubstringBeforeFunction.java
@@ -1,4 +1,4 @@
-/* SubstringBeforeFunction.java --
+/* SubstringBeforeFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -93,5 +93,5 @@ final class SubstringBeforeFunction
{
return "substring-before(" + arg1 + "," + arg2 + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/SubstringFunction.java b/gnu/xml/xpath/SubstringFunction.java
index 33bcade0c..d17c3b662 100644
--- a/gnu/xml/xpath/SubstringFunction.java
+++ b/gnu/xml/xpath/SubstringFunction.java
@@ -1,4 +1,4 @@
-/* SubstringFunction.java --
+/* SubstringFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -91,7 +91,7 @@ final class SubstringFunction
{
Object val3 = arg3.evaluate(context, pos, len);
int v3 = Expr.intValue(val3);
- if (v3 < l)
+ if (v3 < l)
l = v3;
}
@@ -115,5 +115,5 @@ final class SubstringFunction
return (arg3 == null) ? "substring(" + arg1 + "," + arg2 + ")" :
"substring(" + arg1 + "," + arg2 + "," + arg3 + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/SumFunction.java b/gnu/xml/xpath/SumFunction.java
index 73db2a91d..6c3323fb2 100644
--- a/gnu/xml/xpath/SumFunction.java
+++ b/gnu/xml/xpath/SumFunction.java
@@ -1,4 +1,4 @@
-/* SumFunction.java --
+/* SumFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -66,18 +66,18 @@ final class SumFunction
this.arg = arg;
}
- @Override
+ @Override
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
double sum = 0.0d;
if (val instanceof Collection)
{
- /* Suppression is safe, as we know context produces
- Collection<Node> */
- @SuppressWarnings("unchecked")
- Collection<Node> nodes = (Collection<Node>) val;
- for (Node node : nodes)
+ /* Suppression is safe, as we know context produces
+ Collection<Node> */
+ @SuppressWarnings("unchecked")
+ Collection<Node> nodes = (Collection<Node>) val;
+ for (Node node : nodes)
{
String s = stringValue(node);
sum += _number(context, s);
@@ -100,5 +100,5 @@ final class SumFunction
{
return "sum(" + arg + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/Test.java b/gnu/xml/xpath/Test.java
index 94837ffac..529c99bd8 100644
--- a/gnu/xml/xpath/Test.java
+++ b/gnu/xml/xpath/Test.java
@@ -1,4 +1,4 @@
-/* Test.java --
+/* Test.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/gnu/xml/xpath/TranslateFunction.java b/gnu/xml/xpath/TranslateFunction.java
index 8b4b8b233..4e06354c3 100644
--- a/gnu/xml/xpath/TranslateFunction.java
+++ b/gnu/xml/xpath/TranslateFunction.java
@@ -1,4 +1,4 @@
-/* TranslateFunction.java --
+/* TranslateFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -110,8 +110,8 @@ final class TranslateFunction
if (!replaced)
{
buf.append(c);
- }
- }
+ }
+ }
return buf.toString();
}
@@ -126,10 +126,10 @@ final class TranslateFunction
return (arg1.references(var) || arg2.references(var) ||
arg3.references(var));
}
-
+
public String toString()
{
return "translate(" + arg1 + "," + arg2 + "," + arg3 + ")";
}
-
+
}
diff --git a/gnu/xml/xpath/TrueFunction.java b/gnu/xml/xpath/TrueFunction.java
index 6ad42d726..41ab54b75 100644
--- a/gnu/xml/xpath/TrueFunction.java
+++ b/gnu/xml/xpath/TrueFunction.java
@@ -1,4 +1,4 @@
-/* TrueFunction.java --
+/* TrueFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -68,5 +68,5 @@ final class TrueFunction
{
return "true()";
}
-
+
}
diff --git a/gnu/xml/xpath/UnionExpr.java b/gnu/xml/xpath/UnionExpr.java
index 03ae5c06d..bd5f5e990 100644
--- a/gnu/xml/xpath/UnionExpr.java
+++ b/gnu/xml/xpath/UnionExpr.java
@@ -1,4 +1,4 @@
-/* UnionExpr.java --
+/* UnionExpr.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -74,7 +74,7 @@ public final class UnionExpr
return false;
}
- @Override
+ @Override
public Object evaluate(Node context, int pos, int len)
{
Object left = lhs.evaluate(context, pos, len);
@@ -83,13 +83,13 @@ public final class UnionExpr
if (left instanceof Collection && right instanceof Collection)
{
Set<Node> set = new HashSet<Node>();
- /* Suppression is safe as addAll will check the types
- of the elements and throw a ClassCastException as necessary */
- @SuppressWarnings("unchecked")
- Collection<Node> l = (Collection<Node>) left;
- @SuppressWarnings("unchecked")
- Collection<Node> r = (Collection<Node>) right;
- set.addAll (l);
+ /* Suppression is safe as addAll will check the types
+ of the elements and throw a ClassCastException as necessary */
+ @SuppressWarnings("unchecked")
+ Collection<Node> l = (Collection<Node>) left;
+ @SuppressWarnings("unchecked")
+ Collection<Node> r = (Collection<Node>) right;
+ set.addAll (l);
set.addAll (r);
list = new ArrayList<Node>(set);
Collections.sort(list, documentOrderComparator);
@@ -113,5 +113,5 @@ public final class UnionExpr
{
return lhs + " | " + rhs;
}
-
+
}
diff --git a/gnu/xml/xpath/VariableReference.java b/gnu/xml/xpath/VariableReference.java
index 9ef6f160f..e1698c94c 100644
--- a/gnu/xml/xpath/VariableReference.java
+++ b/gnu/xml/xpath/VariableReference.java
@@ -1,4 +1,4 @@
-/* VariableReference.java --
+/* VariableReference.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -98,5 +98,5 @@ public class VariableReference
buf.append(name.getLocalPart());
return buf.toString();
}
-
+
}
diff --git a/gnu/xml/xpath/XPathFactoryImpl.java b/gnu/xml/xpath/XPathFactoryImpl.java
index 45dc57ed1..970cf0e5d 100644
--- a/gnu/xml/xpath/XPathFactoryImpl.java
+++ b/gnu/xml/xpath/XPathFactoryImpl.java
@@ -1,4 +1,4 @@
-/* XPathFactoryImpl.java --
+/* XPathFactoryImpl.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -86,5 +86,5 @@ public class XPathFactoryImpl
{
return new XPathImpl(null, variableResolver, functionResolver);
}
-
+
}
diff --git a/gnu/xml/xpath/XPathImpl.java b/gnu/xml/xpath/XPathImpl.java
index 3511834ca..62f86171b 100644
--- a/gnu/xml/xpath/XPathImpl.java
+++ b/gnu/xml/xpath/XPathImpl.java
@@ -1,4 +1,4 @@
-/* XPathImpl.java --
+/* XPathImpl.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -126,7 +126,7 @@ public class XPathImpl
throw new XPathExpressionException(expression);
}
}
-
+
public Object evaluate(String expression,
Object item,
QName returnType)
diff --git a/gnu/xml/xpath/XPathParser.java b/gnu/xml/xpath/XPathParser.java
index e8c8e94da..26e59091e 100644
--- a/gnu/xml/xpath/XPathParser.java
+++ b/gnu/xml/xpath/XPathParser.java
@@ -1,6 +1,6 @@
// created by jay 0.8 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
- // line 2 "XPathParser.y"
+ // line 2 "XPathParser.y"
/* XPathParser.y - An XPath 1.0 parser.
Copyright (C) 2004 The Free Software Foundation
@@ -206,7 +206,7 @@ public class XPathParser
return new FunctionCall(functionResolver, name, args);
}
- // line 211 "-"
+ // line 211 "-"
// %token constants
public static final int LITERAL = 257;
@@ -364,7 +364,7 @@ public class XPathParser
@throws yyException on irrecoverable parse error.
*/
public Object yyparse (yyInput yyLex, Object yydebug)
- throws java.io.IOException, yyException {
+ throws java.io.IOException, yyException {
//t this.yydebug = (jay.yydebug.yyDebug)yydebug;
return yyparse(yyLex);
}
@@ -392,15 +392,15 @@ public class XPathParser
@throws yyException on irrecoverable parse error.
*/
public Object yyparse (yyInput yyLex)
- throws java.io.IOException, yyException {
- if (yyMax <= 0) yyMax = 256; // initial size
- int yyState = 0, yyStates[] = new int[yyMax]; // state stack
- Object yyVal = null, yyVals[] = new Object[yyMax]; // value stack
- int yyToken = -1; // current input
- int yyErrorFlag = 0; // #tks to shift
+ throws java.io.IOException, yyException {
+ if (yyMax <= 0) yyMax = 256; // initial size
+ int yyState = 0, yyStates[] = new int[yyMax]; // state stack
+ Object yyVal = null, yyVals[] = new Object[yyMax]; // value stack
+ int yyToken = -1; // current input
+ int yyErrorFlag = 0; // #tks to shift
yyLoop: for (int yyTop = 0;; ++ yyTop) {
- if (yyTop >= yyStates.length) { // dynamically increase
+ if (yyTop >= yyStates.length) { // dynamically increase
int[] i = new int[yyStates.length+yyMax];
System.arraycopy(yyStates, 0, i, 0, yyStates.length);
yyStates = i;
@@ -412,9 +412,9 @@ public class XPathParser
yyVals[yyTop] = yyVal;
//t if (yydebug != null) yydebug.push(yyState, yyVal);
- yyDiscarded: for (;;) { // discarding a token does not change stack
+ yyDiscarded: for (;;) { // discarding a token does not change stack
int yyN;
- if ((yyN = YyDefRedClass.yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
+ if ((yyN = YyDefRedClass.yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
if (yyToken < 0) {
yyToken = yyLex.advance() ? yyLex.token() : 0;
//t if (yydebug != null)
@@ -424,7 +424,7 @@ public class XPathParser
&& yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyToken) {
//t if (yydebug != null)
//t yydebug.shift(yyState, YyTableClass.yyTable[yyN], yyErrorFlag-1);
- yyState = YyTableClass.yyTable[yyN]; // shift to yyN
+ yyState = YyTableClass.yyTable[yyN]; // shift to yyN
yyVal = yyLex.value();
yyToken = -1;
if (yyErrorFlag > 0) -- yyErrorFlag;
@@ -432,14 +432,14 @@ public class XPathParser
}
if ((yyN = YyRindexClass.yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
&& yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyToken)
- yyN = YyTableClass.yyTable[yyN]; // reduce (yyN)
+ yyN = YyTableClass.yyTable[yyN]; // reduce (yyN)
else
switch (yyErrorFlag) {
-
+
case 0:
yyerror("syntax error", yyExpecting(yyState));
//t if (yydebug != null) yydebug.error("syntax error");
-
+
case 1: case 2:
yyErrorFlag = 3;
do {
@@ -456,7 +456,7 @@ public class XPathParser
} while (-- yyTop >= 0);
//t if (yydebug != null) yydebug.reject();
throw new yyException("irrecoverable syntax error");
-
+
case 3:
if (yyToken == 0) {
//t if (yydebug != null) yydebug.reject();
@@ -464,9 +464,9 @@ public class XPathParser
}
//t if (yydebug != null)
//t yydebug.discard(yyState, yyToken, yyname(yyToken),
-//t yyLex.value());
+//t yyLex.value());
yyToken = -1;
- continue yyDiscarded; // leave stack alone
+ continue yyDiscarded; // leave stack alone
}
}
int yyV = yyTop + 1-YyLenClass.yyLen[yyN];
@@ -475,13 +475,13 @@ public class XPathParser
yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
switch (yyN) {
case 4:
- // line 277 "XPathParser.y"
+ // line 277 "XPathParser.y"
{
yyVal = new Root();
}
break;
case 5:
- // line 281 "XPathParser.y"
+ // line 281 "XPathParser.y"
{
Steps steps;
if (yyVals[0+yyTop] instanceof Steps)
@@ -499,7 +499,7 @@ case 5:
}
break;
case 6:
- // line 297 "XPathParser.y"
+ // line 297 "XPathParser.y"
{
Test nt = new NodeTypeTest((short) 0);
Selector s = new Selector(Selector.DESCENDANT_OR_SELF,
@@ -522,7 +522,7 @@ case 6:
}
break;
case 8:
- // line 322 "XPathParser.y"
+ // line 322 "XPathParser.y"
{
Steps steps;
if (yyVals[-2+yyTop] instanceof Steps)
@@ -540,7 +540,7 @@ case 8:
}
break;
case 9:
- // line 338 "XPathParser.y"
+ // line 338 "XPathParser.y"
{
Test nt = new NodeTypeTest((short) 0);
Selector s = new Selector(Selector.DESCENDANT_OR_SELF,
@@ -563,14 +563,14 @@ case 9:
}
break;
case 10:
- // line 362 "XPathParser.y"
+ // line 362 "XPathParser.y"
{
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>) yyVals[0+yyTop];
yyVal = new Selector (Selector.CHILD, tests);
}
break;
case 11:
- // line 366 "XPathParser.y"
+ // line 366 "XPathParser.y"
{
/* This is safe as we create this in one of the other cases */
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>) yyVals[0+yyTop];
@@ -578,7 +578,7 @@ case 11:
}
break;
case 12:
- // line 370 "XPathParser.y"
+ // line 370 "XPathParser.y"
{
/* This is safe as we create this in one of the other cases */
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>) yyVals[0+yyTop];
@@ -586,21 +586,21 @@ case 12:
}
break;
case 13:
- // line 374 "XPathParser.y"
+ // line 374 "XPathParser.y"
{
List<Test> emptyList = Collections.emptyList();
yyVal = new Selector (Selector.SELF, emptyList);
}
break;
case 14:
- // line 378 "XPathParser.y"
+ // line 378 "XPathParser.y"
{
List<Test> emptyList = Collections.emptyList();
yyVal = new Selector (Selector.PARENT, emptyList);
}
break;
case 15:
- // line 385 "XPathParser.y"
+ // line 385 "XPathParser.y"
{
List<Test> list = new ArrayList<Test>();
list.add((Test) yyVals[0+yyTop]);
@@ -608,7 +608,7 @@ case 15:
}
break;
case 16:
- // line 391 "XPathParser.y"
+ // line 391 "XPathParser.y"
{
/* This is safe as we create this in one of the other cases */
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>)yyVals[-1+yyTop];
@@ -617,128 +617,128 @@ case 16:
}
break;
case 17:
- // line 415 "XPathParser.y"
+ // line 415 "XPathParser.y"
{
yyVal = new Integer(Selector.ANCESTOR);
}
break;
case 18:
- // line 419 "XPathParser.y"
+ // line 419 "XPathParser.y"
{
yyVal = new Integer(Selector.ANCESTOR_OR_SELF);
}
break;
case 19:
- // line 423 "XPathParser.y"
+ // line 423 "XPathParser.y"
{
yyVal = new Integer(Selector.ATTRIBUTE);
}
break;
case 20:
- // line 427 "XPathParser.y"
+ // line 427 "XPathParser.y"
{
yyVal = new Integer(Selector.CHILD);
}
break;
case 21:
- // line 431 "XPathParser.y"
+ // line 431 "XPathParser.y"
{
yyVal = new Integer(Selector.DESCENDANT);
}
break;
case 22:
- // line 435 "XPathParser.y"
+ // line 435 "XPathParser.y"
{
yyVal = new Integer(Selector.DESCENDANT_OR_SELF);
}
break;
case 23:
- // line 439 "XPathParser.y"
+ // line 439 "XPathParser.y"
{
yyVal = new Integer(Selector.FOLLOWING);
}
break;
case 24:
- // line 443 "XPathParser.y"
+ // line 443 "XPathParser.y"
{
yyVal = new Integer(Selector.FOLLOWING_SIBLING);
}
break;
case 25:
- // line 447 "XPathParser.y"
+ // line 447 "XPathParser.y"
{
yyVal = new Integer(Selector.NAMESPACE);
}
break;
case 26:
- // line 451 "XPathParser.y"
+ // line 451 "XPathParser.y"
{
yyVal = new Integer(Selector.PARENT);
}
break;
case 27:
- // line 455 "XPathParser.y"
+ // line 455 "XPathParser.y"
{
yyVal = new Integer(Selector.PRECEDING);
}
break;
case 28:
- // line 459 "XPathParser.y"
+ // line 459 "XPathParser.y"
{
yyVal = new Integer(Selector.PRECEDING_SIBLING);
}
break;
case 29:
- // line 463 "XPathParser.y"
+ // line 463 "XPathParser.y"
{
yyVal = new Integer(Selector.SELF);
}
break;
case 31:
- // line 472 "XPathParser.y"
+ // line 472 "XPathParser.y"
{
yyVal = new NodeTypeTest(Node.PROCESSING_INSTRUCTION_NODE, (String) yyVals[-1+yyTop]);
}
break;
case 32:
- // line 477 "XPathParser.y"
+ // line 477 "XPathParser.y"
{
yyVal = new NodeTypeTest(((Short) yyVals[-1+yyTop]).shortValue());
}
break;
case 33:
- // line 484 "XPathParser.y"
+ // line 484 "XPathParser.y"
{
yyVal = new Predicate((Expr) yyVals[-1+yyTop]);
}
break;
case 35:
- // line 492 "XPathParser.y"
+ // line 492 "XPathParser.y"
{
yyVal = new ParenthesizedExpr((Expr) yyVals[-1+yyTop]);
}
break;
case 36:
- // line 496 "XPathParser.y"
+ // line 496 "XPathParser.y"
{
yyVal = new Constant(yyVals[0+yyTop]);
}
break;
case 37:
- // line 500 "XPathParser.y"
+ // line 500 "XPathParser.y"
{
yyVal = new Constant(yyVals[0+yyTop]);
}
break;
case 39:
- // line 508 "XPathParser.y"
+ // line 508 "XPathParser.y"
{
List<Expr> emptyList = Collections.emptyList();
yyVal = lookupFunction((String) yyVals[-2+yyTop], emptyList);
}
break;
case 40:
- // line 512 "XPathParser.y"
+ // line 512 "XPathParser.y"
{
/* This is safe as we create this below */
@SuppressWarnings("unchecked") List<Expr> exprs = (List<Expr>) yyVals[-1+yyTop];
@@ -746,7 +746,7 @@ case 40:
}
break;
case 41:
- // line 519 "XPathParser.y"
+ // line 519 "XPathParser.y"
{
List<Expr> list = new ArrayList<Expr>();
list.add((Expr) yyVals[0+yyTop]);
@@ -754,7 +754,7 @@ case 41:
}
break;
case 42:
- // line 525 "XPathParser.y"
+ // line 525 "XPathParser.y"
{
/* This is safe as we create this above */
@SuppressWarnings("unchecked") List<Expr> list = (List<Expr>) yyVals[0+yyTop];
@@ -763,13 +763,13 @@ case 42:
}
break;
case 44:
- // line 535 "XPathParser.y"
+ // line 535 "XPathParser.y"
{
yyVal = new UnionExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop]);
}
break;
case 47:
- // line 544 "XPathParser.y"
+ // line 544 "XPathParser.y"
{
Steps steps;
if (yyVals[0+yyTop] instanceof Steps)
@@ -787,7 +787,7 @@ case 47:
}
break;
case 48:
- // line 560 "XPathParser.y"
+ // line 560 "XPathParser.y"
{
Test nt = new NodeTypeTest((short) 0);
Selector s = new Selector(Selector.DESCENDANT_OR_SELF,
@@ -810,7 +810,7 @@ case 48:
}
break;
case 50:
- // line 585 "XPathParser.y"
+ // line 585 "XPathParser.y"
{
Predicate filter = (Predicate) yyVals[0+yyTop];
Selector s = new Selector(Selector.SELF,
@@ -831,171 +831,171 @@ case 50:
}
break;
case 52:
- // line 608 "XPathParser.y"
+ // line 608 "XPathParser.y"
{
yyVal = new OrExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop]);
}
break;
case 54:
- // line 616 "XPathParser.y"
+ // line 616 "XPathParser.y"
{
yyVal = new AndExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop]);
}
break;
case 56:
- // line 624 "XPathParser.y"
+ // line 624 "XPathParser.y"
{
yyVal = new EqualityExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], false);
}
break;
case 57:
- // line 628 "XPathParser.y"
+ // line 628 "XPathParser.y"
{
yyVal = new EqualityExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], true);
}
break;
case 59:
- // line 636 "XPathParser.y"
+ // line 636 "XPathParser.y"
{
yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], true, false);
}
break;
case 60:
- // line 640 "XPathParser.y"
+ // line 640 "XPathParser.y"
{
yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], false, false);
}
break;
case 61:
- // line 644 "XPathParser.y"
+ // line 644 "XPathParser.y"
{
yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], true, true);
}
break;
case 62:
- // line 648 "XPathParser.y"
+ // line 648 "XPathParser.y"
{
yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], false, true);
}
break;
case 64:
- // line 656 "XPathParser.y"
+ // line 656 "XPathParser.y"
{
yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.ADD);
}
break;
case 65:
- // line 660 "XPathParser.y"
+ // line 660 "XPathParser.y"
{
yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.SUBTRACT);
}
break;
case 67:
- // line 668 "XPathParser.y"
+ // line 668 "XPathParser.y"
{
yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.MULTIPLY);
}
break;
case 68:
- // line 672 "XPathParser.y"
+ // line 672 "XPathParser.y"
{
yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.DIVIDE);
}
break;
case 69:
- // line 676 "XPathParser.y"
+ // line 676 "XPathParser.y"
{
yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.MODULO);
}
break;
case 71:
- // line 684 "XPathParser.y"
+ // line 684 "XPathParser.y"
{
yyVal = new NegativeExpr((Expr) yyVals[0+yyTop]);
}
break;
case 72:
- // line 691 "XPathParser.y"
+ // line 691 "XPathParser.y"
{
yyVal = new Double((String) yyVals[0+yyTop] + ".0");
}
break;
case 73:
- // line 695 "XPathParser.y"
+ // line 695 "XPathParser.y"
{
yyVal = new Double((String) yyVals[-1+yyTop] + ".0");
}
break;
case 74:
- // line 699 "XPathParser.y"
+ // line 699 "XPathParser.y"
{
yyVal = new Double((String) yyVals[-2+yyTop] + "." + (String) yyVals[0+yyTop]);
}
break;
case 75:
- // line 703 "XPathParser.y"
+ // line 703 "XPathParser.y"
{
yyVal = new Double("0." + (String) yyVals[0+yyTop]);
}
break;
case 77:
- // line 732 "XPathParser.y"
+ // line 732 "XPathParser.y"
{
String name = (String) yyVals[0+yyTop];
yyVal = new VariableReference(variableResolver, getQName(name));
}
break;
case 78:
- // line 740 "XPathParser.y"
+ // line 740 "XPathParser.y"
{
yyVal = new NameTest(null, true, true);
}
break;
case 79:
- // line 744 "XPathParser.y"
+ // line 744 "XPathParser.y"
{
QName qName = getQName((String) yyVals[-2+yyTop]);
yyVal = new NameTest(qName, true, false);
}
break;
case 80:
- // line 749 "XPathParser.y"
+ // line 749 "XPathParser.y"
{
QName qName = getQName((String) yyVals[0+yyTop]);
yyVal = new NameTest(qName, false, false);
}
break;
case 82:
- // line 758 "XPathParser.y"
+ // line 758 "XPathParser.y"
{
yyVal = (String) yyVals[-2+yyTop] + ':' + (String) yyVals[0+yyTop];
}
break;
case 83:
- // line 765 "XPathParser.y"
+ // line 765 "XPathParser.y"
{
yyVal = new Short(Node.COMMENT_NODE);
}
break;
case 84:
- // line 769 "XPathParser.y"
+ // line 769 "XPathParser.y"
{
yyVal = new Short(Node.TEXT_NODE);
}
break;
case 85:
- // line 773 "XPathParser.y"
+ // line 773 "XPathParser.y"
{
yyVal = new Short(Node.PROCESSING_INSTRUCTION_NODE);
}
break;
case 86:
- // line 777 "XPathParser.y"
+ // line 777 "XPathParser.y"
{
yyVal = new Short((short) 0);
}
break;
- // line 988 "-"
+ // line 988 "-"
}
yyTop -= YyLenClass.yyLen[yyN];
yyState = yyStates[yyTop];
@@ -1020,7 +1020,7 @@ case 86:
else
yyState = YyDgotoClass.yyDgoto[yyM];
//t if (yydebug != null) yydebug.shift(yyStates[yyTop], yyState);
- continue yyLoop;
+ continue yyLoop;
}
}
}
@@ -1438,7 +1438,7 @@ case 86:
protected static final class YyNameClass {
- public static final String yyName [] = {
+ public static final String yyName [] = {
"end-of-file",null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
@@ -1469,7 +1469,7 @@ case 86:
} /* End of class YyNameClass */
- // line 783 "XPathParser.y"
+ // line 783 "XPathParser.y"
}
- // line 1463 "-"
+ // line 1463 "-"
diff --git a/gnu/xml/xpath/XPathTokenizer.java b/gnu/xml/xpath/XPathTokenizer.java
index bf4516afa..879931bd5 100644
--- a/gnu/xml/xpath/XPathTokenizer.java
+++ b/gnu/xml/xpath/XPathTokenizer.java
@@ -1,4 +1,4 @@
-/* XPathTokenizer.java --
+/* XPathTokenizer.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ import antlr.TokenStreamIOException;*/
/**
* XPath 1.0 expression tokenizer.
- *
+ *
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class XPathTokenizer
@@ -89,7 +89,7 @@ implements XPathParser.yyInput
{
return val;
}
-
+
}
static final Map<String,Integer> keywords = new TreeMap<String,Integer> ();
@@ -151,7 +151,7 @@ implements XPathParser.yyInput
throw new TokenStreamIOException (e);
}
}
-
+
* End ANTLR specific */
public boolean advance ()