Package org.w3c.dom.ls

Examples of org.w3c.dom.ls.LSInput


            if (systemId.startsWith("$THIS$/")) {//other datastream in this object
                String[] tokens = systemId.split("/");
                //String is of the format $THIS$/DSID
                try {
                    final Datastream schemastream = contentmodelReader.GetDatastream(tokens[1], asOfDateTime);
                    LSInput input = new MyLSInput(schemastream);
                    input.setBaseURI(baseURI);
                    input.setPublicId(publicId);
                    input.setBaseURI(baseURI);
                    return input;
                } catch (ServerException e) {
                    return null;
                }
            } else {
View Full Code Here


        return parse(s, false);
    }

    public static Document parse(String s, boolean validateIfSchema) {
        DOMImplementationLS impl = getDOMImpl();
        LSInput input = impl.createLSInput();
        input.setStringData(s);
        return parse(input, validateIfSchema);
    }
View Full Code Here

        return parse(input, validateIfSchema);
    }

    public static Document parse(InputStream s, boolean validateIfSchema) {
        DOMImplementationLS impl = getDOMImpl();
        LSInput input = impl.createLSInput();
        input.setByteStream(s);
        return parse(input, validateIfSchema);
    }
View Full Code Here

            impl = getDOMImpl();
        }

        public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId,
                String baseURI) {
            LSInput lsInput = impl.createLSInput();
            InputStream is = getClass().getResourceAsStream("/" + systemId);
            if (is == null)
                return null;
            lsInput.setByteStream(is);
            return lsInput;
        }
View Full Code Here

        if (resourceResolver != null
                && domConfiguration.canSetParameter("resource-resolver", resourceResolver)) {
            domConfiguration.setParameter("resource-resolver", resourceResolver);
        }

        final LSInput lsInput = impl.createLSInput();
        lsInput.setByteStream(inputStream);

        final Document document = builder.parse(lsInput);
        return document;
    }
View Full Code Here

        try {
            implementation = DomUtil.getDOMImplementation();
        } catch (final IOException e) {
            return null;
        }
        final LSInput input = implementation.createLSInput();
        input.setByteStream(inputStream);
        input.setPublicId(publicId);
        input.setSystemId(systemId);
        return input;
    }
View Full Code Here

        try {
            implementation = DomUtil.getDOMImplementation();
        } catch (final IOException e) {
            return null;
        }
        final LSInput input = implementation.createLSInput();
        input.setByteStream(theStream);
        input.setPublicId(MathMLUtil.MATHML_PUBLIC_ID);
        input.setSystemId(MathMLUtil.MATHML_SYSTEM_ID);
        return input;
    }
View Full Code Here

    }

    private LSInput loadLSInput(String ns) {
        String path = ToolConstants.CXF_SCHEMAS_DIR_INJAR + NSFILEMAP.get(ns);
        URL url = getClass().getClassLoader().getResource(path);
        LSInput lsin = new LSInputImpl();
        lsin.setSystemId(url.toString());
        try {
            lsin.setByteStream(url.openStream());
        } catch (IOException e) {
            return null;
        }
        return lsin;
    }
View Full Code Here

        LOG.log(Level.INFO, msg.toString());
        if (NSFILEMAP.containsKey(namespaceURI)) {
            return loadLSInput(namespaceURI);
        }

        LSInput lsin = null;
        String resURL = null;
        String localFile = null;
        if (systemId != null) {
            String schemaLocation = "";
            if (baseURI != null) {
                schemaLocation = baseURI.substring(0, baseURI.lastIndexOf("/") + 1);
            }
            if (systemId.indexOf("http://") < 0) {
                resURL = schemaLocation + systemId;
            } else {
                resURL = systemId;
            }
        } else if (namespaceURI != null) {
            resURL = namespaceURI;
        }

        if (resURL != null && resURL.startsWith("http://")) {
            String filename = NSFILEMAP.get(resURL);
            if (filename != null) {
                localFile = ToolConstants.CXF_SCHEMAS_DIR_INJAR + filename;
            } else {
                URL url;
                URLConnection urlCon = null;
                try {
                    url = new URL(resURL);
                    urlCon = url.openConnection();
                    urlCon.setUseCaches(false);
                    lsin = new LSInputImpl();
                    lsin.setSystemId(resURL);
                    lsin.setByteStream(urlCon.getInputStream());
                    msg = new Message("RESOLVE_FROM_REMOTE", LOG, url);
                    LOG.log(Level.INFO, msg.toString());
                    return lsin;
                } catch (Exception e) {
                    e.printStackTrace();
                    return null;
                }
            }
        } else if (resURL != null && !resURL.startsWith("http:")) {
            localFile = resURL;
        else {
            return null;
        }
       
       
        URIResolver resolver;
        try {
            msg = new Message("RESOLVE_FROM_LOCAL", LOG, localFile);
            LOG.log(Level.INFO, msg.toString());
           
            resolver = new URIResolver(localFile);
            if (resolver.isResolved()) {
                lsin = new LSInputImpl();
                lsin.setSystemId(localFile);
                lsin.setByteStream(resolver.getInputStream());
            }
        } catch (IOException e) {
            return null;
        }
        return lsin;
View Full Code Here

//                              + "NAMESPACE_URI: "  + namespaceURI +  "\n"   
//                              + "PUBLIC_ID: "  + publicId +  "\n"  
//                              + "SYSTEM_ID: "  + systemId +  "\n"  
//                              + "BASE_URI: "  + baseURI +  "\n" ); 
             
            LSInput lsInput = new LSInputImpl()
             
            // In all Java EE schema xsd files, the <xsd:include schemaLocation=../> always reference to a relative path.
            // so the systemId here will be the xsd file name.
            URL schemaURL = JaxbJavaee.getSchemaURL(systemId);

            InputStream is = null;
            if (schemaURL!=null) {
                try {
                    is = schemaURL.openStream();
                } catch (IOException e) {
                    //should not happen
                    throw new RuntimeException(e);
                }
            }
                       
            lsInput.setSystemId(systemId)
            lsInput.setByteStream(is)
         
            return  lsInput; 
       
View Full Code Here

TOP

Related Classes of org.w3c.dom.ls.LSInput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.