Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Facets - dynamically updating
Facets - dynamically updating [message #599054] Mon, 30 October 2006 11:07
Eclipse UserFriend
Originally posted by: ashish.deshpande.cc

Hi,
I am having a problem adding/using a facet. Here's the code:

------------------------------------------------------------ -------
XSDSchema schema = XSDFactory.eINSTANCE.createXSDSchema();
schema.setSchemaForSchemaQNamePrefix("xsd");
schema.getQNamePrefixToNamespaceMap().put(schema.getSchemaFo rSchemaQNamePrefix(),
XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);

XSDSimpleTypeDefinition s3 =
XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();

s3.setBaseTypeDefinition(schema.getSchemaForSchema().resolve SimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001 ,
"string"));

XSDPatternFacet facet = XSDFactory.eINSTANCE.createXSDPatternFacet();
facet.setLexicalValue("\\d{2}.\\d{1}");
s3.getFacetContents().add(facet);

System.out.println (s3.getFacets() + " " + s3.isValidLiteral("abcd"));

schema.getContents().add(s3);
schema.update(true);
System.out.println (s3.getFacets() + " " + s3.isValidLiteral("abcd"));
------------------------------------------------------------ -------

No matter what I try, I cannot get the added pattern facet to print or
the literal validation to fail. What am I missing?

Thx,
-Ashish
Previous Topic:Copy a new local element into another schema
Next Topic:Facets - dynamically updating
Goto Forum:
  


Current Time: Tue Apr 16 09:39:21 GMT 2024

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

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

Back to the top