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 9226811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:55:11+00:00 2026-06-18T04:55:11+00:00

My XML is like bellow <?xml version=1.0 encoding=UTF-8?> <Students> <![CDATA[<?xml version=1.0 encoding=UTF-8?> <Student><rno>1</rno><name>xyz</name> </student>]]>

  • 0

My XML is like bellow

<?xml version="1.0" encoding="UTF-8"?>
<Students>
<![CDATA[<?xml version="1.0" encoding="UTF-8"?> <Student><rno>1</rno><name>xyz</name>     </student>]]>
</Students>

with the help of XSL i want to retrieve the value of rno which is present inside cdata section. How I can read this value

  • 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-18T04:55:13+00:00Added an answer on June 18, 2026 at 4:55 am

    First of all, in your xml you should replace </student> by </Student> .
    Because XML tags are case sensitive reference here.

    The trick to do that on your own is the following :

    public static String getRNO(){
    
        String valueRetrieved = null;
    
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = null;
        Document doc = null;
    
        try {
            db = dbf.newDocumentBuilder();
            doc = db.parse(new File("D:\\Loic_Workspace\\Test2\\res\\test.xml"));
            NodeList ndList = doc.getElementsByTagName("Students");
            String xmlRetrieved = ndList.item(0).getTextContent();
    
            if(xmlRetrieved != null) {
                //CALL OF STRING REPLACE METHOD TO PREVENT FROM
                //at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
                //at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source
                xmlRetrieved = xmlRetrieved.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
    
                doc = db.parse(new InputSource(new StringReader(xmlRetrieved)));
                valueRetrieved = doc.getElementsByTagName("rno").item(0).getTextContent();
            }
    
    
        } catch (ParserConfigurationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SAXException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    
    
        return valueRetrieved;
    
    }
    

    Hope it helps 😉

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

Sidebar

Related Questions

I am working with layout like in below xml code <?xml version=1.0 encoding=utf-8?> <LinearLayout
Here I i'm trying to parsing a XML in like below: <?xml version=1.0 encoding=utf-8
Hi I'm reading in an XML document like below <?xml version=1.0 encoding=utf-8?> <ArrayOfSYMBOL xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
I have an xml code that looks like below: <?xml version=1.0 encoding=UTF-8?> <metadata><fields><field-order/></fields><roles><role name=DEFAULT3_MOD><state
I have a XML like this: <?xml version=1.0 encoding=UTF-8?> <nodes> <n c=value2/> <n>Has a
I write a theme in styles.xml file like below <?xml version=1.0 encoding=utf-8?> <resources> <!--
I have the following xml <?xml version=1.0 encoding=utf-8?> <Response> <Function Name=GetSomethingById> <something idSome=1 Code=1
I have an xml like below: <?xml version=1.0 encoding=utf-8?> <GetSavedReportResponse> <ResponseType>Success</ResponseType> <FileModifiedDateTime>2012-01-03T17:05:04</FileModifiedDateTime> <FileSizeBytes>7816</FileSizeBytes> <FileDataFormat>XML</FileDataFormat>
I have a XML Like this: <?xml version=1.0 encoding=utf-8?> <soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema> <soap:Body>
If I have a drawable shape: <?xml version=1.0 encoding=UTF-8?> <shape xmlns:android=http://schemas.android.com/apk/res/android android:shape=rectangle> <stroke android:width=2dp

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.