IBM®
跳转到主要内容
    中国 [选择]    使用条款
 
 
Select a scope: Search for:    
    首页    产品    服务与解决方案     支持与下载    个性化服务    
跳转到主要内容

developerWorks 中国  >  XML  >

Working XML: Wrapping up XM version 1

Managing a list of links and the table of contents

developerWorks

Return to article.


Listing 8. resolve() recognizes x-source: URLs
        
public Source resolve(String href,String base)
{
   if(href.endsWith(".xsl"))
   {
      File file = new File(rulesDir,href);
      if(file.exists())
         return new StreamSource(file);
   }
   else if(href.startsWith("x-source:") && docsDir != null)
   {
      File file = new File(docsDir,href.substring(9));
      if(file.exists())
         return new StreamSource(file);
      else
         return new StreamSource(new StringReader("<xm:NotAvailable xmlns:xm='http://www.ananas.org/2001/XM/Walk/Directory'/>"),"file:null");
   }
   return null;
}
      

Return to article.

    关于 IBM 隐私条约 联系 IBM 使用条款