|
How do you add the:
="1.0"="utf-16"
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://website.RFGCommonSpecListingSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
for the headers with Xelement?
|
|
|
|
|
by using the XmlSerializerNamespaces[^] you can add the namespaces to your Xmlheader.
sample:
XmlSerializer serializer = new XmlSerializer(typeof(OrderedItem));
OrderedItem i = new OrderedItem();
i.ItemName = "Widget";
i.Description = "Regular Widget";
i.Quantity = 10;
i.UnitPrice = (decimal) 2.30;
i.Calculate();
XmlSerializerNamespaces ns =
new XmlSerializerNamespaces();
ns.Add("inventory", "http://www.cpandl.com");
ns.Add("money", "http://www.cohowinery.com");
Stream fs = new FileStream(filename, FileMode.Create);
XmlWriter writer =
new XmlTextWriter(fs, new UTF8Encoding());
serializer.Serialize(writer, i, ns);
writer.Close();
Jibesh V P
|
|
|
|
|
Using XElement from System.Xml.Linq :
XNamespace root = "http://website.RFGCommonSpecListingSchema";
XNamespace xs = "http://www.w3.org/2001/XMLSchema";
XNamespace b = "http://schemas.microsoft.com/BizTalk/2003";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", null),
new XElement(xs + "schema",
new XAttribute("xmlns", root.NamespaceName),
new XAttribute(XNamespace.Xmlns + "b", b.NamespaceName),
new XAttribute(XNamespace.Xmlns + "xs", xs.NamespaceName),
new XAttribute("targetNamespace", "http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema"),
new XAttribute("elementFormDefault", "qualified"),
new XAttribute("attributeFormDefault", "unqualified"),
)
);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|