在 Acrobat Javascript 中从 XML 数据创建数组时遇到问题,如果可以的话请提供帮助
我有一个手动创建的数组,它已经可以工作,如下所示:
var PartsData = { 179: { ref:"",
partNum: "201-2007-C00-00",
descript: "System Monitor Card (Tracewell Only)",
cage: "39764",
qty: "1",
SMR: "XBOZZ",
UOC: "A" }};
现在上面的这个数组只是数组中的一个值,并且它工作正常。这是我尝试用来动态更改值的 XML。
<?xml version="1.0" encoding="utf-8"?>
<partsTables>
<partsList>
<part sheetNum="ta1">
<breakDownIndexNo>-1 </breakDownIndexNo>
<referenceDesg/>
<indent>20534220P01 </indent>
<description/>
<cage>TAC RI, GRADE-A SHOCK (TEC RACK), ALT P/N 72304-1</cage>
<qtyPerAssy>23991 </qtyPerAssy>
<smr>1 </smr>
<uoc>ADODD </uoc>
<blank/>
</part>
</partsList>
</partsTables>
我在 Acrobat 中解析得很好。现在我想让数组在使用这些值时为我工作。如果我有以下内容,它将起作用。
其中part.item(i).indent.value等于缩进节点的值等。
newArr = { 179: {
ref: part.item(i).referenceDesg.value,
partNum: part.item(i).indent.value,
descript: part.item(i).cage.value,
cage: part.item(i).qtyPerAssy.value,
qty: part.item(i).smr.value,
SMR: part.item(i).uoc.value,
UOC: part.item(i).blank.value}};
一旦我尝试使用直接part.item(i)来使breakDownIndexNo节点中的179值动态化.breakDownIndexNo.value 它不会编译。 Acrobat 使用 javascript,所以我不知道为什么我无法解析它。
我尝试从breakDownIndexNo 节点创建一个变量,并将其输入为字符串和整数。这将让它创建数组,但不会让我从数组中输出。 newArr[indexNum].partNum 给我“没有属性”,其中 newArr[179].partNum 如果我手动将索引号设置为 179 将打印出part.item(i).indent.value 的值。
如果你们有任何想法或答案,请告诉我。
I have a manually created array that already works example below:
var PartsData = { 179: { ref:"",
partNum: "201-2007-C00-00",
descript: "System Monitor Card (Tracewell Only)",
cage: "39764",
qty: "1",
SMR: "XBOZZ",
UOC: "A" }};
Now this array above is is just one value in the array and it works fine. Here is the XML that I am trying to use to dynamically change the values.
<?xml version="1.0" encoding="utf-8"?>
<partsTables>
<partsList>
<part sheetNum="ta1">
<breakDownIndexNo>-1 </breakDownIndexNo>
<referenceDesg/>
<indent>20534220P01 </indent>
<description/>
<cage>TAC RI, GRADE-A SHOCK (TEC RACK), ALT P/N 72304-1</cage>
<qtyPerAssy>23991 </qtyPerAssy>
<smr>1 </smr>
<uoc>ADODD </uoc>
<blank/>
</part>
</partsList>
</partsTables>
I have this parsing just fine in Acrobat. Now I want to make the array work for me in using these values. if I have the following below it will work.
Where part.item(i).indent.value equals the value of the indent node, etc.
newArr = { 179: {
ref: part.item(i).referenceDesg.value,
partNum: part.item(i).indent.value,
descript: part.item(i).cage.value,
cage: part.item(i).qtyPerAssy.value,
qty: part.item(i).smr.value,
SMR: part.item(i).uoc.value,
UOC: part.item(i).blank.value}};
As soon as I try to make the 179 value, which is in the breakDownIndexNo node, dynamic by using the direct part.item(i).breakDownIndexNo.value it will not compile. Acrobat is using javascript so I'm not sure why I can not get this to parse.
I have tried to create a variable out of the breakDownIndexNo node and typed it to both a String and an Integer. this will let it create the array but it will not let me output from the array. newArr[indexNum].partNum gives me "no properties" where newArr[179].partNum if I were to manually set the index number to 179 will print out the value of part.item(i).indent.value.
If any of you have an idea or an answer please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无论如何,我都不是 AS 专家,但这看起来不对:
字符串使用 ' 打开并使用 " 关闭,这在 JS 中不起作用
i am not an AS expert by any means, but this doesnt look right:
the string is opened using ' and closed using " which doesnt work in JS