Commit Graph

192 Commits

Author SHA1 Message Date
Fred Drake fbdeaad069 expunge the xmlcore changes:
41667, 41668 - initial switch to xmlcore
  47044        - mention of xmlcore in What's New
  50687        - mention of xmlcore in the library reference

re-apply xmlcore changes to xml:
  41674        - line ending changes (re-applied manually), directory props
  41677        - add cElementTree wrapper
  41678        - PSF licensing for etree
  41812        - whitespace normalization
  42724        - fix svn:eol-style settings
  43681, 43682 - remove Python version-compatibility cruft from minidom
  46773        - fix encoding of \r\n\t in attr values in saxutils
  47269        - added XMLParser alias for cElementTree compatibility

additional tests were added in Lib/test/test_sax.py that failed with
the xmlcore changes; these relate to SF bugs #1511497, #1513611
2006-07-29 16:56:15 +00:00
Fred Drake c6730e1772 move the xml package implementation to xmlcore, and adjust the tests to
test that package, not the xmlcore/PyXML switcheroo fiasco in the xml
module/package
2005-12-14 06:20:35 +00:00
Fredrik Lundh af57fa13f4 r1077@spiff: Fredrik | 2005-12-12 22:58:44 +0100
make sure xml.etree can be used even if PyXML is present
 (solution proposed by Philip J. Eby)
