This commit is contained in:
kbolaughlin 2023-03-16 09:14:11 -07:00
commit ecf364f999
4 changed files with 26 additions and 1 deletions

View File

@ -17,6 +17,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Users/dg50/source/repos/nilusxmlgenerator/target/nilus-3.0.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/TethysJavaClient"/>
<classpathentry combineaccessrules="false" kind="src" path="/nilusxmlgenerator"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -29,6 +29,7 @@ import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import com.sun.javafx.runtime.VersionInfo;
@ -48,6 +49,7 @@ import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import PamguardMVC.PamProcess;
import binaryFileStorage.BinaryStore;
import tethys.TethysControl;
/**
* Class for writing XML configuration output to a file.
@ -62,6 +64,7 @@ public class PamguardXMLWriter implements PamSettings {
private static final Set<Class<?>> WRAPPER_TYPES = getWrapperTypes();
private XMLWriterSettings writerSettings = new XMLWriterSettings();
// private String xmlNameSpace;
private static PamguardXMLWriter singleInstance;
@ -84,6 +87,19 @@ public class PamguardXMLWriter implements PamSettings {
return singleInstance;
}
/**
* Recursively walk the tree and add a namespace to every
* single element.
* @param doc
* @param nameSpace
* @return
*/
public boolean addNameSpaceToElements(Document doc, Element el, String nameSpace) {
// el.setAttributeNS(nameSpace, nameSpace, nameSpace);
NamedNodeMap attributes = el.getAttributes();
return true;
}
/**
* Make a document with the options specified in writerSettings.
* @param time timestamp for document
@ -967,5 +983,9 @@ public class PamguardXMLWriter implements PamSettings {
return true;
}
// public void setStaticNameSpace(String xmlNameSpace) {
// this.xmlNameSpace = xmlNameSpace;
// }
}

View File

@ -33,6 +33,7 @@ public class TethysControl extends PamControlledUnit {
public static final String unitType = "Tethys Interface";
public static String defaultName = "Tethys";
public static String xmlNameSpace = "http://tethys.sdsu.edu/schema/1.0";
private TethysExportParams tethysExportParams = new TethysExportParams();

View File

@ -27,6 +27,7 @@ import nilus.Deployment;
import nilus.DescriptionType;
import nilus.Detection;
import nilus.SpeciesIDType;
import tethys.TethysControl;
import tethys.TethysTimeFuncs;
import tethys.output.StreamExportParams;
import tethys.output.TethysExportParams;
@ -117,10 +118,12 @@ public class AutoTethysProvider implements TethysDataProvider {
if (settingsObjs == null) {
return null;
}
// pamXMLWriter.setStaticNameSpace(TethysControl.xmlNameSpace);
Element settingsEl = pamXMLWriter.writeUnitSettings(doc, dummyEl, pamSettings, settingsObjs);
if (settingsEl == null) {
return null;
}
pamXMLWriter.addNameSpaceToElements(doc, settingsEl, TethysControl.xmlNameSpace);
dummyEl.appendChild(settingsEl);
NodeList childs = settingsEl.getChildNodes();
for (int i = 0; i < childs.getLength(); i++) {