Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Facets - dynamically updating
Facets - dynamically updating [message #599054] Mon, 30 October 2006 06: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
Previous Topic:Copy a new local element into another schema
Next Topic:Facets - dynamically updating
Goto Forum:
  


Current Time: Thu Jul 24 07:00:04 EDT 2014

Powered by FUDForum. Page generated in 1.19926 seconds