Invalid xml content как исправить

Fixes an issue in which you receive an "Invalid XML content" error message when you run a WMIC command on a computer that is connected to a USB flash drive. This issue occurs in Windows 7 or in Windows Server 2008 R2.

Windows 7 Enterprise Windows 7 Professional Windows 7 Ultimate Windows 7 Home Basic Windows 7 Home Premium Windows Server 2008 R2 Datacenter Windows Server 2008 R2 Enterprise Windows Server 2008 R2 for Itanium-Based Systems Windows Server 2008 R2 Foundation Windows Server 2008 R2 Standard Windows Server 2008 R2 Web Edition More…Less

Symptoms

Consider the following scenario. You connect a USB flash drive to a computer that is running Windows 7 or Windows Server 2008 R2. You try to run one of the following Windows Management Instrumentation Command-line (WMIC) tool commands to query the hard disk drives on the computer:

wmic diskdrive get *

wmic diskdrive get serialNumberIn this scenario, you receive an error message that resembles the following:

Invalid XML content

Cause

This issue occurs because the XML parser treats the control characters that are included in the serial number of some drives as invalid. Therefore, the XML parser cannot parse content that includes these control characters. This behavior causes valid results for other drives to be displayed incorrectly, together with the behavior that is mentioned in the «Symptoms» section.

Resolution

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

If the hotfix is available for download, there is a «Hotfix download available» section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:

http://support.microsoft.com/contactus/?ws=supportNote The «Hotfix download available» form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

To apply this hotfix, you must be running Windows 7 Service Pack 1 (SP1) or Windows Server 2008 R2 Service Pack 1 (SP1).

For more information about how to obtain a Windows 7 or Windows Server 2008 R2 service pack, click the following article number to view the article in the Microsoft Knowledge Base:

976932 Information about Service Pack 1 for Windows 7 and for Windows Server 2008 R2

Registry information

To apply the hotfix in this package, you do not have to make any changes to the registry.

Restart requirement

You must restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File information

The global version of this hotfix installs files that have the attributes that are listed in the following tables. The dates and the times for these files are listed in Coordinated Universal Time (UTC). The dates and the times for these files on your local computer are displayed in your local time together with your current daylight saving time (DST) bias. Additionally, the dates and the times may change when you perform certain operations on the files.

Windows 7 and Windows Server 2008 R2 file information notes


Important Windows 7 hotfixes and Windows Server 2008 R2 hotfixes are included in the same packages. However, hotfixes on the Hotfix Request page are listed under both operating systems. To request the hotfix package that applies to one or both operating systems, select the hotfix that is listed under «Windows 7/Windows Server 2008 R2» on the page. Always refer to the «Applies To» section in articles to determine the actual operating system that each hotfix applies to.

  • The files that apply to a specific product, milestone (RTM, SPn), and service branch (LDR, GDR) can be identified by examining the file version numbers as shown in the following table:

    Version

    Product

    Milestone

    Service branch

    6.1.760
    1.17xxx

    Windows 7 and Windows Server 2008 R2

    SP1

    GDR

    6.1.760
    1.21xxx

    Windows 7 and Windows Server 2008 R2

    SP1

    LDR

  • GDR service branches contain only those fixes that are widely released to address widespread, critical issues. LDR service branches contain hotfixes in addition to widely released fixes.

  • The MANIFEST files (.manifest) and the MUM files (.mum) that are installed for each environment are listed separately in the «Additional file information for Windows 7 and for Windows Server 2008 R2» section. MUM and MANIFEST files, and the associated security catalog (.cat) files, are critical to maintaining the state of the updated component. The security catalog files, for which the attributes are not listed, are signed with a Microsoft digital signature.

For all supported x86-based versions of Windows 7

File name

File version

File size

Date

Time

Wmic.exe

6.1.7601.17759

396,288

11-Jan-2012

05:34

Wmic.exe

6.1.7601.21895

396,288

11-Jan-2012

05:59

For all supported x64-based versions of Windows 7 and of Windows Server 2008 R2

File name

File version

File size

Date

Time

Wmic.exe

6.1.7601.17759

566,784

11-Jan-2012

06:35

Wmic.exe

6.1.7601.21895

566,784

11-Jan-2012

06:17

For all supported IA-64-based versions of Windows Server 2008 R2

File name

File version

File size

Date

Time

Wmic.exe

6.1.7601.17759

1,074,688

11-Jan-2012

05:02

Wmic.exe

6.1.7601.21895

1,074,688

11-Jan-2012

05:15

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the «Applies to» section.

More Information

For more information about the WMIC tool, visit the following Microsoft website:

How to use the WMIC toolFor more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

Additional file information

Additional file information for Windows 7 and for Windows Server 2008 R2

Additional files for all supported x86-based versions of Windows 7

File name

X86_6c466840b6e63f63f610c157eb689892_31bf3856ad364e35_6.1.7601.17759_none_a7c0934712923ecf.manifest

File version

Not applicable

File size

712

Date (UTC)

11-Jan-2012

Time (UTC)

14:06

File name

X86_a876a9b062f41a0d4de85d1baa24c21b_31bf3856ad364e35_6.1.7601.21895_none_458609fa6ddfc3e2.manifest

File version

Not applicable

File size

712

Date (UTC)

11-Jan-2012

Time (UTC)

14:06

File name

X86_microsoft-windows-w..ommand-line-utility_31bf3856ad364e35_6.1.7601.17759_none_a38b04d82b34f3eb.manifest

File version

Not applicable

File size

2,606

Date (UTC)

11-Jan-2012

Time (UTC)

06:18

File name

X86_microsoft-windows-w..ommand-line-utility_31bf3856ad364e35_6.1.7601.21895_none_a3e560cb44769e1d.manifest

File version

Not applicable

File size

2,606

Date (UTC)

11-Jan-2012

Time (UTC)

07:05

Additional files for all supported x64-based versions of Windows 7 and of Windows Server 2008 R2

File name

Amd64_3d500f95fcbf849689fefcb7325c786f_31bf3856ad364e35_6.1.7601.21895_none_9650dc0e92149a9f.manifest

File version

Not applicable

File size

1,072

Date (UTC)

11-Jan-2012

Time (UTC)

14:06

File name

Amd64_60d1a618a98c83d3b0ba72adf281e92c_31bf3856ad364e35_6.1.7601.21895_none_cd4f676a3ce6ab90.manifest

File version

Not applicable

File size

716

Date (UTC)

11-Jan-2012

Time (UTC)

14:06

File name

Amd64_6c466840b6e63f63f610c157eb689892_31bf3856ad364e35_6.1.7601.17759_none_03df2ecacaefb005.manifest

File version

Not applicable

File size

714

Date (UTC)

11-Jan-2012

Time (UTC)

14:06

File name

Amd64_a876a9b062f41a0d4de85d1baa24c21b_31bf3856ad364e35_6.1.7601.21895_none_a1a4a57e263d3518.manifest

File version

Not applicable

File size

714

Date (UTC)

11-Jan-2012

Time (UTC)

14:06

File name

Amd64_bde56e055e65c9622ce1740fd94aef81_31bf3856ad364e35_6.1.7601.17759_none_1477ed41b5701bb4.manifest

File version

Not applicable

File size

1,072

Date (UTC)

11-Jan-2012

Time (UTC)

14:06

File name

Amd64_c9c34784d98d026b6c1e90dee14ad8b6_31bf3856ad364e35_6.1.7601.17759_none_a008e51116613975.manifest

File version

Not applicable

File size

716

Date (UTC)

11-Jan-2012

Time (UTC)

14:06

File name

Amd64_microsoft-windows-w..ommand-line-utility_31bf3856ad364e35_6.1.7601.17759_none_ffa9a05be3926521.manifest

File version

Not applicable

File size

2,610

Date (UTC)

11-Jan-2012

Time (UTC)

07:40

File name

Amd64_microsoft-windows-w..ommand-line-utility_31bf3856ad364e35_6.1.7601.21895_none_0003fc4efcd40f53.manifest

File version

Not applicable

File size

2,610

Date (UTC)

11-Jan-2012

Time (UTC)

07:31

Additional files for all supported IA-64-based versions of Windows Server 2008 R2

File name

Ia64_4f90e151ff6a00729d20707864ceceb7_31bf3856ad364e35_6.1.7601.17759_none_421d1d510aabe246.manifest

File version

Not applicable

File size

1,070

Date (UTC)

11-Jan-2012

Time (UTC)

14:06

File name

Ia64_d9ae40a789be5755cf49c836060dc0f1_31bf3856ad364e35_6.1.7601.21895_none_5a456f45388820ce.manifest

File version

Not applicable

File size

1,070

Date (UTC)

11-Jan-2012

Time (UTC)

14:06

File name

Ia64_microsoft-windows-w..ommand-line-utility_31bf3856ad364e35_6.1.7601.17759_none_a38ca8ce2b32fce7.manifest

File version

Not applicable

File size

2,608

Date (UTC)

11-Jan-2012

Time (UTC)

06:56

File name

Ia64_microsoft-windows-w..ommand-line-utility_31bf3856ad364e35_6.1.7601.21895_none_a3e704c14474a719.manifest

File version

Not applicable

File size

2,608

Date (UTC)

11-Jan-2012

Time (UTC)

07:16

Need more help?

Am I missing a dll or something?

WMIC PATH CIM_PhysicalMedia

I keep getting: Invalid XML Content.

You could be missing a hotfix:

This issue occurs because the XML parser treats the control characters that are included in the serial number of some drives as invalid.

Try installing the hotfix available from the source link below («Hotfix Download Available» button)


«Invalid XML content» error message when you run a WMIC command in Windows 7 or in Windows Server 2008 R2

SYMPTOMS

Consider the following scenario. You connect a USB flash drive to a
computer that is running Windows 7 or Windows Server 2008 R2. You try
to run one of the following Windows Management Instrumentation
Command-line (WMIC) tool commands to query the hard disk drives on the
computer:

wmic diskdrive get *
wmic diskdrive get serialNumber

In this scenario, you receive an error message that resembles the
following:

Invalid XML content

CAUSE

This issue occurs because the XML parser treats the control characters
that are included in the serial number of some drives as invalid.
Therefore, the XML parser cannot parse content that includes these
control characters. This behavior causes valid results for other
drives to be displayed incorrectly, together with the behavior that is
mentioned in the «Symptoms» section.

RESOLUTION

A supported hotfix is available from Microsoft. However, this hotfix
is intended to correct only the problem that is described in this
article. Apply this hotfix only to systems that are experiencing the
problem described in this article. This hotfix might receive
additional testing. Therefore, if you are not severely affected by
this problem, we recommend that you wait for the next software update
that contains this hotfix.

If the hotfix is available for download, there is a «Hotfix download
available» section at the top of this Knowledge Base article. If this
section does not appear, contact Microsoft Customer Service and
Support to obtain the hotfix.

Source «Invalid XML content» error message when you run a WMIC command in Windows 7 or in Windows Server 2008 R2

  • Remove From My Forums
  • Вопрос

  • i want to read the name and the serialnumber of my Hard-Drives. I stumbled upon wmic but i’m having troubles. these two commands should do the trick i guess, but only get the message: Invalid Xml-Content. //(Translated)

    wmic path win32_physicalmedia get serialnumber

    or

    wmic DISKDRIVE GET SerialNumber

    i tried the following aswell:

    wmic DISKDRIVE GET SerialNumber /FORMAT:list wmic DISKDRIVE GET SerialNumber /FORMAT:xml.xsl wmic DISKDRIVE GET SerialNumber > c:test.txt

    any ideas what i do wrong?

    —————————————————————

    Solution:

    SerialNumber doesn’t even exist for DISKDRIVE, type WMIC DISKDRIVE GET /? to see available attributes.

    WMIC /output:»c:hdds.txt» DISKDRIVE GET PNPDeviceID,Name /Format:CSV

    this works fine for me.

    • Изменено

      15 февраля 2012 г. 22:43

Ответы

  • well the problem is that

    wmic DISKDRIVE GET Name

    gives

    \.PHYSICALDRIVE4
    \.PHYSICALDRIVE2
    \.PHYSICALDRIVE3

    and thats what changes from time to time, these names get dynamically associated to the hdds. that by the way is my original problem. finding out which hdd has which name. would be wounderful if i could get the serialnumber and the name the same time.

    heres my post in the truecrypt forum http://forums.truecrypt.org/viewtopic.php?p=100637#100637

    • Помечено в качестве ответа
      Cloud_TS
      24 февраля 2012 г. 8:32

Basically double-quote all attribute values.

You can read about it in this tutorial.

I used an on-line xml validator and this is the result:

The value following «version» in the XML declaration must be a quoted string.

Change:

<?xml version=1.0 encoding=UTF-8?>

by

<?xml version="1.0" encoding="UTF-8"?>

Open quote is expected for attribute «xmlns:dpid» associated with an element type «dpid:DpidDatabase».

Change:

<dpid:DpidDatabase xmlns:dpid=http://ddex.net/xml/dpid/11 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://ddex.net/xml/dpid/11 http://ddex.net/xml/dpid/11/dpid.xsd>

by

<dpid:DpidDatabase xmlns:dpid="http://ddex.net/xml/dpid/11" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ddex.net/xml/dpid/11 http://ddex.net/xml/dpid/11/dpid.xsd">

Open quote is expected for attribute «SequenceNumber» associated with an element type «DpidOwner».

Change all occurrences of:

<DpidOwner SequenceNumber=XX>

by double quoting SequenceNumber values

<DpidOwner SequenceNumber="1">

You can check the result db<>fiddle here

sequencenumber                                                                                                                                                                                                                                                     | dpid                            | companyname                                     | address                                                                                                                           
:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------ | :---------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------
<DpidOwner SequenceNumber="1"><br>  <DPID>PADPIDA2006111001O</DPID><br>  <CompanyName>234AG</CompanyName><br>  <Address>Riedtlistrasse 23, Z�???????�??????�?????�????�???�??�?�¼rich, 8006, CH</Address><br> </DpidOwner> | <DPID>PADPIDA2006111001O</DPID> | <CompanyName>234AG</CompanyName>                | <Address>Riedtlistrasse 23, Z�???????�??????�?????�????�???�??�?�¼rich, 8006, CH</Address>
<DpidOwner SequenceNumber="2"><br>  <DPID>PADPIDA2007011501Q</DPID><br>  <CompanyName>OpenIMP</CompanyName><br>  <Address>8-10 Rhoda Street, London, E2 7EF, UK</Address><br> </DpidOwner>                                                                         | <DPID>PADPIDA2007011501Q</DPID> | <CompanyName>OpenIMP</CompanyName>              | <Address>8-10 Rhoda Street, London, E2 7EF, UK</Address>                                                                          
<DpidOwner SequenceNumber="3"><br>  <DPID>PADPIDA2007040501K</DPID><br>  <CompanyName>The Harry Fox Agency</CompanyName><br>  <Address>711 Third Avenue, 8th Floor, New York, 10017, USA</Address><br> </DpidOwner>                                                | <DPID>PADPIDA2007040501K</DPID> | <CompanyName>The Harry Fox Agency</CompanyName> | <Address>711 Third Avenue, 8th Floor, New York, 10017, USA</Address>                                                              

Я пытаюсь написать сценарий, который содержит полученный серийный номер диска для отчета. До сих пор я просто пытался получить WMI-вызов или вообще что-нибудь, чтобы вообще получить его.

WMIC PATH CIM_PhysicalMedia

работает на некоторых компьютерах, но не в среде WinPE, на которой он мне нужен. Я продолжаю получать:Invalid XML Content.

Каждая команда , которую я стараюсь, я использую как CIM_PhysicalMediaи Win32_PhysicalMediaи ни работать , когда он не работает.

Что забавно, система, на которой он работает, — это Windows 7 Pro, но она не работает на другом ПК с той же ОС! Я скучаю по DLL или что-то?

Пожалуйста помоги! Опять же, это должно работать в среде WinPE. Я не знаю версию, но я знаю, что WMIC работает нормально.

Пожалуйста помоги!!

PS У меня есть опыт работы с простыми вызовами типа WMI wmic bios get serialnumberи т.п., но я никогда не сталкивался с чем-то настолько сложным.


Ответы:


Я скучаю по DLL или что-то?

WMIC PATH CIM_PhysicalMedia

Я продолжаю получать: Invalid XML Content.

Возможно, вам не хватает исправления:

Эта проблема возникает из- за того, что анализатор XML рассматривает управляющие символы, включенные в серийный номер некоторых дисков, как недействительные .

Попробуйте установить исправление, доступное по ссылке источника ниже (кнопка «Загрузка исправления доступна»)


Сообщение об ошибке «Недопустимое содержимое XML» при запуске команды WMIC в Windows 7 или Windows Server 2008 R2

СИМПТОМЫ

Рассмотрим следующий сценарий. Вы подключаете флэш-накопитель USB к компьютеру под управлением Windows 7 или Windows Server 2008 R2. Вы пытаетесь выполнить одну из следующих командных инструментов командной строки инструментария управления Windows (WMIC) для запроса жестких дисков на компьютере:

wmic diskdrive get *
wmic diskdrive get serialNumber

В этом случае вы получаете сообщение об ошибке, похожее на следующее:

Invalid XML content

ПРИЧИНА

Эта проблема возникает из-за того, что анализатор XML рассматривает управляющие символы, включенные в серийный номер некоторых дисков, как недействительные. Поэтому синтаксический анализатор XML не может анализировать содержимое, которое содержит эти управляющие символы. Это приводит к тому, что допустимые результаты для других дисков отображаются некорректно, а также к поведению, описанному в разделе «Проблема».

РАЗРЕШАЮЩАЯ СПОСОБНОСТЬ

Поддерживаемое исправление доступно от Microsoft. Тем не менее это исправление предназначено для устранения проблемы, описанной в этой статье. Это исправление применяется только к системам, в которых возникла проблема, описанная в этой статье. Это исправление может пройти дополнительное тестирование. Поэтому, если эта проблема не оказывает на вас серьезного влияния, рекомендуется дождаться следующего обновления программного обеспечения, содержащего это исправление.

Если исправление доступно для загрузки, в верхней части этой статьи базы знаний имеется раздел «Исправление доступно для загрузки». Если этот раздел не отображается, обратитесь в службу поддержки клиентов Microsoft, чтобы получить исправление.

Источник сообщение об ошибке «Invalid содержания XML» , когда вы запускаете команду WMIC в Windows 7 или в Windows Server 2008 R2

A lot of users face the Outlook invalid XML error that happens due to a variety of technical glitches.

If you, too, have been looking for solutions for fixing the invalid.XML error, you have come to the right place.

This is our guide on the top solutions, causes, and everything else about the Outlook XML error.

Reasons Behind the Outlook Invalid XML Error

There is not just one reason that can cause any Outlook file to go corrupt. Here are some of the important causes of the error that you must know to start with the right recovery method:

  • The first reason behind the error can be the faulty settings of the navigation pane. These settings directly affect the XML files of Outlook and end up corrupting or damaging them.
  • The active compatibility mode for Outlook can also be a major reason for these XML errors.
  • If you have been using the older versions of Outlook files, then they might catch errors sooner. However, this happens to be a rare case but not completely ignorable.

PS: if you are experiencing issues like Outlook loading profile stuck on MS Outlook, here are the top solutions for you.


Checking for the invalid.XML Error in Outlook Files

It is not difficult at all to diagnose this Outlook Invalid XML error. What makes the diagnosis of the problem easier is the existence of a single symptom only.

Upon trying to launch the Outlook program, you will face lagging issues, or the program will freeze for the time being.

Followed by this, you will see the following error message appear on the screen- “Cannot start Microsoft Outlook. Cannot open the Outlook window. Invalid XML, the view cannot be loaded“. To confirm that the error is related to the corruption of the XML file, check the file size to be 0.

Outlook Invalid XML Error
Outlook Invalid XML Error

Stellar Repair for Outlook – The Best Professional Fix for Outlook Invalid XML Error

It’s always best to start the safe and most effective way, even if you have to pay a little for it. You must not take the risk of errors occurring when you are fixing errors.

Thus, we introduce to you the best professional solution for fixing Outlook invalid XML errors, which is the Stellar Repair for Outlook tool.

This tool proves helpful in removing all errors from the PST of Personal Storage Files of Outlook. It further helps in recovering and restoring the data from those like file attachments, contact, and much more.

Primary Features of the Stellar Repair for Outlook:

  • The tool operates very simply, and that’s the best part about it. It is compatible with all Outlook versions, including 2007, 2010, 2013, 2016, and 2019.
  • The software comes with highly advanced GUI technology. This feature also helps it to facilitate precise mail recovery.
  • The software is powerful enough to fix even the locked or encrypted PST files for the invalid.XML error. You can also use the tool for troubleshooting the big PST files of sizes more than 2 GB.
  • As an additional benefit, the software allows the users to restore the recovered items only after previewing them. It even provides you with the loading scan information if you opt for that.
  • The software can also scan the HTML and RTF messages and restore the formatting from them.

Method of using the Stellar Outlook Repair Tool

  1. Begin with downloading the tool on a PC and installing it properly. After that, launch the tool.
  2. Now, you need to find the lost PST file, and there are two methods for doing so.

The first method is about finding the PST files if it’s stored in a drive.

On the main interface, click the button PST File for Repair. Next, click the option Find, followed by selecting all the drives in the dialog box where you think the files may be.

Once done with that, click the button Find along with the option Look in next to it. A list of all the PST files found in selected drives will emerge on the screen now, and you can select the ones you want to recover.

The second method is about finding the PST files if they were stored in any folder/subfolder.

On the main interface, click the option Select Outlook PST. Followed by that, hit the button Select PST File for Repair. Next, click the option Find and select all the drives in the dialog box.

Click the button Look in and select the folder where the files may have been stored. If they were in a subfolder, click the option Search Subfolders and then Find. All the recovered invalid.XML PST files will be listed on the screen now.

Stellar Outlook Repair

Once the files are in front of you on the software interface, you can start with the Repair procedure. Hit the button Repair so that the program can start scanning the files.

Wait for the time being till the process finishes and the Repair complete notification emerges. Click the option OK, followed by previewing the PST files. Check all the recovered files and decide which ones you want to restore finally.

Stellar Outlook Repair

The last step is to save the PST files once you are done with all the steps above. To do that, you will need to hit the button Save Repaired File present on the main interface of the tool.

The dialog box of Save As will appear now, in which you have to click the option Browse. Here, select the location where you want the files to be stored finally. Click the right option and hit Save.

Fix the Outlook Invalid XML Using Stellar Repair for Outlook

Manual methods of Fixing the Outlook Invalid XML Error

If you don’t want to try any professional way out and trust the manual methods better, here are the five best solutions to try for fixing the Outlook invalid XML error.

Method 1: Inbox Repair Tool

This is one of the most effective manual methods for fixing Outlook issues that involve the Inbox Repair Tool. It is a Microsoft tool that fixes various PST file errors and many other Outlook issues. You can effectively fix damaged PST files with this tool.

Therefore, we are going to give you the steps to follow to use this tool:

1. Open the Windows Explorer window on the PC. You can do so by hitting the keys Windows + E together.

2. After the Windows Explorer dialog menu opens, enter the following path command- “C:Program FilesMicrosoft Office{Office version}.” If your PC is installed with the 64-bit Windows version along with 32-bit Office, then enter the following path command- “C:Program Files x86Microsoft Office{Office version}“.

3. Now, in the next window, find the option Scanpst.exe. (how to locate the ScanPST location) Upon finding it, double-click on the icon. You can do so by hitting the Start button and pressing it. In the search dialog box, enter Scanpst.exe.

4. Hit on the button Browse to select the default PST file in Outlook or Outlook.pst file.

5. Move ahead with the process now and hit on the button Start. This will start the scanning process for the Outlook file. Upon catching any error, the tool will give a notification on the screen listing the errors found. The notification will look like “Errors were found in this file. To repair these errors, click Repair“.

Fix the Outlook Invalid XML Using Outlook Inbox Repair Tool

6. Follow the notification instructions now. Hit on the button Repair to start the repair process of invalid.XML PST files.

Method 2: Recovering the Configuration File in the Navigation Pane

The problems in the settings of the navigation pane also cause errors with the Outlook PST files. Thus, you need to check the navigation pane’s settings and ensure everything is right there.

If you think that they have gotten corrupted, then here are the steps to follow to fix them:

1. Open the Run command box by hitting the keys Windows + R simultaneously. In the box that appears now, enter the following command- Outlook.exe /resetnavpane.

2. Finally, hit the button OK or press the Enter Key to apply the command. Once the process finishes, launch Outlook. Check if everything is alright there.

Method 3: Turning the Outlook Compatibility Mode Off

If Outlook is running in compatibility mode on the PC, then the invalid.XML error might be a result of that. Thus, the logical solution that follows is to turn off the compatibility mode.

Here are the steps to follow to do so:

1. Hit on the button Start, and in the resultant dialog box, enter the following command- Outlook.exe.

Turn Outlook Compatibility Mode Off to Fix the Outlook Invalid XML

2. The Outlook program will appear on the screen now. Right-click on the icon, and from the drop-down menu, select the option Properties.

3. In the tab Properties, click the tab Compatibility. Here, find the option Run this program in compatibility for. Upon finding it, remove the tick from the box present next to the option. Hit the button OK to confirm.

Method 4: Restoring the PST File to Its Older Version

This is one method that can probably fix the Outlook invalid XML error and other issues in one go. Here are the steps to follow:

1. The first step includes finding out the folder where you think the target Outlook file was stored.

2. Upon finding the location or folder, hit right-click on the icon of the folder. From the drop-down menu, select the option Restore previous versions.

Restore PST File to Previous Version to Fix the Outlook Invalid XML

3. Another dialog box will appear on the screen now. This box will have all the latest versions of the Outlook folder listed. The list will appear under the tab Previous versions.

4. Find out the target Outlook file in this list. You may be able to find it in the latest folder.

5. Upon finding the corrupted or lost file, hit on the button Restore. In the pop-up that emerges, click the option Restore.

6. Being here, if you decide not o go with changing the older version to the latest one, click the option Copy. The file will now be saved in its older version at some other location.

Method 5: Removing the Configuration File in the Navigation Pane

If you can’t fix the files’ settings in the navigation pane, you still have the option of deleting them. This can help out, and here are the steps to follow:

1. Open the Run command box by hitting the keys Windows + R at the same time. In the box that appears now, enter the following command- %appdata%MicrosoftOutlook.

2. Once the command runs successfully, it will retrieve the files of the navigation pane configuration related to Microsoft Outlook.

3. Open the search box and enter the Outlook.XML file to find this data.

4. Upon finding the file, hit right-click on it. Select the option of Delete and check if the Outlook error is removed now.


Final Words

We highly recommend you try the Stellar Outlook repair tool for fixing the Outlook invalid XML error. This is much more effective than the manual methods.

However, if you have some technical expertise, then you can try out the manual methods too. Share your suggestions and queries with us in the comment section below.

This website uses cookies to ensure you get the best experience on our website

By Ryan Lambert — Published August 25, 2018

Update: This bug is fixed in the latest supported version’s minor releases. Upgrade to fix this 🐛 bug!

I ran into a problem when moving a database from a production PostGIS-enabled PostgreSQL
server to a development server for testing. Turns out, what I found is a bug in pg_dump related to
the XML data type. The problem encountered is filed under
bug #15342.
Tom Lane summarized the issue:

«There are two problems here: pg_dump neglects to force a safe
value of xmloption for the restore step, plus there doesn’t seem to be
a safe value for it to force :-(.»

The rest of this post explores what the problem is, how to tell if you are affected, and your options
if you find yourself in this group.

  • Who does this affect?
  • Data to reproduce the bug
  • Check for problematic XML data
  • Workaround for part of the problem
  • PostgreSQL and XML, and bug #15342
  • What to do?

Who does this affect?

This bug affects PostgreSQL databases that contain columns of the XML data type. More specifically,
it’s a problem if any of the XML data includes a <!DOCTYPE> block.
If you have XML data with the <!DOCTYPE> block, and also have true XML fragments, you are really affected.
These databases will experience headaches when restoring dump files saved using
the pg_dump or pg_dumpall utilities.

The Check for problematic XML data section below provides a query to help determine if your databases
are affected.

QGIS Layer Styles

If you have PostGIS databases that support QGIS users and those QGIS users store their styles
in the PostGIS database (look at public.layer_styles table), this affects you.
I discovered this bug because I am both an admin and analyst user of our PostGIS databases.
I use QGIS and I love that I can have my complex styles saved (and backed up!) directly in the
database with the spatial data itself.

QGIS achieves this by storing its XML style information in a table named
public.layer_styles in the database storing the PostGIS data.
Style information is stored in XML format in a column named styleqml that includes a
document type declaration
(<!DOCTYPE>). As I mentioned earlier, XML data with <!DOCTYPE> is at the core of this problem.

Data to reproduce the bug

The following SQL code will create a table with two columns and three rows of data. These three rows of
data are sufficient to replicate the error and illustrate the problem. I have replicated this issue on
PostgreSQL versions 9.5 through 11.

CREATE TABLE public.xml_doc (
    notes TEXT NOT NULL,
    data XML NOT NULL
);

-- Example derived from https://wiki.postgresql.org/wiki/XML_Support
INSERT INTO public.xml_doc 
SELECT 'Document, no DOCTYPE', 
    XMLROOT (
  XMLELEMENT (                                       
    NAME gazonk,                                
    XMLATTRIBUTES (
      'val' AS name,
      1 + 1 AS num
    ),
    XMLELEMENT (
      NAME qux,
      'foo'
    )
  ),
  VERSION '1.0',
  STANDALONE YES
)
;

-- Example XML document simplified from:  https://xmlwriter.net/xml_guide/doctype_declaration.shtml
INSERT INTO public.xml_doc 
SELECT 'Document, with DOCTYPE', 
    XMLPARSE (DOCUMENT '<?xml version="1.0" standalone="no" ?>
        <!DOCTYPE document SYSTEM "subjects.dtd">
        <document>
          <title>Subjects available in Mechanical Engineering.</title>
          <subjectID>2.303</subjectID>
        </document>')
;

-- Example dervied from https://wiki.postgresql.org/wiki/XML_Support
INSERT INTO public.xml_doc
SELECT 'Content fragment', 
    XMLPARSE (CONTENT 'abc<foo>bar</foo><bar>foo</bar>');

This example is derived from my original example SQL Fiddle. The SQL Fiddle version will not be maintained/updated.

Data loaded

The code above adds three rows of data with three classifications of XML data.

  • XML document, no DOCTYPE declaration
  • XML document, with DOCTYPE declaration
  • XML fragment

Only the Document, no DOCTYPE row will always load successfully from a pg_dump backup.
The Content fragment will load with the default setting, but fails with the workaround.
The Document, with DOCTYPE fails by default and only works with the workaround.

The following query shows the XML data loaded and checks the XML for valid documents.

SELECT notes, data IS DOCUMENT AS xml_document, data
    FROM public.xml_doc;
┌────────────────────────┬──────────────┬──────────────────────────────────────────────────────────────────────────────────────────┐
│         notes          │ xml_document │                                           data                                           │
╞════════════════════════╪══════════════╪══════════════════════════════════════════════════════════════════════════════════════════╡
│ Document, no DOCTYPE   │ t            │ <?xml version="1.0" standalone="yes"?><gazonk name="val" num="2"><qux>foo</qux></gazonk> │
│ Document, with DOCTYPE │ t            │ <?xml version="1.0" standalone="no"?>                                                   ↵│
│                        │              │                 <!DOCTYPE document SYSTEM "subjects.dtd">                               ↵│
│                        │              │                 <document>                                                              ↵│
│                        │              │                   <title>Subjects available in Mechanical Engineering.</title>          ↵│
│                        │              │                   <subjectID>2.303</subjectID>                                          ↵│
│                        │              │                 </document>                                                              │
│ Content fragment       │ f            │ abc<foo>bar</foo><bar>foo</bar>                                                          │
└────────────────────────┴──────────────┴──────────────────────────────────────────────────────────────────────────────────────────┘
(3 rows)

pg_dump and restore

With example data loaded we can take a backup of the database using pg_dump.

pg_dump -d xml_test -f xml_test_invalid.sql

On a second PostgreSQL server, create a new database and attempting to restore the backup using psql:

psql -d postgres -c "CREATE DATABASE restore_here;"
psql -d restore_here -f xml_test_invalid.sql

It starts out so encouraging…

SET
Time: 4.502 ms
SET
Time: 3.987 ms
SET
Time: 4.818 ms
...

But then… ERROR!

ERROR:  invalid XML content
DETAIL:  line 2: StartTag: invalid element name
  <!DOCTYPE document SYSTEM "subjects.dtd">
   ^
CONTEXT:  COPY xml_doc, line 2, column data: "<?xml version="1.0"
standalone="no"?>
  <!DOCTYPE document SYSTEM "subjects.dtd">
  <document>
    <..."

One particularly unfortunate aspect of this bug is that it doesn’t throw an error during the
pg_dump process. Instead, this bug shows up first when attempting to restore
a pg_dump file that includes XML data with the <!DOCTYPE> block.

This illustrates why an untested backup is not a backup! Some problems, like this one, only show up at the tail end of the process.

Check for problematic XML data

There are three steps to see if (or how badly) you are affected.

  • Database includes XML columns?
  • XML data includes <!DOCTYPE>
  • XML data includes fragments

Database includes XML

The following query will check the active database for any columns with the XML data type.
If this query does not return any rows, you do not have XML columns in this database,
and don’t have to worry about this bug.

SELECT table_schema, table_name, column_name
    FROM information_schema.columns 
    WHERE data_type = 'xml';

┌──────────────┬────────────┬─────────────┐
│ table_schema │ table_name │ column_name │
├──────────────┼────────────┼─────────────┤
│ public       │ xml_doc    │ data        │
└──────────────┴────────────┴─────────────┘
(1 row)

If rows are returned, make note of the table(s) and column(s), those will be used in the next two queries.

XML includes <!DOCTYPE>

If the prior query returned data, you need to check those columns for XML data including <!DOCTYPE> tags.
The following query shows a rough way to check for this by first
CASTing the XML column (named data) to TEXT and using the LIKE operator.

A count greater than zero (0) indicates your database has data including the DOCTYPE declaration.
This means, at minimum, you need to use the workaround discussed below in order to use pg_dump on that
database. If this query returns zero rows, you are not affected by this bug.

SELECT COUNT(*)
    FROM public.xml_doc
    WHERE data::TEXT LIKE '%<!DOCTYPE%';

┌───────┐
│ count │
├───────┤
│     1 │
└───────┘
(1 row)

When using pg_dumpall means these considerations apply instance wide, not just to a single database.

Do you have XML fragments too?

If you have XML data in your PostgreSQL database including DOCTYPE, you must also check for XML
fragment data. The reason why is discussed later.

SELECT COUNT(*)
        FROM public.xml_doc
        WHERE data IS NOT DOCUMENT;

If you have a count greater than zero on this query, and also found XML data with DOCTYPE, you have a big problem with pg_dump.
You have bug #15342.
We’ll come back to this after discussing the workaround if you only have DOCTYPE XML, no fragments.

Workaround for XML with DOCTYPE, but no fragments

If you have XML data with DOCTYPE included in the data (QGIS styles, for example) and no data that is just
XML fragments, the workaround is
to set an option at the top of the script: SET XML OPTION DOCUMENT;
This workaround will work, much of the time (provided no XML fragments…).
Experienced PostGIS / QGIS users have known about this issue the workaround for quite a while,
it was logged as
a QGIS bug back in 2014
that resulted in the QGIS team adding a note about this to
their user manual:

«If you want to make a backup of your PostGIS database using the pg_dump and pg_restore commands, and the default layer styles as saved by QGIS fail to restore afterwards, you need to set the XML option to DOCUMENT and the restore will work.»

That means add this:

SET XML OPTION DOCUMENT;

One caveat of this workaround is that you must use the plain SQL format for pg_dump. The custom
format dump file will not work because you are not able to edit the output to include the XML option.

If this workaround works for you, it’s trivial to update your backup commands to start each pg_dump
file with the required command.

echo "SET XML OPTION DOCUMENT;" > ~/tmp/database_with_xml.sql
pg_dump -d database_with_xml >> ~/tmp/database_with_xml.sql

PostgreSQL and XML, and Bug #15342

Before going on to the final part of this bug, let’s understand a bit more about
how PostgreSQL supports XML. I’ve been lucky enough to mostly avoid XML data, so I had to dive into
the PostgreSQL docs to learn more
about how XML is handled.

«The xml type can store well-formed “documents”, as defined by the XML standard, as well as “content” fragments»

This introduces concepts of XML document and fragments. I had already shown you this concept
above in SQL code with IS DOCUMENT and IS NOT DOCUMENT in the queries.

Now refer back to the workaround above, that setting overrides the default setting of CONTENT
with the setting DOCUMENT. Though this next statement from the
docs seems to indicate the workaround should not be required (emphasis mine):

«The default is CONTENT, so all forms of XML data are allowed

Wait, if all forms of XML data are allowed in CONTENT as this states, why do we have to use a
workaround to override that setting? There is a note further down in the PostgreSQL docs that seem to explain this:

«With the default XML option setting, you cannot directly cast character strings to type xml if they contain a document type declaration, because the definition of XML content fragment does not accept them. If you need to do that, either use XMLPARSE or change the XML option.«

DOCUMENT setting and Fragments

The above workaround of adding SET XML OPTION DOCUMENT; was so easy, right? The problem
is when you set this option, XML fragments (accepted by the default CONTENT setting) are now rejected.
They aren’t documents. Re-visiting our query from the beginning, notice Content fragment is False.

SELECT notes, data IS DOCUMENT AS xml_document, data
    FROM public.xml_doc;
┌────────────────────────┬──────────────┬──────────────────────────────────────────────────────────────────────────────────────────┐
│         notes          │ xml_document │                                           data                                           │
╞════════════════════════╪══════════════╪══════════════════════════════════════════════════════════════════════════════════════════╡
│ Document, no DOCTYPE   │ t            │ <?xml version="1.0" standalone="yes"?><gazonk name="val" num="2"><qux>foo</qux></gazonk> │
│ Document, with DOCTYPE │ t            │ <?xml version="1.0" standalone="no"?>                                                   ↵│
│                        │              │                 <!DOCTYPE document SYSTEM "subjects.dtd">                               ↵│
│                        │              │                 <document>                                                              ↵│
│                        │              │                   <title>Subjects available in Mechanical Engineering.</title>          ↵│
│                        │              │                   <subjectID>2.303</subjectID>                                          ↵│
│                        │              │                 </document>                                                              │
│ Content fragment       │ f            │ abc<foo>bar</foo><bar>foo</bar>                                                          │
└────────────────────────┴──────────────┴──────────────────────────────────────────────────────────────────────────────────────────┘
(3 rows)

Trying to restore the database dump now fails on the record that is an XML fragment, instead of failing
on the record with the <!DOCTYPE>.

ERROR:  invalid XML document
DETAIL:  line 1: Start tag expected, '<' not found
abc<foo>bar</foo><bar>foo</bar>
^
CONTEXT:  COPY xml_doc, line 3, column data: "abc<foo>bar</foo><bar>foo</bar>"

This illustrates the real problem. Without the workaround, it’s impossible to restore XML
data that uses <!DOCTYPE>.
With the workaround, XML fragments will fail to restore. If you have both…

If your PostgreSQL databases have XML fragments and XML with <!DOCTYPE>, pg_dump will not restore properly.

What to do?

If you have a database that includes XML data making pg_dump unusable, what can you do?

  • Implement more reliable backups
  • Evaluate and standardize your XML data
  • Split databases / instances

Backups

While pg_dump is a great utility for specific purposes, it should not be relied upon
as your main backup process. A tool such as
pgbackrest
or
barman
is far better suited for that task.
We use pgbackrest at RustProof Labs, and those backups do not suffer from the problem
that pg_dump does in this instance. That discussion is far beyond the scope of this post.

If you currently are scripting database backups using pg_dump or pg_dumpall, it’s worth the
effort to invest in a more reliable backup solution.

Evaluate and standardize

If your database has XML data with DOCTYPE and fragments both, try to evaluate if one of the two XML
types can be converted to either a more/less formal XML data format. The answer to if you can do
this will be very context specific to your data, systems, users, and software.

For example, our PostGIS databases are used regularly from QGIS, and I love saving our styles directly
in the database. Because of this, and the fact that QGIS’s style XML includes <!DOCTYPE>, that means having
XML fragments would cause a serious problem. Luckily, this is the only XML our databases contain and I don’t
see any new XML sources coming in anytime soon. In our case, the workaround works.

Split data

If you have both <!DOCTYPE> and XML fragments, and can’t convert one to the other, try to split the
different data out into different databases at minimum, but different PostgreSQL instances would be preferred.
Without splitting that data into different instances, pg_dumpall would be affected even if the XML sources
are in different databases.

Summary

If a PostgreSQL database stores a mix of XML data, specifically including records with
<!DOCTYPE> blocks, the pg_dump utility can generate invalid database dump files.
There is a workaround, but it only works if the database does not include any XML fragments.
If you have both <!DOCTYPE> and fragments, pg_dump is going to have a bad time.

I don’t have a good idea of how many PostgreSQL databases this affects. The PostGIS
community has a large number of users, and many of those databases support QGIS
users storing layers in the public.layer_styles table.
The workaround should work for many of those users, unless their database also stores fragments of XML as well.

Hopefully this bug is fixed at some point, I will try to update this post to reflect the status
when that happens.

Need help with your PostgreSQL servers or databases?
Contact us
to start the conversation!

By Ryan Lambert
Published August 25, 2018
Last Updated November 01, 2022

Понравилась статья? Поделить с друзьями:
  • Invalid use of property vba ошибка
  • Invalid url как исправить
  • Invalid url error fix
  • Invalid token pubg ошибка
  • Invalid timestamp libapp md5 checksum error на литрес что делать