I have a problem with understanding XML serialization.
In my case I have got XML files with lots of different information about property owner ( address
, buildings
, facilities
,...).
The goal is to write out specific information and integrate them into a data base. I got the tip to use serialization to generate an object structure, but the examples that I a looked at just showed how to produce a new xml file.
How can I work with serialization when I already have an existing xml file I want to filter and then generate an object structure?
Here is a snippet of the XML file:
<Z1ZRMPA SEGMENT="1" DRUCK="0" ORDER="0" VISIBLE="1" ANSPRECHPARTNER="" POSTFACHADRESSE="0" XPathTBconfig="/DEFINES/SAPMUC/EG/PARVWNODES/AG" KOPIEN="1" TITLE="Auftraggeber" ENABLED="N" COLOR="ff00ffff" XPathMailAdrs="/MAILADRESSEN/SAPMUC/AG/ADRESSE[PARNR = '16220223']" PAMAILTO="obfuscated@example.com" PAKOMMENTAR="Antrag: 18.04.2012 Glas" RESULTMAILTESTER="1" NETDOCX="J">
<KZAEN />
<POSNR>000000</POSNR>
<PARVW>AG</PARVW>
<PARNR>16220223</PARNR>
<NAME_LIST />
<NAME1>SVG Wohnen eG</NAME1>
<NAME2 />
<NAME3 />
<NAME4 />
<CITY1>Stuttgart</CITY1>
<CITY2 />
<POST_CODE1>70195</POST_CODE1>
<POST_CODE2 />
<STREET>Regerstr.</STREET>
<PO_BOX />
<HOUSE_NUM1>17</HOUSE_NUM1>
<COUNTRY>DE</COUNTRY>
<LANGU>D</LANGU>
<REGION>BW</REGION>
<DEFLT_COMM />
<REMARK />
<Z1ZRMTE SEGMENT="1">
<KZAEN />
<COMM_TYPE>TEL</COMM_TYPE>
<FLGDEFAULT />
<TEL_NUMBER />
<ETL_EXTENS />
<REMARK />
</Z1ZRMTE>
Open Visual Studio, Add new Class file to your project and then.
You can copy your XML and then go to Edit > Paste Special > Paste XML as Classes and Classes will be generated.
After the classes generated you can Deserialize it using XmlSerializer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.