Which of the following should I pay attention to when using infopath?

Source: Internet
Author: User
Tags xslt

Turn: http://www.cnblogs.com/dujun0618/articles/750088.html

Note when using appendchild
1 ^ ^
VaR fathernode = xdocument. dom. selectsinglenode ("/TR: Adolescent activity center/NS1: Statistical Report [My: Form Number = '" + TID + "']/My: record group ");
VaR sonnode = xdocument. dom. selectsinglenode ("/TR: Adolescent activity center/NS1: Statistical Report [My: Form Number = '" + TID + "']/My: record group/My: group ");
VaR sonnodelist = xdocument. dom. selectnodes ("/TR: Adolescent activity center/NS1: Statistical Report [My: Form No. = '" + TID + "']/My: record group/My: group ");

2 ^ ^
Sonnodelist. removeall ();

3 ^ ^
VaR clonenodelist = sonnode. clonenode (true );
Clonenodelist. selectsinglenode ("My: date"). Text = T3;

// Obtain the application time information for various documents
Clonenodelist. selectsinglenode ("My: Public out Application Form"). Text = gettimevalue ("public out Application Form", ygname, T3 );
Clonenodelist. selectsinglenode ("My: Overtime Approval Form"). Text = gettimevalue ("overtime approval form", ygname, T3 );
Clonenodelist. selectsinglenode ("My: Department of illness"). Text = gettimevalue ("Department of illness", ygname, T3 );
Clonenodelist. selectsinglenode ("My: Relocation Application Form"). Text = gettimevalue ("relocation Application Form", ygname, T3 );
Clonenodelist. selectsinglenode ("My: annual vacation Application Form"). Text = gettimevalue ("annual vacation Application Form", ygname, T3 );

Fathernode. appendchild (clonenodelist );

