XMLElement

An XML element.

Methods:

addEventListener, applyCellStyle, applyCharacterStyle, applyObjectStyle, applyParagraphStyle, applyTableStyle, asynchronousExportFile, changeGrep, changeText, changeTransliterate, convertElementToTable, convertToAttribute, duplicate, evaluateXPathExpression, exportFile, findGrep, findText, findTransliterate, getElements, importXML, insertTextAsContent, markup, move, placeIntoCopy, placeIntoFrame, placeIntoInlineCopy, placeIntoInlineFrame, placeXML, remove, removeEventListener, select, setContent, store, toSource, toSpecifier, untag, validate

Objects:

Boolean, Cell, Cells, Characters, EPSs, EventListeners, Events, Graphic, Graphics, Images, InsertionPoint, InsertionPoints, Lines, Movie, Number, Object, PDFs, PICTs, PageItem, PageItems, Paragraphs, SVGs, Sound, SpecialCharacters, Stories, Story, String, Table, Tables, Text, TextColumns, TextStyleRanges, Texts, WMFs, Words, XMLAttributes, XMLComments, XMLElements, XMLInstructions, XMLItems, XMLTag

Hierarchy:

Superclass: XMLItem

Class: XMLElement

Property Listing

Property

Type

Access

Description

cells

Cells Cell

readonly

A collection of table cells.

characters

Characters Character

readonly

A collection of characters.

contents

String

SpecialCharacters

SpecialCharacters.ARABIC_COMMA

SpecialCharacters.ARABIC_KASHIDA

SpecialCharacters.ARABIC_QUESTION_MARK

SpecialCharacters.ARABIC_SEMICOLON

SpecialCharacters.AUTO_PAGE_NUMBER

SpecialCharacters.BULLET_CHARACTER

SpecialCharacters.COLUMN_BREAK

SpecialCharacters.COPYRIGHT_SYMBOL

SpecialCharacters.DEGREE_SYMBOL

SpecialCharacters.DISCRETIONARY_HYPHEN

SpecialCharacters.DISCRETIONARY_LINE_BREAK

SpecialCharacters.DOTTED_CIRCLE

SpecialCharacters.DOUBLE_LEFT_QUOTE

SpecialCharacters.DOUBLE_RIGHT_QUOTE

SpecialCharacters.DOUBLE_STRAIGHT_QUOTE

SpecialCharacters.ELLIPSIS_CHARACTER

SpecialCharacters.EM_DASH

SpecialCharacters.EM_SPACE

SpecialCharacters.END_NESTED_STYLE

SpecialCharacters.EN_DASH

SpecialCharacters.EN_SPACE

SpecialCharacters.EVEN_PAGE_BREAK

SpecialCharacters.FIGURE_SPACE

SpecialCharacters.FIXED_WIDTH_NONBREAKING_SPACE

SpecialCharacters.FLUSH_SPACE

SpecialCharacters.FOOTNOTE_SYMBOL

SpecialCharacters.FORCED_LINE_BREAK

SpecialCharacters.FRAME_BREAK

SpecialCharacters.HAIR_SPACE

SpecialCharacters.HEBREW_GERESH

SpecialCharacters.HEBREW_GERSHAYIM

SpecialCharacters.HEBREW_MAQAF

SpecialCharacters.HEBREW_SOF_PASUK

SpecialCharacters.INDENT_HERE_TAB

SpecialCharacters.LEFT_TO_RIGHT_EMBEDDING

SpecialCharacters.LEFT_TO_RIGHT_MARK

SpecialCharacters.LEFT_TO_RIGHT_OVERRIDE

SpecialCharacters.NEXT_PAGE_NUMBER

SpecialCharacters.NONBREAKING_HYPHEN

SpecialCharacters.NONBREAKING_SPACE

SpecialCharacters.ODD_PAGE_BREAK

SpecialCharacters.PAGE_BREAK

SpecialCharacters.PARAGRAPH_SYMBOL

SpecialCharacters.POP_DIRECTIONAL_FORMATTING

SpecialCharacters.PREVIOUS_PAGE_NUMBER

SpecialCharacters.PUNCTUATION_SPACE

SpecialCharacters.QUARTER_SPACE

SpecialCharacters.REGISTERED_TRADEMARK

