This paper presents a learning-based method to solve the traditional parameterization and knot placement problems in B-spline approximation. Different from conventional heuristic methods or recent AI-based methods, the proposed method does not assume ordered or fixed-size data points as input. There is also no need for manually setting the number of knots. Parameters and knots are generated in an associative way to attain better parameter-knot alignment, and therefore a higher approximation accuracy. These features are attained by using a new generative model SplineGen, which casts the parameterization and knot placement problems as a sequence-to-sequence translation problem. It first adopts a shared autoencoder model to learn a 512-D embedding for each input point, which has the local neighborhood information implicitly captured. Then these embeddings are autoregressively decoded into parameters and knots by two associative decoders, a generative process automatically determining the number of knots, their placement, parameter values, and their ordering. The two decoders are made to work in a coordinated manner by a new network module called internal cross-attention. Once trained, SplineGen demonstrates a notable improvement over existing methods, with one to two orders of magnitude increase in approximation accuracy on test data.