XMLElement

An XML element.

Properties

Property Type Access Description
cells Cells readonly A collection of table cells.
characters Characters readonly A collection of characters.
contents any r/w The text contents of the XMLElement. Can return: String or SpecialCharacters enumerator.
epss EPSs readonly A collection of EPS files.
id number readonly The unique ID of the XMLElement.
images Images 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 readonly A collection of insertion points.
lines Lines readonly A collection of lines.
markupTag XMLTag r/w The XML tag applied to the element. Can also accept: String.
pageItems PageItems 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 readonly A collection of paragraphs.
parent any readonly The parent of the XMLElement (a Document, XMLElement or XMLItem).
parentStory Story readonly The story that contains the XMLElement.
pdfs PDFs readonly A collection of PDF files.
picts PICTs readonly A collection of PICT graphics.
properties Object r/w A property that allows setting of several properties at the same time.
stories Stories readonly A collection of stories.
storyOffset InsertionPoint readonly The location of the XMLElement in the parent story.
tables Tables readonly A collection of tables.
textColumns TextColumns readonly A collection of text columns.
texts Texts readonly A collection of text objects.
textStyleRanges TextStyleRanges readonly A collection of text style ranges.
wmfs WMFs readonly A collection of WMF graphics.
words Words readonly A collection of words.
xmlAttributes XMLAttributes readonly A collection of XML attributes.
xmlComments XMLComments readonly A collection of XML comments.
xmlContent any 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 readonly A collection of XML elements.
xmlInstructions XMLInstructions readonly A collection of XML instructions.
xmlItems XMLItems readonly A collection of XML items.

Methods

void applyCellStyle (using:
any[, clearingOverrides:
bool=true ])
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 bool If true, removes local formatting before applying the cell style. (Optional) (default: true )

void applyCharacterStyle (using:
any)
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.

void applyObjectStyle (using:
any[, clearingOverrides:
bool=true ][, clearingOverridesThroughRootObjectStyle:
bool=false ])
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 bool If true, removes local formatting before applying the object style. (Optional) (default: true )
clearingOverridesThroughRootObjectStyle bool If true, clears unchecked category attributes through the root style. (Optional) (default: false )

void applyParagraphStyle (using:
any[, clearingOverrides:
bool=true ])
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 bool If true, clears any attributes before applying the style. (Optional) (default: true )

void applyTableStyle (using:
any[, clearingOverrides:
bool=true ])
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 bool If true, removes local formatting before applying the table style. (Optional) (default: true )

Array of TextchangeGrep ([reverseOrder:
bool])
Finds text that matches the find what value and replaces the text with the change to value.

Parameter Type Description
reverseOrder bool If true, returns the results in reverse order. (Optional)

Array of TextchangeText ([reverseOrder:
bool])
Finds text that matches the find what value and replaces the text with the change to value.

Parameter Type Description
reverseOrder bool If true, returns the results in reverse order. (Optional)

TableconvertElementToTable (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.

XMLAttributeconvertToAttribute ([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)

XMLElementduplicate ()
Duplicates the XMLElement.

void exportFile (format:
any, to:
File[, showingOptions:
bool=false ][, using:
PDFExportPreset][, versionComments:
string][, forceSave:
bool=false ])
Exports the XMLElement to file.

Parameter Type Description
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.
showingOptions bool 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 bool If true, forcibly saves a version. (Optional) (default: false )

Array of TextfindGrep ([reverseOrder:
bool])
Finds text that matches the find what value.

Parameter Type Description
reverseOrder bool If true, returns the results in reverse order. (Optional)

Array of TextfindText ([reverseOrder:
bool])
Finds text that matches the find what value.

Parameter Type Description
reverseOrder bool If true, returns the results in reverse order. (Optional)

Array of XMLElementgetElements ()
Resolves the object specifier, creating an array of object references.

void importXML (from:
File)
Imports the specified XML file into an InDesign document.

Parameter Type Description
from File The XML file.

TextinsertTextAsContent (using:
any, position:
XMLElementPosition)
Inserts the specified text as content before, in, or after the XML element.

Parameter Type Description
using String
SpecialCharacters
The text to be inserted. Can accept: String or SpecialCharacters enumerator.
position XMLElementPosition
:
BEFORE_ELEMENT
AFTER_ELEMENT
ELEMENT_START
ELEMENT_END
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 markup (using:
any)
Associates the object with the specified XML element while preserving existing content.

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

XMLElementmove (to:
LocationOptions[, reference:
any])
Moves the element to the specified location.

Parameter Type Description
to LocationOptions
:
BEFORE
AFTER
AT_END
AT_BEGINNING
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)

PageItemplaceIntoCopy (on:
any, placePoint:
Array of number, copyItem:
PageItem[, retainExistingFrame:
bool=false ])
Associates the XML element with a copy of a page item.

Parameter Type Description
on Spread
Page
MasterSpread
The page or spread on which to create the new page item. Can accept: Spread, Page or MasterSpread.
placePoint Array of number 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 bool 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 )

PageItemplaceIntoFrame (on:
any, geometricBounds:
Array of number)
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 Spread
Page
MasterSpread
The page or spread on which to create the new page item. Can accept: Spread, Page or MasterSpread.
geometricBounds Array of number The bounds of the page item excluding the stroke width, in the format [y1, x1, y2, x2].

PageItemplaceIntoInlineCopy (copyItem:
PageItem[, retainExistingFrame:
bool=false ])
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 bool If true, moves the existing page item. If false, moves a copy of the page item. (Optional) (default: false )

PageItemplaceIntoInlineFrame (dimensions:
Array of number)
Places an XML element into an inline frame.

Parameter Type Description
dimensions Array of number The dimensions of the inline frame in the format [width, height].

void placeXML (using:
any)
Places XML content into the story, replacing the existing content.

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

void remove ()
Deletes the XMLElement.

void select ([existingSelection:
SelectionOptions=REPLACE_WITH ])
Selects the XMLElement.

Parameter Type Description
existingSelection SelectionOptions
:
ADD_TO
REMOVE_FROM
REPLACE_WITH
The selection status of the XMLElement in relation to previously selected objects. (Optional) (default: REPLACE_WITH )

PageItemsetContent (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)

Assetstore (using:
Library[, withProperties:
Object])
Stores the XMLElement(s) in the specified library.

Parameter Type Description
using Library The library in which to store the XMLElement(s).
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.

void untag ()
Untags an element.

Array of ValidationErrorvalidate ([maximumErrors:
number=250 ])
Validates the element against a DTD.

Parameter Type Description
maximumErrors number The maximum number of validation errors to generate. (Optional) (default: 250 )

Element of:

ValidationError.element
XMLAttribute.parent

Used in:

Button.placeXML (

using:
XMLElement )

Button.markup (

using:
XMLElement )

Character.markup (

using:
XMLElement )

EPS.placeXML (

using:
XMLElement )

EPS.markup (

using:
XMLElement )

FormField.placeXML (

using:
XMLElement )

FormField.markup (

using:
XMLElement )

Graphic.placeXML (

using:
XMLElement )

Graphic.markup (

using:
XMLElement )

GraphicLine.placeXML (

using:
XMLElement )

GraphicLine.markup (

using:
XMLElement )

Group.placeXML (

using:
XMLElement )

Group.markup (

using:
XMLElement )

Image.placeXML (

using:
XMLElement )

Image.markup (

using:
XMLElement )

ImportedPage.placeXML (

using:
XMLElement )

ImportedPage.markup (

using:
XMLElement )

InsertionPoint.markup (

using:
XMLElement )

Line.markup (

using:
XMLElement )

Movie.placeXML (

using:
XMLElement )

Movie.markup (

using:
XMLElement )

Oval.placeXML (

using:
XMLElement )

Oval.markup (

using:
XMLElement )

Page.placeXML (

using:
XMLElement , placePoint:
Array of number[, autoflowing:
bool=false ])

PageItem.placeXML (

using:
XMLElement )

PageItem.markup (

using:
XMLElement )

Paragraph.markup (

using:
XMLElement )

PDF.placeXML (

using:
XMLElement )

PDF.markup (

using:
XMLElement )

PICT.placeXML (

using:
XMLElement )

PICT.markup (

using:
XMLElement )

Polygon.placeXML (

using:
XMLElement )

Polygon.markup (

using:
XMLElement )

Rectangle.placeXML (

using:
XMLElement )

Rectangle.markup (

using:
XMLElement )

Sound.placeXML (

using:
XMLElement )

Sound.markup (

using:
XMLElement )

Spread.placeXML (

using:
XMLElement , placePoint:
Array of number[, autoflowing:
bool=false ])

Story.placeXML (

using:
XMLElement )

Story.markup (

using:
XMLElement )

Table.markup (

using:
XMLElement )

Text.markup (

using:
XMLElement )

TextColumn.markup (

using:
XMLElement )

TextFrame.placeXML (

using:
XMLElement )

TextFrame.markup (

using:
XMLElement )

TextStyleRange.markup (

using:
XMLElement )

WMF.placeXML (

using:
XMLElement )

WMF.markup (

using:
XMLElement )

Word.markup (

using:
XMLElement )

XMLElements.previousItem (

obj:
XMLElement )

XMLElements.nextItem (

obj:
XMLElement )

XMLRuleProcessor.startProcessingRuleSet (

initialElement:
XMLElement )

Returned by:

XMLElement XMLAttribute.convertToElement (
[located:
XMLElementLocation=ELEMENT_START ][, markupTag:
XMLTag]
)

XMLElement XMLElement .duplicate (

)

Array of XMLElement XMLElement .getElements (

)

XMLElement XMLElement .move (
to:
LocationOptions[, reference:
any]
)

XMLElement XMLElements.add (
markupTag:
any[, xmlContent:
any][, withProperties:
Object]
)

XMLElement XMLElements.anyItem (

)

Array of XMLElement XMLElements.everyItem (

)

XMLElement XMLElements.firstItem (

)

XMLElement XMLElements.item (
index:
any
)

XMLElement XMLElements.itemByID (
id:
number
)

XMLElement XMLElements.itemByName (
name:
string
)

Array of XMLElement XMLElements.itemByRange (
from:
any, to:
any
)

XMLElement XMLElements.lastItem (

)

XMLElement XMLElements.middleItem (

)

XMLElement XMLElements.nextItem (
obj:
XMLElement
)

XMLElement XMLElements.previousItem (
obj:
XMLElement
)

Leave a Comment

Previous post:

Next post: