I'm doing mock tests from Whizlabs software. Here is the question I've come across and not sure of the answer they've given.
Q)Given the following XML declaration, <x xmlns:n1="http://www.w3.org" xmlns:n2="http://www.w3.org" xmlns="http://www.w3.org">
Which of the following elements is valid with respect to attribute names? A) <test a="1" a="2"> B) <test n1:a="1" n2:a="2" /> C) <test a=1 b=2 /> D) <test a="1" n1:a="2" />
First the schema given is wrong because regarding to xml specification two prefixes not allowed to shared same schema. In schema n1 and n2 using the same namespace. But Same time default and one prefix allowed to use same namespace so there is no problem with default namespace declaration in schema.
In given option,
A Invalid ( due to duplicated attibute name)
C Invalid (due to its missing " )
B) Invalid (due to both a attribute belongs to same namespace)
at first i thought d) option was wrong, because the default namespace was same as n1. However, after chech the question again, i found the <x ...>'s scope has already finished.
hence, the a="1" dose not indicate the default namespase, it is a whatever.
am i right?
Post by:autobot
I am a man of mystery. Mostly because of this tiny ad:
a bit of art, as a gift, the permaculture playing cards