救命!命名空间混乱 [英] Help! Namespace muddle

查看:70
本文介绍了救命!命名空间混乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




考虑以下XML文档:


<?xml version =''1.0''coding =''UTF- 8''?>

< bar:foo xmlns:bar =''someuri''>

< baz />

< / bar:foo>


baz属于哪个命名空间?什么是这个命名空间绑定

到/关联?我的理解是上面的baz对某些默认默认命名空间属于

,但是我无法在这个标准中找到支持
。 (如果它在那里我设法

错过它,如果有人能告诉我确切地说

在哪里,我将感激不尽。)


现在考虑


<?xml version =''1.0''coding =''UTF-8''?>

< ; foo xmlns =''someuri''>

< baz xmlns =''some_other_uri''>

< frotz />

< / baz>

< / foo>


现在,baz属于哪个命名空间? ''someuri''或'some_other_uri''?

通常,在XML代码中没有明确定义任何名称空间

(甚至不是默认名称空间) ),标识符属于什么命名空间

到?


谢谢!


kj


-

注意:在我的地址中,期间之前的所有内容都是向后的。



Consider the following XML document:

<?xml version=''1.0'' encoding=''UTF-8''?>
<bar:foo xmlns:bar=''someuri''>
<baz/>
</bar:foo>

What namespace does baz belong to? What is this namespace bound
to/associated with? My understanding was that baz above belongs
to some "default default namespace", but I have not been able to
find support in the standard for this. (If it''s there I managed
to miss it, and would be thankful if someone would tell me exactly
where.)

Now consider

<?xml version=''1.0'' encoding=''UTF-8''?>
<foo xmlns=''someuri''>
<baz xmlns=''some_other_uri''>
<frotz/>
</baz>
</foo>

Now, what namespace does baz belong to? ''someuri'' or ''some_other_uri''?

In general, in XML code that does not explicitly define any namespaces
(not even default namespaces), what namespace do identifiers belong
to?

Thanks!

kj

--
NOTE: In my address everything before the period is backwards.

推荐答案

你好,kj!

您写的2004年4月13日星期二16:20:37 +0000(UTC):


k> <?xml version =''1.0''encoding =''UTF-8''?>

k> < bar:foo xmlns:bar =''someuri''>

k> < baz />

k> < / bar:foo>


k> baz属于什么名称空间?


它不属于任何名称。


k>这个命名空间绑定/关联的是什么?我的理解是

k>上面的baz属于某个默认默认命名空间,


为什么这么认为?


k>但我无法在此标准中找到支持。 (如果

k>它就在那里我设法错过了,如果有人愿意,我会很感激。> b $ b>告诉我到底在哪里。)


k>现在考虑


k> <?xml version =''1.0''encoding =''UTF-8''?>

k> < foo xmlns =''someuri''>

k> < baz xmlns =''some_other_uri''>

k> < frotz />

k> < / baz>

k> < / foo>


k>现在,baz属于哪个命名空间? ''someuri''或'some_other_uri''?

第二个,我的意思是some_other_uri命名空间。


k>通常,在没有明确定义任何名称空间的XML代码中

k> (甚至不是默认命名空间),标识符所属的命名空间

k>来自?


他们离开了任何一个namspace。

最诚挚的问候,Alex Shirshov。
Hello, kj!
You wrote on Tue, 13 Apr 2004 16:20:37 +0000 (UTC):

k> <?xml version=''1.0'' encoding=''UTF-8''?>
k> <bar:foo xmlns:bar=''someuri''>
k> <baz/>
k> </bar:foo>

k> What namespace does baz belong to?

It doesn''t belong to any.

k> What is this namespace bound to/associated with? My understanding was
k> that baz above belongs to some "default default namespace",

Why do you think so?

k> but I have not been able to find support in the standard for this. (If
k> it''s there I managed to miss it, and would be thankful if someone would
k> tell me exactly where.)

k> Now consider

k> <?xml version=''1.0'' encoding=''UTF-8''?>
k> <foo xmlns=''someuri''>
k> <baz xmlns=''some_other_uri''>
k> <frotz/>
k> </baz>
k> </foo>

k> Now, what namespace does baz belong to? ''someuri'' or ''some_other_uri''?

The second, i mean some_other_uri namespace.

