Tabnine Logo
XmlSchemaCollection
Code IndexAdd Tabnine to your IDE (free)

How to use
XmlSchemaCollection
in
org.apache.ws.commons.schema

Best Java code snippets using org.apache.ws.commons.schema.XmlSchemaCollection (Showing top 20 results out of 477)

Refine searchRefine arrow

  • XmlSchema
  • QName
origin: org.apache.axis2/axis2-kernel

protected XmlSchema getXMLSchema(Element element, String baseUri) {
  XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
  if (baseUri != null) {
    schemaCollection.setBaseUri(baseUri);
  }
  if (customResolver != null) {
    schemaCollection.setSchemaResolver(customResolver);
  }
  return schemaCollection.read(element);
}
origin: raml-org/raml-java-parser

@Override
public XmlSchemaType visitDate(DateOnlyResolvedType dateOnlyTypeDefinition)
{
  return collection.getTypeByQName(Constants.XSD_DATE);
}
origin: org.apache.cxf/cxf-api

/**
 * This function is not part of the XmlSchema API. Who knows why?
 *
 * @param namespaceURI targetNamespace
 * @return schema, or null.
 */
public XmlSchema getSchemaByTargetNamespace(String namespaceURI) {
  for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
    if (namespaceURI.equals(schema.getTargetNamespace())) {
      return schema;
    }
  }
  return null;
}
origin: org.wso2.carbon.business-process/org.wso2.carbon.bpel

  protected XmlSchema getXMLSchema(Element element, String baseUri) {
    XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
    if (baseUri != null) {
      schemaCollection.setBaseUri(baseUri);
    }
    return schemaCollection.read(element, baseUri);
  }
}
origin: apache/cxf

public XmlSchema getSchemaForElement(QName name) {
  for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
    if (name.getNamespaceURI().equals(schema.getTargetNamespace())) {
      if (schema.getElementByName(name.getLocalPart()) != null) {
        return schema;
      } else if (schema.getElementByName(name) != null) {
        return schema;
      }
    }
  }
  return null;
}
origin: org.apache.openejb/openejb-axis

String elementNamespace = element.getQName().getNamespaceURI();
if (elementNamespace == null || elementNamespace.equals("")) {
  elementNamespace = enclosingType.qname.getNamespaceURI();
elementQName = new QName(elementNamespace, element.getQName().getLocalPart());
final XmlSchemaElement refElement = xmlSchemaCollection.getElementByQName(element.getRefName());
origin: apache/cxf

protected static boolean findNonSchemaType(String name,
                      WSDLASTVisitor wsdlVisitor,
                      VisitorTypeHolder holder) {
  boolean result = false;
  TypeMappingType typeMap = wsdlVisitor.getTypeMap();
  XmlSchemaCollection schemas = wsdlVisitor.getSchemas();
  QName qname = new QName(typeMap.getTargetNamespace(), name);
  CorbaType corbaType = findCorbaType(typeMap, qname);
  if (corbaType != null) {
    if (corbaType instanceof Alias) {
      result = true;
      if (holder != null) {
        populateAliasSchemaType(corbaType, wsdlVisitor, holder);
      }
    } else if (((corbaType instanceof Sequence) || (corbaType instanceof Anonsequence))
          && ((corbaType.getType().equals(Constants.XSD_BASE64)))) {
      //special case of sequence of octets
      result = true;
      if (holder != null) {
        holder.setCorbaType(corbaType);
        holder.setSchemaType(schemas.getTypeByQName(corbaType.getType()));
      }
    }
  }
  return result;
}
origin: apache/cxf

/**
 * Validate that a qualified name points to some namespace in the schema.
 *
 * @param qname
 */
public void validateQNameNamespace(QName qname) {
  // astonishingly, xmlSchemaCollection has no accessor by target URL.
  if ("".equals(qname.getNamespaceURI())) {
    return; // references to the 'unqualified' namespace are OK even if there is no schema for it.
  }
  for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
    if (schema.getTargetNamespace().equals(qname.getNamespaceURI())) {
      return;
    }
  }
  throw new InvalidXmlSchemaReferenceException(qname + " refers to unknown namespace.");
}
origin: apache/cxf

public void visit(AST fixedNode) {
  //      <fixed_pt_const_type> ::= "fixed"
  XmlSchemaType stype = null;
  CorbaType ctype = null;
  QName corbaTypeQName = CorbaConstants.NE_CORBA_FIXED;
  if (corbaTypeQName != null) {
    QName schemaTypeQName = Constants.XSD_DECIMAL;
    if (schemaTypeQName != null) {
      stype = schemas.getTypeByQName(schemaTypeQName);
      if (stype != null) {
        ctype = new CorbaType();
        ctype.setQName(corbaTypeQName);
        ctype.setType(stype.getQName());
        ctype.setName(stype.getQName().getLocalPart());
      }
    }
  }
  schemaType = stype;
  corbaType = ctype;
}
origin: apache/cxf

  tname = type.getType();
