Xml Case Sensitive

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2007
Posts: 32
Reputation: karan_21584 is an unknown quantity at this point 
Solved Threads: 0
karan_21584 karan_21584 is offline Offline
Light Poster

Xml Case Sensitive

 
0
  #1
Apr 3rd, 2007
hai, i have a XML schema and XML file. Now i want to change the xml <tags> to lowercase... for example <First> <Second>, then i want to same resultant schema and xml file as <first> <second>. could anyone help me plz??? its urgent... thanks in advance.......

and also <xs:element name="Rollno" type="xs:int" minOccurs="0" /> i want to chage the "Rollno" to "rollno"
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Xml Case Sensitive

 
0
  #2
Apr 3rd, 2007
Assuming it is only the contents of the xml tags you want to change and not everything else, you will probably need regular expressions.

Have you a better example?
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 32
Reputation: karan_21584 is an unknown quantity at this point 
Solved Threads: 0
karan_21584 karan_21584 is offline Offline
Light Poster

Re: Xml Case Sensitive

 
0
  #3
Apr 4th, 2007
Originally Posted by iamthwee View Post
Assuming it is only the contents of the xml tags you want to change and not everything else, you will probably need regular expressions.

Have you a better example?
Actually i m trying here with the datamigration concept.once i convert my XML values to an foxpro 9.0 database, its not accepting and CASE SENSITIVE problem occur.so for the remedy, i need to convert the values which is fetching from xml file and xml schema to "ALL LOWERCASE"... for example...

xml file :

<?xml version="1.0" standalone="yes" ?>
- <NewDataSet>
- <Table1>
<No>1</no>

<Name>www</name>

</Table1>


- <Table1>
<No>2</no>

<Name>gfdf</name>

</Table1>


</NewDataSet>

from the above i want to fetch the "no" and "name" and all should be in lowercase.

xml schema :

<?xml version="1.0" standalone="yes" ?> - <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Table1">
- <xs:complexType>
- <xs:sequence>
<xs:element name="No" type="xs:int" minOccurs="0" />

<xs:element name="Name" type="xs:string" minOccurs="0" />

</xs:sequence>


</xs:complexType>


</xs:element>


</xs:choice>


</xs:complexType>


</xs:element>


</xs:schema>

in the above schema, i want to fetch the element name such as "No" and "Name"... but all in lower case. HELP ME PLZ!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Xml Case Sensitive

 
0
  #4
Apr 4th, 2007
I couldn't think of a way to do it with regex:!: Well I could but I couldn't get the replacement to work.

Here is the code that finds everything within the < > then converts it to lowercase leaving the other stuff untouched.

Basically, the form has one button and two rich text boxes. I just used ctrl + v to paste the original xml into the first rich text box.

  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. Dim txt As String
  3. Dim newText As String
  4.  
  5. 'Drag a rich text box onto your form
  6. ' In the properties menu, in name call it
  7. ' RichTextBox1
  8.  
  9. txt = RichTextBox1.Text
  10.  
  11. Dim go As Integer = 0
  12. Dim tmp As String = ""
  13.  
  14. Dim finalString As String = ""
  15.  
  16. For i As Integer = 0 To txt.Length - 1
  17.  
  18. If (txt.Substring(i, 1) = "<") Then
  19. go = 1
  20. End If
  21.  
  22. If go = 1 And (txt.Substring(i, 1) <> ">") Then
  23. tmp = tmp & txt.Substring(i, 1)
  24. End If
  25.  
  26. If go = 0 Then
  27. finalString = finalString & txt.Substring(i, 1)
  28. End If
  29.  
  30. newText = ""
  31. If (txt.Substring(i, 1) = ">") Then
  32.  
  33. tmp = tmp & ">"
  34. finalString = finalString & tmp.ToLower
  35. go = 0 'reset this baby
  36. tmp = "" 'clear the holding string
  37. End If
  38.  
  39. Next
  40.  
  41. 'Drag another rich text box onto your form
  42. ' In the properties menu, under name call it
  43. ' RichTextBox2
  44. RichTextBox2.Text = (finalString)
  45.  
  46. End Sub


And a test using some xml:

