[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] How to use xml src block as data input?
From: |
Simonyi András |
Subject: |
Re: [O] How to use xml src block as data input? |
Date: |
Mon, 30 Apr 2018 09:47:32 +0000 |
Hello,
if having the data in a source block is a must, then, as a last resort,
you might try to pull the block's content from the buffer's parse tree:
#+begin_src emacs-lisp :var src-block-name="xml-sample"
(let ((xml-str
(org-element-map (org-element-parse-buffer) 'src-block
(lambda (x)
(and (string= src-block-name (org-element-property :name x))
(org-element-property :value x)))
nil t)))
(with-temp-buffer (insert xml-str) (libxml-parse-xml-region (point-min)
(point-max))))
#+end_src
On Mon, 30 Apr 2018 at 05:43, stardiviner <address@hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> Thanks, I forgot to mention I know example block can be used as input.
> But this will lose the syntax highlighting. If there is no better
solution.
> I guess it is the best for now.
> - --
> [ stardiviner ] don't need to convince with trends.
> Blog: https://stardiviner.github.io/
> IRC(freenode): stardiviner
> GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
> -----BEGIN PGP SIGNATURE-----
> iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrmkL0ACgkQG13xyVro
> msOU6gf/UNiTzSt8Cizpk1FLBjJJiqOMfWdvp+jJVoNOCJzaxkHFAiwjbEyIf9B5
> k27Zw3Gh60rT0iz/RYscptv2keTieUwU0rf23oyouFESgIBaICfRRYzZZ0ZUWTHO
> 9VGILsaQfOZfO4lenZGMnWGt583DCV1CxEqcODQj2Z7DFb8EfxvRiGup9qPjMSVq
> 65gu7/Vk2Y2d+cvUZU7t592b7D/5na5Dxy0jkuAEttXjoJrk4OHoxcmYMjbnoimq
> DSUyu467YqtKKyyOgC8hEnatarkItDp6O5v/P8Ki/iVV5zSTiqkhriQYI9k/sPTV
> xmI9WZEFOB5A8auvw9csQTUUny2Mjw==
> =qQac
> -----END PGP SIGNATURE-----