0

XML (WSDL) ファイルでタグ間の s:element を削除したい:

<wsdl:types>
  <s:schema elementFormDefault="qualified" targetNamespace="http://ws.cdyne.com/WeatherWS/">
  <s:element name="GetWeatherInformation">
  <s:complexType/>
   </s:element>
   <s:element name="GetWeatherInformationResponse">
   <s:complexType>
     <s:sequence>
       <s:element minOccurs="0" maxOccurs="1" name="GetWeatherInformationResult"    type="tns:ArrayOfWeatherDescription"/>
     </s:sequence>
     </s:complexType>
    </s:element>

        <s:complexType name="ArrayOfWeatherDescription">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="WeatherDescription"  type="tns:WeatherDescription"/>
        </s:sequence>
        </s:complexType>
        <s:complexType name="WeatherDescription">
        <s:sequence>
           <s:element minOccurs="1" maxOccurs="1" name="WeatherID" type="s:short"/>
           <s:element minOccurs="0" maxOccurs="1" name="Description" type="s:string"/>
           <s:element minOccurs="0" maxOccurs="1" name="PictureURL" type="s:string"/>
       </s:sequence>
      </s:complexType>

       <s:element name="GetCityForecastByZIP">
        <s:complexType>
        <s:sequence>
           <s:element minOccurs="0" maxOccurs="1" name="ZIP" type="s:string"/>
        </s:sequence>
        </s:complexType>
        </s:element>

今、私は削除したい<s:element name="GetCityForecastByZIP"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="ZIP" type="s:string"/> </s:sequence> </s:complexType> </s:element>

<xsl:template match="s:element[@name = 'GetCityForecastByZIP']" />実行後に .xslt ファイルでこの構造を使用すると、コンソールにエラーが表示されます。どうすれば削除できますか?

Mule-Console でこのエラーが表示されました

Exception in thread "main" org.mule.module.launcher.DeploymentInitException: TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:220)
at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64)
at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:46)
at org.mule.tooling.server.application.ApplicationDeployer.run(ApplicationDeployer.java:56)
at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:88)
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceName': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: Failed to compile stylesheet. 1 error detected. (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:80)
    at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:208)
    ... 4 more
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceName': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: Failed to compile stylesheet. 1 error detected. (org.mule.api.lifecycle.InitialisationException)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101)
    at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
    ... 7 more
Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceName': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: Failed to compile stylesheet. 1 error detected.
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:117)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:116)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
    ... 11 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceName': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: Failed to compile stylesheet. 1 error detected.
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1442)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:248)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:581)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89)
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109)
    ... 14 more
        Caused by: org.springframework.beans.factory.BeanCreationException: Error creating                   bean with name 'serviceName': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: Failed to compile stylesheet. 1 error detected.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:408)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:319)
    at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:1154)
    at org.mule.config.spring.ServerNotificationManagerConfigurator.getMergedListeners(ServerNotificationManagerConfigurator.java:83)
    at org.mule.config.spring.ServerNotificationManagerConfigurator.getObject(ServerNotificationManagerConfigurator.java:65)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
    ... 23 more
Caused by: org.mule.api.lifecycle.InitialisationException: Failed to compile stylesheet. 1 error detected.
    at org.mule.module.xml.transformer.XsltTransformer.initialise(XsltTransformer.java:142)
    at org.mule.processor.chain.AbstractMessageProcessorChain.initialise(AbstractMessageProcessorChain.java:79)
    at org.mule.processor.chain.AbstractMessageProcessorChain.initialise(AbstractMessageProcessorChain.java:79)
    at org.mule.construct.AbstractFlowConstruct.initialiseIfInitialisable(AbstractFlowConstruct.java:309)
    at org.mule.construct.AbstractPipeline.doInitialise(AbstractPipeline.java:161)
    at org.mule.construct.AbstractFlowConstruct$1.onTransition(AbstractFlowConstruct.java:111)
    at org.mule.construct.AbstractFlowConstruct$1.onTransition(AbstractFlowConstruct.java:105)
    at org.mule.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:141)
    at org.mule.construct.FlowConstructLifecycleManager.fireInitialisePhase(FlowConstructLifecycleManager.java:81)
    at org.mule.construct.AbstractFlowConstruct.initialise(AbstractFlowConstruct.java:104)
    at org.mule.config.spring.factories.AbstractFlowConstructFactoryBean.initialise(AbstractFlowConstructFactoryBean.java:115)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1581)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1522)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
    ... 35 more
Caused by: javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.
    at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:153)
    at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:137)
    at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:88)
    at org.mule.module.xml.transformer.XsltTransformer$PooledXsltTransformerFactory.makeObject(XsltTransformer.java:363)
    at org.apache.commons.pool.impl.GenericObjectPool.addObject(GenericObjectPool.java:1615)
    at org.mule.module.xml.transformer.XsltTransformer.initialise(XsltTransformer.java:138)
    ... 52 more

これは私の .xslt ファイルです:

<?xml version='1.0' ?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

 <xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes"  indent="yes" />

   <xsl:template match="@*|node()"> 
        <xsl:copy copy-namespaces="yes">
          <xsl:apply-templates select="@*|node()"/>
        </xsl:copy> 
   </xsl:template>


      <xsl:template match="wsdl:operation[@name = 'GetCityWeatherByZIP']" />  
      <xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPSoapIn']" /> 
      <xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPSoapOut']" /> 

      <xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPHttpGetIn']" /> 
      <xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPHttpGetOut']" /> 

      <xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPHttpPostIn']" /> 
      <xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPHttpPostOut']" /> 

      <xsl:template match="s:element[@name = 'GetCityWeatherByZIP']" /> 


 </xsl:stylesheet>
4

2 に答える 2

0

JLRishe は、あなたのスタイルシートの何が問題なのかを推測しましたが、推測する必要はありませんでした。XSLT プロセッサがコンパイル時のエラーを報告したことを示すスタック トレースを示していただきましたが、それらのエラーは表示されていません。つまり、エラーが表示されていない可能性があります。デフォルトでは、それらは標準エラー出力に送られます。Java アプリケーションからコンパイルしている場合は、診断を表示できる場所に送信するようにする必要があります。スタイルシートの現在のコーディング エラーを修正しても、将来診断が表示されるようにコンパイラを実行する際の問題を修正することはできません。

もちろん、コードをデプロイする前にそのようなエラーを検出する IDE でスタイルシートを開発することもできます。ただし、その場合でも、エラー メッセージを見つけることができる堅牢なログ フレームワークの作成に投資する必要があります。

于 2013-01-28T09:17:32.430 に答える