com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter. 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: XSImplementationImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public XSLoader createXSLoader(StringList versions) throws XSException {
    XSLoader loader = new XSLoaderImpl();
    if (versions == null){
                    return loader;
    }
    for (int i=0; i<versions.getLength();i++){
            if (!versions.item(i).equals("1.0")){
                            String msg =
                                    DOMMessageFormatter.formatMessage(
                                            DOMMessageFormatter.DOM_DOMAIN,
                                            "FEATURE_NOT_SUPPORTED",
                                            new Object[] { versions.item(i) });
                            throw new XSException(XSException.NOT_SUPPORTED_ERR, msg);
            }
    }
    return loader;
}
 
Example #2
Source File: DocumentBuilderImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Document parse(InputSource is) throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException(
            DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
            "jaxp-null-input-source", null));
    }
    if (fSchemaValidator != null) {
        if (fSchemaValidationManager != null) {
            fSchemaValidationManager.reset();
            fUnparsedEntityHandler.reset();
        }
        resetSchemaValidator();
    }
    domParser.parse(is);
    Document doc = domParser.getDocument();
    domParser.dropDocumentReferences();
    return doc;
}
 
Example #3
Source File: XSImplementationImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public XSLoader createXSLoader(StringList versions) throws XSException {
    XSLoader loader = new XSLoaderImpl();
    if (versions == null){
                    return loader;
    }
    for (int i=0; i<versions.getLength();i++){
            if (!versions.item(i).equals("1.0")){
                            String msg =
                                    DOMMessageFormatter.formatMessage(
                                            DOMMessageFormatter.DOM_DOMAIN,
                                            "FEATURE_NOT_SUPPORTED",
                                            new Object[] { versions.item(i) });
                            throw new XSException(XSException.NOT_SUPPORTED_ERR, msg);
            }
    }
    return loader;
}
 
Example #4
Source File: DocumentBuilderImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public Document parse(InputSource is) throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException(
            DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
            "jaxp-null-input-source", null));
    }
    if (fSchemaValidator != null) {
        if (fSchemaValidationManager != null) {
            fSchemaValidationManager.reset();
            fUnparsedEntityHandler.reset();
        }
        resetSchemaValidator();
    }
    domParser.parse(is);
    Document doc = domParser.getDocument();
    domParser.dropDocumentReferences();
    return doc;
}
 
Example #5
Source File: XSImplementationImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public XSLoader createXSLoader(StringList versions) throws XSException {
    XSLoader loader = new XSLoaderImpl();
    if (versions == null){
                    return loader;
    }
    for (int i=0; i<versions.getLength();i++){
            if (!versions.item(i).equals("1.0")){
                            String msg =
                                    DOMMessageFormatter.formatMessage(
                                            DOMMessageFormatter.DOM_DOMAIN,
                                            "FEATURE_NOT_SUPPORTED",
                                            new Object[] { versions.item(i) });
                            throw new XSException(XSException.NOT_SUPPORTED_ERR, msg);
            }
    }
    return loader;
}
 
Example #6
Source File: XSImplementationImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public XSLoader createXSLoader(StringList versions) throws XSException {
    XSLoader loader = new XSLoaderImpl();
    if (versions == null){
                    return loader;
    }
    for (int i=0; i<versions.getLength();i++){
            if (!versions.item(i).equals("1.0")){
                            String msg =
                                    DOMMessageFormatter.formatMessage(
                                            DOMMessageFormatter.DOM_DOMAIN,
                                            "FEATURE_NOT_SUPPORTED",
                                            new Object[] { versions.item(i) });
                            throw new XSException(XSException.NOT_SUPPORTED_ERR, msg);
            }
    }
    return loader;
}
 
