Alas, this does not solve the problem, iff I am following your suggestion correctly.

I did
\xmlloadbuffer{thebuffer}{\xmlatt{#1}{buffer}}
\xmlfilter{thebuffer}{*/context()}
\useMPgraphic..

This works for a buffer content enclosed in any node:
\startbuffer[ychannel]
<anyone>  <========= cannot be omitted
\startuseMPgraphic{}{}
..
\stopuseMPgraphic
</anyone>  <========= cannot be omitted
\stopbuffer

But it does not work when the content is not enclosed in a node, which is my input case:
\startbuffer[ychannel]
\startuseMPgraphic{}{}
..
\stopuseMPgraphic
\stopbuffer
Now the xml is judged invalid by running it.

In the case of a file there is a circumvention through directlua. There I can os.execute a chain of commands: echo "<node>" >tmp;cat file >>tmp;echo "<node>" >>tmp and then \xmlprocessfile the tmp. A bit of a kludge, I am ready to admit, but working. But I don't see how to do this with buffers.

Hans van der Meer



On 7 May 2013, at 7:39 PM, Hans Hagen <pragma@wxs.nl> wrote:

On 5/7/2013 5:30 PM, Meer, H. van der wrote:
With \xmlload{myroot}{file} I can load an xml file and the execute on its nodes.
However what to do if the file is not of the form <root>file-contents</root>?
In that case it would help if I could contruct a node with with some actions like:
<root>\input{fileconytents</root> and then operate with xml commands on that <root> node.

Can this be accomplished?

you can just filter the node ..

\xmlfilter{#myroot}{/some/element .....