ePackage.setNsPrefix(index == -1 ? nsPrefix : nsPrefix.substring(index + 1));
nsPrefix = index == -1 ? nsPrefix : nsPrefix.substring(index + 1);       if (nsPrefix.toLowerCase().startsWith("xml")) { nsPrefix = "_" + nsPrefix; } ePackage.setNsPrefix(nsPrefix);
  public EPackage getEPackage(XSDNamedComponent xsdNamedComponent)  {    XSDSchema containingXSDSchema = xsdNamedComponent.getSchema();    if (containingXSDSchema != null && !xsdSchemas.contains(containingXSDSchema))    {      xsdSchemas.add(containingXSDSchema);      addInput(containingXSDSchema);      validate(containingXSDSchema);    }    String targetNamespace =       containingXSDSchema == null ?         xsdNamedComponent.getTargetNamespace() :         containingXSDSchema.getTargetNamespace();    EPackage ePackage = (EPackage)targetNamespaceToEPackageMap.get(targetNamespace);    if (ePackage == null)    {      ePackage = EcoreFactory.eINSTANCE.createEPackage();      setAnnotations(ePackage, containingXSDSchema);      addOutput(ePackage);      if (targetNamespace == null)      {        if (containingXSDSchema == null)        {          containingXSDSchema = rootSchema;        }        ePackage.setName(validName(containingXSDSchema.eResource().getURI().trimFileExtension().lastSegment(), true));        ePackage.setNsURI(containingXSDSchema.eResource().getURI().toString());        // Also register against the nsURI for the case that the target namespace is null.        //        // extendedMetaData.putPackage(ePackage.getNsURI(), ePackage);      }      else      {        String qualifiedPackageName = qualifiedPackageName(targetNamespace);        ePackage.setName(qualifiedPackageName);        ePackage.setNsURI(targetNamespace);      }      String nsPrefix = ePackage.getName();      int index = nsPrefix.lastIndexOf('.');      ePackage.setNsPrefix(index == -1 ? nsPrefix : nsPrefix.substring(index + 1));      extendedMetaData.setQualified(ePackage, targetNamespace != null);      extendedMetaData.putPackage(targetNamespace, ePackage);      targetNamespaceToEPackageMap.put(targetNamespace, ePackage);    }    return ePackage;  }