unprefixed names in Perl SAX 2.0 parsers

Discussion in 'XML' started by Avi Kak, May 5, 2005.

  1. Avi Kak

    Avi Kak Guest

    Hello:

    This questions relates to the behavior of the Perl
    SAX 2.0 parser XML::LibXML::SAX. (This behavior is
    also shown by the XML::SAX::Expat parser and,
    possibly by all other Perl SAX 2.0 parsers.)

    My understanding of a default namespace is that
    all unprefixed names get assigned to the default
    namespace at and below the level of the element in
    which the default namespace is declared.

    But when I try the XML::LibXML::SAX parser on
    the following document, I don't see the un-prefixed
    names 'y', 'C', and 'w' getting assigned to
    the default namespace
    http://www.mywebsite.com/NS3names/.

    Avi Kak

    <?xml version="1.0" encoding="iso-8859-1"?>
    <NS1:A xmlns:NS1="http://www.mywebsite.com/NS1names/"
    xmlns:NS2="http://www.mywebsite.com/NS2names/"
    xmlns="http://www.mywebsite.com/NS3names/"
    >

    <NS1:B NS1:x="hello" y="jello" NS2:z="mello">
    hellojellomello
    </NS1:B>
    <C w="cello"/>
    </NS1:A>
     
    Avi Kak, May 5, 2005
    #1
    1. Advertising

  2. Avi Kak <> writes:

    > Hello:
    >
    > This questions relates to the behavior of the Perl
    > SAX 2.0 parser XML::LibXML::SAX. (This behavior is
    > also shown by the XML::SAX::Expat parser and,
    > possibly by all other Perl SAX 2.0 parsers.)
    >
    > My understanding of a default namespace is that
    > all unprefixed names get assigned to the default
    > namespace at and below the level of the element in
    > which the default namespace is declared.
    >
    > But when I try the XML::LibXML::SAX parser on
    > the following document, I don't see the un-prefixed
    > names 'y', 'C', and 'w' getting assigned to
    > the default namespace


    the default namespace only applies to elements not attriutes so
    in your example y and w are in no-namespace and C is in the namespace
    http://www.mywebsite.com/NS3names/

    David


    > http://www.mywebsite.com/NS3names/.
    >
    > Avi Kak
    >
    > <?xml version="1.0" encoding="iso-8859-1"?>
    > <NS1:A xmlns:NS1="http://www.mywebsite.com/NS1names/"
    > xmlns:NS2="http://www.mywebsite.com/NS2names/"
    > xmlns="http://www.mywebsite.com/NS3names/"
    > >

    > <NS1:B NS1:x="hello" y="jello" NS2:z="mello">
    > hellojellomello
    > </NS1:B>
    > <C w="cello"/>
    > </NS1:A>
     
    David Carlisle, May 5, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marcos

    Locator2 and SAX parsers

    Marcos, Jul 15, 2003, in forum: Java
    Replies:
    0
    Views:
    357
    Marcos
    Jul 15, 2003
  2. Per Magnus L?vold
    Replies:
    0
    Views:
    2,022
    Per Magnus L?vold
    Nov 16, 2004
  3. Replies:
    3
    Views:
    581
  4. Falomiro de Vergatiesa

    Locator2 and SAX parsers

    Falomiro de Vergatiesa, Jul 15, 2003, in forum: XML
    Replies:
    0
    Views:
    978
    Falomiro de Vergatiesa
    Jul 15, 2003
  5. Henry S. Thompson
    Replies:
    0
    Views:
    394
    Henry S. Thompson
    Nov 18, 2005
Loading...

Share This Page