summaryrefslogtreecommitdiff
path: root/xml
AgeCommit message (Collapse)Author
2019-09-23Add TEST_MAPPINGs for XML-related libcore packages.Pete Gillin
Test: treehugger Bug: 130283485 Change-Id: I7d80c283e086fe5c49b9663760c8929b340b3a1d
2019-05-22XmlPullParser docs: getColumnNumber() is 1-based.Tobias Thierer
All docs that I could find claim that it is 0-based, but: * The implementation is 1-based. * xmlpull.org appears unmaintained since ~ 2004 and has no update. * PullParserTest (and thus its implementation KxmlPullParserTest) enforces 1-based counting. * getLineNumber()'s documentation and implementation is also 1-based. On balance, this suggests that the documentation around this method being 0-based is wrong. This CL fixes it. Note that the documentation also contains a statement about cases where the methods return -1, but the implementation doesn't seem to ever return a value < 1. The case of -1 also doesn't seem to be covered by tests. This CL does not touch that part of the documentation. Fixes: 133248153 Test: atest CtsLibcoreTestCases:libcore.xml.KxmlPullParserTest Change-Id: I8a15cd6686083552c3e52434966a4f56a2d9a87b
2018-07-11Rename org.kxml2 code to com.android.org.kxml2Neil Fuller
org.kxml2 code is heavily modified in Android so renaming it to a reserved package name will not make it less maintainable. This rename should also flush out users who are depending on the parser package name. Bug: 111055375 Test: build Change-Id: Idfe871ef7b24fd60d706b932ff2dc52eb9fbf4b6
2017-03-06Automated: Canonicalize spelling of Android-changed across libcoreTobias Thierer
This applies the same regexp replacement across libcore that http://r.android.com/345826 had only applied to ojluni. Most of the previous noncanonical spellings were a lowercased "android-" that should be "Android-". This CL was created by running the following command on top of the above CL. No manual changes were made. find . -name \*\.java | xargs sed -i \ -e 's/Android[- ]changed/Android-changed/ig' \ -e 's/Android-changed :/Android-changed:/g' \ -e 's/Android-changed \(BEGIN\|END\)/\1 Android-changed/g' \ -e 's/Android-changed - /Android-changed: /g' \ -e 's/Android[- ]removed/Android-removed/ig' \ -e 's/Android-removed :/Android-removed:/g' \ -e 's/Android-removed \(BEGIN\|END\)/\1 Android-removed/g' \ -e 's/Android-removed - /Android-removed: /g' \ -e 's/Android[- ]added/Android-added/ig' \ -e 's/Android-added :/Android-added:/g' \ -e 's/Android-added \(BEGIN\|END\)/\1 Android-added/g' \ -e 's/Android-added - /Android-added: /g' \ -e 's/----- \(BEGIN\|END\) android\( -----\)\?/\1 Android-changed/g' \ -e 's/\/\* \(BEGIN\|END\) Android-changed \*\//\/\/ \1 Android-changed/g' Bug: 35841464 Test: make droid cts Change-Id: I060c7236b7607763e5d27d60aa395d2507703a95
2015-10-28Fix @link references to classes not in the public APINeil Fuller
Bug: https://code.google.com/p/android/issues/detail?id=191303 Change-Id: I4f2f2cb7b1f4425a14696f3717ea5f9dcb59be04
2015-08-27Fix PullParser reuse regressionNeil Fuller
Commit 0424d12f9b8a19c4a451282bc8ae974f6109424d introduced a regression: calling setInput() would not fully reset the parser iff the parser had already parsed a <!DOCTYPE tag. This change contains a fix and a test. Thanks to mike@ for the report. Bug: https://code.google.com/p/android/issues/detail?id=182605 Change-Id: Icddc1c52bca3beaba7f5ee662d18757d6fce6cf2
2015-07-06Fix typo in javadoc.Narayan Kamath
"mus" -> "must" bug: https://code.google.com/p/android/issues/detail?id=178755 Change-Id: Ie418de27cc664597cc54f7c2a4395621bea0dc60
2015-05-06Handle whitespaces after DOCTYPE elementWojciech Staszkiewicz
This change fixes a bug where a whitespace after DOCTYPE element in a file would cause the file to be unparsable. It also adds a regresion test. bug: https://code.google.com/p/android/issues/detail?id=171828 Change-Id: I1036b17833c12bc275c058b835fb8f02665edfae
2015-04-29Add buffering to KXmlSerializerWojciech Staszkiewicz
This CL adds buffering to KXmlSerializer. The idea is borrowed from FastXmlSerializer and speeds up serializing ~2 times. A benchmark demonstrating the performance gains is added as well. Full test results on nexus 5, hammerhead-userdebug build (old result -> new result): testcase 1: 3.73ms -> 2.08ms (44% gain) testcase 2: 6ms -> 3.30ms (45% gain) testcase 3: 89.66ms -> 42.17ms (52% gain) testcase 4: 81.03ms -> 39.05ms (51% gain) Bug: 19265797 Change-Id: Ic573cb175b126ab1593eb0a991dc0599120ae745
2014-10-18Improve support for non-BMP characters in XML.Elliott Hughes
This adds support for writing surrogate pairs out as entity references in KXmlSerializer and for parsing non-BMP entity references in DocumentBuilderImpl. Emoji and XML. Two of my least favorite things together at last. Bug: 17960630 Change-Id: If5e1001faf250e87e6eeebe3449a6ebc115789a1
2014-04-23Fix typo.Elliott Hughes
Bug: https://code.google.com/p/android/issues/detail?id=68924 Change-Id: If687c3b02ae630097d5e4b9603acec19732a7dcc
2014-02-13Fix compatibility issues in XmlPullParserFactory.Narayan Kamath
- We should set features on a parser only if the feature value is true. I.e, we guarantee that we'll never call XmlPullParser.setFeature(..., false). - In change 0363556bad8930a, we didn't consider the fact that apps could extend XmlPullParserFactory and modify protected fields to change the parser / serializer that's instantiated. I've reinstated this feature, despite the fact that it's a particularly pointless feature on a more-or-less pointless public API. Apps can and should instantiate their own parser instances directly instead of going through this factory. bug: 12956724 Change-Id: I793eba335b5385eb641e023b3613bba4515a85bf
2013-12-11Fix a javadoc typo.Elliott Hughes
Bug: https://code.google.com/p/android/issues/detail?id=62919 Change-Id: Iadb85c25ec7e07ee245b009f5fb848c8228924a1
2013-10-18Fix build.Narayan Kamath
Bring back fields that were never used but are public APIs. Change-Id: I81d312f53745c03da450f599070ae0f5ddd5a81a
2013-10-17Simplify code in XmlPullParserFactory.Narayan Kamath
Since we're hard coding KXmlParser and KXmlSerializer anyway, we might as well do it more directly. Also add a trivial unit test for this method. NOTE: This change preserves existing behaviour and doesn't throw from #newInstance if the parser class couldn't be found or instantiated. We instead throw from newPullParser or newSerializer as appropriate. Change-Id: Ic0c86e67691b8e662d95363bbe597d3abb7c3642
2013-10-16Get stricter about DOCTYPEs.Narayan Kamath
Allow them only before we've started parsing any XML elements. bug: 3452274 Change-Id: I7b146e4dae8c7aa23a0a227538ec02604f828400
2013-06-28Fix unexpected EOF handling by KXmlParser.Vladimir Marko
Avoid read position slipping beyond limit on EOF, causing an ArrayIndexOutOfBoundsException. Also fix two incorrect checks whether to read more data. Bug: 9012715 Change-Id: I40f60becd97eb4d9f33842bea2c19e9dc531d3b7
2012-12-04Add detail messages to all the easy IllegalArgumentException cases.Elliott Hughes
Noticed during my recent Matcher change. Change-Id: I415d911b26d0ee548ca04d56bba7fc3d4e6b3f88
2012-09-20Remove obsolete ThirdPartyProject.prop files.Elliott Hughes
Change-Id: I5288c5c1f6ce094bcac2792f6fa7fc6a455f756a
2012-08-01Add a test for KxmlSerializer attributes with whitespace chars.Jesse Wilson
Delete some unused Kxml classes while I'm in the area, and combine our two classes named KXmlSerializerTest. (cherry-pick of 22a12704190060f74e308a5b5aa32d0b7f715183.) Change-Id: Id8b3f72edc58547e49ad86c51a171dce3669be3f
2012-05-10Use weasel words to cover changed behavior around END_DOCUMENT.Jesse Wilson
We used to have 2 different implementations of XmlPullParser and each of them behaved differently if you called next() after receiving the END_DOCUMENT token: - Parsers returned from XmlPullParserFactory didn't throw - Parsers returned from android.util.Xml did throw When we went to a single implementation the behavior changed for android.util.Xml users. Unfortunately the change went from being consistent-with-the-docs to not. Rather than changing the behavior I'm being a weasel and changing the docs! That way we aren't promising something we cannot deliver. Bug: http://code.google.com/p/android/issues/detail?id=29931 Change-Id: I0e72e79270b92ecc0fdb5bf64c97fa50d2bdb81c
2012-04-18Fix a minor documentation bug in XmlPullParser.Elliott Hughes
Bug: http://code.google.com/p/android/issues/detail?id=29028 Change-Id: I25464730869499369fb7ec8e282ba5c67ebe909f
2011-11-11Warn about a fixed bug in XmlPullParser.nextText()Jesse Wilson
Bug: http://code.google.com/p/android/issues/detail?id=21425 Change-Id: I4c69d67bb8bfdf3f78359d800860d5dc2e2e349f
2011-05-17am 5d284194: am a0376753: am 6ce8e6ee: Skip BOM characters even with an ↵Jesse Wilson
explicit charset. * commit '5d28419405d27a906426bb2a5a56a8ccdc2b38af': Skip BOM characters even with an explicit charset.
2011-05-16Skip BOM characters even with an explicit charset.Jesse Wilson
Change-Id: I697448528324cd68196d00ebf82ee8eecb72148d http://code.google.com/p/android/issues/detail?id=16892
2011-02-28Remove all the remaining AllTests cruft.Elliott Hughes
Change-Id: Ie61022069e597d9c5c6e7ea4659fd614efe31852
2011-02-24Fix more FindBugs warnings: DM_BOOLEAN_CTOR.Elliott Hughes
"Creating new instances of java.lang.Boolean wastes memory." Change-Id: I954ea1497e924ae9008fe4e47762008f1d1c8561
2011-02-22Remove most of our remaining non-API StringBuffer usage.Elliott Hughes
Change-Id: Ia2c621d8a9dfe04cd55aac652d1ac9ea4398afd1
2011-02-17Fix various FindBugs warnings.Elliott Hughes
Only the ChunkHandler and ZoneInfo ones were real bugs. The former is only called with one input value that doesn't exercise the bug, and the latter would cause us to think that a time zone that stopped using daylight time before 1970 was still using daylight time (which would defeat various optimizations, but should otherwise be harmless). The other stuff is trivia not worth individual changes. Change-Id: Ib0752560cd16edc6538d1fc2b234451a66d48171
2011-02-14Merge commit '995a3842' into manualmergeJesse Wilson
Conflicts: expectations/knownfailures.txt Change-Id: Iee137d2c0c5e8bfa6994258f5fab8e07caeb86e1
2011-02-14Fail parsing if there's text outside the document element.Jesse Wilson
We have a similar bug for misplaced DTDs. This is tested but not fixed by this change. Change-Id: I8e06ec9197cb8c4135212056ab791c254c9dcc3d http://b/3452274
2011-01-13Most callers of toLowerCase/toUpperCase should pass Locale.US to avoid ↵Elliott Hughes
problems in Turkey. Some callers should be replaced with equalsIgnoreCase instead. The one exception is StreamTokenizer, where the RI uses the default locale, which is arguably the right thing to do. No-one cares because that's legacy API, but I've added a test anyway. I've left HttpCookie and GeneralName for my co-conspirators because the appropriate resolutions aren't as obvious there... Bug: 3325637 Change-Id: Ia37a1caaa91b11763ae43e61e445adb45c30f793
2010-12-20Capture the DTD body while it is being parsed.Jesse Wilson
Change-Id: Ibef02ca759eb56a00f0f72f4063d129ef5350d21 http://b/3241492
2010-12-08Fix a bunch of javac -Xlint warnings in our code.Elliott Hughes
I think "fallthrough" uncovered a couple of real bugs in the kxml code, but other than that there's nothing very exciting here. This addresses all but one of the non-xml warnings. I'm assuming that we'll move the xml cruft out into external at some point (since we're deliberately not maintaining it). Change-Id: Ice81253b019df7b19d6557e719663b7bdc11fb22
2010-11-30The last of the Kxml correctness fixes for Expat compatibility.Jesse Wilson
With this change we should be able to drop the Expat pull parser and use Kxml exclusively. I'm deferring that change until after the current release. Change-Id: I7c6d6dfe6c1e9ae9417c48603068ddd4ade78b76 http://b/3090550
2010-11-29Fix XML DOM test failures and close guard warnings.Jesse Wilson
Fix KxmlParser to capture the DTD's root element name, system ID and public ID. This is more robust than capturing the same in the pull-to-DOM adapter. Fix close guard warnings in XML tests. Close input streams of resource files. Don't catch exceptions only to call fail(). http://b/3090550 Change-Id: I7cfafde58cc28af79c48386a4d124803c8791328
2010-11-28Resolve entity values recursively and support default attributes.Jesse Wilson
Change-Id: Ib32040e0ebe8ef52e8d382fb65ab4d08779901b7 http://b/3090550
2010-11-23Implement DTD parsing in KxmlParser.Jesse Wilson
This change still has some problems: - default attribute values are not honored. - the doctype token text is lost - entity values are not reparsed - use of parameter entities is ignored but should cause a failure Change-Id: Idd543846840aea481730e690e63212164555cdf1 http://b/3090550
2010-11-20Change KxmlParser.next() to use one while loop instead of two.Jesse Wilson
This cleans up some of the structural problems with the KxmlParser code. It was unclear how different text tokens (text, CDATA and entity tokens) were concatenated in next() but not nextToken(). This moves the token loop from the next() method into the nextImpl() method, saving redundant calls to peekNext(). The code also had an instance field 'token' that was only well-defined during calls to next() and nextToken(). I've removed this field and passed parameters instead. This fixes some implementation bugs: - empty CDATA blocks aren't reported - empty entities aren't reported - double dash in comments are forbidden in strict mode <!-- -- --> Change-Id: I8c17b61d63e84622556f3751dbf8af282c601d09 http://b/3090550
2010-11-19Fix problems with entity references and relaxed namespaces.Jesse Wilson
Change-Id: I5c19ad97c98e6276129ed7228cc38d414b9517db http://b/3090550
2010-11-17Merge "Fix a typo in the XmlPullParser example." into dalvik-devJesse Wilson
2010-11-16Add interning to KxmlPullParser.Jesse Wilson
Adding just a small interning pool improves performance even further. Combined with the first round of optimizations, total improvement for three large files is 51% 56% and 42%. Performance on a small file improved 3%. When interning is checked in, Kxml will be significantly faster than Expat's pull parser for everything but very small files. /sdcard/xml/com.amazon.mp3.meta /sdcard/xml/com.cooliris.picasa /sdcard/xml/com.rhapsody.Deauth /sdcard/xml/com.snoggdoggler.r benchmark run us linear runtime % us linear runtime % us linear runtime % us linear runtime % Dom baseline / master 210,256 ============================== 184% 53,227 ============================== 171% 2,183 ============================== 151% 164,708 ============================= 200% Dom first optimizations 174,580 ======================== 153% 40,964 ======================= 132% 1,968 =========================== 136% 130,814 ======================= 159% Dom new interning 163,366 ======================= 143% 35,736 ==================== 115% 2,116 ============================= 147% 121,870 ====================== 148% ExpatPull baseline / master 130,078 ================== 114% 21,700 ============ 70% 759 ========== 53% 85,578 =============== 104% ExpatPull first optimizations 129,776 ================== 114% 21,621 ============ 70% 734 ========== 51% 86,799 =============== 105% ExpatPull new interning 130,971 ================== 115% 21,627 ============ 70% 723 ========= 50% 86,555 =============== 105% KxmlPull baseline / master 114,317 ================ 100% 31,040 ================= 100% 1,443 =================== 100% 82,478 =============== 100% KxmlPull first optimizations 88,716 ============ 78% 20,578 =========== 66% 1,560 ===================== 108% 58,567 ========== 71% KxmlPull new interning 55,773 ======= 49% 13,692 ======= 44% 1,394 =================== 97% 48,068 ======== 58% http://b/3090550 Change-Id: I4515546abbbcf940de7be22f26925c4334e59146
2010-11-14Fix a typo in the XmlPullParser example.Jesse Wilson
Originally reported here: http://groups.google.com/group/android-platform/browse_thread/thread/6020aee5f01f21df/afac4ce1a0184788?show_docid=afac4ce1a0184788 Change-Id: I378a441117fdf41e74d91ba8fef8ac9abf5a5275
2010-11-12Optimize KxmlParser.Jesse Wilson
I benchmarked this on four files: size file 268 rhapsody authorization 29489 picasa sync (for gallery) 101129 amazon mp3 search results 103855 RSS feed The performance regressed for the 268-byte file from 1.44ms to 1.56ms. Small files are important and I intend to follow-up to bring this back into line. For the other files, the improvements for pull parsing were 22%, 34% and 29%. Improvements for DOM parsing were 17%, 23% and 21%. All but the 268-byte document now parse faster with Kxml than with Expat. 101129 byte amazon mp3 search results 29489 byte picasa sync dat 268 byte rhapsody authentication 103855 byte RSS feed benchmark run us linear runtime us linear runtime us linear runtime us linear runtime Dom ready to commit 174,580 ======================== 40,964 ======================= 1,968 =========================== 130,814 ======================= Dom baseline 210,256 ============================== 53,227 ============================== 2,183 ============================== 164,708 ============================= ExpatPull ready to commit 129,776 ================== 21,621 ============ 734 ========== 86,799 =============== ExpatPull baseline 130,078 ================== 21,700 ============ 759 ========== 85,578 =============== KxmlPull ready to commit 88,716 ============ 20,578 =========== 1,560 ===================== 58,567 ========== KxmlPull baseline 114,317 ================ 31,040 ================= 1,443 =================== 82,478 =============== Change-Id: I98b7f979c2f926e25c72541bf9f5036f097e8d91 http://b/3090550
2010-11-04Style cleanup of some XML code.Jesse Wilson
Motivation: in preparation to refactor the Kxml code I'd like to bring this code to a style consistent with the rest of Android. This code style currently disagrees with my toolchain. Change-Id: Ibd24570c131e792532e46f7f44c64abac3a6979a http://b/3090550
2010-07-16am 3d667044: am 16b704e4: add meta-files about 3rd party projectsThe Android Open Source Project
Merge commit '3d66704483f1b8ea8b6eea1939f02508c551fd62' * commit '3d66704483f1b8ea8b6eea1939f02508c551fd62': add meta-files about 3rd party projects
2010-07-16add meta-files about 3rd party projectsThe Android Open Source Project
Change-Id: Ib22265632a3be569eeab0320021365b2d80a805e
2010-05-27Delete duplicate test files for JDK 1.6 compatibility.Jake Hamby
JDK 1.6's jar utility fails with a "duplicate entry" error due to identical test files in multiple locations. This change fixes the build on JDK 1.6 by deleting the extra copies of the test files. Change-Id: Iad27b9a345e7b455c1576989e948088fe00e1116
2010-05-24Remove the luni localized exception messages.Elliott Hughes
Also fix a bug I introduced in KXmlSerializer: s.isEmpty() is not equivalent to "".equals(s) if s is allowed to be null. Bug: 1251121 Change-Id: I41a0a98ffb49f214041c9110f824d327af5c34e8
2010-05-21Remove more localized exception messages.Elliott Hughes
I also accidentally mixed two unrelated changes in here: replacing "".equals and equals("") with String.isEmpty, and removing some dead code in org.apache.harmony.luni.util.Util. Change-Id: I0aaad43290b083085b3095b624caf096de487223