Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9145717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:35:00+00:00 2026-06-17T10:35:00+00:00

I use various xml transactions for request and then response transactions. The response transaction

  • 0

I use various xml transactions for request and then response transactions. The response transaction echoes the request transaction and then provides any “hit” information. I’ve noticed that when I try to display the echo, if an element was optional and has the same value as the one provided in the default, then it is omitted.

<Request Name="Marty Jones" Education="0"/>

On Request, if ‘Name’ is required and ‘Education’ is optional, with an enumeration of (0 – none, 1 – high school, 2 – college) and the default is “0”. The element above will display as:

<Request Name="Marty Jones"/>

If I specify that Education=”2″, then it will display as:

<Request Name="Marty Jones" Education="2"/>

Is there a reason that the optional, defaulted value is omitted? I want to show the entire echo no matter what the conditions are.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:35:02+00:00Added an answer on June 17, 2026 at 10:35 am

    Many XSD-aware tools will do this when writing XML. The idea is that it makes the XML shorter and more readable if values that equal the default are omitted (provided they are optional). For example, for XSD itself, any values of minOccurs="1" or maxOccurs="1" will be omitted when writing it out – imagine how cluttered your XSD would be with them included on every <element>, <sequence>, <choice> etc that they could be.

    Note that when parsing with an XSD, a defaulted value and an explicit value equal to the default are not distinguished – without this information, the tool cannot reconstruct which was originally used.

    However, not everyone wants this behaviour in every application; so some tools have a configuration switch to turn this off. As this whole issue is not part of the XSD spec, any such configuration switch is tool-dependent. So you’ll have to tell us which tool you’re using.

    BTW: Here’s a question on this issue, with links to other questions on specific tools. (e.g. MarkLogic has a switch):

    Does the Xml Schema spec define the serialization of optional attributes with a default?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that various systems use various characters as the replacent for illegal ones
On various places they said that you should use @ManagedProperty to get a request
I've seen several projects where I work that use profiles.xml and various {username}.properties in
I have the following method that I use to serialize various objects to XML.
I have a number of Maven pom.xml files in various projects that contain a
I have a class that various different XML schemes are created from. I create
I'm creating an Android application that is supposed to use SAX (javax.xml.parsers.SAXParser) to parse
I have a legacy HTTP/XML service that I need to interact with for various
I am trying to parse somewhat standard XML documents that use a schema called
I am working on a project that makes extensive use of XML config files,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.