4

I need to write a map of string data to an XML document. The XML document has a specific format. An entry key determines where in the XML document the value will be written to. See below for an example (pseudo-code where appropriate);

map = {"document_id": "123"; "document_type": "type_A"}

Produces an XML file like this;

<document>
 <document_id>123</document_id>
 <document_type>type_A</document_type>
</document>

I need the format of the target XML document (and where the map data is written to in it) to be user-configurable. For example;

<node name="document">
 <node name="document_id">${document_id}</node>
 <node name="document_type">${document_type}</node>
</node>

I feel like my proposed solution would be complex and a re-invention of the wheel. I figure there must be some established way to do this but after searching the internet I can't seem to find it. Can anyone offer suggestions on how I may achieve what I want to do?

asked Jul 19, 2013 at 15:23

1 Answer 1

5

have you looked into using an XSLT file for transforming the information?

I imagine that you could take the Data entered into a form and create a new XML file and then use an XSLT file to format it to the right XML format and insert it into your target XML.

I think this is kind of what you are looking for if i read the question correctly

answered Jul 19, 2013 at 18:16
1
  • glad that I could help Commented Jul 24, 2013 at 13:07

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.