2005-12-12 21:59:52 +00:00
Fredrik Lundh 7e0aef0e75 r1068@spiff: Fredrik | 2005-12-12 19:50:30 +0100
assorted xml.etree tweaks
2005-12-12 18:54:55 +00:00
Fredrik Lundh 075854fcc5 added ElementTree core components to xml.etree 2005-12-12 15:10:44 +00:00
Andrew M. Kuchling 593d6b311e [Bug #1281032] Pass encoding from the input source to pyexpat's ParserCreate() 2005-12-04 19:53:45 +00:00
Andrew M. Kuchling 841d25ee66 [Patch #1094164] replaceChild(x,x) ends up removing x of the tree. Add fix from Felix Rabe and a test case 2005-11-22 19:03:16 +00:00
Georg Brandl 175a7dcf65 bug [ 1262320 ] minidom.py alternate newl support is broken 2005-08-25 22:02:43 +00:00
Fred Drake e4772f3ada fix XMLFilterBase.resolveEntity() so the caller gets the result
(PyXML bug #1112052)
2005-02-03 17:31:39 +00:00
Walter Dörwald f7f9b6cb2d Fix typo in comment. 2004-11-25 12:23:23 +00:00
Fred Drake 910b282fbb when only using half of the return value of os.path.split(), use
os.path.dirname() or os.path.basename() instead
2004-10-20 11:08:35 +00:00
Raymond Hettinger 06d9b1f30b SF bug #902037: relative on-disk SYSTEM id handling is incorrect
(Contributed by Bob Ippolito.)

backport candidate.
2004-10-20 08:21:19 +00:00
Martin v. Löwis 4b9059b437 Require minimally PyXML 0.8.4. 2004-10-13 19:57:14 +00:00
Tim Peters 182b5aca27 Whitespace normalization, via reindent.py. 2004-07-18 06:16:08 +00:00
Fred Drake e143bbb610 fix documentation for ContentHandler.ignorableWhitespace()
(closes SF bug #881707)
2004-05-06 03:47:48 +00:00
Martin v. Löwis ae20722d96 Consider output encoding in XMLGenerator. Fixes #938076.
Backported to 2.3.
2004-05-06 02:22:43 +00:00
Martin v. Löwis 0ea558f7b4 Properly delegate startElementNS in saxutils.XMLFilterBase. Fixes #936637.
Backported to 2.3.
2004-05-06 02:04:21 +00:00
Martin v. Löwis 456ab1d271 Swap public and system ID in start_doctype_decl. Fixes #780300. 2004-05-06 01:54:36 +00:00
Fred Drake 6fd0b0d5ba commit the portion of PyXML patch #919008 that is relevant to the
standard library:
str() of xml.sax.SAXParseException should not fail if the line and/or
column number returned by the locator are None
(tests added)
2004-03-20 08:15:30 +00:00
Walter Dörwald 70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Neal Norwitz bc05fc5d2b Add missing self. before curNode. This may need to be committed
to PyXML, I'm not sure of the procedure.
2003-06-29 04:50:34 +00:00
Tim Peters 0eadaac7dc Whitespace normalization. 2003-04-24 16:02:54 +00:00
Raymond Hettinger ff41c48a77 SF patch #701494: more apply removals 2003-04-06 09:01:11 +00:00
Guido van Rossum 68468eba63 Get rid of many apply() calls. 2003-02-27 20:14:51 +00:00
Raymond Hettinger 0e449234bf SF patch 672098: Three __contains__ implementations
Contributed by Jp Calderone.
2003-01-30 00:56:33 +00:00
Martin v. Löwis afef4eefa8 Require PyXML 0.8.2. 2003-01-26 10:36:33 +00:00
Martin v. Löwis f8de21c51b Merge with PyXML 1.3:
Add support for the DOM Level 3 (draft) DOMImplementationSource interface
to the xml.dom and xml.dom.minidom modules.  Note API issue: the draft spec
says to return null when there is no suitable implementation, while the
Python getDOMImplementation() function raises ImportError (minor).
2003-01-26 09:04:35 +00:00
Martin v. Löwis 041411a1c7 Merge with PyXML 1.34: Correct typo. Fixes #674700. 2003-01-26 09:01:30 +00:00
Martin v. Löwis 995359cbe8 Merge with PyXML 1.82:
Correct various typos. Fixes #674700.
Set newly created attribute via setNamedItem.
2003-01-26 08:59:32 +00:00
Martin v. Löwis 7c3c4669b7 Import UserDataHandler from PyXML. 2003-01-25 17:11:07 +00:00
Martin v. Löwis b5698faa9d Import NodeFilter from DOM2 Traversal/Range. 2003-01-25 17:07:03 +00:00
Martin v. Löwis 3f1b5288e5 Merge with PyXML 1.28:
Wrap a lot of long lines.
Clean up a handler for expat.error.

If a lexical handler is set, make sure we call the startDTD() and
endDTD().  If the lexical handler is unset (by setting it to None),
remove the handlers from the underlying pyexpat parser object.
Closes SF bug #485584.

In namespaces mode, make sure we set up the qnames dictionary
correctly for the AttributesNSImpl instance passed to the
start-element-handler.
Closes SF bug #563399.

Support skippedEntity. Fixes #665486.
2003-01-25 16:51:50 +00:00
Martin v. Löwis 9ea67889dc Import from PyXML 1.10. 2003-01-25 15:29:56 +00:00
Martin v. Löwis 787354c3b9 Merge with PyXML 1.80:
Basic minidom changes to support the new higher-performance builder, as
described: http://mail.python.org/pipermail/xml-sig/2002-February/007217.html

Use True/False where appropriate.

isSupported():  Implemented from DOM Level 2.

Support a variety of things from the DOM Level 3 draft, integrate with
the xml.dom.xmlbuilder module for the new Document and
DOMImplementation methods.

Support the NODE_CLONED callback for the UserDataHandler set using
setUserData().

Add Entity and Notation nodes to minidom.
Add __getitem__() to ReadOnlySequentialNamedNodeMap to match NamedNodeMap.
TupleType was used without being defined; rename to _TupleType and define.

Add magic so that instances of the NamedNodeMap (and its read-only cousin)
take a bit less memory in the new-style world of Python 2.2/2.3.  Now, the
assignments to __slots__ actually work.  ;-)

Add support for the Text.wholeText attribute.
Document.createCDATASection():  Do not pass unsupported arg to CDATASection
constructor.

Implemented Text.replaceWholeText().

Updated minidom interfaces to work better with current 4Suite XPath and Xslt.
* Added childNodes to class Attr
* Added localName and prefix to all Nodes
* Added specified on class Attr
* Changed DOMImplementation.createDocument to all creating a document with no document element and
a
Null doctype
* Changed CharacterData__setattr__ to keep nodeValue and data in synch
* fixed typo of ownerDoc in createDocumentFragment
* Changed Comment to inherit from CharacterData
* Allowed mutation of name on PIs
* Added importNode and rewrote cloneNode so both use same code base
* Changed EmptyNodeList to be a list not a tuple

Use a table-driven DOMImplementation.hasFeature().
Shorten lines longer than 80 characters.

Rename CloneNode to _clone_node (better naming consistency within the
module).

When defining localName as a property, the defproperty() call is
needed for each class that defined _get_localName(), otherwise only
the first version is used for Python 2.2 and newer.

Node.insertBefore():  When the reference node is not found, raise the
    exception defined by the DOM specification.

Attr._set_value():  Added setter that does the right thing.

Childless.removeChild():  Raise the exception defined by the
    specification, even though it seem less than intuitive.

_clone_node():  Access nodeType constants so we actually find them.
    Add support for document fragments.

Node.removeChild(), .replaceChild():
    Fix exception raised when a reference node is not found.

CharacterData._set_data():  Update the nodeValue attribute as well as
    the data attribute.

Entity.attributes, .childNodes:  Added these attributes.

Document.removeChild():  Raise the right exception when the node being
    removed is not a child of this node.

Element.removeAttributeNode():  Raise the right exception when the
    node isn't present on this element.  Don't unlink the node unless
    it is present.

Added support for the following methods and accessors:
    Node._get_childNodes(), Attr._get_specified(), Attr._set_prefix(),
    NamedNodeMap.has_key(), .getNamedItem(), .getNamedItemNS(),
    .removeNamedItem(), .removeNamedItemNS(),
    ProcessingInstruction._get_data(), ._get_target(), ._set_data(),
    ._set_target(), CharacterData.__len__(),
    Document.getElementById().

Add many more of the _get_*() accessors.

Convert internal helpers to use a more consistent naming convention.

Remove unused definition of _nssplit(); there can be only one!

Move the Identified mixin up so it can be used by one more class.

Remove comment about NamedNodeMap.__getitem__(); the API won't be
changing now!  Way too late for that.

Preliminary support for getElementById() for DOMs built with
xml.dom.expatbuilder.
Not necessarily very efficient, but it works, and is still fast for Document
instances that do not have the ID information.

DOMImplementation.createDocument():  Don't forget to add the
    DocumentType node to the tree.  This appearantly was lost in the
    previous release.

DocumentType.writexml():  New function.

Implement the final determination on the behaviors of importNode() and
cloneNode() with regard to Document and DocumentType nodes.

When cloning and importing, call the UserDataHandler with the right
operation, not just blindly use NODE_CLONED.

parse(), parseString():  When called with parser=None, use
xml.dom.expatbuilder instead of xml.dom.pulldom, to get a performance
boost (the main point of expatbuilder).

Fix for calling parse / parseString with a given parser instance;
the else-paths were ignored when refactoring the function signatures;
pychecker found that error instantly, BTW (hint, hint)

Added pickle support for NamedNodeMap, ReadOnlySequentialNamedNodeMap,
and ElementInfo. Closes SF bug #609641.

In _clone_node for elements, fixed arguments for getAttributeNodeNS

At least make sure the DOM API won't allow you to modify the child
node list of an entity node (since entity ndoes are supposed to be
readonly).

Add support for the DOM Level 3 (draft) DOMImplementationSource interface
to the xml.dom and xml.dom.minidom modules.  Note API issue: the draft spec
says to return null when there is no suitable implementation, while the
Python getDOMImplementation() function raises ImportError (minor).

Implement the DOM Level 3 Attr.isId property.
Refactor the lookup of the ElementInfo objects.

Implement the schemaType attribute for Element and Attr nodes.
Defined by the (draft) DOM Level 3 specification.

getElementById():  Support caching of IDs found.  This implementation is
    sufficient for DOM Level 2 compliance, but additional changes will be
    needed to support the setIdAttribute() and setIdAttributeNS() methods
    in DOM Level 3.

Add support for Text.isWhitespaceInElementContent (draft Level 3).

NamedNodeMap.removeNamedItem(), .removeNamedItemNS():
    Pass the new tests:  Return the removed node, or raise NotFoundErr
    if there was no matching node.

When changing attributes via a NamedNodeMap, update the ID-cache
appropriately.

Added support for the DOM Level 3 (draft) Element.setIdAttribute*() methods.

setAttributeNode():  Be more careful about not calling
    removeAttributeNode() twice for a single node.

Do more to avoid creating new Attr nodes, so that attributes do not lose
their ID-ness when set using setIdAttribute*().

Work harder to avoid calls to Attr.__setattr__() and
CharacterData.__setattr__().

Attr.unlink():
    Implement everything directly instead of calling to the base
    class, which does several things that aren't needed for Attr
    nodes.

Change some remaining assignments that caused __setattr__() to be
called when it can be avoided.  expatbuilder can now perform DOM
construction without __setattr__() interferance in common cases.

Remove unused _make_parent_nodes logic.
2003-01-25 15:28:29 +00:00
Martin v. Löwis fc5fec7735 Import expatbuilder, minicompat from PyXML. 2003-01-25 15:11:07 +00:00
Fred Drake 6d8905012c Minor simplification. 2002-10-28 18:09:41 +00:00
Fred Drake 407fea5197 Really do replacement of & last to avoid bad interactions between &
replacement and replacements based on the entities parameter.
2002-10-28 17:46:59 +00:00
Fred Drake f55222d98f Avoid calling __dict_replace() if we don't need to -- the call is much
more expensive than just doing to work needed, and these things seem
to always turn into a bottleneck eventually.
2002-10-28 17:29:01 +00:00
Martin v. Löwis 74b51ac1e5 Patch #613256: Add nescape method to xml.sax.saxutils. 2002-10-26 14:50:45 +00:00
Fred Drake a350270302 New entries to track the DOM API growth. These match names exposed in
PyXML 0.8.
2002-08-09 14:57:55 +00:00
Fred Drake 8e8dc419d0 Remove bogus assignment to self.length in NamedNodeMap.__delitem__(). 2002-07-02 17:27:06 +00:00
Martin v. Löwis adfa7409f8 Bump required PyXML version to 0.6.5. 2002-06-30 15:08:22 +00:00
Martin v. Löwis 7d650ca83b Implement the encoding argument for toxml and toprettyxml.
Document toprettyxml.
2002-06-30 15:05:00 +00:00
Martin v. Löwis 2ebfd09e58 Merge from PyXML:
[1.3] Added documentation of the namespace URI for elements with no namespace.
[1.4] New property http://www.python.org/sax/properties/encoding.
[1.5] Support optional string interning in pyexpat.
2002-06-30 07:38:50 +00:00
Martin v. Löwis 0e2d881406 Add xml namespace initially (PyXML 1.19). 2002-06-30 07:32:56 +00:00
Martin v. Löwis d1b516c274 Fix spacing. 2002-06-30 07:27:30 +00:00
Martin v. Löwis 18476a3740 Merge changes from PyXML:
[1.15]
Added understanding of the feature_validation, feature_external_pes,
and feature_string_interning features.
Added support for the feature_external_ges feature.
Added support for the property_xml_string property.
[1.16]
Made it recognize the namespace prefixes feature.
[1.17]
removed erroneous first line
[1.19]
Support optional string interning in pyexpat.
[1.21]
Restore compatibility with versions of Python that did not support weak
references.  These do not get the cyclic reference fix, but they will
continue to work as they did before.
[1.22]
Activate entity processing unless standalone.
2002-06-30 07:21:24 +00:00
Neal Norwitz ab19962290 Use more string methods, remove import string 2002-05-31 20:46:39 +00:00
Fred Drake da204daeaa Not sure why the regression test missed this, but the PyXML tests caught it.
We should get attributes from the right object.
2002-04-04 19:12:31 +00:00
Fred Drake 012c81fc97 Avoid creating circular references between the ExpatParser and the
ContentHandler.  While GC will eventually clean up, it can take longer than
normal for applications that create a lot of strings (or other immutables)
rather without creating many containers.
This closes SF bug #535474.
2002-04-04 17:57:08 +00:00