Hi All,
I have a situation where in I get data in format as below
I get this data in the form of a
String array
/Book/Subject/Fiction
/Book/Subject/NonFiction
/Periodical/Type/Magazine
/Periodical/Type/Newspaper
& many such more. In above we have like 3 level hierarchial structure
(/Book/Subject/Fiction).
In some cases I may get a 4 or 5 level structure.
What I need to do is create the xml representation for the same.
i.e. create the first token as a top level xml element
all the subsequent ones as child level xml elements underneath the above
& the last token as the value for the last level xml element
So say in the above case what we need to do is
<book>
<subject>Fiction</subject>
</book>
<periodical>
<type>Magazine</type>
</periodical>
I am planning to implement this via the Regex
pattern. I don't have much
badwidth on the same.
Do post your thoughts whether I am heading in right direction.
I would appreciate if someone can post few codepieces through which can help me acheiving the same.
Thanks In Advance,
Manish