473,320 Members | 2,193 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,320 software developers and data experts.

Accessing the default value of attributes in an XML file

First off, I'm an experienced software developer but new to XML, so be
gentle :-)

I've put together a schema that defines optional attributes for some
of the elements. Some of these attributes have default values defined
for them in the schema.

XML files that employ that schema may of course then have entries that
omit the default-valued attributes.

How, using XPath (or some other means?) do I query for the attribute
value of those default-valued attributes that are not explicitly
provided?

The software I'm working on needs to be portable, so I'm not using
MSXML, instead Xerces and XAnal (so far).

Thanks for any assistance.

Marc A. Criley
Quadrus Corporation
www.quadruscorp.com
Jul 20 '05 #1
2 1917
Marc A. Criley wrote:
First off, I'm an experienced software developer but new to XML, so be
gentle :-)

I've put together a schema that defines optional attributes for some
of the elements. Some of these attributes have default values defined
for them in the schema.

XML files that employ that schema may of course then have entries that
omit the default-valued attributes.

How, using XPath (or some other means?) do I query for the attribute
value of those default-valued attributes that are not explicitly
provided?
It's impossible with XPath
However, it is possible with DOM :
Attr#getSpecified()

The software I'm working on needs to be portable, so I'm not using
MSXML, instead Xerces and XAnal (so far). ^^^^^ are you sure :) ? Xalan, maybe ?
Thanks for any assistance.

Marc A. Criley
Quadrus Corporation
www.quadruscorp.com

--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------

Jul 20 '05 #2
"Philippe Poulard" <Ph**************@sophia.inria.fr> wrote in message news:<bn**********@news-sop.inria.fr>...
Marc A. Criley wrote:
How, using XPath (or some other means?) do I query for the attribute
value of those default-valued attributes that are not explicitly
provided?


It's impossible with XPath
However, it is possible with DOM :
Attr#getSpecified()


Thanks for the guidance.
The software I'm working on needs to be portable, so I'm not using
MSXML, instead Xerces and XAnal (so far).

^^^^^ are you sure :) ? Xalan, maybe ?

Dyslexics of the world, UNTIE! :-)

Marc
Jul 20 '05 #3

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

Similar topics

1
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
1
by: wooks | last post by:
I have some information embedded in included schemas which I want to access at run-time for the purposes of contructing a GUI (they will support field labels and tool tips). The options seem to...
4
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...
2
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...
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
12
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...
5
by: Peter | last post by:
I have 3 ASP.NET forms written in C#, I also have 3 frames (left, top and bottom) one for each form. My question is if I have data on one form in the bottom frame how do I access this data when I...
3
by: Marty McFly | last post by:
Hello, I have a control class that inherits from System.Web.UI.WebControls.Button. When I drag this control from the "My User Controls" tab in the toolbox onto the form, I want it to reflect the...
3
by: rolf.oltmans | last post by:
Hello, I've been trying to access the html element "Body" in my server side code. I've searched the archives of this group and have been able to put together an example that doesn't work :)...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.