summaryrefslogtreecommitdiffstats
path: root/xml/src/main/java
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Implement adoptNode() and importNode().Jesse Wilson2010-03-093-127/+213
| | | | | | | | | | | | | | importNode() shares all of its implementation with Node.clone(); the only areas they differ are the ones we don't support. The shared code is in 2 new methods, shallowCopy() and cloneOrImportNode(), both based on the old clone() method. Also removing some unnecessary "throws DOMException" clauses. The tests for the new methods are slightly cumbersome. Most move/copy nodes to another document, serialize that, and compare. Change-Id: Id9fb076e020d8327a8f70da401af9bd95d7a3d1b
* Adding support for getUserData() and setUserData() to DOM nodes.Jesse Wilson2010-03-089-27/+110
| | | | | | Also making sure both Document and DocumentType get assigned a Document value when possible; this is necessary to store the user data objects.
* Implementing almost all of Document.normalizeDocument().Jesse Wilson2010-03-019-33/+217
| | | | | | | | | | | This follows the rules specified by DOMConfiguration. In particular: - replacing CDATA nodes with text - splitting CDATA nodes - merging text nodes - stripping comments - detecting invalid characters I haven't added the normalization code for XML validation or namespaces.
* New implementation for DOMConfiguration.Jesse Wilson2010-03-013-20/+402
| | | | | | | | | | | | | | | | | | | | | | This API is disgusting. Its not regular, not typesafe, sparsely implemented and overly specific. I'm implementing the minimum I can get away with - exactly the same route taken by the RI. The Parameter stuff feels a little bit like overkill, but it allowed me to group related chunks of code together and avoid long chains of equalsIgnoreCase if statements. This is necessary to implement Document.normalize(), one of the last remaining APIs in DOMv3. Also fixing our implementation of Node.normalize() and adding tests to discover a bug in that code. Previously a document like this: "<foo>abc<br>def</foo>" Would be normalized to this: "<foo>abcdef<br></foo>" Which is a horrible bug! Yuck. Implementation and tests for Document.normalize() are forthcoming.
* Adding tests to parse document attributes from the DOM.Jesse Wilson2010-02-263-24/+38
| | | | | | | | This adds implementation and tests for these methods: getInputEncoding(), getDocumentURI(). And tests for these methods: getXmlEncoding(), getXmlVersion(), getXmlStandalone().
* Implementing still more DOM API for text nodes.Jesse Wilson2010-02-237-48/+107
| | | | | | - Text.isElementContentWhitespace() - Text.getWholeText() - Text.replaceWholeText()
* More XML DOM v3 APIs.Jesse Wilson2010-02-203-14/+129
| | | | | | | | | This adds the following APIs and tests: - Node.isDefaultNamespace - DomImplementation.hasFeature - Node.isSupported - Node.getFeature - Node.isEqualNode
* DOM setTextContent() tests and implementation fixes.Jesse Wilson2010-02-193-12/+32
|
* Filling in some gaps in our XML DOM v3 API.Jesse Wilson2010-02-196-68/+291
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically, these methods on Node: - setTextContent() - isSameNode() - lookupPrefix() - lookupNamespaceURI() In order to implement the last 2 I needed to fix our KXml parser to include namespace attributes (ie. xmlns) in the pulled document. Previously these were being elided. Added a new testcase to verify our behaviour. It passes the RI. On Dalvik we have a small issue with entity declarations. Added a new testcase to verify Node.getBaseURI(). This test fails because the method isn't implemented. Part of this test required moving a method out to Support_Resources.java; in order to verify the BaseURI the XML must be read from a file and not a stream (so that path information exists). Also... - Style cleanup: changing static calls to look like static calls. - Efficiency: avoiding concatenating with "" when unnecessary - Duplication: sharing prefix validation between attributes and elements - Renaming NodeTests to NodeTest for vogar-friendliness Outstanding: - I need to write a test for setTextContent().
* Removing unnecessary org.w3c.dom subpackagesJesse Wilson2010-02-1618-1112/+12
|
* Fixing problems with the test runner's ability to parse expected results files.Jesse Wilson2010-02-112-9/+11
| | | | | | It appears that the original authors of this testing framework didn't really know whether these files were supposed to be XML or HTML, UTF-8 or UTF-16, and so there's quite a mess of processing in order to canonicalize them.
* Fixing some of our XSLT implementation issues.Jesse Wilson2010-02-106-17/+70
| | | | | | | | | | | These changes move our XSLT code to passing 1898/3173 of the OASIS tests. To contrast, the RI passes 2105/3173 tests. Highlights: - Implementing getTextContent() for nodes - Removing validation during transforms. We don't support validation! - Fixing attribute constraints to match the spec - Fixing test suite to not confuse BaseURI from NamespaceURI
* Restore our ability to parse an XML Document given a File argumentJesse Wilson2010-02-021-2/+10
| | | | | | | directly, rather than via a stream. When I updated DocumentBuilder but not its subclass DocumentBuilderImpl, some of the assumptions by DocumentBuilderImpl were violated.
* Fix warnings in the new XML code.Elliott Hughes2010-02-012-4/+4
|
* Removing dead code from our copy of Xalan.Jesse Wilson2010-01-28166-74891/+45
| | | | | | | | | The trace package isn't accessible via our public API, so I've removed it. Exception localization isn't worthwhile. The Exslt code is a third-party extension that isn't necessary for the spec. Several other classes and methods were unused; I used IntelliJ to find and remove these. There's more that can go, but this is a fine first step.
* Bring our XML APIs up to date with Java 5.Jesse Wilson2010-01-27777-2008/+272320
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New packages for Java 5 compatiblity: - javax.xml.datatype - javax.xml.namespace - javax.xml.parsers (updated) - javax.xml.transform - javax.xml.transform.dom - javax.xml.transform.sax - javax.xml.transform.stream - javax.xml.validation - javax.xml.xpath - org.w3c.dom (updated) - org.w3c.dom.events - org.w3c.dom.ls (load/save) - org.w3c.dom.traversal - org.w3c.dom.views Omitted packages (that otherwise exist in Java 5) - org.w3c.dom.bootstrap. This package facilitates pluggable implementations of DOM. I'm not including this because there's little need for it in practice; and because it adds an unnecessary layer of complexity. This decision is also reflected in TransformerFactory.newInstance(), SAXParserFactory.newInstance(), and DocumentBuilderFactory.newInstance(). New packages that pseudo-exist in Java 5 - org.w3c.dom.traversal This package is referenced by Java 5's org.w3c.dom.ls.LSSerializerFilter, but isn't included in the Javadoc API. Their spec isn't self-consistent. - org.w3c.dom.views This package is referenced by Java 5's org.w3c.dom.events.MouseEvent, but isn't included in the Javadoc API. Another spec that isn't self-consistent. This upgrades DOM from v2 to v3. http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ This includes some API-incompatible changes; notably introducing new methods into interfaces. I believe this is still safe, and Java made a similar backwards incompatible change when they upgraded DOM from v2 to v3 between Java 1.4 and Java 5.0. Source for the new APIs comes from Apache XML commons. http://svn.apache.org/repos/asf/xml/commons/trunk rev 901014. This code currently contains several gaps in its implementation. In particular, the impelementations of the DOM model classes (AttrImpl, ElementImpl, NodeImpl) have DOM v3 methods that throw UnsupportedOperationExceptions. I intend to address this problem in an immediate follow-up CL. All gaps are marked with TODO comments, and they all live in the org.apache.harmony.xml.dom package. To implement these APIs, I've included Apache Xalan. In a follow-up change I intend to remove most of the code we don't actually need. I'm using their pristine copy from SVN so Git can track our local modifications. http://svn.apache.org/repos/asf/xalan/java/trunk rev 889881.
* Depessimize string conversions.Elliott Hughes2009-12-181-1/+1
| | | | | | | | | | | | Why does this idiom persist? It's ugly, and it's the least efficient way to do it. (I found the ones in DecimalFormatSymbols while invesigating why "new SimpleDateFormat()" burns through so many StringBuilders. grep(1) found the rest.) The DocumentBuilderImpl removes an unnecessary level of indirection, since we implement Character.toString in terms of String.valueOf. (I wouldn't have bothered except this was the only use of Character.toString in the core libraries, and I added it myself a few weeks ago.)
* Implement DTDHandler support for ExpatParser.Elliott Hughes2009-12-092-14/+19
| | | | | | | | | | | Every time a third-party developer gets their DefaultHandler method signatures wrong (making it impossible for us to call them), they see this in the log and complain that SAX parsing is broken on Android: WARN/ExpatReader(704): DTD handlers aren't supported. This patch adds that support -- even though no-one wants it -- so we can get rid of the irrelevant log message.
* Fix KXmlSerializer so it won't generate invalid XML.Elliott Hughes2009-11-182-19/+47
| | | | | | | | | | | | We were allowing arbitrary characters to be output (which, surprisingly, XML does not), and we weren't correctly escaping CDATA sections that contained "]]>". Pull out some of my test helpers from DocumentBuilderTest into Support_Xml, because they're more generally useful when writing tests involving XML. Also correct a bunch of spelling mistakes in XmlSerializer's javadoc, since I happened to be reading through.
* Various XML fixes.Elliott Hughes2009-11-174-28/+52
| | | | | | | | | | | | | | | | | | | Add tests for bug 2487, exploring the situations where "]]>" is and isn't allowed. Fix the bug by changing KXmlParser so it pays attention to whether it's dealing with normal text or text in an attribute value and reports errors appropriately. In order to pass the new tests, we also need to fix DocumentBuilder to pay attention to its DocumentBuilderFactory's "coalescing" setting: whether or not adjacent text/CDATA nodes should be coalesced. This in turn fixes a @KnownFailure in DocumentBuilderFactoryTest: previously we didn't allow the caller to turn "coalescing" off (though until my previous patch, we didn't actually coalesce anyway). Now we support both, and I've made coalescing the default, because bug reports tell us that's what users want. It's how the RI behaves, too. Bug: 2487
* Remove org.kxml2.wap.Elliott Hughes2009-11-136-2701/+0
| | | | | | (Not to be submitted before d2944c35 in packages/apps/Email.) Bug: 2249953
* Fix typos in the XmlPullParser documentation.Elliott Hughes2009-11-111-26/+25
|
* Fix DOM parsing of character references/entities.Elliott Hughes2009-11-101-5/+41
| | | | | | | | | | | Our DOM parser didn't support &#123; or &#x9a; character references, and didn't merge adjacent text nodes into one (so "a&amp;b" would be three text nodes rather than one; SAX allows the former, but DOM guarantees the latter). This patch fixes both bugs, and adds tests. Bug: 2607 (and duplicates)
* Bring our kxml2 up to date with upstream.Elliott Hughes2009-11-092-262/+319
| | | | | | | | | | Much of this is spurious whitespace changes, but there's some increased "relaxation". I deliberately lost the Android-specific change that was avoiding Runtime, since we do now have Runtime. I've added an Android-specific change to comment out some System.out logging that's been added upstream. I'd tell you the upstream revision number, but they're still using CVS, so there isn't one.
* Fix a few FindBugs warnings in code that isn't upstream.Elliott Hughes2009-10-271-3/+1
| | | | Bugs: 2099642, 2099637
* Fix Node.getNextSibling bounds checking.Elliott Hughes2009-09-251-1/+1
| | | | | | | | | | | Obvious copy & paste error in InnerNodeImpl compared to LeafNodeImpl, plus new test. I've also fixed a typo that annoys me whenever I look at the XML test results, and removed a KnownFailure for a test that passes (and has been passing for some time). Bug: 779
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-03111-0/+27748
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-03111-27748/+0
|
* auto import from //branches/cupcake/...@126645The Android Open Source Project2009-01-151-2/+9
|
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-1713-401/+734
|
* Initial ContributionThe Android Open Source Project2008-10-21110-0/+27408