namespaces

Empty/blank namespace declarations being generated within result-document

ε祈祈猫儿з 提交于 2019-12-23 11:55:36
问题 I have written a package for converting XMLs to ePubs. Everything works fine, except some cases, where blank namespace ( xmlns="" ) nodes are being written to the result-documents. Prior to transformation, I prepared temporary variables for holding main-segments(i.e., meta , body etc.) and finally copied the nodes(using xsl:copy-of[@copy-namespaces='no'] instruction) to result-document. I also have used @exclude-result-prefixes='ns_list_sep_by_space' within xsl:transform element and still not

C# type or namespace expected confusion

佐手、 提交于 2019-12-23 11:51:15
问题 Im getting slightly confused by a C# error. Type t = thing.GetType() t is now a type. but if i attempt to do this: new GenericThing<t> I get a warning saying type or namespace expected. What am i missing? 回答1: t is a Type object created at runtime. Generics expect a type name, resolved at compile time. To create a generic at runtime, you have to use MakeGenericType For example: Activator.CreateInstance(typeof(GenericThing<>).MakeGenericType(t)); 回答2: t is an object instance of type Type , i.e

C++: namespace conflict between extern “C” and class member

三世轮回 提交于 2019-12-23 10:26:18
问题 I stumbled upon a rather exotic c++ namespace problem: condensed example: extern "C" { void solve(lprec * lp); } class A { public: lprec * lp; void solve(int foo); } void A::solve(int foo) { solve(lp); } I want to call the c function solve in my C++ member function A::solve. The compiler is not happy with my intent: error C2664: 'lp_solve_ilp::solve' : cannot convert parameter 1 from 'lprec *' to 'int' Is there something I can prefix the solve function with? C::solve does not work 回答1: To

How to access to anonymous namespace variable if the same variable exists in global

我们两清 提交于 2019-12-23 10:09:24
问题 Let's imagine situation: #include <iostream> int d =34; namespace { int d =45; } int main() { std::cout << ::d ; return 0; } Here the output is 34, because :: means global namespace. But If I comment 3rd line the output is 45, which is strange . If I use std::cout << d ; - I get error s.cxx:12:15: error: reference to ‘d’ is ambiguous How can I access unnamed_namespace::d in this scenario? PS: I've read that unnamed namespace is used for static global variables aka visible only in file scope

Ruby Equivalent of C# 'using' Statement

我只是一个虾纸丫 提交于 2019-12-23 09:58:56
问题 I've been getting into Ruby over the past few months, but one thing that I haven't figured out yet is what the Ruby equivalent of C#'s (and other languages) using statement is. I have been using the require statement to declare my dependencies on Gems, but I am getting lazy and would prefer to not fully qualify my frequently used class names with their module (namespace) name. Surely this is possible, right? I must not be using the right terminology as Google hasn't given me anything useful.

Force XDocument to not use namespace prefix if namespace is also defined as default

与世无争的帅哥 提交于 2019-12-23 09:57:10
问题 I have an xml file with default namespace specified with and without namespace prefix. When I generate xml output I'm getting all xml elements prefixed. Is there way to get rid of the prefixes since I'm using the default namespace? class Program { static void Main(string[] args) { var xml = "<root xmlns='default-namespace' xmlns:key='default-namespace'>" + " <node1></node1>" + " <node2></node2>" + "</root>"; var document = XDocument.Parse(xml); var output = document.ToString(); } } The output

why is python reusing a class instance inside in function

痞子三分冷 提交于 2019-12-23 09:18:40
问题 I'm running a for loop inside a function which is creating instances of a class to test them. instead of making new classes it appears to be reusing the same two over and over. Is there something I'm missing about how classes and variables are handled in python methods? how can I generate a new object for each iteration of the loop class CollectionSetImages(unittest.TestCase): def test_keywordset(self): """Testing keyword queries by images equality """ for keyword in ['a','b','c','d','e','f',

ASMX Web Service - “This web service is using http://tempuri.org/ as its default namespace.” message - but it shouldn't be

帅比萌擦擦* 提交于 2019-12-23 09:04:22
问题 I've created a web service using Visual Studio ( 2005 - I know I'm old school ) and it all compiles fine but when it opens I get warned thus: This web service does not conform to WS-I Basic Profile v1.1. And furthermore: This web service is using http://tempuri.org/ as its default namespace. Which would be fine except my service begins thus: [WebService(Namespace = "http://totally-not-default-uri.com/servicename")] Searching the entire solution folder for "tempuri" returns nothing. I can't

Perl6: load functions into other namespace

一世执手 提交于 2019-12-23 08:53:07
问题 I want to use Perl6 Modules to group some functions, i often use. Because this functions are all loosely coupled, I don't like to add them in a class. I like the idea of use , where you can select, which functions should be imported, but I don't like it, that the functions, which are imported are then stored in the global namespace. For example if I have a file my_util.pm6 : #content of my_util.pm6 unit module my_util; our sub greet($who) is export(:greet) { say $who; } sub greet2($who) is

What does mean if (\false) (yes, with backslash) in PHP?

≡放荡痞女 提交于 2019-12-23 08:47:37
问题 This morning, I've been notified that a new Twig_Extensions release is available! Yay! Before integrating it to twigfiddle, I wanted to see changes. This is mainly adding support to namespaces using class_alias function, and then add PSR-4 correspoding classes that just include the legacy one. But each new (namespaced) classes are implemented like this: <?php namespace Twig\Extensions; require __DIR__.'/../lib/Twig/Extensions/Extension/Text.php'; if (\false) { class TextExtension extends