summaryrefslogtreecommitdiffstats
path: root/xml/src/main/java
Commit message (Collapse)AuthorAgeFilesLines
* Improve support for non-BMP characters in XML.Elliott Hughes2014-10-181-15/+38
| | | | | | | | | | | 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
* Fix typo.Elliott Hughes2014-04-231-1/+1
| | | | | Bug: https://code.google.com/p/android/issues/detail?id=68924 Change-Id: If687c3b02ae630097d5e4b9603acec19732a7dcc
* Fix compatibility issues in XmlPullParserFactory.Narayan Kamath2014-02-131-27/+86
| | | | | | | | | | | | | | | | | | | - 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
* Fix a javadoc typo.Elliott Hughes2013-12-111-2/+2
| | | | | Bug: https://code.google.com/p/android/issues/detail?id=62919 Change-Id: Iadb85c25ec7e07ee245b009f5fb848c8228924a1
* Fix build.Narayan Kamath2013-10-181-2/+12
| | | | | | Bring back fields that were never used but are public APIs. Change-Id: I81d312f53745c03da450f599070ae0f5ddd5a81a
* Simplify code in XmlPullParserFactory.Narayan Kamath2013-10-171-202/+25
| | | | | | | | | | | | | | 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
* Get stricter about DOCTYPEs.Narayan Kamath2013-10-161-0/+9
| | | | | | | | Allow them only before we've started parsing any XML elements. bug: 3452274 Change-Id: I7b146e4dae8c7aa23a0a227538ec02604f828400
* Fix unexpected EOF handling by KXmlParser.Vladimir Marko2013-06-281-5/+15
| | | | | | | | | | 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
* Add detail messages to all the easy IllegalArgumentException cases.Elliott Hughes2012-12-042-2/+2
| | | | | | Noticed during my recent Matcher change. Change-Id: I415d911b26d0ee548ca04d56bba7fc3d4e6b3f88
* Remove obsolete ThirdPartyProject.prop files.Elliott Hughes2012-09-202-18/+0
| | | | Change-Id: I5288c5c1f6ce094bcac2792f6fa7fc6a455f756a
* Add a test for KxmlSerializer attributes with whitespace chars.Jesse Wilson2012-08-014-839/+0
| | | | | | | | | 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
* Use weasel words to cover changed behavior around END_DOCUMENT.Jesse Wilson2012-05-101-2/+2
| | | | | | | | | | | | | | | | | 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
* Fix a minor documentation bug in XmlPullParser.Elliott Hughes2012-04-181-0/+1
| | | | | Bug: http://code.google.com/p/android/issues/detail?id=29028 Change-Id: I25464730869499369fb7ec8e282ba5c67ebe909f
* Warn about a fixed bug in XmlPullParser.nextText()Jesse Wilson2011-11-111-1/+10
| | | | | Bug: http://code.google.com/p/android/issues/detail?id=21425 Change-Id: I4c69d67bb8bfdf3f78359d800860d5dc2e2e349f
* am 5d284194: am a0376753: am 6ce8e6ee: Skip BOM characters even with an ↵Jesse Wilson2011-05-171-80/+89
|\ | | | | | | | | | | | | explicit charset. * commit '5d28419405d27a906426bb2a5a56a8ccdc2b38af': Skip BOM characters even with an explicit charset.
| * Skip BOM characters even with an explicit charset.Jesse Wilson2011-05-161-80/+89
| | | | | | | | | | Change-Id: I697448528324cd68196d00ebf82ee8eecb72148d http://code.google.com/p/android/issues/detail?id=16892
* | Fix more FindBugs warnings: DM_BOOLEAN_CTOR.Elliott Hughes2011-02-241-6/+4
| | | | | | | | | | | | "Creating new instances of java.lang.Boolean wastes memory." Change-Id: I954ea1497e924ae9008fe4e47762008f1d1c8561
* | Remove most of our remaining non-API StringBuffer usage.Elliott Hughes2011-02-222-4/+4
| | | | | | | | Change-Id: Ia2c621d8a9dfe04cd55aac652d1ac9ea4398afd1
* | Fix various FindBugs warnings.Elliott Hughes2011-02-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge commit '995a3842' into manualmergeJesse Wilson2011-02-141-1/+4
|\ \ | |/ | | | | | | | | | | Conflicts: expectations/knownfailures.txt Change-Id: Iee137d2c0c5e8bfa6994258f5fab8e07caeb86e1
| * Fail parsing if there's text outside the document element.Jesse Wilson2011-02-141-1/+4
| | | | | | | | | | | | | | | | We have a similar bug for misplaced DTDs. This is tested but not fixed by this change. Change-Id: I8e06ec9197cb8c4135212056ab791c254c9dcc3d http://b/3452274
* | Most callers of toLowerCase/toUpperCase should pass Locale.US to avoid ↵Elliott Hughes2011-01-131-7/+6
|/ | | | | | | | | | | | | | | | 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
* Capture the DTD body while it is being parsed.Jesse Wilson2010-12-201-12/+36
| | | | | Change-Id: Ibef02ca759eb56a00f0f72f4063d129ef5350d21 http://b/3241492
* Fix a bunch of javac -Xlint warnings in our code.Elliott Hughes2010-12-082-13/+7
| | | | | | | | | 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
* The last of the Kxml correctness fixes for Expat compatibility.Jesse Wilson2010-11-301-9/+33
| | | | | | | | | 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
* Fix XML DOM test failures and close guard warnings.Jesse Wilson2010-11-291-28/+77
| | | | | | | | | | | | 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
* Resolve entity values recursively and support default attributes.Jesse Wilson2010-11-281-55/+214
| | | | | Change-Id: Ib32040e0ebe8ef52e8d382fb65ab4d08779901b7 http://b/3090550
* Implement DTD parsing in KxmlParser.Jesse Wilson2010-11-231-72/+406
| | | | | | | | | | | 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
* Change KxmlParser.next() to use one while loop instead of two.Jesse Wilson2010-11-201-121/+137
| | | | | | | | | | | | | | | | | | | | 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
* Fix problems with entity references and relaxed namespaces.Jesse Wilson2010-11-191-29/+29
| | | | | Change-Id: I5c19ad97c98e6276129ed7228cc38d414b9517db http://b/3090550
* Merge "Fix a typo in the XmlPullParser example." into dalvik-devJesse Wilson2010-11-171-1/+1
|\
| * Fix a typo in the XmlPullParser example.Jesse Wilson2010-11-141-1/+1
| | | | | | | | | | | | | | Originally reported here: http://groups.google.com/group/android-platform/browse_thread/thread/6020aee5f01f21df/afac4ce1a0184788?show_docid=afac4ce1a0184788 Change-Id: I378a441117fdf41e74d91ba8fef8ac9abf5a5275
* | Add interning to KxmlPullParser.Jesse Wilson2010-11-161-4/+7
|/ | | | | | | | | | | | | | | | | | | | | | | 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
* Optimize KxmlParser.Jesse Wilson2010-11-122-523/+664
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Style cleanup of some XML code.Jesse Wilson2010-11-042-449/+353
| | | | | | | | | 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
* am 3d667044: am 16b704e4: add meta-files about 3rd party projectsThe Android Open Source Project2010-07-163-0/+27
|\ | | | | | | | | | | | | Merge commit '3d66704483f1b8ea8b6eea1939f02508c551fd62' * commit '3d66704483f1b8ea8b6eea1939f02508c551fd62': add meta-files about 3rd party projects
| * add meta-files about 3rd party projectsThe Android Open Source Project2010-07-163-0/+27
| | | | | | | | Change-Id: Ib22265632a3be569eeab0320021365b2d80a805e
* | Remove the luni localized exception messages.Elliott Hughes2010-05-241-1/+1
| | | | | | | | | | | | | | | | 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
* | Remove more localized exception messages.Elliott Hughes2010-05-212-14/+12
| | | | | | | | | | | | | | | | 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
* | Remove all trailing whitespace from the dalvik team-maintained parts of libcore.Elliott Hughes2010-05-137-125/+125
| | | | | | | | | | | | Gentlemen, you may now set your editors to "strip trailing whitespace"... Change-Id: I85b2f6c80e5fbef1af6cab11789790b078c11b1b
* | Convert tabs to spaces.Elliott Hughes2010-05-131-61/+55
| | | | | | | | Change-Id: I16cfbd2faac6b565b78b5dd97e2345323a36f652
* | Merge awt-kernel, icu, luni-kernel, prefs, security-kernel, x-net into luniPeter Hallam2010-05-04685-215652/+0
| | | | | | | | Merge xml except xmlpull and kxml into luni
* | Fixing reset() on SAXParser and DocumentBuilder, and cleaning up nearby tests.Jesse Wilson2010-04-204-18/+40
| | | | | | | | | | | | Also fixing vogar to support a directory of test expectations, so we can group them by file rather than colocating failures we want to fix with those that we don't.
* | Remove explicit 8192 arguments to BufferedReader and friends.Elliott Hughes2010-03-231-4/+1
| | | | | | | | | | | | | | | | | | | | | | These were clearly added just to shut up our own warning, and are now unnecessary and misleading to future maintainers. There's one barely-related change: InputStreamReader and OutputStreamWriter are very similar, and this patch makes them more similar, and adds a few missing modifiers from their fields. Change-Id: I959011f914ff215e92bbfa41c1bac66465803685
* | Remove all remaining "@since Android" tags.Elliott Hughes2010-03-225-12/+3
|/ | | | | | | I've fixed a few typos, and removed a few of the more egregiously nonsensical or incorrect comments that were nearby. Change-Id: I35851baebd532f949cc269f4738a26eeb9b6e697
* Fixing namespace+prefix mode in Expat and removing optional fields from ↵Jesse Wilson2010-03-191-1/+1
| | | | | | | | | | | | | | | | | | | callbacks. The first part is related to bug 6632: http://code.google.com/p/android/issues/detail?id=6632 I added these optional fields back when I was originally updating the XML parser for Froyo. I've decided to remove them to simplify migrating between Android and the RI. It should also save some object allocations. Note that the RI v5 and the RI v6 behave differently for optional values on attributes; this motivated me to add the otherwise unfortunate assertOneOf() method to the testcase. (We behave more like RI v6, which is to supply the values upon request) Change-Id: Icfa5d29976a86bf194b3ed7c0d9e2275c3bff9dd
* Fixing 10 of the XPath failures caused by a malformed Document.Jesse Wilson2010-03-171-4/+4
| | | | | | | | | See bug 2518858. This makes our XPath implementation fail the exact same tests as the RI's. (which we assume is also based on Apache Xalan) Change-Id: I9a98323113c95609651e948ad11113f84ccd87ec
* Implementing Document.renameNode() and DOMImplementation.getFeature().Jesse Wilson2010-03-155-69/+75
| | | | | | | The rename code required moving some behaviour from ElementImpl and AttrImpl up to their common superclass, NodeImpl. Change-Id: I30910de146f525a5ecc837895ce5808928b858a0
* Adding support for DOM3 attribute IDs and SchemaTypeInfos.Jesse Wilson2010-03-113-12/+56
| | | | Change-Id: I35e56ed989820df6b8fea36bbf81fe0314c76304
* Implementing getBaseUri() for DOM.Jesse Wilson2010-03-111-29/+80
| | | | | | | | The tests for this uncover problems with the RI's implementation. It does bizarre things with hashes, trashing the absolute URI and returning a page-relative one (like "#foo"). Change-Id: Ib8af163a7b359e3f72a9c94eb3dd7e81e3a9a95c