Example #7
Source File: DocumentBuilderImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Document parse(InputSource is) throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException(
            DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
            "jaxp-null-input-source", null));
    }
    if (fSchemaValidator != null) {
        if (fSchemaValidationManager != null) {
            fSchemaValidationManager.reset();
            fUnparsedEntityHandler.reset();
        }
        resetSchemaValidator();
    }
    domParser.parse(is);
    Document doc = domParser.getDocument();
    domParser.dropDocumentReferences();
    return doc;
}
 
Example #8
Source File: DocumentBuilderImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public Document parse(InputSource is) throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException(
            DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
            "jaxp-null-input-source", null));
    }
    if (fSchemaValidator != null) {
        if (fSchemaValidationManager != null) {
            fSchemaValidationManager.reset();
            fUnparsedEntityHandler.reset();
        }
        resetSchemaValidator();
    }
    domParser.parse(is);
    Document doc = domParser.getDocument();
    domParser.dropDocumentReferences();
    return doc;
}
 
Example #9
Source File: DocumentBuilderImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public Document parse(InputSource is) throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException(
            DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
            "jaxp-null-input-source", null));
    }
    if (fSchemaValidator != null) {
        if (fSchemaValidationManager != null) {
            fSchemaValidationManager.reset();
            fUnparsedEntityHandler.reset();
        }
        resetSchemaValidator();
    }
    domParser.parse(is);
    Document doc = domParser.getDocument();
    domParser.dropDocumentReferences();
    return doc;
}
 
Example #10
Source File: DOMParserImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private static DOMException newFeatureNotFoundError(String name) {
    String msg =
        DOMMessageFormatter.formatMessage (
                DOMMessageFormatter.DOM_DOMAIN,
                "FEATURE_NOT_FOUND",
                new Object[] { name });
    return new DOMException (DOMException.NOT_FOUND_ERR, msg);
}
 
Example #11
Source File: BaseMarkupSerializer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void setOutputCharStream( Writer writer )
{
    if ( writer == null ) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN,
                                                       "ArgumentIsNull", new Object[]{"writer"});
        throw new NullPointerException(msg);
    }
    _writer = writer;
    _output = null;
    reset();
}
 
Example #12
Source File: DOMParserImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private static DOMException newTypeMismatchError(String name) {
    String msg =
        DOMMessageFormatter.formatMessage (
                DOMMessageFormatter.DOM_DOMAIN,
                "TYPE_MISMATCH_ERR",
                new Object[] { name });
    return new DOMException (DOMException.TYPE_MISMATCH_ERR, msg);
}
 
Example #13
Source File: XMLSchemaLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Object getParameter(String name) throws DOMException {

        if (name.equals(Constants.DOM_ERROR_HANDLER)){
            return (fErrorHandler != null) ? fErrorHandler.getErrorHandler() : null;
        }
        else if (name.equals(Constants.DOM_RESOURCE_RESOLVER)) {
            return (fResourceResolver != null) ? fResourceResolver.getEntityResolver() : null;
        }

        try {
            boolean feature = getFeature(name);
            return (feature) ? Boolean.TRUE : Boolean.FALSE;
        } catch (Exception e) {
            Object property;
            try {
                property = getProperty(name);
                return property;
            } catch (Exception ex) {
                String msg =
                    DOMMessageFormatter.formatMessage(
                            DOMMessageFormatter.DOM_DOMAIN,
                            "FEATURE_NOT_SUPPORTED",
                            new Object[] { name });
                throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
            }
        }
    }
 
Example #14
Source File: DOMResultBuilder.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private void append(Node node) throws XNIException {
    if (fCurrentNode != null) {
        fCurrentNode.appendChild(node);
    }
    else {
        /** Check if this node can be attached to the target. */
        if ((kidOK[fTarget.getNodeType()] & (1 << node.getNodeType())) == 0) {
            String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null);
            throw new XNIException(msg);
        }
        fTargetChildren.add(node);
    }
}
 
