[XML] filling empty attribute values with the default value specifiedin the XML schema.

S

Stefan Siegl

Hello,

I was wondering if there is an easy possiblity to configure a XML parser
to automatically set empty attribute values to the default value
specified in the xml schema file.

I am currently using the dom4j framework with the validating Xerces2
SAX2 Parser.

Thanks in advance,
Stefan Siegl
 
K

Kermit T Tensmeyer

Stefan Siegl said:
Hello,

I was wondering if there is an easy possiblity to configure a XML parser
to automatically set empty attribute values to the default value
specified in the xml schema file.

I am currently using the dom4j framework with the validating Xerces2
SAX2 Parser.

Why Yes Of Course it would be Simple to "write/configure" an XML parser
especially in a SAX environment to write default values for empty elements.

How? When the 'close' event fires off, have your code check for empty
elements, and generate the default values.

SAX uses notifications (registered callbacks as it were) to handle the
processing for each element. Xerces 2.5.0 makes it easier to handle the
code, but the code still must exist (that is written) to handle the open
element events, and close element events. It isn't magic, it's just a
structured way to parse event as they happen.
The validating section just uses a predefined set of open/close events to
map a logical file (physical or otherwise) onto the provided schema, and
notes the differences.


yep, you can make the notification elements that -you- provide generated
default value for conditions that you specify.

it's just that simple..
 

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
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top