我想从WSDL文件中提取内联模式。但是,我不知道如何执行XSL转换。任何关于创建这样的样式表的帮助都将是非常好的。
非常感谢,
发布于 2012-07-10 21:04:56
这一条对我很有效:
<?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名称空间。
发布于 2016-07-22 01:28:12
当wsdl包含多个架构元素时,您可以执行以下操作:使用https://gist.github.com/ebratb/3819949中的xsd-split.xslt将*.wsdl文件拆分为几个*.xsd文件。
您可以使用maven插件来运行带有Saxon的2.0XSLT(参见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属性。
https://stackoverflow.com/questions/11412925
复制相似问题