XML

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Daniel Krebs Daniel Krebs 3 weeks, 6 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #52254
    Profile photo of Christo Kolander
    Christo Kolander
    Participant

    Hi! I have run into a XML problem(Not yet good enough to contribute, hopefully, I will be someday!). I have used the get-content cmdlet and opened up a file in xml using [xml], stuck it in a $variabel and so forth. Managed to address two nodes and change the value by drilling down the hierarchy to.....childnodes.Item(nr). No problem so fare, but what about hte third node, a node named "XmlDefinition"? This is of type string containing some CAML(I think) and two "values" I would like to replace (I use the file in SP deployments). The node and the string looks like this:

    
    	IwanttoreplacethisGUID}" MobileView="TRUE" Type="HTML" Hidden="TRUE" DisplayName="" Url="IwanttoreplacethisURL" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/dlicon.png?rev=43" >30clienttemplates.jsmain.xsl
    

    Question: How would I address ONLY the 2 highlighted pieces of information, replace the GUID and the URL, save the file, using just PowerShell? I have tried getting to it by innertext,data and outerxml and use the replace operator, but no luck. It's not a big deal if it does no work – I get the job done by get-content and set-content, but I dont think this is the right approach.

    I am just pissed off by this IT brick wall.

    Well, there you have it...

    Wish you all well

    /C.

    #52272
    Profile photo of Daniel Krebs
    Daniel Krebs
    Participant

    I think I can help you if you post the full XML (sanitize any confidential details) on an external site like PasteBin, TinyPaste, Hastebin or Gist and link to it here.

    Thanks very much.
    -Daniel

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.