![]() |
[XML] filling empty attribute values with the default value specifiedin the XML schema.
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 |
Re: [XML] filling empty attribute values with the default value specified in the XML schema.
"Stefan Siegl" <Stefan.Siegl@gmx.de> wrote in message news:bg37d2$kd5qt$1@ID-151500.news.uni-berlin.de... > 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.. |
| All times are GMT. The time now is 05:53 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.