web stats
new XML() - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-11-2019, 05:39 PM
Shamil Shamil is offline
OBX.3 Kenobi
 
Join Date: May 2013
Posts: 158
Shamil is on a distinguished road
Default new XML()

I was exploring a bit and start wondering where new XML() class is defined.

As far as I can tell org.mozilla.javascript.xmlimpl.XML is not public in Rhino 1.7.11 and older versions. So how does Mirth call it?
Reply With Quote
  #2  
Old 11-11-2019, 08:50 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,036
agermano is on a distinguished road
Default

You are calling new on the javascript XML class, not the java class directly. It looks like it (indirectly) ends up invoking org.mozilla.javascript.xmlimpl.XML.jsConstructor.

The XML object itself is an instance of XMLCtor (which extends IdFunctionObject)
Code:
js> java.lang.Thread.currentThread().getContextClassLoader().loadClass('java.lang.Object').getMethod('getClass').invoke(XML)
class org.mozilla.javascript.xmlimpl.XMLCtor
Here's a stack trace from where I purposely gave it bad input.
Code:
js> try {new XML('<<')} catch(e) {print(e.rhinoException.getStackTrace().join('\n'))}
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:4198)
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:4188)
org.mozilla.javascript.xmlimpl.XmlProcessor$RhinoSAXErrorHandler.throwError(XmlProcessor.java:56)
org.mozilla.javascript.xmlimpl.XmlProcessor$RhinoSAXErrorHandler.fatalError(XmlProcessor.java:65)
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:180)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.startOfMarkup(XMLDocumentFragmentScannerImpl.java:2635)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
org.mozilla.javascript.xmlimpl.XmlProcessor.toXml(XmlProcessor.java:225)
org.mozilla.javascript.xmlimpl.XmlNode.createElement(XmlNode.java:87)
org.mozilla.javascript.xmlimpl.XMLLibImpl.parse(XMLLibImpl.java:429)
org.mozilla.javascript.xmlimpl.XMLLibImpl.ecmaToXml(XMLLibImpl.java:465)
org.mozilla.javascript.xmlimpl.XMLObjectImpl.ecmaToXml(XMLObjectImpl.java:822)
org.mozilla.javascript.xmlimpl.XML.jsConstructor(XML.java:186)
org.mozilla.javascript.xmlimpl.XMLObjectImpl.execIdCall(XMLObjectImpl.java:610)
org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:101)
org.mozilla.javascript.BaseFunction.construct(BaseFunction.java:364)
org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2655)
Reply With Quote
  #3  
Old 11-12-2019, 08:08 AM
Shamil Shamil is offline
OBX.3 Kenobi
 
Join Date: May 2013
Posts: 158
Shamil is on a distinguished road
Default

Quote:
Originally Posted by agermano View Post
You are calling new on the javascript XML class, not the java class directly
That's what I expected but cannot find the place where this is happening.
Reply With Quote
  #4  
Old 11-12-2019, 09:51 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,036
agermano is on a distinguished road
Default

Quote:
Originally Posted by Shamil View Post
That's what I expected but cannot find the place where this is happening.
Check the rest of my post.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:27 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation