Welcome to Machine Unix

Search Below

Validating SMF manifest with xmllint

Have you ever wondered why you get the following error but not a detailed explanation of where the actual error resides?

# svccfg validate ds7-manifest.xml
svccfg: couldn’t parse document

I have an xml smf manifest I am trying to validate and the system tells me that there is something wrong with my xml. So where is the actual problem? Enter xmllinit….

# xmllint ds7-manifest.xml
ds7-manifest.xml:30: parser error : Opening and ending tag mismatch: propval line 29 and property_group
</property_group>
^
ds7-manifest.xml:40: parser error : Opening and ending tag mismatch: property_group line 28 and service
</service>
^
ds7-manifest.xml:41: parser error : expected ‘>’
</service_bundle>
^
ds7-manifest.xml:42: parser error : Premature end of data in tag service_bundle line 3

^

Ahh, forgot to add a closing tag somewhere, specifically at line 29. Let’s look what is around line 29:

28 <property_group name=’startd’ type=’framework’>
29 <propval name=’duration’ type=’astring’ value=’transient’>
30 </property_group>

This is a transient service I was trying to setup, and it looks like I forgot a “/” and the end of line 29.
Let’s add it, and run it again

28 <property_group name=’startd’ type=’framework’>
29 <propval name=’duration’ type=’astring’ value=’transient’/>
30 </property_group>

# xmllint ds7-manifest.xml
……..

Output of xml is given back to you.

Smiliarly when you run svccfg:

# svccfg validate ds7-manifest.xml

will return an empty prompt..