This works for me with the posted file fragment.
The --recover option tells xmllint to "Output any parsable portions of an invalid document" (From the man page) It tries to fix the incomplete xml by adding the missing end tags. Code:
sed -n '/^ <document>/,/^$/s/^ //p' file | tr -d '\n' | xmllint --format --recover - |
Quote:
|
@ KENHELM...
did you code work then? Did you just run that line or did you use it alongside my script i posted? Im new to all this and not sure if its an addition to what i have already done? Code:
#!/bin/bash Thankyou |
I just ran the line of code I posted.
This is your script with the code inserted. Code:
#!/bin/bash s/^ // removes the single leading space on each line. tr -d '\n' removes the newlines, putting all the xml onto a single line. If the xml is valid you shouldn't need the '--recover' option to xmllint, but if you get some parsing error messages try putting it back in. |
All times are GMT -5. The time now is 08:57 AM. |