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 94513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:30:48+00:00 2026-05-10T23:30:48+00:00

I have a Java object which is able to configure itself given an XML

  • 0

I have a Java object which is able to configure itself given an XML configuration description (it takes other descriptions as well, but I’m interested in the XML at the moment). I’m wondering if I can embed the XML description directly into a Spring application context description. I’m imagining something like:

<bean id='myXMLConfiguredBean' class='com.example.Foo'>   <constructor-arg type='xml'>     <myconfig xmlns='http://example.com/foo/config'>       <bar>42</bar>     </myconfig>   </constructor-arg> </bean> 

but I have no idea if that – or something like it – is possible. I realise I could embed myconfig in a CDATA section, but that seems a bit ugly.

  • 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. 2026-05-10T23:30:48+00:00Added an answer on May 10, 2026 at 11:30 pm

    Spring’s XSD allows <constructor-arg> to contain any XML through:

    <xsd:element name='constructor-arg'>   <xsd:complexType>     <xsd:sequence>       <xsd:element ref='description' minOccurs='0' />         <xsd:choice minOccurs='0' maxOccurs='1'>           <xsd:element ref='bean' />           <xsd:element ref='ref' />           <xsd:element ref='idref' />           <xsd:element ref='value' />           <xsd:element ref='null' />           <xsd:element ref='list' />           <xsd:element ref='set' />           <xsd:element ref='map' />           <xsd:element ref='props' />           <!-- Any XML -->           <xsd:any namespace='##other' processContents='strict' />         </xsd:choice>       </xsd:sequence>       ...   </xsd:complexType> </xsd:element> 

    Where the processContents attribitutes can have one of three values

    strict: There must be a top-level declaration for the item available, or the item must have an xsi:type, and the item must be ·valid· as appropriate.

    So, so long as your config XML has a schema, and you import it correctly, this should work.

    Then, you would need to register a PropertyEditor for your XML using CustomEditorConfigurer

    Hope this helps

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

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer So after some digging around I came up with an… May 11, 2026 at 11:41 am
  • added an answer There is no standard library in the C-standard to read… May 11, 2026 at 11:41 am
  • added an answer So, first you create a virtual table with the position… May 11, 2026 at 11:40 am

Related Questions

I have a Java object which is able to configure itself given an XML
I have a Serializable object which is supposed to hold a java.awt.Image as its
I have a MATLAB class which contains a reference to a java object classdef
On a JSTL/JSP page, I have a java.util.Date object from my application. I need
I have a large tree of Java Objects in my Desktop Application and am
I'm having a small problem in Java. I have an interface called Modifiable. Objects
I have a Java swing application with a panel that contains three JComboBoxe s
I have a java back-end that needs to expose services to clients running in
I have a Java application that launches another java application. The launcher has a
I have a Java application which I want to shutdown 'nicely' when the user

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.