Menu

XMLSTARLET with Namespace Indicators Won't Get Parameter Value

Help
2016-02-02
2016-02-03
  • gilbert mark stewart

    Here's the expression I've tried to use:
    xmlstarlet sel -t -v "/bulkCCDataFile[@xmlns:un='utranNrm.xsd']/configData[@dnPrefix='Undefined']/xn:SubNetwork[@id='ALPHA']/xn:SubNetwork[@id='Burbank']/xn:attributes/xn:userDataType/"

    And here is the part of the XML file I'm trying to read from:

        1 <?xml version="2.0" encoding="UTF-8"?>
        2 <bulkCCDataFile xmlns:un="Nrm.xsd"
        3     xmlns:es="EricssonSpecificAttributes.15.25.xsd"
        4     xmlns:xn="Nrm.xsd" xmlns:gn="Nrm.xsd" xmlns="configData.xsd">
        5     <fileHeader fileFormatVersion="32.615 V4.5" vendorName="Ericsson"/>
        6     <configData dnPrefix="Undefined">
        7         <xn:SubNetwork id="ALPHA">
        8             <xn:SubNetwork id="Burbank">
        9                 <xn:attributes>   
        10                     <xn:userDataType>MY_SERVERS</xn:userDataType>
    

    I've looked at many example, but none seem to address this particular situation for getting userDataType value, "MY_SERVERS". This LOOKS like what XPATH is supposed to be.

    What am I missing?

     

    Last edit: Noam Postavsky 2016-02-03
    • Noam Postavsky

      Noam Postavsky - 2016-02-03

      Have you read chapter 5 in user guide? http://xmlstar.sourceforge.net/doc/UG/ch05.html

       

Log in to post a comment.