EDN Admin
Well-known member
Hi
I have some C# code (CreateExRatesRequestFile below, that produces some XML (ReportRequest XML below). The problem I have is that the InputList and Schedule sections on the xml appear as <InputList xmlns=" and <Schedule xmlns=" i.e.
the xmlns="" part causes xsd validation failure. Can you suggest any way that I can remove the xmlns="" parts from the InputList and Schedule sections, while keeping the xmlns in the ReportRequest root? Any help is appreciated.
<br/>
CreateExRatesRequestFile C# code:
private void CreateExRatesRequestFile(string p_FileName, int p_RequestId)<br/>
{<br/>
try<br/>
{<br/>
XNamespace dss = " http://www.reuters.com/Datascope/ReportRequest.xsd http://www.reuters.com/Datascope/ReportRequest.xsd ";<br/>
XElement l_Xml = new XElement(dss + "ReportRequest",<br/>
new XElement("InputList",<br/>
new XElement("InputListAction", "Replace"),<br/>
new XElement("Name", "Exrates_InputList_01"),<br/>
from l_Rate in FxRatesCollection<br/>
select new XElement("Instrument",<br/>
new XElement("IdentifierType", "RIC"),<br/>
new XElement("Identifier", l_Rate.ProviderInstCode),<br/>
new XElement("Description", "RICDescription"),<br/>
new XElement("Exchange", "NYC")<br/>
)<br/>
),<br/>
new XElement("Schedule",<br/>
new XElement("ScheduleAction",
"Replace"),<br/>
new XElement("Name", "Immediate_Schedule_01"),<br/>
new XElement("IntradayPricingSchedule",<br/>
new XElement("InputList",<br/>
new XElement("Name", "Exrates_InputList_01"),<br/>
new XElement("Type", "Instrument")<br/>
),<br/>
new XElement("ReportTemplate",<br/>
new XElement("Name", "Exrates_ReportTemplate_01"),<br/>
new XElement("Type", "IntradayPricing")<br/>
),<br/>
new XElement("OutputFileName", "RequestR" + p_RequestId + ".xml"),<br/>
new XElement("ScheduleImmediate",<br/>
new XElement("Type", "LastUpdate")<br/>
)<br/>
)<br/>
)<br/>
);
Console.WriteLine(l_Xml);<br/>
Console.ReadLine();<br/>
l_Xml.Save(p_FileName);<br/>
}
catch (Exception p_Exception)<br/>
{<br/>
Console.WriteLine(p_Exception);<br/>
Console.ReadLine();<br/>
}<br/>
}
ReportRequest XML:
<?xml version="1.0" encoding="utf-8"?><br/>
<ReportRequest xmlns=" http://www.reuters.com/Datascope/ReportRequest.xsd http://www.reuters.com/Datascope/ReportRequest.xsd <br/>
<InputList xmlns=" <br/>
<InputListAction>Replace</InputListAction><br/>
<Name>Exrates_InputList_01</Name><br/>
<Instrument><br/>
<IdentifierType>RIC</IdentifierType><br/>
<Identifier>ARS=</Identifier><br/>
<Description>RICDescription</Description><br/>
<Exchange>NYC</Exchange><br/>
</Instrument><br/>
<Instrument><br/>
<IdentifierType>RIC</IdentifierType><br/>
<Identifier>EURAUD=</Identifier><br/>
<Description>RICDescription</Description><br/>
<Exchange>NYC</Exchange><br/>
</Instrument><br/>
</InputList><br/>
<Schedule xmlns=" <br/>
<ScheduleAction>Replace</ScheduleAction><br/>
<Name>Immediate_Schedule_01</Name><br/>
<IntradayPricingSchedule><br/>
<InputList><br/>
<Name>Exrates_InputList_01</Name><br/>
<Type>Instrument</Type><br/>
</InputList><br/>
<ReportTemplate><br/>
<Name>Exrates_ReportTemplate_01</Name><br/>
<Type>IntradayPricing</Type><br/>
</ReportTemplate><br/>
<OutputFileName>RequestR111.xml</OutputFileName><br/>
<ScheduleImmediate><br/>
<Type>LastUpdate</Type><br/>
</ScheduleImmediate><br/>
</IntradayPricingSchedule><br/>
</Schedule><br/>
</ReportRequest>
View the full article
I have some C# code (CreateExRatesRequestFile below, that produces some XML (ReportRequest XML below). The problem I have is that the InputList and Schedule sections on the xml appear as <InputList xmlns=" and <Schedule xmlns=" i.e.
the xmlns="" part causes xsd validation failure. Can you suggest any way that I can remove the xmlns="" parts from the InputList and Schedule sections, while keeping the xmlns in the ReportRequest root? Any help is appreciated.
<br/>
CreateExRatesRequestFile C# code:
private void CreateExRatesRequestFile(string p_FileName, int p_RequestId)<br/>
{<br/>
try<br/>
{<br/>
XNamespace dss = " http://www.reuters.com/Datascope/ReportRequest.xsd http://www.reuters.com/Datascope/ReportRequest.xsd ";<br/>
XElement l_Xml = new XElement(dss + "ReportRequest",<br/>
new XElement("InputList",<br/>
new XElement("InputListAction", "Replace"),<br/>
new XElement("Name", "Exrates_InputList_01"),<br/>
from l_Rate in FxRatesCollection<br/>
select new XElement("Instrument",<br/>
new XElement("IdentifierType", "RIC"),<br/>
new XElement("Identifier", l_Rate.ProviderInstCode),<br/>
new XElement("Description", "RICDescription"),<br/>
new XElement("Exchange", "NYC")<br/>
)<br/>
),<br/>
new XElement("Schedule",<br/>
new XElement("ScheduleAction",
"Replace"),<br/>
new XElement("Name", "Immediate_Schedule_01"),<br/>
new XElement("IntradayPricingSchedule",<br/>
new XElement("InputList",<br/>
new XElement("Name", "Exrates_InputList_01"),<br/>
new XElement("Type", "Instrument")<br/>
),<br/>
new XElement("ReportTemplate",<br/>
new XElement("Name", "Exrates_ReportTemplate_01"),<br/>
new XElement("Type", "IntradayPricing")<br/>
),<br/>
new XElement("OutputFileName", "RequestR" + p_RequestId + ".xml"),<br/>
new XElement("ScheduleImmediate",<br/>
new XElement("Type", "LastUpdate")<br/>
)<br/>
)<br/>
)<br/>
);
Console.WriteLine(l_Xml);<br/>
Console.ReadLine();<br/>
l_Xml.Save(p_FileName);<br/>
}
catch (Exception p_Exception)<br/>
{<br/>
Console.WriteLine(p_Exception);<br/>
Console.ReadLine();<br/>
}<br/>
}
ReportRequest XML:
<?xml version="1.0" encoding="utf-8"?><br/>
<ReportRequest xmlns=" http://www.reuters.com/Datascope/ReportRequest.xsd http://www.reuters.com/Datascope/ReportRequest.xsd <br/>
<InputList xmlns=" <br/>
<InputListAction>Replace</InputListAction><br/>
<Name>Exrates_InputList_01</Name><br/>
<Instrument><br/>
<IdentifierType>RIC</IdentifierType><br/>
<Identifier>ARS=</Identifier><br/>
<Description>RICDescription</Description><br/>
<Exchange>NYC</Exchange><br/>
</Instrument><br/>
<Instrument><br/>
<IdentifierType>RIC</IdentifierType><br/>
<Identifier>EURAUD=</Identifier><br/>
<Description>RICDescription</Description><br/>
<Exchange>NYC</Exchange><br/>
</Instrument><br/>
</InputList><br/>
<Schedule xmlns=" <br/>
<ScheduleAction>Replace</ScheduleAction><br/>
<Name>Immediate_Schedule_01</Name><br/>
<IntradayPricingSchedule><br/>
<InputList><br/>
<Name>Exrates_InputList_01</Name><br/>
<Type>Instrument</Type><br/>
</InputList><br/>
<ReportTemplate><br/>
<Name>Exrates_ReportTemplate_01</Name><br/>
<Type>IntradayPricing</Type><br/>
</ReportTemplate><br/>
<OutputFileName>RequestR111.xml</OutputFileName><br/>
<ScheduleImmediate><br/>
<Type>LastUpdate</Type><br/>
</ScheduleImmediate><br/>
</IntradayPricingSchedule><br/>
</Schedule><br/>
</ReportRequest>
View the full article