1

I am trying to map a String (key) to an XML schema with few variable that will change (marked with $ sign).

I am not sure what is the best way to do this in terms of the map to use (hashmap?) and the type to use for the xml schema (map a string to ..?)

Also, I am not entirely sure if passing the strings that will change (let's say: id and name for example) as part of the key and replace them or get the schema back and replace the variable once I process the schema again.

Any help is appreciated.

1
  • I am not really generating a new schema, I simply have an already generated schema (template) with couple of things need to be replaced. I just need to return that schema once requested by a key (different schemas for different keys). I am not sure JAXB is for that, is it? Commented Mar 22, 2012 at 20:06

2 Answers 2

1

Instead of implementing this on your own, bind the schema types to Java classes or use some sort of templating engine like StringTemplate.

Sign up to request clarification or add additional context in comments.

1 Comment

I am not really generating a new schema, I simply have an already generated schema (template) with couple of things need to be replaced. I just need to return that schema once requested by a key (different schemas for different keys). I am not sure JAXB is for that, is it?
0

So is it not simplest to treat the Schema as a string, and just hold it in a Map. Then when you pull it out, do a replace/replaceAll on the schema, and return it. I think that covers what you want?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.