/** * Attempts to parse the input xml into a single element. * @param xml * @return The document object * @throws XmlException if a parse error occured. */ public static Element parse(String xml) throws XmlException { DocumentBuilder builder = null; try { builder = getBuilder(); InputSource is = new InputSource(new StringReader(xml.trim())); return builder.parse(is).getDocumentElement(); } catch (SAXParseException e) { throw new XmlException( e.getMessage() + " At: (" + e.getLineNumber() + ',' + e.getColumnNumber() + ')', e); } catch (SAXException e) { throw new XmlException(e); } catch (ParserConfigurationException e) { throw new XmlException(e); } catch (IOException e) { throw new XmlException(e); } finally { // Remove reference to XmlUtils class to insure classes can be unloaded if (builder != null) { builder.setErrorHandler(null); } } }
/** * Constructs a message bundle from input xml (fetched from an external file). * * @param locale The LocaleSpec element that this bundle was constructed from. * @param xml The content of the remote file. * @throws SpecParserException if parsing fails. */ public MessageBundle(LocaleSpec locale, String xml) throws SpecParserException { Element doc; try { doc = XmlUtil.parse(xml); } catch (XmlException e) { throw new SpecParserException("Malformed XML in file " + locale.getMessages() + ": " + e.getMessage()); } messages = parseMessages(doc); languageDirection = locale.getLanguageDirection(); }
/** * Constructs a message bundle from input xml (fetched from an external file). * * @param locale The LocaleSpec element that this bundle was constructed from. * @param xml The content of the remote file. * @throws SpecParserException if parsing fails. */ public MessageBundle(LocaleSpec locale, String xml) throws SpecParserException { Element doc; try { doc = XmlUtil.parse(xml); } catch (XmlException e) { throw new SpecParserException("Malformed XML in file " + locale.getMessages() + ": " + e.getMessage()); } messages = parseMessages(doc); languageDirection = locale.getLanguageDirection(); }
/** * Attempts to parse the input xml into a single element. * @param xml * @return The document object * @throws XmlException if a parse error occured. */ public static Element parse(String xml) throws XmlException { DocumentBuilder builder = null; try { builder = getBuilder(); InputSource is = new InputSource(new StringReader(xml.trim())); return builder.parse(is).getDocumentElement(); } catch (SAXParseException e) { throw new XmlException( e.getMessage() + " At: (" + e.getLineNumber() + ',' + e.getColumnNumber() + ')', e); } catch (SAXException e) { throw new XmlException(e); } catch (ParserConfigurationException e) { throw new XmlException(e); } catch (IOException e) { throw new XmlException(e); } finally { // Remove reference to XmlUtils class to insure classes can be unloaded if (builder != null) { builder.setErrorHandler(null); } } }
/** * Constructs a message bundle from input xml (fetched from an external file). * * @param locale The LocaleSpec element that this bundle was constructed from. * @param xml The content of the remote file. * @throws SpecParserException if parsing fails. */ public MessageBundle(LocaleSpec locale, String xml) throws SpecParserException { Element doc; try { doc = XmlUtil.parse(xml); } catch (XmlException e) { throw new SpecParserException("Malformed XML in file " + locale.getMessages() + ": " + e.getMessage()); } messages = parseMessages(doc); languageDirection = locale.getLanguageDirection(); }
/** * Attempts to parse the input xml into a single element. * @param xml * @return The document object * @throws XmlException if a parse error occured. */ public static Element parse(String xml) throws XmlException { DocumentBuilder builder = null; try { builder = getBuilder(); InputSource is = new InputSource(new StringReader(xml.trim())); return builder.parse(is).getDocumentElement(); } catch (SAXParseException e) { throw new XmlException( e.getMessage() + " At: (" + e.getLineNumber() + ',' + e.getColumnNumber() + ')', e); } catch (SAXException e) { throw new XmlException(e); } catch (ParserConfigurationException e) { throw new XmlException(e); } catch (IOException e) { throw new XmlException(e); } finally { // Remove reference to XmlUtils class to insure classes can be unloaded if (builder != null) { builder.setErrorHandler(null); } } }
/** * Attempts to parse the input xml into a single element. * @param xml * @return The document object * @throws XmlException if a parse error occured. */ public static Element parse(String xml) throws XmlException { DocumentBuilder builder = null; try { builder = getBuilder(); InputSource is = new InputSource(new StringReader(xml.trim())); return builder.parse(is).getDocumentElement(); } catch (SAXParseException e) { throw new XmlException( e.getMessage() + " At: (" + e.getLineNumber() + ',' + e.getColumnNumber() + ')', e); } catch (SAXException e) { throw new XmlException(e); } catch (ParserConfigurationException e) { throw new XmlException(e); } catch (IOException e) { throw new XmlException(e); } finally { // Remove reference to XmlUtils class to insure classes can be unloaded if (builder != null) { builder.setErrorHandler(null); } } }
/** * Attempts to parse the input xml into a single element. * @param xml * @return The document object * @throws XmlException if a parse error occured. */ public static Element parse(String xml) throws XmlException { DocumentBuilder builder = null; try { builder = getBuilder(); InputSource is = new InputSource(new StringReader(xml.trim())); return builder.parse(is).getDocumentElement(); } catch (SAXParseException e) { throw new XmlException( e.getMessage() + " At: (" + e.getLineNumber() + ',' + e.getColumnNumber() + ')', e); } catch (SAXException e) { throw new XmlException(e); } catch (ParserConfigurationException e) { throw new XmlException(e); } catch (IOException e) { throw new XmlException(e); } finally { // Remove reference to XmlUtils class to insure classes can be unloaded if (builder != null) { builder.setErrorHandler(null); } } }
throw new SpecParserException(new XmlException(ele));
throw new SpecParserException(new XmlException(ele));
throw new SpecParserException(new XmlException(ele));