Adobe InDesign CS5.5 Server (7.5) Object Model JS: XMLElement

InDesign Server CS5.5

Class

XMLElement

 An XML element. Base Class: XMLItem

QuickLinks

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

Hierarchy

Document | XMLElement
XMLItem
XMLElement
Cell | Character | EPS | Event | EventListener | Graphic | Image | InsertionPoint | Line | MutationEvent | PDF | PICT | PageItem | Paragraph | Story | Table | Text | TextColumn | TextStyleRange | WMF | Word | XMLAttribute | XMLComment | XMLElement | XMLInstruction | XMLItem

Properties

PropertyTypeAccessDescription
cellsCells Cell readonlyA collection of table cells.
charactersCharacters Character readonlyA collection of characters.
contentsSpecialCharactersString r/wThe contents of the text. Can return: String or SpecialCharacters enumerator.
epssEPSs EPS readonlyA collection of EPS files.
eventListenersEventListeners EventListener readonlyA collection of event listeners.
eventsEvents Event readonlyA collection of events.
graphicsGraphics Graphic readonlyA collection of imported graphics in any graphic file format (vector, metafile, or bitmap).
idnumber readonlyThe unique ID of the XMLElement.
imagesImages Image readonlyA collection of bitmap images in any bitmap file format (including TIFF, JPEG, or GIF).
indexnumber readonlyThe index of the XMLElement within its containing object.
insertionPointsInsertionPoints InsertionPoint readonlyA collection of insertion points.
isValidbool readonlyReturns true if the object specifier resolves to valid objects.
linesLines Line readonlyA collection of lines.
markupTagString
XMLTag
r/wThe XML tag applied to the element. Can also accept: String.
pageItemsPageItems PageItem readonlyThe 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.
paragraphsParagraphs Paragraph readonlyA collection of paragraphs.
parentDocument
XMLElement
readonlyThe parent of the XMLElement (a Document or XMLElement).
parentStoryStory readonlyThe story that contains the text.
pdfsPDFs PDF readonlyA collection of PDF files.
pictsPICTs PICT readonlyA collection of PICT graphics.
propertiesObject r/wA property that allows setting of several properties at the same time.
storiesStories Story readonlyA collection of stories.
storyOffsetInsertionPoint readonlyThe insertion point before the table in the story containing the table.
tablesTables Table readonlyA collection of tables.
textColumnsTextColumns TextColumn readonlyA collection of text columns.
textStyleRangesTextStyleRanges TextStyleRange readonlyA collection of text style ranges.
textsTexts Text readonlyA collection of text objects.
wmfsWMFs WMF readonlyA collection of WMF graphics.
wordsWords Word readonlyA collection of words.
xmlAttributesXMLAttributes XMLAttribute readonlyA collection of XML attributes.
xmlCommentsXMLComments XMLComment readonlyA collection of XML comments.
xmlContentCell
Graphic
Movie
PageItem
Sound
Story
Table
Text
readonlyThe text content or page item referred to by the element. Can return: Text, Story, PageItem, Movie, Sound, Graphic, Table or Cell.
xmlElementsXMLElements XMLElement readonlyA collection of XML elements.
xmlInstructionsXMLInstructions XMLInstruction readonlyA collection of XML instructions.
xmlItemsXMLItems XMLItem readonlyA collection of XML items.

Methods

Instances

EventListener addEventListener (eventType: string, handler: varies[, captures: bool=false])
Adds an event listener.

ParameterTypeDescription
eventTypestringThe event type.
handlerFile
JavaScript Function
The event handler. Can accept: File or JavaScript Function.
capturesboolThis parameter is obsolete. (Optional) (default: false)

void applyCellStyle (using: varies[, clearingOverrides: bool=true])
Applies a cell style to the table cells associated with the XMLElement.

ParameterTypeDescription
usingCellStyle
String
The cell style to apply. Can accept: String or CellStyle.
clearingOverridesboolIf true, removes local formatting before applying the cell style. (Optional) (default: true)

void applyCharacterStyle (using: varies)
Applies the specified character style to the text content of the XMLElement.

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

void applyObjectStyle (using: varies[, clearingOverrides: bool=true][, clearingOverridesThroughRootObjectStyle: bool=false])
Applies an object style to the frame associated with the XMLElement.

ParameterTypeDescription
usingObjectStyle
String
The object style to apply. Can accept: String or ObjectStyle.
clearingOverridesboolIf true, removes local formatting before applying the object style. (Optional) (default: true)
clearingOverridesThroughRootObjectStyleboolIf true, clears unchecked category attributes through the root style. (Optional) (default: false)

void applyParagraphStyle (using: varies[, clearingOverrides: bool=true])
Applies the specified paragraph style to the text content of the XMLElement.

ParameterTypeDescription
usingParagraphStyle
String
The paragraph style to apply. Can accept: String or ParagraphStyle.
clearingOverridesboolIf true, clears any attributes before applying the style. (Optional) (default: true)

void applyTableStyle (using: varies[, clearingOverrides: bool=true])
Applies a table style to the table associated with the XMLElement.

ParameterTypeDescription
usingString
TableStyle
The table style to apply. Can accept: String or TableStyle.
clearingOverridesboolIf true, removes local formatting before applying the table style. (Optional) (default: true)

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

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

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

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

Array of Text changeTransliterate ([reverseOrder: bool])
Finds text that matches the find character type value and replaces the text with the change character type value.

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

Table convertElementToTable (rowTag: XMLTag, cellTag: XMLTag)
Converts the content of the XML element to a table.

ParameterTypeDescription
rowTagXMLTagThe XML tag that indicates a table row.
cellTagXMLTagThe XML tag that indicates a table cell.

XMLAttribute convertToAttribute ([using: string])
Converts the XMLElement to an attribute of its parent element.

ParameterTypeDescription
usingstringThe name to give to the new attribute. (Optional)

XMLElement duplicate ()
Duplicates the XMLElement.

Array of XMLItem evaluateXPathExpression (using: string[, prefixMappingTable: Array of varies])
Evaluates an XPath expression starting at this XML element in the structure.

ParameterTypeDescription
usingstringThe XPath expression.
prefixMappingTableArray of :
Array of Arrays of 2 Strings
The namespace mapping table. Can accept: Array of Arrays of 2 Strings. (Optional)

void exportFile (format: varies, to: File[, using: PDFExportPreset][, versionComments: string][, forceSave: bool=false])
Exports the object(s) to a file.

ParameterTypeDescription
formatExportFormat
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.
toFileThe path to the export file.
usingPDFExportPresetThe export style. (Optional)
versionCommentsstringThe comment for this version. (Optional)
forceSaveboolIf true, forcibly saves a version. (Optional) (default: false)

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

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

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

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

Array of Text findTransliterate ([reverseOrder: bool])
Finds text that matches the find character type value.

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

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

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

ParameterTypeDescription
fromFileThe XML file.

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

ParameterTypeDescription
usingSpecialCharacters
String
The text to be inserted. Can accept: String or SpecialCharacters enumerator.
positionXMLElementPosition:
XMLElementPosition.BEFORE_ELEMENT
XMLElementPosition.AFTER_ELEMENT
XMLElementPosition.ELEMENT_START
XMLElementPosition.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: varies)
Associates the object with the specified XML element while preserving existing content.

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

XMLElement move (to: LocationOptions[, reference: varies])
Moves the element to the specified location.

ParameterTypeDescription
toLocationOptions:
LocationOptions.BEFORE
LocationOptions.AFTER
LocationOptions.AT_END
LocationOptions.AT_BEGINNING
LocationOptions.UNKNOWN
The location in relation to the reference object or within the containing object.
referenceText
XMLItem
The reference object. Note: Required when the to parameter specifies before or after. . Can accept: XMLItem or Text. (Optional)

PageItem placeIntoCopy (on: varies, placePoint: Array of Measurement Unit (Number or String), copyItem: PageItem[, retainExistingFrame: bool=false])
Associates the XML element with a copy of a page item.

ParameterTypeDescription
onMasterSpread
Page
Spread
The page or spread on which to create the new page item. Can accept: Spread, Page or MasterSpread.
placePointArray of Measurement Unit (Number or String)The page coordinates of the top left corner of the page item, in the format [y1, x1]
copyItemPageItemThe page item to copy.
retainExistingFrameboolIf 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, geometricBounds: Array of Measurement Unit (Number or 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.

ParameterTypeDescription
onMasterSpread
Page
Spread
The page or spread on which to create the new page item. Can accept: Spread, Page or MasterSpread.
geometricBoundsArray of Measurement Unit (Number or String)The bounds of the page item excluding the stroke width, in the format [y1, x1, y2, x2].

PageItem placeIntoInlineCopy (copyItem: PageItem[, retainExistingFrame: bool=false])
Associates an existing page item with the XML element and places it into an inline frame.

ParameterTypeDescription
copyItemPageItemThe page item to copy.
retainExistingFrameboolIf true, moves the existing page item. If false, moves a copy of the page item. (Optional) (default: false)

PageItem placeIntoInlineFrame (dimensions: Array of Measurement Unit (Number or String))
Places an XML element into an inline frame.

ParameterTypeDescription
dimensionsArray of Measurement Unit (Number or String)The dimensions of the inline frame in the format [width, height].

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

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

void remove ()
Deletes the XMLElement.

bool removeEventListener (eventType: string, handler: varies[, captures: bool=false])
Removes the event listener.

ParameterTypeDescription
eventTypestringThe registered event type.
handlerFile
JavaScript Function
The registered event handler. Can accept: File or JavaScript Function.
capturesboolThis parameter is obsolete. (Optional) (default: false)

PageItem setContent (using: string[, relativeBasePath: string])
Replaces the content of XML element with content imported from a file.

ParameterTypeDescription
usingstringThe file path to the import file.
relativeBasePathstringBase path used to resolve relative paths. (Optional)

Asset store (using: Library[, withProperties: Object])
Stores the object in the specified library.

ParameterTypeDescription
usingLibraryThe library in which to store the object.
withPropertiesObjectInitial 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 ValidationError validate ([maximumErrors: number=250])
Validates the element against a DTD.

ParameterTypeDescription
maximumErrorsnumberThe maximum number of validation errors to generate. (Optional) (default: 250)

Element of

Story.parent

ValidationError.element

XMLAttribute.parent

XMLComment.parent

XMLElement.parent

XMLInstruction.parent

XMLItem.parent

Used in:

void Button.markup (using: XMLElement)

void Button.placeXML (using: XMLElement)

void Character.markup (using: XMLElement)

void EPS.markup (using: XMLElement)

void EPS.placeXML (using: XMLElement)

void EPSText.markup (using: XMLElement)

void EPSText.placeXML (using: XMLElement)

void FormField.markup (using: XMLElement)

void FormField.placeXML (using: XMLElement)

void Graphic.markup (using: XMLElement)

void Graphic.placeXML (using: XMLElement)

void GraphicLine.markup (using: XMLElement)

void GraphicLine.placeXML (using: XMLElement)

void Group.markup (using: XMLElement)

void Group.placeXML (using: XMLElement)

void Image.markup (using: XMLElement)

void Image.placeXML (using: XMLElement)

void ImportedPage.markup (using: XMLElement)

void ImportedPage.placeXML (using: XMLElement)

void InsertionPoint.markup (using: XMLElement)

void Line.markup (using: XMLElement)

void MediaItem.markup (using: XMLElement)

void MediaItem.placeXML (using: XMLElement)

void Movie.markup (using: XMLElement)

void Movie.placeXML (using: XMLElement)

void MultiStateObject.markup (using: XMLElement)

void MultiStateObject.placeXML (using: XMLElement)

void Oval.markup (using: XMLElement)

void Oval.placeXML (using: XMLElement)

void PDF.markup (using: XMLElement)

void PDF.placeXML (using: XMLElement)

void PICT.markup (using: XMLElement)

void PICT.placeXML (using: XMLElement)

PageItem Page.placeXML (using: XMLElement, placePoint: Array of Measurement Unit (Number or String)[, autoflowing: bool=false])

void PageItem.markup (using: XMLElement)

void PageItem.placeXML (using: XMLElement)

void Paragraph.markup (using: XMLElement)

void Polygon.markup (using: XMLElement)

void Polygon.placeXML (using: XMLElement)

void Rectangle.markup (using: XMLElement)

void Rectangle.placeXML (using: XMLElement)

void Sound.markup (using: XMLElement)

void Sound.placeXML (using: XMLElement)

void SplineItem.markup (using: XMLElement)

void SplineItem.placeXML (using: XMLElement)

PageItem Spread.placeXML (using: XMLElement, placePoint: Array of Measurement Unit (Number or String)[, autoflowing: bool=false])

void Story.markup (using: XMLElement)

void Story.placeXML (using: XMLElement)

void Table.markup (using: XMLElement)

void Text.markup (using: XMLElement)

void TextColumn.markup (using: XMLElement)

void TextFrame.markup (using: XMLElement)

void TextFrame.placeXML (using: XMLElement)

void TextStyleRange.markup (using: XMLElement)

void WMF.markup (using: XMLElement)

void WMF.placeXML (using: XMLElement)

void Word.markup (using: XMLElement)

XMLElement XMLElements.nextItem (obj: XMLElement)

XMLElement XMLElements.previousItem (obj: XMLElement)

XMLRuleMatchData XMLRuleProcessor.startProcessingRuleSet (initialElement: XMLElement)

Return

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

XMLElement XMLElement.duplicate ()

Array of XMLElement XMLElement.getElements ()

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

XMLElement XMLElements.[] (index: number)

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

XMLElement XMLElements.anyItem ()

Array of XMLElement XMLElements.everyItem ()

XMLElement XMLElements.firstItem ()

XMLElement XMLElements.item (index: varies)

XMLElement XMLElements.itemByID (id: number)

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

XMLElement XMLElements.lastItem ()

XMLElement XMLElements.middleItem ()

XMLElement XMLElements.nextItem (obj: XMLElement)

XMLElement XMLElements.previousItem (obj: XMLElement)

Jongware, 28-Apr-2012 v3.0.3iContents :: Index