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).
Replaced repr() with strings.urepr() (or equivalent) everywhere needed, to avoid future UnicodeEncodeErrors
Replaced str() with strings.ustr() (or equivalent) everywhere needed, to avoid future UnicodeEncodeErrors
xpath.py: parse(): _value(): Support '+' as a word character that doesn't need to be quoted
xpath.py: put_obj(): Use new get_values(), so that the returned nodes are not modified by XML tree transformations, such as those performed by xml_func.process()
Added get_values()
Removed trailing whitespace on non-empty lines
xpath.py: get(): reference expansion: Use get_1() and check for None result instead of using get(), which returns multiple nodes when we just want the first
xpath.py: path2xml(): Skip to tree created inside root, since that is how callers want to use the returned node
xpath.py: get(): Support checking all children when the elem name is '*'
xpath.py: Added is_all()
xpath.py: get(): Create attrs: Put keys last so that any lookahead assertion's path will be created last as it would have without the assertion. This ensures that any value argument of an XML function will always go last even if a lookahead assertion would otherwise have caused it to be created with the element's keys, which previously were created before the attributes.
xpath.py: get(): Create attrs: Fixed bug where attrs were created with last_only on, which caused attrs to get created multiple times if there were multiple attrs of the same name but different values, becase the last_only optimization would only check the last attr of that name
xpath.py: Added is_xpath()
xpath.py: put_obj(): Return the id_attr_node using get_1() because it should only be one node
xpath.py: put_obj(): Return a tuple of the inserted node and the id attr node
xpath.py: set_id(): When creating the id_path, use obj() (which deepcopy()s the entire path) because it prevents pointers w/o targets
xpath.py: set_id(): When creating the id_path, deepcopy() the id_elem because its keys will change in the main copy
xpath.py: set_id(): Return the path to the ID attr, which can be used to change the ID
xpath.py: put_obj(): Return the inserted node so it can be used to change the inserted value
xpath.py: get(): forward (parent-to-child) pointers: If last target object exists but doesn't have an ID attr (which indicates a bug), recover gracefully by just assuming the ID is 0. (Any bug will be noticeable in the output, which needs to be generated through workarounds like this in order to be able to debug.)
xpath.py: get(): Run xml_dom.by_tag_name() with ignore_namespace=False (possibly later set to True)
xpath.py: Added get_value() to run get_1() and returns the value of any result node
xpath.py: Added append() to recursively append subpath to every leaf of a path tree. parse(): Use append() to fix bug in split path parsing where subpath was not added to every leaf of the tree, only the main leaf of the main branch and the main leaves of the other branches of the last element.
xpath.py: parse(): Split paths: Raise a SyntaxException if can't attach a split path because there is no parent element to attach to
xpath.py: parse(): _paths(): Remove trailing ","
xpath.py: parse() Fixed bug in _paths() where empty lists would be parsed as a list containing a single empty path, instead of as an empty list
xpath.py: Import xpath_func after defining XpathElem because xpath_func depends on XpathElem and it hasn't yet been factored into a separate file
xpath.py: parse(): Run xpath_func.process() on the parsed XPath
xpath.py: Added get_1()
xpath.py: Removed unnecessary copy.deepcopy()'s and instead changed set_value() and set_id() to make copies of any elements they change. This should result in up to a 17% speed increase in the import, because deepcopy() was taking a lot of time. Added documentation to set_value() and set_id() that caller must make a shallow copy of the path to prevent modifications from propagating to other copies of the path. (Previously, a deep copy was needed, but there was no comment specifying this.)
xpath.py: get(): Added support for lookup-only elements which are not created if they don't exist
xpath.py: parse(): Added support for lookup-only elements which are not created if they don't exist
xpath.py: Added support for common subpath after split path's {}
xpath.py: get(): Fixed bug where it would try to create a node named . or .. if . or .. didn't have matching attributes. Now it will just reuse the current or parent node, but create any needed attrs if create is True.
xpath.py: Don't allow rooted attributes (doesn't make sense), in case someone tries to do elem[/rooted_attr]
xpath.py: Added get() support for references (different from pointers) to dynamically set the value of an attribute
xpath.py: get(): Go to root when empty element is encountered at the beginning of an XPath. Added allow_rooted parameter to turn off this functionality when XPaths with a leading slash should not be considered rooted.
xpath.py: Don't consider a path starting with "." to be rooted. Do this by not automatically translating an empty path name to ".".
xpath.py: Added is_rooted()
xpath.py: Added elem_is_empty()
xpath.py: Added documentation labels to each section
xpath.py: Added support for getting the parent node when encountering ".."
xpath.py: get(): Renamed parent to root to better reflect that it's the starting point for the search. Calling it parent will later be confusing when we want to get the parent node using "..".
xpath.py: Added parser support for attribute values that are references to another part of the XML tree
xpath.py: Fixed bug where value of XPath (used for copying to other branches) is retrieved after first XPath element is popped rather than before, which can sometimes leave an empty XPath for value() to run on
Replaced all type(...) == str with util.is_str(...) to properly treat Unicode objects as strings
xpath.py: get(): Fixed bug where limit was not passed to recursive get() calls
xpath.py: get(): Turn off last_only optimization when limit > 1
xpath.py: get(): Added full support for returning multiple matches
xpath.py: get(): Added basic structure for returning multiple matches. Added limit parameter to select one or many matches.
xpath.py: set_id(): Deal with XPaths with an
xpath.py: Allow XPath names to be quoted literals, just like values. Handle : embedded in a name (even without quotes), often indicating a namespace.
Moved everything in scripts to root. inputs_Makefile: Don't run "all" when installing.
xpath.py: Changed backward (child-to-parent) pointer ID abbr expansion to happen in get() when source node's tag name is known. This deals with XPath elements that are '.' being used as a pointer source.
xpath.py: Moved abbr expansion code to separate function
xpath.py: Changed order that main and other branches are processed in so it is consistent with the order the branches are specified in the XPath
xpath.py: Allowed empty names in XPaths
xpath.py: Added automatic conversion of strings to paths where needed.
xpath.py: Added caching of parsed XPaths. Added automatic conversion of strings to paths where needed.
Refactored xml_dom.set_value() to avoid needing a doc parameter for the XML document
xpath.py: Refactored to avoid needing a doc parameter for the XML document
map: Implemented DB input support for querying a single table
map: Continued to add DB input support
xpath.py: Created is_positive() function
xpath.py: Added support for negative attribute assertions with !
xpath.py: Fixed creation of attrs so it happens even when node already exists
xpath.py: Added concept of keys vs attrs in XPath elem
Now allow empty rows. Added support for select statement limit.
Added support for quoted values in XPaths
Changed VegBank mappings to use XML functions (not implemented yet) to calculate averages and ranges
Changed for loops to use enumerate() where the index is also needed
Moved XPath prep code (setting ID, value) to xpath.py
xpath.py: Added deepcopy() before setting value of other branches to traverse
xpath.py: Added basic support for split paths
Merged xml_xpath.py into xpath.py in preparation for changing the XPath parse tree to be the XML DOM tree itself
Refactored xpath.parse() to use a nested function instead of a class extending Parser
Finished VegX-VegBank mapping and created VegBank joins of mappings to VegX
Fixed xml_xpath.get() last_only optimization to handle attrs correctly. Turned off stack traces for errors intended for the user to see.
map: Added support for custom fkeys to parent in db XML trees. Removed extraneous csv reader/writer config because Excel format is default. Improved documentation.
map: Added more stubs for XML-XML mapping
Split off xpath.py XML functionality into xml_xpath.py
Renamed modules to remove _util
Moved Python modules to shared lib folder
data2xml: Added syntax for split paths, which map to multiple leaves
data2xml: Improved syntax for XPath lookahead assertions. Changed XML printing to print multiple text nodes on separate lines.
data2xml: Added support for * abbrs for backward (child-to-parent) pointers
In data2xml, fixed pointer handling to deal with pointer targets that are themselves pointers
In data2xml, added shortcut for lookahead assertion using ! symbol
In data2xml, fixed backward (child-to-parent) pointer handling to get and set attribute values properly
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.