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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:25:01+00:00 2026-05-24T07:25:01+00:00

First, let me start with some background: I have a web service which accepts

  • 0

First, let me start with some background:
I have a web service which accepts XML as input and outputs in XML. The output has 2 different possible schemas (with two more coming). Each request has a list of groups from which to poll for data. The database is polled, then XML of the correct format is generated from each group; the groups are compiled together and the XML is outputted.

So basically, there is a class for each group of data which handles polling the database and outputting either XML schema output.

The code itself is very bloated and difficult to maintain because of the multiple output formats. So I am looking for a design pattern to use in order to make adding new output formats easier. I explored the option of using XSLT to transform between formats, but they differ significantly so that I believe this option isn’t feasible.

tl;dr: What is an efficient design pattern for a restful XML webservice to generate XML in different formats based on data from a single database?

Please let me if I can provide more information!

  • 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-05-24T07:25:02+00:00Added an answer on May 24, 2026 at 7:25 am

    So basically, there is a class for each group of data which handles polling the database and outputting either XML schema output. –> Can this class be broken down to just do polling of data and return the output as a java bean or something? If yes, I would change this class to just handle data retrieval.
    Create a controller to decide the output format. Use the command pattern around this controller, so that you can add more output formats easily in future.
    Create a different component for the XML output part. Use the Factory pattern and pass the identifier for the output format to this. If the output format is very complex, think of using JAXB. Otherwise reuse whatever code is present in the classes already present.

    Let me know if this helps.

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

Sidebar

Related Questions

First off, let me start off that I am not a .net developer. The
First, let me use one sentence to let out some frustration: My god, developing
First let me start of saying I know absolutely nothing about c++ and I
First let me start by explaining my use case: Say there is a database
Let's say I have an (x,y) that is always the same for the start
First let me post you some example strings: string_position = (\%s\;\%s\;\%s\;\\;\%s\\r\n\%s\;\%s\;\%s\;\%s - %s\;\%s\;\%.0f\;\FR\;\%.2f\;\%.2f\;\%.2f\;\%s\;\%s\;\%s\;\%s\;\\;\\;\\;\\;\\;\\;\\;\\;\\;\\;\\;\\;\\;\\;\B\\r\n,POSNR_NR_ID,POSNR_NR_ID,POSNR,POSNR_NR_ID,ARTNR_NR_ID,POSNR_NR_ID,CP90NAME,TEXT1,TEXT2,ARTNR_NR_ID,CNT,WIDTH,HEIGHT,DEPTH,INFO1,INFO2,INFO3,INFO4) string_position
Let us say I have one supervisor and I need execute some start_child for
First, Let me start by saying thatI am aware of other similar questions, like
Alright, to start with let's look at some code: <html> <body> <script type=text/javascript> function
I have a WPF page. Page has some content, but the last child component

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.