By the way, here are the super-quick-and-dirty "validate all 36 manuals at
once"
scripts I used. I'm sure somebody else can make these a lot nicer than they
are! For now, they did the trick, I think... :-)
Mike
==================================================
bash-3.00$ pwd
/home/myusername/docs2/20080215/common
bash-3.00$ ls
catalog.xml validate* validateone*
sun-iso-map.xml validateall* xsolbook.dtd
bash-3.00$ cat validateone
#echo validating: $1
cd $1
if ls *.book 2> /dev/null ; then
echo validating $1...
../common/validate $1
fi
bash-3.00$ cat validateall
find . -type d -exec ./common/validateone {} \;
bash-3.00$ cd ..
bash-3.00$ ./common/validateall
...
michelle olson wrote:
> Cool, this works without modification, confirmed!
>
> -Michelle
>
> Michael Pogue wrote:
>> Actually, could you try out this one? It eliminates step 3, too -- no
>> more need to edit that XML_CATALOG_FILES line. I've also added a CDDL
>> header.
>>
>> Mike
>> ================================================
>>
>> bash-3.00$ cat validate
>> #!/bin/sh
>> #
>> # CDDL HEADER START
>> #
>> # The contents of this file are subject to the terms of the
>> # Common Development and Distribution License, Version 1.0 only
>> # (the "License"). You may not use this file except in compliance
>> # with the License.
>> #
>> # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
>> # or http://www.opensolaris.org/os/licensing.
>> # See the License for the specific language governing permissions
>> # and limitations under the License.
>> #
>> # When distributing Covered Code, include this CDDL HEADER in each
>> # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
>> # If applicable, add the following below this CDDL HEADER, with the
>> # fields enclosed by brackets "[]" replaced with your own identifying
>> # information: Portions Copyright [yyyy] [name of copyright owner]
>> #
>> # CDDL HEADER END
>> #
>>
>> MYLOCATION=`pwd`/$0; export MYLOCATION
>> XML_CATALOG_FILES=`dirname $MYLOCATION`/catalog.xml; export
>> XML_CATALOG_FILES
>> #echo XML_CATALOG_FILES = $XML_CATALOG_FILES
>> if xmllint --memory --valid --noout *.book; then
>> echo No validation errors found in *.book .
>> else
>> echo Errors found in *.book .
>> fi
>>
>>
>>
>>
>>
>> michelle olson wrote:
>>
>>> Awesome! It works for me. Thank you so much Mike, I will add these
>>> two new files to common and update the instructions.
>>>
>>> -Michelle
>>>
>>> Michael Pogue wrote:
>>>
>>>> OK, here's the recipe (could somebody please try out these
>>>> instructions, to make sure everything works correctly?):
>>>>
>>>> 1) Create a "catalog.xml" file in your "common/" directory.
>>>> Michelle, we should create this file in the common/ directory, so
>>>> that this step can be eliminated.
>>>>
>>>> bash-3.00$ cat catalog.xml
>>>> <?xml version="1.0"?>
>>>> <!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML
>>>> Catalog V1.0//EN"
>>>> "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
>>>> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
>>>> <public publicId="-//Sun Microsystems//DTD SolBook-XML 3.5//EN"
>>>> uri="xsolbook.dtd"/>
>>>> </catalog>
>>>>
>>>> Note that the catalog refers to "xsolbook.dtd", and not
>>>> "solbook.dtd".
>>>> No need to rename the file!!
>>>>
>>>> 2) Create the following file, called "validate" in your "common/"
>>>> directory.
>>>> Michelle, I think we should put this file in common/, too. That
>>>> would eliminate step 2.
>>>>
>>>> bash-3.00$ cat validate
>>>> #!/bin/sh
>>>> #
>>>> # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
>>>> # Use is subject to license terms.
>>>> #
>>>>
>>>> XML_CATALOG_FILES=/home/myusername/docs2/20080215/common/catalog.xml; \
>>>> export XML_CATALOG_FILES
>>>> if xmllint --memory --valid --noout *.book; then
>>>> echo No validation errors found in *.book .
>>>> else
>>>> echo Errors found in *.book .
>>>> fi
>>>>
>>>> 3) Change the XML_CATALOG_FILES= statement in validate to point at the
>>>> "catalog.xml" file you created in step 1. You only have to do this
>>>> once.
>>>>
>>>> 4) cd to the directory containing the book you want to validate.
>>>>
>>>> cd /home/myusername/docs2/20080215/DYNMCTRCGGD
>>>>
>>>> 5) Run the validate command. It will validate the .book file (and
>>>> everything that the .book file includes).
>>>>
>>>> bash-3.00$ ../common/validate
>>>> No validation errors found in DYNMCTRCGGD.book .
>>>>
>>>> Mike
>>>>
>>>>
>>>> michelle olson wrote:
>>>>
>>>>> Hi Mike,
>>>>>
>>>>> OK, any help you can give on the catalogs would be greatly
>>>>> appreciated. That was my original intent, but the work hasn't been
>>>>> completed because I have no experience with XML catalogs.
>>>>>
>>>>> thanks,
>>>>> Michelle
>>>>>
>>>>> Michael Pogue wrote:
>>>>>
>>>>>> I've been thinking about that....
>>>>>>
>>>>>> I don't think the best approach is to make N copies (in this case,
>>>>>> N = 36) of the dtd and entities file. If we do that in the
>>>>>> repository, they will diverge. It would be better to keep them in
>>>>>> one place (like "common"), but have the validation script
>>>>>> reference them there.
>>>>>>
>>>>>> The best way to fix this is probably to use XML catalogs. It
>>>>>> looks like the .dtd and sun-iso files are referenced via PUBLIC
>>>>>> entities, so this should work.
>>>>>>
>>>>>> Mike
>>>>>>
>>>>>> michelle olson wrote:
>>>>>>
>>>>>>> Michael Pogue wrote:
>>>>>>>
>>>>>>>> That's better, but it still generates errors, because the
>>>>>>>> entities are actually defined elsewhere. It turns out that
>>>>>>>> copying "common/sun-iso-map.xml" to the DYNMCTRCGGD directory
>>>>>>>> does make it work the rest of the way!
>>>>>>>>
>>>>>>> OK, cool, I'm glad you've made progress, I eagerly await a push
>>>>>>> notification! :)
>>>>>>>
>>>>>>>> I verified that "xmllint --valid --noout DYNMCTRCGGD.book"
>>>>>>>> complains (correctly) when I insert validity errors into the
>>>>>>>> .book file, the sun-iso-map.xml file, and into the chapter1.xml
>>>>>>>> file. So, I think we have a validation process that works now.
>>>>>>>>
>>>>>>>> We should make it easier to use, though!
>>>>>>>>
>>>>>>> OK, so I'll put a copy of the correctly named dtd and the
>>>>>>> sun-iso-map files into each book directory in the next update of
>>>>>>> the consolidation. Then, we should update the instructions to
>>>>>>> make explicit that xmllint should be run on the book file. What
>>>>>>> else can we do to make it easier?
>>>>>>>
>>>>>>> thanks,
>>>>>>> Michelle
>>>>>>>
>>>>>>>> Mike
>>>>>>>>
>>>>>>>> michelle olson wrote:
>>>>>>>> ...
>>>>>>>>
>>>>>>>>> Thanks for continuing to work on this. I found a couple things
>>>>>>>>> that might also help Rainer. So, try doing the following:
>>>>>>>>>
>>>>>>>>> -copy the xsolbook.dtd from the 20080215/common directory to
>>>>>>>>> your DYNMCTRCGGD directory.
>>>>>>>>> -rename the xsolbook.dtd file to solbook.dtd.
>>>>>>>>> -issue the xmllint --valid --noout DYNMCTRCGGD.book
>>>>>>>>>
>>>>>>>>>
>>>>>>>> ...
>>>>>>>>
>> _______________________________________________
>> docs-discuss mailing list
>> docs-discuss at opensolaris.org
>>
>