简体   繁体   中英

combine 2 schemas in 1 XML file

I need to have descriptive info from the mods schema and technical info from the PBCore schema in ONE XML document. But no matter what order I put things in, I keep getting a well formedness error in my XML editor. I have this prologue at the top of the XML doc:

<?xml version='1.0' encoding='UTF-8'?>
<mods:modsCollection xmlns:mods="http://www.loc.gov/mods/v3"
    xmlns:xlink="http://www.w3.org/1999/xlink" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.loc.gov/mods/v3 
http://www.loc.gov/standards/mods/v3/mods-3-6.xsd">

and this a little later in my XML doc:

<pbcoreCollection xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html 
http://pbcore.org/xsd/pbcore-2.0.xsd">

What am I missing?

Here is an example document showing this done:

<?xml version="1.0" encoding="UTF-8"?>
<mods:modsCollection xmlns:mods="http://www.loc.gov/mods/v3"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.loc.gov/mods/v3
                      http://www.loc.gov/standards/mods/v3/mods-3-6.xsd">
  <mods:mods>
    <mods:extension>
      <pbcoreCollection
        xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html
                            http://pbcore.org/xsd/pbcore-2.0.xsd">
        <pbcoreDescriptionDocument>
          <pbcoreIdentifier source="NOLA Code">AMEX000102</pbcoreIdentifier>
          <pbcoreTitle>American Experience: Radio Bikini</pbcoreTitle>
          <pbcoreDescription>In July 1946, the U.S. Navy...
                    later.</pbcoreDescription>
        </pbcoreDescriptionDocument>
      </pbcoreCollection>
    </mods:extension>
  </mods:mods>
</mods:modsCollection>

The trick is to assure you can insert the other-schema content where the parent schema allows. Basically, look at the XSD file for elements that can contain mixed="true" content:

http://www.loc.gov/standards/mods/v3/mods-3-6.xsd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM