3 out of 12 rated this helpful - Rate this topic

IMPORT Processing Instruction

Imports a tag definition from an element behavior.

Syntax

<?IMPORT
    namespace = "sNameSpace"
    implementation = "sImplementation"
>

Attributes

namespace
Required. String that specifies the previously-defined namespace into which the tag definition is imported.
implementation
Required. One of the following values:
#defaultAn element behavior built into Microsoft Internet Explorer 5.5 or later.
#objectIDString that specifies the id attribute of an object tag.
sImplementationString that specifies the HTML Component (HTC) file that contains the tag definition.

Processing Instruction Information

Number of occurrences unlimited
Parent elements BODY, head
Minimum availability Internet Explorer 5.5
Minimum operating systems Windows 95, Windows NT 4.0, Windows CE 4.0

Remarks

Multiple instances of the IMPORT processing instruction (PI) can be used on a Web page.

The value of a XMLNS attribute, defined in the html tag, must correspond to the value of the namespace attribute defined in the IMPORT processing instruction. Otherwise, the imported tag definition cannot be used.

An imported tag will not render if the value of the implementation attribute is not valid. If you are using an HTC file, it must comply with the same security rules as all behaviors. For more information about security, see Introduction to DHTML Behaviors.

The IMPORT PI can be placed anywhere before the closing tag of the document body. However, the IMPORT processing instruction must be placed before the first instance of a custom element that uses the imported tag definition. If the IMPORT PI is placed after the custom element, the behavior does not attach to the custom element. This also means that the document. write method should not be used to add the IMPORT PI to a document.

As an alternative to the IMPORT PI, use the doImport method to dynamically import an element behavior. The doImport method is used in conjunction with the createElement method to insert a custom element to which an element behavior is attached.

The IMPORT processing instruction is only processed during the initial parsing of the document. Therefore, a document that uses an element behavior must include the IMPORT PI in the HTML file. Provided that the IMPORT PI is specified in the primary document, the document. write method can be used to add the custom element and attach to the behavior.

The IMPORT PI is not a member of the all collection. However, the content of the IMPORT PI can be accessed from the document.body. innerHTML property.

Example

The following sample illustrates the use of the IMPORT processing instruction. The XMLNS attribute defined in the html tag is defined to match the namespace attribute in the IMPORT processing instruction.


<HTML xmlns:games>
<?IMPORT namespace="games" implementation="checkers.htc" >
<BODY>
<games:checkers />
</BODY>
</HTML>

Standards Information

There is no public standard that applies to this element.

See Also

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
IMPORT instruction (+export)
Imports ProgSample.Lib, ProgSample.LibOffice
Public Class fMain

    Private Sub fMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        ' Close connection at appClose...
        DB.CloseConnection()
    End Sub
    Private Sub fMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim list As List(Of WTAPlayer) = WTAPlayer.GetWTAPlayers
        lvwWTA.Items.Clear()
        lvwWTA.Items.AddRange(WTAPlayerLVI.GetLVI(list).ToArray)
    End Sub
    Private Sub ImportWTAPlayers()
        Dim ofd As New OpenFileDialog
        ofd.InitialDirectory = Application.StartupPath
        ofd.Filter = "xlsl|*.xlsx"
        If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
            ExcelDA.ImportWTAList(ofd.FileName)
        End If
    End Sub
    Private Sub ExportWTAPlayers()
        Dim sfd As New SaveFileDialog
        sfd.InitialDirectory = Application.StartupPath
        sfd.Filter = "xlsl|*.xlsx"
        If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
            ExcelDA.ExportWTAList(sfd.FileName, WTAPlayer.GetWTAPlayers)
        End If
    End Sub
End Class