DB2 10.5 for Linux, UNIX, and Windows

DB2Connection.DropDTD Method

Drops the document type definition (DTD) registered with the database.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax

[Visual Basic]
Public Sub DropDTD(
   ByVal schema As String,
   ByVal name As String

)
[C#]
public void DropDTD(
   String schema,
   String name
);
[C++]
public: void DropDTD(
   String schema,
   String name

);
[JScript]
public function DropDTD(
   schema : String,
   name : String
);

Parameters

schema
Name of the schema containing the registered document type definition (DTD).
name
Name of the DTD.

Example

Sample HeadCount.dtd contains:
<!ELEMENT HeadCount (Name)*>
<!ELEMENT Name (Name)*>
<!ATTLIST Name First CDATA #REQUIRED>
<!ATTLIST Name Last CDATA #REQUIRED>
<!ATTLIST Name Relation (self | spouse | child) "self">
<!ENTITY MyFirst "Jeff">
<!ENTITY MyLast "Smith">
Sample HeadCount.xml contains:
<!DOCTYPE HeadCount SYSTEM "HeadCount.dtd">
<HeadCount>
	<Name First="Waldo" Last="Pepper">
		<Name First="Salt" Last="Pepper" Relation="spouse"/>
		<Name First="Red" Last="Pepper" Relation="child"/>
	</Name>
	<Name First="&MyFirst;" Last="&MyLast;">
		<Name First="Sharon" Last="&MyLast;" Relation="spouse"/>
		<Name First="Morgan" Last="&MyLast;" Relation="child"/>
		<Name First="Shelby" Last="&MyLast;" Relation="child"/>
	</Name>
</HeadCount>
The following C# code example demonstrate use of the DropDTD method:
using (DB2Connection conn = new DB2Connection(connStr))
{
	String dtdContent = null;
	String xmlDoc =null;

	try 
	{
		TextReader rd = new StreamReader("HeadCount.dtd");
		dtdContent = rd.ReadToEnd();

		// Register the DTD
		conn.RegisterDTD("NEWTON", "HEADCOUNTDTD", "http://dtd1", null, dtdContent);

		rd = new StreamReader("HeadCount.xml");
		xmlDoc = rd.ReadToEnd();

		// insert XML doc into a table validating it using registered DTD
		DB2Command cmd = conn.CreateCommand();
		cmd.CommandText = "insert into myXmlTable(xmlColumn) values( xmlvalidate( ? ) )";
		cmd.Parameters.Add("p1", DB2Type.Xml);
		cmd.Parameters[0].Value = xmlDoc;
		cmd.ExecuteNonQuery();

		//Drop the DTD
		conn.DropDTD("NEWTON", "HEADCOUNTDTD");
	}
	catch (Exception e)
	{
		// exception handling
	}
}

Return value

Function does not return a value.