Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / September 2007

Tip: Looking for answers? Try searching our database.

how to instantiate a proxy class that has multiple instances

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
doug - 21 Sep 2007 00:36 GMT
I have a class built from the following XML:
<tag1>
 <tag2>
    <tag3 item="1"/>
    <tag3 item="2"/>
 </tag2>
</tag1>
On the client side I can populate tag1 and tag2, but I don't know how to
instantiate instances of tag3.  I read the values in from external file and I
want to keep adding tag3 instances until no more found on input.
WenYuan Wang [MSFT] - 21 Sep 2007 10:57 GMT
Hello Doug,

According to your description, what you need is to create a XML file which
includes multiple instances of Tag3. Please don't heisate to correct me if
I misunderstood anything here.

Which Technique are you using in application? XmlReader or XmlDocument?

I wrote a code snippet about how to achieved that by XmlDocument. If you
prefers XmlReader, please let me know. I will follow up.

           System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
           System.Xml.XmlNode tag1 =
xd.CreateNode(System.Xml.XmlNodeType.Element, "tag1", null);
           xd.AppendChild(tag1);

           System.Xml.XmlNode tag2 =
xd.CreateNode(System.Xml.XmlNodeType.Element, "tag2", null);
           tag1.AppendChild(tag2);            
           {
               System.Xml.XmlNode tag3 =
xd.CreateNode(System.Xml.XmlNodeType.Element,"tag3",null);
               System.Xml.XmlAttribute item = xd.CreateAttribute("item");
               item.Value = "1";
               tag3.Attributes.Append(item);
               tag2.AppendChild(tag3);
           }
           {
               System.Xml.XmlNode tag3 =
xd.CreateNode(System.Xml.XmlNodeType.Element, "tag3", null);
               System.Xml.XmlAttribute item = xd.CreateAttribute("item");
               item.Value = "2";
               tag3.Attributes.Append(item);
               tag2.AppendChild(tag3);
           }

Hope this helps, please let me if you face any further issue. We are glad
to assist you.
Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
doug - 21 Sep 2007 15:08 GMT
I need to created the XML layout via client side proxyy class.  I'm not
working with the XML dirtectly - but vua web service refererence to the
proxy.  I'm using VB proxy classes.

I've done this before where each node is uniquely identifiable.  Thisd time
<tag1> and <tag2> are unique and I just create variables objTag1 AS req.TAG1
and objTag2 AS req.TAG2.  But tag3 occurs 1 to many times and has an
ITEM="nn" attribute that identifies it and makes it unique.  I do not know
how to create instances of req.TAG3().

doug

> Hello Doug,
>
[quoted text clipped - 41 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
WenYuan Wang [MSFT] - 24 Sep 2007 12:31 GMT
Hello doug,
Thanks for your reply.

It seems this issue is related to Web Service and you are developing a VB
proxy class.
But I still have something unclear. Would you please clarify it for me?

1)    What Web service does your application refer to? Is it an ASP.net Web
service?
2)    Would you please give me a simple project to reproduce this issue on my
side? My alias is v-wywang@microsoft.com

I will perform further research after I got the reproduce project. I'm
waiting for your reply. It's my pleasure to assist you.
Have a great day.
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.