Previous
Top
Next
XMLSpyDocumentEditor.GetAllowedElements
See also
Declaration:
GetAllowedElements
(
nAction
as
DOCEDElementActions
,
pStartElement
as
XMLData
,
pEndElement
as
XMLData
,
pElements
as
Variant
)
Description
GetAllowedElements() returns the allowed elements for the various actions specified by nAction. Valid values for nAction are:
k_ActionInsertAt = 0
k_ActionApply = 1
k_ActionRemoveSurr = 2
k_ActionAppend = 3
k_ActionInsertBefore = 4
JavaScript example:
function
GetAllowed()
{
var
objView = Application.ActiveDocument.DocEditView;
var
arrElements =
new
Array
(1);
var
objStart = objView.CurrentSelection.Start;
var
objEnd = objView.CurrentSelection.End;
var
strText;
strText = "valid elements at current selection:\n\n";
for
(
var
i = 1;i <= 4;i++) {
objPlugIn.GetAllowedElements(i,objStart,objEnd,arrElements);
strText = strText + ListArray(arrElements) + "------------------\n";
}
return
strText;
}
function
ListArray(arrIn)
{
var
strText = "";
if
(
typeof
(arrIn) == "object") {
for
(
var
i = 0;i <= (arrIn.length - 1);i++)
strText = strText + arrIn[i] + "\n";
}
return
strText;
}
VBScript example:
Sub
DisplayAllowed
dim
objView
set
objView = Application.ActiveDocument.DocEditView
dim
arrElements()
dim
objStart
dim
objEnd
set
objStart = objView.CurrentSelection.Start
set
objEnd = objView.CurrentSelection.End
dim
strText
strText = "valid elements at current selection:" &
chr
(13) &
chr
(13)
dim
i
For
i = 1
To
4
objView.GetAllowedElements i,objStart,objEnd,arrElements
strText = strText & ListArray(arrElements) & "---------------" &
chr
(13)
Next
msgbox
strText
End
Sub
Function
ListArray(arrIn)
dim
strText
If
IsArray
(arrIn)
Then
dim
i
For
i = 0
To
UBound
(arrIn)
strText = strText & arrIn(i) &
chr
(13)
Next
End
If
ListArray = strText
End
Function
Previous
Top
Next
© 2002
Altova