summaryrefslogtreecommitdiffstats
path: root/Lib/xml
Commit message (Collapse)AuthorAgeFilesLines
* Ugly fix used when pyexpat is not available.Jeremy Hylton2001-07-301-0/+3
| | | | | | | | | | If pyexpat is not available and more than one attempt is made to load an expat-based xml parser, an empty xml.parser.expat module will be created. This empty module will confuse xml.sax.expatreader into thinking that pyexpat is available. The ugly fix is to verify that the expat module actually defines the names that are imported from pyexpat.
* Added function xml.sax.saxutils.quoteattr().Fred Drake2001-07-191-0/+21
| | | | This closes SF bug #440351. It should not be moved to Python 2.1.1.
* Patch #432117: Record namespaces in the DOM tree using the DOM xmlns prefix.Martin v. Löwis2001-07-181-1/+18
|
* Make the implementations of getElementsByTagName() andFred Drake2001-07-041-11/+5
| | | | | getElementsByTagNameNS() consistent in form as well as functionality (cosmetic).
* Synchronize with 1.13 of PyXML:Martin v. Löwis2001-06-171-6/+28
| | | | | | Allow application to set a new content handler and lex_prop handler during parsing. Closes bug #433761. Small hack to make expat be ignored in Jython.
* Previous check-in was by mistake, undo it.Martin v. Löwis2001-06-071-1/+3
|
* Patch #416220: Fix misplaced paren.Martin v. Löwis2001-06-071-3/+1
|
* Fix getElementsByTagNameNS:Martin v. Löwis2001-06-031-3/+7
| | | | | - actually return a result - Compare with tag.localName in getElementsByTagNameNSHelper
* Corrected default value of the DocumentType.internalSubset attribute basedFred Drake2001-04-051-1/+1
| | | | on a clarification sent to the www-dom list.
* CharacterData methods: Update self.length on changes instead of extendedFred Drake2001-04-041-4/+7
| | | | | | the __getattr__() handler. Text.splitText(): Update the length and nodeValue attributes.
* Add support for the CharacterData methods, CDATASection.Fred Drake2001-04-041-7/+73
|
* Initialize Attr.value with empty string in createAttribute*, as per DOMMartin v. Löwis2001-03-311-5/+7
| | | | | spec. Closes bug #412036. Also reindent toprettyxml.
* Arghh. Fix typo.Martin v. Löwis2001-03-271-1/+1
|
* Use Guido's trick for always extracting the version number from aMartin v. Löwis2001-03-271-1/+4
| | | | CVS Revision string correctly, even under -kv.
* When creating an attribute node using createAttribute() orFred Drake2001-03-231-1/+2
| | | | | | createAttributeNS(), use the parallel setAttributeNode() or setAttributeNodeNS() to add the node to the document -- do not assume that setAttributeNode() will operate properly for both.
* Synchronize with 1.6 of PyXML:Martin v. Löwis2001-03-221-3/+11
| | | | | Retrieve relevant information at construction time, as it may be lost when the exception is printed.
* Import the exceptions that this module can raise.Fred Drake2001-03-141-0/+3
|
* Patch #407965: Improve Level 2 conformance of minidomMartin v. Löwis2001-03-132-21/+103
| | | | | | | | | | | | | | - addition of a DocumentFragment implementation and createDocumentFragment method - proper setting of ownerDocument for all nodes - setting of namespaceURI to None in Element as a class attribute - addition of setAttributeNodeNS and removeAttributeNodeNS as aliases for setAttributeNode and removeAttributeNode - support for inheriting from DOMImplementation to extend it with additional features (to override the Document class) in pulldom: - support for nodes (comment and PI) that occur before he document element; that became necessary as pulldom now delays creation of the document until it has the document element.
* Patch #103885: Add dynamic registration and lookup of DOM implementations.Martin v. Löwis2001-02-223-0/+81
|
* Patch #103854: raises an exception if a non-Attr node is passed toAndrew M. Kuchling2001-02-211-0/+3
| | | | | | NamedNodeMap.setNamedItem(). Martin, should I sync the PyXML tree, too, or do you want to do it? (I don't know if you're wrapping the 0.6.4 release right now.)
* DOMException._get_code():Fred Drake2001-02-191-0/+3
| | | | | | New method; this is the "alternate" access to the exception code. (Useful for Python DOM implementations that support the accessor method approach to retrieving attribute values.)
* String method conversion.Eric S. Raymond2001-02-091-3/+1
|
* Do not allow empty qualifiedName in createDocument.Martin v. Löwis2001-02-062-19/+47
| | | | | | Rearrange pulldom to create documents with root element. Provide clear methods so that the ContentHandler releases its hold on the document.
* Add toprettyxml method into minidom, closes patch #103471.Martin v. Löwis2001-02-061-14/+24
|
* A couple of changes to make this more conformant. MvL and Uche agree.Guido van Rossum2001-02-051-13/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will make it incompatible with the version found in Python 2.0. Does this need to be done to PyXML too? Changes that might break existing code are marked with (!) below. - Formatting nit: no spaces inside parentheses: foo( a ) -> foo(a). - Break long lines. - (!) Fix getAttribute() and getAttributeNS() to return "" instead of raising KeyError when the attribute is not found. - (!) Fix getAttributeNodeNS() to return None instead of raising KeyError. (Curiously, getAttributeNode() already did this.) - Added hasAttributes(), which returns true iff the node has any attributes. )This is DOM level 3.) - (!) In createDocument(), if the qualified name is not empty, actually create and insert the first element with that name (this will become doc.documentElement). MvL believes that it should be an error to specify an empty qualified name; I'm not going there today, since it would require making a matching change to pulldom. Maybe MvL will do this. - In Document.writexml(), insert an xml declaration at the top. (This doesn't include the encoding since there's no way to specify the encoding. If that's preferred, all writexml() methods should be fixed to support an optional encoding argument that they pass to each other -- and they should use it to encode all text they write, too. Later.)
* Don't get fooled by an empty prefix with a valid namespaceURI -- inGuido van Rossum2001-02-051-2/+10
| | | | | this case, the code used to generate invalid tags and attribute names with a leading colon, e.g. <:tag> or <tag :attr="foo">.
* Added Node.isSameNode() support.Fred Drake2001-02-021-0/+7
|
* Re-indent.Martin v. Löwis2001-01-271-4/+4
|
* Synchronize with PyXML 1.5.Martin v. Löwis2001-01-272-1/+2
|
* Synchronize with PyXML 1.10Martin v. Löwis2001-01-271-7/+25
| | | | | Break cycle involving expat parser in close(). Add lex handler support to SAX2 pyexpat
* Re-indent.Martin v. Löwis2001-01-273-14/+14
|
* Merge changes of PyXML 1.13:Martin v. Löwis2001-01-271-9/+10
| | | | | | Use nodeName, not tagName in attributes. Provide get method for dictionary-like objects. Use DOM exceptions instead of standard exceptions.
* Synchronize with 1.10 of PyXML: Close parser when done.Martin v. Löwis2001-01-271-2/+1
|
* Patch #103052: Restore non-cyclic operation of pulldom.PullDOMMartin v. Löwis2001-01-261-49/+38
|
* Text.__init__(): Make sure the data parameter is a string (8-bit orFred Drake2001-01-081-0/+2
| | | | | | Unicode); raise TypeError if not. This closes SF bug #126866.
* Patch #102485 ] Check for legal children when adding children to a DOM nodeAndrew M. Kuchling2000-12-311-6/+30
|
* Merge with 1.8 of pulldom.py:Martin v. Löwis2000-12-281-1/+7
| | | | Use types.UnicodeType if available, not type(u"").
* Merge changes up to 1.10 from PyXML:Martin v. Löwis2000-12-281-1/+11
| | | | | | | - implement hasAttribute and hasAttributeNS (1.7) - Node.replaceChild(): Update the sibling nodes to point to newChild. Set the .nextSibling attribute on oldChild instead of adding a .newChild attribute (1.9).
* Patch #102492, fixing bug #116677:Andrew M. Kuchling2000-12-202-10/+42
| | | | | | | | | | give minidom.py behaviour that complies with the DOM Level 1 REC, which says that when a node newChild is added to the tree, "if the newChild is already in the tree, it is first removed." pulldom.py is patched to use the public minidom interface instead of setting .parentNode itself. Possibly this reduces pulldom's efficiency; someone else will have to pronounce on that.
* Do not assume that types.UnicodeType exists; we might be running in an oldFred Drake2000-12-161-1/+5
| | | | version of Python. ;-(
* Use the string module instead of string methods; this should still workFred Drake2000-12-161-1/+3
| | | | with Python 1.5.2 for now.
* Typo caught by /F -- thanks!Fred Drake2000-12-151-1/+1
|
* DOMException.__init__(): Remember to pass self to Exception.__init__().Fred Drake2000-12-151-1/+1
|
* Lots of small bug fixes and DOM API conformance improvements:Fred Drake2000-12-141-49/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make Node inherit from xml.dom.Node to pick up the NodeType values defined by the W3C recommendation. When raising AttributeError, be sure to provide the name of the attribute that does not exist. Node.normalize(): Make sure we do not allow an empty text node to survive as the first child; update the sibling links properly. _getElementsByTagNameNSHelper(): Make recursive calls using the right number of parameters. Attr.__setattr__(): Be sure to update name and nodeName at the same time since they are synonyms for this node type. AttributeList: Renamed to NamedNodeMap (AttributeList maintained as an alias). Compute the length attribute dynamically to allow the underlying structures to mutate. AttributeList.item(): Call .keys() on the dictionary rather than using self.keys() for performance. AttributeList.setNamedItem(), .setNamedItemNS(): Added methods. Text.splitText(): Added method. DocumentType: Added implementation class. DOMImplementation: Added implementation class. Document.appendChild(): Do not allow a second document element to be added. Document.documentElement: Find this dynamically, so that one can be removed and another added. Document.unlink(): Clear the doctype attribute. _get_StringIO(): Only use the StringIO module; cStringIO does not support Unicode.
* Adjust PullDOM to use a DOMImplementation instance to create new DocumentFred Drake2000-12-141-26/+37
| | | | | | | | | objects; uses minidom if one is not provided to the constructor. parse(): Pick up the default_bufsize default value dynamically so that the value in the module may be (meaningfully) changed at runtime. This (partially) closes patch #102477.
* When raising KeyError, provide the key value that failed.Fred Drake2000-12-131-4/+4
|
* Add code to DOMException to ensure it cannot be instantiated directly,Fred Drake2000-12-131-1/+8
| | | | | since the API documentation will state specifically that the specializations must be used by the DOM implementations.
* Add standard DOM exception hierarchy.Martin v. Löwis2000-12-131-0/+68
|
* Update the docstring.Fred Drake2000-12-111-2/+31
| | | | | Add a Node class that defines the NodeType constants, based on discussion in the XML-SIG.
* Reduce the visibility of imported modules for cleaner "from ... import *"Fred Drake2000-11-211-76/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | behavior. Added support for the Attr.ownerElement attribute. Everywhere: Define constant object attributes in the classes rather than on the instances during object construction. This reduces the amount of work needed for object construction and destruction; these need to be lightweight operations on a DOM. Node._get_firstChild(), Node._get_lastChild(): Return None if there are no children (required for compliance with DOM level 1). Node.insertBefore(): If refChild is None, append the new node instead of failing (required for compliance). Also, update the sibling relationships. Return the inserted node (required for compliance). Node.appendChild(): Update the parent of the appended node. Node.replaceChild(): Actually replace the old child! Update the parent and sibling relationships of both the old and new children. Return the replaced child (required for compliance). Node.normalize(): Implemented the normalize() method. Required for compliance, but missing from the release. Useful for joining adjacent Text nodes into a single node for easier processing. Node.cloneNode(): Actually make this work. Don't let the new node share the instance __dict__ with the original. Do proper recursion if doing a "deep" clone. Move the attribute cloning out of the base class, since only Element is supposed to have attributes. Node.unlink(): Simplify handling of child nodes for efficiency, and remove the attribute handling since only Element nodes support attributes. Attr.cloneNode(): Extend this to clear the ownerElement attribute in the clone. AttributeList.items(), AttributeList.itemsNS(): Slight performance improvement (avoid lambda). Element.cloneNode(): Extend Node.cloneNode() with support for the attributes. Clone the Attr objects after creating the underlying clone. Element.unlink(): Clean out the attributes here instead of in the base class, since this is the only class that will have them. Element.toxml(): Adjust to create only one AttributeList instance; minor efficiency improvement. _nssplit(): No need to re-import string. Document.__init__(): No longer needed once constant attributes are initialized in the class itself. Document.createElementNS(), Document.createAttributeNS(): Use the defined constructors rather than directly access the classes. _get_StringIO(): New function. Create an output StringIO using the most efficient available flavor. parse(), parseString(): Import pulldom here instead of in the public namespace of the module.