2012-04-28 3 views
4

Web.config 변환을 사용하여 주석을 선택하거나 주석을 삽입하려면 어떻게해야합니까?Web.Config XML 형식의 주석

여기에 대한 정보는 어디에도 없습니다. 내가하려고

중 하나의 Web.config에서 기존 코멘트하기 전에 XML (<serviceAuthorization impersonateCallerForAllOperations="true"/>)의 조각을 삽입 1)

또는

2

) 끝에 주석과 XML을 삽입 형제 자매의 집합 :

는 지금까지 내가 XPath 축를 지원하지 않는의 Web.config 변환을 말할 수있는, 내가 시도하고 첫번째 코멘트하기 전에 노드를 삽입하는 이들의 숫자를 시도 :

<serviceAuthorization impersonateCallerForAllOperations="true" xdt:Transform="InsertBefore(/configuration/system.serviceModel/behaviors/serviceBehaviors/behavior[@name='behaviorOne']/serviceMetadata/preceding::comment()[1])"/> 

<serviceAuthorization impersonateCallerForAllOperations="true" xdt:Transform="InsertBefore(/configuration/system.serviceModel/behaviors/serviceBehaviors/behavior[@name='behaviorOne']/child::node()[1]"/> 

나는 다른 몇 가지를 시도했지만 생각을하게됩니다. 변환을 미리 볼 때 오류가 발생합니다.

의견을 입력하는 방법에 대한 정보도없는 것 같습니다. 내가 놓친 게 있니?

답변

2

필자는 변환이 요소 나 속성에서 작동하는 것으로 제한됩니다. 적어도 xdt : Transform의 documentation에는 주석을 추가하는 데 사용할 수있는 내용이 없습니다.

<spring > 
<objects xmlns="http://www.springframework.net"> 
    <object name="requestConfig" type="Example.Namespace.RequestConfig, Example" singleton ="true"> 
     <constructor-arg index="0" type="System.Uri" value="https://example.com/production"/> 
     <constructor-arg index="1" value="45000"/> 
    </object> 
</objects> 
을 :

<spring > 
<objects xmlns="http://www.springframework.net"> 
    <object > 
    <constructor-arg index="0" type="System.Uri" value="https://example.com/test" xdt:Locator="Condition(../@name='requestConfig' and @index='0')" xdt:Transform="SetAttributes(value)"/> 
    </object> 
</objects> 

다음에 작동 할 때 : 나는 다음과 같은 사용할 수 있다는

는 로케이터에 관해서는, 축의 일부 지원 있을 것처럼 보인다

자세히 알 수 있듯이 abov e는 변환 할 요소를 일치시키기 위해 부모 축을 사용합니다.