Powershell XML file modification

Hi,
Could someone assist me with a Powershell / XML type question please, i am trying to write out element values in a nmde but its being writen at the wrong level, i cant seem to get it working.
Thanks
Source XML file
<?xml version="1.0" encoding="utf-8"?>
<manifest>
  <meta>
    <manifestVersion>1.1</manifestVersion>
    <createdDateTime>23.01.2014 14:16:53</createdDateTime>
    <createdBy>EnterpriseTransporter, Version=5.0.3.7, Culture=neutral, PublicKeyToken=null</createdBy>
    <modifiedDateTime>24.01.2014 16:15:41</modifiedDateTime>
    <lastRunDateTime>24.01.2014 16:15:38</lastRunDateTime>
    <lastRunDuration>2.74</lastRunDuration>
    <lastRunMode>preview</lastRunMode>
  </meta>
  <options bulk="false" turbo="false" ignoreWarnings="true" triggerSlowsync="false" migrateWlan="false" />
  <datasources>
    <sourceDomain label="Source">
      <defaults serverName="" />
    </sourceDomain>
    <destinationDomain label="Target">
      <defaults serverName="" groupName="something" ITPolicyName="something2" SwConfigName="" />
    </destinationDomain>
  </datasources>
  <users>
    <user email="" destServer="" groupName="" ITPolicyName="" SwConfigName="" />
 </users>
</manifest>
Script
$path = "C:\Script\bet\manifestsource.xml"
$csvPath = "C:\Script\bet\import.csv"
$doc = [xml](Get-Content -Path $path)
foreach($e in (Import-Csv -Path $csvPath))
 $element = $doc.Manifest.users.user.clone()
 $element.email = $e.useremail
 $element.destServer = $e.destServer
 $element.groupName = "Something"
 $element.ITPolicyName = "Something2"
 $element.SwConfigName = ""
 $doc.DocumentElement.AppendChild($element)
$doc.Save("C:\Script\bet\manifest.xml")
This is what i get
<?xml version="1.0" encoding="utf-8"?>
<manifest>
  <meta>
    <manifestVersion>1.1</manifestVersion>
    <createdDateTime>23.01.2013 14:16:53</createdDateTime>
    <createdBy>EnterpriseTransporter, Version=5.0.3.7, Culture=neutral, PublicKeyToken=null</createdBy>
    <modifiedDateTime>24.03.2013 16:15:41</modifiedDateTime>
    <lastRunDateTime>24.03.2013 16:15:38</lastRunDateTime>
    <lastRunDuration>2.74</lastRunDuration>
    <lastRunMode>preview</lastRunMode>
  </meta>
  <options bulk="false" turbo="false" ignoreWarnings="true" triggerSlowsync="false" migrateWlan="false" />
  <datasources>
    <sourceDomain label="Source">
      <defaults serverName="" />
    </sourceDomain>
    <destinationDomain label="Target">
      <defaults serverName="" groupName="HSFProd-Baseline" ITPolicyName="HSFGlobal" SwConfigName="" />
    </destinationDomain>
  </datasources>
  <users>
    <user email="" destServer="" groupName="" ITPolicyName="" SwConfigName="" />
  </users>
  <user email="[email protected]" destServer="server1" groupName="something" ITPolicyName="something2" SwConfigName="" />
  <user email="[email protected]" destServer="server2" groupName="something" ITPolicyName="something2" SwConfigName="" />
  <user email="[email protected]" destServer="server1" groupName="something" ITPolicyName="something2" SwConfigName="" />
</manifest>
This is what i need
<?xml version="1.0" encoding="utf-8"?>
<manifest>
  <meta>
    <manifestVersion>1.1</manifestVersion>
    <createdDateTime>23.01.2013 14:16:53</createdDateTime>
    <createdBy>EnterpriseTransporter, Version=5.0.3.7, Culture=neutral, PublicKeyToken=null</createdBy>
    <modifiedDateTime>24.03.2013 16:15:41</modifiedDateTime>
    <lastRunDateTime>24.03.2013 16:15:38</lastRunDateTime>
    <lastRunDuration>2.74</lastRunDuration>
    <lastRunMode>preview</lastRunMode>
  </meta>
  <options bulk="false" turbo="false" ignoreWarnings="true" triggerSlowsync="false" migrateWlan="false" />
  <datasources>
    <sourceDomain label="Source">
      <defaults serverName="" />
    </sourceDomain>
    <destinationDomain label="Target">
      <defaults serverName="" groupName="HSFProd-Baseline" ITPolicyName="HSFGlobal" SwConfigName="" />
    </destinationDomain>
  </datasources>
  <users>
    <user email="[email protected]" destServer="server1" groupName="something" ITPolicyName="something2" SwConfigName="" />
    <user email="[email protected]" destServer="server2" groupName="something" ITPolicyName="something2" SwConfigName="" />
    <user email="[email protected]" destServer="server1" groupName="something" ITPolicyName="something2" SwConfigName="" />
  </users>
</manifest>

The following work perfectly for me:
$doc=[xml]@'
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<meta>
<manifestVersion>1.1</manifestVersion>
<createdDateTime>23.01.2014 14:16:53</createdDateTime>
<createdBy>EnterpriseTransporter, Version=5.0.3.7, Culture=neutral, PublicKeyToken=null</createdBy>
<modifiedDateTime>24.01.2014 16:15:41</modifiedDateTime>
<lastRunDateTime>24.01.2014 16:15:38</lastRunDateTime>
<lastRunDuration>2.74</lastRunDuration>
<lastRunMode>preview</lastRunMode>
</meta>
<options bulk="false" turbo="false" ignoreWarnings="true" triggerSlowsync="false" migrateWlan="false" />
<datasources>
<sourceDomain label="Source">
<defaults serverName="" />
</sourceDomain>
<destinationDomain label="Target">
<defaults serverName="" groupName="something" ITPolicyName="something2" SwConfigName="" />
</destinationDomain>
</datasources>
<users>
<user email="" destServer="" groupName="" ITPolicyName="" SwConfigName="" />
</users>
</manifest>
$user=$doc.SelectSingleNode('//users/user')
Import-Csv -Path c:\scripts\testman.csv |
ForEach-Object{
$u=$user.Clone()
$u.email = $_.useremail
$u.destServer = $_.destserv
$u.groupName = 'group'
$u.ITPolicyName = "Something2"
$uSwConfigName = ""
$doc.Manifest.users.AppendChild($u)
¯\_(ツ)_/¯

Similar Messages

  • Powershell - XML file query

    Hello, I need to query an XML based file to extract info.  I have used the line below in a script with success,
    $Xml.category.machine | Select-Object -Property IP | format-table
    based on querying an XML file formatted as below
    <Category name="System Summary">
     <!--1. machine details-->
     <Machine test="22">
      <Name>Server1</Name>
      <IP>31.248.95.170</IP>
    However the data I need to query is in the format of below.  Can anyone help with how I can reference this to get output from below of Display_Name, State and Start_Mode (the 'Category' field is not unique in the 2nd file so ideally I would be able
    to search for Category name="System Summary" but this doesn't work for me.   Thanks!
    <Category name="Services">
    <Data>
    <Display_Name><![CDATA[Adobe Flash Player Update Service]]></Display_Name>
    <Name><![CDATA[AdobeFlashPlayerUpdateSvc]]></Name>
    <State><![CDATA[Stopped]]></State>
    <Start_Mode><![CDATA[Manual]]></Start_Mode>
    <Service_Type><![CDATA[Own Process]]></Service_Type>
    <Path><![CDATA[c:\windows\system32\macromed\flash\flashplayerupdateservice.exe]]></Path>
    <Error_Control><![CDATA[Normal]]></Error_Control>
    <Start_Name><![CDATA[LocalSystem]]></Start_Name>
    <Tag_ID><![CDATA[0]]></Tag_ID>
    </Data>
    <Data>

    Thanks jrv.  When I ran $nfo=[xml](cat c:\main.nfo)
    $nfo.SelectNodes('//Category[@name="Software Environment"]/Category[@name="Services"]/Data')
    I got several lines of below so it seems to be accessing the right part of the nfo file - which is great.
    Display_Name  : Display_Name
    Name          : Name
    State         : State
    Start_Mode    : Start_Mode
    Service_Type  : Service_Type
    Path          : Path
    Error_Control : Error_Control
    Start_Name    : Start_Name
    Tag_ID        : Tag_ID
    When I ran
    $nfo=[xml](cat \temp\system.nfo)
    $nfo.SelectNodes('//Category[@name="Software Environment"]/Category[@name="Services"]/Data') |
    ForEach-Object{
    $p=[ordered]@{
    Name=$_.Name.innerText
    DisplayName=$_.Display_Name.innerText
    Path=$_.Path.innerText
    State=$_.State.innerText
    StartMode=$_.Start_Mode.innerText
    New-Object PsCustomObject -Property $p
    } |ft -auto
    I got lots of messages like below:
    New-Object : Cannot validate argument on parameter 'Property'. The argument is null or empty. Supply an argument that is not null or em
    pty and then try the command again.
    At line:11 char:46
    +           New-Object PsCustomObject -Property <<<<  $p
        + CategoryInfo          : InvalidData: (:) [New-Object], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.NewObjectCommand
    Unable to find type [ordered]: make sure that the assembly containing this type is loaded.
    At line:4 char:23
    +           $p=[ordered] <<<< @{
        + CategoryInfo          : InvalidOperation: (ordered:String) [], RuntimeException
        + FullyQualifiedErrorId : TypeNotFound
    Any ideas?

  • How to modify the priority of UWL XML File??

    Hello,
    How do you modify the priority of a UWL generated XML file? Ths xml file was generated when I registered the SRM system in UWL.
    I tried using the tab, Universal Worklist Configuration -> Upload new Configuration but it gives an exception "Operation not allowed".
    The reason for doing this,
    Conflicting ItemTypes are defined in the SRM XML file and one of the pre-defined SAP XML file (uwl_erp2005_buyer), and the SRM XML file has a priority of "Low" compared to medium priority for the erp xml. I need to change the SRM XML priority to "HIGH".
    Any help is appreciated.
    Thank you, John

    Erwin,
    Thanks for your reply.
    I downloaded the xml file, modifed some content. While uploading with the same name, making it a high priority and selecting the required system from the dropdown, "Adapt to System", it gives the following error
    Wed Apr 08 15:50:47 CDT 2009 : Operation not allowed on UWL generated Configuration:uwl.webflow.SAP_SRM_IAC
    Any reason the system does not allow doing this?
    John Miller

  • How to Parse this XML File and require below mentioned value as output using powershell script

    Need values for below as an output for below xml file so help me with the script:
    Under Criteria Tag-
    TimeStamp Display Value
    OID corresponding to display value for nodes "Criterion"
    Under Report Body Tag--
    name in Report Section and OID value
    <?xml version="1.0" encoding="UTF-8"?>
    <ReportOutput>
        <ReportHead>
            <Report name="Execution Action" type="detailedchanges_rpt">
                <Description></Description>
            </Report>
            <Criteria>
                <TimestampCriterion name="date" displayvalue="08/10/14 23:08">
                    <Timestamp displayvalue="08/10/14 23:08">1412780929000</Timestamp>
                </TimestampCriterion>
                <MatchCriterion name="approvalId" displayvalue="Not applied" operator="contains" />
                <MatchCriterion name="promotionComment" displayvalue="Not applied" operator="contains" />
                <SelectCriterion name="changeWindow" displayvalue="Not applied" />
                <SelectCriterion name="auditEvents" displayvalue="(Any)">
                    <String>auditEventAny</String>
                </SelectCriterion>
                <SelectCriterion name="attributeDisplay" displayvalue="Changed attributes">
                    <String>changed</String>
                </SelectCriterion>
                <SelectCriterion name="versionCompare" displayvalue="Version with current baseline">
                    <String>disabled</String>
                </SelectCriterion>
                <BooleanCriterion name="showContentDiff" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <BooleanCriterion name="displayUsers" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <BooleanCriterion name="displayPackages" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <BooleanCriterion name="displayCustomProperties" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <BooleanCriterion name="strictPackageMatch" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <BooleanCriterion name="displayCriteriaAtEnd" displayvalue="No">
                    <Boolean value="false" />
                </BooleanCriterion>
                <SelectCriterion name="elementExists" displayvalue="Not applied" />
                <IntegerCriterion name="maxLinesPerBlock" displayvalue="10">
                    <Integer>10</Integer>
                </IntegerCriterion>
                <NodesCriterion name="nodes" displayvalue="TripwireENT.demo.net">
                    <OID>-1y2p0ij32e8bw:-1y2p0ij32e7cu</OID>
                </NodesCriterion>
                <MatchCriterion name="nodeName" displayvalue="Not applied" operator="contains" />
                <CustomPropertiesCriterion name="nodeProps" displayvalue="Not applied" />
                <RulesCriterion name="rules" displayvalue="Critical System Files">
                    <OID>-1y2p0ij32e7q2:-1y2p0ij31snh6</OID>
                </RulesCriterion>
                <MatchCriterion name="ruleName" displayvalue="Not applied" operator="contains" />
                <MatchCriterion name="elementName" displayvalue="Not applied" operator="contains" />
                <CustomPropertiesCriterion name="elementProps" displayvalue="Not applied" />
                <CustomPropertiesCriterion name="versionProps" displayvalue="Not applied" />
                <AttributesCriterion name="attributes" displayvalue="Not applied">
                    <Integer name=".missingImpliesFailure">1</Integer>
                </AttributesCriterion>
                <ContentCriterion name="content" displayvalue="Not applied" />
                <MatchCriterion name="auditEventUserName" displayvalue="Not applied" operator="contains" />
                <IntegerCriterion name="changeType" displayvalue="Added, Modified, Removed">
                    <Integer>7</Integer>
                </IntegerCriterion>
                <SeverityRangeCriterion name="severity" displayvalue="1 - 10000">
                    <Integer name="min">1</Integer>
                    <Integer name="max">10000</Integer>
                </SeverityRangeCriterion>
                <BooleanCriterion name="currentVersionsOnly" displayvalue="Yes">
                    <Boolean value="true" />
                </BooleanCriterion>
                <TimeRangeCriterion name="timeRange" displayvalue="All time" />
                <PackagesCriterion name="packages" displayvalue="Not applied" />
                <SortCriterion name="sortNodes" displayvalue="Name, ascending" isascending="true">
                    <String>name</String>
                </SortCriterion>
                <SortCriterion name="sortRules" displayvalue="Name, ascending" isascending="true">
                    <String>name</String>
                </SortCriterion>
                <SortCriterion name="sortElements" displayvalue="Name, ascending" isascending="true">
                    <String>name</String>
                </SortCriterion>
                <SortCriterion name="sortVersions" displayvalue="Date, descending" isascending="false">
                    <String>date</String>
                </SortCriterion>
            </Criteria>
        </ReportHead>
        <ReportBody>
            <ReportSection name="TripwireENT.demo.net" category="node">
                <OID>-1y2p0ij32e8bw:-1y2p0ij32e7cu</OID>
                <String name="typeName">Windows Server</String>
                <ReportSection name="Critical System Files" category="rule">
                    <OID>-1y2p0ij32e7q2:-1y2p0ij31snh6</OID>
                    <String name="typeName">Windows File System Rule</String>
                    <ReportSection name="C:\Temp" category="element">
                        <OID>-1y2p0ij32e8dr:-1y2p0ij32e586</OID>
                        <ReportSection name="08/10/14 22:48" category="version">
                            <OID>-1y2p0ij32e8du:-1y2p0ij32e3ho</OID>
                            <Integer name="changeType">1</Integer>
                            <String name="changeTypeName">Added</String>
                            <Integer name="severity">10000</Integer>
                            <String name="severityName">High</String>
                            <Timestamp name="changeTime" displayvalue="08/10/14 22:48">1412779682000</Timestamp>
                            <String name="approvalId"></String>
                            <ReportSection name="attributes" category="attributes">
                                <ReportSection name="DACL" category="added">
                                    <String name="observed">Inherits Entries: true
    NT AUTHORITY\SYSTEM, Access Allowed:
     Standard rights:
      Full Control
      Modify
      Read &amp; Execute
      List Folder Contents
      Read
      Write
      Delete
      Read Control
      Write DAC
      Write Owner
      Synchronize
     Specific rights:
      Full Control
      Traverse Folder / Execute File
      List Folder / Read Data
      Read Attributes
      Read Extended Attributes
      Create Files / Write Data
      Create Folders / Append Data
      Write Attributes
      Write Extended Attributes
      Directory Delete Child
      Read Permissions
      Change Permissions
      Take Ownership
     Header flags:
      Object Inherit
      Container Inherit
      Inherited
    BUILTIN\Administrators, Access Allowed:
     Standard rights:
      Full Control
      Modify
      Read &amp; Execute
      List Folder Contents
      Read
      Write
      Delete
      Read Control
      Write DAC
      Write Owner
      Synchronize
     Specific rights:
      Full Control
      Traverse Folder / Execute File
      List Folder / Read Data
      Read Attributes
      Read Extended Attributes
      Create Files / Write Data
      Create Folders / Append Data
      Write Attributes
      Write Extended Attributes
      Directory Delete Child
      Read Permissions
      Change Permissions
      Take Ownership
     Header flags:
      Object Inherit
      Container Inherit
      Inherited
    BUILTIN\Users, Access Allowed:
     Standard rights:
      Read &amp; Execute
      List Folder Contents
      Read
      Read Control
      Synchronize
     Specific rights:
      Traverse Folder / Execute File
      List Folder / Read Data
      Read Attributes
      Read Extended Attributes
      Read Permissions
     Header flags:
      Object Inherit
      Container Inherit
      Inherited
    BUILTIN\Users, Access Allowed:
     Specific rights:
      Create Folders / Append Data
     Header flags:
      Container Inherit
      Inherited
    BUILTIN\Users, Access Allowed:
     Specific rights:
      Create Files / Write Data
     Header flags:
      Container Inherit
      Inherited
    CREATOR OWNER, Access Allowed:
     Generic rights:
      Generic All
     Specific rights:
      Full Control
      Traverse Folder / Execute File
      List Folder / Read Data
      Read Attributes
      Read Extended Attributes
      Create Files / Write Data
      Create Folders / Append Data
      Write Attributes
      Write Extended Attributes
      Directory Delete Child
      Read Permissions
      Change Permissions
      Take Ownership
     Header flags:
      Object Inherit
      Container Inherit
      Inherit Only
      Inherited
    </String>
                                </ReportSection>
                                <ReportSection name="Group" category="added">
                                    <String name="observed">TRIPWIREENT\None</String>
                                </ReportSection>
                                <ReportSection name="Owner" category="added">
                                    <String name="observed">BUILTIN\Administrators</String>
                                </ReportSection>
                                <ReportSection name="Read-Only" category="added">
                                    <String name="observed">false</String>
                                </ReportSection>
                                <ReportSection name="SACL" category="added">
                                    <String name="observed">(null)</String>
                                </ReportSection>
                                <ReportSection name="Type" category="added">
                                    <String name="observed">Directory</String>
                                </ReportSection>
                            </ReportSection>
                        </ReportSection>
                    </ReportSection>
                    <ReportSection name="C:\Windows\System32\drivers\etc\hosts" category="element">
                        <OID>-1y2p0ij32e8dr:-1y2p0ij32e4kp</OID>
                        <ReportSection name="08/10/14 23:08" category="version">
                            <OID>-1y2p0ij32e8du:-1y2p0ij32e3hk</OID>
                            <Integer name="changeType">2</Integer>
                            <String name="changeTypeName">Modified</String>
                            <Integer name="severity">10000</Integer>
                            <String name="severityName">High</String>
                            <Timestamp name="changeTime" displayvalue="08/10/14 23:08">1412780929000</Timestamp>
                            <String name="approvalId"></String>
                            <ReportSection name="attributes" category="attributes">
                                <ReportSection name="SHA-1" category="modified">
                                    <String name="expected">de375d8a456a7345323babee88975ca567a2d5c4</String>
                                    <String name="observed">3c5520382f91cb1cd898fee2da4eba3fa338d982</String>
                                </ReportSection>
                                <ReportSection name="Size" category="modified">
                                    <String name="expected">829</String>
                                    <String name="observed">854</String>
                                </ReportSection>
                            </ReportSection>
                        </ReportSection>
                    </ReportSection>
                </ReportSection>
            </ReportSection>
            <ReportSection name="reportTotals" category="reportTotals">
                <Integer name="summary.nodeCount">1</Integer>
                <Integer name="summary.ruleCount">1</Integer>
                <Integer name="summary.elementCount">2</Integer>
            </ReportSection>
        </ReportBody>
    </ReportOutput>

    Hi Ritehere,
    I know this is simple but am beginner in Powershell Script so I was looking for logic to go through however the output you provided is not what i am looking for and your script is too complicated, as under timestamp i wanted display value and correspoding
    to display value the OID name and then name value correspoding to that OID. May be u got it wrong.
    Thanks anyways.

  • Download RSS feed as xml file from Sharepoint Online using PowerShell

    Hello
    Our company sharepoint (Office 365) contains also several RSS feeds.
    How it is possible to download xml file out of this feed (website) using PowerShell?
    I can authenticate with sharepoint using CSOM but do not what to do next.
    As service user is not administrator I cannot use "SPOService".
    This script works OK for standard website, but not for Sharepoint.
    $doc = New-Object System.Xml.XmlDocument
    $doc.Load("http://www.{CompanySite}.com/feed/")
    $doc.save("C:\temp\feed.xml")
    I am getting this error when using for company Sharepoint:
    "The remote server returned an error: (403) Forbidden."
    Thanks for your time considering this question.
    Jozin

    Hi Scott,
    thanks for advice.
    Combination of WebClient and Sharepoint Credentials is working OK:
    $client = New-Object System.Net.WebClient 
    $client.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User, $SecurePassword)
    $client.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
    $client.DownloadFile($SiteURL, $file)

  • Read an XML file with Powershell ?

    Hi,
    Can someone please help. Is there a way in which powershell can check my 'example' xml file for an instance of 'BizTalk1' for Server1? Can PowerShell check <Group name="BiztalkGroup1" for <Name>BizTalk1 for Server1
    Hope my question makes sense. Thanks in advance
    <Config>
    <Defaults>
    <dgroup>BiztalkGroup1</dgroup>
    <dgroup>Services</dgroup>
    </Defaults>
    <Server name="Server1">
    <Services>
    <Group name="Services" order="1">
    <Items>
    <Name>Service 1</Name>
    <Name>Service 2</Name>
    </Items>
    </Group>
    </Services>
    <HostInstances>
    <Group name="BiztalkGroup1"<order="2">
    <Items>
    <Name>Biztalk1</Name>
    <Name>Biztalk2</Name>
    <Name>Biztalk3</Name>
    <Name>Biztalk4</Name>
    </Items>
    </Group>
    </HostInstances>
    </Server>
    <Server name="Server2">
    <Services>
    <Group name="Services" order="1">
    <Items>
    <Name>Service 1</Name>
    <Name>Service 2</Name>
    </Items>
    </Group>
    </Services>
    <HostInstances>
    <Group name="BiztalkGroup1"<order="2">
    <Items>
    <Name>Biztalk1</Name>
    <Name>Biztalk2</Name>
    <Name>Biztalk3</Name>
    <Name>Biztalk4</Name>
    </Items>
    </Group>
    </HostInstances>
    </Server>

    Hi jrv, I would like to test to see if a server has that value.
    My end goal is to have a checkbox on a form I have created to be ticked if the value exists for Server 1 and antoher Checkbox doing the same for Server2. There are 30 different values in the XML I need to check for.
    e.g: Does BizTalkGroup1 contain 'BizTalk1' for Server1, if true checkbox is ticked if false checkbox is NOT ticked.
    Thanks for your help.

  • Creating Powershell script to run against Multiple XML Files: Correcting Nordic characters. Renaming only the files that were corrected.

    Greetings,
    I am new to powershell and scripting and would like to create a powershell script to do the following to XML files.
    I would like to change the data received in XML files that contains special Nordic characters: such as 
    ä, Ä, é, ö, Ö, ü, Ü, and ß respectfully.
    The file names that gets drop to me come in with the following naming convention: C54ABC_111120140500_1, C54ABC_111120140500_2, C54ABC_111120140500_3, C54ABC_111120140500_4 all the way to C54ABC_111120140500_12.
    By automating the script, I would like the script to look into a directory containing these files and access the data within it and change the the data that has the special characters to the English Dictionary character equivalent.
    e.g. ä for a, Ä for A, é for e, ö for o, Ö for O, ü for u, Ü for U, and ß for ss.
    Once that step is complete. I would like to rename the file from C54ABC_111120140500_1.xml to C54ABC_111120140500_1_rctf.xml (adding an additional 5 characters to the end of a file that was corrected) if the file did not need any correction then renaming is
    not needed.
    the working directory (Source and destination) will remain in the same location. e.g. C:\Temp\
    Currently I was able to come up with the following, however I am stuck when it comes to the renaming part since, it requires "IF and Else" statments .... I think.
    $Source = "C:\Temp"
    $Destination = "C:\Temp"
    $regex33 = "\*.xml"
    (Get-Content $regex33) |
    ForEach-Object {$_ -replace "ä", "a" -replace "Ä", "A" -replace "é", "e" -replace "ö", "o" -replace "Ö", "O" -replace "ü", "u" -replace "Ü", "U" -replace "ß", "ss"}
    #Rename-Item -NewName {$_.name -replace -whatif}
    Your Assistance and Expertise is greatly appreciated.
    Thank you in advance KC.

    Hi KC
    You could try something like this.
    Let me know how you get on and if you've any questionds.
    cheers, Tim
    $Source = 'C:\Temp'
    Set-Location $source
    $xmlFiles = Get-ChildItem -Path $source -Filter *.xml
    ForEach ($xmlFile in $xmlFiles)
      $content = Get-Content -Path $xmlFile.FullName
      $renameFile = $false
      Switch -Wildcard ($content) {
        '*ä*'
          $renameFile = $true
          $content = $content -creplace 'ä', 'a'
        '*Ä*'
          $renameFile = $true
          $content = $content -creplace 'Ä', 'A'
        '*é*'
          $renameFile = $true
          $content = $content -creplace 'é', 'e'
        '*ö*'
          $renameFile = $true
          $content = $content -creplace 'ö', 'o'
        '*Ö*'
          $renameFile = $true
          $content = $content -creplace 'Ö', 'O'
        '*ü*'
          $renameFile = $true
          $content = $content -creplace 'ü', 'u'
        '*Ü*'
          $renameFile = $true
          $content = $content -creplace 'Ü', 'U'
        '*ß*'
          $renameFile = $true
          $content = $content -creplace 'ß', 'ss'
      If ($renameFile)
        $newFileName = "$($xmlFile.BaseName)_rctf.xml"
        $content | Out-File -FilePath $xmlFile.FullName -Force
        Rename-Item -Path $xmlFile.PSChildName -NewName $newFileName

  • How to create a Plan.xml file for modification

    Hi,
    I am trying to create a plan.xml file. Is there any way, I can generate a plan.xml file.
    I see a tab in Admin Console in deployments and plan. but there is nothing there. what it has to do with plan.
    Thanks
    regards
    Amir riaz

    You can find the steps here.
    http://weblogic-wonders.com/weblogic/2009/11/29/plan-xml-usage-for-message-driven-bean/
    http://weblogic-wonders.com/weblogic/2009/12/16/invalidation-interval-secs/

  • AIR 3.8 modifies XML file unexpectedly

    Hello all,
    we are developing a multi-platform offline business-to-business app in AIR. The 1.0 version is currently in the Apple AppStore: https://itunes.apple.com/nl/app/efashion/id659451223?l=en&mt=8
    We are working on the 1.1 update, but when we compile with AIR 3.8, we run into some unexpected behaviour that doesn't happen in AIR 3.7. The scenario is like this:
    - when a user logs in for the first time, the app downloads a large XML database (database.xml). When complete, the file is stored in the local filesystem.
    - then, a second XML file is loaded, containing a stock update for the database (stock.xml).
    - in AIR 3.8, when we start loading the second file (_loader.load(request);), the first XML is modified unexpectedly. Whole XML chunks disappear, tags disappear, XML chunks pop up elsewhere in the tree, etcetera, rendering the database.xml file completely unusable.
    In AIR 3.7, everything is fine.
    I've tried reproducing this bug in a simpler project, but haven't been able to do so yet. Meanwhile, we are curious to find out if anything changed internally in the handling of XML in AIR 3.8 that could cause this behaviour.
    Any help would be greatly appreciated!
    Thanks in advance,
    Olaf Wempe

    Can you please share the entire contents of your platform.xml(if using) and the commands you are using to package ANE as well as IPA? Also, can you try unzipping the ANE and then, checking its contents, platform.xml and the architectures present in sample.a using the file command just to confirm earlier version of ANE is not being used.
    Regards,
    Nimit

  • How to load the .xml file list from 'C:\Drag_list\Modif into xmltype table?

    Hi all experts,
    I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
    SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 22 11:40:23 2011
    is there anyone know why
    SQL> create or replace directory XMLDIR as '/xdb/faq/testdata'
    2 /
    SQL> set long 10000 pages 200 lines 150
    SQL> --
    SQL> select xmltype(bfilename('XMLDIR','2003.xml'),nls_charset_id('AL32UTF8'))
    2 from dual
    worked. but
    SQL> create or replace directory XMLDIR as 'C:\Drag_list\Modified';
    SQL> select xmltype(bfilename('XMLDIR','2011.xml'),nls_charset_id('AL32UTF8'))
    from dual
    did not work?
    IS there any way I can load the .xml file list from 'C:\Drag_list\Modified' into xmltype table?
    Thanks.
    Edited by: Cow on Apr 13, 2011 12:58 AM

    This is a question better suited for the sql and pl/sql support forum, since it is NOT an APEX based question..: PL/SQL
    Thank you,
    Tony Miller
    Webster, TX
    On the road of life...There are 'windshields', and there are 'bugs'
    (splat!)
    "Squeegees Wanted"
    If this question is answered, please mark the thread as closed and assign points where earned..

  • How can I take the part that parses the .XML file and make it a procedure.

    CREATE OR REPLACE PACKAGE BODY XMLSTUD6 AS
    Author: Jimmy Harris
    Created: 5/25/2006
    Purpose: 1.This package has an XML file initialized to a variable called DOC .
              2.It will then take the values from the XML file and insert them into a PL/SQL table.
              3.From the PL/SQL table it will insert values into the STUDENTS table.
              4.After step four above, the STUDLOAD procedure will insert (Sequence,Status, .XML file, USER, SYSDATE, ERROR_Message
                             into the AUDIT_XMLSTUD table regardless if insert status was successfull or not status is indicated by either an Y or
              NO and the original XML filed that was currently processed, the date and user who executed the procedure.
              If the status was NO then it will insert the Oracle SQLERRM massage, into the REASON_FOR_ERROR column.
                             If status is Y then REASOK_FOR_ERROR IS NULL.
                             5,Make sure you embed the xml file with an inner and outer ' ' ie: ' the whole .xml file string ' as the input
                             parameter into the STUDLOAD procedure.
    This package excepts the whole .XML file as a CLOB as an input parameter, so that the end-user will not have
                                  modify the code.      
    Modification History:     1.6/09/2006 JImmy Harris Modified code, added the Function "WORD_CONVERTER1" to accept the requested text data and
    return a coded value back to our Welligent system.     
                                  2. Was advised that a front end type of functionality was not neccesary for this issue so I removed the INSERT_XML_FILE,
                                  UPDATE_XML_FILE and the INSERT_XML_file.
    FUNCTION WORD_CONVERTER1 (v_domain IN VARCHAR2 := null,
    v_incoming IN VARCHAR2 := null) RETURN VARCHAR2 IS
    v_well VARCHAR2(32);
    v_editdd BOOLEAN;
    v_code VARCHAR2(32);
    CURSOR C_conv_wrd IS
    SELECT WELL
    INTO v_code
    FROM CONVERSION_TABLE
    WHERE DOMAIN = UPPER(TRIM(v_domain))
    AND INCOMING = UPPER(TRIM(v_incoming));
    BEGIN
    OPEN c_conv_wrd;
    LOOP
    FETCH c_conv_wrd INTO v_code;
    EXIT WHEN c_conv_wrd%NOTFOUND;
    END LOOP;
    CLOSE c_conv_wrd;
    RETURN v_code;
    END WORD_CONVERTER1;
    PROCEDURE STUDLOAD (DOC CLOB) IS
    v_parser xmlparser.Parser;
    v_doc xmldom.DOMDocument;
    v_nl xmldom.DOMNodeList;
    v_n xmldom.DOMNode;
    v_mm NUMBER;
    v_dd NUMBER;
    v_yyyy NUMBER;
    v_DATE DATE;
    v_race VARCHAR2(1);
    v_eth VARCHAR2(1);
    v_prim_lang VARCHAR2(1);
    v_house_lang VARCHAR2(1);
    v_gender VARCHAR2(1);
    TYPE stuxml_type IS TABLE OF STUDENTS%ROWTYPE;
    s_tab stuxml_type := stuxml_type();
    v_success VARCHAR2(200);
    v_failure VARCHAR2(200);
    l_error_code varchar2(200);
    BEGIN
    -- Create a parser.
    v_parser := xmlparser.newParser;
    xmlparser.setValidationMode(v_parser, FALSE);
    -- Parse the document and create a new DOM document.
    SYS.XMLPARSER.PARSECLOB ( v_parser, DOC );
    v_doc := SYS.XMLPARSER.getDocument(v_parser);
    -- Free resources associated with the Parser now it is no longer needed.
    xmlparser.freeParser(v_parser);
    -- Get a list of all the STUD nodes in the document using the XPATH syntax.
    v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent');
    -- Loop through the list and create a new record in a table collection for each STUD record.
    FOR stud IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
    v_n := xmldom.item(v_nl, stud);
    s_tab.extend;
    -- Use XPATH syntax to assign values to he elements of the collection.
    s_tab(s_tab.last).STUDENT_LAST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/LastName');
         s_tab(s_tab.last).STUDENT_FIRST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/FirstName');
         s_tab(s_tab.last).STUDENT_MI :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/MiddleName');
         v_dd := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Day');
         v_mm := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Month');
    v_yyyy := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Year');
         v_DATE := TO_DATE(v_mm||' '||v_dd||' '||v_yyyy,'MMDDYYYY');
         s_tab(s_tab.last).STUDENT_DOB := v_date;
         s_tab(s_tab.last).STUDENT_STREET :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/Street');
         s_tab(s_tab.last).STUDENT_APART_NO :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ApartmentNumber');
         s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/County');
         s_tab(s_tab.last).STUDENT_STATE :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/State');
         s_tab(s_tab.last).STUDENT_ZIP :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ZipCode');
    v_race := WORD_CONVERTER1('RACE',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Race')));
         v_eth := WORD_CONVERTER1('EHTNICITY',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Ethnicity')));
         v_prim_lang:= WORD_CONVERTER1('PRIMARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/PrimaryLanguage')));
         v_house_lang:= WORD_CONVERTER1('SECONDARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/HouseholdLanguage')));
         v_gender := WORD_CONVERTER1('GENDER',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Gender')));
    s_tab(s_tab.last).STUDENT_RACE := v_race;
         s_tab(s_tab.last).STUDENT_ETHNIC := v_eth;
         s_tab(s_tab.last).STUDENT_PRI_LANG :=v_prim_lang;
         s_tab(s_tab.last).STUDENT_SEC_LANG := v_house_lang;
         s_tab(s_tab.last).STUDENT_GENDER :=v_gender;
    END LOOP;
    FOR stud IN s_tab.first..s_tab.last LOOP
    INSERT INTO STUDENTS (SHISID, SSN, DOE_SCHOOL_NUMBER,PATIENT_TYPE, TEACHER, HOMEROOM,STUDENT_LAST_NAME, STUDENT_FIRST_NAME, STUDENT_MI,STUDENT_DOB,
    STUDENT_BIRTH_CERT, STUDENT_COMM,STUDENT_MUSA, STUDENT_FAMSIZE, STUDENT_FAMINCOME,STUDENT_UNINSURED, STUDENT_LUNCH, STUDENT_ZIP,STUDENT_STATE,
    STUDENT_COUNTY, STUDENT_STREET,STUDENT_APART_NO, STUDENT_PHONE, STUDENT_H2O_TYPE,STUDENT_WASTE_TRT, STUDENT_HOME_SET, STUDENT_NONHOME_SET,
    STUDENT_GENDER, STUDENT_RACE, STUDENT_ETHNIC,STUDENT_PRI_LANG, STUDENT_SEC_LANG, STUDENT_ATRISK,EMER_COND_MEMO, ASSIST_DEVICE_TYPE,
    SCHOOL_ENTER_AGE,STUDENT_CURR_GRADE, S504_ELIG_DATE, S504_DEV_DATE,S504_REV_DATE, STUDENT_504, STUDENT_IEP,IEP_EXP_DATE, GRAD_CLASS, TYPE_DIPLOMA,
    GRADE_RETAIN, LIT_PASS_TEST_MATH, LIT_PASS_DATE_MATH,LIT_PASS_TEST_WRITE, LIT_PASS_DATE_WRITE, LIT_PASS_TEST_READ,LIT_PASS_DATE_READ, SPEC_ED_ELIG,
    SPEC_ED_CODE,TRANSPORT_CODE, TRANSPORT_NO, PRIME_HANDICAP,PRIME_HANDICAP_PERCENT, PRIME_HANDI_MANAGER, FIRST_ADD_HANDI,FIRST_ADD_HANDICAP_PERCENT,
    FIRST_ADD_HANDI_504, FIRST_ADD_HANDI_504_DATE, SECOND_ADD_HANDI, SECOND_ADD_HANDICAP_PERCENT, MED_EXTERNAL_NAME, INS_TYPE, INS_PRI, INS_NAME,
    INS_MEDICAID_NO, ELIGDATE, INS_PRIV_INSURANCE, INS_APPR_BILL, INS_APPR_DATE, INS_PARENT_APPR,INS_POL_NAME, INS_POL_NO, INS_CARRIER_NO,
    INS_CARRIER_NAME, INS_CARRIER_RELATE, INS_AFFECT_DATE, INS_COPAY_OV, INS_COPAY_RX, INS_COPAY_AMBUL,INS_COPAY_EMER, INS_COPAY_OUTPAT,STUDENT_INACTIVE,
    PHYS_ID, ENCOUNTERNUM,USERID,MODDATE, STUDENT_ID, S504_DISABILITY,CHAPTER1, WELLNESS_ENROLL, SCHOOL_OF_RESIDENCE,INITIAL_IEP_DATE, CALENDAR_TRACK,
    USA_BORN,ALT_ID, FUTURE_SCHOOL, IEP_LAST_MEETING,IEP_LAST_SETTING, IEP_LAST_REFER_EVAL, THIRD_ADD_HANDI,LEP, GIFTED, IEP_EXIT_REASON,
    CASE_MANAGER_ID, INTAKE_NOTES, CALLER_PHONE,CALL_DATE, CALLER_RELATIONSHIP, CALLER_NAME,BUSINESS_PHONE, FAX, EMAIL,HIGHEST_EDUCATION, INTAKE_DATE,
    SERVICE_COORDINATOR, DISCHARGE_DATE, DISCHARGE_REASON, DISCHARGE_NOTES,INTAKE_BY, INTAKE_STATUS, IEP_LAST_SERVED_DATE,IEP_APC_DATE, IEP_EXIT_DATE,
    ADDRESS2, LEGAL_STATUS, RELIGION, EMPLOYMENT_STATUS, TARG_POP_GROUP1, TARG_POP_GROUP2, MARITAL_STATUS,THIRD_ADD_HANDI_PERCENT, LAST_INTERFACE_DATE,
    SERVICE_PLAN_TYPE,CURRENT_JURISDICTION, FIPS, BIRTH_PLACE_JURISDICTION,BIRTH_PLACE_HOSPITAL, BIRTH_PLACE_STATE, BIRTH_PLACE_COUNTRY,
    OTHER_CLIENT_NAME, SIBLINGS_WITH_SERVICES, PERM_SHARE_INFORMATION,PERM_VERIFY_INSURANCE, REFERRING_AGENCY, REFERRING_INDIVIDUAL,AUTOMATIC_ELIGIBILITY,
    INTAKE_IEP_ID, FUTURE_SCHOOL2,FUTURE_SCHOOL3, TRANSLATOR_NEEDED, TOTAL_CHILDREN_IN_HOME,REFERRED_BY, FAMILY_ID, SCREENING_CONSENT_FLAG,PICTURE_FILE,
    DUAL_ENROLLED, DOE_SCHOOL_NUMBER2)
    VALUES (123456789025, null,null ,null,null,null ,s_tab(stud).STUDENT_LAST_NAME,s_tab(stud).STUDENT_FIRST_NAME,s_tab(stud).STUDENT_MI,
    s_tab(stud).STUDENT_DOB,null ,null,null ,null,null,null,null,s_tab(stud).STUDENT_ZIP,s_tab(stud).STUDENT_STATE ,s_tab(stud).STUDENT_COUNTY,
    s_tab(stud).STUDENT_STREET,s_tab(stud).STUDENT_APART_NO,null,null,null ,null , null,
    s_tab(stud).STUDENT_GENDER ,s_tab(stud).STUDENT_RACE , s_tab(stud).STUDENT_ETHNIC,
    s_tab(stud).STUDENT_PRI_LANG ,s_tab(stud).STUDENT_SEC_LANG, null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null, null,null );
    END LOOP;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,DOC,'Y',NULL,SYSDATE);
    HTP.HTMLOPEN;
    v_success:= 'The values from the .XML file have been successfully inserted into the STUDENTS table in the Oracle Database.';
    htp.bold(v_success);
    HTP.HTMLCLOSE;
    COMMIT;
    -- Free any resources associated with the document now it that it is no longer needed.
    xmldom.freeDocument(v_doc);
    EXCEPTION
    WHEN OTHERS THEN
    l_error_code := SQLERRM;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,nvl(DOC,TO_CLOB('No .XML file entered, user pressed button without entering correct information.')),'NO',l_error_code,SYSDATE);
    HTP.HTMLOPEN;
    v_failure:= 'The attempt made to insert files to the Student table has failed because,'||l_error_code;
    htp.bold(v_failure);
    HTP.HTMLCLOSE;
    COMMIT;
    END STUDLOAD;
    PROCEDURE UPDSTUDLOAD (DOC CLOB) IS
    v_parser xmlparser.Parser;
    v_doc xmldom.DOMDocument;
    v_nl xmldom.DOMNodeList;
    v_n xmldom.DOMNode;
    v_mm NUMBER;
    v_dd NUMBER;
    v_yyyy NUMBER;
    v_DATE DATE;
    v_race VARCHAR2(1);
    v_eth VARCHAR2(1);
    v_prim_lang VARCHAR2(1);
    v_house_lang VARCHAR2(1);
    v_gender VARCHAR2(1);
    TYPE stuxml_type IS TABLE OF STUDENTS%ROWTYPE;
    s_tab stuxml_type := stuxml_type();
    v_success VARCHAR2(200);
    v_failure VARCHAR2(200);
    l_error_code varchar2(200);
    BEGIN
    -- Create a parser.
    v_parser := xmlparser.newParser;
    xmlparser.setValidationMode(v_parser, FALSE);
    -- Parse the document and create a new DOM document.
    SYS.XMLPARSER.PARSECLOB ( v_parser, DOC );
    v_doc := SYS.XMLPARSER.getDocument(v_parser);
    -- Free resources associated with the Parser now it is no longer needed.
    xmlparser.freeParser(v_parser);
    -- Get a list of all the STUD nodes in the document using the XPATH syntax.
    v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent');
    -- Loop through the list and create a new record in a table collection for each STUD record.
    FOR stud IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
    v_n := xmldom.item(v_nl, stud);
    s_tab.extend;
    -- Use XPATH syntax to assign values to he elements of the collection.
    s_tab(s_tab.last).STUDENT_LAST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/LastName');
         s_tab(s_tab.last).STUDENT_FIRST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/FirstName');
         s_tab(s_tab.last).STUDENT_MI :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/MiddleName');
         v_dd := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Day');
         v_mm := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Month');
    v_yyyy := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Year');
         v_DATE := TO_DATE(v_mm||' '||v_dd||' '||v_yyyy,'MMDDYYYY');
         s_tab(s_tab.last).STUDENT_DOB := v_date;
         s_tab(s_tab.last).STUDENT_STREET :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/Street');
         s_tab(s_tab.last).STUDENT_APART_NO :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ApartmentNumber');
         s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/County');
         s_tab(s_tab.last).STUDENT_STATE :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/State');
         s_tab(s_tab.last).STUDENT_ZIP :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ZipCode');
    v_race := WORD_CONVERTER1('RACE',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Race')));
         v_eth := WORD_CONVERTER1('EHTNICITY',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Ethnicity')));
         v_prim_lang:= WORD_CONVERTER1('PRIMARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/PrimaryLanguage')));
         v_house_lang:= WORD_CONVERTER1('SECONDARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/HouseholdLanguage')));
         v_gender := WORD_CONVERTER1('GENDER',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Gender')));
    s_tab(s_tab.last).STUDENT_RACE := v_race;
         s_tab(s_tab.last).STUDENT_ETHNIC := v_eth;
         s_tab(s_tab.last).STUDENT_PRI_LANG :=v_prim_lang;
         s_tab(s_tab.last).STUDENT_SEC_LANG := v_house_lang;
         s_tab(s_tab.last).STUDENT_GENDER :=v_gender;
    END LOOP;
    FOR stud IN s_tab.first..s_tab.last LOOP
         UPDATE STUDENTS
         SET
         STUDENT_LAST_NAME = s_tab(stud).STUDENT_LAST_NAME,
         STUDENT_FIRST_NAME = s_tab(stud).STUDENT_FIRST_NAME,
         STUDENT_MI = s_tab(stud).STUDENT_MI,
         STUDENT_DOB = s_tab(stud).STUDENT_DOB,
         STUDENT_ZIP = s_tab(stud).STUDENT_ZIP,
         STUDENT_STATE = s_tab(stud).STUDENT_STATE,
         STUDENT_COUNTY = s_tab(stud).STUDENT_COUNTY,
         STUDENT_STREET = s_tab(stud).STUDENT_STREET,
         STUDENT_APART_NO = s_tab(stud).STUDENT_APART_NO
         WHERE SHISID = 123456789025;
    END LOOP;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,DOC,'Y',NULL,SYSDATE);
    HTP.HTMLOPEN;
    v_success:= 'The updated .XML file has been successfully saved to the STUDENTS table in the Oracle Database.';
    htp.bold(v_success);
    HTP.HTMLCLOSE;
    COMMIT;
    -- Free any resources associated with the document now it that it is no longer needed.
    xmldom.freeDocument(v_doc);
    EXCEPTION
    WHEN OTHERS THEN
    l_error_code := SQLERRM;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,nvl(DOC,TO_CLOB('No .XML file entered, user pressed button without entering correct information.')),'NO',l_error_code,SYSDATE);
    HTP.HTMLOPEN;
    v_failure:= 'The attempt made to insert files to the Student table has failed because,'||l_error_code;
    htp.bold(v_failure);
    HTP.HTMLCLOSE;
    COMMIT;
    END UPDSTUDLOAD;
    PROCEDURE DELSTUDLOAD (DOC CLOB) IS
    v_parser xmlparser.Parser;
    v_doc xmldom.DOMDocument;
    v_nl xmldom.DOMNodeList;
    v_n xmldom.DOMNode;
    v_mm NUMBER;
    v_dd NUMBER;
    v_yyyy NUMBER;
    v_DATE DATE;
    TYPE stuxml_type IS TABLE OF STUDENTS%ROWTYPE;
    s_tab stuxml_type := stuxml_type();
    v_success VARCHAR2(200);
    v_failure VARCHAR2(200);
    l_error_code varchar2(200);
    BEGIN
    -- Create a parser.
    v_parser := xmlparser.newParser;
    xmlparser.setValidationMode(v_parser, FALSE);
    -- Parse the document and create a new DOM document.
    SYS.XMLPARSER.PARSECLOB ( v_parser, DOC );
    v_doc := SYS.XMLPARSER.getDocument(v_parser);
    -- Free resources associated with the Parser now it is no longer needed.
    xmlparser.freeParser(v_parser);
    -- Get a list of all the STUD nodes in the document using the XPATH syntax.
    v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent');
    -- Loop through the list and create a new record in a table collection for each STUD record.
    FOR stud IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
    v_n := xmldom.item(v_nl, stud);
    s_tab.extend;
    -- Use XPATH syntax to assign values to he elements of the collection.
    s_tab(s_tab.last).STUDENT_LAST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/LastName');
         s_tab(s_tab.last).STUDENT_FIRST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/FirstName');
         s_tab(s_tab.last).STUDENT_MI :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/MiddleName');
         v_dd := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Day');
         v_mm := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Month');
    v_yyyy := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Year');
         v_DATE := TO_DATE(v_mm||' '||v_dd||' '||v_yyyy,'MMDDYYYY');
         s_tab(s_tab.last).STUDENT_DOB := v_date;
         s_tab(s_tab.last).STUDENT_STREET :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/Street');
         s_tab(s_tab.last).STUDENT_APART_NO :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ApartmentNumber');
         s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/County');
         s_tab(s_tab.last).STUDENT_STATE :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/State');
         s_tab(s_tab.last).STUDENT_ZIP :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ZipCode');
    END LOOP;
    FOR stud IN s_tab.first..s_tab.last LOOP
         DELETE FROM STUDENTS
         WHERE SHISID = 123456789025;
    END LOOP;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,DOC,'Y',NULL,SYSDATE);
    HTP.HTMLOPEN;
    v_success:= 'The .XML file has been successfully deleted from the STUDENTS table in the Oracle Database.';
    htp.bold(v_success);
    HTP.HTMLCLOSE;
    COMMIT;
    -- Free any resources associated with the document now it that it is no longer needed.
    xmldom.freeDocument(v_doc);
    EXCEPTION
    WHEN OTHERS THEN
    l_error_code := SQLERRM;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,nvl(DOC,TO_CLOB('No .XML file entered, user pressed button without entering correct information.')),'NO',l_error_code,SYSDATE);
    HTP.HTMLOPEN;
    v_failure:= 'The attempt made to insert files to the Student table has failed because,'||l_error_code;
    htp.bold(v_failure);
    HTP.HTMLCLOSE;
    COMMIT;
    END DELSTUDLOAD;
    END XMLSTUD6;

    Try opening the problem files using a text editor or file viewer to see what the first few bytes contain. All valid FM binary files for FM 11 will contain <MakerFile 11.0> in the first bytes of the file.
    When updating books, it's sometimes better to just to create a new book file and add the files to that.
    When renaming files in a book, changes at the system level will break any links/cross-references between files, so it's always best to use the Rename option in the Book file to change FM file names. This will maintain the correct linkages.

  • Parsing XML files from application server

    I need to read  an XML file from the application server. This can be done using OPEN DATASET in BINARY MODE and reading into internal table of type binary data.
    But inorder to parse the document using the iXML library, i need to pass the filesize of the XML file that is read into internal table.
    Please let me know how to calculate this filesize ?

    Hi ,
    Check the FM : /SAPDMC/LSM_F4_SERVER_FILE.
    Inside this FM , subroutine below exists.The main program for routine is /SAPDMC/LLSMW_AUX_020F02.
    Call this routine from your program. You will get the length in bytes from the field len of table pt_file.
    data:
      begin of gs_file,
        directory(75) type c,              " name of directory.
                                           " (possibly truncated.)
        name(75)    type c,                " name of entry.
                                           " (possibly truncated.)
        type(10)    type c,                " type of entry: directory, file
        *len(8)      type p,                " length in bytes*
        owner(8)    type c,                " owner of the entry
        mtime(6)    type p,                " last modification date,
                                           " seconds since 1970
        mode(9)     type c,                " like "rwx-r-x--x":
                                           " protection mode
        errno(3)    type c,
        errmsg(40)  type c,
        mod_date    type d,
        mod_time(8) type c,                " hh:mm:ss
        subrc like sy-subrc,
    end of gs_file.
    DATA : pt_file LIKE TABLE OF gs_file.
    DATa : p_ok.
      PERFORM /sapdmc/llsmw_aux_020f02(directory_contents_get)
      TABLES   pt_file
                                USING    '/TMP' ""!!! Here is your filepath
                                CHANGING p_ok

  • Writing an XML file using a Servlet

    Hello, I'm trying to code a servlet that receives a POST from a HTTP and output its data to a XML file, the problem is that I get the following error:
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'http://localhost:8080/XMLSender/xmlsend'.
    I don't know what happens, because I'm NOT trying to show the content, just to save it, I post my code here so anyone can help me, please. Thanks in advance.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class xmlsender extends HttpServlet
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream salida = res.getOutputStream();
    res.setContentType("text/xml");
    String cadenanumero = req.getParameter("numero");
    String cadenaoperadora = req.getParameter("operadora");
    String cadenabody = req.getParameter("mensaje");
    String cadenashortcode = req.getParameter("shortcode");
    File f1 = new File("salida.xml");
    FileWriter writer = new FileWriter(f1);
    writer.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    writer.write("<root>");
    writer.write("<tlf>" + cadenanumero + "</tlf>");
    writer.write("<op>" + cadenaoperadora + "</op>");
    writer.write("<sc>" + cadenashortcode + "</sc>");
    writer.write("<body>" + cadenabody + "</body>");
    writer.write("</root>");
    writer.close();
    }

    Yes, in fact what I want is the file to be in the server, now, I modificated my code to the following:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class xmlsender extends HttpServlet
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream salida = res.getOutputStream();
    res.setContentType("text/HTML");
    String cadenanumero = req.getParameter("numero");
    String cadenaoperadora = req.getParameter("operadora");
    String cadenabody = req.getParameter("mensaje");
    String cadenashortcode = req.getParameter("shortcode");
    File f1 = new File ("salida.xml");
    FileWriter writer = new FileWriter(f1);
    /*salida.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    salida.println("<root>");
    salida.println("<tlf>" + cadenanumero + "</tlf>");
    salida.println("<op>" + cadenaoperadora + "</op>");
    salida.println("<sc>" + cadenashortcode + "</sc>");
    salida.println("<body>" + cadenabody + "</body>");
    salida.println("</root>"); */
    salida.println("Finalizado");
    f1.createNewFile();
    writer.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    writer.write("<root>");
    writer.write("<tlf>" + cadenanumero + "</tlf>");
    writer.write("<op>" + cadenaoperadora + "</op>");
    writer.write("<sc>" + cadenashortcode + "</sc>");
    writer.write("<body>" + cadenabody + "</body>");
    writer.write("</root>");
    writer.close();
    It still do not create my file "salida.xml", still don't know why. Any help is welcome.

  • Find keyword in XML file from an array of keywords

    Hi,
    I have an array of collection of keyword:
    $KeyWord = @("Fail","Exception","Terminated","Error")
    I want to check in a textfile sample.xml, if any or all keywords from the array $KeyWord exist. If any of the keyword exist in the textfile, a boolean variable $ExceptionOccurred will return $true.
    The code I am using working good with a TEXT file, but not working with XML file. Is there a way to convert XML to Text and then look for keyword in plaintext?
    Code:
    $KeyWord = @("Fail","Exception","Terminated","Error")
    $sampleFile = Get-Content .\file1.txt
    $ExceptionOccurred = $false
    $KeyWord | ForEach {
        If ($sampleFile -contains $_) {
            $ExceptionOccurred = $true
    $ExceptionOccurred

    hello,
    with PowerShell you can parsing XML files.
    Example XML-File:
    <ListOfData><Table><service>Backup1</service><description>Backup</description><status>Fail</status></Table><Table><service>Backup2</service><description>Backup</description><status>Exception</status></Table><Table><service>Backup2</service><description>Backup</description><status>Error</status></Table></ListOfData>
    with Select-Object you expand the XML as Table and ForEach-Object with if match the attribute "status" for value in the $KeyWord array.
    $KeyWord = @("Fail","Exception","Terminated","Error")[xml]$xml = Get-Content .\file.xml$xml.ListOfData | Select-Object -ExpandProperty Table | ForEach-Object{if($KeyWord -contains $_.status){$ExceptionOccurred = $true}}

  • Problem validating xml file - jaxb

    hi people, I'm working with jaxb to generate Java source classes from the .xsd schemas that I have. I work with 17 schemas that, a priori, I can't modify. In those schemas there are a lot of types and structures that I can use when creating an .xml file. I've read other threads with the problem of namespaces but as a solution they provide a modification on the schemas. The generation of java source is ok, I've done custoization classes and no problem, but when I try to unmarshal an input xml file I get an error of validation:
    DefaultValidationEventHandler: [ERROR]: Probably namespace URI of tag "XFFile" is wrong (correct one is "http://ww........
    A possible xml file is :
    <?xml version="1.0" encoding="UTF-8" standalone="no" ?><!DOCTYPE XFFile><XFFile xmlns:rp210Elements="http://www.smpte-ra.org/schemes/434/200X/multiplex/S377M/2004" xmlns:s377mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S377M/2004" xmlns:s377mMux="http://www.smpte-ra.org/schemes/434/200X/multiplex/S377M/2004" xmlns:s377mTypes="http://www.smpte-ra.org/schemes/434/200X/types/S377M/2004" xmlns:s380mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S380M/2004" xmlns:s381mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S381M/200X" xmlns:s382mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S382M/200X" xmlns:s385mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S385M/2004" xmlns:s422mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S422M/200X" xmlns:s422mTypes="http://www.smpte-ra.org/schemes/434/200X/types/S422M/200X" xmlns:s423mGroups="http://www.smpte-ra.org/schemes/434/200X/groups/S423M/200X">
         <s380mGroups:ClipFramework rp210Elements:InstanceID="a6.67.7a.47.19.2f.4b.10.8f.ee.1e.59.6d.4c.f1.70" rp210Elements:LinkedGenerationID="0e.10.a8.9c.96.1c.4c.11.b1.fb.0a.a9.40.22.a4.e2">
              <rp210Elements:ClipCreationDateTime>
                   <rp210Elements:Year>2006</rp210Elements:Year>
                   <rp210Elements:Month>4</rp210Elements:Month>
                   <rp210Elements:Day>18</rp210Elements:Day>
                   <rp210Elements:Hour>12</rp210Elements:Hour>
                   <rp210Elements:Minute>0</rp210Elements:Minute>
                   <rp210Elements:Second>0</rp210Elements:Second>
                   <rp210Elements:mSec4>0</rp210Elements:mSec4></rp210Elements:ClipCreationDateTime>
              <rp210Elements:FrameworkExtendedTextLanguageCode>fr</rp210Elements:FrameworkExtendedTextLanguageCode>
         </s380mGroups:ClipFramework>
    </XFFile>
    I think it's ok because someone has provided it to my company but I can't validate it because it takes elements from many schemas (am I wrong and I can?)
    i can't post the schemas because of the copyrights (damn it). I'm not asking for a solution but if someone has an idea or has had a similar problema.. I'll appreciate all comments, thanks
    Jordi
    Message was edited by:
    WuWei

    In the schema root element xs:schema add namespace declaration.
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    In the XML document root element add xmlns:xsi and xsi:noNamespaceSchemaLocation attributes.
    <root_element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://c:/testing.xsd">

Maybe you are looking for

  • Client Object Model Sharepoint 2010

    We are using client object model in sharepoint 2010 When we excute the ExcuteQuery method of clinet obejct model we are getting following error The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and tr

  • Chart Work Items by group and role

    Hi, I need to create a chart or a dashboard (I'm not sure) where I can see the workload on participants that have a specific role and belong to a determined group

  • Is there any direct support for CC? I have been navigating the site trying to find someone to contact by email or phone.

    I'm not sure I want a subscription if I can't get an answer to questions I may have. Not all issues are covered in the Q & As and forums.

  • Can someone makepkg a kernel26zenmm-git for me?

    Hi, I'm not sure which forum this goes in, since this is not a support request nor a PKGBUILD request. I tried building the kernel26zenmm-git package from AUR, but after about 6 hours or so of git trying to reconstruct the repository, my /tmp partiti

  • How to Track Flex

    hello ! is there any way that i can find the certain website is design or develop using Adobe Flex 1.0 or 2.0 wht is differenc e between a website design in flash & html & simple FLex based website .. is there any difference in thier source codes whi