问:名称空间 [英] Q: namespaces

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

问题描述

< example xmlns:namespaceone =" http://www.one.com" xmlns =" http://www.one.com">

< check att1 =" one" ATT2 = QUOT;二" />

< check att1 =" one" namespaceone:ATT1 = QUOT;二" />

< / example>

在我的意见栏中

< check att1 =" one" namespaceone:ATT1 = QUOT;二" />

是错误的(不允许对一个元素的属性使用不同的命名空间)


对吧?

<example xmlns:namespaceone="http://www.one.com" xmlns="http://www.one.com">
<check att1="one" att2="two" />
<check att1="one" namespaceone:att1="two" />
</example>
in my opinion line
<check att1="one" namespaceone:att1="two" />
is wrong (different namespaces for aributes of one element are not allowed)

right?

推荐答案

" Hrvoje Somun" < HR **************** @ zg.tel.hr> schrieb im Newsbeitrag

news:bm ********** @ sunce.iskon.hr ...
"Hrvoje Somun" <hr****************@zg.tel.hr> schrieb im Newsbeitrag
news:bm**********@sunce.iskon.hr...
< example xmlns:namespaceone =" HTTP://www.one.com"
xmlns =" http://www.one.com"> < check att1 =" one ATT2 = QUOT;二" />
< check att1 =" one" namespaceone:ATT1 = QUOT;二" />
< / example>

在我的观点栏中
< check att1 =" one" namespaceone:ATT1 = QUOT;二" />
是错误的(一个元素的不同名称空间不允许

对吗?
<example xmlns:namespaceone="http://www.one.com" xmlns="http://www.one.com"> <check att1="one" att2="two" />
<check att1="one" namespaceone:att1="two" />
</example>
in my opinion line
<check att1="one" namespaceone:att1="two" />
is wrong (different namespaces for aributes of one element are not allowed)
right?




No.



No.




" Julian F. Reschke" <再***** @ muenster.de>在消息中写道

news:bm ************ @ ID-98527.news.uni-berlin.de ...

"Julian F. Reschke" <re*****@muenster.de> wrote in message
news:bm************@ID-98527.news.uni-berlin.de...
" ; Hrvoje Somun < HR **************** @ zg.tel.hr> schrieb im Newsbeitrag
新闻:bm ********** @ sunce.iskon.hr ...
"Hrvoje Somun" <hr****************@zg.tel.hr> schrieb im Newsbeitrag
news:bm**********@sunce.iskon.hr...
< example xmlns:namespaceone =" http:// www.one.com"
<example xmlns:namespaceone="http://www.one.com"


xmlns =" http://www.one.com">


xmlns="http://www.one.com">

< check att1 =" one" ATT2 = QUOT;二" />
< check att1 =" one" namespaceone:ATT1 = QUOT;二" />
< / example>

在我的观点栏中
< check att1 =" one" namespaceone:ATT1 = QUOT;二" />
错误(一个元素的不同名称空间不允许
<check att1="one" att2="two" />
<check att1="one" namespaceone:att1="two" />
</example>
in my opinion line
<check att1="one" namespaceone:att1="two" />
is wrong (different namespaces for aributes of one element are not



对吗?


否。



No.



所以你认为这是格式良好的xml代码?

< check namespaceone:att1 =" one namespacetwo:ATT1 = QUOT;二" />


或者如果一个属性在默认命名空间中,这是唯一的事实吗?(首先

例子)


so you think that this is well formed xml code?
<check namespaceone:att1="one" namespacetwo:att1="two" />

or is this only truth if one attribute is in default namespace?(first
example)


" Hrvoje Somun" < HR **************** @ zg.tel.hr>在消息中写道

新闻:bm ********** @ sunce.iskon.hr
"Hrvoje Somun" <hr****************@zg.tel.hr> wrote in message
news:bm**********@sunce.iskon.hr
所以你认为这是形成良好的xml代码?
< check namespaceone:att1 =" one" namespacetwo:ATT1 = QUOT;二" />

或者,如果一个属性在默认名称空间中,这是唯一的事实吗?(首先
示例)
so you think that this is well formed xml code?
<check namespaceone:att1="one" namespacetwo:att1="two" />

or is this only truth if one attribute is in default namespace?(first
example)




它是两种情况都是如此。元素节点和属性节点可以是任何名称空间独立限定的
。如果省略了qalification

,则该属性位于其元素的命名空间中,而该元素又是其父级的命名空间。


Martin



It is true in both cases. Element nodes and attribute nodes can be
independently qualified with any namespace. If you omit a qalification
the attribute is in the namespace of its element, which is in turn in
the namespace of its parent.

Martin


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

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