maxlength value missing [message #52836] |
Tue, 14 September 2004 14:21  |
Eclipse User |
|
|
|
Originally posted by: robinnt.us.ibm.com
I am trying to build an anonymous simple type with a maximum length
restiction. The maxLength facet is being added to the simpleType however the
value is not shown. Do I need to do anything else in the code for this to
work? I am using the xsd-SDK-M200407211027 build.
This is the XSD fragment I am trying to build:
<xsd:element name="CLASS_CODE" nillable="true">
<xsd:simpleType name="string">
<xsd:annotation />
<xsd:restriction base="xsd:anySimpleType">
<xsd:whiteSpace value="preserve" />
<xsd:maxLength />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
Here is the code:
XSDSimpleTypeDefinition simpleType =
xsdFactory.createXSDSimpleTypeDefinition();
simpleType.setBaseTypeDefinition(derivedSchema.getSchemaForS chema().
resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_U RI_2001,
xsdType));
dbColumnElement.setAnonymousTypeDefinition(simpleType);
XSDMaxLengthFacet maxLengthFacet =
xsdFactory.createXSDMaxLengthFacet();
maxLengthFacet.setValue(charLength); //set length value here
but is not shown in xsd file
simpleType.getFacetContents().add(maxLengthFacet);
Thank you, Robin
|
|
|
|
Re: maxlength value missing [message #52943 is a reply to message #52890] |
Tue, 14 September 2004 15:16  |
Eclipse User |
|
|
|
Originally posted by: robinnt.us.ibm.com
Thanks Ed that worked!!
Robin
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:ci7do7$i1v$1@eclipse.org...
> Robin,
>
> You need to call setLexicalValue rather than setValue; the value is
> computed from the lexical value. (When in doubt, try to find something
> equivalent in XSDPrototypicalSchema.)
>
>
> Robin Noble-Thomas wrote:
>
> >I am trying to build an anonymous simple type with a maximum length
> >restiction. The maxLength facet is being added to the simpleType however
the
> >value is not shown. Do I need to do anything else in the code for this to
> >work? I am using the xsd-SDK-M200407211027 build.
> >
> >This is the XSD fragment I am trying to build:
> >
> > <xsd:element name="CLASS_CODE" nillable="true">
> > <xsd:simpleType name="string">
> > <xsd:annotation />
> > <xsd:restriction base="xsd:anySimpleType">
> > <xsd:whiteSpace value="preserve" />
> > <xsd:maxLength />
> > </xsd:restriction>
> > </xsd:simpleType>
> ></xsd:element>
> >
> >
> >Here is the code:
> >
> > XSDSimpleTypeDefinition simpleType =
> >xsdFactory.createXSDSimpleTypeDefinition();
> >
> > simpleType.setBaseTypeDefinition(derivedSchema.getSchemaForS chema().
> >
> > resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_U RI_2001,
> >xsdType));
> >
> > dbColumnElement.setAnonymousTypeDefinition(simpleType);
> > XSDMaxLengthFacet maxLengthFacet =
> >xsdFactory.createXSDMaxLengthFacet();
> > maxLengthFacet.setValue(charLength); //set length value
here
> >but is not shown in xsd file
> > simpleType.getFacetContents().add(maxLengthFacet);
> >
> >Thank you, Robin
> >
> >
> >
> >
|
|
|
Re: maxlength value missing [message #591570 is a reply to message #52836] |
Tue, 14 September 2004 14:40  |
Eclipse User |
|
|
|
Robin,
You need to call setLexicalValue rather than setValue; the value is
computed from the lexical value. (When in doubt, try to find something
equivalent in XSDPrototypicalSchema.)
Robin Noble-Thomas wrote:
>I am trying to build an anonymous simple type with a maximum length
>restiction. The maxLength facet is being added to the simpleType however the
>value is not shown. Do I need to do anything else in the code for this to
>work? I am using the xsd-SDK-M200407211027 build.
>
>This is the XSD fragment I am trying to build:
>
> <xsd:element name="CLASS_CODE" nillable="true">
> <xsd:simpleType name="string">
> <xsd:annotation />
> <xsd:restriction base="xsd:anySimpleType">
> <xsd:whiteSpace value="preserve" />
> <xsd:maxLength />
> </xsd:restriction>
> </xsd:simpleType>
></xsd:element>
>
>
>Here is the code:
>
> XSDSimpleTypeDefinition simpleType =
>xsdFactory.createXSDSimpleTypeDefinition();
>
> simpleType.setBaseTypeDefinition(derivedSchema.getSchemaForS chema().
>
> resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_U RI_2001,
>xsdType));
>
> dbColumnElement.setAnonymousTypeDefinition(simpleType);
> XSDMaxLengthFacet maxLengthFacet =
>xsdFactory.createXSDMaxLengthFacet();
> maxLengthFacet.setValue(charLength); //set length value here
>but is not shown in xsd file
> simpleType.getFacetContents().add(maxLengthFacet);
>
>Thank you, Robin
>
>
>
>
|
|
|
Re: maxlength value missing [message #591590 is a reply to message #52890] |
Tue, 14 September 2004 15:16  |
Eclipse User |
|
|
|
Originally posted by: robinnt.us.ibm.com
Thanks Ed that worked!!
Robin
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:ci7do7$i1v$1@eclipse.org...
> Robin,
>
> You need to call setLexicalValue rather than setValue; the value is
> computed from the lexical value. (When in doubt, try to find something
> equivalent in XSDPrototypicalSchema.)
>
>
> Robin Noble-Thomas wrote:
>
> >I am trying to build an anonymous simple type with a maximum length
> >restiction. The maxLength facet is being added to the simpleType however
the
> >value is not shown. Do I need to do anything else in the code for this to
> >work? I am using the xsd-SDK-M200407211027 build.
> >
> >This is the XSD fragment I am trying to build:
> >
> > <xsd:element name="CLASS_CODE" nillable="true">
> > <xsd:simpleType name="string">
> > <xsd:annotation />
> > <xsd:restriction base="xsd:anySimpleType">
> > <xsd:whiteSpace value="preserve" />
> > <xsd:maxLength />
> > </xsd:restriction>
> > </xsd:simpleType>
> ></xsd:element>
> >
> >
> >Here is the code:
> >
> > XSDSimpleTypeDefinition simpleType =
> >xsdFactory.createXSDSimpleTypeDefinition();
> >
> > simpleType.setBaseTypeDefinition(derivedSchema.getSchemaForS chema().
> >
> > resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_U RI_2001,
> >xsdType));
> >
> > dbColumnElement.setAnonymousTypeDefinition(simpleType);
> > XSDMaxLengthFacet maxLengthFacet =
> >xsdFactory.createXSDMaxLengthFacet();
> > maxLengthFacet.setValue(charLength); //set length value
here
> >but is not shown in xsd file
> > simpleType.getFacetContents().add(maxLengthFacet);
> >
> >Thank you, Robin
> >
> >
> >
> >
|
|
|
Powered by
FUDForum. Page generated in 0.03208 seconds