- Timestamp:
- 2004-11-05T10:10:44+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/METSStructure.java
r6348 r8461 12 12 import java.sql.ResultSet; 13 13 14 import org.w3c.dom.Element; 15 import org.w3c.dom.NodeList; 16 14 17 import org.greenstone.gsdl3.gs3build.doctypes.DocumentInterface; 15 18 … … 22 25 String label; 23 26 String type; 27 METSDivision divGroup; 24 28 25 29 public static final String STRUCTURE_TYPE = "Structure"; … … 30 34 this.label = label; 31 35 this.type = type; 36 this.divGroup = null; 32 37 } 33 38 … … 108 113 } 109 114 115 116 /* 117 * 118 * parse an XML Element as a METSStructure Section 119 * 120 * @param <code>Element</code> the XML element which represents 121 * the mets:structMap itself 122 */ 123 124 public static METSStructure parseXML(Element element) 125 { 126 String structId = element.getAttribute("ID"); 127 String structType = element.getAttribute("TYPE"); 128 String structLabel = element.getAttribute("LABEL"); 129 130 METSStructure thisStruct = new METSStructure (structId, structType, structLabel); 131 132 NodeList divSecs = element.getChildNodes(); 133 if (divSecs != null) { 134 for (int c = 0; c < divSecs.getLength(); c++) { 135 if (divSecs.item(c).getNodeType() != org.w3c.dom.Node.ELEMENT_NODE){ 136 continue; 137 } 138 Element divElement = (Element) divSecs.item(c); 139 String divName = divElement.getNodeName(); 140 if (divName.equals("mets:div")) { 141 METSDivision division = METSDivision.parseXML(divElement); 142 thisStruct.addDivision(division); 143 } else { 144 System.err.println("Error: mets:structMap was expecting mets:div but got "+divName); 145 } 146 } 147 } 148 return thisStruct; 149 } 150 110 151 /** 111 152 * Write this structure in XML(METS) format to a <code>PrintWriter</code>
Note:
See TracChangeset
for help on using the changeset viewer.