473,390 Members | 1,141 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,390 software developers and data experts.

Parsers preserve order of IDs in IDREFS ?

In a specification I'm designing, I'd like to specify that the order
of Names (IDs) in an attribute value of datatype IDREFS is
significant.

My question is if most real-world XML parsers preserve the order of
IDs in IDREFS? If most don't, then specifying the significance of
order is problematic.

(As far as I can tell, the XML 1.0 spec is silent on this topic.)

Thanks.

Mark

Jan 15 '06 #1
6 1488


Mark wrote:
In a specification I'm designing, I'd like to specify that the order
of Names (IDs) in an attribute value of datatype IDREFS is
significant.

My question is if most real-world XML parsers preserve the order of
IDs in IDREFS?


If the attribute value is a sequence of white space separated IDs then I
don't see why any XML parser would change the order of that sequence
when passing the attribute value on to an application. I don't see why
parsers would touch attribute values at all (with some exception of
complicated values with entity references where a particular data model
(e.g. XPath) does not model such stuff).

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 15 '06 #2
Mark wrote:
In a specification I'm designing, I'd like to specify that the order
of Names (IDs) in an attribute value of datatype IDREFS is
significant.
The order of ID values in an IDREFS attribute is not significant in
XML. The purpose of IDREFS is to allow the specification of a multi-
headed link between the element bearing that attribute and the separate
elements bearing the various IDs. It wasn't designed to allow order to
be expressed, although as you rightly ask below, once entered, the data
is not subsequently changed by a parser.

If the order is significant in your application, then the code to check
or enforce this significance must be written into your application. The
parser (validator) is only interested in checking that an ID value
exists elsewhere in the document for each IDREF[S] value given.
My question is if most real-world XML parsers preserve the order of
IDs in IDREFS?
IMHE yes, they leave them alone. I can't speak for unreal-world parsers :-)
If most don't, then specifying the significance of
order is problematic.
I'd be very interested to know why the order would be significant.
Are you at liberty to give more details? In applications I have seen
where the order of link processing *is* significant, other markup has
been used to express this (eg in TEI the <linkGrp> container).
(As far as I can tell, the XML 1.0 spec is silent on this topic.)


AFAIK it's never been an issue.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Jan 15 '06 #3
In article <42*************@individual.net>,
Peter Flynn <re*********@m.from.email.address> wrote:
The order of ID values in an IDREFS attribute is not significant in
XML.


The XML specification doesn't say anything explicit about this. But
what it requires parsers to pass to applications is the normalized
(string) value of the attribute, not a list of IDs. And the string
must be in the original order - all that is done to it is whitespace
normalization.

The XML Infoset is clear: the [references] property is an ordered
list, and reflects the order in the attribute.

-- Richard
Jan 15 '06 #4
Thanks also to Martin and Peter for replying to my basic inquiry.

Richard Tobin wrote:
Peter Flynn wrote:
The order of ID values in an IDREFS attribute is not significant in
XML.

The XML specification doesn't say anything explicit about this. But
what it requires parsers to pass to applications is the normalized
(string) value of the attribute, not a list of IDs. And the string
must be in the original order - all that is done to it is whitespace
normalization.
<slapping what="hand on head"/>

I should have remembered this from the XML spec! Thanks for reminding
me that parsers preserve attribute values (with white space
normalization as required) to send to the application. I'm clearly not
an expert on XML parsing, so I appreciate the feedback from those who
are.

The XML Infoset is clear: the [references] property is an ordered
list, and reflects the order in the attribute.


Thanks.

I'll also check out a different approach as suggested by Peter (e.g.,
the TEI <linkGrp>.)
On a related topic, I am confused about what XML 1.0 says about the
"space" between IDs in IDREF, and reconcile that with what is being
said on the Internet (which often says "white space".)

According to Section 3.3.1 of the XML spec, datatype IDREFS must
match the "Names" production. "Names" is defined in Section 2.3 [6]
as follows:

[6] Names ::= Name (#x20 Name)*

Notice this allows only one space character between "Name", not
white space (which can be any number of spaces, carriage returns,
line feeds, and tabs.)

So what am I missing here?

Thanks again.
Jan 15 '06 #5
In article <et********************************@4ax.com>,
Mark <ma**@nowhere.com> wrote:
According to Section 3.3.1 of the XML spec, datatype IDREFS must
match the "Names" production. "Names" is defined in Section 2.3 [6]
as follows:

[6] Names ::= Name (#x20 Name)*

Notice this allows only one space character between "Name", not
white space (which can be any number of spaces, carriage returns,
line feeds, and tabs.)

So what am I missing here?


Before the validity constraints, 3.3.1 says:

The validity constraints noted in the grammar are applied after the
attribute value has been normalized as described in 3.3.3
Attribute-Value Normalization.

(If it defined the constraint in terms of the un-normalized value, the
definition would have to deal with entity and character references, as
well as allowing all the kinds of white space.)

-- Richard
Jan 15 '06 #6
Richard Tobin
So what am I missing here?
Before the validity constraints, 3.3.1 says:

The validity constraints noted in the grammar are applied after the
attribute value has been normalized as described in 3.3.3
Attribute-Value Normalization.

(If it defined the constraint in terms of the un-normalized value, the
definition would have to deal with entity and character references, as
well as allowing all the kinds of white space.)


Thanks, Richard. That clarifies it. I did not read far enough back in
that section.
Jan 15 '06 #7

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

Similar topics

1
by: Will Stuyvesant | last post by:
There seems to be no XML parser that can do validation in the Python Standard Libraries. And I am stuck with Python 2.1.1. until my web master upgrades (I use Python for CGI). I know pyXML has...
0
by: Magnus Lie Hetland | last post by:
I'm working on a project where I have to create parsers on the fly, based on input to my program. I think Spark seems like a good candidate for the parser generation part, but it seems very geared...
3
by: Rabe | last post by:
Hi all, here a little brain-twister (starting to spoil my weekend if I do not find a solution ... ;-) ) What I want to do is to find a XML-Schema expression that builds a grammar for the...
5
by: Stuart Robertson | last post by:
I am trying to find a solution that will allow me to use XmlSerializer to serialize/deserialize a collection of objects where a given object is shared between two or more other objects, and not...
7
by: Microsoft News | last post by:
Hi all. Does id() xpath function work in System.XML? I have built dtd, schema, xdr for a simple xml which includes attributes definded as ID and IDREFS. Validation is occurring properly for all...
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...
0
by: zgolus | last post by:
I'm working with one extra large XML file which consists of many parts. Every part can be considered a stand-alone document with references to other parts (IDs and IDREFs). I would like to be able...
0
by: JosAH | last post by:
Greetings, welcome back at the sequel of the parsers article chapter. This part is dedicated to the ExpressionParser, the largest parser class for our little language. This class parses 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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.