Reply by Peter Schweitzer on 29 August 2003:
This situation sometimes occurs when someone has already created
the metadata and run it through mp
to generate HTML but has then discarded, lost, or simply not passed
on to you the original text file. There are a couple of different
ways to cope with this. The cleanest and most likely to produce the
best results is also the strangest because it involves running a very
small specialized program and using cns with a config file.
It's important to note that this procedure works only on HTML written
just like mp writes it. I see that it will work on metadata exported
from ArcCatalog 8.3 using the stylesheet
FGDC CSDGM (HTML).
Note also that this won't work for the FAQ-style HTML.
catfish.htmlwith Notepad. You'll see HTML code.
cdcommand. I'm pretending that this directory is
C:\data> detag catfish.txt
catfish.txt.out. You can use Notepad to compare this to
catfish.txt, but don't make any changes to it.
detag does is remove the HTML markup tags. But it also finds the element names in the metadata and puts @@ before each one to make it easier for cns to recognize them. So the next task is to tell
cns that it should look for those @@ markings.
input prefix @@Save this file in the same directory using a name like
c:\data> cns -c fix.cfg catfish.txt.out -o catfish.met -e leftover.txt
leftover.txt. It should be empty. If it isn't, then the situation is more complicated and you need to understand the more general function of cns. Consult a tutorial on cns or perhaps contact someone who understands cns for help.
catfish.metshould be reliably parseable. Check this by running mp on it:
c:\data> mp catfish.met -e catfish.errThis puts error messages into
catfish.err. Using Notepad, look at
catfish.err. The last line in this file should be the summary of errors. It should not show any unrecognized or misplaced element errors. If it does, then the metadata will probably not import properly into ArcCatalog.
catfish.metinto ArcCatalog, and you can delete
catfish.err catfish.txt catfish.txt.out leftover.txtIf you have any other files to process in this way, keep
fix.cfg, otherwise you can delete these also.
It is also possible to convert the file by saving the HTML as plain text and running cns on that. But you'll have to understand how cns works, and you'll need to check the input and output of cns carefully to clean up any confusing elements.
Still another approach is to open a metadata editor such as ArcCatalog or Tkme and carefully copy the metadata elements from the web browser to the appropriate fields in the metadata editor. While this affords you the opportunity to examine the metadata in great detail, it is also the slowest method and the one most fraught with the possibility of error.