XML Parsing in SharePoint file

asif ahamed 196 Reputation points

Is there a way to parse this xml file got it from sharpoint
<?xml version="1.0"?>
<xml xmlns:z="#RowsetSchema" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882">
<s:Schema id="RowsetSchema">
<s:ElementType rs:CommandTimeout="30" content="eltOnly" name="row">
<s:AttributeType rs:name="Title" name="ows_LinkTitle" rs:number="1">
<s:datatype dt:maxLength="512" dt:type="string"/>

<z:row ows_Created="2021-09-20 12:57:40" ows_Hardware="Yes" ows_IT_x0020_Applications_x0020_List="Domain/Windows/Network ID eMail (Exchange/Outlook) VPN My Cloud (ERP) Additional Responsibilities My Development " ows_NewHireN="5" ows_Additional_x0020_Information="Ship iPhone and Macbook to below address, using the cost center 201.0000.01933.55133.000.0000.0000 Address: Syed ANinja 1034 BRADLEY TERRACE Chicago, IL L9T 5S7 Phone: 416-555-5555 " ows_Peer_x0020_Comments="Please ship a macbook pro 13" from Cyber security's lot of macbooks. " ows_Peer="10374;#i:0#.w|domain\itsec_consultant" ows_Cost_x0020_Center=" 201.0000.01933.55133.000.0000.0000" ows_isStandard="iPhone" ows_Extension_x0020_Needed="No" ows_Computer_x0020_Hardware="Yes" ows_Mobile_x0020_Phone="Yes" ows_New_x0020_Phone="Yes" ows_IT_x0020_Applications=";#Domain/Windows/Network ID;#eMail (Exchange/Outlook);#VPN;#Oracle Cloud (ERP) Additional Responsibilities;#I Development;#" ows_Effective_x0020_Start_x0020_Date="2021-09-27 00:00:00" ows_isManager="No" ows_New_x0020_Hire_x0020_Role="IT" ows_New_x0020_Hire_x0020_Address="300 Marco Blvd" ows_New_x0020_Hire_x0020_City="Paris" ows_New_x0020_Hire_x0020_Province="ILI a" ows_New_x0020_Hire_x0020_Employee_x0="226953" ows_New_x0020_Hire_x0020_Job_x0020_T="help desk" ows_New_x0020_Hire_x0020_Department="Enterprise Architecture" ows_New_x0020_Hire_x0020_Last_x0020_="Ahmed" ows_New_x0020_Hire_x0020_First_x0020="Syed" ows_Work_x0020_Status="Full Time" ows_New_x0020_Hire_x0020_Type="Permanent " ows_Office_x0020_Phone_x0020_Number="6478826765" ows_Submitter_x0020_Name="8179;#i:0#.w|domain\testUser" ows_LinkTitle="New Hire"/>

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,886 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 38,821 Reputation points

    Once you clean up the quoting problem in that XML file you can deal with it like this:

    $xml = [xml](get-content c:\junk\xml.xml)

    Having namespaces in the XML makes navigating slightly more difficult, but let's say you wanted to get the entire "row":

    $row = $xml.xml.data.row

    If you want to pull out individual attributes of a row:

    # Or, using the $row variable from the previous example
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Rich Matheisen 38,821 Reputation points

    I think that file needs to be cleaned up. You've got a mixture of single and double quoted strings, and one of the attributes, specifically the attribute ows_Peer_x0020_Comments, is incorrect.

    The value of the attribute contains three double-quotes, the 2nd of which terminates the value prematurely:

    ows_Peer_x0020_Comments="Please ship a macbook pro 13" from Cyber security's lot of macbooks. "

    0 comments No comments

  2. Limitless Technology 37,746 Reputation points


    Thank you for reaching out.

    You can use lxml

    Please have al look on below Microsoft article : https://learn.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/aa543819(v%3Doffice.14)

    Thank you,

    0 comments No comments

  3. Limitless Technology 37,746 Reputation points

    Hello again @asif ahamed

    There are many also forums for this that you can try out

    Check the accepted answer in this forum

    --If the the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments