diff options
author | Ulf Wiger <[email protected]> | 2010-10-25 16:35:06 +0200 |
---|---|---|
committer | Lars Thorsen <[email protected]> | 2011-01-24 14:32:06 +0100 |
commit | 4e28e50fbfbccba4d35197e21337655107ff0247 (patch) | |
tree | b7c776b7cc9224c59630bae1ef4528434009e3ca | |
parent | c9aae9e6874950c671c08940d4e72abc616c550e (diff) | |
download | otp-4e28e50fbfbccba4d35197e21337655107ff0247.tar.gz otp-4e28e50fbfbccba4d35197e21337655107ff0247.tar.bz2 otp-4e28e50fbfbccba4d35197e21337655107ff0247.zip |
Track parents when expanding #xmlElement records
The function xmerl_lib:expand_content/1 is mainly for expanding
Simple XML, but can also handle xmerl records. This patch fixes
an omission that caused expand_content/1 to not maintain the
'parents' list when expanding #xmlElement{} records.
No test cases written, since the xmerl test suites have not yet been
released.
-rw-r--r-- | lib/xmerl/src/xmerl_lib.erl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/xmerl/src/xmerl_lib.erl b/lib/xmerl/src/xmerl_lib.erl index 7b76a76a33..1b3a7e57f0 100644 --- a/lib/xmerl/src/xmerl_lib.erl +++ b/lib/xmerl/src/xmerl_lib.erl @@ -148,9 +148,10 @@ expand_element(Element) -> expand_element(Element, Pos, Parents) -> expand_element(Element, Pos, Parents, false). -expand_element(E = #xmlElement{}, Pos, Parents, Norm) -> - Content = expand_content(E#xmlElement.content, 1, Parents, Norm), - Attrs = expand_attributes(E#xmlElement.attributes, 1, []), +expand_element(E = #xmlElement{name = N}, Pos, Parents, Norm) -> + NewParents = [{N,Pos}|Parents], + Content = expand_content(E#xmlElement.content, 1, NewParents, Norm), + Attrs = expand_attributes(E#xmlElement.attributes, 1, NewParents), E#xmlElement{pos = Pos, parents = Parents, attributes = Attrs, |