Skip to content

Instantly share code, notes, and snippets.

@grefel
Created November 4, 2014 15:54
Show Gist options
  • Save grefel/e9a333d5332ddbd3ca0a to your computer and use it in GitHub Desktop.
Save grefel/e9a333d5332ddbd3ca0a to your computer and use it in GitHub Desktop.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment