[Haskell-cafe] Re: HXT Namespaces and XPath
mads_lindstroem at yahoo.dk
Tue Apr 6 14:46:09 EDT 2010
Replying to myself:
> I think another example will clarify my point. The code:
> simpleXmlOne, simpleXmlTwo :: String
> simpleXmlOne = "<a:Foo xmlns:a=\"http://foo.org\"/>"
> simpleXmlTwo = "<b:Foo xmlns:b=\"http://foo.org\"/>"
> nsEnv :: [(String, String)]
> nsEnv = [ ("notFoo" , "http://notfoo.org") ]
> evalXPath :: String -> [XmlTree]
> evalXPath xml =
> runLA ( xread
> >>> propagateNamespaces
> >>> getXPathTreesWithNsEnv nsEnv "//a:Foo"
> ) xml
> Now notice that simpleXmlOne and simpleXmlTwo are equivalent. Yes, they
> have a different prefix for "http://foo.org", but the documents means
> the same. And as you write yourself, "... the prefix is no longer
> releavant ..." Yet:
> evalXPath simpleXmlOne /= evalXPath simpleXmlTwo
Just to clarify things. The point I am making is that:
getXPathTreesWithNsEnv nsEnv "//a:Foo"
do not only see the prefixes in 'nsEnv', but also the prefixes in the
XML it is applied to. I think that the getXPathTreesWithNsEnv function
should only see the prefixes mentioned in its first parameter.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100406/a15a4de9/attachment.bin
More information about the Haskell-Cafe