SpecialCharacters.RIGHT_INDENT_TAB

SpecialCharacters.RIGHT_TO_LEFT_EMBEDDING

SpecialCharacters.RIGHT_TO_LEFT_MARK

SpecialCharacters.RIGHT_TO_LEFT_OVERRIDE

SpecialCharacters.SECTION_MARKER

SpecialCharacters.SECTION_SYMBOL

SpecialCharacters.SINGLE_LEFT_QUOTE

SpecialCharacters.SINGLE_RIGHT_QUOTE

SpecialCharacters.SINGLE_STRAIGHT_QUOTE

SpecialCharacters.SIXTH_SPACE

SpecialCharacters.TEXT_VARIABLE

SpecialCharacters.THIN_SPACE

SpecialCharacters.THIRD_SPACE

SpecialCharacters.TRADEMARK_SYMBOL

SpecialCharacters.ZERO_WIDTH_JOINER

SpecialCharacters.ZERO_WIDTH_NONJOINER

read/write

The contents of the text. Can return: String or SpecialCharacters enumerator.

epss

EPSs EPS

readonly

A collection of EPS files.

eventListeners

EventListeners EventListener

readonly

A collection of event listeners.

events

Events Event

readonly

A collection of events.

graphics

Graphics Graphic

readonly

A collection of imported graphics in any graphic file format (vector, metafile, or bitmap).

id

Number

readonly

The unique ID of the XMLElement.

images

Images Image

readonly

A collection of bitmap images in any bitmap file format (including TIFF, JPEG, or GIF).

index

Number

readonly

The index of the XMLElement within its containing object.

insertionPoints

InsertionPoints InsertionPoint

readonly

A collection of insertion points.

isValid

Boolean

readonly

Returns true if the object specifier resolves to valid objects.

lines

Lines Line

readonly

A collection of lines.

markupTag

XMLTag

String

read/write

The XML tag applied to the element. Can also accept: String.

pageItems

PageItems PageItem

readonly

The page items collection, which can be used to process all page items in a container (such as a document, page, or group), regardless of type.

paragraphs

Paragraphs Paragraph

readonly

A collection of paragraphs.

parent

Document

XMLElement

readonly

The parent of the XMLElement (a Document or XMLElement).

parentStory

Story

readonly

The story that contains the text.

pdfs

PDFs PDF

readonly

A collection of PDF files.

picts

PICTs PICT

readonly

A collection of PICT graphics.

properties

Object

read/write

A property that allows setting of several properties at the same time.

stories

Stories Story

readonly

A collection of stories.

storyOffset

InsertionPoint

readonly

The insertion point before the table in the story containing the table.

svgs

SVGs SVG

readonly

A collection of SVG files.

tables

Tables Table

readonly

A collection of tables.

textColumns

TextColumns TextColumn

readonly

A collection of text columns.

textStyleRanges

TextStyleRanges TextStyleRange

readonly

A collection of text style ranges.

texts

Texts Text

readonly

A collection of text objects.

wmfs

WMFs WMF

readonly

A collection of WMF graphics.

words

Words Word

readonly

A collection of words.

xmlAttributes

XMLAttributes XMLAttribute

readonly

A collection of XML attributes.

xmlComments

XMLComments XMLComment

readonly

A collection of XML comments.

xmlContent

Graphic

Movie

PageItem

Sound

Story

Table

Text

Cell

readonly

The text content or page item referred to by the element. Can return: Text, Story, PageItem, Movie, Sound, Graphic, Table or Cell.

xmlElements

XMLElements XMLElement

readonly

A collection of XML elements.

xmlInstructions

XMLInstructions XMLInstruction

readonly

A collection of XML instructions.

xmlItems

XMLItems XMLItem

readonly

A collection of XML items.

Method Listing

EventListener addEventListener (eventType:String, handler:Varies File JavaScriptFunction, [captures:Boolean=Boolean])

Adds an event listener.

Parameter

Type

Description

eventType

String

The event type.

handler

File

JavaScriptFunction

The event handler. Can accept: File or JavaScript Function.

captures

Boolean

This parameter is obsolete. (Optional)

(default: false)

undefined applyCellStyle (using:Varies String CellStyle, [clearingOverrides:Boolean=Boolean])

Applies a cell style to the table cells associated with the XMLElement.

Parameter

