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

  • SEARCH
  • Home
  • 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 8165735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:37:54+00:00 2026-06-06T19:37:54+00:00

I want the output as shown in below image This is a Sikh holy

  • 0

I want the output as shown in below image

This is in Gurumukhi Font

This is a Sikh holy book which uses the Regional font(Gurumukhi) and i want to make an xml file of this text to use the xml parsing to show in my application. But the Problem is when i paste this font in my xml file it converts into the some alphabets and symbols like below

jpujI swihb
<> siq nwmu krqw purKu inrBau inrvYru
Akwl mUriq AjUnI sYBM gur pRswid ]
] jpu ]
Awid scu jugwid scu ]
hY BI scu nwnk hosI BI scu ]1]
socY soic n hoveI jy socI lK vwr ]
cupY cup n hoveI jy lwie rhw ilv qwr ]
BuiKAw BuK n auqrI jy bMnw purIAw Bwr ]
shs isAwxpw lK hoih q iek n clY nwil ]
ikv sicAwrw hoeIAY ikv kUVY qutY pwil ]
hukim rjweI clxw nwnk iliKAw nwil ]1]
hukmI hovin Awkwr hukmu n kihAw jweI ]
hukmI hovin

I have placed a Gurumukhi font file in the asset folder and use the below code which works fine

Typeface tf = Typeface.createFromAsset(getAssets(),
                "fonts/bulara_5.ttf");
        textView = (TextView) findViewById(R.id.textView1);
        textView.setTypeface(tf);
        textView.setMovementMethod(new ScrollingMovementMethod());
        textView.setText(" <>siq nwmu krqw purKu inrBau inrvYru")

