Skip to main content



      Home
Home » Archived » XML Schema Definition (XSD) » maxlength value missing
maxlength value missing [message #52836] Tue, 14 September 2004 14:21 Go to next message
Eclipse UserFriend
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 #52890 is a reply to message #52836] Tue, 14 September 2004 14:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

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 #52943 is a reply to message #52890] Tue, 14 September 2004 15:16 Go to previous message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
> >
> >
> >
> >
Previous Topic:XSDXPathDefinition
Next Topic:Derivation by restriction
Goto Forum:
  


Current Time: Sun May 04 03:59:45 EDT 2025

Powered by FUDForum. Page generated in 0.06731 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top