如何在HXT中提取XML树的特定分支

时间:2015-04-24 13:20:23

标签: xml haskell hxt

举个例子:

<pous>
  <pou>
    <interface>
      ...
    </interface>
    <body>
      <FBD>
        ...
      </FBD>
    </body>
  </pou>
  <pou>
    <interface>
      ...
    </interface>
    <body>
      <SFC>
        ...
      </SFC>
    </body>
  </pou>
</pous>

我知道如何获得所有&#34; pou&#34;使用atTag函数:

atTag:: (ArrowXml a) => String -> a XmlTree XmlTree
atTag tag = deep (isElem >>> hasName tag)

但是如何只提取&#34; pou&#34;使用SFC标签?有干净的方法吗?

提前谢谢!

2 个答案:

答案 0 :(得分:1)

您希望在此示例中使用public void loadBitmap(String url) { if (loadtarget == null) loadtarget = new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { // do something with the Bitmap handleLoadedBitmap(bitmap); } @Override public void onBitmapFailed(Drawable drawable) { } @Override public void onPrepareLoad(Drawable drawable) { } }; Picasso.with(activity).load(url).into(loadtarget); } public void handleLoadedBitmap(Bitmap b) { // do something here thumb_image.setImageBitmap(b); thumb_image.getLayoutParams().height = activity.getResources().getDrawable(R.drawable.editimage).getIntrinsicHeight(); thumb_image.getLayoutParams().width = activity.getResources().getDrawable(R.drawable.editimage).getIntrinsicWidth(); }

filterA

答案 1 :(得分:0)

尝试使用Haskell XPath和:

/*/pou[body[SFC]]

进一步参考"XPath find all elements with specific child node"