/** * Given a DICOM object encoded as an XML document in a named file convert it to a list of * attributes. * * @param name the input file containing the XML document * @return the list of DICOM attributes * @exception IOException * @exception SAXException * @exception DicomException */ public AttributeList getAttributeList(String name) throws IOException, SAXException, DicomException { InputStream fi = new FileInputStream(name); BufferedInputStream bi = new BufferedInputStream(fi); AttributeList list = null; try { list = getAttributeList(bi); } finally { bi.close(); fi.close(); } return list; }
/** * Read a URL into SAX events. * * @param systemId system id of the document * @param xmlReceiver receiver to output to * @param parserConfiguration parser configuration * @param handleLexical whether the XML parser must output SAX LexicalHandler events, including * comments */ public static void urlToSAX( String systemId, XMLReceiver xmlReceiver, XMLUtils.ParserConfiguration parserConfiguration, boolean handleLexical) { try { final URL url = URLFactory.createURL(systemId); final InputStream is = url.openStream(); final InputSource inputSource = new InputSource(is); inputSource.setSystemId(systemId); try { inputSourceToSAX(inputSource, xmlReceiver, parserConfiguration, handleLexical); } finally { is.close(); } } catch (IOException e) { throw new OXFException(e); } }