Search Results

Search found 2761 results on 111 pages for 'sequence generators'.

Page 30/111 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • Getting started with XSD validation with C#

    - by Rosarch
    Here is my first attempt at validating XML with XSD. The XML file to be validated: <?xml version="1.0" encoding="utf-8" ?> <config xmlns="Schemas" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd"> <levelVariant> <filePath>SampleVariant</filePath> </levelVariant> <levelVariant> <filePath>LegendaryMode</filePath> </levelVariant> <levelVariant> <filePath>AmazingMode</filePath> </levelVariant> </config> The XSD, located in "Schemas/config.xsd" relative to the XML file to be validated: <?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="config"> <xs:complexType> <xs:sequence> <xs:element name="levelVariant"> <xs:complexType> <xs:sequence> <xs:element name="filePath" type="xs:anyURI"> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Right now, I just want to validate the XML file precisely as it appears currently. Once I understand this better, I'll expand more. Do I really need so many lines for something as simple as the XML file as it currently exists? The validation code in C#: public void SetURI(string uri) { XElement toValidate = XElement.Load(Path.Combine(PATH_TO_DATA_DIR, uri) + ".xml"); // begin confusion string schemaURI = toValidate.Attributes("xmlns").First().ToString() + toValidate.Attributes("xsi:noNamespaceSchemaLocation").First().ToString(); XmlSchemaSet schemas = new XmlSchemaSet(); schemas.Add("", XmlReader.Create( SOMETHING )); XDocument toValidateDoc = new XDocument(toValidate); toValidateDoc.Validate(schemas, null); // end confusion root = toValidate; } Any illumination would be appreciated.

    Read the article

  • Returning Arrays from .net web service to Java ME web service results in compile error of stub?

    - by sphereinabox
    So, I'm getting some compile errors on netbeans 6.5 generated web service code for a java ME client to a c# (vs2005) web service. I've trimmed my example significantly, and it still shows the problem, and not being able to return a collection of things is pretty much a deal-breaker. c# web service (SimpleWebService.asmx) <%@ WebService Language="C#" Class="SimpleWebService" %> using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; [WebService(Namespace = "http://sphereinabox.com/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class SimpleWebService : System.Web.Services.WebService { [WebMethod] public CustomType[] GetSomething() { return new CustomType[] {new CustomType("hi"), new CustomType("bye")}; } public class CustomType { public string Name; public CustomType(string _name) { Name = _name; } public CustomType() { } } } WSDL (automatically generated by vs2005): <?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://sphereinabox.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://sphereinabox.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="http://sphereinabox.com/"> <s:element name="GetSomething"> <s:complexType /> </s:element> <s:element name="GetSomethingResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="GetSomethingResult" type="tns:ArrayOfCustomType" /> </s:sequence> </s:complexType> </s:element> <s:complexType name="ArrayOfCustomType"> <s:sequence> <s:element minOccurs="0" maxOccurs="unbounded" name="CustomType" nillable="true" type="tns:CustomType" /> </s:sequence> </s:complexType> <s:complexType name="CustomType"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" /> </s:sequence> </s:complexType> </s:schema> </wsdl:types> <wsdl:message name="GetSomethingSoapIn"> <wsdl:part name="parameters" element="tns:GetSomething" /> </wsdl:message> <wsdl:message name="GetSomethingSoapOut"> <wsdl:part name="parameters" element="tns:GetSomethingResponse" /> </wsdl:message> <wsdl:portType name="SimpleWebServiceSoap"> <wsdl:operation name="GetSomething"> <wsdl:input message="tns:GetSomethingSoapIn" /> <wsdl:output message="tns:GetSomethingSoapOut" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="SimpleWebServiceSoap" type="tns:SimpleWebServiceSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="GetSomething"> <soap:operation soapAction="http://sphereinabox.com/GetSomething" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="SimpleWebServiceSoap12" type="tns:SimpleWebServiceSoap"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="GetSomething"> <soap12:operation soapAction="http://sphereinabox.com/GetSomething" style="document" /> <wsdl:input> <soap12:body use="literal" /> </wsdl:input> <wsdl:output> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="SimpleWebService"> <wsdl:port name="SimpleWebServiceSoap" binding="tns:SimpleWebServiceSoap"> <soap:address location="http://localhost/SimpleWebService/SimpleWebService.asmx" /> </wsdl:port> <wsdl:port name="SimpleWebServiceSoap12" binding="tns:SimpleWebServiceSoap12"> <soap12:address location="http://localhost/SimpleWebService/SimpleWebService.asmx" /> </wsdl:port> </wsdl:service> </wsdl:definitions> Generated (netbeans) code that fails to compile, this was created going through the "Add - New JavaME to Web Services Client" wizard. (SimpleWebService_Stub.java) public ArrayOfCustomType GetSomething() throws java.rmi.RemoteException { Object inputObject[] = new Object[] { }; Operation op = Operation.newInstance( _qname_operation_GetSomething, _type_GetSomething, _type_GetSomethingResponse ); _prepOperation( op ); op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "http://sphereinabox.com/GetSomething" ); Object resultObj; try { resultObj = op.invoke( inputObject ); } catch( JAXRPCException e ) { Throwable cause = e.getLinkedCause(); if( cause instanceof java.rmi.RemoteException ) { throw (java.rmi.RemoteException) cause; } throw e; } //////// Error on next line, symbol ArrayOfCustomType_fromObject not defined return ArrayOfCustomType_fromObject((Object[])((Object[]) resultObj)[0]); } it turns out with this contrived example (the "CustomType" in my production problem has more than one field) I also get errors from this fun code in the same generated (SimpleWebService_Stub.java) generated code. The errors are that string isn't defined (it's String in java, and besides I think this should be talking about CustomType anyway). private static string string_fromObject( Object obj[] ) { if(obj == null) return null; string result = new string(); return result; }

    Read the article

  • Xsd recursion of complexTypes

    - by Hatch
    I am just learning XML/XSD and am struggling with the implementation of an XML-schema which models a folder structure. What I had in mind was defining a complexType for the folder which can have additional folder instances that represent subfolders. Using the xsd schema validator here always returns that the schema is invalid. I tried defining the complexType up front and then using the ref keyword for subfolders: <xs:complexType name="tFolder"> <xs:sequence> <xs:element name="Path" type="tFolderType" msdata:Ordinal="0" /> <xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" /> <xs:element name="File" nillable="true" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:simpleContent msdata:ColumnName="File_Text" msdata:Ordinal="0"> <xs:extension base="xs:string"> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="Type" type="tFolderType" /> As for the element itself: <xs:element name="Folder" type="tFolder" /> The error returned by the validator is: "Cannot resolve the name 'Folder' to a(n) 'element declaration' component." and the error occurs at the line <xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" /\> Defining the complexType within the element itself yields the exact same error: <xs:element name="Folder"> <xs:complexType> <xs:sequence> <xs:element name="Path" type="tFolderType" msdata:Ordinal="0" /> <xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" /> <xs:element name="File" nillable="true" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:simpleContent msdata:ColumnName="File_Text" msdata:Ordinal="0"> <xs:extension base="xs:string"> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="Type" type="tFolderType" /> </xs:complexType> </xs:element> What I've read, this kind of recursion should work using ref. Can anyone tell me what I've done wrong? Maybe the xsd validator is just faulty? If so, does anyone know a better alternative? I've tried using the one from w3.org as well, but it seems to be taken offline...

    Read the article

  • staruml "combined fragment" layout

    - by Ryan Fernandes
    Am facing a bit of trouble getting the 'combined fragment' to sit above an activation (in a sequence diagram). On adding a 'combined fragment' (loop/alt/opt etc) to a section of the sequence diagram, the label and the guard condition appear 'under' the activation block and hence is obscured. Any idea how to fix this?

    Read the article

  • Dependency Property not getting updated value via ActivityBind

    - by d h
    I have a Sequence Activity which holds two activities (Activity A and B), the input dependency property for Activity B is bound an output dependency property of Activity A. However, when I run the sequence activity, the Input for activity B is never updated and just uses the default value of activity A's output. My question is: is there a way to enforce an update on activity B's input so that it gets the latest value of activity A's output?

    Read the article

  • F# Equivalent to Enumerable.OfType<'a>

    - by Joel Mueller
    ...or, how do I filter a sequence of classes by the interfaces they implement? Let's say I have a sequence of objects that inherit from Foo, a seq<#Foo>. In other words, my sequence will contain one or more of four different subclasses of Foo. Each subclass implements a different independent interface that shares nothing with the interfaces implemented by the other subclasses. Now I need to filter this sequence down to only the items that implement a particular interface. The C# version is simple: void MergeFoosIntoList<T>(IEnumerable<Foo> allFoos, IList<T> dest) where T : class { foreach (var foo in allFoos) { var castFoo = foo as T; if (castFoo != null) { dest.Add(castFoo); } } } I could use LINQ from F#: let mergeFoosIntoList (foos:seq<#Foo>) (dest:IList<'a>) = System.Linq.Enumerable.OfType<'a>(foos) |> Seq.iter dest.Add However, I feel like there should be a more idiomatic way to accomplish it. I thought this would work... let mergeFoosIntoList (foos:seq<#Foo>) (dest:IList<'a>) = foos |> Seq.choose (function | :? 'a as x -> Some(x) | _ -> None) |> Seq.iter dest.Add However, the complier complains about :? 'a - telling me: This runtime coercion or type test from type 'b to 'a involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. I can't figure out what further type annotations to add. There's no relationship between the interface 'a and #Foo except that one or more subclasses of Foo implement that interface. Also, there's no relationship between the different interfaces that can be passed in as 'a except that they are all implemented by subclasses of Foo. I eagerly anticipate smacking myself in the head as soon as one of you kind people points out the obvious thing I've been missing.

    Read the article

  • Search for multiple values in an xml column

    - by Yuriy Gettya
    Environment: SQL Server 2012. Primary and secondary (value) index is built on xml column. Say I have a table Message with xml column WordIndex. I also have a table Word which has WordId and WordText. Xml for Message.WordIndex has the following schema: <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com"> <xs:element name="wi"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="w"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="p" type="xs:unsignedByte" /> </xs:sequence> <xs:attribute name="wid" type="xs:unsignedByte" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> and some data to go with it: <wi xmlns="http://www.example.com"> <w wid="1"> <p>28</p> <p>72</p> <p>125</p> </w> <w wid="4"> <p>89</p> </w> <w wid="5"> <p>11</p> </w> </wi> I need to search for multiple values in my xml column WordIndex either using OR or AND. What I'm doing is fairly rudimentary, since I'm a n00b in XQuery (taken from debug output, hence real values): with xmlnamespaces(default 'http://www.example.com') select m.Subject, m.MessageId, m.WordIndex.query(' let $dummy := 0 return <word_list> { for $w in /wi/w where $w/@wid=64 return <word wid="64" pos="{data($w/p)}"/> } { for $w in /wi/w where $w/@wid=70 return <word wid="70" pos="{data($w/p)}"/> } { for $w in /wi/w where $w/@wid=63 return <word wid="63" pos="{data($w/p)}"/> } </word_list> ') as WordPosition from Message as m -- more joins go here ... where -- more conditions go here ... and m.WordIndex.exist('/wi/w[@wid=64]') = 1 and m.WordIndex.exist('/wi/w[@wid=70]') = 1 and m.WordIndex.exist('/wi/w[@wid=63]') = 1 How can this be optimized?

    Read the article

  • Can I make Axis2 generate a WSDL with 'unwrapped' types?

    - by Bedwyr Humphreys
    I'm trying to consume a hello world AXIS2 SOAP web service using a PHP client. The Java class is written in Netbeans and the AXIS2 aar file is generated using the Netbeans AXIS2 plugin. You've all seen it before but here's the java class: public class SOAPHello { public String sayHello(String username) { return "Hello, "+username; } } The wsdl genereated by AXIS2 seems to wrap all the parameters so that when I consume the service i have to use a crazy PHP script like this: $client = new SoapClient("http://myhost:8080/axis2/services/SOAPHello?wsdl"); $parameters["username"] = "Dave"; $response = $client->sayHello($parameters)->return; echo $response."!"; When all I really want to do is echo $client->sayHello("Dave")."!"; My question is two-fold: why is this happening? and what can I do to stop it? :) Here's are the types, message and porttype sections of the generated wsdl: <wsdl:types> <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://soap.axis2.myhost.co.uk"> <xs:element name="sayHello"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="username" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="sayHelloResponse"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> </wsdl:types> <wsdl:message name="sayHelloRequest"> <wsdl:part name="parameters" element="ns:sayHello"/> </wsdl:message> <wsdl:message name="sayHelloResponse"> <wsdl:part name="parameters" element="ns:sayHelloResponse"/> </wsdl:message> <wsdl:portType name="SOAPHelloPortType"> <wsdl:operation name="sayHello"> <wsdl:input message="ns:sayHelloRequest" wsaw:Action="urn:sayHello"/> <wsdl:output message="ns:sayHelloResponse" wsaw:Action="urn:sayHelloResponse"/> </wsdl:operation> </wsdl:portType>

    Read the article

  • Need help debugging a very basic PHP SOAP Hello world app

    - by WarDoGG
    I have been breaking my head at this, reading almost every article and tutorial there is on the web, but nothing doing.. i still cannot get my first web service application to work. I would really appreciate it if anyone could debug this code for me and provide me with a good explanation as to what is wrong and why. This will help indeed ! Thanks ! I have pasted below the entire codes that i am using making it easier to debug. I'm using the PHP5 SOAP extension. Here is my WSDL: <?xml version="1.0" encoding="utf-8"?> <wsdl:definitions name="testWebservice" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> <s:import namespace="http://microsoft.com/wsdl/types/" /> <s:element name="getUser"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="username" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="getUserResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="getUserResult" type="tns:userInfo" /> </s:sequence> </s:complexType> </s:element> <s:complexType name="userInfo"> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="ID" type="s:int" /> <s:element minOccurs="1" maxOccurs="1" name="authkey" type="s:int" /> </s:sequence> </s:complexType> </s:schema> </wsdl:types> <wsdl:message name="getUserSoapIn"> <wsdl:part name="parameters" element="tns:getUser" /> </wsdl:message> <wsdl:message name="getUserSoapOut"> <wsdl:part name="parameters" element="tns:getUserResponse" /> </wsdl:message> <wsdl:portType name="testWebservice"> <wsdl:operation name="getUser"> <wsdl:input message="tns:getUserSoapIn" /> <wsdl:output message="tns:getUserSoapOut" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="testWebserviceBinding" type="tns:testWebservice"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getUser"> <soap:operation soapAction="http://tempuri.org/getUser" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="testWebserviceService"> <wsdl:port name="testWebservicePort" binding="tns:testWebserviceBinding"> <soap:address location="http://127.0.0.1/nusoap/storytruck/index.php" /> </wsdl:port> </wsdl:service> </wsdl:definitions> and here is the PHP Code i use to setup the server: <?php function getUser($user,$pass) { return array('ID'=>1); } ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache $server = new SoapServer("http://127.0.0.1/mywsdl.wsdl"); $server->addFunction('getUser'); $server->handle(); ?> and the code for the client: <?php $client = new SoapClient("http://127.0.0.1/index.php?wsdl", array('exceptions' => 0)); try { $result = $client->getUser("username","pass"); print_r($result); } catch (SoapFault $result) { print_r($result); } ?> Here is the ERROR output i am getting on the browser : SoapFault Object ( [message:protected] => Error cannot find parameter [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\xampp\htdocs\client.php [line:protected] => 6 [trace:Exception:private] => Array ( [0] => Array ( [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => getUser [1] => Array ( [0] => username [1] => pass ) ) ) [1] => Array ( [file] => C:\xampp\htdocs\client.php [line] => 6 [function] => getUser [class] => SoapClient [type] => -> [args] => Array ( [0] => username [1] => pass ) ) ) [previous:Exception:private] => [faultstring] => Error cannot find parameter [faultcode] => SOAP-ENV:Client )

    Read the article

  • Encoding error PostgreSQL 8.4

    - by KandadaBoggu
    I am importing data from a CSV file. One of the fields has an accent(Telefónica O2 UK Limited). The application throws en error while inserting the data to the table. PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xf36e6963 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". : INSERT INTO "companies" ("name", "validated") VALUES(E'Telef?nica O2 UK Limited', 't') How do I workaround this issue?

    Read the article

  • The difference between lists and sequences

    - by Peanut
    I'm trying to understand the difference between sequences and lists. In F# there is a clear distinction between the two. However in C# I have seen programmers refer to IEnumerable collections as a sequence. Is what makes IEnumerable a sequence the fact that it returns an object to iterate through the collection? Perhaps the real distinction is purely found in functional languages?

    Read the article

  • Getting started with XSD validation with .NET

    - by Rosarch
    Here is my first attempt at validating XML with XSD. The XML file to be validated: <?xml version="1.0" encoding="utf-8" ?> <config xmlns="Schemas" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd"> <levelVariant> <filePath>SampleVariant</filePath> </levelVariant> <levelVariant> <filePath>LegendaryMode</filePath> </levelVariant> <levelVariant> <filePath>AmazingMode</filePath> </levelVariant> </config> The XSD, located in "Schemas/config.xsd" relative to the XML file to be validated: <?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="config"> <xs:complexType> <xs:sequence> <xs:element name="levelVariant"> <xs:complexType> <xs:sequence> <xs:element name="filePath" type="xs:anyURI"> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Right now, I just want to validate the XML file precisely as it appears currently. Once I understand this better, I'll expand more. Do I really need so many lines for something as simple as the XML file as it currently exists? The validation code in C#: public void SetURI(string uri) { XElement toValidate = XElement.Load(Path.Combine(PATH_TO_DATA_DIR, uri) + ".xml"); // begin confusion // exception here string schemaURI = toValidate.Attributes("xmlns").First().ToString() + toValidate.Attributes("xsi:noNamespaceSchemaLocation").First().ToString(); XmlSchemaSet schemas = new XmlSchemaSet(); schemas.Add(null, schemaURI); XDocument toValidateDoc = new XDocument(toValidate); toValidateDoc.Validate(schemas, null); // end confusion root = toValidate; } Running the above code gives this exception: The ':' character, hexadecimal value 0x3A, cannot be included in a name. Any illumination would be appreciated.

    Read the article

  • Objective C -- passing array literal to a method

    - by morgancodes
    This seems to work (compiler doesn't complain, anyway): float adsr[4] = {0,1.0/PULSE_SPEED, 0,1}; [sequence setBaseADSR:adsr]; but I want to make it more concise and do this: [sequence setBaseADSR:{0,1.0/PULSE_SPEED, 0,1}]; How do I do it? In javascript, I'd call stuff in the brackets an "array literal". Not sure if C languages have the same concept or terminology though.

    Read the article

  • How to send a array as a parameter to a web service using SOAP and objective C.

    - by Alejandra Meraz
    I'm working in a iPhone app that needs to send a array as a parameter using SOAP. this is the current request and connection: NSString *soapMessage = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" "<soap:Body>\n" "<function xmlns=\"http://tempuri.org/\" />\n" "</soap:Body>\n" "</soap:Envelope>\n"]; NSURL *url = [NSURL URLWithString:@"http://myHost.com/myWebService/service.asmx"]; //the url to the WSDL NsMutableURLRequest theRequest = [[NSMutableURLRequest alloc] initWithURL:url]; NSString *msgLength = [NSString stringWithFormat:@"%d",[soapMessage length]]; [theRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; [theRequest addValue:msgLength forHTTPHeaderField:@"Content-Lenght"]; [theRequest setHTTPMethod:@"POST"]; [theRequest addValue:@"myhost.com" forHTTPHeaderField:@"Host"]; [theRequest addValue:@"http://tempuri.org/function" forHTTPHeaderField:@"SOAPAction"]; [theRequest setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]]; theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; Now, to send parameters I looked at the WSDL of the function description for the input is like this: <s:complexType name="ArrayOfDictionaryEntry"> <s:sequence> <s:element minOccurs="0" maxOccurs="unbounded" name="DictionaryEntry" type="tns:DictionaryEntry" /> </s:sequence> </s:complexType> <s:complexType name="DictionaryEntry"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="Key" /> <s:element minOccurs="0" maxOccurs="1" name="Value" /> </s:sequence> </s:complexType> <s:element name="functionInput"> <s:complexType /> </s:element> I guess then that I need to make a array of dictionary entries. what I would like to send is something like this [ location => USA, module => DEVELOPMENT] But I'm kind of confused. the array is created outside the SOAP, like an NSArray or inside the SoapMessage? if so... How is it done? and the DictionaryEntry, should I make a class? thanks for your time n.n

    Read the article

  • How to modify my Response.Document XSD for getting author name form Sharepoint

    - by Rohan Patil
    Hi, This is my XSD currently <?xml version="1.0" encoding="Windows-1252"?> <xsd:schema xmlns:tns="urn:Microsoft.Search.Response.Document" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:Microsoft.Search.Response.Document" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:import namespace="urn:Microsoft.Search.Response.Document.Document" schemaLocation="Microsoft.Search.Response.Document.Document.xsd" /> <xsd:annotation> <xsd:documentation> </xsd:documentation> <xsd:documentation> Defines a Query Respnose from a Windows SharePoint Services 3.0 Query Service. </xsd:documentation> </xsd:annotation> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- Root Element: Document --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - --> <xsd:element name="Document"> <xsd:complexType> <xsd:sequence> <xsd:element name="Title" type="xsd:string" minOccurs="0" /> <xsd:element name="Action"> <xsd:complexType> <xsd:sequence> <xsd:element name="LinkUrl"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="size" type="xsd:unsignedByte" use="optional" /> <xsd:attribute name="fileExt" type="xsd:string" use="required" /> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Description" type="xsd:string" minOccurs="0" /> <xsd:element name="Date" type="xsd:dateTime" minOccurs="0" /> <xsd:element xmlns:q1="urn:Microsoft.Search.Response.Document.Document" ref="q1:Properties" minOccurs="0" /> </xsd:sequence> <xsd:attribute name="relevance" type="xsd:unsignedByte" use="optional" /> </xsd:complexType> </xsd:element> </xsd:schema> I want to able to get the author name.. Please help..

    Read the article

  • Maintaing list order in binary tree.

    - by TheBigO
    Given a sequence of numbers, I want to insert the numbers into a balanced binary tree such that when I do a preorder traversal on the tree, it gives me the sequence back. How can I construct the insert method corresponding to this requirement? Remember that the tree must be balanced, so there isn't a completely trivial solution. I was trying to do this with a modified version of an AVL tree, but I'm not sure if this can work out.

    Read the article

  • How do you efficiently generate a list of K non-repeating integers between 0 and an upper bound N

    - by tucuxi
    The question gives all necessary data: what is an efficient algorithm to generate a sequence of K non-repeating integers within a given interval. The trivial algorithm (generating random numbers and, before adding them to the sequence, looking them up to see if they were already there) is very expensive if K is large and near enough to N. The algorithm provided here seems more complicated than necessary, and requires some implementation. I've just found another algorithm that seems to do the job fine, as long as you know all the relevant parameters, in a single pass.

    Read the article

  • How to replace empty string with zero in comma-separated string?

    - by dsaccount1
    "8,5,,1,4,7,,,,7,,1,9,3,6,,,8,6,3,9,,2,5,4,,,,,3,2,,,7,4,1,1,,4,,6,9,,5,,,,5,,,1,,6,3,,,6,5,,,,7,4,,1,7,6,,,,8,,5,,,7,1,,3,9," I'm doing a programming challenge where i need to parse this sequence into my sudoku script. Need to get the above sequence into 8,5,0,1,4,7,0,0,0,7,0,1,9,3,6,0,0,8......... I tried re but without success, help is appreciated, thanks.

    Read the article

  • How can I implement NotOfType<T> in LINQ that has a nice calling syntax?

    - by Lette
    I'm trying to come up with an implementation for NotOfType, which has a readable call syntax. NotOfType should be the complement to OfType<T> and would consequently yield all elements that are not of type T My goal was to implement a method which would be called just like OfType<T>, like in the last line of this snippet: public abstract class Animal {} public class Monkey : Animal {} public class Giraffe : Animal {} public class Lion : Animal {} var monkey = new Monkey(); var giraffe = new Giraffe(); var lion = new Lion(); IEnumerable<Animal> animals = new Animal[] { monkey, giraffe, lion }; IEnumerable<Animal> fewerAnimals = animals.NotOfType<Giraffe>(); However, I can not come up with an implementation that supports that specific calling syntax. This is what I've tried so far: public static class EnumerableExtensions { public static IEnumerable<T> NotOfType<T>(this IEnumerable<T> sequence, Type type) { return sequence.Where(x => x.GetType() != type); } public static IEnumerable<T> NotOfType<T, TExclude>(this IEnumerable<T> sequence) { return sequence.Where(x => !(x is TExclude)); } } Calling these methods would look like this: // Animal is inferred IEnumerable<Animal> fewerAnimals = animals.NotOfType(typeof(Giraffe)); and // Not all types could be inferred, so I have to state all types explicitly IEnumerable<Animal> fewerAnimals = animals.NotOfType<Animal, Giraffe>(); I think that there are major drawbacks with the style of both of these calls. The first one suffers from a redundant "of type/type of" construct, and the second one just doesn't make sense (do I want a list of animals that are neither Animals nor Giraffes?). So, is there a way to accomplish what I want? If not, could it be possible in future versions of the language? (I'm thinking that maybe one day we will have named type arguments, or that we only need to explicitly supply type arguments that can't be inferred?) Or am I just being silly?

    Read the article

  • Extracting a string between specified characters in python

    - by Seth
    I'm a newbie to regular expressions and I have the following string: sequence = ["{\"First\":\"Belyuen,NT,0801\",\"Second\":\"Belyuen,NT,0801\"}","{\"First\":\"Larrakeyah,NT,0801\",\"Second\":\"Larrakeyah,NT,0801\"}"] I am trying to extract the text Belyuen,NT,0801 and Larrakeyah,NT,0801 in python. I have the following code which is not working: re.search('\:\\"...\\', ''.join(sequence)) I.e. I want to get the string between characters :\ and \.

    Read the article

  • postgresql drop table

    - by Russell
    I have two tables (tbl and tbl_new) that both use the same sequence (tbl_id_seq). I'd like to drop one of those tables. On tbl, I've removed the modifier "not null default nextval('tbl_id_seq'::regclass)" but that modifier remains on tbl_new. I'm getting the following error: ERROR: cannot drop table tbl because other objects depend on it DETAIL: default for table tbl_new column id depends on sequence tbl_id_seq After reviewing http://www.postgresql.org/docs/9.1/static/sql-droptable.html It looks like there is only CASCADE and RESTRICT as options.

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >