Re: XML namespace / element name question



ByteCoder <me@xxxxxxxx> wrote:
> I just have a probably simple XML question, but I just can't find an
> answer to it:
>
> It seems that two sibling elements, which are in the same namespace, may
> not have the same name (tag name). Is this correct? If yes, should my
> parser return an error when it sees this?
> An example:
> <?xml version="1.0" encoding="UTF-8"?>
> <root>
> <sub1>dskjh</sub1>
> <sub2>haskjh</sub2>
> <sub2>xzjg</sub2>
> </root>
>
> Am I correct to assume the above code is *not* well formed?
>
> <?xml version="1.0" encoding="UTF-8"?>
> <root>
> <root>
> </root>
> </root>
>
> I suspect that the above code is well formed, but is it? In other words:
> Does XML allow this kind of redundancy?

They both well-formed.

--
William Park <opengeometry@xxxxxxxx>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
.



Relevant Pages

  • Re: Union nested in structure.
    ... specifying the tag scope rules would have been a Bad Thing. ... (And, IIRC, the single global-scope tag namespace existed in pre- ... > structures, unions and enums? ... case when you're defining one struct inside another; ...
    (comp.lang.c)
  • Web part question in 2007
    ... try to tag the property to register it as a Sharepoint property. ... System.Web namespace I get an "Unable ... to import web part" error when I try to register the WP in Sharepoint. ...
    (microsoft.public.sharepoint.portalserver.development)
  • Namespace Qualification [was Re: Linux compiling]
    ... I'd rather use a search or search / replace facility on 50,000 lines of code ... > I haven't come across any problems so far using namespace ... In order to allow use of the same tag name to identify different ...
    (alt.comp.lang.learn.c-cpp)
  • Re: XML Tree Discovery (script, tool, __?)
    ... > just namespace + tag ... the above script prints ... the script uses universal names for tags that live in a namespace. ... Prev by Date: ...
    (comp.lang.python)
  • Re: XML namespace / element name question
    ... But well-formedness does not make any restrictions alike "It seems that two sibling elements, which are in the same namespace, may ... not have the same name (tag name)". ... Of course you could write a schema or DTD for a particular XML application where you restrict the contents of elements as needed but then it is a question of validity and not ...
    (comp.text.xml)