Original

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!-- Edited with XML Spy v2007 (http://www.altova.com) -->
  3. <CATALOG>
  4. <CD>
  5. <TITLE>Empire Burlesque</TITLE>
  6. <ARTIST>Bob Dylan</ARTIST>
  7. <COUNTRY>USA</COUNTRY>
  8. <COMPANY>Columbia</COMPANY>
  9. <PRICE>10.90</PRICE>
  10. <YEAR>1985</YEAR>
  11. </CD>
  12. <CD>
  13. <TITLE>Hide your heart</TITLE>
  14. <ARTIST>Bonnie Tyler</ARTIST>
  15. <COUNTRY>UK</COUNTRY>
  16. <COMPANY>CBS Records</COMPANY>
  17. <PRICE>9.90</PRICE>
  18. <YEAR>1988</YEAR>
  19. </CD>
  20. <CD>
  21. <TITLE>Greatest Hits</TITLE>
  22. <ARTIST>Dolly Parton</ARTIST>
  23. <COUNTRY>USA</COUNTRY>
  24. <COMPANY>RCA</COMPANY>
  25. <PRICE>9.90</PRICE>
  26. <YEAR>1982</YEAR>
  27. </CD>
  28. <CD>
  29. <TITLE>Still got the blues</TITLE>
  30. <ARTIST>Gary Moore</ARTIST>
  31. <COUNTRY>UK</COUNTRY>
  32. <COMPANY>Virgin records</COMPANY>
  33. <PRICE>10.20</PRICE>
  34. <YEAR>1990</YEAR>
  35. </CD>
  36. <CD>
  37. <TITLE>Eros</TITLE>
  38. <ARTIST>Eros Ramazzotti</ARTIST>
  39. <COUNTRY>EU</COUNTRY>
  40. <COMPANY>BMG</COMPANY>
  41. <PRICE>9.90</PRICE>
  42. <YEAR>1997</YEAR>
  43. </CD>
  44. <CD>
  45. <TITLE>One night only</TITLE>
  46. <ARTIST>Bee Gees</ARTIST>
  47. <COUNTRY>UK</COUNTRY>
  48. <COMPANY>Polydor</COMPANY>
  49. <PRICE>10.90</PRICE>
  50. <YEAR>1998</YEAR>
  51. </CD>
  52. <CD>
  53. <TITLE>Sylvias Mother</TITLE>
  54. <ARTIST>Dr.Hook</ARTIST>
  55. <COUNTRY>UK</COUNTRY>
  56. <COMPANY>CBS</COMPANY>
  57. <PRICE>8.10</PRICE>
  58. <YEAR>1973</YEAR>
  59. </CD>
  60. <CD>
  61. <TITLE>Maggie May</TITLE>
  62. <ARTIST>Rod Stewart</ARTIST>
  63. <COUNTRY>UK</COUNTRY>
  64. <COMPANY>Pickwick</COMPANY>
  65. <PRICE>8.50</PRICE>
  66. <YEAR>1990</YEAR>
  67. </CD>
  68. <CD>
  69. <TITLE>Romanza</TITLE>
  70. <ARTIST>Andrea Bocelli</ARTIST>
  71. <COUNTRY>EU</COUNTRY>
  72. <COMPANY>Polydor</COMPANY>
  73. <PRICE>10.80</PRICE>
  74. <YEAR>1996</YEAR>
  75. </CD>
  76. <CD>
  77. <TITLE>When a man loves a woman</TITLE>
  78. <ARTIST>Percy Sledge</ARTIST>
  79. <COUNTRY>USA</COUNTRY>
  80. <COMPANY>Atlantic</COMPANY>
  81. <PRICE>8.70</PRICE>
  82. <YEAR>1987</YEAR>
  83. </CD>
  84. <CD>
  85. <TITLE>Black angel</TITLE>
  86. <ARTIST>Savage Rose</ARTIST>
  87. <COUNTRY>EU</COUNTRY>
  88. <COMPANY>Mega</COMPANY>
  89. <PRICE>10.90</PRICE>
  90. <YEAR>1995</YEAR>
  91. </CD>
  92. <CD>
  93. <TITLE>1999 Grammy Nominees</TITLE>
  94. <ARTIST>Many</ARTIST>
  95. <COUNTRY>USA</COUNTRY>
  96. <COMPANY>Grammy</COMPANY>
  97. <PRICE>10.20</PRICE>
  98. <YEAR>1999</YEAR>
  99. </CD>
  100. <CD>
  101. <TITLE>For the good times</TITLE>
  102. <ARTIST>Kenny Rogers</ARTIST>
  103. <COUNTRY>UK</COUNTRY>
  104. <COMPANY>Mucik Master</COMPANY>
  105. <PRICE>8.70</PRICE>
  106. <YEAR>1995</YEAR>
  107. </CD>
  108. <CD>
  109. <TITLE>Big Willie style</TITLE>
  110. <ARTIST>Will Smith</ARTIST>
  111. <COUNTRY>USA</COUNTRY>
  112. <COMPANY>Columbia</COMPANY>
  113. <PRICE>9.90</PRICE>
  114. <YEAR>1997</YEAR>
  115. </CD>
  116. <CD>
  117. <TITLE>Tupelo Honey</TITLE>
  118. <ARTIST>Van Morrison</ARTIST>
  119. <COUNTRY>UK</COUNTRY>
  120. <COMPANY>Polydor</COMPANY>
  121. <PRICE>8.20</PRICE>
  122. <YEAR>1971</YEAR>
  123. </CD>
  124. <CD>
  125. <TITLE>Soulsville</TITLE>
  126. <ARTIST>Jorn Hoel</ARTIST>
  127. <COUNTRY>Norway</COUNTRY>
  128. <COMPANY>WEA</COMPANY>
  129. <PRICE>7.90</PRICE>
  130. <YEAR>1996</YEAR>
  131. </CD>
  132. <CD>
  133. <TITLE>The very best of</TITLE>
  134. <ARTIST>Cat Stevens</ARTIST>
  135. <COUNTRY>UK</COUNTRY>
  136. <COMPANY>Island</COMPANY>
  137. <PRICE>8.90</PRICE>
  138. <YEAR>1990</YEAR>
  139. </CD>
  140. <CD>
  141. <TITLE>Stop</TITLE>
  142. <ARTIST>Sam Brown</ARTIST>
  143. <COUNTRY>UK</COUNTRY>
  144. <COMPANY>A and M</COMPANY>
  145. <PRICE>8.90</PRICE>
  146. <YEAR>1988</YEAR>
  147. </CD>
  148. <CD>
  149. <TITLE>Bridge of Spies</TITLE>
  150. <ARTIST>T'Pau</ARTIST>
  151. <COUNTRY>UK</COUNTRY>
  152. <COMPANY>Siren</COMPANY>
  153. <PRICE>7.90</PRICE>
  154. <YEAR>1987</YEAR>
  155. </CD>
  156. <CD>
  157. <TITLE>Private Dancer</TITLE>
  158. <ARTIST>Tina Turner</ARTIST>
  159. <COUNTRY>UK</COUNTRY>
  160. <COMPANY>Capitol</COMPANY>
  161. <PRICE>8.90</PRICE>
  162. <YEAR>1983</YEAR>
  163. </CD>
  164. <CD>
  165. <TITLE>Midt om natten</TITLE>
  166. <ARTIST>Kim Larsen</ARTIST>
  167. <COUNTRY>EU</COUNTRY>
  168. <COMPANY>Medley</COMPANY>
  169. <PRICE>7.80</PRICE>
  170. <YEAR>1983</YEAR>
  171. </CD>
  172. <CD>
  173. <TITLE>Pavarotti Gala Concert</TITLE>
  174. <ARTIST>Luciano Pavarotti</ARTIST>
  175. <COUNTRY>UK</COUNTRY>
  176. <COMPANY>DECCA</COMPANY>
  177. <PRICE>9.90</PRICE>
  178. <YEAR>1991</YEAR>
  179. </CD>
  180. <CD>
  181. <TITLE>The dock of the bay</TITLE>
  182. <ARTIST>Otis Redding</ARTIST>
  183. <COUNTRY>USA</COUNTRY>
  184. <COMPANY>Atlantic</COMPANY>
  185. <PRICE>7.90</PRICE>
  186. <YEAR>1987</YEAR>
  187. </CD>
  188. <CD>
  189. <TITLE>Picture book</TITLE>
  190. <ARTIST>Simply Red</ARTIST>
  191. <COUNTRY>EU</COUNTRY>
  192. <COMPANY>Elektra</COMPANY>
  193. <PRICE>7.20</PRICE>
  194. <YEAR>1985</YEAR>
  195. </CD>
  196. <CD>
  197. <TITLE>Red</TITLE>
  198. <ARTIST>The Communards</ARTIST>
  199. <COUNTRY>UK</COUNTRY>
  200. <COMPANY>London</COMPANY>
  201. <PRICE>7.80</PRICE>
  202. <YEAR>1987</YEAR>
  203. </CD>
  204. <CD>
  205. <TITLE>Unchain my heart</TITLE>
  206. <ARTIST>Joe Cocker</ARTIST>
  207. <COUNTRY>USA</COUNTRY>
  208. <COMPANY>EMI</COMPANY>
  209. <PRICE>8.20</PRICE>
  210. <YEAR>1987</YEAR>
  211. </CD>
  212. </CATALOG>

After

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!-- edited with xml spy v2007 (http://www.altova.com) -->
  3. <catalog>
  4. <cd>
  5. <title>Empire Burlesque</title>
  6. <artist>Bob Dylan</artist>
  7. <country>USA</country>
  8. <company>Columbia</company>
  9. <price>10.90</price>
  10. <year>1985</year>
  11. </cd>
  12. <cd>
  13. <title>Hide your heart</title>
  14. <artist>Bonnie Tyler</artist>
  15. <country>UK</country>
  16. <company>CBS Records</company>
  17. <price>9.90</price>
  18. <year>1988</year>
  19. </cd>
  20. <cd>
  21. <title>Greatest Hits</title>
  22. <artist>Dolly Parton</artist>
  23. <country>USA</country>
  24. <company>RCA</company>
  25. <price>9.90</price>
  26. <year>1982</year>
  27. </cd>
  28. <cd>
  29. <title>Still got the blues</title>
  30. <artist>Gary Moore</artist>
  31. <country>UK</country>
  32. <company>Virgin records</company>
  33. <price>10.20</price>
  34. <year>1990</year>
  35. </cd>
  36. <cd>
  37. <title>Eros</title>
  38. <artist>Eros Ramazzotti</artist>
  39. <country>EU</country>
  40. <company>BMG</company>
  41. <price>9.90</price>
  42. <year>1997</year>
  43. </cd>
  44. <cd>
  45. <title>One night only</title>
  46. <artist>Bee Gees</artist>
  47. <country>UK</country>
  48. <company>Polydor</company>
  49. <price>10.90</price>
  50. <year>1998</year>
  51. </cd>
  52. <cd>
  53. <title>Sylvias Mother</title>
  54. <artist>Dr.Hook</artist>
  55. <country>UK</country>
  56. <company>CBS</company>
  57. <price>8.10</price>
  58. <year>1973</year>
  59. </cd>
  60. <cd>
  61. <title>Maggie May</title>
  62. <artist>Rod Stewart</artist>
  63. <country>UK</country>
  64. <company>Pickwick</company>
  65. <price>8.50</price>
  66. <year>1990</year>
  67. </cd>
  68. <cd>
  69. <title>Romanza</title>
  70. <artist>Andrea Bocelli</artist>
  71. <country>EU</country>
  72. <company>Polydor</company>
  73. <price>10.80</price>
  74. <year>1996</year>
  75. </cd>
  76. <cd>
  77. <title>When a man loves a woman</title>
  78. <artist>Percy Sledge</artist>
  79. <country>USA</country>
  80. <company>Atlantic</company>
  81. <price>8.70</price>
  82. <year>1987</year>
  83. </cd>
  84. <cd>
  85. <title>Black angel</title>
  86. <artist>Savage Rose</artist>
  87. <country>EU</country>
  88. <company>Mega</company>
  89. <price>10.90</price>
  90. <year>1995</year>
  91. </cd>
  92. <cd>
  93. <title>1999 Grammy Nominees</title>
  94. <artist>Many</artist>
  95. <country>USA</country>
  96. <company>Grammy</company>
  97. <price>10.20</price>
  98. <year>1999</year>
  99. </cd>
  100. <cd>
  101. <title>For the good times</title>
  102. <artist>Kenny Rogers</artist>
  103. <country>UK</country>
  104. <company>Mucik Master</company>
  105. <price>8.70</price>
  106. <year>1995</year>
  107. </cd>
  108. <cd>
  109. <title>Big Willie style</title>
  110. <artist>Will Smith</artist>
  111. <country>USA</country>
  112. <company>Columbia</company>
  113. <price>9.90</price>
  114. <year>1997</year>
  115. </cd>
  116. <cd>
  117. <title>Tupelo Honey</title>
  118. <artist>Van Morrison</artist>
  119. <country>UK</country>
  120. <company>Polydor</company>
  121. <price>8.20</price>
  122. <year>1971</year>
  123. </cd>
  124. <cd>
  125. <title>Soulsville</title>
  126. <artist>Jorn Hoel</artist>
  127. <country>Norway</country>
  128. <company>WEA</company>
  129. <price>7.90</price>
  130. <year>1996</year>
  131. </cd>
  132. <cd>
  133. <title>The very best of</title>
  134. <artist>Cat Stevens</artist>
  135. <country>UK</country>
  136. <company>Island</company>
  137. <price>8.90</price>
  138. <year>1990</year>
  139. </cd>
  140. <cd>
  141. <title>Stop</title>
  142. <artist>Sam Brown</artist>
  143. <country>UK</country>
  144. <company>A and M</company>
  145. <price>8.90</price>
  146. <year>1988</year>
  147. </cd>
  148. <cd>
  149. <title>Bridge of Spies</title>
  150. <artist>T'Pau</artist>
  151. <country>UK</country>
  152. <company>Siren</company>
  153. <price>7.90</price>
  154. <year>1987</year>
  155. </cd>
  156. <cd>
  157. <title>Private Dancer</title>
  158. <artist>Tina Turner</artist>
  159. <country>UK</country>
  160. <company>Capitol</company>
  161. <price>8.90</price>
  162. <year>1983</year>
  163. </cd>
  164. <cd>
  165. <title>Midt om natten</title>
  166. <artist>Kim Larsen</artist>
  167. <country>EU</country>
  168. <company>Medley</company>
  169. <price>7.80</price>
  170. <year>1983</year>
  171. </cd>
  172. <cd>
  173. <title>Pavarotti Gala Concert</title>
  174. <artist>Luciano Pavarotti</artist>
  175. <country>UK</country>
  176. <company>DECCA</company>
  177. <price>9.90</price>
  178. <year>1991</year>
  179. </cd>
  180. <cd>
  181. <title>The dock of the bay</title>
  182. <artist>Otis Redding</artist>
  183. <country>USA</country>
  184. <company>Atlantic</company>
  185. <price>7.90</price>
  186. <year>1987</year>
  187. </cd>
  188. <cd>
  189. <title>Picture book</title>
  190. <artist>Simply Red</artist>
  191. <country>EU</country>
  192. <company>Elektra</company>
  193. <price>7.20</price>
  194. <year>1985</year>
  195. </cd>
  196. <cd>
  197. <title>Red</title>
  198. <artist>The Communards</artist>
  199. <country>UK</country>
  200. <company>London</company>
  201. <price>7.80</price>
  202. <year>1987</year>
  203. </cd>
  204. <cd>
  205. <title>Unchain my heart</title>
  206. <artist>Joe Cocker</artist>
  207. <country>USA</country>
  208. <company>EMI</company>
  209. <price>8.20</price>
  210. <year>1987</year>
  211. </cd>
  212. </catalog>

As you can see all the stuff in the xml tags are converted to lowercase but the remaining stuff isn't.

Disclaimer:
The above code hasn't been 100% tested and no guarantee is given by me. Use at your own risk.

If you have any questions...
Last edited by iamthwee; Apr 4th, 2007 at 4:45 pm.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 32
Reputation: karan_21584 is an unknown quantity at this point 
Solved Threads: 0
karan_21584 karan_21584 is offline Offline
Light Poster

Re: Xml Case Sensitive

 
0
  #5
Apr 5th, 2007
thanks yaar. it helped me a lot to my program. And also i want to convert the schema values.... i.e., ..........
<?xml version="1.0" standalone="yes" ?> - <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Table1">
- <xs:complexType>
- <xs:sequence>
<xs:element name="No" type="xs:int" minOccurs="0" />
<xs:element name="Name" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Here, i want to convert the "No" "Name" to lower case... help me plz. thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Xml Case Sensitive

 
0
  #6
Apr 5th, 2007
Well surely you would just be looking for the:-

<xs:element name="Table1">

Then changing all the stuff in the quotes. Let me think...
Last edited by iamthwee; Apr 5th, 2007 at 3:42 pm.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC