WordFile.GetXML
---------------

Queries xml content of the word file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WordFile](component_WordFile.md) | [6.2](newinversion62.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "WordFile.GetXML"; WordFile { ; Part } ) 

**MBS**( **"WordFile.GetXML";** /\* Queries xml content of the word file. \*/  
**$WordFile**; /\* The reference number of the open word file. \*/   
**$Part**) /\* Optional; The name of the part to query.  
See [WordFile.Parts](WordFileParts.md) for a list of parts.  
if no part is given, we use the document.e.g. "document" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| WordFile | The reference number of the open word file. | $wordFile |  |
| Part | The name of the part to query.   See [WordFile.Parts](WordFileParts.md) for a list of parts.   if no part is given, we use the document. | "document" | Optional |

### Result

Returns xml text or error.

### Description

Queries xml content of the word file.  
Getting the raw xml allows you to make modification yourself like adding paragraphs or a table.  
### Examples

Query XML of first footer:

 MBS ( "WordFile.GetXML"; $wordFile ; "footer1" )  
Query document relations:

 MBS ( "WordFile.GetXML"; $WordFile ; "document.xml.rels")  
Query custom properties of a word file:

 # open word file   
Set Variable \[ $wordfile ; Value: MBS ( "[WordFile.OpenContainer](WordFileOpenContainer.md)"; WordFile::Input ) \]   
If \[ MBS ("ISError") \]   
 Show Custom Dialog \[ "Error" ; $wordFile \]   
 Exit Script \[ Text Result: \]   
End If  
\#   
\# read xml   
Set Variable \[ $xml ; Value: MBS ( "WordFile.GetXML"; $WordFile ; "custom") \]   
\#   
\# get property count   
Set Variable \[ $count ; Value: MBS ( "[XML.NodeCount](XMLNodeCount.md)"; $xml ; "property" ) \]   
\#   
If \[ $count &gt; 0 \]   
 Set Variable \[ $i ; Value: 0 \]   
 #   
 Loop  
 Set Variable \[ $name ; Value: MBS ( "[XML.GetPathValue](XMLGetPathValue.md)"; $xml ; "Properties.property\[" &amp; $i &amp; "\]#name"; 1+2 ) \]   
 Set Variable \[ $value ; Value: MBS ( "[XML.GetPathValue](XMLGetPathValue.md)"; $xml ; "Properties.property\[" &amp; $i &amp; "\].lpwstr"; 1+2 ) \]   
 #   
 Show Custom Dialog \[ "Custom propety" ; $name &amp; ": " &amp; $value \]   
 #   
 Set Variable \[ $i ; Value: $i + 1 \]   
 Exit Loop If \[ $i &gt;= $count \]   
 End Loop  
 #   
 #   
End If  
\#   
\# free memory   
Set Variable \[ $r ; Value: MBS ( "[WordFile.Release](WordFileRelease.md)"; $WordFile ) \]  
Change XML directly:

 # get xml   
Set Variable \[ $xml ; Value: MBS ( "WordFile.GetXML"; $wordfile ) \]   
\# Change something   
Set Variable \[ $xml ; Value: Substitute($xml ; "Times New Roman"; "Helvetica") \]   
\# put xml back   
Set Variable \[ $r ; Value: MBS ( "[WordFile.SetXML](WordFileSetXML.md)"; $wordfile ; $xml ) \]  
### See also

- [IsError](IsError.md)
- [WordFile.OpenContainer](WordFileOpenContainer.md)
- [WordFile.Parts](WordFileParts.md)
- [WordFile.Release](WordFileRelease.md)
- [WordFile.SetXML](WordFileSetXML.md)
- [XML.GetPathValue](XMLGetPathValue.md)
- [XML.NodeCount](XMLNodeCount.md)

### Release notes

- **Version 9.5**
    - Improved [WordFile.GetXML](http://www.mbsplugins.eu/WordFileGetXML.shtml) function to work with rels parts in the Word file.

### Blog Entries

- [MBS FileMaker Plugin, version 9.5pr7](https://www.mbsplugins.de/archive/2019-11-07/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.2pr1](https://www.mbsplugins.de/archive/2016-03-19/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2021, Seite 20](https://filemaker-magazin.de/neuigkeit/4165-Appetithappen-FMM_202106)

This function checks for a license.

Created 15th March 2016 , last changed 29th December 2021

  
[WordFile.GetSkipDeletedText](WordFileGetSkipDeletedText.md) - [WordFile.HasTag](WordFileHasTag.md)

[HTML Version](WordFileGetXML.shtml)