Package org.apache.ws.jaxme.xs.xml

Examples of org.apache.ws.jaxme.xs.xml.XsAnyURI


  /** <p>Handles xs:include.</p>
   */
  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


      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

 
  private void importSchema(XsESchema pImportingSchema, String pNamespace,
      XsESchema pImportedSchema, Locator pLocator,
      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

          includeSchema(pSyntaxSchema, (XsEInclude) o);
        } else if (o instanceof XsERedefine) {
          redefineSchema(pSyntaxSchema, (XsERedefine) o);
        } else if (o instanceof XsEImport) {
          XsEImport xsEImport = (XsEImport) o;
          XsAnyURI namespace = xsEImport.getNamespace();
          XsAnyURI schemaLocation = xsEImport.getSchemaLocation();
          importSchema(pSyntaxSchema, namespace == null ? null : namespace.toString(),
              schemaLocation == null ? null : schemaLocation.toString(),
                  xsEImport.getLocator());
        } else {
          add(pSyntaxSchema, childs[i]);
        }
      }
View Full Code Here

      if (myName == null) {
        throw new LocSAXException("Invalid attribute: Neither of its 'name' or 'ref' attributes are set.",
                                     pBaseAttribute.getLocator());
      }
      XsESchema schema = pBaseAttribute.getXsESchema();
      XsAnyURI namespace;
      String namespacePrefix;
      boolean qualified = isGlobal = pBaseAttribute.isGlobal();
      if (!qualified) {
        XsFormChoice form = pBaseAttribute.getForm();
        if (form == null) {
View Full Code Here

        throw new LocSAXException("Invalid element: Must have either of its 'ref' or 'name' attributes set.",
                                     getLocator());
      }
      XsESchema schema = pBaseElement.getXsESchema();

      XsAnyURI namespace;
      String namespacePrefix;
      boolean qualified = pBaseElement.isGlobal();
      if (!qualified) {
        XsFormChoice form = pBaseElement.getForm();
        if (form == null) {
View Full Code Here

  /** <p>Handles xs:include.</p>
   */
  protected void includeSchema(XsESchema pIncludingSchema,
                                 XsEInclude pInclude)
      throws SAXException, IOException, ParserConfigurationException {
    XsAnyURI schemaLocation = pInclude.getSchemaLocation();
    if (schemaLocation == null) {
      throw new LocSAXException("Invalid include: Missing 'schemaLocation' attribute.",
                                   pInclude.getLocator());
    }
    Locator locator = pInclude.getLocator();
    InputSource schemaSource = getInputSource(locator == null ? null : locator.getSystemId(),
                                              schemaLocation.toString());
    XsESchema includedSchema = parseSyntax(schemaSource);
    XsAnyURI incNamespace = includedSchema.getTargetNamespace();
    if (incNamespace == null) {
      includedSchema.setTargetNamespace(includedSchema.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

      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

  }

  private void importSchema(XsESchema pImportingSchema, String pNamespace,
                             XsESchema pImportedSchema, Locator pLocator)
      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

          includeSchema(pSyntaxSchema, (XsEInclude) o);
        } else if (o instanceof XsERedefine) {
          redefineSchema(pSyntaxSchema, (XsERedefine) o);
        } else if (o instanceof XsEImport) {
          XsEImport xsEImport = (XsEImport) o;
          XsAnyURI namespace = xsEImport.getNamespace();
          XsAnyURI schemaLocation = xsEImport.getSchemaLocation();
          importSchema(pSyntaxSchema, namespace == null ? null : namespace.toString(),
                       schemaLocation == null ? null : schemaLocation.toString(),
                       xsEImport.getLocator());
        } else {
          add(pSyntaxSchema, childs[i]);
        }
      }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.xml.XsAnyURI

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.