Click here to Skip to main content
15,881,757 members
Home / Discussions / C#
   

C#

 
AnswerRe: Android & .NET Pin
Pete O'Hanlon7-Feb-13 22:59
mvePete O'Hanlon7-Feb-13 22:59 
JokeRe: Android & .NET Pin
Wayne Gaylard7-Feb-13 23:24
professionalWayne Gaylard7-Feb-13 23:24 
QuestionChech if a graph is connected Pin
brkonja7-Feb-13 10:27
brkonja7-Feb-13 10:27 
AnswerRe: Chech if a graph is connected Pin
Super Lloyd7-Feb-13 15:03
Super Lloyd7-Feb-13 15:03 
QuestionC# debug windows Pin
classy_dog7-Feb-13 9:14
classy_dog7-Feb-13 9:14 
AnswerRe: C# debug windows Pin
Jibesh7-Feb-13 13:34
professionalJibesh7-Feb-13 13:34 
AnswerRe: C# debug windows Pin
Eddy Vluggen8-Feb-13 0:31
professionalEddy Vluggen8-Feb-13 0:31 
QuestionXelement headers and schema definition quandry Pin
DJ 27-Feb-13 4:34
DJ 27-Feb-13 4:34 
Source code:
            XElement Listings = new XElement("Listings");
            XNamespace root = "http://website.RFGCommonSpecListingSchema";
            XNamespace xs = "http://www.w3.org/2001/XMLSchema";
            XNamespace b = "http://schemas.microsoft.com/BizTalk/2003";

            Listings.Add(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")));
            XElement Listing;
            string command = getQuery();

            using (SqlConnection sqlCon = new SqlConnection(connMain))
            {
                sqlCon.Open();
                using (SqlCommand cmd = new SqlCommand(command, sqlCon))
                {
                    
                    using (SqlDataReader Row = cmd.ExecuteReader())
                    {
                        while (Row.Read())
                        {
                            // clearing out the data from pevious MLS
                            featureIN.Clear();

                           
#region XML build
                            //starting XML build

                            //Listings.Add(new XDeclaration("1.0", "utf-16", "true"));

                            Listings.Add(Listing = new XElement("Listing"));
                            Listings.Add(
                                new XElement("ListingKey", Row[3].ToString()),
                                new XElement("ListingIdentifier", Row[3].ToString()),
                                new XElement("Type", Row[4].ToString()),
                                new XElement("ProviderName", "CWS"));


result:

XML
- <Listings>
  <?xml version="1.0" encoding="utf-8"?>
  <xs:schema xmlns="http://website.RFGCommonSpecListingSchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" />
  <Listing />
  <ListingKey>1311618</ListingKey>
  <ListingIdentifier>1311618</ListingIdentifier>
  <Type>Residential Sale</Type>
  <ProviderName>CWS</ProviderName>
  <Listing />
  <ListingKey>1715675</ListingKey>
  <ListingIdentifier>1715675</ListingIdentifier>
  <Type>Residential Sale</Type>
  <ProviderName>CWS</ProviderName>
  <Listing />


I need the header tags above the 'Listings' tag like this:

XML
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="Listings">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Listing" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:sequence>



Anyone have a code that would work? Where am I going wrong with this?
AnswerRe: Xelement headers and schema definition quandry Pin
Matt T Heffron7-Feb-13 8:00
professionalMatt T Heffron7-Feb-13 8:00 
QuestionReading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
devvvy6-Feb-13 22:57
devvvy6-Feb-13 22:57 
AnswerRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
Richard Deeming7-Feb-13 1:21
mveRichard Deeming7-Feb-13 1:21 
GeneralRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
devvvy7-Feb-13 14:22
devvvy7-Feb-13 14:22 
AnswerRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
DaveyM697-Feb-13 2:42
professionalDaveyM697-Feb-13 2:42 
AnswerRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
PIEBALDconsult7-Feb-13 3:50
mvePIEBALDconsult7-Feb-13 3:50 
GeneralRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
devvvy7-Feb-13 22:00
devvvy7-Feb-13 22:00 
GeneralRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
PIEBALDconsult8-Feb-13 3:48
mvePIEBALDconsult8-Feb-13 3:48 
Questiondata source for a chart Pin
sina rafati nia6-Feb-13 21:26
sina rafati nia6-Feb-13 21:26 
AnswerRe: data source for a chart Pin
Abhinav S6-Feb-13 23:25
Abhinav S6-Feb-13 23:25 
QuestionXelement headers and schema definition help Pin
DJ 26-Feb-13 12:19
DJ 26-Feb-13 12:19 
AnswerRe: Xelement headers and schema definition help Pin
Jibesh6-Feb-13 12:34
professionalJibesh6-Feb-13 12:34 
AnswerRe: Xelement headers and schema definition help Pin
Richard Deeming7-Feb-13 1:33
mveRichard Deeming7-Feb-13 1:33 
QuestionHow to put videos, with alpha channel, on the image Pin
okutan16-Feb-13 7:02
okutan16-Feb-13 7:02 
QuestionCould not evaluate expression Pin
MichCl6-Feb-13 3:16
MichCl6-Feb-13 3:16 
AnswerRe: Could not evaluate expression Pin
Pete O'Hanlon6-Feb-13 4:00
mvePete O'Hanlon6-Feb-13 4:00 
GeneralRe: Could not evaluate expression Pin
Dave Kreskowiak6-Feb-13 4:11
mveDave Kreskowiak6-Feb-13 4:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.