From: Xuan B. <med...@us...> - 2008-06-11 06:16:20
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/utils In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20270/src/org/tm4j/topicmap/utils Modified Files: TopicMapHandler.java XTMBuilder.java XTMParser.java Log Message: Support for subjectLocator. Index: XTMBuilder.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/utils/XTMBuilder.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** XTMBuilder.java 11 Jun 2008 06:02:02 -0000 1.78 --- XTMBuilder.java 11 Jun 2008 06:16:21 -0000 1.79 *************** *** 1015,1018 **** --- 1015,1024 ---- break; + case REFTYPE_SUBJECTLOCATOR: + + refTopic = getTopicBySubject(expandedRef); + + break; + case REFTYPE_TOPIC: refTopic = getTopicBySourceLocator(expandedRef); *************** *** 1117,1123 **** break; case 0: ! if (refType == REFTYPE_SUBJECTIDENTIFIER) { ! m_currTopic.addSubjectIndicator(m_locatorFactory.createLocator("URI", expandedRef.getAddress())); ! } break; --- 1123,1134 ---- break; case 0: ! switch (refType) { ! case REFTYPE_SUBJECTIDENTIFIER: ! m_currTopic.addSubjectIndicator(m_locatorFactory.createLocator("URI", expandedRef.getAddress())); ! break; ! /* case REFTYPE_SUBJECTLOCATOR: ! m_currTopic.setSubjectIdentity(m_locatorFactory.createLocator("URI", expandedRef.getAddress())); ! break; ! */ } break; *************** *** 1777,1780 **** --- 1788,1794 ---- /* * $Log$ + * Revision 1.79 2008/06/11 06:16:21 mediumnet + * Support for subjectLocator. + * * Revision 1.78 2008/06/11 06:02:02 mediumnet * Fix missing "break". Maybe the sourcecode should be reformatted (e.g. to Sun Java Code Conventions) to make spotting this more obvious. Index: XTMParser.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/utils/XTMParser.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** XTMParser.java 12 Apr 2007 13:58:12 -0000 1.21 --- XTMParser.java 11 Jun 2008 06:16:21 -0000 1.22 *************** *** 58,61 **** --- 58,62 ---- public static final String XTM2_NS_URI = "http://www.topicmaps.org/xtm/"; public static final String SUBJECTIDENTIFIER = "subjectIdentifier"; + public static final String SUBJECTLOCATOR = "subjectLocator"; public static final String NAME = "name"; public static final String VALUE = "value"; *************** *** 184,187 **** --- 185,190 ---- } else if (enableXTM2support&&xtmClass.equals(SUBJECTIDENTIFIER)) { parseSubjectIdentifier(atts); + } else if (enableXTM2support&&xtmClass.equals(SUBJECTLOCATOR)) { + parseSubjectLocator(atts); } else if (enableXTM2support&&xtmClass.equals(NAME)) { parseNameStart(atts); *************** *** 431,434 **** --- 434,449 ---- } + public void parseSubjectLocator(Attributes atts) + throws TopicMapProcessingException { + String id = getXTMAttribute(ID, atts); + String ref = getXTMAttribute(HREF, atts); + + if (ref != null) { + m_builder.ref(id, TopicMapHandler.REFTYPE_SUBJECTLOCATOR, ref, (String) m_xmlBaseStack.peek()); + } else { + warn("Encountered a subjectIdentifier element with no href attribute. This element will be ignored."); + } + } + public void parseNameStart(Attributes atts) throws TopicMapProcessingException { // FIXME: need to process type Index: TopicMapHandler.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/utils/TopicMapHandler.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TopicMapHandler.java 12 Apr 2007 12:57:48 -0000 1.10 --- TopicMapHandler.java 11 Jun 2008 06:16:21 -0000 1.11 *************** *** 17,20 **** --- 17,21 ---- public static final int REFTYPE_SUBJECTIDENTIFIER = 3; + public static final int REFTYPE_SUBJECTLOCATOR = 4; public void startTopicMap(String id, String xmlBase) |