I’m new to XFA and I’m having some trouble with navigating through a LiveCycle form with Aspose PDF for .NET.
I am trying to get/set some values that are buried several layers down into my form. Here’s what I have done so far: (C#)
Document doc = new Document(“E:\Aspose_In.pdf”);If I break I can what I think is the first XFA element, “xfa:datasets”. I see that datasets has 2 child nodes: “dd:dataDescription” and “xfa:data”. Repeating that process I can find the field that
XmlNode datasets = doc.Form.XFA.Datasets;
I’m looking for, “linktext”. I’ve tried to build a path several different ways but can’t seem to make it work. Here’s one way:
XmlNode fieldNode = datasets.SelectSingleNode("//datasets/data/MainReport/Page3/item/itemDetail/linktext");I used this format because I used the code under the “Reading XFA Fields” from the Tips and Tricks page and it gave me the “path” of MainReport/Page3/item/itemDetail/linktext, which I’ve already tried as well.
Eventually I need to be able to loop through the “item” to get each of the “linktext” values, but I can’t seem to get the “path” correct so putting an index in wouldn’t help.
In LC Designer I use(JS):
xfa.resolveNode(“MainReport.Page3.item.#subform.linktext”).rawValue;which works perfectly.
Back in C#, if I try and grab the first occurrence of “linktext” I get an “Object reference not set to an instance of an object” error. I assume this is because the syntax of my “path” is incorrect.
Can anyone help me out with this?