how can I import/replace(sed) these values from input file
cellIdentity="461"
cellIdentity="465"
cellIdentity="468"
cellIdentity="462"
cellIdentity="466"
cellIdentity="469"
cellIdentity="463"
cellIdentity="467"
cellIdentity="460"
. and put them to this file by order, replacing cellIdentity in the file below:
sectorNumber="1"
>
<Cell
cellNumber="1"
cellCreated="YES"
cellIdentity="461"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="2"
cellCreated="YES"
cellIdentity="465"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="3"
cellCreated="YES"
cellIdentity="468"
cellRange="35000"
baseBandPoolId="1"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
</Sector>
<Sector
sectorNumber="2"
>
<Cell
cellNumber="1"
cellCreated="YES"
cellIdentity="462"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="2"
cellCreated="YES"
cellIdentity="466"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="3"
cellCreated="YES"
cellIdentity="469"
cellRange="35000"
baseBandPoolId="1"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
</Sector>
<Sector
sectorNumber="3"
>
<Cell
cellNumber="1"
cellCreated="YES"
cellIdentity="463"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="2"
cellCreated="YES"
cellIdentity="467"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="3"
cellCreated="YES"
cellIdentity="460"
cellRange="35000"
baseBandPoolId="1"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
</Sector>
I'm new at this programing, so any help is appriciate.
I use /bin/csh.
Thanks for any help
They already look in order to me. But I am guessing you want to do something like this:
awk 'NR==FNR{a[NR]=$(NF-1);next}/cellIdentity/{$(NF-1)=a[++i]}1' FS='"' OFS='"' inputFile bigFile
Using awk (your input file is good format, you can replace the match line directly)
awk 'NR==FNR{a[FNR]=$0;next}/cellIdentity/{$0=a[++i]}1' input largefile
Related
The datatable displays entries that I intend to be able to edit. In order to do so, I use a commandlink to open a dialog box. setPropertyActionListener sets the CostingType object that should be able to be modified from within the dialog box. However, the dialog box isn't able to get the object's variables or save them. Instead, it shows an empty object and clicking on the edit button(after keying in fields) shows the requiredMessage warnings instead. checkEdit() (which exists solely for debug purposes) isn't being called either.
HTML:
<h:form id="costingTypeForm" >
<p:tabView id="tabView">
<p:tab id="tab1" title="Costing Type">
<h:form id="costingTypeForm" >
<p:tabView id="tabView">
<p:tab id="tab1" title="Costing Type">
<p:dataTable
id="costingTypeTable"
value="#{costingTypeBean.costingTypeList}"
var="costingType"
rows="#{psmsProp['psms.dataTable.rows']}"
paginator="true"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {CurrentPageReport}"
rowsPerPageTemplate="#{psmsProp['psms.dataTable.rowsPerPage']}"
currentPageReportTemplate="Displaying {startRecord}-{endRecord} out of {totalRecords}"
style="width:80%; text-align:center;"
sortBy="#{costingType.name}"
sortMode="single" >
<f:facet name="header">
Costing Type
<p:commandButton
value="Add"
oncomplete="PF('addCostingTypeDialog').show()"
update="costingTypeForm:tabView:addCostingTypeForm"
icon="ui-icon-plus"
style="float:right;" />
<div style="clear:both" />
</f:facet>
<p:column sortBy="#{costingType.name}"
filterBy="#{costingType.name}"
filterMatchMode="contains"
filterFunction="#{filterUtil.containsFilter}"
filterStyle="width:80%;"
headerText="Name">
<p:outputLabel id = "name" value="#{costingType.name}" />
</p:column>
<p:column headerText="Description">
<p:outputLabel id = "description" value="#{costingType.nameDesc}" />
</p:column>
<p:column headerText="Budgeted">
<p:outputLabel value="Yes" rendered="#{costingType.budget}" />
<p:outputLabel value="No" rendered="#{not costingType.budget}" />
</p:column>
<p:column headerText="Deleted">
<p:outputLabel value="Yes" rendered="#{costingType.del}" />
<p:outputLabel value="No" rendered="#{not costingType.del}" />
</p:column>
<p:column>
<p:commandLink
oncomplete="PF('editCostingTypeDialog').show()"
update=":costingTypeForm:tabView:editCostingTypeForm"
value="Edit" action="#{costingTypeBean.checkEdit}">
<f:setPropertyActionListener target="#{costingTypeBean.editCostingType}" value="#{costingType}"/>
</p:commandLink>
</p:column>
</p:dataTable>
<p:dialog
header="Edit Costing Type"
widgetVar="editCostingTypeDialog"
modal="true"
showEffect="slide"
hideEffect="fade"
resizable="false"
closable="false">
<p:outputPanel id="editCostingTypeForm">
<p:panelGrid columns="2" cellpadding="5" rendered="#{not empty costingTypeBean.editCostingType}">
<h:panelGroup>
<p:outputLabel value="Name:" />
<p:outputLabel value="*" style="color:red;" />
</h:panelGroup>
<p:inputText value="#{costingTypeBean.editCostingType.name}" required="true" requiredMessage="Name is required" />
<h:panelGroup>
<p:outputLabel value="Description:" />
<p:outputLabel value="*" style="color:red;" />
</h:panelGroup>
<p:inputText value="#{costingTypeBean.editCostingType.nameDesc}" required="true" requiredMessage="Description is required" />
<p:outputLabel value="Budgeted:" />
<p:selectOneMenu value="#{costingTypeBean.editCostingType.budget}">
<f:selectItem itemValue="true" itemLabel="Yes" />
<f:selectItem itemValue="false" itemLabel="No" />
</p:selectOneMenu>
<h:outputLabel value="Deleted:" />
<p:selectOneMenu value="#{costingTypeBean.editCostingType.del}">
<f:selectItem itemValue="true" itemLabel="Yes" />
<f:selectItem itemValue="false" itemLabel="No" />
</p:selectOneMenu>
</p:panelGrid>
<p:commandButton
value="Cancel"
actionListener="#{costingTypeBean.cancelChange}"
oncomplete="PF('editCostingTypeDialog').hide();"
icon="ui-icon-close"
style="float:right;margin-top:10px;margin-bottom:10px;" />
<p:commandButton
value="Edit"
actionListener="#{costingTypeBean.updateCostingType}"
oncomplete="if(args.update) PF('editCostingTypeDialog').hide();"
update=":costingTypeForm:messages #(.ui-datatable)"
icon="ui-icon-disk"
style="float:right;margin-top:10px;margin-right:10px;margin-bottom:10px;" />
</p:outputPanel>
</p:dialog>
<p:dialog
header="Add New CostingType"
widgetVar="addCostingTypeDialog"
modal="true"
showEffect="slide"
hideEffect="fade"
resizable="false"
closable="false">
<p:outputPanel id="addCostingTypeForm">
<p:panelGrid columns="2" cellpadding="5">
<h:panelGroup>
<p:outputLabel value="Name" />
<p:outputLabel value="*" style="color:red;" />
</h:panelGroup>
<p:inputText value="#{costingTypeBean.name}" required="true" requiredMessage="Enter name" />
<h:panelGroup>
<p:outputLabel value="Description:" />
<p:outputLabel value="*" style="color:red;" />
</h:panelGroup>
<p:inputText value="#{costingTypeBean.nameDesc}" required="true" requiredMessage="Enter Engine Type" />
<h:panelGroup>
<h:outputLabel value="Budgeted:" />
<p:outputLabel value="*" style="color:red;" />
</h:panelGroup>
<p:selectOneRadio value="#{costingTypeBean.budgeted}">
<f:selectItem itemValue="true" itemLabel="Yes" />
<f:selectItem itemValue="false" itemLabel="No" />
</p:selectOneRadio>
<h:panelGroup>
<h:outputLabel value="Deleted:" />
<p:outputLabel value="*" style="color:red;" />
</h:panelGroup>
<p:selectOneRadio value="#{costingTypeBean.deleted}">
<f:selectItem itemValue="true" itemLabel="Yes" />
<f:selectItem itemValue="false" itemLabel="No" />
</p:selectOneRadio>
</p:panelGrid>
<p:commandButton
value="Cancel"
actionListener="#{costingTypeBean.cancelChange}"
oncomplete="PF('addCostingTypeDialog').hide();"
icon="ui-icon-close"
style="float:right;margin-top:10px;margin-bottom:10px;" />
<p:commandButton
value="Save"
actionListener="#{costingTypeBean.addCostingType}"
oncomplete="if(args.add) PF('addCostingTypeDialog').hide(); else PF('addCostingTypeDialog').show();"
update="#form #(.ui-datatable)"
icon="ui-icon-disk"
style="float:right;margin-top:10px;margin-right:10px;margin-bottom:10px;" />
</p:outputPanel>
</p:dialog>
</p:tab>
</p:tabView>
</h:form>
Backing bean:
#Component
#Scope("view")
public class CostingTypeBean{
private static final Logger LOGGER = LoggerFactory.getLogger(CostingTypeBean.class);
private long costingTypeId;
private boolean budgeted, deleted;
private String name, nameDesc;
private CostingType costingType;
private CostingType editCostingType;
private List<CostingType> costingTypeList;
#Autowired
private CostingTypeService costingTypeService;
/*
getters and setters
*/
// dialog edit
public void updateCostingType(ActionEvent event) {
RequestContext context = RequestContext.getCurrentInstance();
if(editCostingType!=null) {
costingTypeService.saveOrUpdate(editCostingType);
context.addCallbackParam("update", true);
}
else
context.addCallbackParam("update", false);
}
//debug method
public void checkEdit() {
LOGGER.debug("Edit listener");
ViewUtil.showInfo("Edit dialog triggered");
System.out.println("Edit listener");
}
What should I do to get editCostingTypeDialog to reflect the fields of of the CostingType object and be able to read the values keyed in the input text areas?
Your code works just fine. All I had to do was to modify some of the update= attributes (as I was getting exceptions about destination components not being found). After populating with some random data and using your above code I get the following;
I tested with both PrimeFaces 6.1 and 6.2 on Mojarra 2.3.3.99. The backing bean callback for the edit button in the dialog is also being called properly.
So the next thing to check - which JSF implementation are you using? Is it Mojarra or MyFaces ? which version ? Maybe you are hitting upon some bug in your specific implementation. There is absolutely nothing wrong with your code.
While I'm at it, I might as well post the complete code (including my modifications);
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Costing type Test</title>
</h:head>
<h:body>
<h:form id="costingTypeForm" >
<p:tabView id="tabView">
<p:tab id="tab1" title="Costing Type">
<p:dataTable
id="costingTypeTable"
value="#{costingTypeBean.costingTypeList}"
var="costingType"
paginator="true"
style="width:80%; text-align:center;"
sortMode="single" >
<f:facet name="header">
Costing Type
<p:commandButton value="Add" oncomplete="PF('addCostingTypeDialog').show()" update="#form" icon="ui-icon-plus" style="float:right;" />
<div style="clear:both" />
</f:facet>
<p:column sortBy="#{costingType.name}"
filterBy="#{costingType.name}"
filterMatchMode="contains"
filterFunction="#{filterUtil.containsFilter}"
filterStyle="width:80%;"
headerText="Name">
<p:outputLabel id = "name" value="#{costingType.name}" />
</p:column>
<p:column headerText="Description">
<p:outputLabel id = "description" value="#{costingType.nameDesc}" />
</p:column>
<p:column headerText="Budgeted">
<p:outputLabel value="Yes" rendered="#{costingType.budget}" />
<p:outputLabel value="No" rendered="#{not costingType.budget}" />
</p:column>
<p:column headerText="Deleted">
<p:outputLabel value="Yes" rendered="#{costingType.del}" />
<p:outputLabel value="No" rendered="#{not costingType.del}" />
</p:column>
<p:column>
<p:commandLink
oncomplete="PF('editCostingTypeDialog').show()"
update=":costingTypeForm:tabView:editCostingTypeForm"
value="Edit" action="#{costingTypeBean.checkEdit}">
<f:setPropertyActionListener target="#{costingTypeBean.editCostingType}" value="#{costingType}"/>
</p:commandLink>
</p:column>
</p:dataTable>
<p:dialog
header="Edit Costing Type"
widgetVar="editCostingTypeDialog"
modal="true"
showEffect="slide"
hideEffect="fade"
resizable="false"
closable="false">
<p:outputPanel id="editCostingTypeForm">
<p:panelGrid columns="2" rendered="#{not empty costingTypeBean.editCostingType}">
<h:panelGroup>
<p:outputLabel value="Name:" />
<p:outputLabel value="*" style="color:red;" />
</h:panelGroup>
<p:inputText value="#{costingTypeBean.editCostingType.name}" required="true" requiredMessage="Name is required" />
<h:panelGroup>
<p:outputLabel value="Description:" />
<p:outputLabel value="*" style="color:red;" />
</h:panelGroup>
<p:inputText value="#{costingTypeBean.editCostingType.nameDesc}" required="true" requiredMessage="Description is required" />
<p:outputLabel value="Budgeted:" />
<p:selectOneMenu value="#{costingTypeBean.editCostingType.budget}">
<f:selectItem itemValue="true" itemLabel="Yes" />
<f:selectItem itemValue="false" itemLabel="No" />
</p:selectOneMenu>
<h:outputLabel value="Deleted:" />
<p:selectOneMenu value="#{costingTypeBean.editCostingType.del}">
<f:selectItem itemValue="true" itemLabel="Yes" />
<f:selectItem itemValue="false" itemLabel="No" />
</p:selectOneMenu>
</p:panelGrid>
<p:commandButton
value="Cancel"
actionListener="#{costingTypeBean.cancelChange}"
oncomplete="PF('editCostingTypeDialog').hide();"
icon="ui-icon-close"
style="float:right;margin-top:10px;margin-bottom:10px;" />
<p:commandButton
value="Edit"
actionListener="#{costingTypeBean.updateCostingType}"
oncomplete="if(args.update) PF('editCostingTypeDialog').hide();"
update="#form"
icon="ui-icon-disk"
style="float:right;margin-top:10px;margin-right:10px;margin-bottom:10px;" />
</p:outputPanel>
</p:dialog>
</p:tab>
</p:tabView>
</h:form>
</h:body>
</html>
And here is the backing bean (example uses Lombok and Apache Commons);
#Data
#Named
#ViewScoped
public class CostingTypeBean implements Serializable {
private CostingType costingType;
private CostingType editCostingType;
private List<CostingType> costingTypeList;
#PostConstruct
private void init() {
costingTypeList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
final String name = RandomStringUtils.randomAlphanumeric(10);
final String nameDesc = RandomStringUtils.randomAlphanumeric(10);
final boolean budget = RandomUtils.nextBoolean();
final boolean del = RandomUtils.nextBoolean();
costingTypeList.add(new CostingType(name, nameDesc, budget, del));
}
}
public void updateCostingType(ActionEvent event) {
System.out.println("update!");
}
public void checkEdit() {
System.out.println("Edit listener");
}
public void cancelChange() {
System.out.println("Cancel");
}
#Data
#AllArgsConstructor
public class CostingType {
private String name;
private String nameDesc;
private boolean budget;
private boolean del;
}
}
Hopefully this can be of some help.
It's a bug in PrimeFaces (I think).
I searched with many tests in a minimal test application. It's not possible to use following constellation:
<p:dataTable value="#{bean.list}" var="myVar".....
<p:ajax event="rowSelect" partialSubmit="true" process="#this" listener="#{bean.doWork(myVar)}"/>
bean.doWork() will always be called with a null pointer.
Glassfish 4.1.1
PrimeFaces 6.2
I think your problem is the same.
I want to display the total amount spilttup for each day. I tried with below code .functx:next-day function is used for setting the date filed.
Input
StartDate="04-12-2017"
NoDays = 6
Price=15540
But i want to show the result as shown below. Is there any other function is requird to set the date field value.
Current output:
<Night>
<Price Amount="2590" NightDate="2017-12-05" />
<Price Amount="2590" NightDate="2017-12-06" />
<Price Amount="2590" NightDate="2017-12-07" />
<Price Amount="2590" NightDate="2017-12-08" />
<Price Amount="2590" NightDate="2017-12-09" />
<Price Amount="2590" NightDate="2017-12-10" />
</Night>
Expected Output:
<Night>
<Price Amount="2590" NightDate="2017-12-04" />
<Price Amount="2590" NightDate="2017-12-05" />
<Price Amount="2590" NightDate="2017-12-06" />
<Price Amount="2590" NightDate="2017-12-07" />
<Price Amount="2590" NightDate="2017-12-08" />
<Price Amount="2590" NightDate="2017-12-09" />
</Night>
Currently used Logic:
<Night>
<xsl:for-each select="1 to $NoDays">
<Price>
<xsl:attribute name="Amount">
<xsl:value-of select="$Price div $NoDays"/>
</xsl:attribute>
<xsl:attribute name="NightDate">
<xsl:value-of select="functx:next-
day(xs:date($StartDate),position())"/>
</xsl:attribute>
</Price>
</xsl:for-each>
I think you simply want
<xsl:variable name="NoDays" select="6"/>
<xsl:variable name="Price" select="15540"/>
<xsl:variable name="StartDate">04-12-2017</xsl:variable>
<xsl:variable name="date" as="xs:date"
select="xs:date(replace($StartDate,
'([0-9]{2})-([0-9]{2})-([0-9]{4})',
'$3-$2-$1'))"/>
<xsl:for-each select="0 to $NoDays - 1">
<Price Amount="{$Price div $NoDays}"
NightDate="{$date + xs:dayTimeDuration('P1D') * .}"/>
</xsl:for-each>
which exploits that you can multiply a duration with an integer and add it to a date.
Online sample at http://xsltransform.net/bEzjRKT
Magento 2 related Problem:
The header.phtml gets included but the purchase.phtml doesn't and we can't find the issue why. This bug only appears on our success page
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="head.additional">
<block class="Anowave\Ec\Block\Track" name="ec_header" as="ec_header" template="header.phtml" />
<block class="Anowave\Ec\Block\Track" name="ec_purchase" as="ec_purchase" template="purchase.phtml" >
<block class="Anowave\Ec\Block\Track" name="ec_datalayer" as="ec_datalayer" template="datalayer.phtml" />
<block class="Anowave\Ec\Block\Track" name="ec_impressions" as="ec_impressions" template="impression.phtml" />
<block class="Anowave\Ec\Block\Track" name="ec_search" as="ec_search" template="search.phtml" />
<block class="Anowave\Ec\Block\Track" name="ec_detail" as="ec_detail" template="detail.phtml" />
</block>
</referenceBlock>
<referenceContainer name="after.body.start">
<block class="Anowave\Ec\Block\Track" name="ec_noscript" as="ec_noscript" template="noscript.phtml" />
</referenceContainer>
<referenceContainer name="before.body.end">
<block class="Anowave\Ec\Block\Track" name="ec_events" as="ec_events" template="events.phtml" />
<block class="Anowave\Ec\Block\Track" name="ec_promotions" as="ec_promotions" template="promotions.phtml" />
<block class="Anowave\Ec\Block\Track" name="ec_footer" as="ec_footer" template="footer.phtml" />
</referenceContainer>
</body>
</page>
Looks like you want call templates in a template. Try insert the code below in your purchase.phtml:
include ($block->getTemplateFile('Anowave_ec::search.phtml'));
I used acroFields.GetTranslatedFieldName() to get the next fieldnames from the pdf:
topmostSubform[0].Page1[0].CheckBox2A[0]
topmostSubform[0].Page1[0].CheckBox2A[1]
topmostSubform[0].Page2[0].CheckBox2A[0]
topmostSubform[0].Page2[0].CheckBox2A[1]
topmostSubform[0].Page3[0].CheckBox2A[0]
topmostSubform[0].Page3[0].CheckBox2A[1]
I use the next line of code to fill CheckBox2A[0] on the second page.
fields.SetField("topmostSubform[0].Page2[0].CheckBox2A[0]", "1")
Instead of CheckBox2A[0] on the second page, CheckBox2A[0] on the first page gets checked.
iTextSharp (and also iText for Java, tested here) does not correctly associate the reference derived from the XFA template structure
topmostSubform[0].Page2[0].CheckBox2A[0]
with the matching entry in the one XFA dataset:
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" >
<xfa:data >
<topmostSubform >
<!-- vvv the incorrect match by iText -->
<CheckBox2A >0</CheckBox2A >
<!-- ^^^ the incorrect match by iText -->
<CheckBox2A >0</CheckBox2A >
<CheckBox2B >0</CheckBox2B >
<CheckBox2B >0</CheckBox2B >
<Voorletters />
<Achternaam />
<CheckBox2C >0</CheckBox2C >
<CheckBox2C >0</CheckBox2C >
<DatumDag />
<DatumMaand />
<DatumJaar />
<TextField1 />
<HuisNrTekst5 />
<HuisNrNummer5 />
<Straat />
<PostcodeNr1c />
<PostcodeAlpha1c />
<Plaats />
<HuisNrTekst5 />
<HuisNrNummer5 />
<TextField1 />
<PostcodeNr1c />
<PostcodeAlpha1c />
<Plaats />
<TextField1 />
<CheckBox2D >0</CheckBox2D >
<CheckBox2D >0</CheckBox2D >
<IBANREKC_1 />
<IBANREKB_1 />
<IBANREKA_1 />
<IBAN_1 />
<BurgerserviceNr />
<Voorletters />
<Achternaam />
<CheckBox2E >0</CheckBox2E >
<CheckBox2E >0</CheckBox2E >
<HuisNrTekst5 />
<HuisNrNummer5 />
<Straat />
<PostcodeNr1c />
<PostcodeAlpha1c />
<Plaats />
<DatumDag />
<DatumMaand />
<DatumJaar />
<IBANREKC_2 />
<IBANREKB_2 />
<IBANREKA_2 />
<IBAN_2 />
<Telefoon />
<!-- vvv the correct match -->
<CheckBox2A >0</CheckBox2A >
<!-- ^^^ the correct match -->
<CheckBox2A >0</CheckBox2A >
<CheckBox2B >0</CheckBox2B >
<CheckBox2B >0</CheckBox2B >
<IBANREKC_1 />
<IBANREKB_1 />
<IBANREKA_1 />
<IBAN_1 />
<CheckBox2C >0</CheckBox2C >
<CheckBox2C >0</CheckBox2C >
<TextField1 />
<TextField1 />
<CheckBox2D >0</CheckBox2D >
<CheckBox2D >0</CheckBox2D >
<Telefoon />
<CheckBox2E >0</CheckBox2E >
<CheckBox2E >0</CheckBox2E >
<CheckBox2F >0</CheckBox2F >
<CheckBox2F >0</CheckBox2F >
<TextField1 />
<TextField1 />
<CheckBox2G >0</CheckBox2G >
<CheckBox2G >0</CheckBox2G >
<CheckBox3B >0</CheckBox3B >
<CheckBox3B >0</CheckBox3B >
<CheckBox3B >0</CheckBox3B >
<IBAN_1E_01 />
<IBAN_1D_01 />
<IBAN_1C_01 />
<IBAN_1A_01 />
<IBAN_1B_01 />
<IBANREKC_1 />
<IBANREKB_1 />
<IBANREKA_1 />
<IBAN_1 />
<IBAN_1E_02 />
<IBAN_1D_02 />
<IBAN_1C_02 />
<IBAN_1B_02 />
<IBAN_1A_02 />
<CheckBox3D >0</CheckBox3D >
<CheckBox3D >0</CheckBox3D >
<CheckBox3D >0</CheckBox3D >
<CheckBox3A >0</CheckBox3A >
<CheckBox3A >0</CheckBox3A >
<CheckBox3A >0</CheckBox3A >
<CheckBox2A >0</CheckBox2A >
<CheckBox2A >0</CheckBox2A >
<CheckBox3B >0</CheckBox3B >
<CheckBox3B >0</CheckBox3B >
<CheckBox3B >0</CheckBox3B >
<DatumDag />
<DatumMaand />
<DatumJaar />
<TextField1 />
<DatumDag />
<DatumMaand />
<DatumJaar />
<TextField1 />
<Telefoon />
</topmostSubform >
</xfa:data >
</xfa:datasets >
Thus, the wrong dataset element is changed. I'm afraid this has to be looked into by iText development, I have no fix at hand.
You might be in luck, though: The form in your document actually is a hybrid with both an AcroForm and an XFA representation. During your fields.SetField call iText attempts to set the value in both representations, and indeed, in the AcroForm representation it sets the correct one.
Thus, if the result PDF is not required to carry that XFA structure anymore, you can simply drop the XFA structure:
using (var pdfReader = new PdfReader(file))
using (FileStream output = new FileStream(outputFilePath, FileMode.Create, FileAccess.Write))
using (PdfStamper pdfStamper = new PdfStamper(pdfReader, output))
{
AcroFields fields = pdfStamper.AcroFields;
fields.SetField("topmostSubform[0].Page2[0].CheckBox2A[0]", "1");
fields.RemoveXfa();
}
Doing that you get the tick on page 2:
I am a beginner in file fuzzing.I want to fuzz Adrenalin Player 2.2.5.3 with peach 3 and during compile got a problem. when I enter this command c:\peach\peach.exe wav.xml receive this error: unable to locate test named "Default".
and here is my code in xml :
<!-- Defines the common wave chunk -->
<DataModel name="Chunk">
<String name="ID" length="4" padCharacter=" " />
<Number name="Size" size="32" >
<Relation type="size" of="Data" />
</Number>
<Blob name="Data" />
<Padding alignment="16" />
</DataModel>
<DataModel name="ChunkData" ref="Chunk">
<String name="ID" value="data" token="true"/>
</DataModel>
<DataModel name="ChunkFact" ref="Chunk">
<String name="ID" value="fact" token="true"/>
<Block name="Data">
<Number size="32" />
<Blob/>
</Block>
</DataModel>
<DataModel name="ChunkSint" ref="Chunk">
<String name="ID" value="sInt" token="true"/>
<Block name="Data">
<Number size="32" />
</Block>
</DataModel>
<DataModel name="ChunkWavl" ref="Chunk">
<String name="ID" value="wavl" token="true"/>
<Block name="Data">
<Block name="ArrayOfChunks" maxOccurs="3000">
<Block ref="ChunkSint"/>
<Block ref="ChunkData" />
</Block>
</Block>
</DataModel>
<DataModel name="ChunkCue" ref="Chunk">
<String name="ID" value="cue " token="true"/>
<Block name="Data">
<Block name="ArrayOfCues" maxOccurs="3000">
<String length="4" />
<Number size="32" />
<String length="4" />
<Number size="32" />
<Number size="32" />
<Number size="32" />
</Block>
</Block>
</DataModel>
<DataModel name="ChunkFmt" ref="Chunk">
<String name="ID" value="fmt " token="true"/>
<Block name="Data">
<Number name="CompressionCode" size="16" />
<Number name="NumberOfChannels" size="16" />
<Number name="SampleRate" size="32" />
<Number name="AverageBytesPerSecond" size="32" />
<Number name="BlockAlign" size="16" />
<Number name="SignificantBitsPerSample" size="16" />
<Number name="ExtraFormatBytes" size="16" />
<Blob name="ExtraData" />
</Block>
</DataModel>
<DataModel name="ChunkPlst" ref="Chunk">
<String name="ID" value="plst" token="true"/>
<Block name="Data">
<Number name="NumberOfSegments" size="32" >
<Relation type="count" of="ArrayOfSegments"/>
</Number>
<Block name="ArrayOfSegments" maxOccurs="3000">
<String length="4" />
<Number size="32" />
<Number size="32" />
</Block>
</Block>
</DataModel>
<DataModel name="ChunkLtxt" ref="Chunk">
<String name="ID" value="ltxt" token="true"/>
<Block name="Data">
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Number size="16" />
<Number size="16" />
<Number size="16" />
<Number size="16" />
<String nullTerminated="true" />
</Block>
</DataModel>
<DataModel name="ChunkSmpl" ref="Chunk">
<String name="ID" value="smpl" token="true"/>
<Block name="Data">
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Block maxOccurs="3000">
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Number size="32" />
<Number size="32" />
</Block>
</Block>
</DataModel>
<DataModel name="ChunkInst" ref="Chunk">
<String name="ID" value="inst" token="true"/>
<Block name="Data">
<Number size="8"/>
<Number size="8"/>
<Number size="8"/>
<Number size="8"/>
<Number size="8"/>
<Number size="8"/>
<Number size="8"/>
</Block>
</DataModel>
<!-- Defines the format of a WAV file -->
<DataModel name="Wav">
<!-- wave header -->
<String value="RIFF" token="true" />
<Number size="32" />
<String value="WAVE" token="true"/>
<Choice maxOccurs="30000">
<Block ref="ChunkFmt"/>
<Block ref="ChunkData"/>
<Block ref="ChunkFact"/>
<Block ref="ChunkSint"/>
<Block ref="ChunkWavl"/>
<Block ref="ChunkCue"/>
<Block ref="ChunkPlst"/>
<Block ref="ChunkLtxt"/>
<Block ref="ChunkSmpl"/>
<Block ref="ChunkInst"/>
<Block ref="Chunk"/>
</Choice>
</DataModel>
<!-- This is our simple wave state model -->
<StateModel name="TheState" initialState="Initial">
<State name="Initial">
<!-- Write out our wave file -->
<Action type="output">
<DataModel ref="Wav"/>
<!-- This is our sample file to read in -->
<Data fileName="sample.wav"/>
</Action>
<Action type="close"/>
<!-- Launch the target process -->
<Action type="call" method="StartMPlayer" publisher="Peach.Agent" />
</State>
</StateModel>
<Agent name="WinAgent">
<Monitor class="WindowsDebugger">
<!-- The command line to run. Notice the filename provided matched up
to what is provided below in the Publisher configuration -->
<Param name="CommandLine" value="c:\\Program Files (x86)\\adrenalin\\play.exe fuzzed.wav" />
<!-- This parameter will cause the debugger to wait for an action-call in
the state model with a method="StartMPlayer" before running
program.
-->
<Param name="StartOnCall" value="StartMPlayer" />
<!-- This parameter will cause the monitor to terminate the process
once the CPU usage reaches zero.
-->
<Param name="CpuKill" value="true"/>
</Monitor>
<!-- Enable heap debugging on our process as well. -->
<Monitor class="PageHeap">
<Param name="Executable" value="c:\\Program Files (x86)\\adrenalin\\play.exe"/>
</Monitor>
</Agent>
<Agent name="LinAgent">
<!-- Register for core file notifications. -->
<Monitor class="LinuxCrashMonitor"/>
<Monitor class="Process">
<!-- The executable to run. -->
<Param name="Executable" value="mplayer"/>
<!-- This parameter will cause the monitor to wait for an action-call in
the state model with a method="StartMPlayer" before running
program.
-->
<Param name="StartOnCall" value="StartMPlayer"/>
<!-- The program arguments. Notice the filename provided matched up
to what is provided below in the Publisher configuration -->
<Param name="Arguments" value="fuzzed.wav"/>
<!-- This parameter will cause the monitor to terminate the process
once the CPU usage reaches zero.
-->
<Param name="CpuKill" value="true"/>
</Monitor>
</Agent>
<Agent name="OsxAgent">
<Monitor class="CrashWrangler">
<!-- The executable to run. -->
<Param name="Command" value="mplayer" />
<!-- The program arguments. Notice the filename provided matched up
to what is provided below in the Publisher configuration -->
<Param name="Arguments" value="fuzzed.wav" />
<!-- Do not use debug malloc. -->
<Param name="UseDebugMalloc" value="false" />
<!-- Treat read access violations as exploitable. -->
<Param name="ExploitableReads" value="true" />
<!-- Path to Crash Wrangler Execution Handler program. -->
<Param name="ExecHandler" value="/usr/local/bin/exc_handler" />
<!-- This parameter will cause the monitor to wait for an action-call in
the state model with a method="StartMPlayer" before running
program.
-->
<Param name="StartOnCall" value="StartMPlayer" />
</Monitor>
</Agent>
<Test name="Default">
<Agent ref="WinAgent" platform="windows"/>
<Agent ref="LinAgent" platform="linux"/>
<Agent ref="OsxAgent" platform="osx"/>
<StateModel ref="TheState"/>
<Publisher class="File">
<Param name="FileName" value="fuzzed.wav"/>
</Publisher>
<Logger class="Filesystem">
<Param name="Path" value="logs" />
</Logger>
</Test>
When you use the Peach Framework, your pit files(the xml file you have included) must be completed encapsulated by a <Peach>.........</Peach> tag. Try this and see what happens!