How to generate XSD from XML, by restricting all the values ? [message #903191] |
Wed, 22 August 2012 13:07  |
Eclipse User |
|
|
|
Say, My XML is,
<ITRForm:IncomeFromSal>1500000</ITRForm>
<ITRForm:TotalIncomeOfHP>-10000</ITRForm:TotalIncomeOfHP>
<ITRForm:IncomeOthSrc>15000</ITRForm:IncomeOthSrc>
i need to restrict IncomeFromSal to 1500000,
In XSD, I can give,
<xs:element name="IncomeFromSal" fixed="1500000">
I've some 500 elements in my XML. I need to make all elements in XSD as, 'fixed' to the values in XML.
like
<xs:element name="IncomeFromSal" fixed="1500000">
<xs:element name="TotalIncomeOfHP" fixed="-10000">
<xs:element name="IncomeOthSrc" fixed="15000">
How to do this? Can any one help me?
|
|
|
Re: How to generate XSD from XML, by restricting all the values ? [message #903224 is a reply to message #903191] |
Wed, 22 August 2012 14:28   |
Eclipse User |
|
|
|
What have you tried so far?
On 22/08/2012 3:07 PM, sagar y wrote:
> Say, My XML is,
>
> <ITRForm:IncomeFromSal>1500000</ITRForm>
> <ITRForm:TotalIncomeOfHP>-10000</ITRForm:TotalIncomeOfHP>
> <ITRForm:IncomeOthSrc>15000</ITRForm:IncomeOthSrc>
>
> i need to restrict IncomeFromSal to 1500000,
>
> In XSD, I can give,
>
> <xs:element name="IncomeFromSal" fixed="1500000">
>
> I've some 500 elements in my XML. I need to make all elements in XSD
> as, 'fixed' to the values in XML.
>
> like
>
> <xs:element name="IncomeFromSal" fixed="1500000">
> <xs:element name="TotalIncomeOfHP" fixed="-10000">
> <xs:element name="IncomeOthSrc" fixed="15000">
>
> How to do this? Can any one help me?
>
>
|
|
|
Re: How to generate XSD from XML, by restricting all the values ? [message #903308 is a reply to message #903224] |
Thu, 23 August 2012 06:15   |
Eclipse User |
|
|
|
Hi Ed Merks,
Since i can restrict values by enumeration too,
I tried using int2xsd by giving enumeration attribute ,
inst2xsd -enumerations 1
but it generates XSD with enumeration to elements which have more than 1 different(at min.)
I do not get enumeration for elements which take only one value.
say My XML is
<ITRForm:Section80GGA>2500</ITRForm:Section80GGA>
<ITRForm:Section80GGC>3500</ITRForm:Section80GGC>
<ITRForm:Section80U>1500</ITRForm:Section80U>
<ITRForm:DoneePAN>SomePan11111</ITRForm:DoneePAN>
<ITRForm:AddressDetail>
<ITRForm:AddrDetail>SomePlace1111</ITRForm:AddrDetail>
<ITRForm:DoneePAN>SomePan22222</ITRForm:DoneePAN>
<ITRForm:AddressDetail>
<ITRForm:AddrDetail>SomePlace2222</ITRForm:AddrDetail>
XSD is created as,
<xs:element name="Section80GGA" type="xs:integer"/>
<xs:element name="Section80GGC" type="xs:integer"/>
<xs:element name="Section80U" type="xs:integer"/>
<xs:element name="AddrDetail">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="SomePlace1111"/>
<xs:enumeration value="SomePlace2222"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
I need enumeration for Section80GGA,Section80GGC,Section80U too.
Other option is generating fixed="" attribute for elements.
|
|
|
Re: How to generate XSD from XML, by restricting all the values ? [message #903311 is a reply to message #903308] |
Thu, 23 August 2012 06:32   |
Eclipse User |
|
|
|
Sagar,
A -inst2xsd option isn't part of the XSD project. Is this something
provided by Web Tools ore something external to Eclipse? I imagine a
schema generator tool will try to create a general schema that allows
more than just the one specific instance...
On 23/08/2012 8:15 AM, sagar y wrote:
> Hi Ed Merks,
>
> Since i can restrict values by enumeration too,
> I tried using int2xsd by giving enumeration attribute ,
>
> inst2xsd -enumerations 1
>
> but it generates XSD with enumeration to elements which have more than
> 1 different(at min.)
> I do not get enumeration for elements which take only one value.
>
> say My XML is
>
> <ITRForm:Section80GGA>2500</ITRForm:Section80GGA>
> <ITRForm:Section80GGC>3500</ITRForm:Section80GGC>
> <ITRForm:Section80U>1500</ITRForm:Section80U>
>
>
> <ITRForm:DoneePAN>SomePan11111</ITRForm:DoneePAN>
> <ITRForm:AddressDetail>
> <ITRForm:AddrDetail>SomePlace1111</ITRForm:AddrDetail>
> <ITRForm:DoneePAN>SomePan22222</ITRForm:DoneePAN>
> <ITRForm:AddressDetail>
> <ITRForm:AddrDetail>SomePlace2222</ITRForm:AddrDetail>
> XSD is created as,
>
>
> <xs:element name="Section80GGA" type="xs:integer"/>
> <xs:element name="Section80GGC" type="xs:integer"/>
> <xs:element name="Section80U" type="xs:integer"/>
>
> <xs:element name="AddrDetail">
> <xs:simpleType>
> <xs:restriction base="xs:string">
> <xs:enumeration value="SomePlace1111"/>
> <xs:enumeration value="SomePlace2222"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:element>
>
> I need enumeration for Section80GGA,Section80GGC,Section80U too.
>
> Other option is generating fixed="" attribute for elements.
>
>
|
|
|
|
Re: How to generate XSD from XML, by restricting all the values ? [message #903322 is a reply to message #903313] |
Thu, 23 August 2012 07:33   |
Eclipse User |
|
|
|
I don't know anything about OxygenXML. Best to find an appropriate forum
to ask about that.
On 23/08/2012 8:54 AM, sagar y wrote:
> Ed Merks,
>
> Yeh.. inst2xsd is external to Eclipse. I tried with oxygenXml eclipse
> plugin. With that we can create sample XML from XSD.
> Is there a way to create XSDs from XML with oxygenXml plugin?
|
|
|
|
Powered by
FUDForum. Page generated in 0.40670 seconds