Menu

Problems with XpathExtract

Help
Anonymous
2003-10-27
2003-10-28
  • Anonymous

    Anonymous - 2003-10-27

    Is XpathExtract working, and how should it be set-up and used?
    Im trying to extract a tag value from an xml document into an attribute to the document I have tried to use both the simple and the xml configuration setup but I never get any value from the added attribute.

    Regards, Stefan

     
    • Dejan Krsmanovic

      Can you post here your pipeline configuration

      Dejan

       
      • Anonymous

        Anonymous - 2003-10-27

        Here is the "config.property" file.

        entryStage=filen

        filen.stageType=XpathExtract
        filen.nextStage=transform
        filen.XPath=/Envelope/Payload/MessageMetaData/DocumentInfo/LogInfo

        transform.stageType=XslTransform
        transform.nextStage=writer
        transform.transformationFile=c:/java/babeldoc-bin-1.2.0-RC2/stla/vonpluring/data/StripEnv.xsl

        writer.stageType=FileWriter
        writer.nextStage=null
        writer.outputFile=c:/tmp/out/TST${document.get('LogInfo')}.xml

        /Stefan

         
        • Sherman Wood

          Sherman Wood - 2003-10-27

          I use XML properties files, so I do things like:

                 
                  <stage-inst>
                      <stage-name>getDocRunDate</stage-name>
                      <stage-desc>Extracts the date of this daily report</stage-desc>
                      <stage-type>XpathExtract</stage-type>
                      <option>
                          <option-name>XPath</option-name>
                          <option-value></option-value>
                          <sub-option>
                              <option-name>document_date</option-name>
                              <option-value>/Procedures[1]/Procedure[1]/Date/text()</option-value>
                          </sub-option>
                      </option>
                  </stage-inst>

          but I think you want:

          filen.stageType=XpathExtract
          filen.nextStage=transform
          filen.XPath.LogInfo=/Envelope/Payload/MessageMetaData/DocumentInfo/LogInfo

           
    • Dejan Krsmanovic

      Sherman answered you.
      When you use XpathExtact, you need to specify one or more attributes that will contain result of XPath expression.
      In case of properties files configuration you should use syntax:
      stageName.XPath.attributeName=XPath expression

      In case of XML config files use suboptions like in Sherman's code.

      Dejan

       
      • Anonymous

        Anonymous - 2003-10-28

        Thanks Sherman and Dejan!

        You put me on the right track and I finally got what I wanted using this config:

        <option>
        <option-name>XPath</option-name>
        <option-value/>
        <sub-option>
        <option-name>LogInfo</option-name>
        <option-value>string(/Envelope/Payload/MessageMetaData/DocumentInfo/LogInfo)</option-value>
        </sub-option>
        </option>
        </stage-inst>
        <stage-inst>
        <stage-name>transform</stage-name>
        <stage-desc>this transforms stuff</stage-desc>
        <stage-type>XslTransform</stage-type>
        <option>

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.