Import upstream snapshot 2.0.6+git20180529
Andrej Shadura
5 years ago
0 | #FindBugs User Preferences | |
1 | #Tue Sep 20 20:18:08 EDT 2011 | |
2 | detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true | |
3 | detectorBadAppletConstructor=BadAppletConstructor|false | |
4 | detectorBadResultSetAccess=BadResultSetAccess|true | |
5 | detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true | |
6 | detectorBadUseOfReturnValue=BadUseOfReturnValue|true | |
7 | detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true | |
8 | detectorBooleanReturnNull=BooleanReturnNull|true | |
9 | detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false | |
10 | detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true | |
11 | detectorCheckTypeQualifiers=CheckTypeQualifiers|true | |
12 | detectorCloneIdiom=CloneIdiom|true | |
13 | detectorComparatorIdiom=ComparatorIdiom|true | |
14 | detectorConfusedInheritance=ConfusedInheritance|true | |
15 | detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true | |
16 | detectorCrossSiteScripting=CrossSiteScripting|true | |
17 | detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true | |
18 | detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true | |
19 | detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true | |
20 | detectorDontUseEnum=DontUseEnum|true | |
21 | detectorDroppedException=DroppedException|true | |
22 | detectorDumbMethodInvocations=DumbMethodInvocations|true | |
23 | detectorDumbMethods=DumbMethods|true | |
24 | detectorDuplicateBranches=DuplicateBranches|true | |
25 | detectorEmptyZipFileEntry=EmptyZipFileEntry|true | |
26 | detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true | |
27 | detectorFinalizerNullsFields=FinalizerNullsFields|true | |
28 | detectorFindBadCast2=FindBadCast2|true | |
29 | detectorFindBadForLoop=FindBadForLoop|true | |
30 | detectorFindCircularDependencies=FindCircularDependencies|false | |
31 | detectorFindDeadLocalStores=FindDeadLocalStores|true | |
32 | detectorFindDoubleCheck=FindDoubleCheck|true | |
33 | detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true | |
34 | detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true | |
35 | detectorFindFinalizeInvocations=FindFinalizeInvocations|true | |
36 | detectorFindFloatEquality=FindFloatEquality|true | |
37 | detectorFindHEmismatch=FindHEmismatch|true | |
38 | detectorFindInconsistentSync2=FindInconsistentSync2|true | |
39 | detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true | |
40 | detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true | |
41 | detectorFindMaskedFields=FindMaskedFields|true | |
42 | detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true | |
43 | detectorFindNakedNotify=FindNakedNotify|true | |
44 | detectorFindNonSerializableStoreIntoSession=FindNonSerializableStoreIntoSession|true | |
45 | detectorFindNonSerializableValuePassedToWriteObject=FindNonSerializableValuePassedToWriteObject|true | |
46 | detectorFindNonShortCircuit=FindNonShortCircuit|true | |
47 | detectorFindNullDeref=FindNullDeref|true | |
48 | detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true | |
49 | detectorFindOpenStream=FindOpenStream|true | |
50 | detectorFindPuzzlers=FindPuzzlers|true | |
51 | detectorFindRefComparison=FindRefComparison|true | |
52 | detectorFindReturnRef=FindReturnRef|true | |
53 | detectorFindRunInvocations=FindRunInvocations|true | |
54 | detectorFindSelfComparison=FindSelfComparison|true | |
55 | detectorFindSelfComparison2=FindSelfComparison2|true | |
56 | detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true | |
57 | detectorFindSpinLoop=FindSpinLoop|true | |
58 | detectorFindSqlInjection=FindSqlInjection|true | |
59 | detectorFindTwoLockWait=FindTwoLockWait|true | |
60 | detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true | |
61 | detectorFindUnconditionalWait=FindUnconditionalWait|true | |
62 | detectorFindUninitializedGet=FindUninitializedGet|true | |
63 | detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true | |
64 | detectorFindUnreleasedLock=FindUnreleasedLock|true | |
65 | detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true | |
66 | detectorFindUnsyncGet=FindUnsyncGet|true | |
67 | detectorFindUselessControlFlow=FindUselessControlFlow|true | |
68 | detectorFormatStringChecker=FormatStringChecker|true | |
69 | detectorHugeSharedStringConstants=HugeSharedStringConstants|true | |
70 | detectorIDivResultCastToDouble=IDivResultCastToDouble|true | |
71 | detectorIncompatMask=IncompatMask|true | |
72 | detectorInconsistentAnnotations=InconsistentAnnotations|true | |
73 | detectorInefficientMemberAccess=InefficientMemberAccess|false | |
74 | detectorInefficientToArray=InefficientToArray|true | |
75 | detectorInfiniteLoop=InfiniteLoop|true | |
76 | detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true | |
77 | detectorInfiniteRecursiveLoop2=InfiniteRecursiveLoop2|false | |
78 | detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true | |
79 | detectorInitializationChain=InitializationChain|true | |
80 | detectorInstantiateStaticClass=InstantiateStaticClass|true | |
81 | detectorInvalidJUnitTest=InvalidJUnitTest|true | |
82 | detectorIteratorIdioms=IteratorIdioms|true | |
83 | detectorLazyInit=LazyInit|true | |
84 | detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true | |
85 | detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true | |
86 | detectorMethodReturnCheck=MethodReturnCheck|true | |
87 | detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true | |
88 | detectorMutableLock=MutableLock|true | |
89 | detectorMutableStaticFields=MutableStaticFields|true | |
90 | detectorNaming=Naming|true | |
91 | detectorNumberConstructor=NumberConstructor|true | |
92 | detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true | |
93 | detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true | |
94 | detectorPublicSemaphores=PublicSemaphores|false | |
95 | detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true | |
96 | detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true | |
97 | detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true | |
98 | detectorRedundantInterfaces=RedundantInterfaces|true | |
99 | detectorRepeatedConditionals=RepeatedConditionals|true | |
100 | detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true | |
101 | detectorSerializableIdiom=SerializableIdiom|true | |
102 | detectorStartInConstructor=StartInConstructor|true | |
103 | detectorStaticCalendarDetector=StaticCalendarDetector|true | |
104 | detectorStringConcatenation=StringConcatenation|true | |
105 | detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true | |
106 | detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true | |
107 | detectorSwitchFallthrough=SwitchFallthrough|true | |
108 | detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true | |
109 | detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true | |
110 | detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true | |
111 | detectorURLProblems=URLProblems|true | |
112 | detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true | |
113 | detectorUnnecessaryMath=UnnecessaryMath|true | |
114 | detectorUnreadFields=UnreadFields|true | |
115 | detectorUseObjectEquals=UseObjectEquals|false | |
116 | detectorUselessSubclassMethod=UselessSubclassMethod|false | |
117 | detectorVarArgsProblems=VarArgsProblems|true | |
118 | detectorVolatileUsage=VolatileUsage|true | |
119 | detectorWaitInLoop=WaitInLoop|true | |
120 | detectorWrongMapIterator=WrongMapIterator|true | |
121 | detectorXMLFactoryBypass=XMLFactoryBypass|true | |
122 | detector_threshold=2 | |
123 | effort=default | |
124 | excludefilter0=FindBugsExcludeFilter.xml | |
125 | filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,MT_CORRECTNESS,PERFORMANCE,STYLE|false | |
126 | filter_settings_neg=MALICIOUS_CODE,NOISE,I18N,SECURITY,EXPERIMENTAL| | |
127 | includefilter0=FindBugsIncludeFilter.xml | |
128 | run_at_full_build=false |
0 | /.classpath | |
1 | /.project | |
2 | /.idea/inspectionProfiles | |
3 | /ebuild | |
4 | /.settings | |
5 | /build | |
6 | /cobertura.ser | |
7 | /build.properties | |
8 | /bin |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <project version="4"> | |
2 | <component name="CompilerConfiguration"> | |
3 | <wildcardResourcePatterns> | |
4 | <entry name="!?*.java" /> | |
5 | <entry name="!?*.form" /> | |
6 | <entry name="!?*.class" /> | |
7 | <entry name="!?*.groovy" /> | |
8 | <entry name="!?*.scala" /> | |
9 | <entry name="!?*.flex" /> | |
10 | <entry name="!?*.kt" /> | |
11 | <entry name="!?*.clj" /> | |
12 | </wildcardResourcePatterns> | |
13 | </component> | |
14 | </project>⏎ |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <project version="4"> | |
2 | <component name="Encoding"> | |
3 | <file url="PROJECT" charset="UTF-8" /> | |
4 | </component> | |
5 | </project>⏎ |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <project version="4"> | |
2 | <component name="GradleSettings"> | |
3 | <option name="linkedExternalProjectsSettings"> | |
4 | <GradleProjectSettings> | |
5 | <option name="distributionType" value="WRAPPED" /> | |
6 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> | |
7 | <option name="modules"> | |
8 | <set> | |
9 | <option value="$PROJECT_DIR$" /> | |
10 | <option value="$PROJECT_DIR$/contrib" /> | |
11 | <option value="$PROJECT_DIR$/core" /> | |
12 | <option value="$PROJECT_DIR$/test" /> | |
13 | </set> | |
14 | </option> | |
15 | <option name="useAutoImport" value="true" /> | |
16 | </GradleProjectSettings> | |
17 | </option> | |
18 | </component> | |
19 | </project>⏎ |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <project version="4"> | |
2 | <component name="ExternalStorageConfigurationManager" enabled="true" /> | |
3 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
4 | <output url="file://$PROJECT_DIR$/classes" /> | |
5 | </component> | |
6 | </project>⏎ |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <project version="4"> | |
2 | <component name="VcsDirectoryMappings"> | |
3 | <mapping directory="" vcs="Git" /> | |
4 | </component> | |
5 | </project>⏎ |
0 | !!! This file is no longer maintained. Please see the GitHub Commits !!! | |
1 | https://github.com/hunterhacker/jdom/commits/master | |
2 | ||
3 | ||
4 | * * * * * * JDOM 1.1.1 (tag: jdom_1_1_1) from JDOM 1.1 * * * * * * | |
5 | ||
6 | Fixed a synchronization issue in the Namespace class that could cause a | |
7 | hang when doing concurrent builds. | |
8 | ||
9 | Added output support for Unicode surrogate pairs. | |
10 | ||
11 | Added a new flag on SAXBuilder named setFastReconfigure() which, when set, | |
12 | can speed reconfiguration by skipping repeated attempts to set features that | |
13 | are determined not to be present on a parser. Useful when doing many builds | |
14 | per second. | |
15 | ||
16 | Updated the provided Jaxen library from a modified Jaxen 1.0 to the latest | |
17 | which is Jaxen 1.1.1. | |
18 | ||
19 | Added reflection code in the error reporting system to support Android's | |
20 | Dalvik VM which doesn't have the java.rmi.* classes. | |
21 | ||
22 | ||
23 | * * * * * * JDOM 1.1 (tag: jdom_1_1) from JDOM 1.0 * * * * * * | |
24 | ||
25 | Added an additional constructor to JDOMSource with an EntityResolver which is | |
26 | passed to the internal DocumentReader allowing the SAXOutputter to properly | |
27 | resolve DTDs. | |
28 | ||
29 | Added a forceNamespaceAware property to DOMOutputter which specifies you want | |
30 | a DOM constructed with namespaces even if the source JDOM document has no | |
31 | namespaces. | |
32 | ||
33 | Added support for attribute "INF" and "-INF" values, to indicate positive and | |
34 | negative infinity, as XML Schema allows. | |
35 | ||
36 | Moved isXMLWhitespace() method from private in XMLOutputter to public in | |
37 | Verifier. | |
38 | ||
39 | Clarified XMLOutputter behavior with newlines and indents: | |
40 | setIndent(" ") means newlines and " " indents | |
41 | setIndent("") means newlines and "" indents | |
42 | setIndent(null) means no newlines and no indents | |
43 | ||
44 | Added set/getIgnoringBoundaryWhitespace() methods and features to SAXBuilder | |
45 | and SAXHandler. | |
46 | ||
47 | Added a setFactory() method on XSLTransformer to control the object types | |
48 | built by the transform. | |
49 | ||
50 | Added a string constant for the JDOM_OBJECT_MODEL_URI used by JAXP 1.3. It | |
51 | deserves being part of the public API. | |
52 | ||
53 | Fixed bug in SAXOutputter where default namespaces would be declared as | |
54 | xmlns:="" with a spurious colon. | |
55 | ||
56 | Fixed bug when using attributes without a namespace and outputting to a | |
57 | JDOMResult. | |
58 | ||
59 | Removing check that a comment not start with a hyphen. A careful reading of | |
60 | production 15 in the XML 1.0 spec indicates leading hyphens are in fact | |
61 | allowed. | |
62 | ||
63 | Fixed bug where outputFragment() on SAXOutputter could cause a | |
64 | NullPointerException because the locator would be null during the call. | |
65 | ||
66 | Fixed bug where serializing ElementFilter causes a NullPointerException if the | |
67 | filter has no assigned namespace | |
68 | ||
69 | Fixed some subtle bad behaviors in listIterator.add() logic, using brand new | |
70 | iterator logic. | |
71 | ||
72 | Allowed a String to be passed to ContentList.add(int, Object). | |
73 | ||
74 | Simplified JDOMAbout and renamed info.xml to jdom-info.xml, so | |
75 | getResourceAsStream() won't suffer any name collision. | |
76 | ||
77 | Fixed tiny issue where CDATA could be set with illegal character content. | |
78 | ||
79 | Added logic to escape some special characters in namespace URIs. | |
80 | ||
81 | Fixed bug where the attribute type would change on a setAttribute() call. | |
82 | ||
83 | Improved performance on Namespace handling. | |
84 | ||
85 | Improved and clarified Javadocs. | |
86 | ||
87 | ||
88 | * * * * * * JDOM 1.0 (tag: jdom_1_0) from JDOM Beta10 * * * * * * | |
89 | ||
90 | Added a new lib/jaxen-jdom.jar that solves some XPath ancestry problems | |
91 | introduced by the Parent interface. See the new lib/jaxen.readme for | |
92 | details. | |
93 | ||
94 | Moved the addContent() and setContent() methods from Parent into Element and | |
95 | Document directly. This re-enables method chaining that some people missed. | |
96 | ||
97 | Fixed a few bugs in SAXOutputter: start/endPrefixMapping was not being fired | |
98 | for no namespace, DocType was being improperly constructed, changed to use a | |
99 | DefaultHandler with the dtd parser to better suppress unimportant problems. | |
100 | ||
101 | Added SAXOutputter support for outputting fragments of documents with the | |
102 | new methods: | |
103 | output(Content) | |
104 | outputFragment(List) | |
105 | outputFragment(Content) | |
106 | ||
107 | Added support in XMLOutputter for ignoring the JAXP processing instructions | |
108 | <?javax.xml.transform.enable-output-escaping?> and | |
109 | <?javax.xml.transform.disable-output-escaping?>. Respect for these PIs is | |
110 | toggled by the Format.set/getIgnoreTrAXEscapingPIs() feature, default false. | |
111 | ||
112 | Added to JDOMFactory the methods document(Element rootElement, DocType | |
113 | docType, String baseURI) and entityRef(String elementName, String systemID). | |
114 | These match constructors that were previously overlooked. Also added | |
115 | implementations to DefaultJDOMFactory and UnverifiedJDOMFactory. | |
116 | ||
117 | Added to Element the method getParentElement() that returns the parent element | |
118 | or null if the object is unattached or the root element. | |
119 | ||
120 | Fixed bug in FilterIterator that affected next() calls. | |
121 | ||
122 | Fixed bug in DOMOutputter regarding extraneous namespace declarations | |
123 | appearing under certain conditions. | |
124 | ||
125 | Changed XMLOutputter to clone the Format objects when they're set/get | |
126 | ||
127 | Fixed bug in JDOMResult where the result list could include incomplete | |
128 | results in certain situations, fixed by forcing a flush. | |
129 | ||
130 | Made SAXHandler.flushCharacters() protected again after being private. It's | |
131 | needed for the above fix. | |
132 | ||
133 | Changed Verifier.isXXX() methods from private to public as it was well | |
134 | argued that they're based on unchanging spec productions and can be | |
135 | generally useful even apart from JDOM. | |
136 | ||
137 | Added support for surrogate pairs in the Verifier. (Surrogate pairs don't | |
138 | yet have any special output support.) | |
139 | ||
140 | Fixed bug in SAXBuilder to avoid an IllegalStateException when apps access | |
141 | the partial document when parse failure occurs right after the beginning of | |
142 | the parse. | |
143 | ||
144 | Updated JaxenXPath to avoid the deprecated XPath.valueOf(). | |
145 | ||
146 | Brought the jdom-contrib ElementScanner up to date. | |
147 | ||
148 | Fixed various Javadoc typos. | |
149 | ||
150 | Removed the build-time dependence on saxpath.jar. | |
151 | ||
152 | Removed all deprecated methods. | |
153 | ||
154 | Fixed bug where in "pretty print" output EntityRef instances would erroneously | |
155 | print on their own line. | |
156 | ||
157 | Added character encoding rules to improve whitespace round tripping: | |
158 | http://lists.denveronline.net/lists/jdom-interest/2003-July/013227.html | |
159 | ||
160 | Added DOMBuilder.getFactory() method to match what we added to SAXBuilder. | |
161 | ||
162 | Removed Parent.canContain() and the Document and Element implementations. | |
163 | Moved the logic directly into ContentList. No reason to expose a public | |
164 | method unless it has a general purpose. | |
165 | ||
166 | Reduced the visibility on some XMLOutputter internals that we don't want to | |
167 | guarantee support for over the long term. Some people who want custom output | |
168 | formatting may need to copy some code blocks. That's OK since JDOM is open | |
169 | source and while it's less than ideal, it's better than our exposing protected | |
170 | internal variables and methods that we may have reason to change later. | |
171 | Now marked private: | |
172 | userFormat | |
173 | printString() | |
174 | printContentRange() | |
175 | printTextRange() | |
176 | Now static final: | |
177 | preserveFormat | |
178 | ||
179 | Removed some unnecessary casts. | |
180 | ||
181 | Made a few private methods static where it made sense. Also a select | |
182 | few protected methods. | |
183 | ||
184 | Made the Format constructor private. It used to be pkg protected which | |
185 | doesn't make a lot of sense. | |
186 | ||
187 | Removed equals() from AbstractFilter since it's better to let concrete | |
188 | subclasses define that, as they already were. | |
189 | ||
190 | Removed some unnecessary instanceof and != null checks. | |
191 | ||
192 | -- | |
193 | Added an UncheckedJDOMFactory class which builds without doing any | |
194 | content or structure checks, letting you gain speed in a situation | |
195 | where you have 100% confidence in your parser. The Javadocs for | |
196 | the class naturally includes a serious warning. | |
197 | ||
198 | It's not used by default, but you can select it with a | |
199 | builder.setFactory(new UncheckedJDOMFactory()) call. | |
200 | ||
201 | I also added to JDOMFactory a few methods: | |
202 | addContent(Parent, Content) | |
203 | setAttribute(Element, Attribute) | |
204 | addNamespaceDeclaration(Element, Namespace) | |
205 | ||
206 | These are called during the build to do the adds. The default builder | |
207 | just calls parent.addContent(Content) while the "unchecked" factory does | |
208 | the work without checks using package protected methods on ContentList | |
209 | and AttributeList. | |
210 | ||
211 | A perk of having these methods in the factory and used by the builder | |
212 | is you can write a custom factory to do certain things during the adds. | |
213 | Like you could ignore all elements named "foo" by not doing the add if | |
214 | the Content was an Elt foo. That's not perfect since the elements | |
215 | underneath foo would still be built into a subtree that got ignored, | |
216 | but it's an easy solution to save memory in the resulting document. | |
217 | -- | |
218 | ||
219 | * * * * * * Beta10 (tag: jdom_1_0_b10) from Beta9 * * * * * * | |
220 | ||
221 | PARENT AND CONTENT | |
222 | ------------------ | |
223 | ||
224 | Added a new Parent interface and a new Content abstract class. Parent is | |
225 | implemented by Document and Element. Content is extended by Element, Comment, | |
226 | DocType, EntityRef, ProcessingInstruction, and Text (CDATA). | |
227 | ||
228 | Parent has methods (* means new): | |
229 | Parent addContent(Content child); | |
230 | * Parent addContent(Collection collection); | |
231 | * Parent addContent(int index, Content child); | |
232 | * Parent addContent(int index, Collection collection); | |
233 | * List cloneContent(); | |
234 | * void canContain(Content, int); | |
235 | List getContent(); | |
236 | List getContent(Filter filter); | |
237 | * Content getContent(int index); | |
238 | * int getContentSize(); | |
239 | * Iterator getDescendants() | |
240 | * Iterator getDescendants(Filter) | |
241 | * Document getDocument() | |
242 | * Parent getParent() | |
243 | * int indexOf(Content) | |
244 | * List removeContent(); | |
245 | boolean removeContent(Content child); | |
246 | * List removeContent(Filter filter); | |
247 | * Content removeContent(int index); | |
248 | Parent setContent(Content child); | |
249 | Parent setContent(Collection collection); | |
250 | * Parent setContent(int index, Content child); | |
251 | * Parent setContent(int index, Collection collection); | |
252 | Object clone(); | |
253 | ||
254 | Content has public methods: | |
255 | Content detach(); | |
256 | Document getDocument(); | |
257 | Parent getParent(); | |
258 | * String getValue(); | |
259 | Object clone(); | |
260 | ||
261 | The new methods on Parent are pretty self explanatory. A few methods that used | |
262 | to require getting the content List now work on Parent itself for convenience | |
263 | (tired of all those FAQs). The cloneContent() and removeContent() calls | |
264 | should be especially helpful. The getDescendants() methods is great in | |
265 | providing a mechanism to walk the entire tree from this item down using an | |
266 | optional filter. | |
267 | ||
268 | The getValue() method in Content is defined to return the XPath 1.0 string | |
269 | value of the element. The getText() methods in Element are left unchanged. | |
270 | ||
271 | A subtle change is that getParent() now returns a Parent type which is its | |
272 | immediate parent. Previously an item at the document level would return null | |
273 | and you'd use getDocument() to get its Document. Parent has getParent() as | |
274 | well to make repeated getParent() calls easier. | |
275 | ||
276 | The protected setDocument() methods have been removed in favor of just using | |
277 | setParent(). getDocument() remains as a potentially recursive lookup method. | |
278 | ||
279 | ||
280 | NEW CLASSES | |
281 | ----------- | |
282 | ||
283 | Added an org.jdom.transform.XSLTransformer class to help with simple | |
284 | transformations. It's a one-liner now, the way it should be. Also added an | |
285 | XSLTransformException class to support the XSLTransformer. | |
286 | ||
287 | Added an org.jdom.output.Format class to control XMLOutputter behavior. | |
288 | Format has convenience methods .getRawFormat(), .getPrettyFormat(), and | |
289 | .getCompactFormat() to use in lieu of people having to remember when to trim, | |
290 | set indents, and such. The old XMLOutputter.set*() methods are now deprecated | |
291 | and should be called on a Format instance. The XMLOutputter constructors that | |
292 | took indents and so on are also deprecated. | |
293 | ||
294 | Added an EscapeStrategy plug-in interface for XMLOutputter to determine which | |
295 | chars to escape. A user can set a strategy and go, no need to subclass. | |
296 | ||
297 | Created a DefaultEscapeStrategy which tries to be generally smart. It quickly | |
298 | says no escaping is necessary for UTF-8 (our default) and UTF-16. It escapes | |
299 | everything above 255 for ISO-8859-1/Latin1. It escapes everything above 127 | |
300 | for ASCII. For the other charsets, it tries to use the JDK 1.4 CharsetEncoder | |
301 | to determine if the char needs escaping. Reflection is used for this so JDOM | |
302 | isn't dependent on JDK 1.4. That means if you run on JDK 1.3 there's no | |
303 | escaping unless JDOM knows about the charset itself or you plug in your own. | |
304 | ||
305 | Added a Format.TextMode inner class with values: PRESERVE, TRIM, NORMALIZE, | |
306 | and TRIM_FULL_WHITE. Removed the methods setTextTrim(), setTextNormalize(), | |
307 | and setTrimAllWhite(). Replaced them with setTextMode(Format.TextMode) and | |
308 | getTextMode(). | |
309 | ||
310 | Moved org.jdom.input.JDOMFactory and org.jdom.input.DefaultJDOMFactory into | |
311 | the org.jdom package. | |
312 | ||
313 | ||
314 | NEW METHODS | |
315 | ----------- | |
316 | ||
317 | Added Document.setBaseURI(String) and getBaseURI() to record the effective URI | |
318 | from which the document was loaded (against which relative URLs in the | |
319 | document should be resolved). The builders record the URI when possible. | |
320 | ||
321 | Added a Document(Element, DocType, String baseURI) constructor. | |
322 | ||
323 | ||
324 | ENHANCEMENTS | |
325 | ------------ | |
326 | ||
327 | Incorporated Jaxen 1.0 and Xerces 2.6.1. | |
328 | ||
329 | Enhanced the filter classes so they extend a new AbstractFilter class and | |
330 | inherit its and(), or(), and negate() methods. | |
331 | ||
332 | Added proper hashCode() methods to the filters. | |
333 | ||
334 | Changed the Document's DocType storage so it's part of the ContentList now and | |
335 | has a location that can be preserved. This helps with round tripping. The | |
336 | getDocType() and setDocType() methods remain for convenience but just operate | |
337 | based on searches through the ContentList. Adding logic to ensure the DOCTYPE | |
338 | isn't added after the root, or vice-versa. | |
339 | ||
340 | The Attribute class now trims its value before attempted conversion to a | |
341 | double, float, or boolean values. Also "1" and "0" are legal boolean values | |
342 | following the lead of Schema. | |
343 | ||
344 | Added better support for loading from files whose names have special | |
345 | characters like #. | |
346 | ||
347 | Added a protected SAXHandler.flushCharacters(String) method to allow | |
348 | subclassers to have more control over strings. | |
349 | ||
350 | ||
351 | BUG FIXES | |
352 | --------- | |
353 | ||
354 | Fixed bug in AttributeList.clear() where the cleared list did not reset its | |
355 | size to 0, causing NullPointerException when the list was reused. | |
356 | ||
357 | Fixed bug where serializing a content list using a filter. It wouldn't work | |
358 | because FilterList wasn't serializable. It is now. | |
359 | ||
360 | Fixed bug in ContentList that could theoretically cause problems during | |
361 | reverse iteration. | |
362 | ||
363 | Changed JDOMException.initCause() to return "this" instead of "cause" | |
364 | since that's what Throwable says it should do. | |
365 | ||
366 | Fixed bug with elt.isAncestor() where it had been acting like "is descendant". | |
367 | ||
368 | Fixed bug in DOMOutputter where it could have problems outputting documents | |
369 | with a DocType. | |
370 | ||
371 | ||
372 | DEPRECATED METHODS | |
373 | ------------------ | |
374 | ||
375 | Deprecated the Document(List, DocType) constructor because it doesn't make | |
376 | sense if the DocType should be part of the content list rather than separate. | |
377 | ||
378 | Deprecated the XMLOutputter.set*() methods that now reside in Format. | |
379 | ||
380 | Deprecated the XMLOutputter constructors that took format parameters. Use the | |
381 | constructor that accepts a Format now instead. | |
382 | ||
383 | Deprecated the Attribute constants: | |
384 | Attribute.CDATA_ATTRIBUTE | |
385 | Attribute.ID_ATTRIBUTE | |
386 | Attribute.IDREFS_ATTRIBUTE, etc. | |
387 | Their new names are simpler: | |
388 | Attribute.CDATA_TYPE | |
389 | Attribute.ID_TYPE | |
390 | Attribute.IDREFS_TYPE, etc. | |
391 | ||
392 | Renamed methods from the PI class to be more consistent and explanatory. | |
393 | Deprecating: | |
394 | getNames() | |
395 | getValue() | |
396 | setValue() | |
397 | removeValue() | |
398 | New names: | |
399 | getPseudoAttributeNames() | |
400 | getPseudoAttributeValue() | |
401 | setPseudoAttribute() | |
402 | removePseudoAttribute() | |
403 | ||
404 | Deprecated the methods setTextTrim(), setTextNormalize(), and | |
405 | setTrimAllWhite(). Replaced them with setTextMode(Format.TextMode) and | |
406 | getTextMode(). | |
407 | ||
408 | Changed the protected method SAXHandler.setAlternateRoot() to pushElement(). | |
409 | ||
410 | ||
411 | REMOVED CLASSES | |
412 | --------------- | |
413 | ||
414 | None. | |
415 | ||
416 | ||
417 | REMOVED METHODS | |
418 | --------------- | |
419 | ||
420 | Removed everything deprecated in b9. (JDOM deprecates for one beta cycle, | |
421 | then removes.) | |
422 | ||
423 | Made the DOMOutputter output(Element, ...) and output(Attribute, ...) private. | |
424 | They used to be protected. Skipped the deprecation step because you couldn't | |
425 | actually extend them because of the NamespaceStack visibility, and we don't | |
426 | usually deprecate protected methods. | |
427 | ||
428 | ||
429 | SPECIAL NOTE | |
430 | ------------ | |
431 | ||
432 | Reduced the visibility on many items from protected to private. Anything | |
433 | protected or public must be supported in the future, and we don't want to | |
434 | promise that for anything unless it's absolutely necessary. If your JDOM | |
435 | extension has problems with the reduced visibility that can't be overcome, | |
436 | write to jdom-interest-AT-jdom.org with your issue. We'll crack open the | |
437 | visibility as proven necessary. | |
438 | ||
439 | ||
440 | * * * * * * Beta9 (tag: jdom_1_0_b9) from Beta8 * * * * * * | |
441 | ||
442 | NEW PACKAGES | |
443 | ------------ | |
444 | ||
445 | Added org.jdom.xpath package for XPath manipulations. | |
446 | ||
447 | ||
448 | NEW CLASSES | |
449 | ----------- | |
450 | ||
451 | Added the XPath and JaxenXPath classes to the new org.jdom.xpath package. | |
452 | ||
453 | Added org.jdom.input.JDOMParseException, a subclass of JDOMException, to be | |
454 | thrown by the builders to convey whatever information could be gathered from | |
455 | the parser about the error. It has a getPartialDocument() that gives access | |
456 | to whatever part of the input document that was successfully parsed before the | |
457 | parser fired a SAXParseException. | |
458 | ||
459 | Added org.jdom.output.JDOMLocator, an implementation of org.xml.sax.Locator | |
460 | which a ContentHandler could use to determine the document object on which an | |
461 | error occurred. | |
462 | ||
463 | ||
464 | NEW METHODS | |
465 | ----------- | |
466 | ||
467 | Added the the getResult()/setResult() methods to JDOMResult to support | |
468 | transformations that return results other than a document. | |
469 | ||
470 | Added saxBuilder.setReuseParser(boolean) with a default of false. Turning it | |
471 | on allows reuse and faster performance for parsers that support reuse. | |
472 | ||
473 | Added a ProcessingInstruction.setTarget(String newTarget) method. Once we | |
474 | decided to allow elt.setName() we should allow pi.setTarget(). | |
475 | ||
476 | Added a SAXOutputter.getLocator() method to make the locator available outside | |
477 | the ContentHandler. For example, this allows you to have ErrorHandlers not | |
478 | implementing XMLFilters. | |
479 | ||
480 | ||
481 | ENHANCEMENTS | |
482 | ------------ | |
483 | ||
484 | Fixed the TextBuffer performance problem that made performance terrible on | |
485 | certain JVMs in beta8. | |
486 | ||
487 | Changed CDATA to extend Text so now you can look just for Text nodes | |
488 | in content and don't need to differentiate CDATA sections if you don't | |
489 | want to. This does require "instanceof CDATA" to come before "instanceof | |
490 | Text" now. Watch out for that potential subtle bug. | |
491 | ||
492 | Changed the exception types that may be thrown from the SAXBuilder. The idea | |
493 | is that SAXBuilder should throw an IOException for an I/O error, a | |
494 | JDOMException for an XML problem, and that unexpected runtime exceptions | |
495 | should not be hidden. Previously it could only throw a JDOMException, so this | |
496 | will break existing code! Builders will now need to catch IOException. | |
497 | ||
498 | Changed the DOM adapter classes to throw either IOException, a JDOMException | |
499 | wrapped around a parser-specific exception, or a subtype of RuntimeException. | |
500 | Previously they might throw any Exception. | |
501 | ||
502 | Changing doctype.equals() to be == instead of comparing its elt name, system | |
503 | id, and public id. Did this because someone may not care about the elt name | |
504 | in comparing doc types, while someone else might care about the internal DTD | |
505 | subset. This lets the default behavior be == and lets users write their own | |
506 | equality check. | |
507 | ||
508 | Added a feature to prevent firing DTD events by setting the SAX core feature | |
509 | "http://xml.org/sax/features/validation" to false. | |
510 | ||
511 | Removed the special namespace treatment of xml:space and xml:lang so they are | |
512 | now treated as any other attributes in a namespace. | |
513 | ||
514 | Enhanced SAXOutputter to notify of entities through ContentHandler's | |
515 | skippedEntity() and notify of some errors to the registered SAX ErrorHandler, | |
516 | Added support to output Comments as Element children. Added support for CDATA | |
517 | (i.e. distinguish CDATA from plain text and use of the start/endCDATA | |
518 | callbacks of LexicalHandler). Removed support for CDATA as children of the | |
519 | document node. | |
520 | ||
521 | Added CVS_ID and @version tags to source files that were missing them. | |
522 | ||
523 | Added JDOM_FEATURE constants to JDOMSource and JDOMResult which can be used | |
524 | with TransformerFactory.getFeature() to determine if the transformer natively | |
525 | supports JDOM. | |
526 | ||
527 | Moved the printing of the line seperator after the doctype up to | |
528 | output(Document, Writer). This allows someone who doesn't want a newline | |
529 | after the decl to kludge it away. | |
530 | ||
531 | Improved the Verifier's checking of Comment contents. Added logic to ensure | |
532 | you can't have two default namespace declarations on the same element. | |
533 | ||
534 | Numerous performance improvements. | |
535 | ||
536 | Many Javadoc improvements. | |
537 | ||
538 | Numerous build script enhancements. | |
539 | ||
540 | Moved samples into the default package, building to build/samples. | |
541 | ||
542 | ||
543 | BUG FIXES | |
544 | --------- | |
545 | ||
546 | Fixed Document.clone() to set the new DocType. | |
547 | ||
548 | Fixed a bug where the JDOMException.printStackTrace(PrintWriter) method would | |
549 | print some data to System.err instead of to the writer. | |
550 | ||
551 | Fixed bug in PI map parse logic which could be confused when there was a lot | |
552 | of whitespace surrounding the = signs. | |
553 | ||
554 | Fixed bug where AttributeList.set() would not set parentage in one situation. | |
555 | ||
556 | Fixed bug where namespace prefixes were being lost on DOM builds. | |
557 | ||
558 | Fixed bug in PI.toString() which could cause funny output on PIs without data. | |
559 | ||
560 | Fixed a problem with the CDATA.clone() method that would result in CDATA | |
561 | sections being cloned as Text objects rather than CDATA objects. | |
562 | ||
563 | Fixed the SAXOutputter so elementContent() fires a comment() event. | |
564 | ||
565 | Fixed bug where mapping a value to an attribute wouldn't happen if the | |
566 | attribute was renamed. | |
567 | ||
568 | Fixed bug in XMLOutputter where \n was used instead of | |
569 | currentFormat.lineSeparator at one location. | |
570 | ||
571 | Fixed a whitespace output bug where whitespace-only content would be treated | |
572 | as empty. | |
573 | ||
574 | Fixed bug where the "xml" prefix wasn't available in Element's | |
575 | getNamespace(String) call. | |
576 | ||
577 | ||
578 | DEPRECATED METHODS | |
579 | ------------------ | |
580 | ||
581 | Deprecated the XMLOutputter.setIndent* methods except setIndent(String). | |
582 | ||
583 | Deprecated DOMBuilder(boolean validate), DOMBuilder(String adapter, boolean | |
584 | validate), and DOMBuilder.setValidation(boolean validate) because validation | |
585 | only matters when building from files, and those methods have already been | |
586 | deprecated. | |
587 | ||
588 | Deprecated the DOMOutputter output methods that return a DOM Element or Attr, | |
589 | because they aren't truly useful and the DOM contract is that every Attr and | |
590 | Element (and every other Node too) always belongs to exactly one Document or | |
591 | DocumentFragment object. | |
592 | ||
593 | Deprecated element.removeChildren() because it's a nearly useless method. | |
594 | Call element.getChildren().clear() in the very rare case you want to remove | |
595 | only the children but leave other content. | |
596 | ||
597 | Deprecated element.hasChildren() because it's not a performance optimization | |
598 | anymore. This helps simplify the most complicated class around. | |
599 | ||
600 | Deprecated element.setChildren(List) since element.setContent(List) suffices. | |
601 | ||
602 | Deprecated xmlOutputter.outputString(String) since outputString(Text) handles | |
603 | the Text nodes that now really reside within documents. | |
604 | ||
605 | ||
606 | REMOVED CLASSES | |
607 | --------------- | |
608 | ||
609 | Removed ProjectXDOMAdapter since the parser is no longer important. | |
610 | ||
611 | ||
612 | REMOVED METHODS | |
613 | --------------- | |
614 | ||
615 | Removed element.addContent(CDATA) and removeContent(CDATA) since | |
616 | addContent(Text) and removeContent(Text) do the job now that CDATA extends | |
617 | Text. | |
618 | ||
619 | Removed canAdd() and canRemove() from Filter. matches() is sufficient. | |
620 | ||
621 | Removed the methods deprecated in beta7. | |
622 | ||
623 | ||
624 | SPECIAL NOTE | |
625 | ------------ | |
626 | ||
627 | Beginning with this release JDK 1.1 is no longer supported. You'll need JDK | |
628 | 1.2 or later. | |
629 | ||
630 | ||
631 | * * * * * * Beta8 (tag: jdom_1_0_b8) from Beta7 (tag: jdom_1_0_b7) * * * * * * | |
632 | ||
633 | NEW CLASSES | |
634 | ----------- | |
635 | ||
636 | Added a Text class. This class is primarily for internal use to store String | |
637 | data, so strings can now have parentage. A getText() will still return a | |
638 | String. The Text nodes themselves can be retrieved through a getContent() | |
639 | call. | |
640 | ||
641 | Added the public interface org.jdom.filter.Filter to support the "FilterList" | |
642 | functionality. | |
643 | ||
644 | Added org.jdom.filter.ContentFilter, a standard filter for Content. And added | |
645 | org.jdom.filter.ElementFilter, a standard filter for Element data. | |
646 | ||
647 | Added two non-public support classes to support the "FilterList" | |
648 | functionality: ContentList and AttributeList. | |
649 | ||
650 | ||
651 | NEW METHODS | |
652 | ----------- | |
653 | ||
654 | Added to Element and Document the method getContent(Filter) that takes a | |
655 | Filter instance. | |
656 | ||
657 | Added to CDATA the methods getTextTrim(), getTextNormalize(), append(String), | |
658 | append(CDATA), getParent(), getDocument(), and detach(). This brings CDATA | |
659 | close in line with the Text class. They'll may become the same class with a | |
660 | flag differentiator in the next beta. | |
661 | ||
662 | Added to Element the methods addContent(Text) and removeContent(Text). These | |
663 | methods support the new Text class. | |
664 | ||
665 | Also added to Element the method removeAttribute(Attribute). This method was | |
666 | simply overlooked before. | |
667 | ||
668 | Also added to Element the method getChildTextNormalize(). This method is | |
669 | similar to getChildTextTrim(). | |
670 | ||
671 | Also added to Element two new styles of getAttributeValue() which let the | |
672 | programmer specify default values if the attribute doesn't exist. | |
673 | ||
674 | Added to SAXBuilder the methods setFeature() and setProperty(). These methods | |
675 | to allow programmers to customize the underlying parser. | |
676 | ||
677 | Added to SAXOutputter the new method setLexicalHandler(LexicalHandler). Also | |
678 | added a new SAXOutputter constructor that takes a LexicalHandler as its last | |
679 | argument. | |
680 | ||
681 | Added to ProcessingInstruction the method getNames(). This method returns the | |
682 | pseudo-attribute names in the PI's data. | |
683 | ||
684 | Added to DocType the methods setInternalDTDSubset(String) and | |
685 | getInternalDTDSubset(). These methods support new functionality where a | |
686 | DocType can store and alter the internal DTD subset information. | |
687 | ||
688 | Also added to DocType the method setElementName(). | |
689 | ||
690 | Added a no-arg SAXOutputter constructor. | |
691 | ||
692 | Added to SAXOutputter the methods getContentHandler(), getErrorHandler(), | |
693 | getDTDHandler(), getEntityResolver(), getLexicalHandler(), setDeclHandler(), | |
694 | getDeclHandler(), setFeature(), setProperty(), getFeature(), and | |
695 | getProperty(). | |
696 | ||
697 | Added to Attribute the methods getAttributeType() and setAttributeType(). | |
698 | Also added various constructors that take an int type. These methods and | |
699 | constructors support the new functionality where attributes can record their | |
700 | type information. Note: this is something DOM can't do! | |
701 | ||
702 | Added to Document the method detachRootElement(). | |
703 | ||
704 | Added to XMLOutputter the methods outputString(List list), outputString(String | |
705 | str), outputString(Text text), output(List list, OutputStream out), and | |
706 | output(List list, Writer out). | |
707 | ||
708 | Added to EntityRef the constructor EntityRef(String name, String systemID). | |
709 | This supports building an EntityRef without a public ID. | |
710 | ||
711 | Added to Verifier the methods checkSystemLiteral() and checkPublicID(). | |
712 | ||
713 | ||
714 | NEW CONSTANTS | |
715 | ------------- | |
716 | ||
717 | Attribute has new constants for each attribute type: | |
718 | UNDECLARED_ATTRIBUTE, CDATA_ATTRIBUTE, ID_ATTRIBUTE, IDREF_ATTRIBUTE, | |
719 | IDREFS_ATTRIBUTE, ENTITY_ATTRIBUTE, ENTITIES_ATTRIBUTE, NMTOKEN_ATTRIBUTE, | |
720 | NMTOKENS_ATTRIBUTE, NOTATION_ATTRIBUTE, and ENUMERATED_ATTRIBUTE. | |
721 | ||
722 | ||
723 | NEW SIGNATURES | |
724 | -------------- | |
725 | ||
726 | The XMLOutputter escape*() methods are now public. | |
727 | ||
728 | The Verifier checkXMLName() method is now public. | |
729 | ||
730 | Changed the protected "Element parent" variable for classes to be "Object | |
731 | parent", with the object capable of serving double duty as either a Document | |
732 | parent or Element parent. Saves noticeable memory. | |
733 | ||
734 | Changed the no-arg Document constructor to be public, along with Javadocs | |
735 | explaining how the method is to be used. | |
736 | ||
737 | ||
738 | REMOVED CLASSES | |
739 | --------------- | |
740 | ||
741 | None. | |
742 | ||
743 | ||
744 | REMOVED METHODS | |
745 | --------------- | |
746 | ||
747 | Removed the methods deprecated in beta7. | |
748 | ||
749 | ||
750 | DEPRECATED METHODS | |
751 | ------------------ | |
752 | ||
753 | Deprecated the DOMBuilder.build() methods that build from a File, URL, or | |
754 | InputStream. This helps people understand those methods are for testing only. | |
755 | DOMBuilder.build(org.w3c.dom.Document) and such are still undeprecated. | |
756 | ||
757 | ||
758 | ENHANCEMENTS | |
759 | ------------ | |
760 | ||
761 | Added the long-awaited "FilterList" functionality! This improves the | |
762 | reliability and performance of the lists returned by getContent() and | |
763 | getChildren() calls. These lists are now fully live, they fully enforce | |
764 | well-formedness constraints, and they don't require in-memory copying before | |
765 | returning. A huge improvement! | |
766 | ||
767 | Integrated the Text class for wrapping strings behind the scenes and thus | |
768 | allowing strings to have parentage. | |
769 | ||
770 | Added the ability for the DocType to have an internal DTD subset, and changed | |
771 | the SAX and DOM builders and outputters to support this change. | |
772 | ||
773 | Added the ability for a Document to have a detached root to make elt.detach() | |
774 | work easily. There will be an IllegalStateException thrown in case of read | |
775 | from such a Document. | |
776 | ||
777 | Added support for "attribute types". Typing is now recorded within the | |
778 | attribute object and fully managed during build and output. | |
779 | ||
780 | Rearchitected the internals of SAXBuilder and SAXHandler to be more extensible | |
781 | via subclassing. Also exposed more of the internals of SAXHandler to make | |
782 | subclassing easier. | |
783 | ||
784 | Made SAXOutputter much more robust, and made JDOMSource (used for | |
785 | transformations) more robust along with it. | |
786 | ||
787 | Changed setContent(null) to now clear the content list and does not throw an | |
788 | exception. Same for setChildren(null). | |
789 | ||
790 | Improved XMLOutputter to respect the xml:space attribute. | |
791 | ||
792 | Improved reporting behavior of build error messages. | |
793 | ||
794 | Improved how JDOMException reports on nested exceptions. | |
795 | ||
796 | Updated the Ant build system to version 1.4. | |
797 | ||
798 | Improved JDOM build versioning so we have versions like "1.0beta8-dev" for | |
799 | work after Beta8, and "1.0beta8" will only be the actual Beta8 code. | |
800 | ||
801 | Changed the Javadocs to use CVS Revision and Date tags for @version. | |
802 | ||
803 | Many Javadoc clarifications. | |
804 | ||
805 | Improved the Verifier error message when adding a PI with an "xml" target, | |
806 | since parsers and/or people have been trying to add it as a PI. | |
807 | ||
808 | Added verification of the system and public ID's in both DocType and | |
809 | EntityRef, the root element name in DocType, and the entity name in EntityRef. | |
810 | ||
811 | Added ability for DocType and EntityRef to differentiate a missing ID from the | |
812 | empty string ID. | |
813 | ||
814 | Changed the MANIFEST.MF to no longer list Xerces in the Class-Path entry, nor | |
815 | to have JDOMAbout as its Main-Class. This helps applet deployment, but does | |
816 | remove the ability to do the cool "java -jar jdom.jar". | |
817 | ||
818 | Added support for skipped entities in SAXHandler in the event that the parser | |
819 | is not resolving external entities. | |
820 | ||
821 | Added well-formedness checking to ensure there are never duplicate attributes. | |
822 | ||
823 | Many, many performance optimizations throughout. | |
824 | ||
825 | Made Xerces 1.4.4 the default parser in "lib/xerces.jar". | |
826 | ||
827 | ||
828 | BUG FIXES | |
829 | --------- | |
830 | ||
831 | Fixed XMLOutputter to no longer add spurious newlines after closing element | |
832 | tags. | |
833 | ||
834 | Fixed SAXBuilder to work better with XML filters. | |
835 | ||
836 | Fixed SAXHandler bug where attributes that had a namespace were being added to | |
837 | the Document, but did not have the Namespace correctly reported. | |
838 | ||
839 | Fixed bug where a ProcessingInstruction or DocType removed from a Document did | |
840 | not have its parentage set to null. | |
841 | ||
842 | Fixed bug where SAXBuilder would cache the class name even when using JAXP to | |
843 | create the parser, causing problems for parsers without no-arg constructors. | |
844 | ||
845 | Fixed bug where Namespace collision checking could generate false positives. | |
846 | ||
847 | Fixed bug where a document containing a huge number of character entities | |
848 | would cause JDOM builds to slow down exponentially. | |
849 | ||
850 | Fixed the many bugs caused by the old PartialList code, by replacing it with | |
851 | FilterList code. | |
852 | ||
853 | ||
854 | * * * * * * Beta7 (tag: jdom_1_0_b7) from Beta6 (tag: jdom_1_0_b6) * * * * * * | |
855 | ||
856 | NEW CLASSES | |
857 | ----------- | |
858 | ||
859 | Added JDOMSource and JDOMResult to the org.jdom.transform package. These | |
860 | support XSLT transforms using the JAXP TrAX model. Added Crimson, JAXP, and | |
861 | Xalan JARs to the lib directory to support the transform functionality. | |
862 | ||
863 | Added org.jdom.EntityRef to replace org.jdom.Entity. Changed methods taking | |
864 | Entity to take EntityRef. | |
865 | ||
866 | Made org.jdom.input.SAXHandler a public class. It used to be package | |
867 | protected. This is helpful to classes that want to build JDOM from a SAX | |
868 | source, such as JDOMResult. | |
869 | ||
870 | Added org.jdom.input.JDOMFactory/DefaultJDOMFactory to support the builder | |
871 | factory model. | |
872 | ||
873 | Added org.jdom.adapters.JAXPDOMAdapter to contain all the logic for | |
874 | interacting with JAXP. Most people will never use this class. | |
875 | ||
876 | Added org.jdom.Text to the repository. It's not yet used. | |
877 | ||
878 | ||
879 | NEW METHODS | |
880 | ----------- | |
881 | ||
882 | Added a new detach() method to each of the classes Attribute, Comment, | |
883 | Element, EntityRef, and ProcessingInstruction. It removes the node from its | |
884 | parent. | |
885 | ||
886 | Added setName(String) and setNamespace(Namespace) to Element and Attribute. | |
887 | ||
888 | Added elt.setAttribute() method, to replace elt.addAttribute(). It replaces | |
889 | any existing attribute by the same name, instead of throwing an exception as | |
890 | addAttribute() did. | |
891 | ||
892 | Added elt.getContent() and elt.setContent() methods, to replace | |
893 | elt.getMixedContent() and elt.setMixedContent(). Did the same on Document. | |
894 | ||
895 | Added SAXBuilder.setExpandEntitities(boolean) method to indicate if entities | |
896 | should be expanded, or if EntityRef objects should appear within the document. | |
897 | ||
898 | Added two new Document constructors to support constructing with a list of | |
899 | content: | |
900 | Document(List) | |
901 | Document(List, DocType) | |
902 | ||
903 | Added elt.removeNamespaceDeclaration(Namespace). It removes a namespace | |
904 | declaration, the counterpart to addNamespaceDeclaration(Namespace). | |
905 | ||
906 | Added a new constructor in IllegalAddException to account for a Namespace | |
907 | illegally added: | |
908 | IllegalAddException(Element base, Namespace added, String reason) | |
909 | ||
910 | Added getDocument() method to DocType. Added a protected setDocument() method | |
911 | also. | |
912 | ||
913 | Added setFactory() method to SAXBuilder/DOMBuilder to support the factory | |
914 | build model. | |
915 | ||
916 | Added elt.getTextNormalize() to return a normalized string (external | |
917 | whitespace trimmed, internal whitespace reduced to a single space). The | |
918 | getTextTrim() method now does a true trim. | |
919 | ||
920 | Added a SAXBuilder.setIgnoringElementContentWhitespace(boolean) method with | |
921 | behavior that matches the method by the same name in JAXP's | |
922 | DocumentBuilderFactory. Setting the value to true causes | |
923 | ignorableWhitespace() to operate like a no-op. By default its value is false. | |
924 | ||
925 | Added getCause() to JDOMException, replacing getRootCause(). This new name | |
926 | matches JDK 1.4. | |
927 | ||
928 | Added setOmitDeclaration on XMLOutputter, replacing the now-deprecated | |
929 | setSuppressDeclaration(). | |
930 | ||
931 | Added elt.removeContent(CDATA) which was previously overlooked. | |
932 | ||
933 | Added protected methods in SAXBuilder to make it easier to extend: | |
934 | protected XMLReader createParser() | |
935 | protected SAXHandler createContentHandler() | |
936 | protected void configureContentHandler(SAXHandler) | |
937 | ||
938 | Added getDocument() method to Attribute. | |
939 | ||
940 | ||
941 | NEW SIGNATURES | |
942 | -------------- | |
943 | ||
944 | DOMAdapter methods now may throw Exception instead of IOException. DOMBuilder | |
945 | and DOMOutputter have the same API as always. | |
946 | ||
947 | Changed XMLOutputter's protected printXXX() methods to have a new signature | |
948 | without the "int indentLevel" final parameter. Didn't bother with | |
949 | deprecation. | |
950 | ||
951 | Changed XMLOutputter's printEntity() method to printEntityRef(). | |
952 | ||
953 | Made SAXBuilder's build(InputSource) method public. It used to be protected. | |
954 | ||
955 | ||
956 | REMOVED CLASSES | |
957 | --------------- | |
958 | ||
959 | Removed org.jdom.Entity; it's replaced by EntityRef. | |
960 | ||
961 | ||
962 | REMOVED METHODS | |
963 | --------------- | |
964 | ||
965 | Removed various methods that were previously deprecated in beta6: | |
966 | Document.addContent(Element) | |
967 | Namespace.getNamespace(String prefix, Element context) | |
968 | CDATA.setText(String) | |
969 | ||
970 | Removed Document's protected rootElement variable. | |
971 | ||
972 | ||
973 | DEPRECATED METHODS | |
974 | ------------------ | |
975 | ||
976 | Deprecated constructor Attribute(String name, String prefix, String uri, | |
977 | String value). Its parameter order was non-standard and it was not a useful | |
978 | method. | |
979 | ||
980 | Deprecated XMLOutputter's setIndentLevel() method. Having a global indent is | |
981 | better done with a stacked FilterOutputStream. The method is now empty. | |
982 | ||
983 | Deprecated XMLOutputter's setPadText() method. It's not needed with the | |
984 | current output mechanism. The method is now empty. | |
985 | ||
986 | Deprecated Element's getCopy(String) and getCopy(String, Namespace). These | |
987 | can better be done now with a clone() and setName()/setNamespace(). | |
988 | ||
989 | Deprecated elt.addAttribute(). It's replaced by elt.setAttribute(). | |
990 | ||
991 | Deprecated getMixedContent() and setMixedContent() on Element and Document. | |
992 | They're replaced by getContent() and setContent() versions. | |
993 | ||
994 | Deprecated getSerializedForm() methods on all objects, and moved the logic | |
995 | into XMLOutputter. | |
996 | ||
997 | Deprecated the various xxxProcessingInstruction() methods in Document: | |
998 | List getProcessingInstructions() | |
999 | List getProcessingInstructions(String target) | |
1000 | ProcessingInstruction getProcessingInstruction(String target) | |
1001 | boolean removeProcessingInstruction(String target) | |
1002 | boolean removeProcessingInstructions(String target) | |
1003 | Document setProcessingInstructions(List pis) | |
1004 | ||
1005 | Deprecated the SAXHandler constructor SAXHandler(Document document) since now | |
1006 | the handler constructs the document itself. | |
1007 | ||
1008 | Deprecated elt.hasMixedContent() because it's of little use and its behavior | |
1009 | isn't well defined. | |
1010 | ||
1011 | Deprecated getRootCause() on JDOMException in favor of getCause(). This new | |
1012 | name matches JDK 1.4. | |
1013 | ||
1014 | Deprecated XMLOutputter's setSuppressDeclaration() in favor of | |
1015 | setOmitDeclaration() to better match setOmitEncoding(). | |
1016 | ||
1017 | Deprecated elt.addAttribute(String name, String prefix, String value). | |
1018 | Instead, setAttribute() should be used. | |
1019 | ||
1020 | ||
1021 | ENHANCEMENTS | |
1022 | ------------ | |
1023 | ||
1024 | Clarified and improved many, many javadocs. | |
1025 | ||
1026 | Performance enhancement for files with namespaces. This improves build times | |
1027 | on one test from 13000ms to 580ms. | |
1028 | ||
1029 | Added support for the DOM DocumentType object when constructing documents | |
1030 | using DOMOutputter. | |
1031 | ||
1032 | Added a check that only one element is allowed in the document list as the | |
1033 | root. | |
1034 | ||
1035 | Added informational XML files in the jdom.jar META-INF directory storing | |
1036 | things like the version, credits, description, etc. These can be accessed | |
1037 | with a "java -jar jdom.jar" command which uses JDOM to read the info about | |
1038 | JDOM. | |
1039 | ||
1040 | Added JDOM version info to the MANIFEST.MF so servlets and such can depend on | |
1041 | it using http://java.sun.com/j2se/1.3/docs/guide/extensions/versioning.html | |
1042 | ||
1043 | Made elt.setMixedContent() check object types and parentage, and set | |
1044 | parentage. | |
1045 | ||
1046 | For the JDK 1.1 build, added a replace target so @throws is replaced by | |
1047 | @exception, which is the old JDK 1.1 javadoc keyword. | |
1048 | ||
1049 | Improved XMLOutputter internals so it no longer uses list.get(i) and instead | |
1050 | uses an Iterator. Should lighten the burden on outputting large documents. | |
1051 | ||
1052 | Added CVS Id variable to the top of each file for better tracking. | |
1053 | ||
1054 | Changed pi.getValue("nonexistant") to return null instead of "". Also made it | |
1055 | so that any parse error aborts and clears the parse results. | |
1056 | ||
1057 | Created a new implementations of clone() without any constructor calls. | |
1058 | ||
1059 | Revamped XMLOutputter's output logic to better match expectations. | |
1060 | ||
1061 | Changed XMLOutputter flushing logic so output() methods handle their own | |
1062 | flush() at the end of writing so user flush() calls should no longer be | |
1063 | necessary. | |
1064 | ||
1065 | Made elt.setMixedContent() and doc.setMixedContent() appear atomic, even in | |
1066 | case of failure. | |
1067 | ||
1068 | Optimized attr.getQualifiedName() implementation for speed. | |
1069 | ||
1070 | Added logic to setAttribute() to ensure well-formedness by verifying the | |
1071 | attribute namespace prefix doesn't collide with an existing prefix on that | |
1072 | element (either on the element's own ns, an additional ns, or another | |
1073 | attribute's ns). | |
1074 | ||
1075 | Added logic to addNamespaceDeclaration() to ensure the prefix doesn't collide | |
1076 | with an existing prefix on the element. | |
1077 | ||
1078 | Changed DocType.equals() to check for equivalency and not reference equality. | |
1079 | Now two DocTypes are equals() if their constituent strings are equals(). This | |
1080 | makes general sense because if you want to compare the doctypes of two docs | |
1081 | you want to do an equivalency check. | |
1082 | ||
1083 | Added a private CVS_ID variable to the core classes containing RCS variables. | |
1084 | This allows you to examine the compiled class to determine the source from | |
1085 | which it was compiled. See jdom-contrib's Ident.java. | |
1086 | ||
1087 | Performance optimization in setAttribute() so that removeAttribute() on a | |
1088 | pre-existing attribute is only called when necessary, as determined by an | |
1089 | earlier scan through the attributes. This was submitted by Phil Nelson who | |
1090 | says it gave an 8% time savings during a fresh build. | |
1091 | ||
1092 | Integrated the factory model for SAXBuilder. See the new classes | |
1093 | DefaultJDOMFactory and JDOMFactory. | |
1094 | ||
1095 | Changed Element.getTextTrim() behavior to truly be only a trim(). It used to | |
1096 | do normalization. | |
1097 | ||
1098 | Changed Document and Element internal LinkedList implementation to ArrayList. | |
1099 | This change of list gives us a remarkable reduction in memory sizes for all | |
1100 | large documents tested, and gives a speed boost too. | |
1101 | ||
1102 | Changed Element parentage so only one variable is used for the parent. It may | |
1103 | be of type Element or Document depending on where the elt is placed in the | |
1104 | tree. This saves one instance variable's worth of memory for each element in | |
1105 | the tree. | |
1106 | ||
1107 | Added a new line after the DocType always, for better formatting. | |
1108 | ||
1109 | Made the SAXHandler smart enough to ignore xmlns attributes. They shouldn't | |
1110 | appear when SAXHandler is used with SAXBuilder but sometimes appear with | |
1111 | driven by a different parser, such as with JDOMResult. | |
1112 | ||
1113 | Made note that elt.getAdditionalNamespaces() returns an unmodifiable list, and | |
1114 | made the implementation enforce the rule. This change allows | |
1115 | Namespace.equals() to be implemented to compare URIs instead of resorting to | |
1116 | ==, and more importantly it avoids having XMLOutputter trigger a new List | |
1117 | object creation for every element with an empty additional namespace list | |
1118 | (which is 99.9% of elements). | |
1119 | ||
1120 | Refactored SAXBuilder to make it easier to extend. | |
1121 | * The parser is created in a separate createParser() method, and | |
1122 | configured in a separate configureParser() method. | |
1123 | * The content handler is created in a separate createContentHandler() | |
1124 | method, and configured in a separate configureContentHandler() method. | |
1125 | ||
1126 | Improved builder exception handling to if anything in the build process throws | |
1127 | a JDOMException, we no longer wrap it in another JDOMException; we just | |
1128 | rethrow as-is. | |
1129 | ||
1130 | Made XMLOutputter expose its NamespaceStack using an inner class, so | |
1131 | subclassers could have access to the stack. | |
1132 | ||
1133 | ||
1134 | BUG FIXES | |
1135 | --------- | |
1136 | ||
1137 | Fixed bug where Element.clone() didn't copy over PIs. | |
1138 | ||
1139 | Made DOMOutputter check if there was a pre-existing root element on a new | |
1140 | document, and if so call replaceChild() instead of appendChild(). This is | |
1141 | necessary for Xerces 1.3 where new documents are created with a default | |
1142 | <root/> element. | |
1143 | ||
1144 | Fixed a bug where Attr output(Attribute) wasn't using JAXP. | |
1145 | ||
1146 | Improved the logic by which ProcessingInstruction parses attribute-style | |
1147 | values. The old logic was confused by whitespace, nested quotes, etc. | |
1148 | ||
1149 | Added sanity check in DOMBuilder to ignores null NodeList and Node entries. | |
1150 | Per the DOM2 spec neither should ever be null, but that doesn't mean some DOM | |
1151 | implementations don't return null. | |
1152 | ||
1153 | Fixed bug in Namespace.getNamespace() where the lookup for a pre-existing | |
1154 | identical namespaces would fail even if there was a pre-existing identical | |
1155 | namespace. This caused new Namespaces to be created on all | |
1156 | Namespace.getNamespace() calls! | |
1157 | ||
1158 | Fixed bug where elt.clone() would concatenate adjacent strings. | |
1159 | ||
1160 | Fixed bug in elt.hasChildren() where the logic could be confused if there was | |
1161 | a subclass of Element in the tree. | |
1162 | ||
1163 | Fixed the Javadoc on Element.getAdditionalNamespaces() to say it returns an | |
1164 | empty list if empty. It used to say null. Empty is consistent with JDOM | |
1165 | elsewhere. | |
1166 | ||
1167 | Fixed bug where adding a null to a setMixedContent() method would cause an NPE | |
1168 | while constructing the error message. | |
1169 | ||
1170 | Fixed bug in SAXHandler where namespaces weren't being removed from the | |
1171 | available list, causing memory bloat. | |
1172 | ||
1173 | Fixed DOMBuilder so it works better on non-namespace-aware documents. Now if | |
1174 | getLocalName() returns null we look for a specific tagname/attname. | |
1175 | ||
1176 | Added ignorableWhitespace() method to SAXHandler to capture ignorable | |
1177 | whitespace. It can be turned off with | |
1178 | builder.setIgnoringElementContentWhitespace(true). | |
1179 | ||
1180 | Changed Namespace.equals() to check equivalency based only on URI. It used to | |
1181 | be both URI and prefix. This new behavior is more in line with standard XML. | |
1182 | It's unlikely but possible that existing code might break because of this, if | |
1183 | any code puts Namespace objects into a collection and doesn't expect | |
1184 | namespaces with different prefixes to be treated identically. No deprecation | |
1185 | is possible though. Also fixed behavior of Namespace.hashCode() to depend | |
1186 | solely on the URI. | |
1187 | ||
1188 | Fixed bug where DOMOutputter creates nodes with "" as their | |
1189 | node.getNamespaceURI() even if the node is not in a namespace. | |
1190 | ||
1191 | Changed attribute value escaping to not escape single-quotes because it's not | |
1192 | necessary as attribute values are always surrounded by double-quotes. | |
1193 | ||
1194 | Made sure XMLOutputter doesn't print the newline after the decl if the decl is | |
1195 | suppressed. | |
1196 | ||
1197 | Fixed SAXOutputter to declare namespaces using start/endPrefixMapping methods. | |
1198 | Also added optional ability for SAXOutputter to report namespace declarations | |
1199 | (the xmlns: attributes) if setReportNamespaceDeclarations() is true. | |
1200 | ||
1201 | Fixed performance bug where namespaces were continuously being added to the | |
1202 | availableNamespaces list unnecessarily, causing roughly as many entries to be | |
1203 | added as there were elements with namespaces. In simple testing, memory usage | |
1204 | for representing a namespace-intensive file went from 1.4 Megs to 460K. | |
1205 | ||
1206 | Fixed addFirst() and addLast() in PartialList to work correctly. | |
1207 | ||
1208 | Fixed a bug in PartialList where addAll() added *before* the last element | |
1209 | instead of after. | |
1210 | ||
1211 | Made PartialList's addAll() method work OK if the backing list is non-empty | |
1212 | while the PartialList is empty. | |
1213 | ||
1214 | Fixed build scripts to work OK on Windows with spaces in directory paths. | |
1215 | ||
1216 | ||
1217 | NEW ARCHIVES | |
1218 | ------------ | |
1219 | ||
1220 | Added new *searchable* mailing list archives at | |
1221 | http://www.servlets.com/archive/servlet/SummarizeList?listName=jdom-interest | |
1222 | ||
1223 | ||
1224 | * * * * * * * * * * Beta6 from Beta5 * * * * * * * * * * | |
1225 | ||
1226 | NEW CLASSES | |
1227 | ----------- | |
1228 | ||
1229 | Added new class org.jdom.input.BuilderErrorHandler as a default error handler | |
1230 | for JDOM builders. It ignores warnings but throws on errors and fatal errors. | |
1231 | ||
1232 | Added a Crimson adapter CrimsonDOMAdapter.java, to support the parser slated | |
1233 | to come with JAXP 1.1. | |
1234 | ||
1235 | ||
1236 | NEW METHODS | |
1237 | ----------- | |
1238 | ||
1239 | Added parentage for Attribute, Comment, Element, Entity, and PI! They all now | |
1240 | have getParent() methods. All but Attribute have getDocument() methods also. | |
1241 | The addContent() and addAttribute() methods now check parentage and don't | |
1242 | allow an item to be added if it's already held by another. | |
1243 | ||
1244 | Added to Element the method Namespace getNamespace(String prefix). It returns | |
1245 | the Namespace in scope with the given prefix. It helps with attributes whose | |
1246 | values include namespaces, like <xsl:template match="sg:title">. | |
1247 | ||
1248 | Added DOMBuilder.setValidation(boolean) to set the validate flag after | |
1249 | construction, to match SAXBuilder. | |
1250 | ||
1251 | Added DOMOutputter.output(Attribute) methods. | |
1252 | ||
1253 | Added XMLOutputter.setExpandEmptyElements() to choose between <empty/> and | |
1254 | <empty></empty>. | |
1255 | ||
1256 | Many new XMLOutputter methods for outputting document fragments. | |
1257 | ||
1258 | SAXBuilder now has a setXMLFilter() method to allow setting of XMLFilter | |
1259 | objects to operate during the build. | |
1260 | ||
1261 | Added to Element a hasChildren() method. | |
1262 | ||
1263 | Added various removeContent() methods on Element. They were deprecated and | |
1264 | scheduled for removal, but they're now being kept. | |
1265 | ||
1266 | Added various removeContent() methods on Document. These are brand new. | |
1267 | ||
1268 | ||
1269 | NEW SIGNATURES | |
1270 | -------------- | |
1271 | ||
1272 | Made clone() methods no longer final. | |
1273 | ||
1274 | Made toString() methods no longer final. | |
1275 | ||
1276 | Changed all outputter output() signatures to throw JDOMException in case of | |
1277 | problem. | |
1278 | ||
1279 | Changed DOMAdapter signature so getDocument(String filename, ...) is now | |
1280 | getDocument(File filename, ...) to match the standard builder model. I did | |
1281 | not do a deprecation because no one should be using this internal API | |
1282 | directly, and if they are, I want to hear from them. | |
1283 | ||
1284 | ||
1285 | REMOVED METHODS | |
1286 | --------------- | |
1287 | ||
1288 | Removed all methods marked deprecated in beta5. | |
1289 | ||
1290 | ||
1291 | DEPRECATED METHODS | |
1292 | ------------------ | |
1293 | ||
1294 | Marked Namespace.getNamespace(String prefix, Element context) deprecated | |
1295 | because it had been replaced by the more elegant elt.getNamespace(String | |
1296 | prefix). | |
1297 | ||
1298 | Marked Document.addContent(Element) deprecated because there can be only one | |
1299 | element and it's properly set with setMixedContent(). | |
1300 | ||
1301 | Marked CDATA.setText() as deprecated. This is because CDATA doesn't have | |
1302 | parentage, and without parentage an object should be immutable. | |
1303 | ||
1304 | ||
1305 | ENHANCEMENTS | |
1306 | ------------ | |
1307 | ||
1308 | Added JAXP 1.1 support to SAXBuilder, DOMBuilder, and DOMOutputter. The | |
1309 | default parser for all these is now the JAXP parser, with a fallback of Xerces | |
1310 | if JAXP isn't available. | |
1311 | ||
1312 | Added improved Verifier checks of well-formedness throughout all of JDOM. | |
1313 | Among the most likely to be noticed: | |
1314 | - Added Verifier detection of wrongly places "xmlns" attributes. | |
1315 | - Added check in Attribute that a namespace with "" prefix must be | |
1316 | NO_NAMESPACE. | |
1317 | - Added Verifier checks so CDATA text cannot contain ">>]" | |
1318 | ||
1319 | Upgraded provided parser to Xerces 1.2. | |
1320 | ||
1321 | Improved SAXBuilder and DOMBuilder to be *much* smarter about namespaces. | |
1322 | Most likely to be noticed: | |
1323 | - DOMBuilder now keeps xmlns namespaces declaration location, and it now | |
1324 | relies on the parser to handle namespaces (necessary for importing a | |
1325 | document that has nodes moved around). | |
1326 | ||
1327 | Made SAXBuilder and DOMBuilder much more specific on error reporting. | |
1328 | ||
1329 | Brought DOMOutputter up to DOM Level 2 compliance. | |
1330 | - Added logic to DOMOutputter to add xmlns attributes to the DOM tree | |
1331 | where appropriate. | |
1332 | ||
1333 | Added SAXOutputter to generate SAX events. | |
1334 | ||
1335 | Improved documentation on clone() methods. | |
1336 | ||
1337 | Changed XMLOutputter.escape*Entities() to protected from private to help | |
1338 | subclasses. | |
1339 | ||
1340 | Improved removeContent() to solve a Crimson performance problem regarding | |
1341 | duplicate string entries. | |
1342 | ||
1343 | Added logic to prevent an element from being added as a child or descendent of | |
1344 | itself. | |
1345 | ||
1346 | Optimized SAXBuilder list handling so retrievals and removes will most likely | |
1347 | hit on their first try instead of their last try. | |
1348 | ||
1349 | Added Namespace output to Element.toString() to help debugging element | |
1350 | namespace issues. | |
1351 | ||
1352 | Improved the Verifier.isXML*() methods to operate much faster. | |
1353 | ||
1354 | XMLOutputter now prints new lines after the declaration, even if newlines are | |
1355 | turned off for the rest of the document. | |
1356 | ||
1357 | Made PI's getSerializedForm() smarter about spacing between target and data. | |
1358 | Now if there is no data, there's no space added. | |
1359 | ||
1360 | Guarantee XMLOutputter prints a new line at the end of each document, for | |
1361 | better formatting, esp when printing to System.out. | |
1362 | ||
1363 | Put samples in the "samples" package. | |
1364 | ||
1365 | ||
1366 | BUG FIXES | |
1367 | --------- | |
1368 | ||
1369 | Fixed bug in XMLOutputter where "additional namespace" declarations would be | |
1370 | output even if they were already declared by an ancestor. | |
1371 | ||
1372 | Fixed bug where an element not in any namespace will still inherit the default | |
1373 | namespace from an ancestor. | |
1374 | ||
1375 | Added fix to recognize implicit "xml" namespace during | |
1376 | Namespace.getNamespace() call. | |
1377 | ||
1378 | Added fix so XMLOutputter no longer outputs XML_NAMESPACE. | |
1379 | ||
1380 | Fixed Element.getDocument() behavior to work reliably. | |
1381 | ||
1382 | Fixed Verifier to not see "xmlnsfoo" attributes as invalid. | |
1383 | ||
1384 | Fixed Verifier to allow attribute names xml:lang and xml:space as special | |
1385 | cases. | |
1386 | ||
1387 | Improved all adapters to throw exceptions on error instead of printing stack | |
1388 | traces. | |
1389 | ||
1390 | Fixed Element.clone() to be a true deep copy. | |
1391 | ||
1392 | Fixed bug in SAXBuilder that would throw an EmptyStackException if a PI | |
1393 | appeared after the root element. | |
1394 | ||
1395 | Fixed bug in doc.setMixedContent(List) so it now stores the new data | |
1396 | correctly. | |
1397 | ||
1398 | Made removeChildren() properly set parents to null, and to return true only if | |
1399 | children were actually deleted. | |
1400 | ||
1401 | Changed SAXBuilder's endPrefixMapping(String, String) to be | |
1402 | endPrefixMapping(String) as it should have been so we now get the callback and | |
1403 | can remove namespaces. | |
1404 | ||
1405 | Fixed PartialList.addAll() to behave as specified. | |
1406 |
0 | The following people are committers on the "jdom" repo. | |
1 | ||
2 | DO NOT WRITE THESE PEOPLE FOR TECH SUPPORT. THEY WILL NOT ANSWER. | |
3 | WRITE THE jdom-interest MAILING LIST AT http://jdom.org. | |
4 | ||
5 | Jason Hunter <jhunter_AT_jdom_DOT_org> is project maintainer. | |
6 | ||
7 | Rolf Lear <jdom_AT_tuis_DOT_net> is leading the JDOM 2.0 work. | |
8 |
0 | <FindBugsFilter> | |
1 | ||
2 | <Match> | |
3 | <Package name="~org\.jdom2\.test\..*" /> | |
4 | </Match> | |
5 | <Match> | |
6 | <Class name="~Test.*" /> | |
7 | </Match> | |
8 | <Match> | |
9 | <Package name="~.*\.contrib\..*" /> | |
10 | </Match> | |
11 | ||
12 | </FindBugsFilter>⏎ |
0 | <FindBugsFilter> | |
1 | ||
2 | <Match> | |
3 | <Package name="~org\.jdom2" /> | |
4 | </Match> | |
5 | <Match> | |
6 | <Package name="~org\.jdom2\..*" /> | |
7 | </Match> | |
8 | ||
9 | ||
10 | </FindBugsFilter>⏎ |
0 | /*-- | |
1 | ||
2 | Copyright (C) 2000-2012 Jason Hunter & Brett McLaughlin. | |
3 | All rights reserved. | |
4 | ||
5 | Redistribution and use in source and binary forms, with or without | |
6 | modification, are permitted provided that the following conditions | |
7 | are met: | |
8 | ||
9 | 1. Redistributions of source code must retain the above copyright | |
10 | notice, this list of conditions, and the following disclaimer. | |
11 | ||
12 | 2. Redistributions in binary form must reproduce the above copyright | |
13 | notice, this list of conditions, and the disclaimer that follows | |
14 | these conditions in the documentation and/or other materials | |
15 | provided with the distribution. | |
16 | ||
17 | 3. The name "JDOM" must not be used to endorse or promote products | |
18 | derived from this software without prior written permission. For | |
19 | written permission, please contact <request_AT_jdom_DOT_org>. | |
20 | ||
21 | 4. Products derived from this software may not be called "JDOM", nor | |
22 | may "JDOM" appear in their name, without prior written permission | |
23 | from the JDOM Project Management <request_AT_jdom_DOT_org>. | |
24 | ||
25 | In addition, we request (but do not require) that you include in the | |
26 | end-user documentation provided with the redistribution and/or in the | |
27 | software itself an acknowledgement equivalent to the following: | |
28 | "This product includes software developed by the | |
29 | JDOM Project (http://www.jdom.org/)." | |
30 | Alternatively, the acknowledgment may be graphical using the logos | |
31 | available at http://www.jdom.org/images/logos. | |
32 | ||
33 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |
34 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
35 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
36 | DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT | |
37 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
38 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
39 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |
40 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
41 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
42 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |
43 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
44 | SUCH DAMAGE. | |
45 | ||
46 | This software consists of voluntary contributions made by many | |
47 | individuals on behalf of the JDOM Project and was originally | |
48 | created by Jason Hunter <jhunter_AT_jdom_DOT_org> and | |
49 | Brett McLaughlin <brett_AT_jdom_DOT_org>. For more information | |
50 | on the JDOM Project, please see <http://www.jdom.org/>. | |
51 | ||
52 | */ | |
53 |
0 | This is a patched versions of JDOM project which is used in IntelliJ Platform. | |
1 | It's based on JDOM 2.0.x version and patched to restore compatibility with JDOM 1.1. | |
2 | ||
3 | Introduction to the JDOM project | |
4 | ================================ | |
5 | ||
6 | Please see the JDOM web site at http://jdom.org/ | |
7 | and GitHub repository at https://github.com/hunterhacker/jdom/ | |
8 | ||
9 | Quick-Start for JDOM | |
10 | ===================== | |
11 | See the github wiki for a Primer on using JDOM: | |
12 | https://github.com/hunterhacker/jdom/wiki/JDOM2-A-Primer | |
13 | ||
14 | Also see the web site http://jdom.org/downloads/docs.html. It has links to | |
15 | numerous articles and books covering JDOM. | |
16 | ||
17 | ||
18 | Installing the build tools | |
19 | ========================== | |
20 | ||
21 | The JDOM build system is based on Apache Ant. Ant is a little but very | |
22 | handy tool that uses a build file written in XML (build.xml) as building | |
23 | instructions. For more information refer to "http://ant.apache.org". | |
24 | ||
25 | The only thing that you have to make sure of is that the "JAVA_HOME" | |
26 | environment property is set to match the top level directory containing the | |
27 | JVM you want to use. For example: | |
28 | ||
29 | C:\> set JAVA_HOME=C:\jdk1.6 | |
30 | ||
31 | or on Mac: | |
32 | ||
33 | % setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home | |
34 | (csh) | |
35 | > JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home; export JAVA_HOME | |
36 | (ksh, bash) | |
37 | ||
38 | or on Unix: | |
39 | ||
40 | % setenv JAVA_HOME /usr/local/java | |
41 | (csh) | |
42 | > JAVA_HOME=/usr/java; export JAVA_HOME | |
43 | (ksh, bash) | |
44 | ||
45 | That's it! | |
46 | ||
47 | ||
48 | Building instructions | |
49 | ===================== | |
50 | ||
51 | If you do not have the full source code it can be cloned from GitHub. The JDOM | |
52 | project at https://github.com/hunterhacker/jdom has the instructions and source | |
53 | URL to make the git clone easy. | |
54 | ||
55 | You will need to have Apache Ant 1.8.2 or later, and you will need Java JDK 1.6 | |
56 | or later. | |
57 | ||
58 | Ok, let's build the code. First, make sure your current working directory is | |
59 | where the build.xml file is located. Then run "ant". | |
60 | ||
61 | If everything is right and all the required packages are visible, this action | |
62 | will generate a file called "jdom-2.x-20yy.mm.dd.HH.MM.zip" in the | |
63 | "./build/package" directory. This is the same 'zip' file that is distributed | |
64 | as the official JDOM distribution. | |
65 | ||
66 | The name of the zip file (and the jar names inside the zip) is controlled by | |
67 | the two ant properties 'name' and 'version'. The package is called | |
68 | "${name}-${version}.zip". The 'official' JDOM Build process is done by | |
69 | creating a file 'build.properties' in the 'top' folder of the JDOM code, and | |
70 | it contains the single line (or whatever the appropriate version is): | |
71 | ||
72 | version=2.0.0 | |
73 | ||
74 | If your favourite Java IDE happens to be Eclipse, you can run the 'eclipse' ant | |
75 | target, and that will configure your Eclipse project to have all the right | |
76 | 'source' folders, and 'Referenced Libraries'. After running the 'ant eclipse' | |
77 | target, you should refresh your Eclipse project, and you should have a project | |
78 | with no errors or warnings. | |
79 | ||
80 | ||
81 | Build targets | |
82 | ============= | |
83 | ||
84 | The build system is not only responsible for compiling JDOM into a jar file, | |
85 | but is also responsible for creating the HTML documentation in the form of | |
86 | javadocs. | |
87 | ||
88 | These are the meaningful targets for this build file: | |
89 | ||
90 | - package [default] -> generates ./build/package/jdom*.zip | |
91 | - compile -> compiles the source code | |
92 | - javadoc -> generates the API documentation in ./build/javadocs | |
93 | - junit -> runs the JUnit tests | |
94 | - coverage -> generates test coverage metrics | |
95 | - eclipse -> generates an Eclipse project (source folders, jars, etc) | |
96 | - clean -> restores the distribution to its original and clean state | |
97 | - maven -> generates the package, and makes a 'bundle' for maven-central | |
98 | ||
99 | To learn the details of what each target does, read the build.xml file. It is | |
100 | quite understandable. | |
101 | ||
102 | ||
103 | Bug Reports | |
104 | =========== | |
105 | ||
106 | Bug reports go to the jdom-interest list at jdom.org. But *BEFORE YOU POST* | |
107 | make sure you've tested against the LATEST code available from GitHub (or the | |
108 | daily snapshot). Odds are good your bug has already been fixed. If it hasn't | |
109 | been fixed in the latest version, then when posting *BE SURE TO SAY* which | |
110 | code version you tested against. For example, "GitHub from October 3rd". Also | |
111 | be sure to include enough information to reproduce the bug and full exception | |
112 | stack traces. You might also want to read the FAQ at http://jdom.org to find | |
113 | out if your problem is not really a bug and just a common misunderstanding | |
114 | about how XML or JDOM works. | |
115 | ||
116 | ||
117 | Searching for Information | |
118 | ========================= | |
119 | ||
120 | The JDOM mailing lists are archived and easily searched at | |
121 | http://jdom.markmail.org. |
0 | Items that need to be done: | |
1 | ||
2 | --- ITEMS REMAINING BEFORE 1.1 --- | |
3 | ||
4 | None! | |
5 | ||
6 | --- ITEMS TO CONSIDER FOR 1.2 --- | |
7 | ||
8 | * Integrate the contributed StAXBuilder. | |
9 | ||
10 | * Rusty's "base uri" support for Element and the rest. | |
11 | ||
12 | * Investigate a way to do in-memory validation. First step is probably | |
13 | to get an in-memory representation of a DTD as per | |
14 | http://xmlhack.com/read.php?item=626 | |
15 | http://www.wutka.com/dtdparser.html | |
16 | http://lists.denveronline.net/lists/jdom-interest/2000-July/001431.html | |
17 | http://lists.denveronline.net/lists/jdom-interest/2001-February/004661.html | |
18 | Maybe new DTDValidator(dtd).validate(doc); | |
19 | Then later new SchemaValidator(schema).validate(doc); | |
20 | Could instead do doc.validate(dtd/schema) but then we'd have to dynamically | |
21 | switch between recognizing DTDs and the various schemas. | |
22 | The method would probably either throw InvalidDocumentException or might | |
23 | take an ErrorHandler-style interface implementation if there are non-fatal | |
24 | errors possible. | |
25 | It'd also be possible to have a programmatic verifier, that determined for | |
26 | example if an orderid="100" entry was valid against a database entry. | |
27 | http://dcb.sun.com/practices/devnotebook/xml_msv.jsp | |
28 | http://www.sun.com/software/xml/developers/multischema/ | |
29 | ||
30 | * Create an HTMLOutputter to handle the HTML specific aspects (closing tags, | |
31 | escaped characters like é, etc). | |
32 | ||
33 | --- FUTURE IDEAS --- | |
34 | ||
35 | * Utility methods for comparing nodes by content instead of reference. | |
36 | Hopefully base this on whatever standard emerges in this area. | |
37 | ||
38 | * Note in the docs where necessary our multithreading policy. | |
39 | ||
40 | * Create a JDOM logo. | |
41 | ||
42 | * Look at http://www.sosnoski.com/opensrc/xmls/format.html. | |
43 | ||
44 | * Look at interfaces for the core classes, Element with ConcreteElement being | |
45 | our code. Base on the factory model. Allow no access between objects | |
46 | except using the public API, to avoid the import node problem. Do the big | |
47 | switchover using javax.xml.jdom as interfaces and default impl, use org.jdom | |
48 | for the concretes. May not need to break existing code (sick and wrong). | |
49 | - read-only? Experimentation happening in jdom-javax module. | |
50 | ||
51 | * Ensure JDOM is appropriately tweaked for subclassing, per the threads | |
52 | started by Joe Bowbeer. | |
53 | http://www.servlets.com/archive/servlet/ReadMsg?msgId=7601 begins it | |
54 | ||
55 | * Ensure JDOM is flawless regarding clone semantics, per more threads by | |
56 | Joe Bowbeer. | |
57 | http://www.servlets.com/archive/servlet/ReadMsg?msgId=7602 begins it | |
58 | ||
59 | * Joe summarizes his issues at | |
60 | http://www.servlets.com/archive/servlet/ReadMsg?msgId=7697 | |
61 | ||
62 | * Add in attribute type support to DOM to match what's in SAX. | |
63 | ||
64 | * Look into implementing an id() method now that we have attribute types. | |
65 | ||
66 | * Look into how the factory builder model could support giving the factory | |
67 | extra knowledge about the context (line number, element stack, etc), and | |
68 | allow it to report errors or to return a code indicating the element should | |
69 | be ignored. | |
70 | (Laurent Bihanic wrote JH a private email about this on Dec 28 2001.) | |
71 | ||
72 | * Write a "GNU JAXP (i.e. AElfred) DOM adapter" (elharo looking into this). | |
73 | ||
74 | * Create "build dist" for distribution | |
75 | Use fixcrlf in dist (instead of package as currently done) | |
76 | Probably include source with jdom.jar built | |
77 | ||
78 | * Populate jdom-test. Hong Zhang <Hong.Zhang AT Sun.COM> once volunteered to | |
79 | help with the J2EE CTS. | |
80 | ||
81 | * Add setIgnoringAllWhitespace(boolean) method. | |
82 | ||
83 | * Consider a listener interface so you could listen to doc changes. | |
84 | (Probably after 1.1 honestly; this can be done through manual subclasses | |
85 | already.) Some pertinent messages on this topic: | |
86 | http://lists.denveronline.net/lists/jdom-interest/2000-July/001586.html | |
87 | http://lists.denveronline.net/lists/jdom-interest/2000-July/001587.html | |
88 | http://lists.denveronline.net/lists/jdom-interest/2000-July/001600.html | |
89 | ||
90 | * Consider a "locator" ability for nodes to remember the line number on which | |
91 | they were declared, to help debug semantic errors. | |
92 | http://lists.denveronline.net/lists/jdom-interest/2000-October/003422.html | |
93 | ||
94 | * Consider an XMLOutputter flag or feature to convert characters with well | |
95 | known named character entities to their named char entity form instead of | |
96 | numeric. | |
97 | ||
98 | * Determine if DOMBuilder and DOMOutputter should transparently support DOM1. | |
99 | ||
100 | * Create a builder based on Xerces' XNI, which will be more featureful and | |
101 | probably faster than the one based on SAX. | |
102 | See http://lists.denveronline.net/lists/jdom-interest/2001-July/007362.html | |
103 | Some existing SAX limitations which hurt round-tripping: | |
104 | * Can't tell if attribute values are included from the DTD, because SAX | |
105 | doesn't tell if attributes are standalone/implicit | |
106 | (See http://www.saxproject.org/apidoc/org/xml/sax/ext/Attributes2.html) | |
107 | (Thought: could use a bit in the type value to save memory) | |
108 | * Can't get access to retain the internal dtd subset unless entity | |
109 | expansion is off | |
110 | * Can't get access to whitespace outside the root element. | |
111 | ||
112 | * Write a guide for contributors. Short summary: | |
113 | Follow Sun's coding guidelines, use 4-space (no tab) indents, no lines | |
114 | longer than 80 characters | |
115 | ||
116 | * Consider a builder for a read-only document. It could "intern" objects to | |
117 | reduce memory consumption. In fact, interning may be good for String | |
118 | objects regardless. | |
119 | ||
120 | * Consider having the license be clear org.jdom is a protected namespace. | |
121 | ||
122 | * Think about the idea of using more inheritance in JDOM to allow | |
123 | lightweight but not XML 1.0 complete implementations. For example Element | |
124 | could have a superclass "CommonXMLElement" that supported only what Common | |
125 | XML requires. Builders could build such elements to be faster and lighter | |
126 | than full elements -- perfect for things like reading config files. Lots | |
127 | of difficulties with this design though. | |
128 | ||
129 | * Create a Verifier lookup table as an int[256] growable to int[64K] where | |
130 | bits in the returned value indicate that char's ability to be used for a | |
131 | task. So "lookup[(int)'x'] & LETTER_MASK" tells us if it's a letter | |
132 | or not. | |
133 | ||
134 | * Consider an HTMLBuilder that reads not-necessarily-well-formed HTML and | |
135 | produces a JDOM Document. The approach I'd suggest is to build on top of | |
136 | JTidy first. That gives a working implementation fast, at the cost of a | |
137 | 157K Tidy.jar in the distribution. After that, perhaps someone would lead | |
138 | an effort to change the JTidy code to build a JDOM Document directly, | |
139 | instead of making a DOM Document or XML stream first. That would be a lot | |
140 | faster, use less memory, and make our dist smaller. See | |
141 | http://www.sourceforge.net/projects/jtidy for Tidy. | |
142 | See post by Jacob.Robertson@argushealth.com on 2/13/2002. | |
143 | ||
144 | * Look at a (contrib?) outputter option using SAX filters per | |
145 | http://lists.denveronline.net/lists/jdom-interest/2000-October/003303.html | |
146 | http://lists.denveronline.net/lists/jdom-interest/2000-October/003304.html | |
147 | http://lists.denveronline.net/lists/jdom-interest/2000-October/003318.html | |
148 | http://lists.denveronline.net/lists/jdom-interest/2000-October/003535.html | |
149 | ||
150 | * Look at event-based parsing as per the following thread: | |
151 | http://lists.denveronline.net/lists/jdom-interest/2000-November/003613.html | |
152 | and replies. | |
153 | Also see posts with the subject "streamdom". | |
154 | ||
155 | * Considering that local vars are considerably faster that instance vars, test | |
156 | if using local vars can speed building. | |
157 | ||
158 | * Consider using a List of instance data so elements only use what they really | |
159 | need (saving attrib list, namespace list) | |
160 | ||
161 | * Investigate doc.getDescription() to let people add doc descriptions. It's | |
162 | an idea from IBM's parser suggested by andyk. | |
163 | ||
164 | * Work on creating a deferred builder that parses only what's necessary to | |
165 | satisfy the programmer's requests. See Ayal Spitz' post at | |
166 | http://lists.denveronline.net/lists/jdom-interest/2001-April/005685.html | |
167 | ||
168 | * Change the various setAttributeValue() methods in Element and | |
169 | Attribute to check the attribute type and normalize the string | |
170 | according to the attribute type. i.e. normalize the white space if | |
171 | the attribute has any type other than CDATA or UNDECLARED. | |
172 | ||
173 | * Give attributes the "specified" flag like in DOM. This probably isn't | |
174 | receivable from SAXBuilder, but it would be from DOMBuilder and other | |
175 | builders. Then give XMLOutputter the ability to avoid outputting | |
176 | "unspecified" attributes. | |
177 | ||
178 | * Should there be XPath support within Element, Document, etc? | |
179 |
0 | <!-- $Id: build.xml,v 1.57 2009/07/23 06:48:27 jhunter Exp $ --> | |
1 | ||
2 | <!-- | |
3 | For instructions on how to build JDOM, please view the README.txt file. | |
4 | --> | |
5 | ||
6 | <project default="package" basedir="."> | |
7 | ||
8 | <!-- =================================================================== --> | |
9 | <!-- Initialization target --> | |
10 | <!-- =================================================================== --> | |
11 | <tstamp > | |
12 | <format property="snapshot.time" pattern="yyyy.MM.dd.HH.mm" /> | |
13 | <format property="year" pattern="yyyy" /> | |
14 | </tstamp> | |
15 | ||
16 | <!-- | |
17 | Give user a chance to override without editing this file | |
18 | (and without using -D arguments each time they build). | |
19 | The build properties a user is likely to override include: | |
20 | - lib.dir The directory where to look for the default JAR | |
21 | files. Defaults to ./lib | |
22 | - xml-apis.jar The JAR containing the DOM, SAX and JAXP classes. | |
23 | Defaults to ${lib.dir}/xml-apis.jar | |
24 | - parser.jar The JAR containing the XML parser to use. | |
25 | Defaults to ${lib.dir}/xerces.jar | |
26 | - jaxen.lib.dir The directory containing the Jaxen JAR libraries. | |
27 | Defaults to ${lib.dir} | |
28 | --> | |
29 | <property file="${user.home}/jdom.build.properties" /> | |
30 | <property file="${basedir}/build.properties" /> | |
31 | ||
32 | <property name="Name" value="JDOM"/> | |
33 | <property name="name" value="jdom"/> | |
34 | <property name="version" value="2.x-${snapshot.time}"/> | |
35 | <property name="version.impl" value="${version}"/> | |
36 | <property name="version.spec" value="2.0.0"/> | |
37 | ||
38 | <property name="gpg" value="gpg" | |
39 | description="Path to the GNU gpg program for maven target"/> | |
40 | ||
41 | <property name="jarbase" value="${name}-${version}" /> | |
42 | ||
43 | <property name="instrument" value="true" /> | |
44 | ||
45 | <echo message="----------- ${Name} ${version} ------------"/> | |
46 | ||
47 | <property name="compile.debug" value="true" /> | |
48 | <property name="compile.optimize" value="true" /> | |
49 | <property name="compile.target" value="1.5" /> | |
50 | <property name="compile.source" value="1.5" /> | |
51 | <property name="compile.deprecation" value="true" /> | |
52 | ||
53 | <property name="build" value="./build"/> | |
54 | ||
55 | <property name="core" value="./core" /> | |
56 | <property name="core.src" value="${core}/src/java" /> | |
57 | <property name="core.build" value="${build}/core" /> | |
58 | ||
59 | <property name="about" value="./core/package" /> | |
60 | <property name="about.src" value="${about}" /> | |
61 | <property name="about.build" value="${build}/about" /> | |
62 | ||
63 | <property name="metainf" value="./core/package/META-INF" /> | |
64 | <property name="metainf.build" value="${build}/META-INF" /> | |
65 | ||
66 | <property name="contrib" value="./contrib" /> | |
67 | <property name="contrib.src" value="${contrib}/src/java" /> | |
68 | <property name="contrib.build" value="${build}/contrib" /> | |
69 | ||
70 | <property name="junit" value="./test" /> | |
71 | <property name="junit.src" value="${junit}/src/java" /> | |
72 | <property name="junit.resources" value="${junit}/src/resources" /> | |
73 | <property name="junit.build" value="${build}/junit" /> | |
74 | <property name="junit.xml" value="${build}/junit.xml" /> | |
75 | <property name="junit.report" value="${build}/junit.report" /> | |
76 | <property name="junit.instrumented" value="${build}/instrumented" /> | |
77 | ||
78 | ||
79 | <property name="samples" value="./core/samples/" /> | |
80 | <property name="samples.src" value="${samples}/" /> | |
81 | <property name="samples.build" value="${build}/samples"/> | |
82 | ||
83 | <!-- Do not set a stax.dir | |
84 | but it is available for override (for Java5 for example) --> | |
85 | <property name="stax.dir" value="dummy" /> | |
86 | ||
87 | <property name="lib.dir" value="./lib"/> | |
88 | <property name="packages" value="org.jdom.*"/> | |
89 | ||
90 | <property name="build.javadocs" value="${build}/apidocs"/> | |
91 | ||
92 | <property name="package" value="${build}/package"/> | |
93 | ||
94 | <property name="coverage.out" value="${build}/coverage" /> | |
95 | ||
96 | <property name="mavendir" value="${build}/maven" /> | |
97 | ||
98 | <filter token="year" value="${year}"/> | |
99 | <filter token="version" value="${version}"/> | |
100 | <filter token="date" value="${TODAY}"/> | |
101 | <filter token="jdk" value="${compile.target}" /> | |
102 | ||
103 | <!-- Default JAR libraries --> | |
104 | <property name="parser.jar" value="${lib.dir}/xercesImpl.jar" /> | |
105 | <property name="xmlapi.jar" value="${lib.dir}/xml-apis.jar" /> | |
106 | <property name="jaxen.jar" value="${lib.dir}/jaxen-1.1.6.jar" /> | |
107 | <property name="junit.jar" value="${lib.dir}/junit-4.8.2.jar" /> | |
108 | <property name="isorelax.jar" value="${contrib}/lib/isorelax.jar" /> | |
109 | <property name="xalan.jar" value="${lib.dir}/xalan/xalan-2.7.2.jar" /> | |
110 | <property name="xalanser.jar" value="${lib.dir}/xalan/serializer-2.7.2.jar" /> | |
111 | ||
112 | <!-- Compilation class path --> | |
113 | <path id="base.class.path"> | |
114 | <pathelement location="${jaxen.jar}" /> | |
115 | <pathelement location="${parser.jar}" /> | |
116 | <pathelement location="${xmlapi.jar}" /> | |
117 | <pathelement location="${junit.jar}" /> | |
118 | <pathelement location="${isorelax.jar}" /> | |
119 | <pathelement location="${xalan.jar}" /> | |
120 | <pathelement location="${xalanser.jar}" /> | |
121 | <!-- normally these stax jars will not be found --> | |
122 | <!-- this is used for testing Java5 (the test sets stax.dir) --> | |
123 | <pathelement location="${stax.dir}/jsr173_1.0_api.jar" /> | |
124 | <pathelement location="${stax.dir}/sjsxp.jar" /> | |
125 | </path> | |
126 | ||
127 | <path id="core.class.path"> | |
128 | <path refid="base.class.path"/> | |
129 | <pathelement location="${core.build}"/> | |
130 | </path> | |
131 | ||
132 | <path id="contrib.class.path"> | |
133 | <path refid="core.class.path"/> | |
134 | <pathelement location="${contrib.build}"/> | |
135 | </path> | |
136 | ||
137 | <path id="junit.class.path"> | |
138 | <pathelement location="${junit.instrumented}" /> | |
139 | <pathelement location="${junit.build}"/> | |
140 | <path refid="contrib.class.path"/> | |
141 | <fileset dir="${lib.dir}/cobertura" includes="*.jar" /> | |
142 | </path> | |
143 | ||
144 | ||
145 | <!-- =================================================================== --> | |
146 | <!-- Help on usage --> | |
147 | <!-- =================================================================== --> | |
148 | <target name="usage"> | |
149 | <echo message=""/> | |
150 | <echo message=""/> | |
151 | <echo message="JDOM Build file"/> | |
152 | <echo message="-------------------------------------------------------------"/> | |
153 | <echo message=""/> | |
154 | <echo message=" available targets are:"/> | |
155 | <echo message=""/> | |
156 | <echo message=" - package [default] -> generates ./build/jdom2.jar and other supporting files"/> | |
157 | <echo message=" - compile -> compiles the source code"/> | |
158 | <echo message=" - javadoc -> generates the API documentation in ./build/javadocs"/> | |
159 | <echo message=" - junit -> runs the JUnit tests"/> | |
160 | <echo message=" - coverage -> generates test coverage metrics"/> | |
161 | <echo message=" - eclipse -> generates an Eclipse project (source folders, jars, etc)"/> | |
162 | <echo message=" - clean -> restores the distribution to its original and clean state"/> | |
163 | <echo message=" - maven -> Prepares a package-upload for maven-central"/> | |
164 | <echo message=""/> | |
165 | <echo message=" See the comments inside the build.xml file for more details."/> | |
166 | <echo message="-------------------------------------------------------------"/> | |
167 | <echo message=""/> | |
168 | <echo message=""/> | |
169 | </target> | |
170 | ||
171 | <!-- =================================================================== --> | |
172 | <!-- Prepares the build directory --> | |
173 | <!-- =================================================================== --> | |
174 | <target name="prepare"> | |
175 | <mkdir dir="${build}"/> | |
176 | <mkdir dir="${core.build}"/> | |
177 | <mkdir dir="${about.build}"/> | |
178 | <mkdir dir="${samples.build}"/> | |
179 | <mkdir dir="${junit.build}"/> | |
180 | <mkdir dir="${contrib.build}"/> | |
181 | <mkdir dir="${metainf.build}"/> | |
182 | </target> | |
183 | ||
184 | <!-- =================================================================== --> | |
185 | <!-- Compiles the source directory --> | |
186 | <!-- =================================================================== --> | |
187 | <target name="compile.core" depends="prepare" | |
188 | description="Compiles the core source code"> | |
189 | ||
190 | <!-- Copy resources and stuff - everything except Java code --> | |
191 | <copy todir="${core.build}" > | |
192 | <fileset dir="${core.src}" excludes="**/*.java" /> | |
193 | </copy> | |
194 | ||
195 | <javac srcdir="${core.src}" | |
196 | destdir="${core.build}" | |
197 | debug="${compile.debug}" | |
198 | optimize="${compile.optimize}" | |
199 | target="${compile.target}" | |
200 | source="${compile.source}" | |
201 | deprecation="${compile.deprecation}" | |
202 | includeantruntime="false"> | |
203 | <classpath refid="base.class.path"/> | |
204 | </javac> | |
205 | </target> | |
206 | ||
207 | <target name="compile.samples" depends="compile.core, compile.contrib" | |
208 | description="Compiles the sample source code"> | |
209 | ||
210 | <!-- Copy resources and stuff - everything except Java code --> | |
211 | <copy todir="${samples.build}" > | |
212 | <fileset dir="${samples.src}" excludes="**/*.java" /> | |
213 | </copy> | |
214 | ||
215 | <javac srcdir="${samples.src}" | |
216 | destdir="${samples.build}" | |
217 | debug="${compile.debug}" | |
218 | optimize="${compile.optimize}" | |
219 | target="${compile.target}" | |
220 | source="${compile.source}" | |
221 | deprecation="${compile.deprecation}" | |
222 | includeantruntime="false"> | |
223 | <classpath refid="contrib.class.path" /> | |
224 | </javac> | |
225 | </target> | |
226 | ||
227 | <target name="compile.contrib" depends="compile.core" | |
228 | description="Compiles the contrib source code"> | |
229 | ||
230 | <!-- Copy resources and stuff - everything except Java code --> | |
231 | <copy todir="${contrib.build}" > | |
232 | <fileset dir="${contrib.src}" excludes="**/*.java" /> | |
233 | </copy> | |
234 | ||
235 | <javac srcdir="${contrib.src}" | |
236 | destdir="${contrib.build}" | |
237 | debug="${compile.debug}" | |
238 | optimize="${compile.optimize}" | |
239 | target="${compile.target}" | |
240 | source="${compile.source}" | |
241 | deprecation="${compile.deprecation}" | |
242 | includeantruntime="false"> | |
243 | <classpath refid="core.class.path" /> | |
244 | </javac> | |
245 | </target> | |
246 | ||
247 | <target name="compile.junit" depends="compile.core, compile.contrib" | |
248 | description="Compiles the junit source code"> | |
249 | ||
250 | <!-- Copy resources and stuff - everything except Java code --> | |
251 | <copy todir="${junit.build}" > | |
252 | <fileset dir="${junit.src}" excludes="**/*.java" /> | |
253 | <fileset dir="${junit.resources}" /> | |
254 | </copy> | |
255 | ||
256 | <!-- ignore deprecation warnings in jUnit --> | |
257 | <javac srcdir="${junit.src}" | |
258 | destdir="${junit.build}" | |
259 | debug="${compile.debug}" | |
260 | optimize="${compile.optimize}" | |
261 | target="${compile.target}" | |
262 | source="${compile.source}" | |
263 | deprecation="no" | |
264 | includeantruntime="false"> | |
265 | <classpath refid="contrib.class.path" /> | |
266 | </javac> | |
267 | </target> | |
268 | ||
269 | <target name="compile" depends="compile.core, compile.junit, compile.contrib, compile.samples" | |
270 | description="Compiles all JDOM code (core, samples, junit, contrib)" /> | |
271 | ||
272 | <!-- =================================================================== --> | |
273 | <!-- Creates the API documentation --> | |
274 | <!-- =================================================================== --> | |
275 | <target name="javadoc" depends="prepare" | |
276 | description="Creates the API documentation"> | |
277 | <mkdir dir="${build.javadocs}"/> | |
278 | <javadoc packagenames="${packages}" | |
279 | sourcepath="${core.src}" | |
280 | destdir="${build.javadocs}" | |
281 | author="true" | |
282 | version="true" | |
283 | use="true" | |
284 | splitindex="true" | |
285 | noindex="false" | |
286 | windowtitle="${Name} v${version}" | |
287 | doctitle="${Name} v${version}<br>API Specification" | |
288 | header="<b>${Name}<br><font size='-1'>${version}</font></b>" | |
289 | bottom="Copyright © ${year} Jason Hunter, Brett McLaughlin. All Rights Reserved."> | |
290 | <classpath refid="base.class.path"/> | |
291 | </javadoc> | |
292 | </target> | |
293 | ||
294 | ||
295 | <!-- =================================================================== --> | |
296 | <!-- Creates the jars --> | |
297 | <!-- =================================================================== --> | |
298 | <target name="jars" depends="compile, javadoc" | |
299 | description="Builds the Jars"> | |
300 | <fixcrlf srcdir="." includes="**/*.bat" excludes="build*.*" eol="crlf"/> | |
301 | <fixcrlf srcdir="." includes="**/*.sh" excludes="build*.*" eol="lf"/> | |
302 | ||
303 | <!-- Filters defined specifically for updating the manifest --> | |
304 | <filter token="version.spec" value="${version.spec}"/> | |
305 | <filter token="version.impl" value="${version.impl}"/> | |
306 | ||
307 | <copy todir="${metainf.build}/META-INF" filtering="yes"> | |
308 | <fileset dir="${metainf}"/> | |
309 | <fileset dir="."> | |
310 | <include name="LICENSE.txt"/> | |
311 | </fileset> | |
312 | </copy> | |
313 | ||
314 | <jar jarfile="${package}/${jarbase}.jar" manifest="${metainf.build}/META-INF/MANIFEST.MF"> | |
315 | <fileset dir="${core.build}" includes="**/*.class" /> | |
316 | <fileset dir="${metainf.build}" excludes="**/MANIFEST.MF" /> | |
317 | </jar> | |
318 | <jar jarfile="${package}/${jarbase}-contrib.jar" > | |
319 | <fileset dir="${contrib.build}" includes="**/*" /> | |
320 | <fileset dir="${metainf.build}" excludes="**/MANIFEST.MF" /> | |
321 | </jar> | |
322 | <jar jarfile="${package}/${jarbase}-junit.jar" > | |
323 | <fileset dir="${junit.build}" includes="**/*" /> | |
324 | <fileset dir="${metainf.build}" excludes="**/MANIFEST.MF" /> | |
325 | </jar> | |
326 | <jar destfile="${package}/${jarbase}-javadoc.jar" | |
327 | basedir="${build.javadocs}" includes="**/*" /> | |
328 | ||
329 | <jar jarfile="${package}/${jarbase}-sources.jar" > | |
330 | <fileset dir="${core.src}" includes="**/*" /> | |
331 | </jar> | |
332 | <jar jarfile="${package}/${jarbase}-junit-sources.jar" > | |
333 | <fileset dir="${junit.src}" includes="**/*" /> | |
334 | </jar> | |
335 | <jar jarfile="${package}/${jarbase}-contrib-sources.jar" > | |
336 | <fileset dir="${contrib.src}" includes="**/*" /> | |
337 | </jar> | |
338 | ||
339 | </target> | |
340 | ||
341 | <target name="androidtests" depends="jars"> | |
342 | ||
343 | <property name="android.project" value="JUT" /> | |
344 | <property name="android" value="${build}/android" /> | |
345 | <property name="android.libs" value="${android}/${android.project}/libs" /> | |
346 | <mkdir dir="${android}" /> | |
347 | <mkdir dir="${android.libs}" /> | |
348 | ||
349 | <path id="at.class.path"> | |
350 | <pathelement location="${package}/${jarbase}.jar" /> | |
351 | <pathelement location="${package}/${jarbase}-contrib.jar" /> | |
352 | <pathelement location="${package}/${jarbase}-junit.jar" /> | |
353 | <path refid="base.class.path"/> | |
354 | </path> | |
355 | ||
356 | <!-- Convert the test cases from JUnit4 to a JUnit3 format --> | |
357 | <!-- This also copies the resources only. --> | |
358 | <java classname="org.jdom.contrib.android.TranslateTests" | |
359 | classpathref="at.class.path" > | |
360 | <arg value="${package}/${jarbase}-junit.jar" /> | |
361 | <arg value="${android}/${android.project}Test/src" /> | |
362 | </java> | |
363 | ||
364 | <copy todir="${android.libs}"> | |
365 | <fileset dir="${package}" | |
366 | includes="${jarbase}.jar, ${jarbase}-contrib.jar ${jarbase}-junit.jar" /> | |
367 | </copy> | |
368 | ||
369 | <copy todir="${android.libs}" file="${jaxen.jar}"/> | |
370 | <copy todir="${android.libs}" file="${xalan.jar}"/> | |
371 | <copy todir="${android.libs}" file="${xalanser.jar}"/> | |
372 | <copy todir="${android.libs}" file="${junit.jar}"/> | |
373 | </target> | |
374 | ||
375 | <!-- =================================================================== --> | |
376 | <!-- Creates the class package --> | |
377 | <!-- =================================================================== --> | |
378 | <target name="package" depends="coverage, jars" | |
379 | description="Creates the class package"> | |
380 | <zip destfile="${package}/${jarbase}.zip"> | |
381 | <fileset dir="${package}" includes="${jarbase}*.jar" /> | |
382 | <fileset dir="${basedir}" includes="lib/xerces* lib/jaxen* lib/xml* lib/xalan/**" /> | |
383 | <fileset dir="${basedir}" includes="LICENSE.txt README.txt" /> | |
384 | </zip> | |
385 | </target> | |
386 | ||
387 | <!-- =================================================================== --> | |
388 | <!-- Clean targets --> | |
389 | <!-- =================================================================== --> | |
390 | <target name="clean" description="Removes build files"> | |
391 | <delete dir="${build}" failonerror="false"/> | |
392 | </target> | |
393 | ||
394 | <!-- =================================================================== --> | |
395 | <!-- JUnit and Test Coverage targets --> | |
396 | <!-- =================================================================== --> | |
397 | <target name="coverage.setup" description="Set up code-coverage metrics" depends="compile.core"> | |
398 | <taskdef classpathref="junit.class.path" resource="tasks.properties"/> | |
399 | ||
400 | <delete dir="${junit.instrumented}"/> | |
401 | <mkdir dir="${junit.instrumented}" /> | |
402 | <property name="cobertura.datafile" value="${junit.instrumented}/cobertura.ser"/> | |
403 | <cobertura-instrument todir="${junit.instrumented}" datafile="${cobertura.datafile}"> | |
404 | <fileset dir="${core.build}"> | |
405 | <include name="**/*.class"/> | |
406 | <!-- exclude name="**/**/jaxen/**/*.class"/ --> | |
407 | </fileset> | |
408 | </cobertura-instrument> | |
409 | ||
410 | <property name="forkjunit" value="true" /> | |
411 | ||
412 | </target> | |
413 | ||
414 | ||
415 | <target name="junit.nodeps" | |
416 | description="Run all the JUnit tests, but do not compile anything first"> | |
417 | ||
418 | <delete dir="${junit.report}" /> | |
419 | <mkdir dir="${junit.report}" /> | |
420 | ||
421 | <delete dir="${junit.xml}" /> | |
422 | <mkdir dir="${junit.xml}" /> | |
423 | ||
424 | <!-- We need to fork to get the resources on the classpath --> | |
425 | <!-- Otherwise we rely on ant's ClassLoader which does not do resources nicely --> | |
426 | <junit fork="true" forkmode="once" haltonerror="false" haltonfailure="false" | |
427 | failureproperty="junit.failed" printsummary="true" timeout="100000" | |
428 | showoutput="true" includeantruntime="true" > | |
429 | ||
430 | <sysproperty key="net.sourceforge.cobertura.datafile" | |
431 | file="${cobertura.datafile}" /> | |
432 | <classpath refid="junit.class.path" /> | |
433 | ||
434 | <formatter type="xml"/> | |
435 | ||
436 | <batchtest haltonerror="false" haltonfailure="false" | |
437 | failureproperty="junit.failed" todir="${junit.xml}" > | |
438 | <sort> | |
439 | <name /> | |
440 | <fileset dir="${junit.src}"> | |
441 | <include name="**/Test*.java"/> | |
442 | <exclude name="**/generate/**" /> | |
443 | </fileset> | |
444 | </sort> | |
445 | </batchtest> | |
446 | ||
447 | </junit> | |
448 | ||
449 | <junitreport todir="${junit.report}"> | |
450 | <fileset dir="${junit.xml}"> | |
451 | <include name="TEST-*.xml"/> | |
452 | </fileset> | |
453 | ||
454 | <report format="frames" todir="${junit.report}"/> | |
455 | </junitreport> | |
456 | </target> | |
457 | ||
458 | <target name="junit" depends="compile.core, compile.junit, junit.nodeps" | |
459 | description="Compile code required for JUnit, then run JUnit tests"/> | |
460 | ||
461 | <target name="coverage" depends="coverage.setup, junit" | |
462 | description="Run the code coverage tool."> | |
463 | <delete dir="${coverage.out}"/> | |
464 | <mkdir dir="${coverage.out}" /> | |
465 | <cobertura-report srcdir="${core.src}" destdir="${coverage.out}" datafile="${cobertura.datafile}"/> | |
466 | <echo message="See ${coverage.out}/index.html for results." /> | |
467 | </target> | |
468 | ||
469 | <!-- =================================================================== --> | |
470 | <!-- Eclipse targets --> | |
471 | <!-- =================================================================== --> | |
472 | <target name="eclipse" description="Set up your eclipse project (source folders, jars, etc.)"> | |
473 | <echo file="./.classpath" xml:space="preserve"><![CDATA[<?xml version="1.0" encoding="UTF-8"?> | |
474 | <classpath> | |
475 | <classpathentry kind="src" path="core/src/java"/> | |
476 | <classpathentry kind="src" path="core/package"/> | |
477 | <classpathentry kind="src" path="core/samples"/> | |
478 | <classpathentry kind="src" path="test/src/java"/> | |
479 | <classpathentry kind="src" path="test/src/resources"/> | |
480 | <classpathentry kind="src" path="contrib/src/java" excluding="org/jdom/contrib/ids/doc-files/|org/jdom/contrib/input/scanner/doc-files/|org/jdom2/contrib/ids/doc-files/|org/jdom2/contrib/ids/doc-files/|org/jdom2/contrib/input/scanner/doc-files/|org/jdom2/contrib/input/scanner/doc-files/"/> | |
481 | <classpathentry kind="src" path="contrib/samples"/> | |
482 | <classpathentry kind="src" path="contrib/src/java/org/jdom2/contrib/ids/doc-files"/> | |
483 | <classpathentry kind="src" path="contrib/src/java/org/jdom2/contrib/input/scanner/doc-files"/> | |
484 | <classpathentry kind="lib" path="${junit.jar}"/> | |
485 | <classpathentry kind="lib" path="${parser.jar}"/> | |
486 | <classpathentry kind="lib" path="${xmlapi.jar}"/> | |
487 | <classpathentry kind="lib" path="${jaxen.jar}"/> | |
488 | <classpathentry kind="lib" path="${isorelax.jar}"/> | |
489 | <classpathentry kind="lib" path="${xalanser.jar}"/> | |
490 | <classpathentry kind="lib" path="${xalan.jar}"/> | |
491 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | |
492 | <classpathentry kind="output" path="ebuild"/> | |
493 | </classpath> | |
494 | ]]> | |
495 | </echo> | |
496 | </target> | |
497 | ||
498 | <!-- =================================================================== --> | |
499 | <!-- Maven targets --> | |
500 | <!-- =================================================================== --> | |
501 | ||
502 | ||
503 | <target name="maven.clean"> | |
504 | <delete dir="${mavendir}" includes="**/*" failonerror="false"/> | |
505 | </target> | |
506 | ||
507 | <target name="maven" depends="maven.clean, package" | |
508 | description="Prepares Maven bundle to load on to Sonatype Nexus for Maven-Central"> | |
509 | <mkdir dir="${mavendir}" /> | |
510 | <mkdir dir="${mavendir}/core" /> | |
511 | <mkdir dir="${mavendir}/test" /> | |
512 | <mkdir dir="${mavendir}/contrib" /> | |
513 | ||
514 | <property name="mavenartifact" value="jdom2" /> | |
515 | <property name="mavenbase" value="${mavenartifact}-${version}" /> | |
516 | ||
517 | <!-- copy the build jar --> | |
518 | <copy tofile="${mavendir}/core/${mavenbase}.jar" file="${package}/${jarbase}.jar"/> | |
519 | <copy tofile="${mavendir}/core/${mavenbase}-javadoc.jar" file="${package}/${jarbase}-javadoc.jar"/> | |
520 | <copy tofile="${mavendir}/core/${mavenbase}-sources.jar" file="${package}/${jarbase}-sources.jar"/> | |
521 | ||
522 | <!-- load the license in to the ${license} property --> | |
523 | <loadfile property="license" srcfile="LICENSE.txt" /> | |
524 | ||
525 | <!-- copy/rename the pom template --> | |
526 | <copy filtering="true" file="maven/maven.pom" tofile="${mavendir}/core/${mavenbase}.pom"> | |
527 | <filterset> | |
528 | <filter token="artifactID" value="${mavenartifact}"/> | |
529 | <filter token="version" value="${version}" /> | |
530 | <filter token="jdk" value="${compile.target}" /> | |
531 | <filter token="license" value="${license}" /> | |
532 | </filterset> | |
533 | </copy> | |
534 | ||
535 | <exec dir="${mavendir}/core" executable="${gpg}"> | |
536 | <arg value="-abv"/> | |
537 | <arg value="${mavenbase}.pom"/> | |
538 | </exec> | |
539 | <exec dir="${mavendir}/core" executable="${gpg}"> | |
540 | <arg value="-abv"/> | |
541 | <arg value="${mavenbase}.jar"/> | |
542 | </exec> | |
543 | <exec dir="${mavendir}/core" executable="${gpg}"> | |
544 | <arg value="-abv"/> | |
545 | <arg value="${mavenbase}-sources.jar"/> | |
546 | </exec> | |
547 | <exec dir="${mavendir}/core" executable="${gpg}"> | |
548 | <arg value="-abv"/> | |
549 | <arg value="${mavenbase}-javadoc.jar"/> | |
550 | </exec> | |
551 | ||
552 | <jar destfile="${mavendir}/${mavenbase}-maven-bundle.jar" | |
553 | basedir="${mavendir}/core" | |
554 | includes="${mavenbase}*" excludes="*maven-bundle*" /> | |
555 | ||
556 | </target> | |
557 | ||
558 | </project> | |
559 | ||
560 | <!-- End of file --> |
0 | Introduction | |
1 | ============ | |
2 | ||
3 | jdom-contrib is a place for projects that increase the value of JDOM but | |
4 | aren't (at least yet) in the core distribution. Contributed code is | |
5 | placed under the org.jdom.contrib package hierarchy. | |
6 | ||
7 | Currently we have org.jdom.contrib packages for beans, helpers, ids, input, | |
8 | output, and schema. "beans" holds JDOMBean and can hold related bean | |
9 | work. "helpers" holds certain helper functions. "ids" demonstrates how to | |
10 | use the attribute type support provided by JDOM to create JDOM documents that | |
11 | allow looking up elements using the value of their ID attribute. "input" and | |
12 | "output" hold builders and outputters. "schema" has code for in-memory | |
13 | schema validation. | |
14 | ||
15 | Some code from contrib (or the equivalent functionality) has been migrated in | |
16 | to the core code, The code has been left in contrib and been marked as | |
17 | 'deprecated', as example code of what can be done. | |
18 | ||
19 | If you have an interesting contribution, or just ideas that someone else might | |
20 | pick up on, post to jdom-interest. |
0 | dependencies { | |
1 | compile project(':core') | |
2 | compile 'junit:junit:4.12' | |
3 | compile 'isorelax:isorelax:20030108' | |
4 | compile 'xerces:xercesImpl:2.11.0' | |
5 | compile 'xalan:xalan:2.7.2' | |
6 | } | |
7 | ||
8 | sourceSets { | |
9 | main { | |
10 | java { | |
11 | srcDir 'src/java' | |
12 | } | |
13 | } | |
14 | } | |
15 |
0 | /*-- | |
1 | ||
2 | Copyright (C) 2000 Brett McLaughlin & Jason Hunter. All rights reserved. | |
3 | ||
4 | Redistribution and use in source and binary forms, with or without modifica- | |
5 | tion, are permitted provided that the following conditions are met: | |
6 | ||
7 | 1. Redistributions of source code must retain the above copyright notice, | |
8 | this list of conditions, and the following disclaimer. | |
9 | ||
10 | 2. Redistributions in binary form must reproduce the above copyright notice, | |
11 | this list of conditions, the disclaimer that follows these conditions, | |
12 | and/or other materials provided with the distribution. | |
13 | ||
14 | 3. The names "JDOM" and "Java Document Object Model" must not be used to | |
15 | endorse or promote products derived from this software without prior | |
16 | written permission. For written permission, please contact | |
17 | license@jdom.org. | |
18 | ||
19 | 4. Products derived from this software may not be called "JDOM", nor may | |
20 | "JDOM" appear in their name, without prior written permission from the | |
21 | JDOM Project Management (pm@jdom.org). | |
22 | ||
23 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |
24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
25 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
26 | JDOM PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
27 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |
29 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |
30 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
32 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | ||
34 | This software consists of voluntary contributions made by many individuals | |
35 | on behalf of the Java Document Object Model Project and was originally | |
36 | created by Brett McLaughlin <brett@jdom.org> and | |
37 | Jason Hunter <jhunter@jdom.org>. For more information on the JDOM | |
38 | Project, please see <http://www.jdom.org/>. | |
39 | ||
40 | */ | |
41 | ||
42 | import java.awt.*; | |
43 | import java.awt.event.*; | |
44 | import java.net.URL; | |
45 | import javax.swing.*; | |
46 | import javax.swing.tree.*; | |
47 | ||
48 | import org.jdom.Document; | |
49 | import org.jdom.input.SAXBuilder; | |
50 | import org.jdom.contrib.output.JTreeOutputter; | |
51 | ||
52 | /** | |
53 | * <p><code>JTreeOutputterDemo</code> demonstrates how to | |
54 | * build a JTree (in Swing) from a JDOM <code>{@link Document}</code>. | |
55 | * </p> | |
56 | * | |
57 | * @author Jon Baer | |
58 | * @author Brett McLaughlin | |
59 | * @version 1.0 | |
60 | */ | |
61 | @SuppressWarnings("javadoc") | |
62 | public class JTreeOutputterDemo implements ActionListener { | |
63 | ||
64 | public JFrame frame; | |
65 | public Document doc; | |
66 | public DefaultMutableTreeNode root; | |
67 | public JTreeOutputter outputter; | |
68 | public JTree tree; | |
69 | public JScrollPane scrollPane; | |
70 | public SAXBuilder saxBuilder; | |
71 | public JMenuItem openFile, openURL, openSQL, exitMenu; | |
72 | public JButton openButton, reloadButton, exitButton, aboutButton; | |
73 | ||
74 | public static void main(String[] args) { | |
75 | new JTreeOutputterDemo(); | |
76 | } | |
77 | ||
78 | public JTreeOutputterDemo() { | |
79 | ||
80 | frame = new JFrame(" JDOM Viewer 1.0"); | |
81 | JMenuBar menuBar = new JMenuBar(); | |
82 | JMenu menu = new JMenu("File"); | |
83 | openFile = new JMenuItem("Open XML File"); | |
84 | openFile.addActionListener(this); | |
85 | openURL = new JMenuItem("Open URL Stream"); | |
86 | openURL.addActionListener(this); | |
87 | openSQL = new JMenuItem("Query Database"); | |
88 | openSQL.addActionListener(this); | |
89 | exitMenu = new JMenuItem("Exit"); | |
90 | exitMenu.addActionListener(this); | |
91 | menu.add(openFile); | |
92 | menu.add(openURL); | |
93 | menu.add(new JSeparator()); | |
94 | menu.add(openSQL); | |
95 | menu.add(new JSeparator()); | |
96 | menu.add(exitMenu); | |
97 | menuBar.add(menu); | |
98 | frame.setJMenuBar(menuBar); | |
99 | ||
100 | openButton = new JButton("Open"); | |
101 | openButton.addActionListener(this); | |
102 | reloadButton = new JButton("Reload"); | |
103 | reloadButton.addActionListener(this); | |
104 | exitButton = new JButton("Exit"); | |
105 | exitButton.addActionListener(this); | |
106 | aboutButton = new JButton("About"); | |
107 | aboutButton.addActionListener(this); | |
108 | JPanel buttonPanel = new JPanel(); | |
109 | buttonPanel.add(openButton); | |
110 | buttonPanel.add(reloadButton); | |
111 | buttonPanel.add(exitButton); | |
112 | buttonPanel.add(aboutButton); | |
113 | ||
114 | root = new DefaultMutableTreeNode("JDOM"); | |
115 | ||
116 | outputter = new JTreeOutputter(true); | |
117 | ||
118 | tree = new JTree(root); | |
119 | ||
120 | saxBuilder = new SAXBuilder(); | |
121 | ||
122 | scrollPane = new JScrollPane(); | |
123 | scrollPane.getViewport().add(tree); | |
124 | ||
125 | frame.setSize(400,400); | |
126 | frame.getContentPane().setLayout(new BorderLayout()); | |
127 | frame.getContentPane().add("Center", scrollPane); | |
128 | frame.getContentPane().add("South", buttonPanel); | |
129 | ||
130 | frame.addWindowListener(new WindowAdapter() { | |
131 | @Override | |
132 | public void windowClosing(WindowEvent evt) { | |
133 | System.exit(0); | |
134 | } | |
135 | }); | |
136 | ||
137 | frame.setVisible(true); | |
138 | ||
139 | } | |
140 | ||
141 | @Override | |
142 | public void actionPerformed(ActionEvent e) { | |
143 | // Open File | |
144 | if (e.getSource() == openButton || e.getSource() == openFile) { | |
145 | doFile(); | |
146 | } | |
147 | // Open URL | |
148 | if (e.getSource() == openURL) { | |
149 | doURL(); | |
150 | } | |
151 | // Query Database | |
152 | if (e.getSource() == openSQL) { | |
153 | doSQL(); | |
154 | } | |
155 | // Exit | |
156 | if (e.getSource() == exitButton || e.getSource() == exitMenu) { | |
157 | System.exit(0); | |
158 | } | |
159 | } | |
160 | ||
161 | public void doFile() { | |
162 | JFileChooser fc = new JFileChooser(); | |
163 | fc.setDialogTitle("Select an XML File"); | |
164 | int returnVal = fc.showDialog(frame, "Load XML"); | |
165 | if (returnVal == 0) { | |
166 | try { | |
167 | doc = saxBuilder.build(fc.getSelectedFile()); | |
168 | } catch (Exception e) {e.printStackTrace();} | |
169 | outputter.output(doc, root); | |
170 | } | |
171 | } | |
172 | ||
173 | public void doURL() { | |
174 | URLDialog urlDialog = new URLDialog(frame); | |
175 | if (urlDialog.getURL() != null) { | |
176 | try { | |
177 | doc = saxBuilder.build(new URL(urlDialog.getURL())); | |
178 | } catch (Exception e) { | |
179 | e.printStackTrace(); | |
180 | } | |
181 | outputter.output(doc, root); | |
182 | } | |
183 | } | |
184 | ||
185 | public void doSQL() { | |
186 | // do nothing | |
187 | } | |
188 | ||
189 | } | |
190 | ||
191 | class URLDialog extends JDialog implements ActionListener { | |
192 | ||
193 | /** | |
194 | * Default. | |
195 | */ | |
196 | private static final long serialVersionUID = 1L; | |
197 | ||
198 | public String url; | |
199 | public JTextField urlField; | |
200 | public JButton okButton, cancelButton; | |
201 | ||
202 | public URLDialog(Frame frame) { | |
203 | super(frame, "Enter A URL", true); | |
204 | urlField = new JTextField("http://"); | |
205 | JPanel buttonPanel = new JPanel(); | |
206 | okButton = new JButton("OK"); | |
207 | okButton.addActionListener(this); | |
208 | cancelButton = new JButton("Cancel"); | |
209 | cancelButton.addActionListener(this); | |
210 | buttonPanel.add(okButton); | |
211 | buttonPanel.add(cancelButton); | |
212 | getContentPane().setLayout(new BorderLayout()); | |
213 | getContentPane().add("North", urlField); | |
214 | getContentPane().add("South", buttonPanel); | |
215 | setSize(400, 150); | |
216 | setVisible(true); | |
217 | } | |
218 | ||
219 | public String getURL() { | |
220 | return this.url; | |
221 | } | |
222 | ||
223 | @Override | |
224 | public void actionPerformed(ActionEvent e) { | |
225 | if (e.getSource() == okButton) { | |
226 | this.url = urlField.getText(); setVisible(false); | |
227 | } | |
228 | if (e.getSource() == cancelButton) { | |
229 | setVisible(false); | |
230 | } | |
231 | } | |
232 | ||
233 | } |
0 | /*-- | |
1 | ||
2 | Copyright 2004 Jason Hunter. All rights reserved. | |
3 | ||
4 | Redistribution and use in source and binary forms, with or without modifica- | |
5 | tion, are permitted provided that the following conditions are met: | |
6 | ||
7 | 1. Redistributions of source code must retain the above copyright notice, | |
8 | this list of conditions, and the following disclaimer. | |
9 | ||
10 | 2. Redistributions in binary form must reproduce the above copyright notice, | |
11 | this list of conditions, the disclaimer that follows these conditions, | |
12 | and/or other materials provided with the distribution. | |
13 | ||
14 | 3. The names "JDOM" and "Java Document Object Model" must not be used to | |
15 | endorse or promote products derived from this software without prior | |
16 | written permission. For written permission, please contact | |
17 | license@jdom.org. | |
18 | ||
19 | 4. Products derived from this software may not be called "JDOM", nor may | |
20 | "JDOM" appear in their name, without prior written permission from the | |
21 | JDOM Project Management (pm@jdom.org). | |
22 | ||
23 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |
24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
25 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
26 | JDOM PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
27 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |
29 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |
30 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
32 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | ||
34 | This software consists of voluntary contributions made by many individuals | |
35 | on behalf of the Java Document Object Model Project and was originally | |
36 | created by Brett McLaughlin <brett@jdom.org> and | |
37 | Jason Hunter <jhunter@jdom.org>. For more information on the JDOM | |
38 | Project, please see <http://www.jdom.org/>. | |
39 | ||
40 | */ | |
41 | ||
42 | import java.io.StringReader; | |
43 | import java.util.Iterator; | |
44 | ||
45 | import org.jdom.Document; | |
46 | import org.jdom.input.SAXBuilder; | |
47 | import org.jdom.filter2.*; | |
48 | ||
49 | import org.jdom.contrib.input.*; | |
50 | ||
51 | /** | |
52 | * @author Per Norrman | |
53 | * | |
54 | */ | |
55 | @SuppressWarnings("javadoc") | |
56 | public class LineNumberSAXBuilderDemo | |
57 | { | |
58 | ||
59 | public static void main(String[] args) throws Exception { | |
60 | SAXBuilder builder = new SAXBuilder(); | |
61 | builder.setSAXHandlerFactory(LineNumberSAXHandler.SAXFACTORY); | |
62 | Document doc = builder.build(new StringReader(xml)); | |
63 | ||
64 | for (Iterator<LineNumberElement> iter = doc.getDescendants(Filters.fclass(LineNumberElement.class)); | |
65 | iter.hasNext(); ) { | |
66 | LineNumberElement e = iter.next(); | |
67 | System.out.println( | |
68 | e.getName() + ": lines " + e.getStartLine() + " to " + e.getEndLine()); | |
69 | } | |
70 | ||
71 | } | |
72 | ||
73 | private static String xml = | |
74 | "<a>\n<b/>\n<c/>\n<d>\n<e/>\n<f/>\n</d>\n</a>\n"; | |
75 | ||
76 | } |
0 | /*-- | |
1 | ||
2 | Copyright 2000 Brett McLaughlin & Jason Hunter. All rights reserved. | |
3 | ||
4 | Redistribution and use in source and binary forms, with or without modifica- | |
5 | tion, are permitted provided that the following conditions are met: | |
6 | ||
7 | 1. Redistributions of source code must retain the above copyright notice, | |
8 | this list of conditions, and the following disclaimer. | |
9 | ||
10 | 2. Redistributions in binary form must reproduce the above copyright notice, | |
11 | this list of conditions, the disclaimer that follows these conditions, | |
12 | and/or other materials provided with the distribution. | |
13 | ||
14 | 3. The names "JDOM" and "Java Document Object Model" must not be used to | |
15 | endorse or promote products derived from this software without prior | |
16 | written permission. For written permission, please contact | |
17 | license@jdom.org. | |
18 | ||
19 | 4. Products derived from this software may not be called "JDOM", nor may | |
20 | "JDOM" appear in their name, without prior written permission from the | |
21 | JDOM Project Management (pm@jdom.org). | |
22 | ||
23 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |
24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
25 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
26 | JDOM PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
27 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |
29 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |
30 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
32 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | ||
34 | This software consists of voluntary contributions made by many individuals | |
35 | on behalf of the Java Document Object Model Project and was originally | |
36 | created by Brett McLaughlin <brett@jdom.org> and | |
37 | Jason Hunter <jhunter@jdom.org>. For more information on the JDOM | |
38 | Project, please see <http://www.jdom.org/>. | |
39 | ||
40 | */ | |
41 | ||
42 | import java.sql.*; | |
43 | ||
44 | import org.jdom.*; | |
45 | import org.jdom.output.*; | |
46 | ||
47 | import org.jdom.contrib.input.ResultSetBuilder; | |
48 | ||
49 | @SuppressWarnings("javadoc") | |
50 | public class ResultSetBuilderDemo { | |
51 | ||
52 | // SQL tables copied from the Servlets.com ISP listing application | |
53 | ||
54 | static final String PREP = | |
55 | "create table rsbd ( " + | |
56 | "id int PRIMARY KEY, " + | |
57 | "name varchar(255) NOT NULL, " + | |
58 | "home_url varchar(255) NULL, " + | |
59 | "contact_email varchar(255) NULL, " + | |
60 | "contact_phone varchar(255) NULL, " + | |
61 | "location varchar(255) NULL, " + | |
62 | "comments long varchar NULL, " + | |
63 | "free_hosting boolean NULL, " + | |
64 | "state_flag tinyint NOT NULL, " + // submitted, rejected, live, dead | |
65 | "submitter_email varchar(255) NULL, " + // not displayed | |
66 | "created_time timestamp NOT NULL, " + | |
67 | "modified_time timestamp NOT NULL " + | |
68 | ")"; | |
69 | ||
70 | static final String FILL = | |
71 | "insert into rsbd (id, name, home_url, contact_email, " + | |
72 | "contact_phone, comments, free_hosting, state_flag, created_time, " + | |
73 | "modified_time) values (2, 'sphere', null, 'info@sphere', " + | |
74 | "'1234', 'cool', true, 10, " + | |
75 | "{ts '1999-02-09 20:11:11.123455'}, " + | |
76 | "{ts '1999-03-21 22:11:11.123455'})"; | |
77 | ||
78 | public static void main(String[] args) throws Exception { | |
79 | // Tested against Cloudscape database that comes with the J2EE ref impl | |
80 | Class.forName("COM.cloudscape.core.JDBCDriver"); | |
81 | Connection con = | |
82 | DriverManager.getConnection("jdbc:cloudscape:rsbd;create=true"); | |
83 | ||
84 | // Create and fill commands, needed only on the first run | |
85 | Statement prep = con.createStatement(); | |
86 | prep.executeUpdate(PREP); | |
87 | ||
88 | Statement fill = con.createStatement(); | |
89 | fill.executeUpdate(FILL); | |
90 | ||
91 | Statement stmt = con.createStatement(); | |
92 | ResultSet rs = stmt.executeQuery( |