# Refactoring in XML Schema Files

Within an XML Schema file, refactoring allows authors to make a single artifact change, and have that change implemented throughout all other dependant artifacts.

Refactoring eliminates the need for the tedious editing necessary to recover broken dependencies caused by artifact changes which cause ripple effects on other dependant artifacts (such as renaming an XML Schema element).

1. Create a new XML schema or double-click an existing schema in the Navigator view. It will automatically open in the XML schema editor.
2. To refactor an artifact, position cursor within the artifact, right-click the artifact, click Refactor > Rename A popup dialog will request the entry of a new name for that artifact
   1. Type in the new name of the artifact.
   2. (Optional) Click Preview. A window will open indicating all of the changes which will take place due to the refactoring.
   3. Click OK.

The new name will be entered in the opened XSD source, as well as in all dependant artifacts.
Component References in XML Schema

Global named components | Reference
--- | ---

- <element name="foo">

- <element ref="foo">
- <element substitutionGroup="foo"

- <simple/complexType name="foo">

- <element type="foo">
- <attribute type="foo">
- <restriction base="foo">
- <substitution base="foo">

- <attribute name="foo">

- <attribute ref="foo">

- <attributeGroup name="foo">

- <attributeGroup ref="foo">

- <group name="foo">

- <group ref="foo">