moved everything into /trunk/ to create the standard svn layout, for use with tools that require this (eg. git-svn). IMPORTANT: do NOT do an `svn up`. instead, re-use your working copy's existing files with `svn switch` (http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.switch.html).
xml_dom.py: replace_with_text(): Added support for all scalar (non-Node) types, which will be stringified using strings.ustr()
xml_dom.py: replace_with_text(): Fixed bug where need to use scalar.is_nonnull_scalar() instead of is_scalar() to avoid converting None values to the string 'None'
xml_dom.py: replace_with_text(): Support any scalar type recognized by scalar.is_scalar()
xml_dom.py: Added prune_parent()
xml_dom.py: replace_with_text(): Support ints and floats
Replaced str() with strings.ustr() (or equivalent) everywhere needed, to avoid future UnicodeEncodeErrors
xml_dom.py: NodeEntryIter: Support entries with multiple children
xml_dom.py: replace(): Support a list of new nodes to replace the old node with
xml_dom.py: Moved only_child() near related method has_one_child()
xml_dom.py: only_child(): Raise exception instead of failing assertion. Include invalid node in exception message for easier debugging.
xml_dom.py: Added only_child() and use it where its definition was used
xml_dom.py: Added prune()
xml_dom.py: Added prune_empty() and prune_children()
xml_dom.py: Added NodeEntryIter
xml_dom.py: replace_with_text(): Use new bool2str() so that False causes the node to be removed instead of replaced with the empty string
xml_dom.py: Added bool2str()
xml_dom.py: replace_with_text(): Support bool `new` values
xml_dom.py: is_empty(): Treat whitespace-only text nodes (including text nodes containing empty strings) as empty. This will also support None equivalents in text nodes, because they are isspace_none_str, which is considered whitespace.
xml_dom.py: value(), set_value(): Use new strings.isspace_none_str as sentinel None equivalent, to support cloning text nodes containing a sentinel None
xml_dom.py: is_whitespace(): Also consider empty text nodes to be whitespace
xml_dom.py: is_whitespace(): Support text nodes whose value() is None by using .nodeValue instead
xml_dom.py: set_value(): Don't set the value of a text node to None by removing it, because this prevents the node from being reused. Instead use a sentinel string value to denote None, and map to and from it.
xml_dom.py: set_value(): Support setting the value of a text node to None, by removing it
xml_dom.py: NodeTextEntryIter: Allow empty values through as None, and instead filter them out in TextEntryOnlyIter using new helper function non_empty(). This allows XML functions to decide for themselves whether empty values should be filtered out, because process() will now no longer automatically remove them. This will enable process() to work with SQL functions, which must not have empty values filtered out because this will remove required, but nullable, arguments.
xml_dom.py: Removed no longer used merge_same_name()
xml_dom.py: Moved merge_adjacent() recursion and name checking into merge() so that other callers of merge() can take advantage of it, too. Added merge_by_name() and use it in merge_same_name(). Removed now-unused merge_adjacent().
xml_dom.py: replace(): Assert that old node not removed from parent tree
xml_dom.py: Added merge_same_name()
xml_dom.py: Added merge() and merge_adjacent()
xml_dom.py: replace_with_text(): Return the new node
xml_dom.py: Added is_node()
xml_dom.py: set_value(): If value is None and node is Element, remove value node entirely instead of setting node's value to None
xml_dom.py: Added value_node(). Use new value_node() in value() and set_value(). set_value(): If the node already has a value node, reuse it instead of appending a new value node.
xml_dom.py: get_id(): If the node doesn't have an ID, assumes the node itself is the ID. This enables backward (child-to-parent) pointers whose target is a text element containing an ID, rather than a regular element with an ID attribute.
xml_dom.py: value(): Skip comment nodes. This fixes a bug where comments inside text elements would prevent the value from being retrieved.
xml_dom.py: Comments: Added clean_comment() and mk_comment(). Searching child nodes: by_tag_name(): Added ignore_namespace option to ignore namespace of node name.
xml_dom.py: Added clean_comment() and mk_comment() to properly sanitize comment contents (comments can't contain '--')
xml_dom.py: Don't print whitespace from parsed XML document when pretty-printing XML. minidom modifications section: Added subsection labels for the class each modification applies to.
Moved parse_str() from xml_dom.py to xml_parse.py
xml_dom.py: Added parse_str()
xml_dom.py: minidom modifications: Escape as many text strings as we use directly. This still leaves the tagName used by xml.dom.minidom.Element.writexml: It uses 'writer.write(indent+"<" + self.tagName)' and doesn't escape the tagName.
xml_dom.py: NodeTextEntryIter: Filter out empty entries (instead of producing an entry with an explicit None value, which causes problems with XML funcs that can't handle Nones)
xml_dom.py: Fixed bug in parent() where it didn't account for NodeParentIter's first element returned being the current node, not its parent. Refactored parent() to use parentNode directly, and NodeParentIter to use parent(), instead of the other way around.
xml_dom.py: Fixed bug in parent() where incorrect variable name was used
xml_dom.py: Added parent() to get parent node without recursing past the root node to the document object. Documented that NodeParentIter incorporates this sanity check.
xml_dom.py: NodeTextEntryIter: Convert empty entries (including entries containing error comments) to None
xml_dom.py: replace(): Added support for new node that's None (deletes existing node)
xml_dom.py: minidom.Element.write_opening(): Use new Attr.__str__() method for printing attributes
xml_dom.py: by_tag_name(): Iterate forwards over children unless last_only optimization turned on. Added Attr.__str__() and repr() for debug-printing Attrs.
strings.py: Renamed one_line() to remove_extra_newl() to better reflect what it does
xml_dom.py: Remove extra newlines from single-line strings (bin/map doesn't need to do this itself anymore)
xml_dom.py: Added documentation labels to each section
xml_dom.py: Fixed bug in NodeTextEntryIter where an entry containing an element instead of a text node would be returned as the whole entry, instead of the value of the entry
xml_dom.py: Override Node.__repr__ and Element.__repr__ to make sure self.toprettyxml() is used in all cases where a Node is converted to a string
xml_dom.py: Added TextEntryOnlyIter to check that values returned by NodeTextEntryIter are strings from text nodes
xml_dom.py: Fixed conversion of minidom.Node to a string to use toprettyxml() again
xml_dom.py: Print simple XML elements on one line
xml_dom.py: replace_with_text(): Accept Node inputs for cases where e.g. an XML func with an error has been replaced with a comment
xml_dom.py: Added is_simple() to determine whether every child recursively has no more than one child. Used is_simple() to print condensed XML when simple nodes are converted to a string.
xml_dom.py: In NodeTextEntryIter, return non-text children as-is instead of ignoring them so that XML functions can use them
xml_dom.py: Improved readability by separating into sections
xml_dom.py: Changed is_empty() to consider nodes with only comments to be empty
xml_dom.py: Added has_elems() to check if node has Element children
xml_dom.py: Added remove() function to remove a node
xml_dom.py: Node.__str__() uses toprettyxml() instead of toxml()
xml_dom.py: Added Node pop() and clear() methods
xml_dom.py: Added support for integer indents
xml_dom.py: Added NodeIter() and Node.__iter__()
Use new xml_dom.prettyxml_config instead of Node.writeprettyxml because it can be passed as keyword args to any writexml function
xml_dom.py: Removed no longer needed xml_dom.writexml()
xml_dom.py: Added minidom.Document write_opening() and write_closing() methods. Changed writexml(writer, node) to use new Node.writeprettyxml() method.
Import xml.dom.minidom as minidom
xml_dom.py: Refactored xml.dom.minidom.Element.writexml() to use new write_opening() and write_closing() methods. Use new functions is_elem() and is_text_node() to determine node type. Corrected definition of a text element to be an element that contains a single text node.
Moved everything in scripts to root. inputs_Makefile: Don't run "all" when installing.
Added str() method to XML nodes
Refactored xml_dom.set_value() to avoid needing a doc parameter for the XML document
xpath.py: Refactored xml_func.py to avoid needing a doc parameter for the XML document
xml_dom.py: Changed all uses of name_of(node) to node.tagName
Made XML node names case-sensitive
map: Implemented DB input support for querying a single table
map: Continued to add DB input support
Added xml_func.py to process mappings whose output needs postprocessing
map: Fixed bugs to enable mapping straight from CSV to a database. Still need a way to set plot.authorPlotCode for specimens data.
Finished VegX-VegBank mapping and created VegBank joins of mappings to VegX
Renamed modules to remove _util
Moved Python modules to shared lib folder
data2xml: Improved syntax for XPath lookahead assertions. Changed XML printing to print multiple text nodes on separate lines.
Removed no longer necessary strip() from node value getter
Added patch for xml.dom.minidom.Element.writexml to avoid adding extra whitespace around text nodes
In data2xml, fixed xpath.get() to do last_only optimization properly for pointer targets
In data2xml, added support for XPath pointers
Merged data2xml XPath functionality into xpath.py. Merged data2xml xml_dom.py and xml2db xml_util.py into identical xml_util.py for each script.