Java Code Examples for org.apache.xerces.xs.XSConstants#MODEL_GROUP

The following examples show how to use org.apache.xerces.xs.XSConstants#MODEL_GROUP . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CMXSDElementDeclaration.java    From lemminx with Eclipse Public License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void collectElementsDeclaration(XSTerm term, Collection<CMElementDeclaration> elements) {
	if (term == null) {
		return;
	}
	switch (term.getType()) {
	case XSConstants.WILDCARD:
		// XSWildcard wildcard = (XSWildcard) term;
		// ex : xsd:any
		document.getElements().forEach(e -> {
			if (!elements.contains(e)) {
				elements.add(e);
			}
		});
		break;
	case XSConstants.MODEL_GROUP:
		XSObjectList particles = ((XSModelGroup) term).getParticles();
		particles.forEach(p -> collectElementsDeclaration(((XSParticle) p).getTerm(), elements));
		break;
	case XSConstants.ELEMENT_DECLARATION:
		XSElementDeclaration elementDeclaration = (XSElementDeclaration) term;
		document.collectElement(elementDeclaration, elements);
		break;
	}
}
 
Example 2
Source File: SentinelXsdDumpMetadata.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
private static void dumpParticle(String path, XSParticle particle)
{
   XSTerm term = particle.getTerm();

   switch (term.getType())
   {
      case XSConstants.ELEMENT_DECLARATION:
         dumpElement(path, (XSElementDeclaration) term);
         break;
      case XSConstants.MODEL_GROUP:
         XSModelGroup model_group = (XSModelGroup) term;
         final XSObjectList particles = model_group.getParticles();

         for (int ipar = 0; ipar < particles.getLength(); ipar++)
         {
            dumpParticle(path, (XSParticle) particles.item(ipar));
         }
         break;
      default:
         System.err.println(path + " - UNKNOWN");
   }

}