Example #15
Source File: AbstractDOMParser.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * This method allows the programmer to decide which document
 * factory to use when constructing the DOM tree. However, doing
 * so will lose the functionality of the default factory. Also,
 * a document class other than the default will lose the ability
 * to defer node expansion on the DOM tree produced.
 *
 * @param documentClassName The fully qualified class name of the
 *                      document factory to use when constructing
 *                      the DOM tree.
 *
 * @see #getDocumentClassName
 * @see #DEFAULT_DOCUMENT_CLASS_NAME
 */
protected void setDocumentClassName (String documentClassName) {

    // normalize class name
    if (documentClassName == null) {
        documentClassName = DEFAULT_DOCUMENT_CLASS_NAME;
    }

    if (!documentClassName.equals(DEFAULT_DOCUMENT_CLASS_NAME) &&
        !documentClassName.equals(PSVI_DOCUMENT_CLASS_NAME)) {
        // verify that this class exists and is of the right type
        try {
            Class _class = ObjectFactory.findProviderClass (documentClassName, true);
            //if (!_class.isAssignableFrom(Document.class)) {
            if (!Document.class.isAssignableFrom (_class)) {
                throw new IllegalArgumentException (
                    DOMMessageFormatter.formatMessage(
                    DOMMessageFormatter.DOM_DOMAIN,
                    "InvalidDocumentClassName", new Object [] {documentClassName}));
            }
        }
        catch (ClassNotFoundException e) {
            throw new IllegalArgumentException (
                DOMMessageFormatter.formatMessage(
                DOMMessageFormatter.DOM_DOMAIN,
                "MissingDocumentClassName", new Object [] {documentClassName}));
        }
    }

    // set document class name
    fDocumentClassName = documentClassName;
    if (!documentClassName.equals (DEFAULT_DOCUMENT_CLASS_NAME)) {
        fDeferNodeExpansion = false;
    }

}
 
Example #16
Source File: BaseMarkupSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void setOutputFormat( OutputFormat format )
{
    if ( format == null ) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN,
                                                       "ArgumentIsNull", new Object[]{"format"});
        throw new NullPointerException(msg);
    }
    _format = format;
    reset();
}
 
Example #17
Source File: XMLSchemaLoader.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public Object getParameter(String name) throws DOMException {

        if (name.equals(Constants.DOM_ERROR_HANDLER)){
            return (fErrorHandler != null) ? fErrorHandler.getErrorHandler() : null;
        }
        else if (name.equals(Constants.DOM_RESOURCE_RESOLVER)) {
            return (fResourceResolver != null) ? fResourceResolver.getEntityResolver() : null;
        }

        try {
            boolean feature = getFeature(name);
            return (feature) ? Boolean.TRUE : Boolean.FALSE;
        } catch (Exception e) {
            Object property;
            try {
                property = getProperty(name);
                return property;
            } catch (Exception ex) {
                String msg =
                    DOMMessageFormatter.formatMessage(
                            DOMMessageFormatter.DOM_DOMAIN,
                            "FEATURE_NOT_SUPPORTED",
                            new Object[] { name });
                throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
            }
        }
    }
 
Example #18
Source File: SerializerFactoryImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
SerializerFactoryImpl( String method )
{
    _method = method;
    if ( ! _method.equals( Method.XML ) &&
         ! _method.equals( Method.HTML ) &&
         ! _method.equals( Method.XHTML ) &&
         ! _method.equals( Method.TEXT ) ) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, "MethodNotSupported", new Object[]{method});
        throw new IllegalArgumentException(msg);
    }
}
 
Example #19
Source File: BaseMarkupSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean reset()
{
    if ( _elementStateCount > 1 ) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN,
                                                       "ResetInMiddle", null);
        throw new IllegalStateException(msg);
    }
    _prepared = false;
    fCurrentNode = null;
    fStrBuffer.setLength(0);
    return true;
}
 
