本文整理了Java中javax.wsdl.extensions.schema.Schema.getElement()
方法的一些代码示例,展示了Schema.getElement()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Schema.getElement()
方法的具体详情如下:
包路径:javax.wsdl.extensions.schema.Schema
类名称:Schema
方法名:getElement
[英]Get the DOM Element that represents this schema element.
[中]获取表示此架构元素的DOM元素。
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Build a list of schema target name spaces which are element form qualified.
*
* @return All target name spaces for schemas defined in the WSDL which are element form qualified.
*/
private List<String> getElementFormQualifiedNamespaces() {
List<String> namespaces = new ArrayList<String>();
List<ExtensibilityElement> schemas = getSchemas();
for ( ExtensibilityElement schema : schemas ) {
Element schemaElement = ( (Schema) schema ).getElement();
if ( schemaElement.hasAttribute( WsdlUtils.ELEMENT_FORM_DEFAULT_ATTR ) ) {
String v = schemaElement.getAttribute( WsdlUtils.ELEMENT_FORM_DEFAULT_ATTR );
if ( WsdlUtils.ELEMENT_FORM_QUALIFIED.equalsIgnoreCase( v ) ) {
namespaces.add( schemaElement.getAttribute( WsdlUtils.TARGET_NAMESPACE_ATTR ) );
}
}
}
return namespaces;
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Get the schema with the specified target namespace.
*
* @param targetNamespace
* target namespace of the schema to get.
* @return null if not found.
*/
private Schema getSchema( String targetNamespace ) {
if ( _types == null ) {
return null;
}
List<ExtensibilityElement> schemas = WsdlUtils.findExtensibilityElements( _types, "schema" );
for ( ExtensibilityElement e : schemas ) {
Element schemaRoot = ( (Schema) e ).getElement();
String tns = schemaRoot.getAttribute( "targetNamespace" );
if ( targetNamespace.equals( tns ) ) {
return (Schema) e;
}
}
return null;
}
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Create a new instance, parse the WSDL file for named complex types.
*
* @param wsdlTypes
* Name space resolver.
*/
protected WsdlComplexTypes( WsdlTypes wsdlTypes ) {
List<ExtensibilityElement> schemas = wsdlTypes.getSchemas();
for ( ExtensibilityElement schema : schemas ) {
Element schemaRoot = ( (Schema) schema ).getElement();
List<Element> types = DomUtils.getChildElementsByName( schemaRoot, WsdlUtils.COMPLEX_TYPE_NAME );
for ( Element t : types ) {
String schemaTypeName = t.getAttribute( WsdlUtils.NAME_ATTR );
_complexTypes.put( schemaTypeName, new ComplexType( t, wsdlTypes ) );
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Find a named <complexType> or <simpleType> in the types section of the WSDL.
*
* @param typeName
* Name of the type to find.
* @return null if type not found.
*/
protected Element findNamedType( QName typeName ) {
Schema s = getSchema( typeName.getNamespaceURI() );
if ( s == null ) {
return null;
}
Element schemaRoot = s.getElement();
// get all simple and complex types defined at the top-level.
//
List<Element> types = DomUtils.getChildElementsByName( schemaRoot, WsdlUtils.COMPLEX_TYPE_NAME );
types.addAll( DomUtils.getChildElementsByName( schemaRoot, WsdlUtils.SIMPLE_TYPE_NAME ) );
Element namedType = null;
for ( Element t : types ) {
String schemaTypeName = t.getAttribute( WsdlUtils.NAME_ATTR );
if ( typeName.getLocalPart().equals( schemaTypeName ) ) {
namedType = t;
break;
}
}
return namedType;
}
代码示例来源:origin: pentaho/pentaho-kettle
Element schemaRoot = s.getElement();
List<Element> elements = DomUtils.getChildElementsByName( schemaRoot, WsdlUtils.ELEMENT_NAME );
代码示例来源:origin: wsdl4j/wsdl4j
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
Schema schema = (Schema)extension;
pw.print(" ");
DOM2Writer.serializeAsXML(schema.getElement(), def.getNamespaces(), pw);
pw.println();
}
}
代码示例来源:origin: com.consol.citrus/citrus-core
/**
* Reads target namespace from schema definition element.
* @param schema
* @return
*/
private String getTargetNamespace(Schema schema) {
return schema.getElement().getAttribute("targetNamespace");
}
代码示例来源:origin: org.wso2.wsdl.validator/wsdl-validator
public void visit(
ExtensibilityElement el,
Object parent,
WSDLTraversalContext ctx)
{
if (el instanceof Schema)
searchForImport(((Schema) el).getElement());
}
代码示例来源:origin: org.wso2.wsdl.validator/wsdl-validator
/**
* (non-Javadoc)
* @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(Message, Object, WSDLTraversalContext)
*/
public void visit(ExtensibilityElement obj, Object parent, WSDLTraversalContext ctx)
{
if((obj != null) && (obj instanceof Schema))
{
Schema el = (Schema) obj;
try {
processor.processAllSchema(el.getElement());
} catch (WSIException e) {}
}
}
代码示例来源:origin: org.mule.modules/mule-module-ws
/**
* Converts a schema into a String.
* @throws TransformerException If unable to transform the schema.
*/
public static String schemaToString(Schema schema) throws TransformerException
{
StringWriter writer = new StringWriter();
Transformer transformer = XMLSecureFactories.createDefault().getTransformerFactory().newTransformer();
transformer.transform(new DOMSource(schema.getElement()), new StreamResult(writer));
return writer.toString();
}
代码示例来源:origin: org.wso2.wsdl4j/wsdl4j
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
Schema schema = (Schema)extension;
pw.print(" ");
DOM2Writer.serializeAsXML(schema.getElement(), def.getNamespaces(), pw);
pw.println();
}
}
代码示例来源:origin: spring-projects/spring-ws
@Override
public void addMessages(Definition definition) throws WSDLException {
Types types = definition.getTypes();
Assert.notNull(types, "No types element present in definition");
for (Iterator<?> iterator = types.getExtensibilityElements().iterator(); iterator.hasNext();) {
ExtensibilityElement extensibilityElement = (ExtensibilityElement) iterator.next();
if (extensibilityElement instanceof Schema) {
Schema schema = (Schema) extensibilityElement;
if (schema.getElement() != null) {
createMessages(definition, schema.getElement());
}
}
}
if (definition.getMessages().isEmpty() && logger.isWarnEnabled()) {
logger.warn("No messages were created, make sure the referenced schema(s) contain elements");
}
}
代码示例来源:origin: org.springframework.ws/org.springframework.ws
public void addMessages(Definition definition) throws WSDLException {
Types types = definition.getTypes();
Assert.notNull(types, "No types element present in definition");
for (Iterator<?> iterator = types.getExtensibilityElements().iterator(); iterator.hasNext();) {
ExtensibilityElement extensibilityElement = (ExtensibilityElement) iterator.next();
if (extensibilityElement instanceof Schema) {
Schema schema = (Schema) extensibilityElement;
if (schema.getElement() != null) {
createMessages(definition, schema.getElement());
}
}
}
if (definition.getMessages().isEmpty() && logger.isWarnEnabled()) {
logger.warn("No messages were created, make sure the referenced schema(s) contain elements");
}
}
代码示例来源:origin: apache/cxf
public void marshall(@SuppressWarnings("rawtypes") Class parentType,
QName elementType, ExtensibilityElement extension, PrintWriter pw,
Definition def, ExtensionRegistry extReg) throws WSDLException {
try {
writeXml(((Schema)extension).getElement(), pw);
} catch (XMLStreamException e) {
throw new WSDLException("", "Could not write schema.", e);
}
}
代码示例来源:origin: org.apache.cxf/cxf-rt-core
public void marshall(@SuppressWarnings("rawtypes") Class parentType,
QName elementType, ExtensibilityElement extension, PrintWriter pw,
Definition def, ExtensionRegistry extReg) throws WSDLException {
try {
writeXml(((Schema)extension).getElement(), pw);
} catch (XMLStreamException e) {
throw new WSDLException("", "Could not write schema.", e);
}
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
public void marshall(@SuppressWarnings("rawtypes") Class parentType,
QName elementType, ExtensibilityElement extension, PrintWriter pw,
Definition def, ExtensionRegistry extReg) throws WSDLException {
try {
writeXml(((Schema)extension).getElement(), pw);
} catch (XMLStreamException e) {
throw new WSDLException("", "Could not write schema.", e);
}
}
代码示例来源:origin: org.lorislab.corn/corn
private static Source loadWsdlSource(String wsdl) throws Exception {
Definition definition = loadDefinition(wsdl);
if (definition.getTypes() != null) {
for (Object o : definition.getTypes().getExtensibilityElements()) {
if (o instanceof javax.wsdl.extensions.schema.Schema) {
Element e = ((javax.wsdl.extensions.schema.Schema) o).getElement();
return new DOMSource(e);
}
}
}
return null;
}
代码示例来源:origin: org.switchyard.components/switchyard-component-soap
private static Boolean setMtomEnabled(Schema schema) {
if (schema != null) {
if (hasExpectedContentTypes(schema.getElement())) {
return true;
}
for (List<SchemaImport> c : ((Map<String, List<SchemaImport>>)schema.getImports()).values()) {
for (SchemaImport simport : c) {
if (setMtomEnabled(simport.getReferencedSchema())) {
return true;
}
}
}
}
return false;
}
代码示例来源:origin: jboss-switchyard/components
private static Boolean setMtomEnabled(Schema schema) {
if (schema != null) {
if (hasExpectedContentTypes(schema.getElement())) {
return true;
}
for (List<SchemaImport> c : ((Map<String, List<SchemaImport>>)schema.getImports()).values()) {
for (SchemaImport simport : c) {
if (setMtomEnabled(simport.getReferencedSchema())) {
return true;
}
}
}
}
return false;
}
代码示例来源:origin: apache/cxf
public Element getElement(Definition wsdlDef) throws WSDLException {
Types types = wsdlDef.getTypes();
if (types != null) {
List<ExtensibilityElement> l = CastUtils.cast(types.getExtensibilityElements());
if (l == null) {
return null;
}
for (ExtensibilityElement e : l) {
if (e instanceof Schema) {
Schema sc = (Schema)e;
return sc.getElement();
}
}
}
return null;
}
public Document getDocument(Definition wsdlDef) throws WSDLException {
内容来源于网络,如有侵权,请联系作者删除!