jjzjj

registerNamespace

全部标签

javascript - 当命名空间已存在时,Type.registerNamespace 会抛出错误

在我的公司环境中,我们使用了大量的javascript。为了简化所有这些脚本的管理,避免命名冲突,我们采用了命名空间的javascript命名约定,基本上是:CompanyName.ProjectName.Area.XYZ.js要创建命名空间,我们使用以下模式:varCompany;(function(Company){(function(Project){(function(Area){(function(XYZ){functionfunction1(args){},functionfunction2(args){}})(Area.XYZ||(Area.XYZ={}));})(Pro

php - PHP 的 DOMXPath 中是否需要 registerNamespace?

我正在使用这样的XML:(它是epub书中的标准container.xml)我正在尝试使用PHP解析它。到目前为止,这是我的代码:$c=newDOMDocument();$c->load($filename);$x=newDOMXPath($c);//fineuptohere!//isthisevenwhatI'msupposedtobedoing?$x->registerNamespace('epub','urn:oasis:names:tc:opendocument:xmlns:container');$root=$x->query('/epub:container/epub:ro