"Stefan Siegl" <> wrote in message
news:bg37d2$kd5qt$...
> 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..
|