测试可选节点是否存在的正确方法是什么?我的XML片段是:但也可以是:Antenna的子级可以是BirdBath或AzEl,但不能两者都是...我在DelphiXE中尝试过:if(MountNode.ChildNodes.Nodes['AzEl']unassignedthen//Doesnotworkif(MountNode.ChildNodes['BirdBathMount'].NodeValuenull)then//Doesnotworkif(MountNode.BirdBathMount.NodeValuenull)then//Doesnotwork我使用XMLSpy创建模式和示例
当XMLDOMDocument保存自身时,我怎样才能让它包含XML声明,例如:正在内存中创建XMLDOMDomcument对象(即未从某些外部源加载xml):{IXMLDOMDocument2doc=newDOMDocument60();//addnodestothedoc...doc.Save(saveTarget);}如果没有xml声明,您只会得到主体xml,例如:...而不是完整的XML文档:...问题2我如何控制encodingtheXMLDOMDocument将在保存到流时使用? 最佳答案 您需要使用MXXMLWriter
如何设置DOMDocument60对象的doctype?例如我尝试:IXMLDOMDocument60doc=newDOMDocument60();doc.doctype.name="html";除了IXMLDOMDocumentType.name是只读:IXMLDOMDocumentType=interface(IXMLDOMNode){['{2933BF8B-7B36-11D2-B20E-00C04F983E60}']stringGet_name();...propertyStringnamereadGet_name;}并且IXMLDOMDocument60.doctype是只读的