Class XMLRepresentationOfStructuredReportObjectFactory

java.lang.Object
com.pixelmed.dicom.XMLRepresentationOfStructuredReportObjectFactory

public class XMLRepresentationOfStructuredReportObjectFactory extends Object

A class to encode a representation of a DICOM Structured Report object in an XML form, suitable for analysis as human-readable text, or for feeding into an XSLT-based validator.

Note that XML representations can either contain only the content tree, or also the additional top level DICOM attributes other than those that encode the content tree, as individual DICOM attributes, in the manner of XMLRepresentationOfDicomObjectFactory.

A typical example of usage to extract just the content tree would be:

try {
    AttributeList list = new AttributeList();
    list.read("dicomsrfile",null,true,true);
        StructuredReport sr = new StructuredReport(list);
    Document document = new XMLRepresentationOfStructuredReportObjectFactory().getDocument(sr);
    XMLRepresentationOfStructuredReportObjectFactory.write(System.out,document);
} catch (Exception e) {
    slf4jlogger.error("",e);
 }
 

or to include the top level attributes as well as the content tree, supply the attribute list as well as the parsed SR content to the write() method:

try {
    AttributeList list = new AttributeList();
    list.read("dicomsrfile",null,true,true);
        StructuredReport sr = new StructuredReport(list);
    Document document = new XMLRepresentationOfStructuredReportObjectFactory().getDocument(sr,list);
    XMLRepresentationOfStructuredReportObjectFactory.write(System.out,document);
} catch (Exception e) {
    slf4jlogger.error("",e);
 }
 

or even simpler, if there is no further use for the XML document or the SR tree model:

try {
    AttributeList list = new AttributeList();
    list.read("dicomsrfile",null,true,true);
    XMLRepresentationOfStructuredReportObjectFactory.createDocumentAndWriteIt(list,System.out);
} catch (Exception e) {
    slf4jlogger.error("",e);
 }
 
See Also: