namespaces

avoid error when xpath does not find namespace in xml

Hello everyone, Could someone tell me how to avoid these errors? Testing for existance of namespace? It starts when I want to add geo information to an array I thought it was enough to do this. (from the picasa api feed) foreach($feed->xpath('//gml:pos') as $pos) { $feed_arr['geo'][$i]['pos'] = (string)$pos[0]; $i++; } <b>Warning</...

Should I use an enum or multiple const for non-sequential constants in c++?

I'm writing porting file-io set of functions from c into a c++ class. "Magic numbers" (unnamed constants) abound. The functions read a file header which has a number of specific entries whose locations are currently denoted by magic numbers. I was taught by a veteran programmer a couple years back that using "magic numbers" is inher...

Namespacing, OOP JS, Am I doing this right?

My problem is with objInfo(). How can I return an object via a passed-in variable? I'm trying to namespace my code and use private/public vars. Bonus Q: How would you otherwise improve the code? // Namespace all my code var bab = new function() { // Declare cat object function cat() { this.eyes = 2; this.legs =...

includes inside a namespace

Hi All Is the following approach correct? Well i get a compilation error. a.hpp is #include <iostream> class a { public: void classa_f(); }; a.cpp is #include "a.hpp" void a::classa_f() { std::cout<< "a::classa_f\n"; } main.cpp #include <iostream> namespace myname { #include "a.hpp" } int main () { myname::a ...

XSLT: How to get a list of all used namespaces

I'm writing an XSLT 1.0 stylesheet to transform multi-namespace XML documents to HTML. At some place in the result HTML I want to list all the namespaces, that occured in the document. Is this possibile? I thought about something like <xsl:for-each select="//*|//@*"> <xsl:value-of select="namespace-uri(.)" /> </xsl:for-each> but o...

what is the parameter to ns ?

what is the parameter to ns ? the documentation says something, but it's not clear (to me, at least) my-new-namespace=> (doc ns) ------------------------- clojure.core/ns ([name docstring? attr-map? references*]) Macro Sets *ns* to the namespace named by name (unevaluated), creating it if needed. ...the rest of the documentatio...

basic question on C# - do I need a namespace?

I am a Java developer, totally new to C#. I am currently writing a DLL for distribution across my organization. It is a very simple library containing a couple of classes and I do not see any real use in putting all of them into some namespace just for the sake of it. Do I really have to use a namespace? If so, why? Is it some kind of a ...

XML Namespace error in WSDL file

I have the following service definition (incomplete, but demonstrates the error. Visual Studio tells me (translated from german) "In this Schema Namespace http://schemas.xmlsoap.org/wsdl/ is not available" at the line where I define OffertXML. <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions name="TestOffertverwaltung" targetNa...

How to specify schemalocation for an xsd in local folder, while importing it into a wsdl file

I have a XSD in local , and I need to import the same into a WSDL. I have couple of other xsds too which are already on the production namespace. Now I have little clue as how to make this XSD that is only in my local to be made available in my WSDL file to test the webservice using soapUI. So questions, what will be the namespace and...

Clojure: fully qualified name of a function

In Clojure, is there a more elegant way of finding the fully qualified name of a function (known to have meta info) than (defn fully-qualified-name [fn] (let [fn-meta (meta fn ) fn-ns (ns-name (:ns fn-meta)) ] (str fn-ns "/" (:name fn-meta)))) A run-time solution is required. Read-time and compile-time solutions ...

Clojure: referring to the name of the namespace

In Clojure, how do I get the name of the namespace in which variables and functions are named? For example, improving the following: (ns my-ns) (def namespace-name "my-ns") The problem with the above is that if I want to change the name of my-ns, I have to change the definition of namespace-name as well ...

Namespaces in C# vs imports in Java and Python

In the Java and Python world, you look at a source file and know where all the imports come from (i.e. you know in which file the imported classes are defined). For example: In Java: import javafoo.Bar; public class MyClass { private Bar myBar = new Bar(); } You immediately see that the Bar-class is imported from javafoo. So, Ba...

Converting from console to windows app in visual studio

When changing the project from console to windows app, I still am not able to use the namespace System.Windows.Forms. Do I really need to create a whole new project? If there is a better way, please give a detailed description of how to do this in visual studio step by step, thanks :) ...

XSLT problem during transformation

<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" version="1.0" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:infoRequest="ControlSkin3" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xmlns"> <xsl:output omit-xml-declaration="yes" method="xml" encoding="utf-8" /> I've got...

SOAP request namespaces .NET

When my client makes a request via web service, the generated SOAP message looks like this: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org /2001/XMLSchema"><soap:Body><myMethod xmlns="htt...

Namespaces in JSON

Is there such a thing as JSON namespaces, just like XML namespaces? Has anyone created a spec or libraries for this? Is this a good or a terrible idea? I want to make a data spec that can be represented in XML as well as JSON. However I also need the namespace concept, that the data can be extended by annotations in different vocabulari...

Javascript Namespace declaration

What is the proper way to declare a namespace? I've just read "Developing Large Web Applications" and the author suggests using: if (!window.YourNamespace) { YourNamespace = {}; } seems easy enough.. but I see all the javascript libraries for declaring namespaces and alternate methods. Isn't there a standard way to do this? Any ...

NSXMLDocument, nodesForXPath with namespaces

I want to get a set of elements from a xml-file, but as soon the the elements involve namespaces, it fails. This is a fragment of the xml file: <gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="Groundspeak Pocket Query" xsi:schemaLocation="ht...

Good python XML parser to work with namespace heavy documents

Python elementTree seems unusable with namespaces. What are my alternatives? BeautifulSoup is pretty rubbish with namespaces too. I don't want to strip them out. Examples of how a particular python library gets namespaced elements and their collections are all +1. Edit: Could you provide code to deal with this real world use-case using...

2 objects, exactly the same (except namespace) c#

I'm using a 3rd party's set of webservices, and I've hit a small snag. Before I manually make a method copying each property from the source to the destination, I thought I'd ask here for a better solution. I've got 2 objects, one of type Customer.CustomerParty and one of type Appointment.CustomerParty. The CustomerParty objects are a...