In that way the text in that text view converts into the Gurumukhi but How can i create my Xml file for this type of text in it. Or Give me some Good Suggestion that which way is better to work on this type of app and handle the text. I have to show 4-5 Holy books in one app and each have 20-25 pages. Any help is appreciated.

  • 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-06-06T19:37:55+00:00Added an answer on June 6, 2026 at 7:37 pm

    I have made some changes in xml keep in mind that changes are required.

    I have made an data.xml in asset folder the xml is as look like as shown below

        <?xml version="1.0" encoding="UTF-8"?>
        <book1>
        <page1>&#60;&#62; siq nwmu krqw purKu inrBau inrvYru
        Akwl mUriq AjUnI sYBM gur pRswid ]
                        ] jpu ]
                 Awid scu jugwid scu ]
          hY BI scu nwnk hosI BI scu ]1]
         socY soic n hoveI jy socI lK vwr ]
        cupY cup n hoveI jy lwie rhw ilv qwr ]
        BuiKAw BuK n auqrI jy bMnw purIAw Bwr ]
       shs isAwxpw lK hoih q iek n clY nwil ]
       ikv sicAwrw hoeIAY ikv kUVY qutY pwil ]
       hukim rjweI clxw nwnk iliKAw nwil ]1]
      hukmI hovin Awkwr hukmu n kihAw jweI ]
      hukmI hovin jIA hukim imlY vifAweI ]
      hukmI auqmu nIcu hukim iliK duK suK pweIAih ]
      ieknw hukmI bKsIs ieik hukmI sdw BvweIAih ]
      hukmY AMdir sBu ko bwhir hukm n koie ]
      nwnk hukmY jy buJY q haumY khY n koie ]2]
      gwvY ko qwxu hovY iksY qwxu ]</page1>
      </book1>
    

    after that see my StudyParser.class as shown below

      import java.io.BufferedInputStream;
      import java.io.ByteArrayOutputStream;
      import java.io.IOException;
      import java.io.InputStream;
      import java.io.InputStreamReader;
      import java.io.StringReader;
      import java.io.UnsupportedEncodingException;
      import java.net.MalformedURLException;
    
      import javax.xml.parsers.DocumentBuilder;
      import javax.xml.parsers.DocumentBuilderFactory;
      import javax.xml.parsers.ParserConfigurationException;
    
      import org.apache.http.HttpEntity;
      import org.apache.http.HttpResponse;
      import org.apache.http.client.methods.HttpPost;
      import org.apache.http.impl.client.DefaultHttpClient;
      import org.apache.http.util.EntityUtils;
      import org.w3c.dom.Document;
      import org.w3c.dom.Element;
      import org.w3c.dom.Node;
      import org.w3c.dom.NodeList;
      import org.xml.sax.InputSource;
      import org.xml.sax.SAXException;
    
    
    
      public class StudyParser {
    public StudyParser() {
    
    }
    
    public final static Document XMLfromString(String xml){
         Document doc = null;
    
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setCoalescing(true);
                try {
    
              DocumentBuilder db = dbf.newDocumentBuilder();
    
              InputSource is = new InputSource();
                  is.setCharacterStream(new StringReader(xml));
                  doc = db.parse(is); 
    
            } catch (ParserConfigurationException e) {
              System.out.println("XML parse error: " + e.getMessage());
              return null;
            } catch (SAXException e) {
              System.out.println("Wrong XML file structure: " + e.getMessage());
                    return null;
            } catch (IOException e) {
              System.out.println("I/O exeption: " + e.getMessage());
              return null;
            }
    
                return doc;
    
      }
    public static String getXMLstring(String xml){   
          String line = null;
    
          try {
    
            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost(xml);
    
            HttpResponse httpResponse = httpClient.execute(httpPost);
            HttpEntity httpEntity = httpResponse.getEntity();
            line = EntityUtils.toString(httpEntity);
    
          } catch (UnsupportedEncodingException e) {
            line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";
          } catch (MalformedURLException e) {
            line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";
          } catch (IOException e) {
            line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";
          }
    
          return line;
    
      }
    public static String getXML(InputStream is)throws IOException {
    
        BufferedInputStream bis = new BufferedInputStream(is);
        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        int result = bis.read();
        while(result != -1) {
          byte b = (byte)result;
          buf.write(b);
          result = bis.read();
        }        
        return buf.toString();
    }
    public final static String getElementValue( Node elem ) {
           Node kid;
           if( elem != null){
               if (elem.hasChildNodes()){
                   for( kid = elem.getFirstChild(); kid != null; kid = kid.getNextSibling() ){
                       if( kid.getNodeType() == Node.TEXT_NODE  ){
                           return kid.getNodeValue();
                       }
    
                   }
               }
           }
           return "";
       }
     public static int numResults(Document doc){    
            Node results = doc.getDocumentElement();
            int res = -1;
    
            try{
              res = Integer.valueOf(results.getAttributes().getNamedItem("Categories").getNodeValue());
            }catch(Exception e ){
              res = -1;
            }
    
            return res;
          }
    
          public static String getValue(Element item, String str) {    
            NodeList n = item.getElementsByTagName(str);    
            return StudyParser.getElementValue(n.item(0));
          }
    
    
    }
    

    after code in my activity is as shown below

     TextView txt;
     try{
     txt = (TextView)findViewById(R.id.tv); 
     String   xml= StudyParser.getXML(getAssets().open("data.xml"));    
    
       Document doc = StudyParser.XMLfromString(xml);
      NodeList n = doc.getElementsByTagName("book1");
     Element eid = (Element) n.item(0);
    String Js=StudyParser.getValue(eid, "page1");
     Typeface tf = Typeface.createFromAsset(getAssets(),"bulara_5.ttf");
     txt.setTypeface(tf);
     txt.setText(Js);
       }catch(Exception e){
     Log.e("error",e.toString());
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 maps as shown below and I want the output as a
I have a table number_color_style with the structure as shown below. This table contains
I want to get something like as shown in below and the code i
The process I want to do is to make the FFT to an image
I want to read data of average saturation (%) for water as shown below.
The highlights in the image below shows the logic I want to implement. I
I have a inputfile with template as shown below. I want to change the
I want to use pprint's output to show a complex data structure, but I
I want to show the output of the Linux command dialog --menu from my
i have a xml and a xsl file. i want output of xsl in

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.