Search Results

Search found 58802 results on 2353 pages for 'system xml'.

Page 11/2353 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Linq-to-XML query to select specific sub-element based on additional criteria

    - by BrianLy
    My current LINQ query and example XML are below. What I'd like to do is select the primary email address from the email-addresses element into the User.Email property. The type element under the email-address element is set to primary when this is true. There may be more than one element under the email-addresses but only one will be marked primary. What is the simplest approach to take here? Current Linq Query (User.Email is currently empty): var users = from response in xdoc.Descendants("response") where response.Element("id") != null select new User { Id = (string)response.Element("id"), Name = (string)response.Element("full-name"), Email = (string)response.Element("email-addresses"), JobTitle = (string)response.Element("job-title"), NetworkId = (string)response.Element("network-id"), Type = (string)response.Element("type") }; Example XML: <?xml version="1.0" encoding="UTF-8"?> <response> <response> <contact> <phone-numbers/> <im> <provider></provider> <username></username> </im> <email-addresses> <email-address> <type>primary</type> <address>[email protected]</address> </email-address> </email-addresses> </contact> <job-title>Account Manager</job-title> <type>user</type> <expertise nil="true"></expertise> <summary nil="true"></summary> <kids-names nil="true"></kids-names> <location nil="true"></location> <guid nil="true"></guid> <timezone>Eastern Time (US &amp; Canada)</timezone> <network-name>Domain</network-name> <full-name>Alice</full-name> <network-id>79629</network-id> <stats> <followers>2</followers> <updates>4</updates> <following>3</following> </stats> <mugshot-url> https://assets3.yammer.com/images/no_photo_small.gif</mugshot-url> <previous-companies/> <birth-date></birth-date> <name>alice</name> <web-url>https://www.yammer.com/domain.com/users/alice</web-url> <interests nil="true"></interests> <state>active</state> <external-urls/> <url>https://www.yammer.com/api/v1/users/1089943</url> <network-domains> <network-domain>domain.com</network-domain> </network-domains> <id>1089943</id> <schools/> <hire-date nil="true"></hire-date> <significant-other nil="true"></significant-other> </response> <response> <contact> <phone-numbers/> <im> <provider></provider> <username></username> </im> <email-addresses> <email-address> <type>primary</type> <address>[email protected]</address> </email-address> </email-addresses> </contact> <job-title>Office Manager</job-title> <type>user</type> <expertise nil="true"></expertise> <summary nil="true"></summary> <kids-names nil="true"></kids-names> <location nil="true"></location> <guid nil="true"></guid> <timezone>Eastern Time (US &amp; Canada)</timezone> <network-name>Domain</network-name> <full-name>Bill</full-name> <network-id>79629</network-id> <stats> <followers>3</followers> <updates>1</updates> <following>1</following> </stats> <mugshot-url> https://assets3.yammer.com/images/no_photo_small.gif</mugshot-url> <previous-companies/> <birth-date></birth-date> <name>bill</name> <web-url>https://www.yammer.com/domain.com/users/bill</web-url> <interests nil="true"></interests> <state>active</state> <external-urls/> <url>https://www.yammer.com/api/v1/users/1089920</url> <network-domains> <network-domain>domain.com</network-domain> </network-domains> <id>1089920</id> <schools/> <hire-date nil="true"></hire-date> <significant-other nil="true"></significant-other> </response> </response>

    Read the article

  • How to add XML elements into the toolbox in Visual Studio 2010 RC

    - by Alex Marshall
    I'm trying to edit an XML schema in Visual Studio 2010 Ultimate RC, but when I go to the toolbox (with the schema open and focused) there's absolutely nothing in the Toolbox view, even when every tutorial out there that I've read tells me that there should be. I've tried using the context menu option for resetting the Toolbox to no effect. Is there something I'm missing ? Something I need to install to get this feature of Visual Studio going ?

    Read the article

  • XML Schema (XSD) to Rails ActiveRecord Mapping?

    - by Incomethax
    I'm looking for a way to convert an XML Schema definition file into an ActiveRecord modeled database. Does anyone know of a tool that happens to do this? So far the best way I've found is to first load the XSD into an RDBMS like postgres or mysql and then have rails connect to do a rake db:schema:dump. This however, only leaves me with a database without rails Models. What would be the best way to import/load this xsd based database into rails?

    Read the article

  • c# linq to xml dynamic query

    - by David Archer
    Right, bit of a strange question; I have been doing some linq to XML work recently (see my other recent posts here and here). Basically, I want to be able to create a query that checks whether a textbox is null before it's value is included in the query, like so: XDocument db = XDocument.Load(xmlPath); var query = (from vals in db.Descendants("Customer") where (if(textbox1.Text != "") {vals.Element("CustomerID") == Convert.ToInt32(textbox1.Text) } || if(textbox2.Text != "") {vals.Element("Name") == textbox2.Text}) select vals).ToList();

    Read the article

  • Specify XML schema data type of decimal or blank

    - by Jeremy Stein
    Is there a way in an XML schema to specify that an element may contain either an empty string or a decimal? If I specify the type as xs:decimal like this: <xs:element name="Sample" type="xs:decimal" /> then a blank value would not pass validation: <Sample/> (I realize that the best way to indicate no value would be to not include the element, but I was wondering if there was a way to allow blank or decimal.)

    Read the article

  • How to generate following xml

    - by Mohsan
    hi. i want to generate XML for the following tree type structure. i attached picture. generated xml should be <services> <service> <name>Service 1</name> <categories> <category> <name>Cateogry 1</name> <methods> <method> <name>Method 1</name> </method> </methods> </category> </categories> </service> <service> <name>Service 2</name> <categories> <category> <name>Cateogry 1</name> <methods> <method> <name>Method 1</name> </method> </methods> </category> </categories> </service> <service> <name>Service 3</name> <categories> <category> <name>Cateogry 1</name> <methods> <method> <name>Method 1</name> </method> </methods> </category> </categories> </service> </services>

    Read the article

  • Digitally Sign Parts of a XML document

    - by Eros
    I have an XML document having structure similar to the following <envelop> <header>blaa</header> <message>blaa blaa</message> <footer></footer> </envelop> I want to digitally sign the header and message elements and add the signature to the footer element. How can I sign the elements and then later verify the signature (using .net c#) ?

    Read the article

  • Serialize a message format to xml

    - by anijhaw
    I have a python list as [ (A,{'a':1,'b':2,'c':3,'d':4}), B,{'a':1,'b':2,'c':3,'d':4}), ... ] I want to know if there is a standard library of serializing this kind of list to xml or should I hand code it to a file.

    Read the article

  • Dataset -> XML Document - Load DataSet into an XML Document - C#.Net

    - by NLV
    Hello I'm trying to read a dataset as xml and load it into an XML Document. XmlDocument contractHistoryXMLSchemaDoc = new XmlDocument(); using (MemoryStream ms = new MemoryStream()) { //XmlWriterSettings xmlWSettings = new XmlWriterSettings(); //xmlWSettings.ConformanceLevel = ConformanceLevel.Auto; using (XmlWriter xmlW = XmlWriter.Create(ms)) { xmlW.WriteStartDocument(); dsContract.WriteXmlSchema(xmlW); xmlW.WriteEndDocument(); xmlW.Close(); using (XmlReader xmlR = XmlReader.Create(ms)) { contractHistoryXMLSchemaDoc.Load(xmlR); } } } But I'm getting the error - "Root Element Missing". Any ideas? Update When i do xmlR.ReadInnerXML() it is empty. Does anyone know why? NLV

    Read the article

  • how to merge xml string to main xml document object

    - by CliffC
    how can i merge the following xml string <employee> <name>cliff</name> </employee> to my existing xml document object XmlDocument xmlDoc = new XmlDocument(); XmlElement xmlCompany = xmlDoc.CreateElement("Company"); the final output should look like <Company> <employee> <name>cliff</name> </employee> </Company> thanks

    Read the article

  • WCF Method is returning xml fragment but no xml UTF-8 header

    - by horls
    My method does not return the header, just the root element xml. internal Message CreateReturnMessage(string output, string contentType) { // create dictionaryReader for the Message byte[] resultBytes = Encoding.UTF8.GetBytes(output); XmlDictionaryReader xdr = XmlDictionaryReader.CreateTextReader(resultBytes, 0, resultBytes.Length, Encoding.UTF8, XmlDictionaryReaderQuotas.Max, null); if (WebOperationContext.Current != null) WebOperationContext.Current.OutgoingResponse.ContentType = contentType; // create Message return Message.CreateMessage(MessageVersion.None, "", xdr); } However, the output I get is: <Test> <Message>Hello World!</Message> </Test> I would like the output to render as: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <Test> <Message>Hello World!</Message> </Test>

    Read the article

  • Convert XML attributes to a Dictionary in Linq to XML

    - by NateD
    I've got a program that needs to convert two attributes of a particular tag to the key and value of an Dictionary<int,string>. The XML looks like this: (fragment) <startingPoint coordinates="1,1" player="1" /> and so far my LINQ looks something like this: XNamespace ns = "http://the_namespace"; var startingpoints = from sp in xml.Elements(ns+"startingPoint") from el in sp.Attributes() select el.Value; Which gets me a nice IEnumerable full of things like "1,1" and "1", but there should be a way to adapt something like this answer to do attributes instead of elements. Little help please? Thank you!

    Read the article

  • VB.NET add an element to the XML document with LINQ to XML

    - by Bayonian
    Hi, I'm adding an element to existing XML doc with the following code: Dim theXMLSource As String = Server.MapPath("~/Demo/") & "LabDemo.xml" Dim nodeElement As XElement Dim attrAndValue As XElement = _ <LabService> <ServiceType> <%= txtServiceType.Text.Trim %> </ServiceType> <Level> <%= txtLevel.Text.Trim %> </Level> </LabService> nodeElement.Add(New XElement(attrAndValue)) nodeElement.Save(theXMLSource) It makes error like this: System.NullReferenceException: Object reference not set to an instance of an object. Object reference not set to an instance of an object. Error line: nodeElement.Add(New XElement(attrAndValue)) I debugged it but I couldn't get the error yet. Can you show what the problem is? Thank you

    Read the article

  • Need Simple way to access XML in VB.Net - Pain with Linq-to-Xml

    - by aiart
    Dim myXDoc As XDocument = _ I want to access this in a simple way in VB.Net - Like: Dim Integer SizeXStr = CInt(MyZDoc.Cameras(1).Camera_Desc.@SizeX) ' where (1) is an index Why isn't this implemented in VB.Net? Better yet, type the values with a Schema and eliminate the conversion. Is this so hard? How do I access, in a simple way, data in XML - this would be VERY VERY useful! I have been using Query to try to get the values - when I use MsgBox() to display results, they display, but my main Windows Form is Trashed - changed colors, etc. The system has Bugs. Instead, I have to create an elaborate structure of arrays of objects and read the XML line-by-line and do the same for saving - this is the dark ages. Art

    Read the article

  • Reading xml within xml as String in flex/AS3

    - by duder
    I'm getting XML input that looks like this <?xml version="1.0" encoding="utf-8"?> <data1>this is data 1</data1> <data2>this is data 2</data2> <data3> <3a>this is data 3a</3a> <3b>this is data 3b</3b> <3c> <TextFlow xmlns="http://ns.adobe.com/textLayout/2008"> <p direction="ltr" > <span>some text</span> <span>some additional text</span> </p> <p direction="ltr"> <span>some text</span> <span>some additional text</span> </p> </TextFlow> </3c> </data3> I can read <data1> with event.result.data1 which outputs a string this is data1 But when I do the same thing to event.result.data3.3c, it prints object [object] so I guess it's trying to dig deeper into the tree. But I need the actual string text (not xml tree) starting from and including <TextFlow></TextFlow> to be stored and printed as a string. Any idea what's the syntax for this? The string I'm looking for would look like this: <TextFlow xmlns="http://ns.adobe.com/textLayout/2008"> <p direction="ltr" > <span>some text</span> <span>some additional text</span> </p> <p direction="ltr"> <span>some text</span> <span>some additional text</span> </p> </TextFlow>

    Read the article

  • how to read value of an xml node (single) using linq to xml

    - by Wondering
    Hi All, I have a xml structure similar to below one: <test> <test1>test1 value</test1> </test> Now I am reading the value of node using below LINQ to xml code. var test = from t in doc.Descendants("test") select t.Element("test1").Value; Console.WriteLine("print single node value"); Console.WriteLine(test); above code works fine, but here I have one single node, but to retrive value I am using foreach loop, which I dont think is good..any better way of doing the same thing without a foreach loop Thanks.

    Read the article

  • Stairway to XML: Level 3 - Working with Typed XML

    You can enforce the validation of an XML data type, variable or column by associating it with an XML Schema Collection. SQL Server validates a typed XML value against the rules defined in the schema collection so that INSERT or UPDATE operations will succeed only if the value being inserted or updated is valid as per the rules defined in the Schema Collection. NEW! Deployment Manager Early Access ReleaseDeploy SQL Server changes and .NET applications fast, frequently, and without fuss, using Deployment Manager, the new tool from Red Gate. Try the Early Access Release to get a 20% discount on Version 1. Download the Early Access Release.

    Read the article

  • System.Threading.ThreadAbortException executing WCF service

    - by SURESH GIRIRAJAN
    In one of our prod server we recently ran into issue when we went and update the web.config and try to browse the service. We started seeing the service was not responding and getting the following warning in the application log. Our service is WCF service, BizTalk orchestration exposed as service. We have other prod server where we never ran into this issue, so what’s different with this server. After going thru lot of forum and came up on some Microsoft service pack and hot fix which related to FCN. But I don’t want to apply any patch on this server then we need to do on all the other servers too. So solution is simple, I dropped the existing website, created a new site with different name with updated web.config browse the service. Then dropped that site and recreate the original web site and it worked fine without any issue. Event Viewer:  Event Type:        Warning Event Source:    ASP.NET 2.0.50727.0 Event Category:                Web Event Event ID:              1309 Date:                     6/6/2011 Time:                    5:41:42 PM User:                     N/A Computer:          PRODP02 Description: Event code: 3005 Event message: An unhandled exception has occurred. Event time: 6/6/2011 5:41:42 PM Event time (UTC): 6/6/2011 9:41:42 PM Event ID: a71769f42b304355a58c482bfec267f2 Event sequence: 3 Event occurrence: 1 Event detail code: 0  Application information:     Application domain: /LM/W3SVC/518296899/ROOT/PortArrivals-2-129518698821558995     Trust level: Full     Application Virtual Path: /TESTSVC     Application Path: D:\inetpub\wwwroot\RFID\TESTSVC\     Machine name: PRODP02  Process information:     Process ID: 8752     Process name: w3wp.exe     Account name: domain\BizTalk_Svc_Hostlso  Exception information:     Exception type: ThreadAbortException     Exception message: Thread was being aborted.  Request information:     Request URL: http://localhost:81/TESTSVC/TESTSVCS.svc     Request path: /TESTSVC/TESTSVCS.svc     User host address: 127.0.0.1     User:      Is authenticated: False     Authentication Type:      Thread account name: domain\BizTalk_Svc_Hostlso  Thread information:     Thread ID: 22     Thread account name: domain\BizTalk_Svc_Hostlso     Is impersonating: False     Stack trace:    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)    at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)  at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)    at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  <Description>Handling an exception.</Description> <AppDomain>/LM/W3SVC/518296899/ROOT/TESTSVC-6-129518741899334691</AppDomain> <Exception> <ExceptionType>System.Threading.ThreadAbortException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> <Message>Thread was being aborted.</Message> <StackTrace> at System.Threading.Monitor.Enter(Object obj) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state) at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2() at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke() at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks() at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state) at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) </StackTrace> <ExceptionString>System.Threading.ThreadAbortException: Thread was being aborted.    at System.Threading.Monitor.Enter(Object obj)    at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)    at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)    at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2()    at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke()    at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks()    at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state)    at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)    at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)</ExceptionString>

    Read the article

  • xml schema and using a choice as the document root

    - by mikey
    I have a bit of a newbie xml schema question. I believe the answer is that what I need to do is not possible with schema, but I'd like to be sure. The problem is that I have a webservice that returns a response with one type of root element on success (say <Response), and on a complete failure, returns a document with a different root element (say, <Exception). So, basically, two completely different documents: <Response......</Response OR <Exception....</Exception Is it possible to describe these two different documents with one schema document? It's like I want a choice as the first element under the schema element -- but that isn't valid syntax. I've tried a couple of variants that parse as valid xsd, but don't validate the documents. Any suggestions? Or is this simply not possible? Thanks very much in advance -- m

    Read the article

  • XSD Restrictions based on target xml elements

    - by ??????
    Is it possible in xsd to create restriction based on elements of some type in target (processed) document? For example I have XML like this: <Pets> <Pet name="Murka" /> <Pet name="Browko" /> <Pet name="Tuzik" /> </Pets> <Children> <Child name="Petruk" favoritePet="Browko" /> </Children> so what I want to restrict the attribute "favoritePet" of element "Child" based on existing "Pet" elements. How can I do this?

    Read the article

  • XMl Data Structure

    - by metdos
    Which one of two XML structures below do you prefer? Why? Any other suggestion is welcome :) <Parameters> <Parameter id=username>metdos</Parameter> <Parameter id=password>123</Parameter> </Parameters> or <Parameters> <username>metdos</username> <password>123</password> </Parameters>

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >