Parent xsd :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="SpecialOption">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="Option" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
After modifying xsd: Adding use="required" field
<xs:element name="SpecialOption">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="Option" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
I want to add the use="required" field to the parent xsd and generate a new xsd file. I want to do this programmatically from a java code.
currently, I am following the below method to read the xsd file but cannot figure out a way to add the use="required" attribute How to Programmatically Update and Add Elements to an XSD
Any help here is very much appreciated.Thank you