By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

problem accessing with DTD data in xml

P: 1
I am having a problem accessing with DTD data in xml.
Expand|Select|Wrap|Line Numbers
  1. Imports System
  2. Imports System.Xml
  3.  
  4.  
  5. Module Module1
  6.  
  7.     Sub Main()
  8.  
  9.         Using reader As XmlReader = XmlReader.Create("00000002.xml")
  10.             While reader.Read()
  11.                 ' Check for start elements.
  12.                 If reader.IsStartElement() Then
  13.  
  14.                     ' See if perls element or article element.
  15.                     If reader.Name = "result" Then
  16.                         Console.WriteLine("Start <result> element.")
  17.  
  18.                     ElseIf reader.Name = "sample" Then
  19.                         Console.WriteLine("Start <sample> element.")
  20.                         ' Get name attribute.
  21.                         Dim attribute As String = reader("samplenumber")
  22.                         If attribute IsNot Nothing Then
  23.                             Console.WriteLine("  Has attribute name: {0}", attribute)
  24.                         End If
  25.  
  26.                         ' Text data.
  27.                         If reader.Read() Then
  28.                             Console.WriteLine("  Text node: {0}", reader.Value.Trim())
  29.                         End If
  30.                     End If
  31.  
  32.                 End If
  33.             End While
  34.         End Using
  35.  
  36.     End Sub
  37. End Module
in xml file

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" standalone="no"?>
  2. <!DOCTYPE result SYSTEM "result.dtd">
  3. <result>
  4. <sample sampleid="1" samplenumber="RLG 512" applname="Starter" n_constituent="12">
  5. <datestart year="2012" month="6" date="19" hour="7" minute="27" second="2"/>
  6. <datestop year="2012" month="6" date="19" hour="7" minute="27" second="32"/>
  7. <constituent id="1" name="Brix" value="     14.04" GH="      1.69" NH="      1.09"/>
  8. <constituent id="2" name="Pol" value="     10.15" GH="      1.69" NH="      1.09"/>
  9. <constituent id="19" name="Trash" value="     28.66" GH="      0.00" NH="6182057154624353400000000000000000.00"/>
  10. <constituent id="20" name="Fibre" value="      9.52" GH="      1.69" NH="      1.09"/>
  11. <constituent id="21" name="Ash" value="     -0.63" GH="      1.69" NH="      1.09"/>
  12. <constituent id="22" name="DryMatter" value="     21.60" GH="      1.69" NH="      1.09"/>
  13. <constituent id="24" name="Glucose" value="      1.13" GH="      1.69" NH="      1.09"/>
  14. <constituent id="25" name="Fructose" value="      1.42" GH="      1.69" NH="      1.09"/>
  15. <constituent id="26" name="PIC" value="      8.68" GH="      0.00" NH="      0.00"/>
  16. <constituent id="27" name="BIC" value="     12.28" GH="      0.00" NH="      0.00"/>
  17. <constituent id="31" name="TRS" value="     11.69" GH="      0.00" NH="509313097534660010000000000000000.00"/>
  18. <constituent id="32" name="Purity" value="     72.31" GH="      0.00" NH="      0.00"/>
  19. </sample>
  20. </result>
Oct 25 '12 #1
Share this Question
Share on Google+
1 Reply


Meetee
Expert Mod 100+
P: 931
Where's the question?. Explain your code and problem.
Oct 25 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.