473,545 Members | 4,241 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Q: attribute default name space


Hello

What is the correct way to associate the attributes with the tag if the
tag has a name space associated with it and the attribute doesn't have a
name space?

i.e.
<mytag
xmlns:mine="my/default/name/space"
xmlns:theirs="S ome/one/elses/name/space" >

<mine:atag mine:attr1="my value" attr1="whatever " theirs:attr1="a nother">

</mine:atag>
</mytag>
The parser shows that mytag is in "my/default/name/space", and

`mine:attr1' is in "my/default/name/space"
`theirs:attr1' is in "Some/one/elses/name/space".
`attr1' is not in a name space
Is there a "correct" way to interpret this? Which attribute should be
associated with the tag? Obviously (?) not `theirs', but I would think
that most commonly an attribute won't have a name space, whereas a tag
commonly would, so the unspaced attribute would normally "go with" a tag
even though the name space is wrong, but the above appears valid, so how
is this interpreted?

malcolm

Jul 20 '05 #1
2 1588
In article <40******@news. victoria.tc.ca> ,
Malcolm Dew-Jones <yf***@vtn1.vic toria.tc.ca> wrote:
What is the correct way to associate the attributes with the tag if the
tag has a name space associated with it and the attribute doesn't have a
name space?
Elements are no namespace are interpreted according to the element they
appear on.
<mytag
xmlns:mine="my/default/name/space"
xmlns:theirs="S ome/one/elses/name/space" >

<mine:atag mine:attr1="my value" attr1="whatever " theirs:attr1="a nother">


So in this case you would expect to find the "attr1" attribute described
along with the description of mine:atag.

-- Richard
Jul 20 '05 #2
yf***@vtn1.vict oria.tc.ca (Malcolm Dew-Jones) writes:
The parser shows that mytag is in "my/default/name/space", and

`mine:attr1' is in "my/default/name/space"
`theirs:attr1' is in "Some/one/elses/name/space".
`attr1' is not in a name space
Is there a "correct" way to interpret this?
If by 'interpret' you mean 'associate each attribute with
a namespace (or not, as the case may be)', the correct interpretation
is the one you reproduce. If by 'interpret' you mean something
else, like mapping into some appliction semantics, then that
depends on the definitions of the elements and attributes you
are using.
Which attribute should be
associated with the tag?


All of the attributes should be associated with the element.
All of them occur on the element's start-tag. You don't need
to choose among them.

I hope this helps.

-C. M. Sperberg-McQueen
World Wide Web Consortium / MIT CSAIL
Jul 20 '05 #3

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

Similar topics

2
2025
by: Gabriel Genellina | last post by:
Hi In the following code sample, I have: - a Worker class, which could have a lot of methods and attributes. In particular, it has a 'bar' attribute. This class can be modified as needed. - a Base class (old-style) which defines a default class attribute 'bar' too. I can't modify the source code of this class. Note that Workes does not...
7
3641
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc. And i have things to offer, and to request. And a lot of ideas, but who needs them.... here's an example (from type_struct.py):
4
2921
by: Lénaïc Huard | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I've some namespace problems when defining default values for attributes. My problem seems to come from the fact that the attributes are defined in a different namespace from the element.
2
3949
by: Bill Cohagan | last post by:
In my app I'm validating an XML file against an XSD which contains several attribute default value specifications. I'm performing the validation via an xml document load() using a ValidatingXMLReader. After loading the document (and validating it) I assume that the resulting doc will (as appropriate) have elements with attributes set to their...
12
4929
by: Stefano | last post by:
Hi all, what is the correct use of the "default" attribute in XML Schema? For example: <xs:element name="myProperty" type="xs:string" default="myDefaultValue"/> What can I do with it? What is the meaning of < ....default="myDefaultValue" /> ?
2
1584
by: Nicolas | last post by:
Hi everybody... In Xerces 2.7.0 it is explicitly stated that, no matter how one removes an attribute (attList->removeNamedItem, attList->removeNamedItemNS, domElement->removeAttributeNode, domElement->removeAttribute, domElement->removeAttributeNS), if that attribute has a default value it is immediately replaced. However I cannot obtain...
5
1790
by: patrin | last post by:
Hi All, given the source document: <?xml version="1.0" encoding="UTF-8"?> <root> <child> <test id="1" name="first child"/> </child> <child>
9
6453
by: Mark Olbert | last post by:
I'm trying to serialize (using XmlSerializer.Serialize) a class that I generated from an XSD schema using XSD.EXE /c. The problem I'm running into is that the root element needs to be unqualified, and the default namespace needs to be included on it as an attribute. The schema I'm using is this: <xs:schema...
5
3890
by: John Gordon | last post by:
My XSLT files have many occurrences of this general pattern: <a> <xsl:attribute name="href"> <xsl:value-of select="xyz" /> </xsl:attribute> </a> When I execute an XSL transform, the resulting HTML looks like this:
0
7464
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7396
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7805
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7751
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5323
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1874
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
700
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.