Example #20
Source File: XMLSchemaLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Object getParameter(String name) throws DOMException {

        if (name.equals(Constants.DOM_ERROR_HANDLER)){
            return (fErrorHandler != null) ? fErrorHandler.getErrorHandler() : null;
        }
        else if (name.equals(Constants.DOM_RESOURCE_RESOLVER)) {
            return (fResourceResolver != null) ? fResourceResolver.getEntityResolver() : null;
        }

        try {
            boolean feature = getFeature(name);
            return (feature) ? Boolean.TRUE : Boolean.FALSE;
        } catch (Exception e) {
            Object property;
            try {
                property = getProperty(name);
                return property;
            } catch (Exception ex) {
                String msg =
                    DOMMessageFormatter.formatMessage(
                            DOMMessageFormatter.DOM_DOMAIN,
                            "FEATURE_NOT_SUPPORTED",
                            new Object[] { name });
                throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
            }
        }
    }
 
Example #21
Source File: BaseMarkupSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void setOutputByteStream( OutputStream output )
{
    if ( output == null ) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN,
                                                       "ArgumentIsNull", new Object[]{"output"});
        throw new NullPointerException(msg);
    }
    _output = output;
    _writer = null;
    reset();
}
 
Example #22
Source File: DOMResultBuilder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void append(Node node) throws XNIException {
    if (fCurrentNode != null) {
        fCurrentNode.appendChild(node);
    }
    else {
        /** Check if this node can be attached to the target. */
        if ((kidOK[fTarget.getNodeType()] & (1 << node.getNodeType())) == 0) {
            String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null);
            throw new XNIException(msg);
        }
        fTargetChildren.add(node);
    }
}
 
Example #23
Source File: DOMParserImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static DOMException newTypeMismatchError(String name) {
    String msg =
        DOMMessageFormatter.formatMessage (
                DOMMessageFormatter.DOM_DOMAIN,
                "TYPE_MISMATCH_ERR",
                new Object[] { name });
    return new DOMException (DOMException.TYPE_MISMATCH_ERR, msg);
}
 
Example #24
Source File: DOMParserImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static DOMException newFeatureNotFoundError(String name) {
    String msg =
        DOMMessageFormatter.formatMessage (
                DOMMessageFormatter.DOM_DOMAIN,
                "FEATURE_NOT_FOUND",
                new Object[] { name });
    return new DOMException (DOMException.NOT_FOUND_ERR, msg);
}
 
Example #25
Source File: AbstractDOMParser.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * This method allows the programmer to decide which document
 * factory to use when constructing the DOM tree. However, doing
 * so will lose the functionality of the default factory. Also,
 * a document class other than the default will lose the ability
 * to defer node expansion on the DOM tree produced.
 *
 * @param documentClassName The fully qualified class name of the
 *                      document factory to use when constructing
 *                      the DOM tree.
 *
 * @see #getDocumentClassName
 * @see #DEFAULT_DOCUMENT_CLASS_NAME
 */
protected void setDocumentClassName (String documentClassName) {

    // normalize class name
    if (documentClassName == null) {
        documentClassName = DEFAULT_DOCUMENT_CLASS_NAME;
    }

    if (!documentClassName.equals(DEFAULT_DOCUMENT_CLASS_NAME) &&
        !documentClassName.equals(PSVI_DOCUMENT_CLASS_NAME)) {
        // verify that this class exists and is of the right type
        try {
            Class _class = ObjectFactory.findProviderClass (documentClassName, true);
            //if (!_class.isAssignableFrom(Document.class)) {
            if (!Document.class.isAssignableFrom (_class)) {
                throw new IllegalArgumentException (
                    DOMMessageFormatter.formatMessage(
                    DOMMessageFormatter.DOM_DOMAIN,
                    "InvalidDocumentClassName", new Object [] {documentClassName}));
            }
        }
        catch (ClassNotFoundException e) {
            throw new IllegalArgumentException (
                DOMMessageFormatter.formatMessage(
                DOMMessageFormatter.DOM_DOMAIN,
                "MissingDocumentClassName", new Object [] {documentClassName}));
        }
    }

    // set document class name
    fDocumentClassName = documentClassName;
    if (!documentClassName.equals (DEFAULT_DOCUMENT_CLASS_NAME)) {
        fDeferNodeExpansion = false;
    }

}
 
