Java Code Examples for org.xml.sax.SAXException#getMessage()
The following examples show how to use
org.xml.sax.SAXException#getMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TraxSource.java From lams with GNU General Public License v2.0 | 6 votes |
private void configureXMLReader() { if (this.xmlReader != null) { try { if (this.xstream != null) { this.xmlReader.setProperty( SaxWriter.CONFIGURED_XSTREAM_PROPERTY, this.xstream); } if (this.source != null) { this.xmlReader.setProperty( SaxWriter.SOURCE_OBJECT_LIST_PROPERTY, this.source); } } catch (SAXException e) { throw new IllegalArgumentException(e.getMessage()); } } }
Example 2
Source File: XmlSerializer.java From uima-uimaj with Apache License 2.0 | 6 votes |
/** * Serialize an element named name, with the indicated attributes and value. * * @param name is the element name * @param attributes are the attributes...serializer is free to add more. * @param value is the value * @param context is the SerializationContext * @throws IOException Signals that an I/O exception has occurred. */ @Override public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException { if (value instanceof XMLizable) { try { // System.out.println("AxisResourceServiceSerializer::serialize(" + name + ")"); context.startElement(name, attributes); SerializerContentHandler contentHandler = new SerializerContentHandler(context); ((XMLizable) value).toXML(contentHandler); context.endElement(); } catch (SAXException e) { throw new IOException("SAXException: " + e.getMessage()); } } else { throw new IOException("Can't serialize a " + value.getClass().getName() + " with an XmlSerializer."); } }
Example 3
Source File: DocumentBuilderFactoryImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Creates a new instance of a {@link javax.xml.parsers.DocumentBuilder} * using the currently configured parameters. */ public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { /** Check that if a Schema has been specified that neither of the schema properties have been set. */ if (grammar != null && attributes != null) { if (attributes.containsKey(JAXPConstants.JAXP_SCHEMA_LANGUAGE)) { throw new ParserConfigurationException( SAXMessageFormatter.formatMessage(null, "schema-already-specified", new Object[] {JAXPConstants.JAXP_SCHEMA_LANGUAGE})); } else if (attributes.containsKey(JAXPConstants.JAXP_SCHEMA_SOURCE)) { throw new ParserConfigurationException( SAXMessageFormatter.formatMessage(null, "schema-already-specified", new Object[] {JAXPConstants.JAXP_SCHEMA_SOURCE})); } } try { return new DocumentBuilderImpl(this, attributes, features, fSecureProcess); } catch (SAXException se) { // Handles both SAXNotSupportedException, SAXNotRecognizedException throw new ParserConfigurationException(se.getMessage()); } }
Example 4
Source File: DocumentBuilderImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public boolean isValidating() { try { return domParser.getFeature(VALIDATION_FEATURE); } catch (SAXException x) { throw new IllegalStateException(x.getMessage()); } }
Example 5
Source File: AttributeWeights.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** Loads a new AttributeWeights object from the given XML file. */ public static AttributeWeights load(File file) throws IOException { AttributeWeights result = new AttributeWeights(); Document document = null; try { document = XMLTools.createDocumentBuilder().parse(file); } catch (SAXException e1) { throw new IOException(e1.getMessage()); } Element attributeWeightsElement = document.getDocumentElement(); if (!attributeWeightsElement.getTagName().equals("attributeweights")) { throw new IOException("Outer tag of attribute weights file must be <attributeweights>"); } NodeList weights = attributeWeightsElement.getChildNodes(); for (int i = 0; i < weights.getLength(); i++) { Node node = weights.item(i); if (node instanceof Element) { Element weightTag = (Element) node; String tagName = weightTag.getTagName(); if (!tagName.equals("weight")) { throw new IOException("Only tags <weight> are allowed, was " + tagName); } String name = weightTag.getAttribute("name"); String value = weightTag.getAttribute("value"); double weight = 1.0d; try { weight = Double.parseDouble(value); } catch (NumberFormatException e) { throw new IOException("Only numerical weights are allowed for the 'value' attribute."); } result.setWeight(name, weight); } } return result; }
Example 6
Source File: SAXParserImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public boolean isNamespaceAware() { try { return xmlReader.getFeature(NAMESPACES_FEATURE); } catch (SAXException x) { throw new IllegalStateException(x.getMessage()); } }
Example 7
Source File: SAXParserFactoryImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates a new instance of <code>SAXParser</code> using the currently * configured factory parameters. * @return javax.xml.parsers.SAXParser */ public SAXParser newSAXParser() throws ParserConfigurationException { SAXParser saxParserImpl; try { saxParserImpl = new SAXParserImpl(this, features, fSecureProcess); } catch (SAXException se) { // Translate to ParserConfigurationException throw new ParserConfigurationException(se.getMessage()); } return saxParserImpl; }
Example 8
Source File: SAXParserImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public boolean isValidating() { try { return xmlReader.getFeature(VALIDATION_FEATURE); } catch (SAXException x) { throw new IllegalStateException(x.getMessage()); } }
Example 9
Source File: SAXParserImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public boolean isNamespaceAware() { try { return xmlReader.getFeature(NAMESPACES_FEATURE); } catch (SAXException x) { throw new IllegalStateException(x.getMessage()); } }
Example 10
Source File: DocumentBuilderImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public boolean isNamespaceAware() { try { return domParser.getFeature(NAMESPACES_FEATURE); } catch (SAXException x) { throw new IllegalStateException(x.getMessage()); } }
Example 11
Source File: DocumentBuilderImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public boolean isNamespaceAware() { try { return domParser.getFeature(NAMESPACES_FEATURE); } catch (SAXException x) { throw new IllegalStateException(x.getMessage()); } }
Example 12
Source File: DocumentBuilderImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public boolean isValidating() { try { return domParser.getFeature(VALIDATION_FEATURE); } catch (SAXException x) { throw new IllegalStateException(x.getMessage()); } }
Example 13
Source File: XPathWhiteSpaceTest.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { try{ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(new File(System.getProperty("test.src", "."), XSDFILE)); } catch (SAXException e) { throw new RuntimeException(e.getMessage()); } }
Example 14
Source File: XPathWhiteSpaceTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { try{ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(new File(System.getProperty("test.src", "."), XSDFILE)); } catch (SAXException e) { throw new RuntimeException(e.getMessage()); } }
Example 15
Source File: SAXParserFactoryImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Creates a new instance of <code>SAXParser</code> using the currently * configured factory parameters. * @return javax.xml.parsers.SAXParser */ public SAXParser newSAXParser() throws ParserConfigurationException { SAXParser saxParserImpl; try { saxParserImpl = new SAXParserImpl(this, features, fSecureProcess); } catch (SAXException se) { // Translate to ParserConfigurationException throw new ParserConfigurationException(se.getMessage()); } return saxParserImpl; }
Example 16
Source File: ParameterSet.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** Reads a parameter set from a file. */ public static ParameterSet readParameterSet(InputStream in) throws IOException { ParameterSet parameterSet = new ParameterSet(); Document document = null; try { document = XMLTools.createDocumentBuilder().parse(in); } catch (SAXException e) { throw new IOException(e.getMessage()); } Element parametersElement = document.getDocumentElement(); if (!parametersElement.getTagName().equals("parameterset")) { throw new IOException("Outer tag of parameter set file must be <parameterset>"); } NodeList parameters = parametersElement.getChildNodes(); for (int i = 0; i < parameters.getLength(); i++) { Node node = parameters.item(i); if (node instanceof Element) { Element parameterTag = (Element) node; String tagName = parameterTag.getTagName(); if (!tagName.equals("parameter")) { throw new IOException("Only tags <parameter> are allowed, was " + tagName); } String operatorName = parameterTag.getAttribute("operator"); String parameterKey = parameterTag.getAttribute("key"); String parameterValue = parameterTag.getAttribute("value"); parameterSet.parameterValues.add(new ParameterValue(operatorName, parameterKey, parameterValue)); } } return parameterSet; }
Example 17
Source File: ErrorHandlerWrapper.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** Creates an XNIException from a SAXException. NOTE: care should be taken *not* to call this with a SAXParseException; this will lose information!!! */ protected static XNIException createXNIException(SAXException exception) { return new XNIException(exception.getMessage(),exception); }
Example 18
Source File: ErrorHandlerWrapper.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** Creates an XNIException from a SAXException. NOTE: care should be taken *not* to call this with a SAXParseException; this will lose information!!! */ protected static XNIException createXNIException(SAXException exception) { return new XNIException(exception.getMessage(),exception); }
Example 19
Source File: ErrorHandlerWrapper.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** Creates an XNIException from a SAXException. NOTE: care should be taken *not* to call this with a SAXParseException; this will lose information!!! */ protected static XNIException createXNIException(SAXException exception) { return new XNIException(exception.getMessage(),exception); }
Example 20
Source File: ErrorHandlerWrapper.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** Creates an XNIException from a SAXException. NOTE: care should be taken *not* to call this with a SAXParseException; this will lose information!!! */ protected static XNIException createXNIException(SAXException exception) { return new XNIException(exception.getMessage(),exception); }