XmlSchemaType stype = schemas.getTypeByQName(tname);
if (stype == null) {
  XmlSchema xmlSchema = wsdlVisitor.getManager().getXmlSchema(tname.getNamespaceURI());
  if (xmlSchema != null) {
    stype = xmlSchema.getTypeByName(tname);
  } else {
    stype = wsdlVisitor.getSchema().getTypeByName(tname);
origin: apache/axis2-java

public String readXMLfromSchemaFile(String path) throws Exception {
  InputStream is = new FileInputStream(path);
  XmlSchemaCollection schemaCol = new XmlSchemaCollection();
  XmlSchema schema = schemaCol.read(new StreamSource(is));
  ByteArrayOutputStream stream = new ByteArrayOutputStream();
  schema.write(stream);
  is.close();
  return stream.toString();
}

origin: org.apache.ws.commons.schema/XmlSchema

/**
 * Read an XML Schema from a complete XSD XML DOM Document into this collection.
 * Schemas in a collection must be unique in
 * the concatenation of SystemId and targetNamespace.
 * @param doc The schema document.
 * @param systemId System ID for this schema.
 * @param veh handler to be called to check validity of the schema.
 * @return the schema object.
 */
public XmlSchema read(Document doc, String systemId, ValidationEventHandler veh) {
  return read(doc, systemId, veh, null);
}
origin: org.apache.axis2/axis2-kernel

private void loadCustomSchemaFile() {
  if (customSchemaLocation != null) {
    try {
      DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
      documentBuilderFactory.setNamespaceAware(true);
      Document doc = documentBuilderFactory.newDocumentBuilder().parse(new File(customSchemaLocation));
      XmlSchema schema = xmlSchemaCollection.read(doc, null);
      schemaMap.put(schema.getTargetNamespace(), schema);
    } catch (Exception e) {
      log.info(e.getMessage());
    }
  }
}
origin: apache/axis2-java

public XmlSchema loadSingleSchemaFile(int i) throws Exception{
  File file = new File(SampleSchemasDirectory + "sampleSchema" + i
      + ".xsd");
  InputStream is = new FileInputStream(file);
  XmlSchemaCollection schemaCol = new XmlSchemaCollection();
  XmlSchema schema = schemaCol.read(new StreamSource(is));
  return schema;
}
 
origin: spring-projects/spring-ws

@Override
public void afterPropertiesSet() throws IOException {
  Assert.notEmpty(xsdResources, "'xsds' must not be empty");
  schemaCollection.setSchemaResolver(uriResolver);
  Set<XmlSchema> processedIncludes = new HashSet<XmlSchema>();
  Set<XmlSchema> processedImports = new HashSet<XmlSchema>();
  for (Resource xsdResource : xsdResources) {
    Assert.isTrue(xsdResource.exists(), xsdResource + " does not exist");
    try {
      XmlSchema xmlSchema =
          schemaCollection.read(SaxUtils.createInputSource(xsdResource));
      xmlSchemas.add(xmlSchema);
      if (inline) {
        inlineIncludes(xmlSchema, processedIncludes, processedImports);
        findImports(xmlSchema, processedImports, processedIncludes);
      }
    }
    catch (Exception ex) {
      throw new CommonsXsdSchemaException("Schema [" + xsdResource + "] could not be loaded", ex);
    }
  }
  if (logger.isInfoEnabled()) {
    logger.info("Loaded " + StringUtils.arrayToCommaDelimitedString(xsdResources));
  }
}
origin: raml-org/raml-java-parser

private void initialize(ResolvedType resolvedType)
{
  collection = new XmlSchemaCollection();
  final boolean empty = currentElement.isEmpty();
  // We use namespace of this element
  if (empty)
  {
    final String target = getTargetNamespace(resolvedType);
    schema = new XmlSchema(target, "raml-xsd", collection);
    schema.setTargetNamespace(target);
  }
  schema.setElementFormDefault(XmlSchemaForm.QUALIFIED);
}
origin: apache/cxf

public SchemaCollection() {
  this(new XmlSchemaCollection());
}
origin: org.codehaus.xfire/xfire-core

schemas.setBaseUri(definition.getDocumentBaseURI());
XmlSchema schema = schemas.read(el, schemaSystemId);
origin: org.apache.openejb/openejb-axis

private void buildXmlTypeInfos() {
  for (final XmlSchema schema : xmlSchemaCollection.getXmlSchemas()) {
    // Global Elements
    for (final Iterator iterator = schema.getElements().getValues(); iterator.hasNext(); ) {
      final XmlSchemaElement globalElement = (XmlSchemaElement) iterator.next();
      addGlobalElement(globalElement);
    }
    // Global Types
    for (final Iterator iterator = schema.getSchemaTypes().getValues(); iterator.hasNext(); ) {
      final XmlSchemaType globalType = (XmlSchemaType) iterator.next();
      addType(globalType.getQName(), globalType);
    }
  }
}
origin: org.apache.cxf/cxf-core

public void setSchemaResolver(URIResolver schemaResolver) {
  schemaCollection.setSchemaResolver(schemaResolver);
}
org.apache.ws.commons.schemaXmlSchemaCollection

Javadoc

Contains a cache of XML Schema definition language (XSD).

Most used methods

  • read
  • <init>
    Creates new XmlSchemaCollection
  • setSchemaResolver
    Register a custom URI resolver
  • setBaseUri
    Set the base URI. This is used when schemas need to be loaded from relative locations
  • getTypeByQName
    Retrieve a global type from the schema collection.
  • getXmlSchemas
    Returns an array of all the XmlSchemas in this collection.
  • getElementByQName
    Retrieve a global element from the schema collection.
  • getExtReg
  • getNamespaceContext
    Retrieve the namespace context.
  • getXmlSchema
    Retrieve a set containing the XmlSchema instances with the given system ID. In general, this will re
  • init
    This section should comply to the XMLSchema specification; see http://www.w3.org/TR/2004/PER-xmlsch
  • setNamespaceContext
    Set the namespace context for this collection, which controls the assignment of namespace prefixes t
  • init,
  • setNamespaceContext,
  • getAttributeByQName,
  • getSchemaResolver,
  • setExtReg,
  • addSchema,
  • addSimpleType,
  • addUnresolvedType,
  • check,
  • containsSchema

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • startActivity (Activity)
  • compareTo (BigDecimal)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • JTextField (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now