Java Code Examples for org.w3c.dom.ls.LSInput#setBaseURI()

The following examples show how to use org.w3c.dom.ls.LSInput#setBaseURI() . 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: LocalResolver.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Override
public LSInput resolveResource(final String type, final String namespaceURI, final String publicId, final String systemId, final String baseURI) {
    final LSInput input = lsImplementation.createLSInput();

    final String path = URI.create(systemId).getPath();

    input.setPublicId(publicId);
    input.setBaseURI(baseURI);
    input.setSystemId(path);
    input.setByteStream(LocalResolver.class.getResourceAsStream("/xsd/" + path));

    return input;
}
 
Example 2
Source File: QuikitResolver.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
public LSInput resolveResource( String type, String namespaceURI, String publicId, String systemId, String baseURI )
{
    String resourceName = local.getProperty( systemId );
    if( resourceName == null )
    {
        System.out.println( "type: " + type );
        System.out.println( "namespaceURI: " + namespaceURI );
        System.out.println( "publicId: " + publicId );
        System.out.println( "systemId: " + systemId );
        System.out.println( "baseURI: " + baseURI );
        return null;
    }

    InputStream resource = getClass().getClassLoader().getResourceAsStream( resourceName );
    LSInput input;
    try
    {
        input = getLSInput();
    }
    catch( Exception e )
    {
        throw new UnsupportedOperationException( "Internal problem. Please report to [email protected] mailing list.", e  );
    }
    input.setBaseURI( baseURI );
    input.setByteStream( resource );
    input.setPublicId( publicId );
    input.setSystemId( systemId );
    return input;
}