From ef8ba559efdef989a5c608ac40635410500395df Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 7 Dec 2010 11:30:05 +0100 Subject: Implement namespace axis Namespace nodes are represented as `#xmlNsNode` records. Now that the namespace axis is correctly implemented, attributes nodes corresponding to attributes that declare namespaces are ignored. See [5.3 Attribute Nodes][xpath-5.3]: > There are no attribute nodes corresponding to attributes > that declare namespaces. [xpath-5.3]: http://www.w3.org/TR/xpath/#attribute-nodes --- lib/xmerl/src/xmerl_xpath_pred.erl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/xmerl/src/xmerl_xpath_pred.erl') diff --git a/lib/xmerl/src/xmerl_xpath_pred.erl b/lib/xmerl/src/xmerl_xpath_pred.erl index 9ad7925111..855b8599fe 100644 --- a/lib/xmerl/src/xmerl_xpath_pred.erl +++ b/lib/xmerl/src/xmerl_xpath_pred.erl @@ -337,6 +337,9 @@ local_name1([#xmlNode{type=element,node=El}|_]) -> local_name1([#xmlNode{type=attribute,node=Att}|_]) -> #xmlAttribute{name=Name,nsinfo=NSI} = Att, local_name2(Name,NSI); +local_name1([#xmlNode{type=namespace,node=N}|_]) -> + #xmlNsNode{prefix=Prefix} = N, + ?string(Prefix); local_name1([#xmlElement{name = Name, nsinfo = NSI}|_]) -> local_name2(Name,NSI). local_name2(Name, NSI) -> @@ -431,6 +434,9 @@ string_value(N=#xmlObj{}) -> string_value(A=#xmlNode{type=attribute}) -> #xmlAttribute{value=AttVal}=A#xmlNode.node, ?string(AttVal); +string_value(N=#xmlNode{type=namespace}) -> + #xmlNsNode{uri=URI}=N#xmlNode.node, + ?string(atom_to_list(URI)); string_value(El=#xmlNode{type=element}) -> #xmlElement{content=C} = El#xmlNode.node, TextValue = fun(#xmlText{value=T},_Fun) -> T; -- cgit v1.2.3