Click here to Skip to main content
12,398,181 members (62,449 online)
   

C#

 
AnswerRe: Android & .NET Pin
Pete O'Hanlon7-Feb-13 22:59
protectorPete O'Hanlon7-Feb-13 22:59 
JokeRe: Android & .NET Pin
Wayne Gaylard7-Feb-13 23:24
mentorWayne Gaylard7-Feb-13 23:24 
QuestionChech if a graph is connected Pin
brkonja7-Feb-13 10:27
memberbrkonja7-Feb-13 10:27 
AnswerRe: Chech if a graph is connected Pin
Super Lloyd7-Feb-13 15:03
memberSuper Lloyd7-Feb-13 15:03 
QuestionC# debug windows Pin
classy_dog7-Feb-13 9:14
memberclassy_dog7-Feb-13 9:14 
AnswerRe: C# debug windows Pin
jibesh7-Feb-13 13:34
memberjibesh7-Feb-13 13:34 
AnswerRe: C# debug windows Pin
Eddy Vluggen8-Feb-13 0:31
mvpEddy Vluggen8-Feb-13 0:31 
QuestionXelement headers and schema definition quandry Pin
DJ 27-Feb-13 4:34
memberDJ 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:

- <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 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
memberMatt T Heffron7-Feb-13 8:00 
QuestionReading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
devvvy6-Feb-13 22:57
memberdevvvy6-Feb-13 22:57 
AnswerRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
Richard Deeming7-Feb-13 1:21
memberRichard Deeming7-Feb-13 1:21 
GeneralRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
devvvy7-Feb-13 14:22
memberdevvvy7-Feb-13 14:22 
AnswerRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
DaveyM697-Feb-13 2:42
mentorDaveyM697-Feb-13 2:42 
AnswerRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
PIEBALDconsult7-Feb-13 3:50
memberPIEBALDconsult7-Feb-13 3:50 
GeneralRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
devvvy7-Feb-13 22:00
memberdevvvy7-Feb-13 22:00 
GeneralRe: Reading Excel (xls+Xlsx) without Excel Interop library or OleDB/Jet? Pin
PIEBALDconsult8-Feb-13 3:48
memberPIEBALDconsult8-Feb-13 3:48 
Questiondata source for a chart Pin
sina rafati nia6-Feb-13 21:26
membersina rafati nia6-Feb-13 21:26 
AnswerRe: data source for a chart Pin
Abhinav S6-Feb-13 23:25
mvpAbhinav S6-Feb-13 23:25 
QuestionXelement headers and schema definition help Pin
DJ 26-Feb-13 12:19
memberDJ 26-Feb-13 12:19 
AnswerRe: Xelement headers and schema definition help Pin
jibesh6-Feb-13 12:34
memberjibesh6-Feb-13 12:34 
AnswerRe: Xelement headers and schema definition help Pin
Richard Deeming7-Feb-13 1:33
memberRichard Deeming7-Feb-13 1:33 
QuestionHow to put videos, with alpha channel, on the image Pin
okutan16-Feb-13 7:02
memberokutan16-Feb-13 7:02 
QuestionCould not evaluate expression Pin
MichCl6-Feb-13 3:16
memberMichCl6-Feb-13 3:16 
AnswerRe: Could not evaluate expression Pin
Pete O'Hanlon6-Feb-13 4:00
protectorPete O'Hanlon6-Feb-13 4:00 
GeneralRe: Could not evaluate expression Pin
Dave Kreskowiak6-Feb-13 4:11
mvpDave 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.


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 26 Jul 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid