InDesign Server2025
API 20.5.0.49
Object

XMLElement

An XML element.

XMLItem XMLElement

Properties

NameType AccessDescription
Cells<Cell> readonly A collection of table cells.
Characters<Character> readonly A collection of characters.
String | SpecialCharacters
+52 more
read/write The contents of the text. Can return: String or SpecialCharacters enumerator.
EPSs<EPS> readonly A collection of EPS files.
EventListeners<EventListener> readonly A collection of event listeners.
Events<Event> readonly A collection of events.
Graphics<Graphic> readonly A collection of imported graphics in any graphic file format (vector, metafile, or bitmap).
Number readonly The unique ID of the XMLElement.
Images<Image> readonly A collection of bitmap images in any bitmap file format (including TIFF, JPEG, or GIF).
Number readonly The index of the XMLElement within its containing object.
InsertionPoints<InsertionPoint> readonly A collection of insertion points.
Boolean readonly Returns true if the object specifier resolves to valid objects.
Lines<Line> readonly A collection of lines.
XMLTag | String read/write The XML tag applied to the element. Can also accept: String.
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<Paragraph> readonly A collection of paragraphs.
Document | XMLElement readonly The parent of the XMLElement (a Document or XMLElement).
Story readonly The story that contains the text.
PDFs<PDF> readonly A collection of PDF files.
PICTs<PICT> readonly A collection of PICT graphics.
Object read/write A property that allows setting of several properties at the same time.
Stories<Story> readonly A collection of stories.
InsertionPoint readonly The insertion point before the table in the story containing the table.
SVGs<SVG> readonly A collection of SVG files.
Tables<Table> readonly A collection of tables.
TextColumns<TextColumn> readonly A collection of text columns.
TextStyleRanges<TextStyleRange> readonly A collection of text style ranges.
Texts<Text> readonly A collection of text objects.
WMFs<WMF> readonly A collection of WMF graphics.
Words<Word> readonly A collection of words.
XMLAttributes<XMLAttribute> readonly A collection of XML attributes.
XMLComments<XMLComment> readonly A collection of XML comments.
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<XMLElement> readonly A collection of XML elements.
XMLInstructions<XMLInstruction> readonly A collection of XML instructions.
XMLItems<XMLItem> readonly A collection of XML items.

Methods

EventListener

Adds an event listener.

eventType String The event type.
handler File | JavaScriptFunction The event handler. Can accept: File or JavaScript Function.
captures? Boolean This parameter is obsolete.
void

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

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.
void

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

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

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

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.
clearingOverridesThroughRootObjectStyle? Boolean If true, clears unchecked category attributes through the root style.
void

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

using String | ParagraphStyle The paragraph style to apply. Can accept: String or ParagraphStyle.
clearingOverrides? Boolean If true, clears any attributes before applying the style.
void

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

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.
Text[]

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

reverseOrder? Boolean If true, returns the results in reverse order.
Text[]

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

reverseOrder? Boolean If true, returns the results in reverse order.
Text[]

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

reverseOrder? Boolean If true, returns the results in reverse order.
Table

Converts the content of the XML element to a table.

rowTag XMLTag The XML tag that indicates a table row.
cellTag XMLTag The XML tag that indicates a table cell.
XMLAttribute

Converts the XMLElement to an attribute of its parent element.

using? String The name to give to the new attribute.
XMLElement

Duplicates the XMLElement.

XMLItem[]

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

using String The XPath expression.
prefixMappingTable? Arrays of 2 Strings[] The namespace mapping table. Can accept: Array of Arrays of 2 Strings.
void

Exports the object(s) to a file.

format ExportFormat | 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.
using? PDFExportPreset The export style.
versionComments? String The comment for this version.
forceSave? Boolean If true, forcibly saves a version.
Text[]

Finds text that matches the find what value.

reverseOrder? Boolean If true, returns the results in reverse order.
Text[]

Finds text that matches the find what value.

reverseOrder? Boolean If true, returns the results in reverse order.
Text[]

Finds text that matches the find character type value.

reverseOrder? Boolean If true, returns the results in reverse order.
XMLElement[]

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

void

Imports the specified XML file into an InDesign document.

from File The XML file.
Text

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

using String | SpecialCharacters The text to be inserted. Can accept: String or SpecialCharacters enumerator.
position XMLElementPosition 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.
void

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

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

Moves the element to the specified location.

to LocationOptions 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.
PageItem

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

on Page | Spread | MasterSpread The page or spread on which to create the new page item. Can accept: Spread, Page or MasterSpread.
placePoint Number[] | String[] unit 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).
PageItem

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.

on Page | Spread | MasterSpread The page or spread on which to create the new page item. Can accept: Spread, Page or MasterSpread.
geometricBounds Number[] | String[] unit The bounds of the page item excluding the stroke width, in the format [y1, x1, y2, x2].
PageItem

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

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.
PageItem

Places an XML element into an inline frame.

dimensions Number[] | String[] unit The dimensions of the inline frame in the format [width, height].
void

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

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

Deletes the XMLElement.

Boolean

Removes the event listener.

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.
PageItem

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

using String The file path to the import file.
relativeBasePath? String Base path used to resolve relative paths.
Asset

Stores the object in the specified library.

using Library The library in which to store the object.
withProperties? Object Initial values for properties of the new XMLElement
String

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

String

Retrieves the object specifier.

void

Untags an element.

ValidationError[]

Validates the element against a DTD.

maximumErrors? Number The maximum number of validation errors to generate.

Object of 28

Properties elsewhere that hold a XMLElement.

Parameter of 80

Method parameters that accept a XMLElement.

Button.markup(using)Button.placeXML(using)Character.markup(using)CheckBox.markup(using)CheckBox.placeXML(using)ComboBox.markup(using)ComboBox.placeXML(using)EPS.markup(using)EPS.placeXML(using)EPSText.markup(using)EPSText.placeXML(using)EndnoteTextFrame.markup(using)EndnoteTextFrame.placeXML(using)FormField.markup(using)FormField.placeXML(using)Graphic.markup(using)Graphic.placeXML(using)GraphicLine.markup(using)GraphicLine.placeXML(using)Group.markup(using)Group.placeXML(using)HtmlItem.markup(using)HtmlItem.placeXML(using)Image.markup(using)Image.placeXML(using)ImportedPage.markup(using)ImportedPage.placeXML(using)InsertionPoint.markup(using)Line.markup(using)ListBox.markup(using)ListBox.placeXML(using)MediaItem.markup(using)MediaItem.placeXML(using)Movie.markup(using)Movie.placeXML(using)MultiStateObject.markup(using)MultiStateObject.placeXML(using)Oval.markup(using)Oval.placeXML(using)PDF.markup(using)PDF.placeXML(using)PICT.markup(using)PICT.placeXML(using)Page.placeXML(using)PageItem.markup(using)PageItem.placeXML(using)Paragraph.markup(using)Polygon.markup(using)Polygon.placeXML(using)RadioButton.markup(using)RadioButton.placeXML(using)Rectangle.markup(using)Rectangle.placeXML(using)SVG.markup(using)SVG.placeXML(using)SignatureField.markup(using)SignatureField.placeXML(using)Sound.markup(using)Sound.placeXML(using)SplineItem.markup(using)SplineItem.placeXML(using)Spread.placeXML(using)Story.markup(using)Story.placeXML(using)Table.markup(using)Tables.add(reference)Text.markup(using)TextBox.markup(using)TextBox.placeXML(using)TextColumn.markup(using)TextFrame.markup(using)TextFrame.placeXML(using)TextStyleRange.markup(using)WMF.markup(using)WMF.placeXML(using)Word.markup(using)XMLElements.itemByRange(from)XMLElements.nextItem(obj)XMLElements.previousItem(obj)XMLRuleProcessor.startProcessingRuleSet(initialElement)

Return 17

Methods that return a XMLElement.