Skip to main content
Participant
August 26, 2014
Question

InvalidObject understanding

  • August 26, 2014
  • 0 replies
  • 346 views

Hi,

I encounter an issue with custom objects, I try to find Element with the function Find(). When I search Xref, row or known elements I get a valid Object. If a search for a custom element like here "RuleTemplate" I get an InvalidObject. Here is my code :

var searchPropValRuleTemplate = AllocatePropVals(1) // allocate array of 1 PropVal

searchPropValRuleTemplate[0].propIdent.num = Constants.FS_FindElementTag // element search mode

searchPropValRuleTemplate[0].propVal.valType = Constants.FT_Strings; // property of type Strings (array of string)

searchPropValRuleTemplate[0].propVal.ssval.length = Constants.FV_NumFindElementItems; // required

searchPropValRuleTemplate[0].propVal.ssval[Constants.FV_FindElemTag] = "RuleTemplate"; // element to find

searchPropValRuleTemplate[0].propVal.ssval[Constants.FV_FindAttrName]= ""; // required even if empty

searchPropValRuleTemplate[0].propVal.ssval[Constants.FV_FindAttrValue] = ""; // required even if empty

var startLoc = new TextLoc(currentDoc.FirstPgfInDoc, 0);

var trFoundInDoc = currentDoc.Find(startLoc, searchPropValRuleTemplate);

var currentSGMLTag = currentDoc.ElementSelection.beg.child.Object;

var firstUidSGMLTag = currentSGMLTag.Unique;

In this sample currentSGMLTag is an InvalidObject, if I change the propval FindElemTag to "XRef" by example I get my XRef valid Object.

Can anyone help me please ? I'm missing something.

This topic has been closed for replies.