how to create a fully-expandable environment [closed]

I know DeclareDocumentCommand from the package xparse. I am wondering if there is a version for environment ? I could also imagine a trick based on :

• declare the environment with DeclareDocumentEnvironment
• then redefine the "begin" part of the environment with DeclareExpandableDocumentCommand

How safe is it ?

EDIT1 The aim of this the following : i have a macro \content which i need to fully expand (in a \edef). Unfortunately, the replacement text of this macro contains several commands and environments. For example

\newcommand{\content}{blabla \textbf{text} blabla \othercommand[3]{text}    \begin{tabular} AA&BB\\CC&DD \end{tabular} blabla ...}


I just need to extract the arguments of each command and environment contained in \content. For this i redefine them, eg

\def\textbf#1{<bold>#1</bold>}


For the commands with optional parameters, I redefine them with DeclareDocumentCommand. But for environments, i don't knoy how to proceed.

-

closed as not a real question by egreg, Joseph Wright♦Feb 2 '13 at 21:10

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Can't be done. An environment forms a group, and grouping (\begingroup/\endgroup) is not expandable. Also, tracking environment nesting requires an assignment. –  Joseph Wright Jun 22 '12 at 10:26
What precisely do you want to achieve? –  egreg Jun 22 '12 at 13:07
@egreg: please see my edit. –  nicolas roy Jun 24 '12 at 14:48
What should the contents of the tabular environment become? You can say \def\begin#1{\csname #1\endcsname} and \def\tabular#1#2\end{tabular}{<tabular=#1>#2</tabular>} but I guess it won't be sufficient. Writing a parser for generic tabular environments is not something I would endeavor. –  egreg Jun 24 '12 at 15:00
@egreg: I don't understand the need of \def\begin#1{\csname #1\endcsname} ; I though \begin{env} does precisely \env. What did i miss ? –  nicolas roy Jun 24 '12 at 15:43