Docx reader utils: handle empty namespace in elemName
Previously, if given an empty namespace: (elemName ns "" "foo") `elemName` would output a QName with a `Just ""` namespace. This is never what we want. Now we output a `Nothing`. If someone *does* want a `Just ""` in the namespace, they can enter the QName value explicitly.
This commit is contained in:
parent
bdda4b185b
commit
1138ae6656
1 changed files with 2 additions and 1 deletions
|
@ -18,7 +18,8 @@ attrToNSPair (Attr (QName s _ (Just "xmlns")) val) = Just (s, val)
|
|||
attrToNSPair _ = Nothing
|
||||
|
||||
elemName :: NameSpaces -> String -> String -> QName
|
||||
elemName ns prefix name = QName name (lookup prefix ns) (Just prefix)
|
||||
elemName ns prefix name =
|
||||
QName name (lookup prefix ns) (if null prefix then Nothing else Just prefix)
|
||||
|
||||
isElem :: NameSpaces -> String -> String -> Element -> Bool
|
||||
isElem ns prefix name element =
|
||||
|
|
Loading…
Add table
Reference in a new issue