en-US/Xmlips.dll-Help.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 |
<?xml version="1.0" encoding="utf-8"?>
<helpItems xmlns="http://msh" schema="maml"> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Add-Xml</command:name> <maml:description> <maml:para>Adds an XML element.</maml:para> </maml:description> <command:verb>Add</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>The command creates and adds a new XML element to the specified.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Add-Xml</maml:name> <command:parameter required="true" position="0" > <maml:name>Tag</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> <command:parameter required="true" position="1" > <maml:name>Xml</maml:name> <command:parameterValue required="true">XmlElement[]</command:parameterValue> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Namespace</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" position="0" > <maml:name>Tag</maml:name> <maml:description> <maml:para>Specifies the new element name.</maml:para> </maml:description> </command:parameter> <command:parameter required="true" pipelineInput="true (ByValue)" position="1" > <maml:name>Xml</maml:name> <maml:description> <maml:para>Specifies the parent element.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Namespace</maml:name> <maml:description> <maml:para>The namespace URI of the element.</maml:para> </maml:description> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Xml.XmlElement</maml:name> </dev:type> <maml:description> <maml:para>Input parent XML element.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Xml.XmlElement</maml:name> </dev:type> <maml:description> <maml:para>Added child XML element.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <command:examples> <command:example> <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$xml = [xml]'<r/>' Add-Xml e $xml.DocumentElement | Set-Xml a, 1 $xml.OuterXml</dev:code> <dev:remarks> <maml:para>This example adds a new element "e" to the root element and passes the added result element in Set-Xml which sets its attribute "a" to "1".</maml:para> </dev:remarks> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Copy-Xml</command:name> <maml:description> <maml:para>Copies the inner XML of one element to another.</maml:para> </maml:description> <command:verb>Copy</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>The cmdlet compares inner XML of the source and target. If they are different then the source is copied to the target. Note that this command does not affect attributes.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Copy-Xml</maml:name> <command:parameter required="true" position="0" > <maml:name>Source</maml:name> <command:parameterValue required="true">XmlElement</command:parameterValue> </command:parameter> <command:parameter required="true" position="1" > <maml:name>Target</maml:name> <command:parameterValue required="true">XmlElement</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" position="0" > <maml:name>Source</maml:name> <maml:description> <maml:para>Specifies the source element.</maml:para> </maml:description> </command:parameter> <command:parameter required="true" position="1" > <maml:name>Target</maml:name> <maml:description> <maml:para>Specifies the target element.</maml:para> </maml:description> </command:parameter> </command:parameters> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Export-Xml</command:name> <maml:description> <maml:para>Exports elements as fragments.</maml:para> </maml:description> <command:verb>Export</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>The cmdlet exports specified XML elements as fragments. Exported elements may be imported later by Import-Xml. The cmdlet may be used in order to save XML query results for later use. Another use case is logging using XML format, in this case the switch Append is normally used in order to add new data to logs effectively.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Export-Xml</maml:name> <command:parameter required="true" position="0" > <maml:name>Path</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> <command:parameter required="true" position="1" > <maml:name>Xml</maml:name> <command:parameterValue required="true">XmlElement[]</command:parameterValue> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Append</maml:name> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" position="0" > <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the destination file path.</maml:para> </maml:description> </command:parameter> <command:parameter required="true" pipelineInput="true (ByValue)" position="1" > <maml:name>Xml</maml:name> <maml:description> <maml:para>Specifies elements to be exported.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Append</maml:name> <maml:description> <maml:para>Tells to append data if the file exists.</maml:para> </maml:description> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Xml.XmlElement</maml:name> </dev:type> <maml:description> <maml:para>XML elements.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Import-Xml</maml:linkText> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Find-Xml</command:name> <maml:description> <maml:para>Gets the specified existing or just added element.</maml:para> </maml:description> <command:verb>Find</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>The cmdlet gets a single element specified by its name, key attribute name, and unique value. If the element is not found then it is created with the specified key attribute value and added to the input parent.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Find-Xml</maml:name> <command:parameter required="true" position="0" > <maml:name>Tag</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> <command:parameter required="true" position="1" > <maml:name>Key</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> <command:parameter required="true" position="2" > <maml:name>Value</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> <command:parameter required="true" position="3" > <maml:name>Xml</maml:name> <command:parameterValue required="true">XmlElement[]</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" position="0" > <maml:name>Tag</maml:name> <maml:description> <maml:para>Specifies the element name.</maml:para> </maml:description> </command:parameter> <command:parameter required="true" position="1" > <maml:name>Key</maml:name> <maml:description> <maml:para>Specifies the key attribute name.</maml:para> </maml:description> </command:parameter> <command:parameter required="true" position="2" > <maml:name>Value</maml:name> <maml:description> <maml:para>Specifies the unique attribute value.</maml:para> </maml:description> </command:parameter> <command:parameter required="true" pipelineInput="true (ByValue)" position="3" > <maml:name>Xml</maml:name> <maml:description> <maml:para>Specifies the parent element.</maml:para> </maml:description> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Xml.XmlElement</maml:name> </dev:type> <maml:description> <maml:para>XML elements.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Xml.XmlElement</maml:name> </dev:type> <maml:description> <maml:para>Found or created XML element.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <command:examples> <command:example> <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$xml = [xml]'<r> <e a="1"/> </r>' Find-Xml e a 1 $xml.DocumentElement Find-Xml e a 2 $xml.DocumentElement $xml.OuterXml</dev:code> <dev:remarks> <maml:para>The first Find-Xml gets the existing element "e" with a="1". The second Find-Xml gets the created element "e" with a="2".</maml:para> </dev:remarks> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Get-Xml</command:name> <maml:description> <maml:para>Gets XML nodes or data using XPath.</maml:para> </maml:description> <command:verb>Get</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>The cmdlet uses XPath queries to search for nodes or data in XML nodes.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-Xml</maml:name> <command:parameter required="true" position="0" > <maml:name>XPath</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> <command:parameter required="true" position="1" > <maml:name>Xml</maml:name> <command:parameterValue required="true">XmlNode[]</command:parameterValue> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Namespace</maml:name> <command:parameterValue required="true">IDictionary</command:parameterValue> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Property</maml:name> <command:parameterValue required="true">Object[]</command:parameterValue> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Single</maml:name> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" position="0" > <maml:name>XPath</maml:name> <maml:description> <maml:para>Specifies an XPath search query. Variables are supported. XPath uses the same variable notation as PowerShell: $Variable. Variables are evaluated as existing PowerShell variables.</maml:para> </maml:description> </command:parameter> <command:parameter required="true" pipelineInput="true (ByValue)" position="1" > <maml:name>Xml</maml:name> <maml:description> <maml:para>Specifies one or more XML nodes. The XPath query is applied to them.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Namespace</maml:name> <maml:description> <maml:para>Specifies a hash table of the namespaces used in the XML. See Select-Xml parameter Namespace for more details.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Property</maml:name> <maml:description> <maml:para>Tells to evaluate the specified XPath expressions on the result node and return them as PSObject properties. Strings may be converted to specified types. The parameter accepts one or more items. Items are defined as: <XPath> Get-Xml //log $xml -Property '@time', '@count' @{<PropertyName> = <XPath>} Get-Xml //log $xml -Property @{Time = '@time'}, @{Count = '@count'} @{<PropertyName> = <XPath>, <ResultType>} Get-Xml //log $xml -Property @( @{Time = '@time', [DateTime]} @{Count = '@count', [int]} ) PowerShell conversion is used to convert strings to specified types.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Single</maml:name> <maml:description> <maml:para>Tells to return the first found node, if any, for each input node.</maml:para> </maml:description> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Xml.XmlNode</maml:name> </dev:type> <maml:description> <maml:para>XML nodes.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Xml.XmlNode</maml:name> </dev:type> <maml:description> <maml:para>XML nodes.</maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>PSObject</maml:name> </dev:type> <maml:description> <maml:para>Objects with evaluated properties specified by Property.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <command:examples> <command:example> <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$xml = [xml]'<r> <e a="1"/> <e a="2"/> </r>' $a = 2 Get-Xml '//e[@a = $a]' $xml</dev:code> <dev:remarks> <maml:para>This example creates an XML document and gets an element "e" which attribute "a" is equal to 2. The value is specified by a variable.</maml:para> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title> <dev:code>$xml = [xml]'<r> <e id="1" date="2015-01-02"/> <e id="2" date="2015-11-12"/> </r>' Get-Xml //e $xml -Property @{Id = '@id', [int]}, @{Date = '@date', [DateTime]}</dev:code> <dev:remarks> <maml:para>This example queries for elements "e" and tells to return PSObject's with properties "Id" (int) and "Date" (DateTime) based on attributes "id" and "date".</maml:para> </dev:remarks> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Import-Xml</command:name> <maml:description> <maml:para>Imports elements from a file or strings.</maml:para> </maml:description> <command:verb>Import</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>The command reads elements from the source with multiple root elements. The result is a single element "root" which contains imported elements as child nodes.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Import-Xml</maml:name> <command:parameter required="true" position="0" > <maml:name>Path</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Import-Xml</maml:name> <command:parameter required="true" position="named" > <maml:name>Content</maml:name> <command:parameterValue required="true">String[]</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" position="0" > <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the source file path.</maml:para> </maml:description> </command:parameter> <command:parameter required="true" position="named" > <maml:name>Content</maml:name> <maml:description> <maml:para>Specifies the content string(s).</maml:para> </maml:description> </command:parameter> </command:parameters> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Xml.XmlElement</maml:name> </dev:type> <maml:description> <maml:para>An element "root" with imported elements.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <command:examples> <command:example> <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code># pandoc.exe --to=html outputs as XHTML, without --standalone it is not well-formed XML $fragments = pandoc.exe --to=html README.md # import and get all links, the namespace http://www.w3.org/1999/xhtml is not needed Import-Xml -Content $fragments | Get-Xml //a</dev:code> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Export-Xml</maml:linkText> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>New-Xml</command:name> <maml:description> <maml:para>Creates a new XML element.</maml:para> </maml:description> <command:verb>New</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>The cmdlet creates and returns an XML element.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-Xml</maml:name> <command:parameter required="false" position="0" > <maml:name>Tag</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> <command:parameter required="false" position="1" > <maml:name>Attribute</maml:name> <command:parameterValue required="true">String[]</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" position="0" > <maml:name>Tag</maml:name> <maml:description> <maml:para>Specifies the new element name. The default name is "root".</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="1" > <maml:name>Attribute</maml:name> <maml:description> <maml:para>Specifies attribute name/value pairs followed by an optional inner text. In other words, if the number of items is odd then the last item is the inner text.</maml:para> </maml:description> </command:parameter> </command:parameters> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Xml.XmlElement</maml:name> </dev:type> <maml:description> <maml:para>Created XML element.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Save-Xml</command:name> <maml:description> <maml:para>Saves a document read by Read-Xml.</maml:para> </maml:description> <command:verb>Save</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>The cmdlet saves a document read by Read-Xml if it is changed.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Save-Xml</maml:name> <command:parameter required="true" position="0" > <maml:name>Xml</maml:name> <command:parameterValue required="true">XmlNode</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" position="0" > <maml:name>Xml</maml:name> <maml:description> <maml:para>Any node of the document read by Read-Xml.</maml:para> </maml:description> </command:parameter> </command:parameters> <command:examples> <command:example> <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$xml = Read-Xml data.xml ... Save-Xml $xml</dev:code> <dev:remarks> <maml:para>The example shows a typical scenario: an XML document is read from a file, some operations are performed on returned $xml, and then Save-Xml is called.</maml:para> </dev:remarks> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Read-Xml</maml:linkText> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Set-Xml</command:name> <maml:description> <maml:para>Sets XML attributes and text.</maml:para> </maml:description> <command:verb>Set</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>The cmdlet sets the specified attribute and text values.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-Xml</maml:name> <command:parameter required="true" position="0" > <maml:name>Attribute</maml:name> <command:parameterValue required="true">String[]</command:parameterValue> </command:parameter> <command:parameter required="true" position="1" > <maml:name>Xml</maml:name> <command:parameterValue required="true">XmlElement[]</command:parameterValue> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Change</maml:name> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Changed</maml:name> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" position="0" > <maml:name>Attribute</maml:name> <maml:description> <maml:para>Specifies attribute name/value pairs followed by an optional inner text. In other words, if the number of items is odd then the last item is the inner text.</maml:para> </maml:description> </command:parameter> <command:parameter required="true" pipelineInput="true (ByValue)" position="1" > <maml:name>Xml</maml:name> <maml:description> <maml:para>Specifies the XML element which attributes and text are set.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Change</maml:name> <maml:description> <maml:para>Tells to set only changed values. The same values are not set and the document is not changed. This may avoid unnecessary writing to disk by Save-Xml.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Changed</maml:name> <maml:description> <maml:para>Tells to set only changed values and return changed information. For each changed value an object describing the change is written. The properties are Attribute, OldValue, NewValue, Element. The attribute name is empty for the text value.</maml:para> </maml:description> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Xml.XmlElement</maml:name> </dev:type> <maml:description> <maml:para>XML element which attributes and text are set.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None or change information objects</maml:name> </dev:type> <maml:description> <maml:para>Optional change data information.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <command:examples> <command:example> <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$xml = [xml]'<r> <e a="1"/> <e/> </r>' Get-Xml //e $xml | Set-Xml a, 2 $xml.InnerXml</dev:code> <dev:remarks> <maml:para>This example gets all elements "e" and sets their attribute "a" to "2".</maml:para> </dev:remarks> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Read-Xml</command:name> <maml:description> <maml:para>Reads a document and gets its root element.</maml:para> </maml:description> <command:verb>Read</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>The cmdlet reads an XML document from a file and returns its root element. Use Save-Xml with any node of this document in order to save the changes. Note that Save-Xml does not write to disk if the document is not changed. The document, if needed, can be obtained as the property OwnerDocument. It is derived from XmlDocument and contains extra properties: IsChanged Tells that the document is changed. IsNew Tells that the document is created from Content.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Read-Xml</maml:name> <command:parameter required="true" position="0" > <maml:name>Path</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Content</maml:name> <command:parameterValue required="true">String</command:parameterValue> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Settings</maml:name> <command:parameterValue required="true">XmlReaderSettings</command:parameterValue> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Backup</maml:name> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" position="0" > <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the source XML file. The file must exist unless Content is specified.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Backup</maml:name> <maml:description> <maml:para>Tells to create a backup copy of the original source file on saving of the changed document by Save-Xml. The backup file name is the original name with added ".bak".</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Content</maml:name> <maml:description> <maml:para>Tells to create a new document from the specified content if the source file does not exist. In this case the properties IsNew and IsChanged are set to true.</maml:para> </maml:description> </command:parameter> <command:parameter required="false" position="named" > <maml:name>Settings</maml:name> <maml:description> <maml:para>Specifies the custom XML reader settings instead of the default.</maml:para> </maml:description> </command:parameter> </command:parameters> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Xmlips.FileXmlDocument</maml:name> </dev:type> <maml:description> <maml:para>XmlDocument with extra members IsNew, IsChanged.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <command:examples> <command:example> <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$xml = Read-Xml data.xml ... Save-Xml $xml</dev:code> <dev:remarks> <maml:para>The example shows a typical scenario: an XML document is read from a file, some operations are performed on returned $xml, and then Save-Xml is called.</maml:para> </dev:remarks> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Save-Xml</maml:linkText> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <command:details> <command:name>Remove-Xml</command:name> <maml:description> <maml:para>Removes XML nodes.</maml:para> </maml:description> <command:verb>Remove</command:verb> <command:noun>Xml</command:noun> </command:details> <maml:description> <maml:para>This cmdlet removes the input nodes from their parents.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-Xml</maml:name> <command:parameter required="true" position="0" > <maml:name>Xml</maml:name> <command:parameterValue required="true">XmlNode[]</command:parameterValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" pipelineInput="true (ByValue)" position="0" > <maml:name>Xml</maml:name> <maml:description> <maml:para>Specifies one or more nodes to be removed.</maml:para> </maml:description> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Xml.XmlNode</maml:name> </dev:type> <maml:description> <maml:para>XML nodes to be removed.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:examples> <command:example> <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title> <dev:code>$xml = [xml]'<r> <e a="1"/> <e a="2"/> </r>' Get-Xml '//e[@a = 2]' $xml | Remove-Xml $xml.InnerXml</dev:code> <dev:remarks> <maml:para>This example gets elements with a="2" and removes them.</maml:para> </dev:remarks> </command:example> </command:examples> <maml:relatedLinks> <maml:navigationLink> <maml:linkText>Project site:</maml:linkText> <maml:uri>https://github.com/nightroman/Xmlips</maml:uri> </maml:navigationLink> </maml:relatedLinks> </command:command> </helpItems> |