  In the regime of weak nonlinearity we present two general feasible schemes.
One is an entangler for generating any one of the $n$-photon
Greenberger-Horne-Zeilinge (GHZ) states and Bell states. After the interactions
with cross-Kerr nonlinear media, a phase gate followed by a measurement on the
probe beam, and appropriate local operations via classical feed-forward, one
can obtain the desired states in a nearly deterministic way. Another scheme is
an analyzer for multiphoton maximally entangled states, which is taken as a
further application of the above entangler. In this scheme, all of the $2^n$
$n$-photon GHZ states can, nearly deterministically, be discriminated.
Furthermore, an efficient two-step nondestructive Bell-state analyzer is
designed.
