XML DOM doctype özelliği

Document nesnesi referans el kitabı

Tanım ve kullanım

Doctype özelliği, belge ile ilgili belge türü beyanını (Document Type Declaration) döndürebilir.

DTD'si olmayan XML belgeleri için null döndürür.

Bu özellik, DocumentType nesnesine (Document'in bir alt düğümü) doğrudan erişimi sağlar.

Sözdizimi:

documentObject.doctype

Örnek

Tüm örneklerde XML dosyalarını kullanacağız note_internal_dtd.xmlve JavaScript fonksiyonları loadXMLDoc()

Aşağıdaki kod parçası bir DocumentType nesnesi döndürebilir:

xmlDoc=loadXMLDoc("note_internal_dtd.xml");
document.write(xmlDoc.doctype);

Çıktı:

[object DocumentType]

Document nesnesi referans el kitabı