namespaces

SimpleXML - add a new node using a namespace previously declared - how?

旧街凉风 提交于 2019-12-24 04:23:32
问题 I would like to add a child, on a very specific place (so I'm also using DOM and not only simpleXML) for <domain:create> node. I have tried to use the $ns attribute on simpleXML construct. $nsNode = new SimpleXMLElement('<domain:ns>', $options = 0, $ns='urn:ietf:params:xml:ns:domain-1.0'); //transform the target into dom object for manipulation $nodeRegistrantDom = dom_import_simplexml($nodeRegistrant); But I'm getting: I/O warning : failed to load external entity "<domain:ns>" I've tried to

How to mention namespace in XSLT file when the namespaces are dynamic?

こ雲淡風輕ζ 提交于 2019-12-24 03:55:22
问题 I have a requirement to store XML data in DB and after that retrieve xml from DB and convert to PDF. For that I am using XSLT with Apache FOP. The below code is working fine with current namespaces in the XML file(I have copied and pasted the namespaces from Books.xml file to Books.xsl . The Problem is whenever the WebService is updated if the namespace of Books.xml file is changed then my Books.xsl file with old namespaces is giving exception while generating PDF using Apache FOP. Note : If

C++ using namespaces to avoid long paths

此生再无相见时 提交于 2019-12-24 03:55:12
问题 I am still learning C++, and I have never really created my own namespaces before. I was experimenting with them and while I got most things to work, there's one thing that I still can't seem to do. I would like to be able to call a static method within a class without typing something like NameOfClass::method . Here is what I thought the code should look like, but it fails to compile: File A.h , namespace Test { class A { public: static int foo() { return 42; } }; } File main.cpp , #include

PHP: “use” in include files? [duplicate]

亡梦爱人 提交于 2019-12-24 03:26:12
问题 This question already has an answer here : Expose “use” classes to Included file (1 answer) Closed 4 years ago . When using namespaces in PHP you can do things like: <?php use \mynamspace\MyClass; $a = new MyClass(); ?> Is it possible to put the use... line in an include file? If there are dozens oft those use statements it is very annoying to write them in every single file you need them. But the use statement is only working for the current file and is ignored in the files that include it.

Django external library and app name conflict

不羁的心 提交于 2019-12-24 02:59:08
问题 Have a django app 'my_app'. Now added an external library that happens to have the same name and needs to be added to INSTALLED_APPS. src | -- apps | --- **my_app** external libraries | __ **my_app** | __some_path | __ new_module Django follows the old path and spits out Error: No module named my_app.some_path.new_module because it is looking in the wrong folder. INSTALLED_APPS = ( ... apps.my_app my_app.some_path.new_module ... ) Note: order of apps in INSTALLED_APPS makes no difference.

Evaluate function within package environment without attaching package

﹥>﹥吖頭↗ 提交于 2019-12-24 02:56:15
问题 Background I would like to evaluate a set of R function with a package environment without attaching this package I would like to avoid using package:: Example Data Given sample dummy data set: # Data -------------------------------------------------------------------- tmpCSV <- tempfile(fileext = ".CSV", pattern = "mtcars_data_") write.csv(x = mtcars[, 1:5], file = tmpCSV, row.names = FALSE) # Confirm # readLines(con = tmpCSV)[1] Reading library I could read it with use of read_csv function

create a namespace in c++/cli?

霸气de小男生 提交于 2019-12-24 02:52:17
问题 I have seen many examples of using .NET Framework namespaces in c++/cli like the following: using namespace System; using namespace System::IO; But I haven't seen any examples of creating my own. So I was wondering if there is a way to declare/create my own namespace as I would in C#: namespace Animals { public class Dog { public Dog() {} } } Thanks for your time :) 回答1: Same syntax for single namespaces. Nest for multiples, e.g. for First.Second.Third: namespace First { namespace Second {

pundit policies with namespaces

ε祈祈猫儿з 提交于 2019-12-24 02:33:28
问题 I have Question model in my application. app/models/question.rb class Question < ActiveRecord::Base ... end I'm using 'pundit' gem for authorization. There are two controllers to do some changes in questions: one for registered user, one for admin. I'm trying to create separate policies for controllers. app/controllers/questions_controller.rb class QuestionsController < ApplicationController ... end app/policies/question_policy.rb class QuestionPolicy < ApplicationPolicy ... end app

Do I use jQuery noconflict to avoid plugins conflict?

偶尔善良 提交于 2019-12-24 02:25:10
问题 UPDATE: I've found that the jquery.bxslider plugin itself clones and appends/prepends the LIs causing the trouble. No solution to this though, except maybe using another script :( I'm having to jQuery plugins partially conflicting with each other, Boxslider (an image slider) and Colorbox (a lightbox). They both work, but the slider script somehow ads to the lightbox so the first and last images get repeated twice. This is easier to understand if you have a look at the example page. You'll see

problem calling namespaced function from javascript function in another js file

蹲街弑〆低调 提交于 2019-12-24 01:52:54
问题 Namespacing is new to me in js - and my project has grown very complex so it's time to tame the beast :-P I have created a namespace foo in foo.js using the module pattern. var foo = (function () { update: function () { alert('z'); } }; }()); I can call foo.update in the document ready function on an html page with $(function () {foo.update(); }); But I can't seem to get it to fire calling from another js file. I am trying to call it from bar.js function updateTheFoo() { foo.update(); } The