Accessing the default value of attributes in an XML file

Marc A. Criley

Usenet Archive
Joined
Oct 28, 2003
Messages
4
Reaction score
0
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
 

Philippe Poulard

Usenet Archive
Joined
Dec 20, 2001
Messages
412
Reaction score
0
Marc said:
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
 

Marc A. Criley

Usenet Archive
Joined
Oct 28, 2003
Messages
4
Reaction score
0
Philippe Poulard said:
It's impossible with XPath
However, it is possible with DOM :
Attr#getSpecified

Thanks for the guidance.
^^^^^ are you sure :) ? Xalan, maybe ?

Dyslexics of the world, UNTIE! :)

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,802
Members
249,594
Latest member
henrywalsh

Latest Threads

Top