XMLDocumentComponent
Use the xmlDocumentComponent to manipulate an XML document using Studio automations. Adding an xmlDocumentComponent to an automation is synonymous to creating an instance of an XML document.
Using the xmlDocumentComponent methods you can load a document and then modify the document by inserting nodes, modifying nodes, and deleting node, and so on. You can associate the xmlDocumentComponent with a schema. When associated with a schema, Studio provides properties and methods to enforce the document structure while manipulating the document within automations. For more information, see xmlDocumentComponent with Schema.
A subsidiary component to the xmlDocumentComponent is the xmlElementComponent. The xmlElementComponent represents an individual XML element within an XML document. The xmlElementComponent provides the basis for all element manipulations within an XML document and is also used as a base type when generating data types from an XML Schema Definition (XSD) to provide enhanced XML manipulation capabilities around various data types defined within an XSD. The xmlElementComponent is not a toolbox resident component; rather it is accessed from the xmlDocumentComponent to get instances of this type when navigating through, or adding elements to a document.
When you add this component to an automation, the system places it on the Global tab of the component tray. For more information, see Adding Global Components to an Automation. This component must be global to be referenced by other automations in the project.
These xmlDocumentComponent functions are available for the component:
Save Diagnostics (accessed from the Properties window)
Refresh (accessed from the Edit Schema Provider)
Clear (accessed from the Edit Schema Provider)
View Schema (accessed from the Properties window)
These functions only apply when using the xmlDocumentComponent in StonglyTyped DocumentMode, such as when using a schema.
Note: When you add the xmlDocumentComponent to an automation, it is placed in the Global tab of the Components Tray. This way, any automation in the solution will have access to the document.
For more information, see General Component Properties Methods Events.
Properties
Property |
Description |
Type |
ChildNodes |
Gets a list of child nodes from the designated XML document. |
IList <xmlElementComponent> |
Document |
Gets the xmlDocumentComponent for a document. |
xmlDocumentComponent |
DocumentElement |
Gets the document element as an xmlElementComponent. |
xmlElementComponent |
DocumentMode |
Gets the current document mode. The options are:
The default mode is FreeForm. After selecting a schema using the Set Schema Provider link, the mode is automatically set to StronglyTyped. |
xmlDocumentMode |
HasChildNodes |
Returns True if the document has child nodes. |
Boolean |
InnerText |
Gets or sets the concatenated values of the document and all its child nodes. Note that you cannot use this property to set the values in a strongly typed document. |
String |
InnerXML |
Gets or sets the markup for the children of the document. Note that you cannot use this property to set the values in a strongly typed document. |
String |
LocalName |
Gets the local name of the document. |
String |
NodeName |
Gets the qualified name of the node. |
String |
OuterXML |
Gets the full text of document. |
String |
Prefix |
Gets the namespace for the prefix. |
String |
SchemaProvider |
Gets the schema provider assigned to the document, if any. |
xmlSchemaProvider |
Valid |
Gets the last know validation state. |
Boolean |
ValidationErrors |
Gets a list of validation errors from last execution of the Validate method. |
xmlDocumentValidation[] |
Methods
Method |
Description |
Parameters |
Return Type |
AppendChild |
Appends XML as a document element. |
String XML |
Void |
AppendChild |
Appends element a document element. |
xmlElementComponent Element |
Void |
ClearDocument |
Clears a document element |
None |
Void |
Create.Type |
Creates an instance of the given type populating the property value with the arguments made to the method call. This method only applies to strongly typed documents. For more information, see xmlDocumentComponent with Schema. |
Type List without Collections
|
Type |
GetAttribute |
Gets the value of an attribute on the root element. |
String attribute |
String |
GetDocument |
Gets xmlDocumentComponent for document. |
xmlDocumentComponent document |
Boolean |
GetDocumentElement |
Returns the document element. |
None |
xmlElementComponent or descendent type |
GetFirstChild |
Gets first child node of the document. Returns true if element output is not null. |
None |
xmlElementComponent element, Boolean |
GetLastChild |
Gets the last child of the document. Returns true if element output is not null. |
None |
xmlElementComponent element, Boolean |
GetNextSibling |
This is an inherited property and has no function on the XML document level. |
None |
xmlElementComponent, Boolean |
GetParentNode |
This is an inherited property and has no function on the XML document level. |
None |
xmlElementComponent, Boolean |
GetPreviousSibling |
This is an inherited property and has no function on the XML document level. |
None |
xmlElementComponent, Boolean |
Insert |
Inserts XML, note that the index is ignored. Returns True if the insert was successful. |
Integer Index, String XML |
Boolean |
Insert |
Inserts element, note that the index is ignored. Returns True if the insert is successful. |
Integer Index, xmlElementComponent element |
Boolean |
InsertAfter |
Inserts XML as specified by a String after selected node. Node selection via the XPath. Returns True if the insert is successful. |
String Xpath, String XML |
Boolean |
InsertAter |
Inserts XML as specified by an xmlElementComponent after selected node. Node selection via the XPath. Returns True if the insert is successful. |
String Xpath, xmlElementComponent Element |
Boolean |
InsertBefore |
Inserts XML as specified by a string before selected node. Node selection via the XPath. Returns True if the insert is successful. |
String Xpath, String XML |
Boolean |
InsertBefore |
Inserts XML as specified by an xmlElementComponent before selected node. Node selection vial the XPath. Returns True if the insert is successful. |
String Xpath, xmlElementComponent Element |
Boolean |
Load |
Loads XML into the document from the file you specified. Returns True if the document load is successful. |
String Filename |
Boolean |
Load |
Loads XML into the document from the stream. Returns True if the document load is successful. |
Stream Stream |
Boolean |
LoadXML |
Loads XML into the document from the string. Returns True if the document load is successful. |
String XML |
Boolean |
PrependChild |
Prepends XML to the document element. |
String XML |
Void |
PrependChild |
Prepends element to the document element. |
xmlElementComponent Element |
Void |
Remove |
Removes the document element. Index is ignored. |
Int Integer |
Void |
RemoveNodes |
Removes the nodes as specified by the XPath. Returns True if the nodes located and removed. |
String Xpath |
Boolean |
RemoveSingleNode |
Removes the first node selected by XPath. Returns True if the node is located and removed. |
String Xpath |
Boolean |
Replace |
Replaces the node selected by XPath with the XML you specified. Returns True if the node is located and replaced. |
String Xpath, String XML |
Boolean |
Replace |
Replaces node selected by XPath with the specified element. Returns True if the node is located and replaced. |
String Xpath, xmlElementComponent Element |
Boolean |
Save |
Saves current document. Returns True if the save is successful. |
None |
Boolean |
Save |
Saves document to specified file. Returns True if the save is successful. |
String Filename |
Boolean |
Save |
Saves document to specified stream. Returns True if the save is successful. |
Stream Stream |
Boolean |
SelectNodes |
Selects the nodes by specified XPath and returns a list of xmlElementComponents. |
String Xpath |
IList xmlElementComponents |
SelectSingleNode |
Selects the first node matching the XPath. |
String Xpath |
xmlElementComponent |
ToString |
Returns OuterXML value. |
None |
String |
Validate |
Validates the document against the associated schema provider. This method only applies to strongly typed documents. For more information, see xmlDocumentComponent with Schema. |
None |
Boolean |
Validate |
Validates the document against the XSD set in the xsdFilePath property. This method only applies to strongly typed documents. For more information, see xmlDocumentComponent with Schema. |
String xsdFilePath |
Boolean |
ViewDocument |
Displays a modal dialog that contains a web browser which shows the current contents of the XML document. |
None |
Void |
ViewSchema |
Displays a modal dialog that contains a web browser which shows the current contents of the document schema (.xsd file). |
None |
Void |
ViewSchema |
Displays a modal dialog that contains a web browser which shows the current contents of the XSD set in the xsdFilePath property. |
String xsdFilePath |
Void |
Related information
Using the xmlDocumentComponent
xmlDocumentComponent with Schema
Using the xmlDocumentComponent with Schema
Privacy | Trademarks | Terms of Use | Feedback
Updated: 18 June 2020
© 2016 - 2020 Pegasystems Inc. Cambridge, MA All rights reserved.