<p>
の子であるfirst のテキスト コンテンツを取得する必要があるため<div class="about">
、次のコードを記述しました。
tagTextS :: IOSArrow XmlTree String
tagTextS = getChildren >>> getText >>> arr stripString
parseDescription :: IOSArrow XmlTree String
parseDescription =
(
deep (isElem >>> hasName "div" >>> hasAttrValue "id" (== "company_about_full_description"))
>>> (arr (\x -> x) /> isElem >>> hasName "p") >. (!! 0) >>> tagTextS
) `orElse` (constA "")
これを見てください。これarr (\x -> x)
がなければ、結果を出すことができませんでした。
- より良い書き方はあり
parseDescription
ますか? - 別の質問は、なぜ前後に括弧が必要なの
arr
ですhasName "p"
か? (私は実際にこの解決策を見つけましたhere)