DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Feb 2011
    Posts
    1

    Question XML to text Boxes

    I need to take my XML data to populate text boxes

    this is what I have.

    Code:
    ProjectReferralTableControlRow rows = new ProjectReferralTableControlRow();
    
                    XmlTextReader obj = new XmlTextReader(@"c:\temp\reg.xml");
                    string sr= "";
                    while(obj.Read())
    
                    
                        switch (obj.NodeType)
                        {
                            case XmlNodeType.Element:
                                sr = obj.Name;
                                break;                      
                                   
                                    case XmlNodeType.Text:
                                                                 
                                           //this.SubConstructionManagerLabel1.Text = obj.GetAttribute("BusinessName");
                                           rows.SubConstructionManager1.Text = obj.GetAttribute("BusinessName");
                                           //break;
                                           rows.SubContactName1.Text = obj.GetAttribute("OwnerName");
                                           //break;
                                           rows.SubAddress1.Text = obj.GetAttribute("Address");
                                          // break;
                                           rows.SubCity1.Text = obj.GetAttribute("City");
                                           //break;
                                           rows.SubState1.Text = obj.GetAttribute("State");
                                          // break;
                                           rows.SubZip1.Text = obj.GetAttribute("ZipCode");
                                          // break;
                                           rows.SubPhone1.Text = obj.GetAttribute("Phone");
                                          // break;
                                           rows.SubFax1.Text = obj.GetAttribute("Fax");
                                           //break;
                                           rows.SubEmail1.Text = obj.GetAttribute("Email");
                                           break;
                                           
                                
                        }
                                
            }
    I am using a table control and repeaters so if I can get this to work.

    I can figure out the rest.


    My XML file read like this.


    Code:
    <?xml version="1.0" encoding="utf-8"?><Registration><BusinessName>North Coast Minority Media, LLC</BusinessName><OwnerName>Louis A. Acosta</OwnerName><Address>2310 Superior Avenue, Suite 260</Address><City>Cleveland</City><State>Ohio</State><ZipCode>44114</ZipCode><Phone>4402420835</Phone><Fax>&amp;nbsp;</Fax><EmailAddress>brotherlew@gmail.com</EmailAddress><BusinessName>Bernard R. Doyle dba FASTSIGNS</BusinessName><OwnerName>Mary C. and Bernard Doyle</OwnerName><Address>2102 St. Clair Avenue</Address><City>Cleveland</City><State>Ohio</State><ZipCode>44114</ZipCode><Phone>2165232288</Phone><Fax>2165231265</Fax><EmailAddress>kayandbernard.doyle@fastsigns.com</EmailAddress><BusinessName>DLR Protection</BusinessName><OwnerName>Darren Robinson</OwnerName><Address>16919 Invermere Avenue</Address><City>Cleveland</City><State>Ohio</State><ZipCode>44128</ZipCode><Phone>2169916018</Phone><Fax>2169916085</Fax><EmailAddress>darrenRobinson@roadrunner.com</EmailAddress></Registration>

  2. #2
    Join Date
    May 2009
    Posts
    60
    read this
    http://www.functionx.com/vbnet/xml/Lesson05.htm

    in your xml file is no attribut

    better make a new xml
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Registration>
    	<item>
    		<BusinessName>North Coast Minority Media, LLC</BusinessName>
    		<OwnerName>Louis A. Acosta</OwnerName>
    		<Address>2310 Superior Avenue, Suite 260</Address>
    		<City>Cleveland</City>
    		<State>Ohio</State>
    		<ZipCode>44114</ZipCode>
    		<Phone>4402420835</Phone>
    		<Fax>&amp;nbsp;</Fax>
    		<EmailAddress>brotherlew@gmail.com</EmailAddress>
    	</item>
    	<item>
    		<BusinessName>Bernard R. Doyle dba FASTSIGNS</BusinessName>
    		<OwnerName>Mary C. and Bernard Doyle</OwnerName>
    		<Address>2102 St. Clair Avenue</Address>
    		<City>Cleveland</City>
    		<State>Ohio</State>
    		<ZipCode>44114</ZipCode>
    		<Phone>2165232288</Phone>
    		<Fax>2165231265</Fax>
    		<EmailAddress>kayandbernard.doyle@fastsigns.com</EmailAddress>
    	</item>
    	<item>
    		<BusinessName>DLR Protection</BusinessName>
    		<OwnerName>Darren Robinson</OwnerName>
    		<Address>16919 Invermere Avenue</Address>
    		<City>Cleveland</City>
    		<State>Ohio</State>
    		<ZipCode>44128</ZipCode>
    		<Phone>2169916018</Phone>
    		<Fax>2169916085</Fax>
    		<EmailAddress>darrenRobinson@roadrunner.com</EmailAddress>
    	</item>
    </Registration>
    your program must search item
    and then read all node in this node

Similar Threads

  1. XML Startkabel Updates
    By xmlstartkabel in forum XML
    Replies: 0
    Last Post: 10-10-2001, 04:07 AM
  2. Replies: 0
    Last Post: 10-01-2001, 12:19 PM
  3. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 11:45 AM
  4. XML tutorials - fyi
    By Jeff Condon in forum XML
    Replies: 0
    Last Post: 05-29-2001, 02:25 PM
  5. XML Security
    By HSIN NING in forum Web
    Replies: 0
    Last Post: 08-21-2000, 12:21 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links