提取内联模式WSDL样式表xsom



我想从WSDL文件中提取内联模式。但是,我不知道如何执行XSL转换。创建这样一个样式表的任何帮助都是非常好的。

非常感谢

这个对我有用:

<?xml-stylesheet type="text/xsl"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:s="http://www.w3.org/2001/XMLSchema" >
<xsl:output method="xml" />
<xsl:template match='text()' />
<xsl:template match="//s:schema">
    <xsl:copy-of select='.'/>
</xsl:template>    
</xsl:stylesheet>

它假设您的内联模式使用http://www.w3.org/2001/XMLSchema命名空间。

当wsdl包含多个模式元素时,您可以这样做:使用来自的xsd-split.xslthttps://gist.github.com/ebratb/3819949以将*.wsdl文件拆分为几个*.xsd文件。

您可以使用maven插件与Saxon一起运行2.0 xslt(请参阅http://www.mojohaus.org/xml-maven-plugin/examples/transform-saxon.html)

然后编写一个小的模式文件,只导入那些生成的*.xsd文件以及soap信封的官方定义。

<?xml version="1.0" encoding="UTF-8" ?>  
<xsd:schema attributeFormDefault="unqualified"       elementFormDefault="qualified" targetNamespace="http://your.company.com/dummy" xmlns:xsd="http://www.w3.org/2001/XMLSchema">                      
   <xsd:import namespace="http://<target namespace of the first xsd file>"  schemaLocation="file:///path/to/first.xsd"  />
   <xsd:import namespace="http://<target namespace of the second xsd file>" schemaLocation="file:///path/to/second.xsd"  />
    ...
   <xsd:import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="http://schemas.xmlsoap.org/soap/envelope/" />
</xsd:schema>

使用自定义资源解析程序时,不需要schemaLocation属性。

最新更新