Package org.apache.ws.jaxme.xs.parser.impl

Examples of org.apache.ws.jaxme.xs.parser.impl.LocSAXException


              + calendar.get(Calendar.MONTH) + ","
              + calendar.get(Calendar.DAY_OF_MONTH) + ")" },
          getDatatypeType());
    } catch (RuntimeException e) {
      try {
        throw new LocSAXException("Failed to convert string value to "
            + getDatatypeName() + " instance: " + pValue, getLocator());
      } catch (Exception e1) {
        throw new SAXException("Failed to convert string value to "
            + getDatatypeName() + " instance: " + pValue);
      }
View Full Code Here


    Long length = atomicType.getLength();
    Long maxLength = atomicType.getMaxLength();
    Long minLength = atomicType.getMinLength();

    if (minLength != null  &&  minLength.longValue() < 0) {
      throw new LocSAXException("Negative value for minLength detected: " + minLength, getLocator());
    }
    if (maxLength != null) {
      if (maxLength.longValue() < 0) {
        throw new LocSAXException("Negative value for maxLength detected: " + maxLength, getLocator());
      }
      if (minLength != null) {
        if (maxLength.longValue() < minLength.longValue()) {
          throw new LocSAXException("MaxLength value of " + maxLength + " is smaller than minLength value of " + minLength,
              getLocator());
        }
        if (maxLength.longValue() == minLength.longValue()) {
          length = maxLength;
        }
      }
    }
    if (length != null) {
      if (length.longValue() < 0) {
        throw new LocSAXException("Negative value for length detected: " + length, getLocator());
      }
      if (maxLength != null) {
        if (maxLength.longValue() < length.longValue()) {
          throw new LocSAXException("MaxLength value of " + maxLength + " is smaller than length value of " + length,
              getLocator());
        }
        maxLength = null// Avoid unnecessary checks
      }
      if (minLength != null) {
        if (minLength.longValue() > length.longValue()) {
          throw new LocSAXException("MinLength value of " + minLength + " is larger than length value of " + length,
              getLocator());
        }
        minLength = null// Avoid unnecessary checks
      }
    }
View Full Code Here

    } else if (pChild instanceof XsTComplexType) {
      XsTComplexType type = (XsTComplexType) pChild;
      mySchema.redefine(factory.newXSType(mySchema, type));
    } else {
      Locator locator = (pChild instanceof XsObject) ? ((XsObject) pChild).getLocator() : pRedefine.getLocator();
      throw new LocSAXException("Unknown type for redefinition: " + pChild.getClass().getName() +
          ", perhaps you should handle this in a subclass?", locator);
    }
  }
View Full Code Here

      XsENotation notation = (XsENotation) pChild;
      mySchema.add(factory.newXSNotation(mySchema, notation));
    } else {
      Locator locator = (pChild instanceof XsObject) ?
          ((XsObject) pChild).getLocator() : pSyntaxSchema.getLocator();
          throw new LocSAXException("Unknown child type: " + pChild.getClass().getName() +
              ", perhaps you should handle this in a subclass?", locator);
    }
  }
View Full Code Here

   */
  protected void redefineSchema(XsESchema pRedefiningSchema,
      XsERedefine pRedefine)
  throws SAXException, IOException, ParserConfigurationException {
    // TODO: Implement redefine
    throw new LocSAXException("Redefine isn't yet implemented.", pRedefine.getLocator());
  }
