xmllint output to a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting xmllint output to a file
# 1  
Old 07-21-2008
xmllint output to a file

Hello All,
I have an XML file which has some errors in its tag definition according to an xsd. When i validate this xml file against an xsd, i wish to only take the errors in a file and not the complete xml. for eg.
Raman.xml has some errors induced in it.
RamanValidator.xsd holds the schema definition.
upon running the following utility:
xmllint --schema RamanValidator.xsd Raman.xml,
i get this as output:
ACT_D_03_07_08_T_12_41.xml:16: element CLI: Schemas validity error : Element 'CLI' [ST local, facet 'pattern']: The value '019145 58756' is not accepted by the pattern '[0-9]*'.
ACT_D_03_07_08_T_12_41.xml:35: element BBProduct: Schemas validity error : Element 'BBProduct' [CT 'BBProductType']: The element content is not valid.
ACT_D_03_07_08_T_12_41.xml:64: element CallingAndNetworkFeatures: Schemas validity error : Element 'CallingAndNetworkFeatures' [CT local]: The element content is not valid.
ACT_D_03_07_08_T_12_41.xml:10022: element BBProduct: Schemas validity error : Element 'BBProduct' [CT 'BBProductType']: The element content is not valid.
ACT_D_03_07_08_T_12_41.xml fails to validate

Now, i want this output only in a file.

Please help... Anticipating....
# 2  
Old 07-21-2008
You can simply redirect output to a file with redirector.
command > {filename}
# 3  
Old 07-21-2008
It doesnt work Nilesh !!
It produces a zero byte file and the entire output is given as stdio only...

Must be some other way to do so ....
# 4  
Old 07-21-2008
Code:
command > output_file 2>&1

# 5  
Old 07-21-2008
use --noout option to suppress default xml output after parsing
# 6  
Old 07-21-2008
Thanks a ton for the trick matrixmadhan.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Xmllint parser error : EntityRef: expecting ';'

Hi I have an XML file which contains html urls in that node values. When i use xmllint to parse that, i am getting error (because of the sympols in the url). i have used --html option but it throws other tag errors. Please guide me. sample file.xml <abc> <bcd> <cde> <a>sometext</a>... (2 Replies)
Discussion started by: ananan
2 Replies

2. Shell Programming and Scripting

Xmllint: get one result per line

Hi, I'm trying to get some values from an xmlfile and want be able to process them. I'm using xmllint(v20901 on debian jessie) and this program directly outputs all results concatenated right after each other. I did not find a solution in the man page to get a different format or some output... (2 Replies)
Discussion started by: stomp
2 Replies

3. Shell Programming and Scripting

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 . (7 Replies)
Discussion started by: Anethar
7 Replies

4. Shell Programming and Scripting

Parse XML using xmllint

Hi All, Need help to parse the xml file in shell script using xmllint. Below is the sample xml file. <CARS> <AUDI> <Speed="45"/> <speed="55"/> <speed="75"/> <speed="95"/> </AUDI> <BMW> <Speed="30"/> <speed="75"/> <speed="120"/> <speed="135"/> </BMW>... (6 Replies)
Discussion started by: prasanna2166
6 Replies

5. Shell Programming and Scripting

Linux xmllint schema validation fails but error code 0

Command line xmllint --schema validation fails but $? returns 0 myinput.xml: <myinput><header>mytestvalue</header></myinput>myschema.xsd <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="myinput" type="xsd:string"/> </xsd:schema>Command: $xmllint --schema... (4 Replies)
Discussion started by: mknag
4 Replies

6. Shell Programming and Scripting

Xmllint - Xml-file problem --ods file not opening

Dear All, this is my first post on this Forum, glad to be here. I'm trying to fix an .ods file. Yes, I had a backup, but it's also corrupted. When opening the document I get this EM: read error format error discovered in the file in sub-document content.xml at 2,337040(row,col). So I... (3 Replies)
Discussion started by: jameslast
3 Replies

7. UNIX for Dummies Questions & Answers

Xmllint pretty print, batch files

I have about 20 xml files I want to use xmllint to pretty print: xmllint --format file01.xml > pretty_file01.xml xmllint --format file02.xml > pretty_file02.xml etc Is there a way I can just use "xmllint --format" on all the current xml files so I don't have to run this command 20 times?? :( (5 Replies)
Discussion started by: pxalpine
5 Replies

8. Shell Programming and Scripting

XMLLINT COMMAND IN UNIX TO VALIDATE XML AGAINST XSD

Hi i am baby to unix shell script. how do i validate xml agaist xsd and transforms xml using xslt. Thanks Mohan (2 Replies)
Discussion started by: mohan.cheepu
2 Replies

9. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

10. UNIX for Advanced & Expert Users

iconv and xmllint

Here is my question, volume of records processed : 5M ( approx ) Its basically very simple operation that am trying to do and I had achieved the output that am interested. What am looking for really is to improve the performance, an optimized way to do that. with respect to iconv, am... (3 Replies)
Discussion started by: matrixmadhan
3 Replies
Login or Register to Ask a Question