function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ayesha LefebvreAyesha Lefebvre 

Is it possible to create an object using XSD file?

New to Apex development and wondering if it is even possible to generate apex POJOs from xsd files? I see there is support for WSDL > Apex, JSON deserialize method (json > Object) and XMLStreamReader but no explicit way to generate of objects from xsd files. Has nayone tried to do this? How di you solve? 
AbhishekAbhishek (Salesforce Developers) 
The Salesforce objects can be updated via Metadata. The good news is the metadata for objects is an XML file, so depending on the contents of your file it would be feasible to use an XSLT to convert to the Salesforce XML definitions.
 
I suggest you start off looking at the http://www.salesforce.com/us/developer/docs/api_meta/api_meta.pdf and take it from there.



Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.
Shaun RipleyShaun Ripley
If I understand this right, you're both wanting to read a file in, and you're wanting to direct deserialize them into objects. With this, you would have to convert the XML to JSON, and from there use the (json > object) deserialization. I have written a library to help with this for anyone else that comes across similar issues: https://github.com/zabroseric/sfdc-xml-parser

With regards to reading the files, however, I would need to understand how this is managed to help further.