Can XML Refactoring convert an element to an attribute?
Posted: Fri Jun 07, 2019 7:00 am
Greetings,
I need to convert S1000D Issue 4.0 XML files over to Issue 4.1. which is a very big project. The two code examples shown below show a coding change that has taken place between the two Issue releases. My hope is XML Refactoring can automatically perform for me this change accross many XML files and save me the work of doing it manually.
The change is as follows. In the Example #1 code the <manufacturerCode>777</manufacturerCode> tag and the <partNumber>1010</partNumber> tag exist as elements. However, in Example #2 both of these elements have been changed to attributes now and also have been renamed to manufacturerCodeValue="777" and partNumberValue="1010". Additionally, both newly renamed attributes now exist inside the <partRef> tag. Can XML Refactoring perform an operation that involves changing the two mentioned elements to the two mentioned attribute names and relocating the new renamed attributes into the <partRef> tag as shown in Example #2? I would really like to know if such an XML Refactoring operation is possible because if it is indeed possible it will help me out a lot. Thank you for your help.
Example #1: Issue 4.0 Bicycle
Example #2: Issue 4.1 Bicycle
I need to convert S1000D Issue 4.0 XML files over to Issue 4.1. which is a very big project. The two code examples shown below show a coding change that has taken place between the two Issue releases. My hope is XML Refactoring can automatically perform for me this change accross many XML files and save me the work of doing it manually.
The change is as follows. In the Example #1 code the <manufacturerCode>777</manufacturerCode> tag and the <partNumber>1010</partNumber> tag exist as elements. However, in Example #2 both of these elements have been changed to attributes now and also have been renamed to manufacturerCodeValue="777" and partNumberValue="1010". Additionally, both newly renamed attributes now exist inside the <partRef> tag. Can XML Refactoring perform an operation that involves changing the two mentioned elements to the two mentioned attribute names and relocating the new renamed attributes into the <partRef> tag as shown in Example #2? I would really like to know if such an XML Refactoring operation is possible because if it is indeed possible it will help me out a lot. Thank you for your help.
Example #1: Issue 4.0 Bicycle
Code: Select all
<catalogSeqNumber catalogSeqNumberValue="D00000000A001 " indenture="2">
<itemSequenceNumber itemSeqNumberValue="00A">
<reasonForSelection reasonForSelectionValue="1"/>
<quantityPerNextHigherAssy>1</quantityPerNextHigherAssy>
<manufacturerCode>KZ777</manufacturerCode>
<partNumber>LRU1010</partNumber>
<partIdentSegment>
<descrForPart>Light, sub-assembly front</descrForPart>
<unitOfIssue>EA</unitOfIssue>
<specialStorage>1</specialStorage>
</partIdentSegment>
<partLocationSegment>
<descrForLocation>FRONT</descrForLocation>
</partLocationSegment>
<locationRcmdSegment>
<locationRcmd>
<service>UKA</service>
<sourceMaintRecoverability>PAODF</sourceMaintRecoverability>
</locationRcmd>
</locationRcmdSegment>
</itemSequenceNumber>
</catalogSeqNumber>
Code: Select all
<catalogSeqNumber indenture="3" systemCode="D00" subSystemCode="0" subSubSystemCode="0" assyCode="00" figureNumber="01" item="002">
<itemSeqNumber itemSeqNumberValue="00A">
<reasonForSelection reasonForSelectionValue="1"/>
<quantityPerNextHigherAssy>1</quantityPerNextHigherAssy>
<partRef manufacturerCodeValue="KZ777" partNumberValue="LRU1011"/>
<partLocationSegment/>
<locationRcmdSegment>
<locationRcmd>
<service>UKA</service>
<sourceMaintRecoverability>PAFFD</sourceMaintRecoverability>
</locationRcmd>
</locationRcmdSegment>
</itemSeqNumber>
</catalogSeqNumber>