Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

xml duplicated field name

Question posted by: sweetpotatop@yahoo.com (Guest) on June 27th, 2008 07:07 PM
Hi,

I am wondering if it alright to have duplicate attribute name in an
xml file. As you can see below, there is an attribute called
<FieldNote>, then another one at the bottom. Besides, you can see the
2nd FieldNote attribute doesn't have an open tag, does this file looks
right at all?


<AuditType>2</AuditType>

<FieldNote>0</FieldNote>

<Date>2/1/2008</Date>
<EventID>149406</EventID>
<EventType>2</EventType>
<FieldName>Approval</FieldName>

<FieldNote />

Thanks in advance. Your advice would be greatly appreciated.
Martin Honnen's Avatar
Martin Honnen
Guest
n/a Posts
June 27th, 2008
07:07 PM
#2

Re: xml duplicated field name
Join Bytes! wrote:
Quote:
Hi,
>
I am wondering if it alright to have duplicate attribute name in an
xml file. As you can see below, there is an attribute called
<FieldNote>, then another one at the bottom. Besides, you can see the
2nd FieldNote attribute doesn't have an open tag, does this file looks
right at all?
>
>
<AuditType>2</AuditType>
>
<FieldNote>0</FieldNote>
>
<Date>2/1/2008</Date>
<EventID>149406</EventID>
<EventType>2</EventType>
<FieldName>Approval</FieldName>
>
<FieldNote />


You have two _elements_ of the name FieldNote. That is allowed. You
can't have two _attributes_ of the same name on the same element however
e.g.
<foo FieldNote="bar" FieldNote="baz"/>
is not allowed.



--

Martin Honnen
http://JavaScript.FAQTs.com/

sweetpotatop@yahoo.com's Avatar
sweetpotatop@yahoo.com
Guest
n/a Posts
June 27th, 2008
07:07 PM
#3

Re: xml duplicated field name
On Jun 12, 10:37*am, Martin Honnen <mahotr...@yahoo.dewrote:
Quote:
sweetpota...@yahoo.com wrote:
Quote:
Hi,

>
Quote:
I am wondering if it alright to have duplicate attribute name in an
xml file. As you can see below, there is an attribute called
<FieldNote>, then another one at the bottom. Besides, you can see the
2nd FieldNote attribute doesn't have an open tag, does this file looks
right at all?

>
Quote:
* <AuditType>2</AuditType>

>
Quote:
* <FieldNote>0</FieldNote>

>
Quote:
* <Date>2/1/2008</Date>
* <EventID>149406</EventID>
* <EventType>2</EventType>
* <FieldName>Approval</FieldName>

>
Quote:
* <FieldNote />

>
You have two _elements_ of the name FieldNote. That is allowed. You
can't have two _attributes_ of the same name on the same element however
e.g.
* *<foo FieldNote="bar" FieldNote="baz"/>
is not allowed.
>
--
>
* * * * Martin Honnen
* * * *http://JavaScript.FAQTs.com/- Hide quoted text -
>
- Show quoted text -


Thanks, how about the 2nd elements without the open tag? i.e. with
just <FieldNote />, but not <FieldNote><FieldNote />

Thanks

Joseph J. Kesselman's Avatar
Joseph J. Kesselman
Guest
n/a Posts
June 27th, 2008
07:07 PM
#4

Re: xml duplicated field name
just <FieldNote />, but not <FieldNote><FieldNote />

http://www.w3.org/TR/REC-xml/#NT-EmptyElemTag

Martin Honnen's Avatar
Martin Honnen
Guest
n/a Posts
June 27th, 2008
07:07 PM
#5

Re: xml duplicated field name
Join Bytes! wrote:
Quote:
Thanks, how about the 2nd elements without the open tag? i.e. with
just <FieldNote />, but not <FieldNote><FieldNote />


Sorry, I don't understand what you are asking now.
<FieldNote><FieldNote />
does not make sense, you either need
<FieldNote></FieldNote>
or
<FieldNote><FieldNote /></FieldNote>
where the first is an empty FieldNote element and the second is a
FieldNote element that has one child node, a second FieldNote element.

--

Martin Honnen
http://JavaScript.FAQTs.com/

sweetpotatop@yahoo.com's Avatar
sweetpotatop@yahoo.com
Guest
n/a Posts
June 27th, 2008
07:07 PM
#6

Re: xml duplicated field name
On Jun 12, 10:58*am, Martin Honnen <mahotr...@yahoo.dewrote:
Quote:
sweetpota...@yahoo.com wrote:
Quote:
Thanks, how about the 2nd elements without the open tag? i.e. with
just <FieldNote />, but not <FieldNote><FieldNote />

>
Sorry, I don't understand what you are asking now.
* *<FieldNote><FieldNote />
does not make sense, you either need
* *<FieldNote></FieldNote>
or
* *<FieldNote><FieldNote /></FieldNote>
where the first is an empty FieldNote element and the second is a
FieldNote element that has one child node, a second FieldNote element.
>
--
>
* * * * Martin Honnen
* * * *http://JavaScript.FAQTs.com/


Alright, by looking at

<FieldNote>0</FieldNote>
<Date>2/1/2008</Date>
<EventID>149406</EventID>
<EventType>2</EventType>
<FieldName>Approval</FieldName>
<FieldNote />
<NewValue>1</NewValue>

The first FieldNote has a value of "0"
How about the 2nd one? what does <FieldNote /mean?

Thanks in advance.

Martin Honnen's Avatar
Martin Honnen
Guest
n/a Posts
June 27th, 2008
07:07 PM
#7

Re: xml duplicated field name
Join Bytes! wrote:
Quote:
<FieldNote>0</FieldNote>
<Date>2/1/2008</Date>
<EventID>149406</EventID>
<EventType>2</EventType>
<FieldName>Approval</FieldName>
<FieldNote />
<NewValue>1</NewValue>
>
The first FieldNote has a value of "0"
How about the 2nd one? what does <FieldNote /mean?


<FieldNote /is a short form of <FieldNote></FieldNote>, it is an empty
FieldNode element.


--

Martin Honnen
http://JavaScript.FAQTs.com/

Peter Flynn's Avatar
Peter Flynn
Guest
n/a Posts
June 27th, 2008
07:07 PM
#8

Re: xml duplicated field name
Join Bytes! wrote:
Quote:
On Jun 12, 10:58 am, Martin Honnen <mahotr...@yahoo.dewrote:
Quote:
>sweetpota...@yahoo.com wrote:
Quote:
>>Thanks, how about the 2nd elements without the open tag? i.e. with
>>just <FieldNote />, but not <FieldNote><FieldNote />

>Sorry, I don't understand what you are asking now.
> <FieldNote><FieldNote />
>does not make sense, you either need
> <FieldNote></FieldNote>
>or
> <FieldNote><FieldNote /></FieldNote>
>where the first is an empty FieldNote element and the second is a
>FieldNote element that has one child node, a second FieldNote element.
>>
>--
>>
> Martin Honnen
> http://JavaScript.FAQTs.com/

>
Alright, by looking at
>
<FieldNote>0</FieldNote>
<Date>2/1/2008</Date>
<EventID>149406</EventID>
<EventType>2</EventType>
<FieldName>Approval</FieldName>
<FieldNote />
<NewValue>1</NewValue>
>
The first FieldNote has a value of "0"
How about the 2nd one? what does <FieldNote /mean?


In terms of markup, it means the element is present but it has no value.

What it means in terms of your business process is a question only you
can answer.

///Peter
--
XML FAQ: http://xml.silmaril.ie/

 
Not the answer you were looking for? Post your question . . .
189,759 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors