I am trying to reproduce the following line from an SQL Server .regsrvr file. It does not include the prefix on the element name, 'definitions'.
<definitions xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08">
If I use the three (3) parameter version of WriteStartElement()
$xmlw.WriteStartElement('sfc', 'definitions', 'http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08')
it produces the prefix on the element name.
<sfc:definitions xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" />
If I use the two (2) parameter version of WriteStartElement()
$xmlw.WriteStartElement('definitions', 'http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08')
it does not include the prefix 'sfc'.
<definitions xmlns="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" />
Does it matter if the prefix is present on the element name?
PS C:\> $PSVersionTable.PSVersion.ToString()
7.2.7
Update:
@mklement0 - is this correct?
This is from the .regsrvr created by SSMS. The definitions element creates sfc as the "default" namespace for descendent elements. The document, docinfo, and aliases elements are considered part of the sfc namespace.
If the definitions element was given as sfc:definitions, then the descendent elements would be considered as part of the parent xs namespace.
If sfc became the namespace for descendents of definitions, does sfc:version need to have the sfc prefix?
<xs:bufferSchema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<definitions xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08">
<document>
<docinfo>
<aliases>
<alias>/system/schema/RegisteredServers</alias>
</aliases>
<sfc:version DomainVersion="1" />
</docinfo>
<data>