grefel
11/4/2014 - 3:54 PM

Add standard namespaces for using evaluateXPathExpression() on #InDesign #XML subtrees

Add standard namespaces for using evaluateXPathExpression() on #InDesign #XML subtrees

function addStandardNameSpace(xmlContainer) {
	if( !xmlContainer.xmlAttributes.itemByName("xmlns:xml").isValid ) {
		xmlContainer.xmlAttributes.add( "xmlns:xml", "http://www.w3.org/XML/1998/namespace" );
	}
	if( !xmlContainer.xmlAttributes.itemByName("xmlns:aid").isValid ) {
		xmlContainer.xmlAttributes.add( "xmlns:aid", "http://ns.adobe.com/AdobeInDesign/4.0/");
	}
	if( !xmlContainer.xmlAttributes.itemByName("xmlns:aid5").isValid ) {
		xmlContainer.xmlAttributes.add( "xmlns:aid5", "http://ns.adobe.com/AdobeInDesign/5.0/");
	}
	return xmlContainer;
}