Type

Description

using

String

CellStyle

The cell style to apply. Can accept: String or CellStyle.

clearingOverrides

Boolean

If true, removes local formatting before applying the cell style. (Optional)

(default: true)

undefined applyCharacterStyle (using:Varies String CharacterStyle)

Applies the specified character style to the text content of the XMLElement.

Parameter

Type

Description

using

String

CharacterStyle

The character style to apply. Can accept: String or CharacterStyle.

undefined applyObjectStyle (using:Varies String ObjectStyle, [clearingOverrides:Boolean=Boolean], [clearingOverridesThroughRootObjectStyle:Boolean=Boolean])

Applies an object style to the frame associated with the XMLElement.

Parameter

Type

Description

using

String

ObjectStyle

The object style to apply. Can accept: String or ObjectStyle.

clearingOverrides

Boolean

If true, removes local formatting before applying the object style. (Optional)

(default: true)

clearingOverridesThroughRootObjectStyle

Boolean

If true, clears unchecked category attributes through the root style. (Optional)

(default: false)

undefined applyParagraphStyle (using:Varies String ParagraphStyle, [clearingOverrides:Boolean=Boolean])

Applies the specified paragraph style to the text content of the XMLElement.

Parameter

Type

Description

using

String

ParagraphStyle

The paragraph style to apply. Can accept: String or ParagraphStyle.

clearingOverrides

Boolean

If true, clears any attributes before applying the style. (Optional)

(default: true)

undefined applyTableStyle (using:Varies String TableStyle, [clearingOverrides:Boolean=Boolean])

Applies a table style to the table associated with the XMLElement.

Parameter

Type

Description

using

String

TableStyle

The table style to apply. Can accept: String or TableStyle.

clearingOverrides

Boolean

If true, removes local formatting before applying the table style. (Optional)

(default: true)

BackgroundTask asynchronousExportFile (format:Varies ExportFormat String, to:File, [showingOptions:Boolean=Boolean], using:PDFExportPreset, versionComments:String, [forceSave:Boolean=Boolean])

asynchronously exports the object(s) to a file.

Parameter

Type

Description

format

ExportFormat

ExportFormat.EPS_TYPE

ExportFormat.EPUB

ExportFormat.FIXED_LAYOUT_EPUB

ExportFormat.HTML

ExportFormat.HTMLFXL

ExportFormat.INCOPY_MARKUP

ExportFormat.INDESIGN_MARKUP

ExportFormat.INDESIGN_SNIPPET

ExportFormat.INTERACTIVE_PDF

ExportFormat.JPG

ExportFormat.PDF_TYPE

ExportFormat.PNG_FORMAT

ExportFormat.RTF

ExportFormat.TAGGED_TEXT

ExportFormat.TEXT_TYPE

ExportFormat.XML

String

The export format, specified as an enumeration value or as an extension that appears in the Save as type or Format menu in the Export dialog. Can accept: ExportFormat enumerator or String.

to

File

The path to the export file.

showingOptions

Boolean

If true, displays the export options dialog. (Optional)

(default: false)

using

PDFExportPreset

The export style. (Optional)

versionComments

String

The comment for this version. (Optional)

forceSave

Boolean

If true, forcibly saves a version. (Optional)

(default: false)

Text changeGrep (reverseOrder:Boolean)

Finds text that matches the find what value and replaces the text with the change to value.

Parameter

Type

Description

reverseOrder

Boolean

If true, returns the results in reverse order. (Optional)

Text changeText (reverseOrder:Boolean)

Finds text that matches the find what value and replaces the text with the change to value.

Parameter

Type

Description

reverseOrder

Boolean

If true, returns the results in reverse order. (Optional)

Text changeTransliterate (reverseOrder:Boolean)

Finds text that matches the find character type value and replaces the text with the change character type value.

Parameter

Type

Description

reverseOrder

Boolean

If true, returns the results in reverse order. (Optional)

Table convertElementToTable (rowTag:XMLTag, cellTag:XMLTag)

Converts the content of the XML element to a table.

Parameter

Type

Description

rowTag

XMLTag

The XML tag that indicates a table row.

cellTag

XMLTag

The XML tag that indicates a table cell.

XMLAttribute convertToAttribute (using:String)

Converts the XMLElement to an attribute of its parent element.

Parameter

Type

Description

using

String

The name to give to the new attribute. (Optional)

XMLElement duplicate ()

Duplicates the XMLElement.

XMLItem evaluateXPathExpression (using:String, prefixMappingTable:Array of Varies Arrays of 2 Strings. )

Evaluates an XPath expression starting at this XML element in the structure.

Parameter

Type

Description

using

String

The XPath expression.

prefixMappingTable

Array of Arrays of 2 Strings.

The namespace mapping table. Can accept: Array of Arrays of 2 Strings. (Optional)

undefined exportFile (format:Varies ExportFormat String, to:File, [showingOptions:Boolean=Boolean], using:PDFExportPreset, versionComments:String, [forceSave:Boolean=Boolean])

Exports the object(s) to a file.

Parameter

Type

Description

format

ExportFormat

ExportFormat.EPS_TYPE

ExportFormat.EPUB

ExportFormat.FIXED_LAYOUT_EPUB

ExportFormat.HTML

ExportFormat.HTMLFXL

ExportFormat.INCOPY_MARKUP

ExportFormat.INDESIGN_MARKUP

ExportFormat.INDESIGN_SNIPPET

ExportFormat.INTERACTIVE_PDF

ExportFormat.JPG

ExportFormat.PDF_TYPE

ExportFormat.PNG_FORMAT

ExportFormat.RTF

ExportFormat.TAGGED_TEXT

ExportFormat.TEXT_TYPE

ExportFormat.XML

String

The export format, specified as an enumeration value or as an extension that appears in the Save as type or Format menu in the Export dialog. Can accept: ExportFormat enumerator or String.

to

File

The path to the export file.

showingOptions

Boolean

If true, displays the export options dialog. (Optional)

(default: false)

using

PDFExportPreset

The export style. (Optional)

versionComments

String

The comment for this version. (Optional)

forceSave

Boolean

If true, forcibly saves a version. (Optional)

(default: false)

Text findGrep (reverseOrder:Boolean)

Finds text that matches the find what value.

Parameter

Type

Description

reverseOrder

Boolean

If true, returns the results in reverse order. (Optional)

Text findText (reverseOrder:Boolean)

Finds text that matches the find what value.

Parameter

Type

Description

reverseOrder

Boolean

If true, returns the results in reverse order. (Optional)

Text findTransliterate (reverseOrder:Boolean)

Finds text that matches the find character type value.

Parameter

Type

Description

reverseOrder

Boolean

If true, returns the results in reverse order. (Optional)

XMLElement getElements ()

Resolves the object specifier, creating an array of object references.

undefined importXML (from:File)

Imports the specified XML file into an InDesign document.

Parameter

Type

Description

from

File

The XML file.

Text insertTextAsContent (using:Varies String SpecialCharacters, position:XMLElementPosition)

Inserts the specified text as content before, in, or after the XML element.

Parameter

Type

Description

using

String

SpecialCharacters

SpecialCharacters.ARABIC_COMMA

SpecialCharacters.ARABIC_KASHIDA

SpecialCharacters.ARABIC_QUESTION_MARK

SpecialCharacters.ARABIC_SEMICOLON

SpecialCharacters.AUTO_PAGE_NUMBER

SpecialCharacters.BULLET_CHARACTER

SpecialCharacters.COLUMN_BREAK

SpecialCharacters.COPYRIGHT_SYMBOL

SpecialCharacters.DEGREE_SYMBOL

SpecialCharacters.DISCRETIONARY_HYPHEN

SpecialCharacters.DISCRETIONARY_LINE_BREAK

SpecialCharacters.DOTTED_CIRCLE

SpecialCharacters.DOUBLE_LEFT_QUOTE

SpecialCharacters.DOUBLE_RIGHT_QUOTE

SpecialCharacters.DOUBLE_STRAIGHT_QUOTE

SpecialCharacters.ELLIPSIS_CHARACTER

SpecialCharacters.EM_DASH

SpecialCharacters.EM_SPACE

SpecialCharacters.END_NESTED_STYLE

SpecialCharacters.EN_DASH

SpecialCharacters.EN_SPACE

SpecialCharacters.EVEN_PAGE_BREAK

SpecialCharacters.FIGURE_SPACE

SpecialCharacters.FIXED_WIDTH_NONBREAKING_SPACE

