summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2016-08-05 18:18:03 +0000
committerptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2016-08-05 18:18:03 +0000
commitc73ab617c0d090ab29d3ef9a940abe435cbcb51b (patch)
tree368681a56c373a120980e1c1896f553d1eeef36d
parent18e800d48d3e1c5298c11ae1dce9a6517bad7fd9 (diff)
downloadpyparsing-c73ab617c0d090ab29d3ef9a940abe435cbcb51b.tar.gz
Deprecated ParseResults.asXML
git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/trunk@386 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b
-rw-r--r--src/CHANGES12
-rw-r--r--src/pyparsing.py4
2 files changed, 14 insertions, 2 deletions
diff --git a/src/CHANGES b/src/CHANGES
index 877114f..823ad88 100644
--- a/src/CHANGES
+++ b/src/CHANGES
@@ -22,6 +22,18 @@ Version 2.1.6 -
while the generic "number" is similar to the flexible number syntax
in other languages.
+- Deprecated ParseResults.asXML. I've never been too happy with this
+ method, and it usually forces some unnatural code in the parsers in
+ order to get decent tag names. The amount of guesswork that asXML
+ has to do to try to match names with values should have been a red
+ flag from day one. If you are using asXML, you will need to implement
+ your own ParseResults->XML serialization. Or consider migrating to
+ a more current format such as JSON (which is very easy to do:
+ results_as_json = json.dumps(parse_result.asDict()) Hopefully, when
+ I remove this code in a future version, I'll also be able to simplify
+ some of the craziness in ParseResults, which IIRC was only there to try
+ to make asXML work.
+
- Updated traceParseAction parse action decorator to show the repr
of the input and output tokens, instead of the str format, since
str has been simplified to just show the token list content.
diff --git a/src/pyparsing.py b/src/pyparsing.py
index 9f637c6..0f658b0 100644
--- a/src/pyparsing.py
+++ b/src/pyparsing.py
@@ -58,7 +58,7 @@ The pyparsing module handles some of the problems that are typically vexing when
"""
__version__ = "2.1.6"
-__versionTime__ = "05 Aug 2016 18:01 UTC"
+__versionTime__ = "05 Aug 2016 18:11 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -592,7 +592,7 @@ class ParseResults(object):
return ret
def asXML( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ):
- """Returns the parse results as XML. Tags are created for tokens and lists that have defined results names."""
+ """(Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names."""
nl = "\n"
out = []
namedItems = dict((v[1],k) for (k,vlist) in self.__tokdict.items()