Search Results

Search found 5760 results on 231 pages for 'linq to xsd'.

Page 2/231 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • svcutil, XmlSerializer and xsd:list

    - by Dmitry Ornatsky
    I'm using svcutil to generate classes from service metadata. This XML schema <xsd:complexType name="FindRequest"> ... <xsd:attribute name="Significance" type="Significance" use="optional" /> </xsd:complexType> <xsd:simpleType name="Significance"> <xsd:list> <xsd:simpleType> <xsd:restriction base="xsd:int"> <xsd:enumeration value="1" /> <xsd:enumeration value="2" /> <xsd:enumeration value="3" /> </xsd:restriction> </xsd:simpleType> </xsd:list> produces following code: public partial class FindRequest { ... private int significanceField; private bool significanceFieldSpecified; [System.Xml.Serialization.XmlAttributeAttribute()] public int Significance { get { return this.significanceField; } set { this.significanceField = value; } } [System.Xml.Serialization.XmlIgnoreAttribute()] public bool SignificanceSpecified { get { return this.significanceFieldSpecified; } set { this.significanceFieldSpecified = value; } } } My questions are: Is it possible to make XmlSerializer understand this type of list: <FindRequest Significance="1 2 3"/> For example by using some kind of a flags-style enum: public enum EmployeeStatus { [XmlEnum(Name = "1")] One = 1, [XmlEnum(Name = "2")] Two = 2, [XmlEnum(Name = "3")] Three = 4 } If the answer is yes, Is it possible to make svcutil/xsd.exe generate classes that are serialized that way without changing the schema?

    Read the article

  • XSD validation on the sequence of attributes.

    - by infant programmer
    How to validate the sequence of attributes? In my sample XML: <root id1="1" id2="2" id3="3" id4=""> <node/> </root> the appearance of attributes of root must come in same order as written above, however the xsd what I have written accepts the attributes in any order, here is the XSD: <xs:element name="root"> <xs:complexType> <xs:sequence> <xs:element name="node" /> </xs:sequence> <xs:attributeGroup ref="attt"/> </xs:complexType> </xs:element> <xs:attributeGroup name="attt"> <xs:attribute name="id1" type="xs:string" use="required" form="qualified"/> <xs:attribute name="id2" type="xs:string" use="required" form="qualified"/> <xs:attribute name="id3" type="xs:string" use="required" form="qualified"/> <xs:attribute name="id4" type="xs:string" use="required" form="qualified"/> </xs:attributeGroup> Is it possible to put restriction on the sequence of attribute?

    Read the article

  • Using LINQ to fetch result from nested SQL queries

    - by Shantanu Gupta
    This is my first question and first day in Linq so bit difficult day for me to understand. I want to fetch some records from database i.e. select * from tblDepartment where department_id in ( select department_id from tblMap where Guest_Id = @GuestId ) I have taken two DataTable. i.e. tblDepartment, tblMap Now I want to fetch this result and want to store it in third DataTable. How can I do this. I have been able to construct this query up till now after googling. var query = from myrow in _dtDepartment.AsEnumerable() where myrow.Field<int>("Department_Id") == _departmentId select myrow; Please provide me some link for learning Linq mainly for DataTables and DataSets. EDIT: I have got a very similar example here but i m still not able to understand how it is working. Please put some torch on it.

    Read the article

  • LINQ to Entities pulling back entire table

    - by Focus
    In my application I'm pulling back a user's "feed". This contains all of that user's activities, events, friend requests from other users, etc. When I pull back the feed I'm calling various functions to filter the request along the way. var userFeed = GetFeed(db); // Query to pull back all data userFeed = FilterByUser(userFeed, user, db); // Filter for the user userFeed = SortFeed(userFeed, page, sortBy, typeName); // Sort it The data that is returned is exactly what I need, however when I look at a SQL Profile Trace I can see that the query that is getting this data does not filter it at the database level and instead is selecting ALL data in the table(s). This query does not execute until I iterate through the results on my view. All of these functions return an IEnumerable object. I was under the impression that LINQ would take all of my filters and form one query to pull back the data I want instead of pulling back all the data and then filtering it on the server. What am I doing wrong or what don't I understand about the way LINQ evaluates queries?

    Read the article

  • Creating an XSD schema

    - by Nikolai
    I have an xml tag: <ROW field1="value 1" field2="value 2" ... /> fieldi has a string value, and number of attributes fieldi is variable, but not less than 1. Is it possible to create an xsd schema for this tag? possible xml document <ROWDATA> <ROW field1="dfgdf" field2="ddfg"></ROW> <ROW field1="dfedf" field2="djkfg" field3="cdffd"></ROW> <ROW field1="dfedf" field2="djkfg" field3="cdffd" field4="dfedf" field5="djkfg" field6="cdffd"></ROW> </ROWDATA> in this xml document, which I receive from a web server, can be a variable number of attributes field (I noted them as fieldi, where i means the order of a specific attribute field) So I have, unknown number of ROW elements and unknown number of field attributes in the ROW element Thanks

    Read the article

  • How can I do this with LINQ?

    - by Liam
    All I'm after doing is this: SELECT CallTypeID, Count(CallTypeID) as NumberOfCalls FROM [Helpdesk_HR].[dbo].[CallHeader] WHERE CallHeader.DateOpened <= GETDATE()-7 GROUP BY CallTypeID in LINQ. But I can't work out a way of doing it and getting it to work. I would use Linqer, but my company won't pay for it at present. Any help is greatly appreciated as I'm sure the answer is obvious. It's just been one of those days today.

    Read the article

  • LINQ Query Help!

    - by rk1962
    Can someone hep me converting the following SQL query into LINQ? select convert(varchar(10),date,110) as 'Date', max(users) as 'Maximum Number of Users', max(transactions) as 'Maximum Number of Transactions' from stats where datepart(Year, Date) = '2010' group by convert(varchar(10),date,110) order by convert(varchar(10),date,110) Thank you in advance!

    Read the article

  • Method 'SingleOrDefault' not supported by Linq to Entities

    - by user300992
    I read other posts on similar problem on using SingleOfDefault on Linq-To-Entity, some suggested using "First()" and some others suggested using "Extension" method to implement the Single(). This code throws exception: Movie movie = (from a in movies where a.MovieID == '12345' select a).SingleOrDefault(); If I convert the object query to a List using .ToList(), "SingleOrDefault()" actually works perfectly without throwing any error. My question is: Is it not good to convert to List? Is it going to be performance issue for more complicated queries? What does it get translated in SQL? Movie movie = (from a in movies.ToList() where a.MovieID == '12345' select a).SingleOrDefault();

    Read the article

  • Use Any() and Count() in Dynamic Linq

    - by ArpanDesai
    I am trying to write dynamic Linq Library query to fetch record on condition, Customers who has order count is greater than 3 and ShipVia field equal 2. Below is my syntax what i have tried. object[] objArr = new object[10]; objArr[0] = 1; IQueryable<Customer> test = db.Customers.Where("Orders.Count(ShipVia=2)", objArr); and IQueryable<Customer> test = db.Customers.Where("Orders.Any(ShipVia=2).Count()", objArr); But both are not working. In second query Any returns true so it won't work with Count. Suggest me a way to implement this.

    Read the article

  • return from a linq where statement

    - by Vaccano
    I have the following link function MyLinqToSQLTable.Where(x => x.objectID == paramObjectID).ToList(); I most of the time you can change a linq call to be several lines by adding curly brackets around the method body. Like this: MyLinqToSQLTable.Where(x => { x.objectID == paramObjectID; }).ToList(); Problem is the implied return that was there when I just did a Boolean compare is now not done. Return (x.objectID == paramObjectID); is not accepted either. How do do this? can I do this? NOTE: I know that I can add another where clause if needed. But I would still like to know the answer to this.

    Read the article

  • Parse XML tree with no id using LINQ to XML

    - by Danny
    Requirement I want to read a XML tree, fill my objects with encountered attributes and after every run a method (insert it into my db). The amount of parents is not specified, also the order is not specified, it could be, address-death-death-address-address for example Input file Overview: <Root> <Element> <Element2> <Parent> <Child> <Grandchild> <Grandchild> </Child> </Parent> </Element2> </Element1> </Root> Full example: <?xml version="1.0" encoding="utf-8" ?> <Root> <Element1> <Element2> <Parent> <Child> <Grandchild> <number>01</number> <name>Person</name> <Rows> <Row> <number>0110</number> <name>ID</name> <value>123456789</value> </Row> </Rows> </Grandchild> <Grandchild> <number>08</number> <name>Address</name> <Rows> <Row> <number>1110</number> <name>street</name> <value>first aveneu</value> </Row> <Row> <number>1120</number> <name>streetnumber</name> <value>345</value> </Row> <Row> <number>1130</number> <name>zip</name> <value>2938PS</value> </Row> <Row> <number>1160</number> <name>country</name> <value>Germany</value> </Row> </Rows> </Grandchild> </Child> </Parent> <Parent> <Child> <Grandchild> <number>01</number> <name>Person</name> <Rows> <Row> <number>0110</number> <name>ID</name> <value>987654321</value> </Row> </Rows> </Grandchild> <Grandchild> <number>06</number> <name>Death</name> <Rows> <Row> <number>0810</number> <name>date</name> <value>2012-01-03</value> </Row> <Row> <number>0820</number> <name>placeOfDeath</name> <value>attic</value> </Row> <Row> <number>0830</number> <name>funeral</name> <value>burrial</value> </Row> </Rows> </Grandchild> </Child> </Parent> </Element2> </Element1> </Root> Desired result After encounter of parent determine type of grandchild (number 6 is death number 8 is address) Every parent has ALWAYS grandchild number 1 'Person', the second grandchild is either death or address. reading first parent Person person = new Person(); person.ID = value; <--- filled with 123456789 person.street = value; <--- filled with first aveneu person.streetnumber = value; <--- filled with 345 person.zip = value; <--- filled with 2938PS person.country = value; <--- filled with germany person.DoMethod(); // inserts the value in db Continue reading next parent. Person person = new Person(); person.ID = value; <--- filled with 987654321 person.date = value; <--- filled with 2012-01-03 person.placeOfDeath = value; <--- filled with attic person.funeral = value; <--- filled with burrial person.DoMethod(); // insert the values in db Continue reading till no parents found EDIT: how do I target the name element of the second grandchild for every child? Like address or death Code/Credit I got no further then this, with help of Daniel Hilgarth: Linq to XML (C#) parse XML tree with no attributes/id to object The XML tree has changed, and I am really stuck.. in the meantime I try to post new working code...

    Read the article

  • Linq to XSD processing

    - by goel
    For Typed Xml to Linq processing ,do i need to download Linq to XSD alpha installer or is it available in VS 2008 ? (I am using VS 2008 Professional edition).

    Read the article

  • Why I am getting Null from this statement. Query Syntax in C#

    - by Shantanu Gupta
    This is not working. Returns Null to dept_list. var dept_list = ((from map in DtMapGuestDepartment.AsEnumerable() where map.Field<Nullable<long>>("Guest_Id") == 174 select map.Field<Nullable<long>>("Department_id")).Distinct())as IEnumerable<DataRow>; DataTable dt = dept_list.CopyToDataTable(); //dept_list comes null here This works as desired. var dept_list = from map in DtMapGuestDepartment.AsEnumerable() where map.Field<Nullable<long>>("Guest_Id") == 174 select map; DataTable dt = dept_list.CopyToDataTable(); //when used like this runs correct. What mistake is being done by me here. ?

    Read the article

  • PHP XML Validation

    - by efritz
    What's the best way to validate an XML file (or a portion of it) against multiple XSD files? For example, I have the following schema for a configuration loader: <xsd:schema xmlns="http://www.kauriproject.org/schema/configuration" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.kauriproject.org/schema/configuration" elementFormDefault="qualified"> <xsd:element name="configuration" type="configuration" /> <xsd:complexType name="configuration"> <xsd:choice maxOccurs="unbounded"> <xsd:element name="import" type="import" minOccurs="0" maxOccurs="unbounded" /> <xsd:element name="section" type="section" /> </xsd:choice> </xsd:complexType> <xsd:complexType name="section"> <xsd:sequence> <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="type" type="xsd:string" use="required" /> </xsd:complexType> <xsd:complexType name="import" mixed="true"> <xsd:attribute name="resource" type="xsd:string" /> </xsd:complexType> </xsd:schema> As the Configuration class exists now, it lets one add a <section> tag with a define concrete parser class (much like custom configuration sections in ASP.NET). However, I'm unsure of how to validate the section being parsed. If it possible to validate just this section of code with an XSD file/string without writing it back to a file?

    Read the article

  • How to differentiate between to similer fields in Linq Join tables

    - by Azhar
    How to differentiate between to select new fields e.g. Description c.Description and lt.Description DataTable lDt = new DataTable(); try { lDt.Columns.Add(new DataColumn("AreaTypeID", typeof(Int32))); lDt.Columns.Add(new DataColumn("CategoryRef", typeof(Int32))); lDt.Columns.Add(new DataColumn("Description", typeof(String))); lDt.Columns.Add(new DataColumn("CatDescription", typeof(String))); EzEagleDBDataContext lDc = new EzEagleDBDataContext(); var lAreaType = (from lt in lDc.tbl_AreaTypes join c in lDc.tbl_AreaCategories on lt.CategoryRef equals c.CategoryID where lt.AreaTypeID== pTypeId select new { lt.AreaTypeID, lt.Description, lt.CategoryRef, c.Description }).ToArray(); for (int j = 0; j< lAreaType.Count; j++) { DataRow dr = lDt.NewRow(); dr["AreaTypeID"] = lAreaType[j].LandmarkTypeID; dr["CategoryRef"] = lAreaType[j].CategoryRef; dr["Description"] = lAreaType[j].Description; dr["CatDescription"] = lAreaType[j].; lDt.Rows.Add(dr); } } catch (Exception ex) { }

    Read the article

  • How to differentiate between two similar fields in Linq Join tables

    - by Azhar
    How to differentiate between two select new fields e.g. Description c.Description and lt.Description DataTable lDt = new DataTable(); try { lDt.Columns.Add(new DataColumn("AreaTypeID", typeof(Int32))); lDt.Columns.Add(new DataColumn("CategoryRef", typeof(Int32))); lDt.Columns.Add(new DataColumn("Description", typeof(String))); lDt.Columns.Add(new DataColumn("CatDescription", typeof(String))); EzEagleDBDataContext lDc = new EzEagleDBDataContext(); var lAreaType = (from lt in lDc.tbl_AreaTypes join c in lDc.tbl_AreaCategories on lt.CategoryRef equals c.CategoryID where lt.AreaTypeID== pTypeId select new { lt.AreaTypeID, lt.Description, lt.CategoryRef, c.Description }).ToArray(); for (int j = 0; j< lAreaType.Count; j++) { DataRow dr = lDt.NewRow(); dr["AreaTypeID"] = lAreaType[j].LandmarkTypeID; dr["CategoryRef"] = lAreaType[j].CategoryRef; dr["Description"] = lAreaType[j].Description; dr["CatDescription"] = lAreaType[j].; lDt.Rows.Add(dr); } } catch (Exception ex) { }

    Read the article

  • How can I validate XML against an XSD with distinct imports and namespaces?

    - by Pedrolopes
    Hi there!! I am trying to validate a few XML files and I'm failing due to various issues with the XSD definition and the namespaces... This is public info, so no problem sharing data: the main XSD is at http://bioinformatics.ua.pt/euadr/euadr_types.xsd and it imports another XSD at the same location name common_types.xsd, I've validated them in W3C validator, and they passed. The XML <?xml version="1.0"?> <relationship xmlns="http://euadr.biosemantic.erasmusmc.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://euadr.biosemantic.erasmusmc.org/ http://bioinformatics.ua.pt/euadr/euadr_types.xsd"> <sourceId> <source>SMILE</source> <code>[S]1(=O)(=O)N(C(</code> </sourceId> <targetId> <source>UP</source> <code>P35354</code> </targetId> <creator>http://cgl.imim.es</creator> <observationDateTime>2010-05-12T19:03:40.097+02:00</observationDateTime> <informationSources> <informationSource> <relationshipType>BINDS</relationshipType> <interaction> <type>pIC50</type> <value>6.55</value> </interaction> <evidence> <type>OBSERVATIONAL</type> <value>1.0</value> </evidence> <databaseIds> <databaseId> <source>PDSP</source> <code> P35354</code> </databaseId> </databaseIds> </informationSource> </informationSources> </relationship> is straightforward and well-formed! I've tested a few online validators, and I'm getting the following error cvc-elt.1: Cannot find the declaration of element 'relationship'. Does anyone has any idea of what the problem is? Is it in the declaration of the namespaces? Of the XSD? Thanks in advance for your help! Cheers!

    Read the article

  • XML validation error when using multiple schema files/namespaces

    - by user129609
    Hi, I've been reading a ton about xml and learning a lot but I am stuck on one error. I have a schema defined in multiple files and I can't get it to work. Here is an example ================================== libraryBooks.xsd <?xml version="1.0" encoding="utf-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:MyNamespace" targetNamespace="urn:MyNamespace" elementFormDefault="qualified" > <xsd:element name="libraryBooks" type="libraryBooksType"/> <xsd:complexType name="libraryBooksType"> <xsd:sequence> <xsd:any minOccurs="0"/> </xsd:sequence> <xsd:attribute name="name" type="xsd:string"/> </xsd:complexType> </xsd:schema> ================================== book.xsd <?xml version="1.0" encoding="utf-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:MyNamespace2" targetNamespace="urn:MyNamespace2" elementFormDefault="qualified" > <xsd:element name="book" type="booksType"/> <xsd:complexType name="bookType"> <xsd:attribute name="title" type="xsd:string"/> </xsd:complexType> </xsd:schema> ================================== myXml.xml <?xml version="1.0" encoding="utf-8" ?> <libraryBooks xmlns="urn:MyNamespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:MyNamespace file:///C:/libraryBooks.xsd" name="CentralLibrary"> <mn2:book xmlns:mn2="file:///C:/book.xsd" title="How to make xml work the way I want"> </mn2:book> </libraryBooks> So the error I get would be "The 'file:///C:/book.xsd:book' element is not found". Any ideas? I'm almost certain it is something simple

    Read the article

  • how to get cartesian products between database and local sequences in linq?

    - by JD
    I saw this similar question here but can't figure out how to use Contains in Cartesian product desired result situation: http://stackoverflow.com/questions/1712105/linq-to-sql-exception-local-sequence-cannot-be-used-in-linq-to-sql-implementatio Let's say I have following: var a = new [] { 1, 4, 7 }; var b = new [] { 2, 5, 8 }; var test = from i in a from j in b select new { A = i, B = j, AB = string.Format("{0:00}a{1:00}b", i, j), }; foreach (var t in test) Console.Write("{0}, ", t.AB); This works great and I get a dump like so (note, I want the cartesian product): 01a02b, 01a05b, 01a08b, 04a02b, 04a05b, 04a08b, 07a02b, 07a05b, 07a08b, Now what I really want is to take this and cartesian product it again against an ID from a database table I have. But, as soon as I add in one more from clause that instead of referencing objects, references SQL table, I get an error. So, altering above to something like so where db is defined as a new DataContext (i.e., class deriving from System.Data.Linq.DataContext): var a = new [] { 1, 4, 7 }; var b = new [] { 2, 5, 8 }; var test = from symbol in db.Symbols from i in a from j in b select new { A = i, B = j, AB = string.Format("{0}{1:00}a{2:00}b", symbol.ID, i, j), }; foreach (var t in test) Console.Write("{0}, ", t.AB); The error I get is following: Local sequence cannot be used in LINQ to SQL implementations of query operators except the Contains operator Its related to not using Contains apparently but I'm unsure how Contains would be used when I don't really want to constrict the results - I want the Cartesian product for my situation. Any ideas of how to use Contains above and still yield the Cartesian product when joining database and local sequences?

    Read the article

  • how to: re-assemble machine generated classes from xsd files to their original nested state.

    - by Paul Connolly
    Hi everyone, I'm working in Visual Studio 2008 using c#. Let's say I have 2 xsd files e.g "Envelope.xsd" and "Body.xsd" I create 2 sets of classes by running xsd.exe, creating something like "Envelope.cs" and "Body.cs", so far so good. I can't figure out how to link the two classes to serialize (using XmlSerializer) into the proper nested xml, i.e: I want: <Envelope><DocumentTitle>Title</DocumentTitle><Body>Body Info</Body></Envelope> But I get: <Envelope><DocumentTitle>Title</DocumentTitle></Envelope><Body>Body Info</Body> Could someone perhaps show me how the two .cs classes should look to enable XmlSerializer to runt the desired nested result? Thanks a million Paul

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >