1. XML import

    Článek: AN0001933Aktualizováno::

    Na této stránce jsou zobrazeny příklady xml importů.

    Import elementů podle názvu atributu

    V některých případech potřebujeme načítat hodnoty xml elementů v závislosti na názvu atributu. ObjectGears toto umožňuje bez nutnosti provádět xslt transformaci.

    Příklad xml souboru:

    <?xml version="1.0"?>
    <Objects>
       <Object>
          <Property Name="Login">Miller</Property>
          <Property Name="LoginWithDomain">objectgears\majer</Property>
          <Property Name="Displayname">Miller David</Property>
          <Property Name="Firstname">David</Property>
          <Property Name="Lastname">Miller</Property>
          <Property Name="Email">miller@objectgears.com</Property>
          <Property Name="Enabled (Yes/No)">Yes</Property>
          <Property Name="Phone" /><Property Name="Fax">Yes</Property>
          <Property Name="SID">S-1-5-24-1432678235-875345213-874234965-43999</Property>
          <Property Name="Description">CIO</Property>
          <Property Name="Office">New York, 5th Avenue</Property>
       </Object>
       <Object>
          <Property Name="Login">Metz</Property>
          <Property Name="LoginWithDomain">objectgears\semerad</Property>
          <Property Name="Displayname">Metz Peter</Property>
          <Property Name="Firstname">Petr</Property>
          <Property Name="Lastname">Metz</Property>
          <Property Name="Email">metz@objectgears.com</Property>
          <Property Name="Enabled (Yes/No)">Yes</Property>
          <Property Name="Phone" /><Property Name="Fax">Yes</Property>
          <Property Name="SID">S-1-5-24-234842432-874237976-324856234-76534</Property>
          <Property Name="Description">Unix administrator</Property>
          <Property Name="Office">Frankfurt, Bernerstrasse</Property>
       </Object>
    </Objects>

    Pro výše uvedený importní soubor v definici importu nastavíme:

    XML cesta k položce:

    /Objects/Object

    Importní sloupce:

    Property[@Name="LoginWithDomain"]

    Property[@Name="Login"]

    Property[@Name="Displayname"]

    atd...

    Import při využití namespace

    ObjectGears umožňuje importovat data z xml souboru níže uvedené struktury.

    <?xml version="1.0" encoding="UTF-8"?>
    -<EnergyReport xmlns="http://schemas.microsoft.com/energy/2007">
      -<ReportInformation>
          <ReportGuid>61c5664e-9ba1-4a7e-8b35-64e62e8b9918</ReportGuid>
          <ReportVersion>1.0</ReportVersion>
          <ScanTime>2014-10-07T06:32:02Z</ScanTime>
          <ScanDuration>PT60S</ScanDuration>
       </ReportInformation>
      -<Troubleshooter guid="c78b52e3-9cd7-4802-979c-57ca1283dafa">
          <Name>System information</Name>
         -<AnalysisLog>
            -<LogEntry guid="3d053cee-9926-4ac0-a4e1-63ab80c63af0">
               <Name>System information</Name>
               <Severity>Informational</Severity>
               <Description>Detailed system information</Description>
              -<Details>
                 -<Detail guid="300b5d9f-434e-45b0-80d2-4bd55b168ef3">
                     <Name>Computer name</Name>
                     <Value>NYGU9SAN7Q3</Value>
                  </Detail>
                 -<Detail guid="a49d84bf-a8c7-4c26-8f54-eefccac2f084">
                     <Name>Vendor</Name>
                     <Value>Dell Inc.</Value>
                  </Detail>
                 -<Detail guid="ceddb6e2-626c-4efe-ae58-c7b241693909">
                     <Name>Product name</Name>
                     <Value>Latitude E6420</Value>
                  </Detail>
                 -<Detail guid="b586008a-e3ca-457a-8f48-30fe0de3facf">
                     <Name>Datum systému BIOS</Name>
                     <Value>06/24/2013</Value>
                  </Detail>
                 -<Detail guid="c85bfef6-93e7-4f1a-a35d-20655dab095d">
                     <Name>BIOS version</Name>
                     <Value>A19</Value>
                  </Detail>
                 -<Detail guid="31dc51fd-a872-4546-a54f-ae0da74cdf9f">
                     <Name>Number of operationg system build</Name>
                     <Value>9600</Value>
                  </Detail>
                 -<Detail guid="8838163d-e78c-4858-9432-9b034382e9f6">
                     <Name>Platform role</Name>
                     <Value>PlatformRoleMobile</Value>
                  </Detail>
                 -<Detail guid="d64ab9ff-6978-4c37-ac17-9494347b673b">
                     <Name>Process count</Name>
                     <Value>113</Value>
                  </Detail>
                 -<Detail guid="375cbf0f-61d5-42b8-a0fd-16c198b7b32f">
                     <Name>Thread count</Name>
                     <Value>1616</Value>
                  </Detail>
                 -<Detail guid="9fd5343d-fcb1-42ac-9566-8a8e8409a60b">
                     <Name>Power supply</Name>
                     <Value>true</Value>
                  </Detail>
                  </Details>
             </LogEntry>
          </AnalysisLog>
       </Troubleshooter>
    </EnergyReport>

    Pro výše uvedený importní soubor v definici importu nastavíme:

    XML cesta k položce:

    /a:EnergyReport/a:Troubleshooter/a:AnalysisLog/a:LogEntry/a:Details/a:Detail

    Importní sloupce:

    ../../../..@@guid

    ../..@@guid

    ../../a:Name

    ../../a:Severity

    @@guid

    a:Name

    a:Value

    Namespace na záložce Xml:

    a http://schemas.microsoft.com/energy/2007

×