Last post Jul 16, 2018 06:35 AM by Nan Yu
Participant
1861 Points
2836 Posts
Jul 15, 2018 08:22 PM|EnenDaveyBoy|LINK
Hi
when you have an element like this in a bigger xml setup
<v1:somefield xmlsns:v1="http:/www.somethinf.com/api/somethin">
so I know v1 is the namespace, but whats it called when you put the xmlsns:v1="http:/www.somethinf.com/api/somethin" on an element?
how do i add this to an elment which isn't the root? I am using models so am looking for a property decorator.
Or does it it just happen on the first element decorated with the element?
All-Star
18815 Points
3831 Posts
Jul 16, 2018 06:35 AM|Nan Yu|LINK
Hi EnenDaveyBoy,
Do you mean the XML Namespace xmlns ? See explanation :
https://stackoverflow.com/questions/1181888/what-does-xmlns-in-xml-mean
https://www.w3schools.com/xml/xml_namespaces.asp
To add xml namespace to element in c#, you can try :
https://stackoverflow.com/questions/2920142/how-to-add-xmlnamespace-to-a-xmldocument
https://stackoverflow.com/questions/2810548/how-to-generate-tag-prefixes-using-xmlserializer
If i misunderstand your scenario , please feel free to let me know .
Best Regards,
Nan Yu
Participant
1861 Points
2836 Posts
understand xml
Jul 15, 2018 08:22 PM|EnenDaveyBoy|LINK
Hi
when you have an element like this in a bigger xml setup
<v1:somefield xmlsns:v1="http:/www.somethinf.com/api/somethin">
so I know v1 is the namespace, but whats it called when you put the xmlsns:v1="http:/www.somethinf.com/api/somethin" on an element?
how do i add this to an elment which isn't the root? I am using models so am looking for a property decorator.
Or does it it just happen on the first element decorated with the element?
All-Star
18815 Points
3831 Posts
Re: understand xml
Jul 16, 2018 06:35 AM|Nan Yu|LINK
Hi EnenDaveyBoy,
Do you mean the XML Namespace xmlns ? See explanation :
https://stackoverflow.com/questions/1181888/what-does-xmlns-in-xml-mean
https://www.w3schools.com/xml/xml_namespaces.asp
To add xml namespace to element in c#, you can try :
https://stackoverflow.com/questions/2920142/how-to-add-xmlnamespace-to-a-xmldocument
https://stackoverflow.com/questions/2810548/how-to-generate-tag-prefixes-using-xmlserializer
If i misunderstand your scenario , please feel free to let me know .
Best Regards,
Nan Yu