当前位置: 首页>>代码示例>>Java>>正文


Java LSInput.setBaseURI方法代码示例

本文整理汇总了Java中org.w3c.dom.ls.LSInput.setBaseURI方法的典型用法代码示例。如果您正苦于以下问题:Java LSInput.setBaseURI方法的具体用法?Java LSInput.setBaseURI怎么用?Java LSInput.setBaseURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.w3c.dom.ls.LSInput的用法示例。


在下文中一共展示了LSInput.setBaseURI方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveResource

import org.w3c.dom.ls.LSInput; //导入方法依赖的package包/类
@Override
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
	
	try {
		InputStream inputStream = new URL(new URL(baseURI), systemId).openStream();
		
		LSInput retval = new DefaultLSInput();
		retval.setByteStream(inputStream);
		retval.setBaseURI(baseURI);
		retval.setSystemId(systemId);
		retval.setPublicId(publicId);
		
		return retval;
	} catch(IOException e) {
		return null;
	}
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:18,代码来源:DefaultLSResourceResolver.java

示例2: resolveResource

import org.w3c.dom.ls.LSInput; //导入方法依赖的package包/类
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI)
{
    LOGGER.debug("==== Resolving '" + type + "' '" + namespaceURI + "' '" + publicId + "' '" + systemId + "' '" +
            baseURI + "'");
    LSInput lsInput = domImplementationLS.createLSInput();
    InputStream is = getXSDStream(systemId);
    if(is==null)return null;                
    lsInput.setByteStream(is);
    lsInput.setSystemId(systemId);
    lsInput.setBaseURI(baseURI);
    lsInput.setPublicId(publicId);
    LOGGER.debug("==== Resolved ====");
    return lsInput;            
}
 
开发者ID:ArticulatedSocialAgentsPlatform,项目名称:HmiCore,代码行数:15,代码来源:XSDValidationTest.java

示例3: resolveResource

import org.w3c.dom.ls.LSInput; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:30,代码来源:QuikitResolver.java

示例4: parseWithContext

import org.w3c.dom.ls.LSInput; //导入方法依赖的package包/类
public Node parseWithContext(LSInput input, Node context, short action)
  throws DOMException, LSException
{
  Document doc = (context.getNodeType() == Node.DOCUMENT_NODE) ?
    (Document) context : context.getOwnerDocument();
  input.setBaseURI(doc.getDocumentURI());
  // TODO use namespaces defined on context node
  Document ret = parse(input);
  Node root = ret.getDocumentElement();
  root = doc.adoptNode(root);
  switch (action)
    {
    case ACTION_APPEND_AS_CHILDREN:
      context.appendChild(root);
      break;
    case ACTION_REPLACE_CHILDREN:
      Node c1 = context.getFirstChild();
      while (c1 != null)
        {
          Node next = c1.getNextSibling();
          context.removeChild(c1);
          c1 = next;
        }
      context.appendChild(root);
      break;
    case ACTION_INSERT_BEFORE:
      Node p1 = context.getParentNode();
      p1.insertBefore(root, context);
      break;
    case ACTION_INSERT_AFTER:
      Node p2 = context.getParentNode();
      Node r1 = context.getNextSibling();
      if (r1 == null)
        {
          p2.appendChild(root);
        }
      else
        {
          p2.insertBefore(root, r1);
        }
      break;
    case ACTION_REPLACE:
      Node p3 = context.getParentNode();
      Node r2 = context.getNextSibling();
      p3.removeChild(context);
      if (r2 == null)
        {
          p3.appendChild(root);
        }
      else
        {
          p3.insertBefore(root, r2);
        }
      break;
    }
  return root;
}
 
开发者ID:vilie,项目名称:javify,代码行数:58,代码来源:DomLSParser.java


注:本文中的org.w3c.dom.ls.LSInput.setBaseURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。