View Full Code Here

  protected void includeSchema(XsESchema pIncludingSchema,
      XsEInclude pInclude)
  throws SAXException, IOException, ParserConfigurationException {
    final XsAnyURI schemaLocation = pInclude.getSchemaLocation();
    if (schemaLocation == null) {
      throw new LocSAXException("Invalid include: Missing 'schemaLocation' attribute.",
          pInclude.getLocator());
    }
    Locator locator = pInclude.getLocator();
    XsESchema includedSchema = parseSyntax(locator, schemaLocation.toString());
    XsAnyURI incNamespace = includedSchema.getTargetNamespace();
    if (incNamespace == null) {
      if (pIncludingSchema.getTargetNamespace() != null) {
        includedSchema.setTargetNamespace(pIncludingSchema.getTargetNamespace());
      }
    } else {
      XsAnyURI myNamespace = includedSchema.getTargetNamespace();
      if (!incNamespace.equals(myNamespace)) {
        throw new LocSAXException("Invalid include: The included schemas target namespace " +
            incNamespace + " and the including schemas target namespace " +
            myNamespace + " do not match.",
            pInclude.getLocator());
      }
    }
View Full Code Here

  private void checkValidImportSchema(XsESchema pImportingSchema, String pNamespace,
      Locator pLocator)
  throws SAXException {
    if (pNamespace == null) {
      if (pImportingSchema.getTargetNamespace() == null) {
        throw new LocSAXException("The importing schema has no 'targetNamespace' attribute and" +
            " the 'import' element has no 'namespace' attribute, which is" +
            " forbidden. Perhaps you want to use include?",
            pLocator);
      }
    } else {
      if ("".equals(pNamespace)) {
        throw new LocSAXException("Invalid import: Empty 'namespace' attribute, which is forbidden." +
            " Perhaps you want to omit the attribute to indicate the absence of a namespace?",
            pLocator);
      }
      XsAnyURI targetNamespace = pImportingSchema.getTargetNamespace();
      if (targetNamespace != null  &&
          pNamespace.equals(targetNamespace.toString())) {
        throw new LocSAXException("The importing schema and the imported schema have the same namespace, which is forbidden. Perhaps you want to use include?",
            pLocator);
      }
    }
  }
View Full Code Here

      String pSchemaLocation)
  throws SAXException, ParserConfigurationException, IOException {
    XsAnyURI impNamespace = pImportedSchema.getTargetNamespace();
    if (pNamespace == null) {
      if (impNamespace != null) {
        throw new LocSAXException("The 'import' element does not have a 'namespace' attribute, but the imported schema has target namespace " +
            impNamespace + ", it ought to match and have none.",
            pLocator);
      }
    } else {
      if (impNamespace == null) {
        throw new LocSAXException("The 'import' element has a 'namespace' attribute (" + pNamespace +
            "), but the imported schema has no 'targetNamespace' attribute.",
            pLocator);
      } else if (!pNamespace.equals(impNamespace.toString())) {
        throw new LocSAXException("The 'import' elements 'namespace' attribute (" + pNamespace +
            ") and the imported schemas 'targetNamespace' attribute (" +
            impNamespace + ") do not match.",
            pLocator);
      }
    }
View Full Code Here

        if (qName != null) {
          SubstitutionGroup group = (SubstitutionGroup) substitutionGroups.get(qName);
          if (group == null) {
            XSElement head = pSchema.getElement(qName);
            if (head == null) {
              throw new LocSAXException("The substituted element " + qName + " is missing in the schema.",
                  element.getLocator());
            }
            if (head.isBlockedForSubstitution()) {
              throw new LocSAXException("The substituted element " + qName + " is blocked for substitution.",
                  element.getLocator());
            }
            group = new SubstitutionGroup(head);
            if (!head.isAbstract()) {
              group.addMember(head);
View Full Code Here

      group.validate();
      XSParticleImpl particle = new XSParticleImpl(group);
      particle.setMaxOccurs(pChoice.getMaxOccurs());
      particle.setMinOccurs(pChoice.getMinOccurs());     
      if (group.getParticles().length == 0) {
        throw new LocSAXException("The complex type must not have an empty element group, as it is a choice.",
                                     choice.getLocator());
      } else {
        setParticle(pType.isMixed() ? XsComplexContentType.MIXED : XsComplexContentType.ELEMENT_ONLY, particle);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.parser.impl.LocSAXException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.