k> In general, in XML code that does not explicitly define any namespaces
k> (not even default namespaces), what namespace do identifiers belong
k> to?

They out of any namspace.
With best regards, Alex Shirshov.


在文章< c5 ********** @ reader1.panix.com> ;, kj< so *** @ 987jk.com>写道:
In article <c5**********@reader1.panix.com>, kj <so***@987jk.com> wrote:
baz属于哪个命名空间?这个命名空间绑定到/关联的是什么?我的理解是上面的baz属于某些默认默认命名空间,但我无法在标准中找到支持。
What namespace does baz belong to? What is this namespace bound
to/associated with? My understanding was that baz above belongs
to some "default default namespace", but I have not been able to
find support in the standard for this.



默认默认命名空间没有命名空间。


- Richard



The "default default namespace" is no namespace.

-- Richard


kj潦草地写道:
请考虑以下XML文档:

<?xml version =''1.0''coding =''UTF-8''?>
< bar:foo xmlns:bar = ''someuri''>
< baz />
< / bar:foo>

baz属于哪个命名空间?这个命名空间绑定到/关联的是什么?我的理解是上面的baz属于某些默认默认命名空间,但我无法在标准中找到支持。 (如果它在那里我设法
错过它,如果有人能告诉我确切地说
在哪里会很感激。)


它属于默认命名空间,即无命名空间。 <巴兹/>这里没有定义的命名空间。

现在考虑

<?xml version =''1.0''coding =''UTF-8 ''>
< foo xmlns =''someuri''>
< baz xmlns =''some_other_uri''>
< frotz />
< / baz>
< / foo>

现在,baz属于哪个命名空间? ''someuri''或'some_other_uri''?


''some_other_uri''。默认命名空间,即没有前缀的命名空间,

已在< baz />中重新定义,其中< frotz />是一个子元素。

一般来说,在XML代码中没有明确定义任何名称空间
(甚至不是默认名称空间),标识符属于什么名称空间?
Consider the following XML document:

<?xml version=''1.0'' encoding=''UTF-8''?>
<bar:foo xmlns:bar=''someuri''>
<baz/>
</bar:foo>

What namespace does baz belong to? What is this namespace bound
to/associated with? My understanding was that baz above belongs
to some "default default namespace", but I have not been able to
find support in the standard for this. (If it''s there I managed
to miss it, and would be thankful if someone would tell me exactly
where.)
It belongs to the default namespace, which is "no namespace". <baz/> has
no defined namespace here.
Now consider

<?xml version=''1.0'' encoding=''UTF-8''?>
<foo xmlns=''someuri''>
<baz xmlns=''some_other_uri''>
<frotz/>
</baz>
</foo>

Now, what namespace does baz belong to? ''someuri'' or ''some_other_uri''?
''some_other_uri''. The default namespace, i.e. the one with no prefixes,
has been redefined in <baz/>, of which <frotz/> is a child element.
In general, in XML code that does not explicitly define any namespaces
(not even default namespaces), what namespace do identifiers belong
to?




" no namespace" ;.即使您使用的前缀未被声明为/ b $ b之前引用某个命名空间,使用它们的元素也属于

no namespace或 undefined。

这在XML名称TR中解释,位于 http:/ /www.w3.org/ 据我所知
记住。


一个更有趣的问题是:


< foo xmlns =" someuri" xmlns:bar =" some_other_uri">

< bar:baz qux =" some_value" />

< / foo>


属性qux属于哪个命名空间?

据我所知,它属于bar-namespace(some_other_uri),

虽然没有前缀。


-

Alan Plum,WAD / WD,蘑菇云制作
http://www.mushroom-cloud.com/



"no namespace". Even if you use prefixes which haven''t been declared to
reference a certain namespace before, the elements using them belong to
"no namespace", or "undefined".
This is explained in the XML Names TR at http://www.w3.org/ as far as I
remember.

A more interesting question is, in:

<foo xmlns="someuri" xmlns:bar="some_other_uri">
<bar:baz qux="some_value"/>
</foo>

What namespace does the attribute qux belong to?
To my understanding it belongs to the bar-namespace (some_other_uri),
although unprefixed.

--
Alan Plum, WAD/WD, Mushroom Cloud Productions
http://www.mushroom-cloud.com/


这篇关于救命!命名空间混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