java - Xerces2-j XML Schema Attribute / Element Declaration data type -


i'm using apache's xerces2-j parse xsd. trying datatype information element / attribute declarations in xsd.

here's example xsd:

<xs:element name="pretzel">     ...     <xs:attribute name="flavor" type="xs:string"/>     <xs:attribute name="productid" type="xs:nonnegativeinteger"/>     ... </xs:element> 

in case, i'd want datatypes of flavor , productid attributes. according w3c schema api , its xerces2-j implementation, xsattributedeclaration's getactualvctype() me want. me method returns 45, unavailable_dt. bug in xerces2-j, or understanding api wrong? if am, i'd appreciate if point me right direction here.

you looking use method

xsattributedeclaration.gettypedefinition(); // returns xssimpletypedefinition 

for simple types and/or possibly

xsattributedeclaration.getenclosingctdefinition(); // returns xscomplextypedefinition 

for complex types.

the method getactualvctype() deprecated, , alternative call getvalueconstraintvalue().getactualvaluetype() looks so-called value constraint not looking for. argument supported code in xsattributedecl.java:

       // variable definition 48     // value constraint type: default, fixed or !specified 49     short fconstrainttype = xsconstants.vc_none; 

and

183    public short getactualvctype() { 184        return getconstrainttype() == xsconstants.vc_none ? 185               xsconstants.unavailable_dt : 186               fdefault.actualvaluetype; 187    } 

with

136 137    public short getconstrainttype() { 138        return fconstrainttype; 139    } 

suggests indeed getting unavailable_dt because not set. suggest looking xssimpletypedefinition's methods, looks promising me.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -