I'm getting the error:
"org.xml.sax.SAXParseException: org.xml.sax.SAXParseException: Content is not all
owed in prolog."
Have tried all the suggestions posted in:
[http://forum.java.sun.com/thread.jspa?threadID=567285&start=15&tstart=0]
My xml is
<?xml version="1.0" encoding="UTF-8"?>
<Resources>
<ResourcePrefix>LoadData</ResourcePrefix>
<Node name="Node01"/>
<AppServer>server1</AppServer>
<SIB_ENDPOINT_ADDRESS>7284</SIB_ENDPOINT_ADDRESS>
<DatasourceJNDIname>dbXA</DatasourceJNDIname>
<Database>myDB2db</Database>
<DatabaseServer>myServer</DatabaseServer>
<JAAS-J2C-AuthenticationAlias>myUserName</JAAS-J2C-AuthenticationAlias>
</Resources>
I'm trying to read it using the following Jython script:
from java.io import StringReader
import org.xml.sax as sax
import org.apache.xerces.parsers.DOMParser as domparser
parser = domparser()
document = 'createResources.xml'
parser.reset()
documentIS = sax.InputSource(StringReader(document))
parser.parse(documentIS)
domtree = parser.getDocument()
results = domtree.getElementsByTagName('Node')
for ix in range(results.getLength()):
print "getCreateResourcesConfiguration.py: Link found: uri=%s" % results.item(ix).getAttribute('name'')
Can you suggest an approach to solve this issue?
Best regards,
Mike
The full error log is:
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java
)
at org.python.core.PyMethod.__call__(PyMethod.java)
at org.python.core.PyObject.__call__(PyObject.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at org.python.pycode._pyx5.f$0(getCreateResourcesConfiguration.py:28)
at org.python.pycode._pyx5.call_function(getCreateResourcesConfiguration
.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at org.python.core.__builtin__.execfile_flags(__builtin__.java)
at org.python.core.__builtin__.execfile(__builtin__.java)
at org.python.core.__builtin__.execfile(__builtin__.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java
)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java
)
at org.python.core.PyObject.__call__(PyObject.java)
at org.python.pycode._pyx4.f$0(<string>:26)
at org.python.pycode._pyx4.call_function(<string>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at org.python.core.Py.exec(Py.java)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java)
at com.ibm.bsf.engines.jython.JythonEngine$BSFPythonInterpreter.exec(Unk
nown Source)
at com.ibm.bsf.engines.jython.JythonEngine.exec(Unknown Source)
at com.ibm.bsf.BSFManager$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(AccessController.java:246
)
at com.ibm.bsf.BSFManager.exec(Unknown Source)
at com.ibm.ws.scripting.AbstractShell.executeScript(AbstractShell.java:9
91)
at com.ibm.ws.scripting.AbstractShell.run(AbstractShell.java:1957)
at com.ibm.ws.scripting.WasxShell.main(WasxShell.java:1022)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:183)
at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:90)
at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:72)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformAct
ivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runAppli
cation(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Ec
lipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja
va:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja
va:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.jav
a:336)
at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:91)
org.xml.sax.SAXParseException: org.xml.sax.SAXParseException: Content is not all
owed in prolog.