Hello Hao

I saw on the GitHub repository that the work is progressing well. Keep
going!


Le 28/06/16 à 02:34, phuong hao nguyen thi a écrit :
> This is Xpart for MOD021KM Metadata :
> /_MI_Metadata_/identificationInfo/_MD_DataIdentification_/citation/CI_Citation/identifier/MD_Identifier/code/CharacterString
> This is Xpart for lansat metadata :
> /_MD_Metadata_/identificationInfo/_MD_Identification_/citation/CI_Citation/identifier/MD_Identifier/code/CharacterString.

The first XPath begins with "MI_" and the second XPath begins with
"MD_". The second one (MD_Metadata) is defined by ISO 19115. The first
one (MI_Metadata) is defined in an extension called ISO 19115-2. This
may look a little bit complicated, but the reason for that separation is
not really technical. It is rather (in my understanding) historical.

Actually, if I look at the ParseXML class, I see that you need to care
about MD_Metadata or MI_Metadata name because you parse the XML file as
a org.w3c.dom.Document, then use XPath for extracting value. It is okay
to do that way if you wish. But alternatively, you could also let Apache
SIS do the parsing for you. Apache SIS should be "intelligent" enough
for supporting MD_Metadata and MI_Metadata almost like synonymous. It
may be easier for you since you would need need to worry anymore about
the different XPaths.

    Metadata md = (Metadata) XML.umarshal(new 
File("/home/haonguyen/data/LC81230522014071LGN00_MTL.xml"));
    Identification id = first(md.getIdentificationInfos());
    Identifier identifier = first(id.getCitation().getIdentifier());

With the following convenience method:

    private static <E> E first(Collection<E> c) {
        Iterator<E> it = c.iterator();
        if (it.hasNext()) {
            return it.next();
        } else {
            return null;
        }
    }

With this approach, you would not need to worry anymore about
MI_Metadata versus MD_Metadata.


> And this is xml full when I XML.marshal(metadata.new File (...)) for
> landsat metadata
> don't have the value boudingbox.

Do you see the bounding box in System.out.println(metadata)?

    Martin


Reply via email to