Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5967687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:58:48+00:00 2026-05-22T19:58:48+00:00

I am new to Android. I want to convert a XML file to HTML

  • 0

I am new to Android.

I want to convert a XML file to HTML format using XSLT to display it in android.

Can you please tell me some tutorials or examples to follow?

I also tried the codes in the Android: Convert xml using xslt
But it didn’t work. I am not sure what is “StringOutputStream” there.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:58:48+00:00Added an answer on May 22, 2026 at 7:58 pm

    Put both your xml and xslt file in raw folder.
    The generated html file will be stored in sdcard.
    Use the following code.

    import java.io.File;
    
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerFactoryConfigurationError;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.os.Environment;
    
    public class XsltTester extends Activity {
    
        private static String TAG = XsltTester.class.getSimpleName();
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            try {
    
                Source xmlSource = new StreamSource(this.getResources().openRawResource(R.raw.weather));
                Source xsltSource = new StreamSource(this.getResources().openRawResource(R.raw.weatherxsl));
    
                TransformerFactory transFact = TransformerFactory.newInstance();
                Transformer trans = transFact.newTransformer(xsltSource);
    //          FileOutputStream fo = new FileOutputStream(f);
    //          fo.write(resizeBitMapImageToByteArray(photoAlbumBean));
    //          fo.close();
                File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/mydata.html");
    
    //            OutputStream output = new StringOutputStream();
                StreamResult result = new StreamResult(f);
                trans.transform(xmlSource, result);
    
            } catch (TransformerConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (TransformerFactoryConfigurationError e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (TransformerException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
    

    Thanks
    Deepak

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Android. I want to display HTML pages in android emulator.
I am new in android.I want to encrypt a file and I want to
I'm quite new to android and i want to make some animation (simple game
The new Android 2.1 SDK (version 7) has a new class called SignalStrength: http://developer.android.com/reference/android/telephony/SignalStrength.html
I know that eclipse can do this, can Intellij via the new Android support
I am new to android and I want to retrieve button information which is
I'm new in android and I want to use achartengine to implement time chart
I am new so please be patient with me. What I want is to
i'm new to android.I want to add values to the listview as below.I have
Can someone please give me a hand with this image downloading code? I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.