Example #26
Source File: DOMResultBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void append(Node node) throws XNIException {
    if (fCurrentNode != null) {
        fCurrentNode.appendChild(node);
    }
    else {
        /** Check if this node can be attached to the target. */
        if ((kidOK[fTarget.getNodeType()] & (1 << node.getNodeType())) == 0) {
            String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null);
            throw new XNIException(msg);
        }
        fTargetChildren.add(node);
    }
}
 
Example #27
Source File: AbstractDOMParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method allows the programmer to decide which document
 * factory to use when constructing the DOM tree. However, doing
 * so will lose the functionality of the default factory. Also,
 * a document class other than the default will lose the ability
 * to defer node expansion on the DOM tree produced.
 *
 * @param documentClassName The fully qualified class name of the
 *                      document factory to use when constructing
 *                      the DOM tree.
 *
 * @see #getDocumentClassName
 * @see #DEFAULT_DOCUMENT_CLASS_NAME
 */
protected void setDocumentClassName (String documentClassName) {

    // normalize class name
    if (documentClassName == null) {
        documentClassName = DEFAULT_DOCUMENT_CLASS_NAME;
    }

    if (!documentClassName.equals(DEFAULT_DOCUMENT_CLASS_NAME) &&
        !documentClassName.equals(PSVI_DOCUMENT_CLASS_NAME)) {
        // verify that this class exists and is of the right type
        try {
            Class _class = ObjectFactory.findProviderClass (documentClassName, true);
            //if (!_class.isAssignableFrom(Document.class)) {
            if (!Document.class.isAssignableFrom (_class)) {
                throw new IllegalArgumentException (
                    DOMMessageFormatter.formatMessage(
                    DOMMessageFormatter.DOM_DOMAIN,
                    "InvalidDocumentClassName", new Object [] {documentClassName}));
            }
        }
        catch (ClassNotFoundException e) {
            throw new IllegalArgumentException (
                DOMMessageFormatter.formatMessage(
                DOMMessageFormatter.DOM_DOMAIN,
                "MissingDocumentClassName", new Object [] {documentClassName}));
        }
    }

    // set document class name
    fDocumentClassName = documentClassName;
    if (!documentClassName.equals (DEFAULT_DOCUMENT_CLASS_NAME)) {
        fDeferNodeExpansion = false;
    }

}
 
Example #28
Source File: SerializerFactoryImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private Serializer getSerializer( OutputFormat format )
{
    if ( _method.equals( Method.XML ) ) {
        return new XMLSerializer( format );
    } else if ( _method.equals( Method.HTML ) ) {
        return new HTMLSerializer( format );
    }  else if ( _method.equals( Method.XHTML ) ) {
        return new XHTMLSerializer( format );
    }  else if ( _method.equals( Method.TEXT ) ) {
        return new TextSerializer();
    } else {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, "MethodNotSupported", new Object[]{_method});
        throw new IllegalStateException(msg);
    }
}
 
Example #29
Source File: SerializerFactoryImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
SerializerFactoryImpl( String method )
{
    _method = method;
    if ( ! _method.equals( Method.XML ) &&
         ! _method.equals( Method.HTML ) &&
         ! _method.equals( Method.XHTML ) &&
         ! _method.equals( Method.TEXT ) ) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, "MethodNotSupported", new Object[]{method});
        throw new IllegalArgumentException(msg);
    }
}
 
Example #30
Source File: BaseMarkupSerializer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean reset()
{
    if ( _elementStateCount > 1 ) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN,
                                                       "ResetInMiddle", null);
        throw new IllegalStateException(msg);
    }
    _prepared = false;
    fCurrentNode = null;
    fStrBuffer.setLength(0);
    return true;
}