Help with xmllint

Have like 50 xml files in a folder. They all have a Node named <Number>.How to display the values of <Number> with the count and filename in the folder. I am using Mac .

Hi, welcome to these forums. Please show a representative sample of input, desired output and attempts at a solution and specify what OS and versions are being used.

And please post in the right forum..

Thanks. Eg: The file emp1.xml

<Employee>
    <EmployeeId>1</ EmployeeId >
    <DeptId>E</DeptId>
    <InternId>94</internId>
     <Number>10<Number>

There will 50 xml files or more than that .
How to write an xmllint or any command to display the value of <Number> and its filename?

I wrote :

xmllint --xpath "//Number" *.Xml

.

is it right?

Then : sometimes <Number xsi:nil="true"> .

How to write an xmllint or any other command to find <Number> is true or NULL value.
since its more than 50 files and it might increase in future pl let me know and thanks

Computer : Mac
OSX :10.9.2
Terminal in Mac.

Instead of using xmllint, and providing your XML file layout is consistent, you could do something like this:

$ grep -E "<Number>(.*)</Number>" *.xml | sed -e 's/<Number>\([^<]*\)<\/Number>.*/ \1/g' 

Typed the command. Displays or returns back to the $ mode without any result. Pl help.

---------- Post updated at 06:25 PM ---------- Previous update was at 04:54 PM ----------

I tried the below :

xmllint --xpath "//Number[contains(name, �true�)] *.Xml

returns the 50 files output , with the values of the <Number> and the filename.

But I need to print the <Number> which has value :

<Number xsi:nil="true"/>

Pl help.Thanks.

Your request is not at all clear.

Please post a couple of small XML files (in CODE tags) and show us exactly what you are hoping to get as output (in CODE tags) from those sample files.

In XML files, tags aren't values, values come between opening tags and closing tags; or XML tags contain attributes that have values. Are you trying to get the value of the nil attributes in Number tags in your XML files?

Yes.

Trying to get the value of the

nil 

attributes in

<Number>

tags in XML files.

Thanks for the help.

Which is it? Do you want the attribute value, or the tag value where the nil attribute is true?