Revision 1389
Added by Jing Tao almost 22 years ago
src/edu/ucsb/nceas/metacat/DBSAXHandler.java | ||
---|---|---|
186 | 186 |
public void startElement(String uri, String localName, |
187 | 187 |
String qName, Attributes atts) |
188 | 188 |
throws SAXException { |
189 |
MetaCatUtil.debugMessage("Start ELEMENT " + qName, 50); |
|
190 |
|
|
189 |
// for element <eml:eml...> qname is "eml:eml", local name is "eml" |
|
190 |
// for element <acl....> both qname and local name is "eml" |
|
191 |
// uri is namesapce |
|
192 |
MetaCatUtil.debugMessage("Start ELEMENT(qName) " + qName, 50); |
|
193 |
MetaCatUtil.debugMessage("Start ELEMENT(localName) " + localName, 50); |
|
194 |
MetaCatUtil.debugMessage("Start ELEMENT(uri) " + uri, 50); |
|
195 |
|
|
196 |
|
|
191 | 197 |
DBSAXNode parentNode = null; |
192 | 198 |
DBSAXNode currentNode = null; |
193 | 199 |
|
... | ... | |
199 | 205 |
} |
200 | 206 |
|
201 | 207 |
// Document representation that points to the root document node |
202 |
if (atFirstElement) { |
|
208 |
if (atFirstElement) |
|
209 |
{ |
|
203 | 210 |
atFirstElement = false; |
204 |
// If no DOCTYPE declaration: docname = root element name |
|
205 |
if (docname == null) { |
|
211 |
// If no DOCTYPE declaration: docname = root element |
|
212 |
// doctype = root element name or name space |
|
213 |
if (docname == null) |
|
214 |
{ |
|
206 | 215 |
docname = localName; |
216 |
// if uri isn't null doctype = uri(namespace) |
|
217 |
// othewise root element |
|
218 |
if (uri != null && !(uri.trim()).equals("")) |
|
219 |
{ |
|
220 |
doctype = uri; |
|
221 |
} |
|
222 |
else |
|
223 |
{ |
|
224 |
doctype = docname; |
|
225 |
} |
|
226 |
MetaCatUtil.debugMessage("DOCNAME-a: " + docname, 30); |
|
227 |
MetaCatUtil.debugMessage("DOCTYPE-a: " + doctype, 30); |
|
228 |
} |
|
229 |
else if (doctype == null) |
|
230 |
{ |
|
231 |
// because docname is not null and it is declared in dtd |
|
232 |
// so could not be in schema, no namespace |
|
207 | 233 |
doctype = docname; |
208 |
MetaCatUtil.debugMessage("DOCNAME-a: " + docname, 50); |
|
209 |
MetaCatUtil.debugMessage("DOCTYPE-a: " + doctype, 50); |
|
210 |
} else if (doctype == null) { |
|
211 |
doctype = docname; |
|
212 |
MetaCatUtil.debugMessage("DOCTYPE-b: " + doctype, 50); |
|
234 |
MetaCatUtil.debugMessage("DOCTYPE-b: " + doctype, 30); |
|
213 | 235 |
} |
214 | 236 |
rootNode.writeNodename(docname); |
215 | 237 |
try { |
Also available in: Unified diff
If insert a schema xml, the doctype will be root element name space.