SpecialCharacters.FLUSH_SPACE

SpecialCharacters.FOOTNOTE_SYMBOL

SpecialCharacters.FORCED_LINE_BREAK

SpecialCharacters.FRAME_BREAK

SpecialCharacters.HAIR_SPACE

SpecialCharacters.HEBREW_GERESH

SpecialCharacters.HEBREW_GERSHAYIM

SpecialCharacters.HEBREW_MAQAF

SpecialCharacters.HEBREW_SOF_PASUK

SpecialCharacters.INDENT_HERE_TAB

SpecialCharacters.LEFT_TO_RIGHT_EMBEDDING

SpecialCharacters.LEFT_TO_RIGHT_MARK

SpecialCharacters.LEFT_TO_RIGHT_OVERRIDE

SpecialCharacters.NEXT_PAGE_NUMBER

SpecialCharacters.NONBREAKING_HYPHEN

SpecialCharacters.NONBREAKING_SPACE

SpecialCharacters.ODD_PAGE_BREAK

SpecialCharacters.PAGE_BREAK

SpecialCharacters.PARAGRAPH_SYMBOL

SpecialCharacters.POP_DIRECTIONAL_FORMATTING

SpecialCharacters.PREVIOUS_PAGE_NUMBER

SpecialCharacters.PUNCTUATION_SPACE

SpecialCharacters.QUARTER_SPACE

SpecialCharacters.REGISTERED_TRADEMARK

SpecialCharacters.RIGHT_INDENT_TAB

SpecialCharacters.RIGHT_TO_LEFT_EMBEDDING

SpecialCharacters.RIGHT_TO_LEFT_MARK

SpecialCharacters.RIGHT_TO_LEFT_OVERRIDE

SpecialCharacters.SECTION_MARKER

SpecialCharacters.SECTION_SYMBOL

SpecialCharacters.SINGLE_LEFT_QUOTE

SpecialCharacters.SINGLE_RIGHT_QUOTE

SpecialCharacters.SINGLE_STRAIGHT_QUOTE

SpecialCharacters.SIXTH_SPACE

SpecialCharacters.TEXT_VARIABLE

SpecialCharacters.THIN_SPACE

SpecialCharacters.THIRD_SPACE

SpecialCharacters.TRADEMARK_SYMBOL

SpecialCharacters.ZERO_WIDTH_JOINER

SpecialCharacters.ZERO_WIDTH_NONJOINER

The text to be inserted. Can accept: String or SpecialCharacters enumerator.

position

XMLElementPosition

XMLElementPosition.AFTER_ELEMENT

XMLElementPosition.BEFORE_ELEMENT

XMLElementPosition.ELEMENT_END

XMLElementPosition.ELEMENT_START

The position at which to insert the text. Note that text inserted before or after the element does not become part of the content of the element. Instead, it becomes content of the parent of the element.

undefined markup (using:Varies Graphic Movie PageItem Sound Story Text Table)

Associates the object with the specified XML element while preserving existing content.

Parameter

Type

Description

using

Graphic

Movie

PageItem

Sound

Story

Text

Table

The object to mark up. Can accept: PageItem, Movie, Sound, Graphic, Story, Text or Table.

XMLElement move (to:LocationOptions, reference:Varies XMLItem Text)

Moves the element to the specified location.

Parameter

Type

Description

to

LocationOptions

LocationOptions.AFTER

LocationOptions.AT_BEGINNING

LocationOptions.AT_END

LocationOptions.BEFORE

LocationOptions.UNKNOWN

The location in relation to the reference object or within the containing object.

reference

XMLItem

Text

The reference object. Note: Required when the to parameter specifies before or after. . Can accept: XMLItem or Text. (Optional)

PageItem placeIntoCopy (on:Varies Page Spread MasterSpread, placePoint:Array of Number String, copyItem:PageItem, [retainExistingFrame:Boolean=Boolean])

Associates the XML element with a copy of a page item.

Parameter

Type

Description

on

Page

Spread

MasterSpread

The page or spread on which to create the new page item. Can accept: Spread, Page or MasterSpread.

placePoint

Array of Number

Array of String

The page coordinates of the top left corner of the page item, in the format [y1, x1]

copyItem

PageItem

The page item to copy.

