Better Approach to Code?

S

Steve Green

Which is the preferred way to write XML files?

I have old code where there is a writeXML(Writer w) method in my class
hierarchy that loops from the top down through each class. Each class has
this method.

I am rewriting the code and am considering removing the methods from my data
and putting them in a special class that then traverses the hierarchy and
prints the XML file.

Any thoughts?
 
G

gpl

I would leave it the way it is with each class being able to print out
its own xml code. This way you can reuse the classes in other projects
without additional coding as they already have their output function .

This is the method I use:

public String toStirngXML( int tabs ) // takes care of indenting and
makes it people readable

Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top