BizTalk Utilities CV ,   Jobs ,   Code library  
 
javax.xml.transform.TransformerFactory Class
javax.xml.transform.Transformer Class
javax.xml.transform.Templates Class
javax.xml.transform.stream.StreamSource Class
javax.xml.transform.stream.StreamResult Class
javax.xml.transform.Source Class
javax.xml.transform.sax.SAXSource Class
javax.xml.transform.sax.SAXResult Class
javax.xml.transform.Result Class
javax.xml.transform.ErrorListener Class
javax.xml.transform.dom.DOMSource Class
javax.xml.transform.dom.DOMResult Class
javax.xml.parsers.SAXParserFactory Class
javax.xml.parsers.SAXParser Class
javax.xml.parsers.DocumentBuilderFactory Class
javax.xml.parsers.DocumentBuilder Class
SAX 2.0 Features and Properties
MSMQ Mode Tool
XML for Software Configuration
XML - Basics.
<< XSLT
.NET and XML >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :261

 

The javax.xml.transform.URIResolver Class

Members

Signature

Public methods

Source

resolve(String href, String base)

Overview

This is the interface responsible for URI resolution, and is analogous to the SAX EntityResolver interface. This interface allows URIs found in XML constructs like xsl:import and xsl:include to be handled. It has only one method resolve(), which returns javax.xml.transform.Source. You can instructtransformer to search for the specified document in various locations when a particular URI is encountered. For example, when an include of the URI http://www.topxml.com/header.xsl is encountered, you might instead return the local document Localheader.xsl and prevent the need for network access.

Method Overviews

The only method in this interface is resolve(String href,String base). This method is called by the processor when it encounters an xsl:include, xsl:import, or document() function.  

Example of how to use resolve(String href,String base)

Your main stylesheet contains <xsl:include href="http://www.topxml.com/header.xsl"/>. During processing, when it encounters this href, you want to use your local stylesheet. “Localheading.xsl”.

public Source resolve(String href, String base)

  {

    System.out.println("Href :"+href);

    System.out.println("Base :"+base);

    Source source = null;

    if(href.equals("http://www.topxml.com/header.xsl"))

    {

      source = new StreamSource("E:\\topxml\\Localheading.xsl");

      return source;

    }

    if(source == null)

    {

      source = new StreamSource("E:\\topxml\\Default.xsl");

    }

    return source;

  }

The above method first compares the href. If it matches your criteria, then it creates a new source so your transformer uses this source in stead of http://www.topxml.com/header.xsl .

URIResolverImpl uriResolver = new URIResolverImpl(); //This class implements URIResolver.

tFactory.setURIResolver(uriResolver);


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C
Immediate ASP.NET/C# Openings for C

View all Jobs (Add yours)
View all CV (Add yours)



online fax
swimming pool contractor
conference calling services
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP