Udostępnij za pośrednictwem


Namespace declaration with prefix cannot have an empty value in XML literals

An XML namespace declaration in an XML literal does not include a namespace value. For example, the following code will cause this error:

Dim book = <book xmlns:ns=""/>

Error ID: BC31184

To correct this error

  • Include a valid namespace in the XML namespace declaration, or remove the XML namespace declaration from the XML literal.

    As an alternative, you can use the Imports statement to identify a namespace prefix for the empty namespace. For example:

    Imports <xmlns:ns="">
    

See Also

Reference

Imports Statement (XML Namespace)

Other Resources

XML Literals

XML in Visual Basic