Changeset 4503
- Timestamp:
- 2003-06-06T15:42:53+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/msm/MSMUtils.java
r4487 r4503 408 408 * @return A fully qualified identifier as a <strong>String</strong> 409 409 */ 410 static final public String getFullIdentifier(Node element ) {410 static final public String getFullIdentifier(Node element, String namespace) { 411 411 if(element == null) { 412 412 return "Error"; … … 421 421 } 422 422 return identifier + NS_SEP + getIdentifier(element); 423 } 424 return getIdentifier(element); // No namespace anymore 423 } 424 if (namespace.equals("")) { 425 return getIdentifier(element); // No namespace anymore 426 } 427 return namespace + NS_SEP + getIdentifier(element); 425 428 } // static public String getFullIdentier(Node element) 426 429 427 430 /*************************************************************************/ 428 /** Method to construct an elements fully qualified name. Note that this is different from a nodes identifier. Think of name as a short, unique reference to a nmetadata element, whereas identifier can be much longer, language specific and non-unique.431 /** Method to construct an elements fully qualified name. Note that this is different from a nodes identifier. Think of name as a short, unique reference to a metadata element, whereas identifier can be much longer, language specific and non-unique. 429 432 * @param element An <strong>Element</strong> whose name we are interested in. 430 433 * @return A <strong>String</strong> representing this given elements fully namespace qualified name. 431 434 */ 432 435 static final public String getFullName(Element element) { 436 return getFullName(element, ""); 437 438 } 439 /*************************************************************************/ 440 /** Method to construct an elements fully qualified name. Note that this is different from a nodes identifier. Think of name as a short, unique reference to a metadata element, whereas identifier can be much longer, language specific and non-unique. 441 * @param element An <strong>Element</strong> whose name we are interested in. 442 * @return A <strong>String</strong> representing this given elements fully namespace qualified name. 443 */ 444 static final public String getFullName(Element element, String def_namespace) { 433 445 if(element == null) { 434 446 return null; … … 436 448 // Get namespace for given element. 437 449 Element root = (Element)element.getParentNode(); 438 String identifier = root.getAttribute("namespace") + NS_SEP + element.getAttribute("name"); 450 String namespace = ""; 451 if (root==null) { 452 namespace = def_namespace; 453 } else { 454 namespace = root.getAttribute("namespace") ; 455 } 456 String identifier = namespace + NS_SEP + element.getAttribute("name"); 439 457 // Get name and return it. 440 458 if(identifier.startsWith(".")) { … … 557 575 static final public String[] getStructuralDetails(MetadataSet mds, Element element) { 558 576 String details[] = new String[4]; 559 Element root = (Element)element.getParentNode();577 //Element root = (Element)element.getParentNode(); 560 578 //details[0] = root.getAttribute("name"); 561 579 //details[1] = root.getAttribute("namespace"); … … 671 689 } 672 690 691 /** can only be used to set the english value */ 673 692 static final public void setIdentifier(Node element, String value) { 674 693 // Get the 'identifier' Element … … 677 696 if(node.getNodeName().equals("Attribute")) { 678 697 Element target = (Element)node; 679 if(target.getAttribute("name").equals("identifier") ) {698 if(target.getAttribute("name").equals("identifier") && target.getAttribute("language").equals("en")) { 680 699 Node text = target.getFirstChild(); 681 700 text.setNodeValue(value); 701 break; 682 702 } 683 703 }
Note:
See TracChangeset
for help on using the changeset viewer.