Use this method to automatically add sub-nodes. Note that the subnode "My: record group" only has "My: group" and cannot have other nodes or groups. If yes, you must complete the subnode "My: record group" in appendchild.
My: record group/My: Group
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&
VaR parentnode = xdocument. Dom. selectsinglenode ("/My: youth activity center/My: Teacher Group/My: Teacher/My: time group ");
VaR sonnode = xdocument. Dom. selectsinglenode ("/My: youth activity center/My: Teacher Group/My: Teacher/My: time group/My: Time ");
Parentnode. appendchild (sonnode. clonenode (true); // correct
Parentnode. appendchild (sonnode); // incorrect. Because sonnode has been specified as a pointer, it is always added.
Clonenode (true) is used to copy a copy of The sonnode node, and the child node is also copied.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&
The premise of using appendchild is that the parent node of the added node is a duplicate node.

Note with the count () function
Count (/My: Wenzhou Torch/My: Template structure/My: Elevator type parameter [My: Production No. =/My: Wenzhou Torch/My: the production ID is used to generate the serial number]/My: Part group [My: Part type =/My: Wenzhou Torch/My: Part type is used to generate the serial number]/My: standard part/My: group/My: Part Information Group/My: No)

The count () function can only be a regular XPath statement, and double quotation marks are not allowed. It cannot be an XPATH statement combined by the Concat () function.
[My: Part type =/My: Wenzhou Torch/My: Part type is used to generate serial numbers] use absolute paths when filtering.

Why the infopath form cannot be opened
Xdocument. getdom ("employee information entry table "). selectnodes (NS1: Name); in this way, the form cannot be opened. I didn't believe it at the time. The script hasn't been triggered yet, but it will be checked when running the form.
Change
Xdocument. getdom ("employee information entry table "). selectnodes (/DFS: myfields/DFS: datafields/TNS: getdataresponse/TNS: getdataresult/TR: employee basic information/NS1: Name); That's right.

In short, the script syntax is checked when the form is opened.

Sometimes the namespace is too long, and the semicolon cannot be in the second line. Otherwise, it cannot be opened.

Duplicate table structure when using the view. executeaction command
My: Production table/My: Production (Table content)

When you add duplicate tables, the default structure is "My: group1/My: Group2". "My: Group2" indicates duplicate table names, while "My: group1" indicates that its parent node is non-duplicate.

I am using xdocument. view. executeaction ("xcollection: Insert", "_ 9"), an error message is displayed, indicating that the xmltoedit name cannot be a Chinese name, and an error occurs after it is replaced with a letter.

When a duplicate table is added, the parent node of the duplicate table is deleted and replaced with the node of the duplicate table. Duplicate sections can be repeated. So an error occurs.

The rule cannot be called by itself.
When a rule is set in this field, the value of this rule cannot be changed. This will lead to an endless loop, but the system will not. It will automatically jump out after several calls.

"InCode. The number of onafterchange events called for a single data update exceeds the maximum value allowed. "

Rules in fields converted from the XSL style cannot respond.
Rules cannot respond to fields converted from the XSL style, but can be used to add or delete rules for repeated tables.

Note namespace in XSLT
// XSLT Style
// Configure //---------------------------------------------------------------------------------------------
Response content = '<? XML version = "1.0" encoding = "gb2312"?> <XSL: stylesheet version = "1.0" xmlns: XSL = "http://www.w3.org/1999/XSL/Transform" xmlns: My = "http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-05-23T07:44:28">'
Response content + = '<XSL: template match = "/"> <my: salary group> <XSL: For-each select = "My: Statistics Group/My: instructor Group/My: Instructor ">'
Response content + = '<my: Name group> <my: Instructor Name> <XSL: value-of select = "My: Name"/> </My: Instructor Name>'
Required content + = '<my: number of lessons> </My: number of lessons>'
When content + = '<my: Lesson Standard> </My: Lesson Standard>'
Response content + = '<my: amount> </My: amount>'
Response content + = '<my: resend amount> </My: resend amount>'
Required content + = '<my: total amount> </My: total amount>'
Response content + = '<my: Tax Amount> </My: Tax Amount>'
Response content + = '<my: after-tax amount> </My: after-tax amount>'
Response content + = '<my: remarks 1> </My: remarks 1> </My: Personal Name group> </XSL: For-each>'
Salary content + = '</My: salary group> </XSL: Template> </XSL: stylesheet>'
// Configure //-------------------------------------------------------------------------------------------------

Xmlns: My = "http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-05-23T07:44:28" The namespace statement cannot be omitted because it contains the my: prefix. Otherwise it will not take shape.

VaR writable dom = xdocument. createdom ();
Using Dom. loadxml (using content );
Xdocument. UI. Alert (Response content );
Xdocument. UI. Alert (export Dom. XML );

The blank characters in XPath are valid.
[My: Component = 'source']
[My: Component = 'source']
The two are different.

XPath path (case sensitive)
VaR Ylid = xdocument. Dom. selectsinglenode ('My: myfields/My: raw material information/My: No. '). text;

both single quotes and double quotes
must be case sensitive
my: myfields F is capital

xdocument. createdom () object namespace declaration method
transdom = xdocument. createdom ();
transdom. loadxml (xmldom. transformnode (writable DOM);
-----------------------------------------
transdom. setproperty ("selectionnamespaces", 'xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: My = "http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-05-23T07:44:28" xmlns: XD = "http://schemas.microsoft.com/office/infopath/2003 "');
-----------------------------------------
declare the same as the namespace of the primary data source
xdocument. dom. setproperty ("selectionnamespaces", 'xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: My = "http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-05-23T07:44:28" xmlns: XD = "http://schemas.microsoft.com/office/infopath/2003" ');

Xdocument. createdom () object and Node object
Function ctrl8_5: onclick (eventobj)
{
VaR strurl = "http: // localhost/testform3.xml ";

VaR oxmlhttp = new activexobject ("msxml2.xmlhttp ");

Oxmlhttp. Open ("get", strurl, false );
Oxmlhttp. Send ();


Xdocument. UI. Alert (oxmlhttp. responsexml. XML );
Xdocument. UI. Alert (oxmlhttp. responsexml. selectsinglenode ("/My: myfields/My: mybooks"). XML );

VaR rexml = oxmlhttp. responsexml. selectsinglenode ("/My: myfields/My: mybooks ");
VaR renode = xdocument. createdom ();
Renode. loadxml (rexml. XML );
Xdocument. UI. Alert (renode. XML );

VaR node = xdocument. Dom. selectsinglenode ("/My: myfields/My: mybooks ");
Node.parentnode.appendchild(renode.doc umentelement );

Oxmlhttp. Open ("put", strurl, false );
Oxmlhttp. Send (xdocument. Dom. XML );
}

After the renodeobject contains xml, if the selectsinglenodeobject does not exist, renode.doc umentelement is required to obtain the root node. And then use it like the selectsinglenode object.

Query path of XML converted nodes and XSL in transformnode
If the name is simply an XML file, you do not have to use the "My:" prefix "or" OK "in the" <> "name" column. All names are processed as names, in this way, the full name of the node is required when the path is selected in the XSL statement.

The prefix is only used in infopath to represent the node structure. Is a framework rule.

Last () is used in different places
/My: Wenzhou Torch/My: Template structure/My: remarks [last ()]
When used as a drop-down, the end of the remarks for each table is taken out, and the remarks only have one knot, which is equivalent to all the remarks.

/My: Wenzhou Torch/My: Template structure [last ()]/My: Remarks
When used as a drop-down, the remarks of the last table will be taken out.

========================================================== ====================================
Concat ("/My: Wenzhou torch [My: Template structure/My: Component = '",., "']/My: Template structure [last ()]/My: No ")
In this way, first locate the qualified node and then retrieve the last one.

Concat ("/My: Wenzhou Torch/My: Template structure [My: Component = '",., "' and last ()]/My: No ")
This does not allow you to retrieve the last one that meets the conditions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.