java - Best Practice for large XML file builder -


i have build xml file input soap service in java. input xml can consist of @ least 1000 tags. best way build xml? have xsd files bit complicated use jaxb. xmlstreamwriter option that?

xmlstreamwriter 1 of better apis use writing xml java application, has few quirks (e.g. namespace handling bit bizarre) , may find worthwhile wrap in convenience api knows kind of document writing, e.g. namespaces uses.

one of advantages of xmlstreamwriter interface there plenty of implementations choose from. example saxon has implementation gives full control on xslt/xquery serialization options plus saxon extensions (for example, can control output order of attributes!)

one of problems hit event-based apis sooner or later find forgetting write end tag, , can quite tricky debug. using wrapper api forces include element name in call on endelement() can useful debugging; if debugging switched on can keep stack of element names , check endelement() writing right tag; debugging switched off drop check.

serializing using jaxb higher-level, of course, downside gives less control.