namespaces

What is the difference between header file and namespace ?

I want to know the exact difference between Header file and namespace in consideration in programming languages ?? ...

Forward declaring classes in namespaces

I was rather surprised to learn that I couldn't forward declare a class from another scope using the scope resolution operator, i.e. class someScope::someClass; Instead, the full declaration has to be used as follows: namespace { class someClass; } Can someone explain why this is the case? UPDATE: To clarify, I am asking why t...

Running a MATLAB code fragment without namespace pollution

Hi! I'm writing a version of Python's doctest test-runner, for MATLAB (it partly works...). For this to work, I need to run the code in people's examples in their m-file help. I want variables to carry over from one line to the next, e.g. % >> I = 5 + 33; % expect no output % >> I % % I = % % 38 % To run the tests, I have a l...

How do I keep smartgwt from polluting the window namespace?

I have existing javascript in a project that creates a 'Calendar' object. The object is a member of window. When I added smartgwt to my project, the original Calendar object was overwritten by a smartclient calendar (ISC_Calendar) packaged in smartgwt. Using a browser-based JS debugger, I found that all the JS objects from smartgwt wer...

How to assign same class object declared in 2 different namespaces

I have a webservice project with a class (let's refer to it as webservice.classA). I have another class project producing a dll which references that class in its own namespace and instantiates an instance of it (lets call the dlls namespace dllnamespace). In another project I want to access the member in the dll e.g. using webservic...

JAXP Processing XML with NameSpace

Hi Iam trying to process an XML file with a namespace using JAXP/XPATH - but there is no output - any help would be great. I'm struggling with the namespace syntax... Basically I would like to process the currency and rates below in the XML file. XML FILE <gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http...

Can I force a dependency between namespaces in C#

Can I restrict classes from a specific namespace from referencing classes in another specific namespace? Both namespaces exist in the same .NET assembly. Example: namespace LegacyCode { class LegacyClass { ... } } namespace NewCode { class NewClass {...} } I do not want classes from 'NewCode' to be able to reference classes ...

Why does my asp.net application need to import its own namespace?

I just converted UberSite, a vb.net web site to a web application. I get run-time errors saying that there is no such thing as type foo. When I drill down to the page in the code-view, it gives me an error-correction suggestion: import namespace UberSite. If I create a new web application and define foo there, there is no need to impo...

Javascript "Object not a constructor" error when using namespaces?

I have the following JS code: window.Foo = {}; window.Foo.Name1 = function() { function Bar1(param1) { this.Name = param1; } } var gMyBar = new Foo.Name1.Bar1("hello world"); alert(gMyBar.Name); I'm getting the error "Foo.Name1.Bar1 is not a constructor" in my Firefox error console... what gives? ...

How do you import an enum into a different namespace in C++?

I have an enum in a namespace and I'd like to use it as if it were in a different namespace. Intuitively, I figured I could use 'using' or 'typedef' to accomplish this, but neither actually work. Code snippet to prove it, tested on GCC and Sun CC: namespace foo { enum bar { A }; } namespace buzz { // Which of these two methods I ...

XML DOM conflicting namespace issues

Hi, I am using XML DOM documents with two namespaces. For example, consider the following document: <entry xmlns="http://www.w3.org/2005/Atom" xmlns:libx="http://libx.org/xml/libx2"&gt; <id>5</id> <title>Put Google Book results into Addison</title> <updated>2009-02-23T10:12:15Z</updated> <author> <name>LibX Team</name> ...

adding a custom namespace to xaml

i am quite new on c#, wpf and xaml etc then i may not be able to use the right terms to ask the right question=) i am trying to add my own namespace to my xaml file in order to use my own class easily-i guess the reason is this- i wrote that command in window tag for this: xmlns:myns="clr-namespace:LibNameSpace" where my window tag als...

Where to store Class Specific named constants in C++

If you have a class that has some named constants, what is the best practive for storing the constants: Option 1: Namespace in Class header So in my class header I will have: class myClass { ... ... }; namespace NamedConstants { const string Bucket = "Bucket"; } Option 2 Member Constants class MyClass { // this goes in th...

Map XSLT input document prefixes to preferred values

Using XSLT, I'm wondering how to get the output to use my stylesheet's namespace prefixes rather than the input document's prefixes. By way of example, given this very simplified document: <?xml version="1.0"?> <a:node xmlns:a="urn:schemas:blah:"/> And the following XSL transform: <?xml version="1.0"?> <xsl:transform xmlns:xsl="htt...

VS2010 - Getting "type or namespace name could not be found" but everything seems ok?

I'm getting a "type or namespace name could not be found" error for a C# WPF app in VS2010. This area of code was compiling fine, but suddenly I'm getting this error. I've tried removing the Project Reference and Using statement, shutting VS2010 and restarting, but still I have this issue. Any ideas why this might be occurring, where ...

Extraneous wcf body xml namespace declarations

I generated a set of web service proxy objects with the .Net 3.5 svcutil.exe tool. The soap body element has 2 extraneous xml namespace alias declarations. Specifically schema and schema instance namespaces ( http://www.w3.org/2001/XMLSchema, http://www.w3.org/2001/XMLSchema-instance ). For other reasons, the service I'm interacting wit...

XML Default namespaces for unqualified attribute names?

I'm trying to understand the correct interpretation of the "Namespaces in XML 1.0 (Third Edition)" definition for unqualified attribute namespaces. "The namespace name for an unprefixed attribute name always has no value." And later in the same section: "The attribute value in a default namespace declaration MAY be empty. This ...

how namespaces can be read from xml file using xquery

I am reading XML files of Office 2007 document using xquery. In these files the namespaces are also included. I need to retrieve the node of namespaces. I wrote xquery to fetch data and it works fine if I removed namespace from the source XML file else of the xquery resultset is empty. Wanna know how can I read namespaces and value from ...

XSD Namespace backword compatibility

Hello All, We are struggling with some namespace compatibility issues. Currently we store some external data in our database as XML files with namespace as xmlns="http://xyz.com/prodresponse/v2", recently the vendor has changed the namesspace to xmlns="http://xyz.com/prodresponse/v4". The issue is we need to deal with both old and new ...

Why do I get an error trying to refer a nested class in Ruby?

Why there is an error in the following example? class ClassA class ClassB end class ClassC def test ClassB.new end end end p ClassA::ClassC.new.test # => #<ClassA::ClassB:0x0000010103f860> class ClassA class ClassD def test ClassB.new end end end p ClassA::ClassD.new.test # => #<ClassA::ClassB:...