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 / Languages / Managed C++ / May 2004

Tip: Looking for answers? Try searching our database.

how can I acess XML file in Managed C++ application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
allen chang - 25 May 2004 03:28 GMT
I wanna write an application using xml technology with MS.NET2003
VC++.NET,but I don't know how to add xml functionality to my application, So
anybody can offer same artical or snipped codes?

Thank for your the advanced.

Best regards.
Allen Zhang
Daniel =?iso-8859-1?Q?Lidstr=F6m?= - 25 May 2004 09:40 GMT
> I wanna write an application using xml technology with MS.NET2003
> VC++.NET,but I don't know how to add xml functionality to my application, So
> anybody can offer same artical or snipped codes?
>
> Thank for your the advanced.

Here's a snippet from my test program. Hopefully you get the idea.

#using <mscorlib.dll>
#using <System.Xml.dll>

using namespace std;
using namespace LX;
using namespace System::Xml::Serialization;
using namespace System::Xml;
using namespace System;
using namespace System;
using namespace System::Collections;

public __gc class foo
{
public:
 foo()
 {
 }

 foo(System::String* s)
 {
   _s = s;
 }
public:
 [XmlAttributeAttribute(S"name")]
 System::String* _s;
};

public __gc class land_xml
{
public:
 land_xml()
 {
   arr = new System::Collections::ArrayList();
   m_collection = new GeoPointBaseCollection();
   System::String* s = new System::String("Daniel");
   m_collection->Add(s);
 }

public:
 [XmlArray(S"Alignments")]
 [XmlArrayItemAttribute(S"Alignment",__typeof(foo))]
 System::Collections::ArrayList* arr;

 [System::Xml::Serialization::XmlAttributeAttribute("Alignments")]
 GeoPointBaseCollection* m_collection;
};

int test()
{
 using namespace System;
 using namespace System::Xml;
 using namespace System::Xml::Serialization;
 using namespace System::IO;

 land_xml* m_land_xml = new land_xml();
 XmlSerializer* xs = new XmlSerializer(__typeof(land_xml));
 XmlTextWriter* writer = new XmlTextWriter("land_xml2.xml",
System::Text::Encoding::UTF8);
 writer->Formatting = Formatting::Indented;
 xs->Serialize(writer, m_land_xml);
 writer->Close();
 return 0;
}

Signature

Daniel


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.