Incoming Business Interlink Properties

This section describes the PeopleCode properties you use with Incoming Business Interlinks.

Description

The AttributeCount property gets the number of attributes within an XML element referenced by a BiDocs object.

This property is read-only.

Example

Here is a set of XML request code.

<?xml version="1.0"?> 
   <postreq> 
      <email>joe_blow@example.com</email> 
      <location scenery="great" density="low" blank="eh?"> 
         <city>San Rafael</city> 
         <state>CA</state> 
         <zip>94522</zip> 
         <country>US</country> 
      </location> 
   </postreq>

Here is the PeopleCode that gets the number of attributes in the location XML element. &count should be 3, for scenery, density, and blank.

Local BIDocs &rootInDoc, &postreqDoc, &locationDoc; 
Local string &blob; 
Local number &count; 
&blob = %Request.GetContentBody(); 
    
&rootInDoc = GetBiDoc(&blob); 
&postreqDoc = &rootInDoc.GetNode("postreq"); 
&locationDoc = &postreqDoc.GetNode("location"); 
&count = &locationDoc.AttributeCount;

Description

The ChildNodeCount property returns the number of XML child nodes within the element referenced by the BiDocs object. Child nodes include XML elements, comments, and processing instructions.

This property is read-only.

Example

Here is a set of XML request code.

<?xml version="1.0"?> 
   <postreq> 
      <email>joe_blow@example.com</email> 
      <projtitle> 
         <!--this is a comment line--> 
         <projsubtitle>first_subtitle</projsubtitle> 
         <projsubtitle>second_subtitle</projsubtitle> 
         <projsubtitle>third_subtitle</projsubtitle> 
      </projtitle> 
   </postreq>

Here is the XML code that gets the number of nodes within <postreq> and <projtitle>. &count1 is 2, for <email> and <projtitle>, and &count2 is 4, for the three <projsubtitle> nodes and the comment node.

Local BIDocs &rootInDoc, &projtitleDoc; 
Local string &blob; 
Local number &count1, &count2; 
&blob = %Request.GetContentBody(); 
    
&rootInDoc = GetBiDoc(&blob); 
&postreqDoc = &rootInDoc.GetNode("postreq"); 
&count1 = &postreqDoc.ChildNodeCount; 
&projtitleDoc = &postreqDoc.GetNode("projtitle"); 
&count2 = &projtitleDoc.ChildNodeCount;

Description

The NodeName property gets the name of an XML element referenced by a BiDocs object. Use this to get the name of an XML element when you used GetNode with an index number to retrieve it (meaning that you did not have the name of the XML element when you used GetNode).

This property is read-only.

Example

Here is a set of XML request code.

<?xml version="1.0"?> 
   <postreq> 
      <email>joe_blow@example.com</email> 
      <projtitle> 
         <projsubtitle>first_subtitle</projsubtitle> 
         <projsubtitle>second_subtitle</projsubtitle> 
         <projsubtitle>third_subtitle</projsubtitle> 
      </projtitle> 
   </postreq>

Here is the PeopleCode that gets the name of the <email> element, email.

Local BIDocs &rootInDoc, &postreqDoc, &emailDoc; 
Local string &emailName, &blob; 
&blob = %Request.GetContentBody(); 
    
&rootInDoc = GetBiDoc(&blob); 
&postreqDoc = &rootInDoc.GetNode(1); 
&emailDoc = &postreqDoc.GetNode(1); 
&emailName = &emailDoc.NodeName;

Description

The NodeType property returns the type of an XML tag within a BiDocs object as an integer. The values are:

Value

Description

1

Element (a normal XML tag)

7

Processing instruction

8

Comment

This property is read-only.

Example

Here is a set of XML request code.

<?xml version="1.0"?> 
   <postreq> 
      <email>joe_blow@example.com</email> <!--this is a comment--> 
      <projtitle> 
         <projsubtitle>first_subtitle</projsubtitle> 
         <projsubtitle>second_subtitle</projsubtitle> 
         <projsubtitle>third_subtitle</projsubtitle> 
      </projtitle> 
   </postreq>

Here is the PeopleCode that gets types: &xmlprocType is 7 for processing instruction, postreqDoc is 1 for element, and commentType is 8 for comment.

Local BIDocs &rootInDoc, &postreqDoc, &commentDoc; 
Local number &xmlprocType, &postreqType, &commentDoc; 
Local string &blob; 
&blob = %Request.GetContentBody(); 
    
/* <?xml version="1.0"?> */ 
&rootInDoc = GetBiDoc(&blob); 
&xmlprocType = &rootInDoc.NodeType; 
 
/* <postreq> */ 
&postreqDoc = &rootInDoc.GetNode(1); 
&postreqType = &postreqDoc.NodeType; 
 
/* <!--this is a comment--> */ 
&commentDoc = &postreqDoc.GetNode(2); 
&commentType = &commentDoc.NodeType;

Description

The NodeValue property returns the value of a node within an XML document as a string.

This property is read-only.

Example

Here is a set of XML request code.

<?xml version="1.0"?> 
   <postreq> 
      <email>joe_blow@example.com</email> 
      <projtitle> 
         <projsubtitle>first_subtitle</projsubtitle> 
         <projsubtitle>second_subtitle</projsubtitle> 
         <projsubtitle>third_subtitle</projsubtitle> 
      </projtitle> 
   </postreq>

Here is the PeopleCode that gets the value of the third <projsubtitle> element, third_subtitle.

Local BIDocs &rootInDoc, &postreqDoc, &projtitleDoc, &projsubtitleDoc; 
Local string &name, &blob; 
&blob = %Request.GetContentBody(); 
    
&rootInDoc = GetBiDoc(&blob); 
&postreqDoc = &rootInDoc.GetNode(1); 
&projtitleDoc = &postreqDoc.GetNode(2); 
&projsubtitleDoc = &projtitleDoc.GetNode(3); 
&projsubtitleName = &projsubtitleDoc.NodeValue;