retainExistingFrame

Boolean

If true, associates the XML element with the existing page item and moves the page item (rather than a copy of the page item). (Optional)

(default: false)

PageItem placeIntoFrame (on:Varies Page Spread MasterSpread, geometricBounds:Array of Number String)

Places the XML element into a new rectangular page item. If the XML element was already associated with a page item, that page item is deleted.

Parameter

Type

Description

on

Page

Spread

MasterSpread

The page or spread on which to create the new page item. Can accept: Spread, Page or MasterSpread.

geometricBounds

Array of Number

Array of String

The bounds of the page item excluding the stroke width, in the format [y1, x1, y2, x2].

PageItem placeIntoInlineCopy (copyItem:PageItem, [retainExistingFrame:Boolean=Boolean])

Associates an existing page item with the XML element and places it into an inline frame.

Parameter

Type

Description

copyItem

PageItem

The page item to copy.

retainExistingFrame

Boolean

If true, moves the existing page item. If false, moves a copy of the page item. (Optional)

(default: false)

PageItem placeIntoInlineFrame (dimensions:Array of Number String)

Places an XML element into an inline frame.

Parameter

Type

Description

dimensions

Array of Number

Array of String

The dimensions of the inline frame in the format [width, height].

undefined placeXML (using:Varies Graphic Movie PageItem Story Sound)

Places XML content into the story, replacing the existing content.

Parameter

Type

Description

using

Graphic

Movie

PageItem

Story

Sound

The object to place into. Can accept: Story, PageItem, Graphic, Movie or Sound.

undefined remove ()

Deletes the XMLElement.

Boolean removeEventListener (eventType:String, handler:Varies File JavaScriptFunction, [captures:Boolean=Boolean])

Removes the event listener.

Parameter

Type

Description

eventType

String

The registered event type.

handler

File

JavaScriptFunction

The registered event handler. Can accept: File or JavaScript Function.

captures

Boolean

This parameter is obsolete. (Optional)

(default: false)

undefined select ([existingSelection:SelectionOptions=SelectionOptions])

Selects the object.

Parameter

Type

Description

existingSelection

SelectionOptions

SelectionOptions.ADD_TO

SelectionOptions.REMOVE_FROM

SelectionOptions.REPLACE_WITH

SelectionOptions.SET_KEY

The selection status of the XMLElement in relation to previously selected objects. (Optional)

(default: SelectionOptions.REPLACE_WITH)

PageItem setContent (using:String, relativeBasePath:String)

Replaces the content of XML element with content imported from a file.

Parameter

Type

Description

using

String

The file path to the import file.

relativeBasePath

String

Base path used to resolve relative paths. (Optional)

Asset store (using:Library, withProperties:Object)

Stores the object in the specified library.

Parameter

Type

Description

using

Library

The library in which to store the object.

withProperties

Object

Initial values for properties of the new XMLElement (Optional)

String toSource ()

Generates a string which, if executed, will return the XMLElement.

String toSpecifier ()

Retrieves the object specifier.

undefined untag ()

Untags an element.

ValidationError validate ([maximumErrors:Number=Number])

Validates the element against a DTD.

Parameter

Type

Description

maximumErrors

Number

The maximum number of validation errors to generate. (Optional)

(default: 250)

Object of

ValidationError.element

Cell.parent

Character.parent

EPS.parent

Event.parent

EventListener.parent

Graphic.parent

Image.parent

InsertionPoint.parent

Line.parent

MutationEvent.parent

PDF.parent

PICT.parent

PageItem.parent

Paragraph.parent

SVG.parent

Story.parent

Table.parent

Text.parent

TextColumn.parent

TextStyleRange.parent

WMF.parent

Word.parent

XMLAttribute.parent

XMLComment.parent

XMLElement.parent

XMLInstruction.parent

XMLItem.parent

Return

XMLAttribute.convertToElement()

XMLElements.add()

XMLElement.duplicate()

XMLElement.move()

XMLElement.getElements()

XMLElements.anyItem()

XMLElements.everyItem()

XMLElements.nextItem()

XMLElements.previousItem()

XMLElements.itemByID()

XMLElements.item()

XMLElements.[]()

XMLElements.itemByRange()

XMLElements.firstItem()

XMLElements.lastItem()

XMLElements.middleItem()