當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。