Announcement

Collapse
No announcement yet.

new XML()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

  • #2
    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)

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment

        Working...
        X