473,411 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

unprefixed names in Perl SAX 2.0 parsers


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>

Jul 20 '05 #1
1 1310
Avi Kak <ka*@ecn.purdue.edu> 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>

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
0
by: Henry S. Thompson | last post by:
W3C is pleased to announce the public launch of the XPointer Schemes Registry: http://www.w3.org/2005/04/xpointer-schemes/ The XPointer Recommendation reserved all simple (unprefixed) XPointer...
5
by: James Owens | last post by:
I anticipate working with XML and XSL a lot over the next few years (I'm in technical documentation). I also happen to be looking for a new scripting language for some CGI interfaces I'll be...
5
by: bugbear | last post by:
I need to do some fairly simple processing of XML files; I would like to be able to do this in perl. However, the XML I'm handling uses namespaces. In practice, the tags do not overlap, so I...
13
by: athiane | last post by:
I want a way to parse out all function names that appear in a couple of C files. When the parsing logic finds a function name in a file, it should print out the Function name, line number and file...
2
by: dwelch91 | last post by:
Hi, c.l.p.'ers- I am having a problem with the import of xml.parsers.expat that has gotten me completely stumped. I have two programs, one a PyQt program and one a command line (text) program...
9
by: Henrik Goldman | last post by:
Hi, I would like to create a simplistic parser which goes through each .h file and finds each function prototype (or inline implementation) along with class names and member functions. ...
4
by: Victor Lagerkvist | last post by:
Hello, I have the need to parse variable names from a string and save them somewhere safe for future usage. Here's my first attempt (I don't have any rules for valid names yet) - but I have a...
0
by: JosAH | last post by:
Greetings, this week's article part discusses the parsers used for our little language. We will implement the parsers according to the grammar rules we defined in the second part of this...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.