Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to read urdu text from the following code using C#.

XML
<owl:DatatypeProperty rdf:about="&untitled-ontology-23;حے_رابطہ">
        <rdf:type rdf:resource="&owl;FunctionalProperty"/>
        <rdfs:domain rdf:resource="&untitled-ontology-23;کنٹیکٹ"/>
        <rdfs:range rdf:resource="&xsd;string"/>
    </owl:DatatypeProperty>




can anyone please tell me how to read test using xml in C#.
Posted

 
Share this answer
 
RDF namespace declarations are missing. You can only parse this XML in wider context (if it exists), where the namespaces are declared. You can ignore the problem and recognize the tags in hard-coded way, but that would not be correct.

To make Urdu work, you need to use Unicode. In post cases, people save the file in the UTF-8 encoding, most practical one. Then XML prolog should be
XML
<?xml version="1.0" encoding="utf-8"?>


.NET FCL suggests different ways of XML parsing. This is my short overview of them:

  1. Use System.Xml.XmlDocument class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx.
  2. Use the class System.Xml.XmlTextReader; this is the fastest way of reading, especially is you need to skip some data.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx.
  3. Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx, http://msdn.microsoft.com/en-us/library/bb387063.aspx.


—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900