[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Thu Oct 26 00:32:20 UTC 2006
gordonp
Wed Oct 25 20:32:20 EDT 2006
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data
In directory dev.open-bio.org:/tmp/cvs-serv14885/src/main/org/biomoby/shared/data
Modified Files:
MobyContentInstance.java MobyDataUtils.java
Log Message:
Became more lenient in namespace resoltion (moby-s allowed, but give warnings)
moby-live/Java/src/main/org/biomoby/shared/data MobyContentInstance.java,1.4,1.5 MobyDataUtils.java,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/09/22 23:01:04 1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/10/26 00:32:20 1.5
@@ -87,10 +87,18 @@
") was not " + MobyTags.MOBYCONTENT);
}
if(!MobyPrefixResolver.MOBY_XML_NAMESPACE.equals(objectTag.getNamespaceURI())){
- throw new MobyException("The content element's namespace (" +
- objectTag.getNamespaceURI() +
- ") did not have the MOBY namespace " +
- MobyPrefixResolver.MOBY_XML_NAMESPACE);
+ if(!MobyPrefixResolver.MOBY_XML_NAMESPACE_INVALID.equals(objectTag.getNamespaceURI())){
+ throw new MobyException("The content element's namespace (" +
+ objectTag.getNamespaceURI() +
+ ") did not have the MOBY namespace " +
+ MobyPrefixResolver.MOBY_XML_NAMESPACE);
+ }
+ else{
+ System.err.println("Invalid namespace used for content element (was " +
+ objectTag.getNamespaceURI() +
+ ", but should be " + MobyPrefixResolver.MOBY_XML_NAMESPACE +
+ ", proceeding anyway");
+ }
}
members = new HashMap();
@@ -100,11 +108,12 @@
NodeList mobyData = MobyPrefixResolver.getChildElements(objectTag,
MobyTags.MOBYDATA);
- if(mobyData.getLength() == 0){
- throw new MobyException("The document's " + MobyTags.MOBYCONTENT +
- " element does not have a " + MobyTags.MOBYDATA +
- " child. It must have one or more according to the MOBY API");
- }
+ // The case below is no longer true: an empty content block is a "ping" request as per mailing list 2006-08
+// if(mobyData.getLength() == 0){
+// throw new MobyException("The document's " + MobyTags.MOBYCONTENT +
+// " element does not have a " + MobyTags.MOBYDATA +
+// " child. It must have one or more according to the MOBY API");
+// }
// Now back to the main data
for(int i = 0; i < mobyData.getLength(); i++){
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataUtils.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataUtils.java 2006/07/07 04:12:40 1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataUtils.java 2006/10/26 00:32:20 1.4
@@ -57,14 +57,25 @@
doc_root.getLocalName() +
") was not " + MobyTags.MOBY);
}
+ NodeList envelope = null;
if(!MobyPrefixResolver.MOBY_XML_NAMESPACE.equals(doc_root.getNamespaceURI())){
- throw new MobyException("The XML document's root element namespace (" +
- doc_root.getNamespaceURI() +
- ") is not the MOBY namespace " +
- MobyPrefixResolver.MOBY_XML_NAMESPACE);
+ if(!MobyPrefixResolver.MOBY_XML_NAMESPACE_INVALID.equals(doc_root.getNamespaceURI())){
+ throw new MobyException("The XML document's root element namespace (" +
+ doc_root.getNamespaceURI() +
+ ") is not the MOBY namespace " +
+ MobyPrefixResolver.MOBY_XML_NAMESPACE);
+ }
+ System.err.println("Invalid namespace used for root element (was " + doc_root.getNamespaceURI() +
+ ", but should be " + MobyPrefixResolver.MOBY_XML_NAMESPACE +
+ ", proceeding anyway");
+ envelope = doc_root.getElementsByTagNameNS(MobyPrefixResolver.MOBY_XML_NAMESPACE_INVALID,
+ MobyTags.MOBYCONTENT);
+ }
+ else{
+ envelope = doc_root.getElementsByTagNameNS(MobyPrefixResolver.MOBY_XML_NAMESPACE,
+ MobyTags.MOBYCONTENT);
}
- NodeList envelope = doc_root.getElementsByTagNameNS(MobyPrefixResolver.MOBY_XML_NAMESPACE,
- MobyTags.MOBYCONTENT);
+
if(envelope.getLength() == 0){
throw new MobyException("The document's " + MobyTags.MOBY +
" element does not contain a " +
More information about the MOBY-guts
mailing list