Facets - dynamically updating [message #599054] |
Mon, 30 October 2006 11:07 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03289 seconds