Hello,
In my application im going to use cxsd module in order to generate a Typescript class from a given xsd. The application is fed by xml inputs that I then do some logics on, converting the input to a known object by another web service and send it to the web service.
For example, recieving a DogXML input -> converting to OutputDog -> sending to the webservice that expects the OutputDog
I couldnt find converting the input xml to the output object so trivial.
Writing an application with Typescript made it clear for me that i need to somehow parse the xml input to the generated Typescript classes by the cxsd. my question is how?
How do you parse a given xml to an instance of an existing Class?
What i want to achieve is :
- Recieving a
DogXML - Creating a
Doginstance of this xml - Do logic and convert it to
OutputDog - Send the
OutputDogto the web service
Currently i am using xml2js module to convert the input xml into a JSON and work on it, the problem is that the output of the parsing to JSON is any and I cant access the properties of Dog since it doesn't know Dog's properties. This is why I need to create an instance of Dog from the given XML
Thanks in advance, hopefully i made myself clear!