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

  • SEARCH
  • Home
  • 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 195k
  • Answers 195k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If I understand you correctly, you have an NSArray (you… May 12, 2026 at 6:58 pm
  • Editorial Team
    Editorial Team added an answer For release libraries, it's unlikely that you could determine the… May 12, 2026 at 6:58 pm
  • Editorial Team
    Editorial Team added an answer Having thought about it a couple minutes, it seems very… May 12, 2026 at 6:58 pm

Related Questions

I have an application that's a mix of Java and C++ on Solaris. The
I'm about to embark on a new project within which we require the ability
I have a very simple problem. I have an application which is written in
I have a web service method where I would like to throw some custom

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.