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

Discussion in 'Java' started by Stefan Siegl, Jul 28, 2003.

  1. Stefan Siegl

    Stefan Siegl Guest

    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
     
    Stefan Siegl, Jul 28, 2003
    #1
    1. Advertising

  2. Re: [XML] filling empty attribute values with the default value specified in the XML schema.

    "Stefan Siegl" <> wrote in message
    news:bg37d2$kd5qt$-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..
     
    Kermit T Tensmeyer, Jul 28, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,580
    Markus
    Nov 23, 2005
  2. Bob Foster
    Replies:
    0
    Views:
    429
    Bob Foster
    Jul 30, 2003
  3. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,277
    Stanimir Stamenkov
    Apr 25, 2005
  4. Mohsen Pahlevanzadeh
    Replies:
    0
    Views:
    124
    Mohsen Pahlevanzadeh
    Sep 9, 2013
  5. MRAB
    Replies:
    0
    Views:
    123
Loading...

Share This Page