I have to create another xml doc with the properties of nodes from the first doc. For the new doc I have to create a parent node
called "definitions". Instead of the "model" node in the first doc I have to create a "process" node in the new doc that has an
attribute "id" which value is the same as the content of the "id" child node of model. For each "nodes" node in the first doc
if their "stencil" child node content equals "TASK" I create a "task" node in the new xml doc.

I just wanted to know if this is the correct way to define the respective classes.
Can anyone tell me any way to create and fill the nodes for the new doc using this
classes?
I am used with DOM parser and I know how to create nodes and fill attribute values,
but I have always done this job in a single class, not using different classes for the
elements.

Re: How to create new XML DOC with properties from an existing one?

(Next time it'll be helpful to state here other forums where you have cross-posted your question so that if it has already been answered elsewhere, there's no need for anyone to spend time here. Ditto vice versa.)

I agree with gimbal2... it is quite strange that if you have written the above code, you surely must know how you would be use it. Therefore please provide further context behind your question - what are you working on, and how did the above code come about.

To help you get started with this, the following is an outline of what you'll need to do.

Call the extractProcess method in the Definitions object to get a Process object. (You can do some println()s against the Process object at this point to check you've done this correctly.)

Call the extractTasks method in the Process object to get an ArrayList of Task objects. (At this point you can iterate through the ArrayList, and println() each Task objet to check you've done this correctly.)