org.xml.sax.SAXException#getMessage ( )源码实例Demo

下面列出了org.xml.sax.SAXException#getMessage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lams   文件: TraxSource.java
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());
        }
    }
}
 
源代码2 项目: uima-uimaj   文件: XmlSerializer.java
/**
 * 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.");
  }
}
 
/**
 * 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());
    }
}
 
源代码4 项目: rapidminer-studio   文件: ParameterSet.java
/** 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;
}
 
/**
 * 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;
}
 
源代码6 项目: openjdk-jdk8u   文件: XPathWhiteSpaceTest.java
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());
    }


}
 
源代码7 项目: hottub   文件: XPathWhiteSpaceTest.java
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());
    }


}
 
源代码8 项目: openjdk-8   文件: DocumentBuilderImpl.java
public boolean isValidating() {
    try {
        return domParser.getFeature(VALIDATION_FEATURE);
    }
    catch (SAXException x) {
        throw new IllegalStateException(x.getMessage());
    }
}
 
public boolean isNamespaceAware() {
    try {
        return domParser.getFeature(NAMESPACES_FEATURE);
    }
    catch (SAXException x) {
        throw new IllegalStateException(x.getMessage());
    }
}
 
源代码10 项目: openjdk-jdk8u   文件: DocumentBuilderImpl.java
public boolean isNamespaceAware() {
    try {
        return domParser.getFeature(NAMESPACES_FEATURE);
    }
    catch (SAXException x) {
        throw new IllegalStateException(x.getMessage());
    }
}
 
源代码11 项目: openjdk-jdk8u   文件: SAXParserImpl.java
public boolean isNamespaceAware() {
    try {
        return xmlReader.getFeature(NAMESPACES_FEATURE);
    }
    catch (SAXException x) {
        throw new IllegalStateException(x.getMessage());
    }
}
 
源代码12 项目: TencentKona-8   文件: SAXParserImpl.java
public boolean isValidating() {
    try {
        return xmlReader.getFeature(VALIDATION_FEATURE);
    }
    catch (SAXException x) {
        throw new IllegalStateException(x.getMessage());
    }
}
 
源代码13 项目: TencentKona-8   文件: SAXParserFactoryImpl.java
/**
 * 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;
}
 
源代码14 项目: openjdk-8   文件: SAXParserImpl.java
public boolean isNamespaceAware() {
    try {
        return xmlReader.getFeature(NAMESPACES_FEATURE);
    }
    catch (SAXException x) {
        throw new IllegalStateException(x.getMessage());
    }
}
 
源代码15 项目: rapidminer-studio   文件: AttributeWeights.java
/** 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;
}
 
源代码16 项目: openjdk-8-source   文件: DocumentBuilderImpl.java
public boolean isValidating() {
    try {
        return domParser.getFeature(VALIDATION_FEATURE);
    }
    catch (SAXException x) {
        throw new IllegalStateException(x.getMessage());
    }
}
 
源代码17 项目: jdk8u60   文件: ErrorHandlerWrapper.java
/** 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);
}
 
源代码18 项目: openjdk-jdk8u   文件: ErrorHandlerWrapper.java
/** 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);
}
 
源代码19 项目: TencentKona-8   文件: ErrorHandlerWrapper.java
/** 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);
}
 
源代码20 项目: openjdk-8-source   文件: ErrorHandlerWrapper.java
/** 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);
}