Click here to Skip to main content
15,902,276 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a class and nee to return xml out put in asp.net web api 2 and i xmla class with different classes and nested and class properties as class
like below
class A
Public B b{get;set;}
public string name{get;set;}
Class B
public string bproperties


output like


<name> tst
<bpropee>xya

could you please assist the best weay that how to follow better standard

What I have tried:

I have created the sp with return different tables from DB
and one class and properties based on table columns from the dataset I have mapped the values to a particular property

but I doubt this is not a better approach to rerun huge XML related information by using this
could you please suggest the best way
Posted
Comments
Member 15627495 21-Aug-22 7:54am    
Hello,

to stay accurate with 'xml' datas , use first a 'xsd'.

It's the content ->schema<- of your 'Xml'.
'xsd' can authenticate ( and repair ) an Xml pattern, it's very powerful.

to shape your xml ( for a better readability )
it's common :
<?xml version="1.0"?>  <element>  // as parent, which contains sub elements     <other element="">child value 1  </element>    <other element="">child value 2  </element>    <other element="">child value 3 </element>  </element>

--------------------------------------------------------

as I don't know about all the datas you put in your xml,
it's a challenge to guess a schema.

It's a 'datas container', but yours.
PIEBALDconsult 22-Aug-22 8:57am    
There is no "best" approach.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900