Menu

#125 Allow val to read from stdin

all
open
nobody
None
5
2019-02-18
2019-02-12
No

Please allow xmlstarlet val to read from stdin.

This is especially useful in scenarios where an XML file is generated by some other tool, or wherexmlstarlet is running inside a container and cannot access the file system directly.

Steps to reproduce:

  1. Have a valid XML file in the file a.xml.
  2. Have a valid XML Schema definition in the file b.xsd.
  3. Execute cat a.xml | xmlstarlet val --xsd b.xsd --err

Expected results:

  1. On step 3, the XML file should be validated against the XSD.

Actual results:

  1. NOK: On step 3, this error is generated:
couldn't read file '--err'
--err - invalid

Discussion

  • Ernst de Haan

    Ernst de Haan - 2019-02-13

    Workaround I'm using (inside a Dockerfile):

    mkdir -p /io
    cat > /io/input.xml
    xmlstarlet validate --xsd "$1" --err /io/input.xml
    
     
  • Noam Postavsky

    Noam Postavsky - 2019-02-13

    Use - to indicate stdin, e.g., cat a.xml | xmlstarlet val --xsd b.xsd --err -

     
    • Ernst de Haan

      Ernst de Haan - 2019-02-18

      Thanks Noam! That works.

      Would be good to explain that in the help output.

      I think this ticket can be closed now.

       

Log in to post a comment.

MongoDB Logo MongoDB