How to disable validation against DTD while unmarshalling

Hi All
I am relatively new to XML and JAXB. I have a tool that needs to run offline, however the XML documents that are being read in are automatically being validated against the DTD even though I have specified unmarshaller.setValidating(false). How can I completely diable validation while offline? Here is my code:
context = JAXBContext.newInstance("my.xmlobjects.package");
Unmarshaller u = context.createUnmarshaller();
u.setValidating(false);
testLog = (TestLog) u.unmarshal(new File("/path/to/my/file.xml"));
I've also tried a suggestion I saw on another forum (note that I know nothing about SAX, I've been trying to make sense of the documentation):
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
parserFactory.setValidating(false);
SAXParser saxParser = parserFactory.newSAXParser();
XMLReader xmlReader = saxParser.getXMLReader();
EntityResolver entityResolver = new EntityResolver()
public InputSource resolveEntity (String publicId, String systemId)
return null;
xmlReader.setEntityResolver(entityResolver);
InputSource source = new InputSource(new FileInputStream("/path/to/my/file.xml");
SAXSource saxSource = new SAXSource(xmlReader, source);
context = JAXBContext.newInstance("my.xmlobjects.package");
Unmarshaller u = context.createUnmarshaller();
u.setValidating(false);
testLog = (TestLog) u.unmarshal(saxSource);
Both of these work when connected, but fail when disconnected from the internet. Is there an Oracle specific property that needs to be set here?
Thanks
Jeff

Well you can create non validating parser programatically .
http://edocs.bea.com/wls/docs100/xml/programming.html#wp1069856
i.e.
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setValidating(false);
Hope this helps.

Similar Messages

  • How to disable after mis call while showing reply by message in apple 4s

    how to disable after mis call while showing reply by message in apple 4s

    Please rephrase the question. This doesn't make much sense.

  • How to disable XML´s DTD validation in Weblogic10?

    Hello folks, we are trying to upgrade our server to Weblogic10, but it´s XML parser is validating XML´s DTD and ´cause we are behind a firewall we receive a error like:
    Tried all: ´6´ address, but could not connect over HTTP to server: 'www.w3.org', port: '80'
    Does anyone here known how to disable DTD validation in WL10?
    Regards,
    lottalava

    Well you can create non validating parser programatically .
    http://edocs.bea.com/wls/docs100/xml/programming.html#wp1069856
    i.e.
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setValidating(false);
    Hope this helps.

  • XML validation against DTD.. Is it possible?

    Hello all,
    Sorry for what may be a trivial post, but I'll keep it short..
    According to the docs:
    "The Validate XML command will validate the XML against the schema defined in the XML file. This command on the context menu is disabled whenever an XML file does not have an XML namespace defined."
    I'm used to the XML editor retrieving a DTD from somewhere and validating it against that.. is it possible to do this in JDev?

    Unfortunately it's not. We only have support for validating against XML Schemas.
    Rob

  • How to disable CD-DRIVE checking, while using a Dolphin file manager

    Hello.
    I  would like ask for a help. I have one problem that's quite annoying. It is related to checking cd-drive when using a dolphin file menager. It always cheecks it when Dolphin is launched from K or launcher on taskbar for the first time, again it happens when i close it and open again.
    Is there a way to disable checking of cd-drive in Dolphin? This behaviour occurs on KDE with all linux system that i checked: Slackware, Arch, Kubuntu. Look at this:
    Disabling CD-DRIVE checking, while using a file manager
    I would like to disable it in order to speed up opening Dolphin, launching it.

    Udisks2 is what dolphin uses to handle external drives of all kinds (USB, optical, etc).  Udisks is an automounting tool that allows normal users to mount disks.  The permission handling before was handled with consolekit and has now been replaced by systemd-logind (which is much better anyway).  So what I am suggesting is that it might be that dolphin is using udisks2 as the tool that polls for the existence of a disc in your optical drive.
    Unfortunately, it is a bit more confusing than that because udisks2 is the replacement for the original udisks.  It is totally different and not compatible.  So I remember seeing a way to turn off optical drive polling, but I cannot remember if it was udisks or udisks2.  But it was done with a udev rule. 
    So I think if you tried to google for "udisks optical (or cd or dvd) polling" or something like that, you might be able to figure out how this is done.
    Edit: unfortunately, I do not use dolphin or udisks2.  But I do have the original udisks installed.
    Edit2: It seems that the method I remembered is for the original udisks.
    Last edited by WonderWoofy (2013-07-25 17:51:56)

  • Validating against dtd

    Hi,
    I am trying to parse an xml against a dtd, using SAX parser. The validation is proper..but i want to parse the entire file even if there is a mismatch in the middle of the xml document.
    say if there is an error at one particular element, the parser throws an exception and quits..but i want the parser to continue with the rest of the document..
    how can i achieve this functionality..
    thanks & regards

    Hi,
    I had put the try catch block, the exception was getting caught and the program was exiting...later i used the ErrorHandler class to handle the exceptions..
    and it is working fine if there is a saxparseexception..
    But if there is some fatal error in the xml file, the parser throws the exception and quits. Is there any way to catch the fatal error and still proceed with the parsing.
    Thanks & regards

  • Node Insertion - ensure validity against DTD

    I want to create a new XML document, insert elements one by one. How do I ensure that the element is insertable according to DTD specified (i.e. it is valid to insert the new element to the XML document)?
    Thank you

    You can use class com.ibm.xml.parser.DTD to load your DTD and use the getAppendableElements method. Then you can check if an element is in the appendable elements,...

  • How to disable a main vi while a sub-vi is running?

    I have a vi that calls up two sub-vi's using menu buttons. It is done using a typical state machine setup. When the first sub-vi is running, the main vi is disabled until either the OK or Cancel buttons are selected on the sub-vi. When the second vi is running, the main vi remains sensitive to mouse clicks and jams up the system. How do I set the second vi so that the main vi is disabled until the second vi is closed?
    (Apparently the first vi is set up properly with dumb luck.)
    I noticed that the first vi has the dark box around the OK button which makes it work off of the enter key without having to use the mouse. The second vi does not. Does this have anything to do with the above problem? If no
    t, how is the OK button configured like the first vi?
    Property nodes does not seem to be the issue. Property nodes are only used for system initialization in this application.
    I am using LabView v6.0, full development.
    Thanks,
    --- Dave Johnson
    --- [email protected]
    --- Practical Technologies

    Hi,
    There is a solution with VI server. See attachement saved for LabVIEW 6.0.
    I hope it will be helpful.
    Attachments:
    call_subvis.zip ‏24 KB

  • Complains about " ?xml ....? " then validating against DTD

    We are using Oracle's XML-parser (xmlparserv2.zip) to validate XML-files with DTD-files.
    The problem we are getting is that it complains on the first row in the XML-file:
    It doesn't work when:
         <?xml encoding="ISO-3242"?>
    But it DOES (!??) work when we remove the "x":
         <?ml encoding="ISO-3242"?>
    Can anyone explain this to me? The error message was something about "xml is a reserved..."

    I think the problem is that <?xml encoding="..."> is not a valid as a XML declaration. It must include the attribute version="1.0" e.g. <?xml version="1.0" encoding....>. Otherwise it treats xml as a user defined name, and as the error indicates you cannot declare element names that have xml.
    Hope this helps.

  • XML validation against DTD

    Hi,
    I have an application that receives XML from an external source. The XML received does not have the XML version and the doc type declaration lines. I want to validate the XML against a DTD.
    One dirty way of doing this is to open the XML received and prepend the XML versions and doctype lines to it. And then parse the XML. But is it the right way to do it?
    What I would like to know is that does the XML parser provide any API which can tell it to validate an XML document against a certain DTD.

    Yes, there is an API to do this. You have to do something like this:
    DocumentBuilderFactory dbf          =DocumentBuilderFactory.newInstance();
    dbf.setValidating(true);
    DocumentBuilder db = dbf.newDocumentBuilder();
    XMLErrors eh = new XMLErrors(frame);
    db.setErrorHandler(eh);
    Document doc = db.parse(f);
    (where f is the XML file)
    In this example, the class XMLErrors is used as the ErrorHandler. XMLErrors extends the DefaultHandler class and provides the user with information about the various error levels. A call to the over-ridden "error" method notifies the user (using a Dialog box) that the document doesn't meet the DTD.
    Hope this helps.

  • How to disable SAVE AS option while opening PDF in browser in OAF

    Hi All,
    We have created a page with MessageTextInput fields. All the datas are captured and export into PDF format. We have done this through XML publisher. PDF will be generated when we click on Generate button. PDF is getting opened in the IE browser.
    The user should not save the PDF, so we need to disable the save as functionality of browser.
    Thanks and Regards,
    Myvizhi

    On your Print window (CTRL+P '''''or''''' ''Firefox button > Print'' '''''or''''' ''File > Print''):
    #be sure your correct printer is seclected
    #be sure "Print to file" is '''''not''''' checked
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check --> http://www.mozilla.org/en-US/plugincheck/
    *'''''Adobe Shockwave for Director Netscape plug-in''''': [https://support.mozilla.org/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.org/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.org/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *Next Generation Java Plug-in for Mozilla browsers: [https://support.mozilla.org/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • How to disable audio output in while in sleep mode? (annoying issue)

    I have a my workstation set up in my bedroom and when I am not using it I put it to sleep (or wait for it to go to sleep deu to inactivity).  The problem is that when its asleep the audio output is still active.  So when I get emails and such the speakers still emit the notification/alert sounds even though my computer is in sleep mode.  This is really annoying since I work with offshore teams and they send me email in the late night and early morning (when I am sleeping).  I can't seem to find a setting to change that. Any ideas? 
    My set up is as follows:
    17 macbook pro (early 2011)
    OSX 10.9.4
    Connected to a 27" thunderbolt display
    Thanks!

    Thanks KiltedTim.  I am starting to agree with you.  Do you know what I can log for in the logs that will give me an idea?
    Esquared - Thanks for the link. The only thing I see in the logs is when I woke up my computer this morning.  But all morning (before I woke my computer) I was hearing a bunch of alerts/notification. Here's a look at the log query I did.

  • How to disable parent window while popup window is coming

    Hi,
    I am working on Oracle Applications 11i.
    I am able to get the popup window using the Java script in the controller.
    Please see the below code for the reference.
    String pubOrderId = pageContext.getParameter("orderId");
    StringBuffer l_buffer = new StringBuffer();
    StringBuffer l_buffer1 = new StringBuffer();
    l_buffer.append("javascript:mywin = openWindow(top, '");
    l_buffer1.append("/jct/oracle/apps/xxpwc/entry/webui/AddAttachmentPG");
    l_buffer1.append("&retainAM=Y");
    l_buffer1.append("&pubOrderId="+pubOrderId);
    String url = "/OA_HTML/OA.jsp?page="+l_buffer1.toString();
    OAUrl popupUrl = new OAUrl(url, OAWebBeanConstants.ADD_BREAD_CRUMB_SAVE );
    String strUrl = popupUrl.createURL(pageContext);
    l_buffer.append(strUrl.toString());
    l_buffer.append("', 'lovWindow', {width:750, height:550},false,'dialog',null);");
    pageContext.putJavaScriptFunction("SomeName",l_buffer.toString());
    But here the problem is, even though popup window is there, i am able to do the actions on the parent page.
    So how to disable the parent page, while getting the popup window.
    Thanks in advance.
    Thanks
    Naga

    Hi,
    You can use javaScript for disabling parent window as well.
    Refer below link for the same:
    http://www.codeproject.com/Questions/393481/Parent-window-not-disabling-when-pop-up-appears-vi
    --Sushant                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to disable security warning while printing(Silent Print) from Javascript?

    We have a webapplication through which, we are creating a pdf document and trying to print it sliently ("Silent Print").
    Users who are having latest Adobe version, were getting javascript warning message. However, those with older versions able to "Silent Print", without any warning messages.
    How to disable this security warning while printing from Javascript?
    Warning message: "A script has requested to print an Acrobat file. This could print an entire document. Do you want to proceed printing?".
    Appreciate for your kind help.
    Thanks.

    It's a security warning so it can't be bypassed by anything within the file.

  • How to disable Touchpad

    So I've been playing some Battlefield 4 recently, and after 20 MinutesaI realised, somethingawas not right.If I touch the touchpad when gaming (While intense combat is happening), My gun glitches out and doesn't stop shooting until, no ammo.This is FREAKING annoying, so how do I do this???

    Hi there ,  Thank you for visiting the HP Support Forums and Welcome! This is a great site to get answers and ask questions.  I understand how the TouchPad causing glitches in Battlefield 4 can be annoying. Here is a document called HP Notebook PCs - Using and Troubleshooting the TouchPad or ClickPad (Windows 8). This document will show you how to disable your TouchPad temporarily while playing games.   Have a great day!

Maybe you are looking for