Project

Profile

Help

Exceptions Saxon HE with .NET

Added by Katharina Zeiringer over 8 years ago

I am using the saxon he api in a c# .NET project to validate XML documents with schematron. It works correct but there are two Exceptions thrown in background, one of them about 10 times. This is the reason I think, why the validation precess is very very slow.

First Exception: org.apache.xerced.util.URI.MalformedURIException' occurred in saxon9he.dll Additional Information: Path contains invalid character

sample path: C:\Test\661-06_11_2015.xml --> perhaps hyphen not allowed?

The second Exception is more important. It occurs about ten times in a row: Exceptiontype: 'org.apache.xerces.impl.XMLEntityScanner$1' ocurred in saxon9he.dll

What could be the reason for this Error?


Replies (10)

Please register to reply

RE: Exceptions Saxon HE with .NET - Added by Michael Kay over 8 years ago

In the first case, you are using a Windows filename somewhere that expects a URI. The correct form is file:///C:/Test/661-06_11_2015.xml.

Some software is very liberal in allowing filenames to be used instead of URIs, but you've obviously found some API that's applying a strict interpretation of the rules. The difficulty usually comes when the software has to decide whether the URI is relative or absolute, and it's hard to do that correctly if the URI doesn't follow the approved syntax.

The second one is tricky. Are there really no other diagnostics?

Last time it came up, in 2012, we didn't get very far:

https://sourceforge.net/p/saxon/mailman/message/28996720/

Googling around for this class name (which is part of the Xerces XML parser that we distribute with Saxon on .NET), it seems to be invariably associated with pretty low-level system problems of one kind or another.

It would be good if you can produce a repro allowing us to reproduce and investigate the problem.

RE: Exceptions Saxon HE with .NET - Added by Katharina Zeiringer over 8 years ago

yes sure I am uploading my testproject. It would be great to have this problem solved. It is really exactly the same problem, that is dicussed in your link.

RE: Exceptions Saxon HE with .NET - Added by O'Neil Delpratt over 8 years ago

Thanks for sending your test project. What version of visual studio are you using?

RE: Exceptions Saxon HE with .NET - Added by Katharina Zeiringer over 8 years ago

I am using VS Professional 2013

RE: Exceptions Saxon HE with .NET - Added by O'Neil Delpratt over 8 years ago

Ok great thanks for the info. I have tried running your project on both VS 2010 and VS 2012 but it fails. Let me try VS 2013 express.

RE: Exceptions Saxon HE with .NET - Added by O'Neil Delpratt over 8 years ago

Hi Katharina,

I have finally managed to get your project running but your form is asking for the following paths 'C:\CASMed\CDALetters' but I cannot find this directory. Is something missing from the project you sent?

RE: Exceptions Saxon HE with .NET - Added by Katharina Zeiringer over 8 years ago

Oh sorry. This is just the path where the XML documents, that are going to be validated should be saved. Just choose another folder after clicking button 'einstellungen' and put the file into it. Choose 'Ordner validieren' instead of 'auf Befund warten' and the Program will validate the file in the folder. I hope it works for you.

RE: Exceptions Saxon HE with .NET - Added by O'Neil Delpratt over 8 years ago

Hi Katharina,

Thanks for your recent post. But I am still having trouble reproducing the exception you reported. See exception that I am getting:

System.Security.SecurityException was unhandled
  HResult=-2146233078
  Message=The source was not found, but some or all event logs could not be searched.  To create the source, you need permission to read all event logs to make sure that the new source name is unique.  Inaccessible logs: Security.
  Source=System
  StackTrace:
       at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly, Boolean wantToCreate)
       at System.Diagnostics.EventLog.SourceExists(String source, String machineName, Boolean wantToCreate)
       at System.Diagnostics.EventLogInternal.VerifyAndCreateSource(String sourceName, String currentMachineName)
       at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
       at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type)
       at CDAValidator.Logging.eventLog(String message, EventLogEntryType type) in C:\Users\win1\Downloads\CDAValidator\CDAValidator\Logging.cs:line 25
       at CDAValidator.Logging.eventLog(Exception ex) in C:\Users\win1\Downloads\CDAValidator\CDAValidator\Logging.cs:line 32
       at CDAValidator.SchematronTransWindow.logErrors(Exception ex) in C:\Users\win1\Downloads\CDAValidator\CDAValidator\SchematronTransWindow.xaml.cs:line 103
       at CDAValidator.SchematronTransWindow.btnStartTrans_Click(Object sender, RoutedEventArgs e) in C:\Users\win1\Downloads\CDAValidator\CDAValidator\SchematronTransWindow.xaml.cs:line 94
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
       at System.Windows.Controls.Primitives.ButtonBase.OnClick()
       at System.Windows.Controls.Button.OnClick()
       at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at CDAValidator.App.Main() in C:\Users\win1\Downloads\CDAValidator\CDAValidator\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

RE: Exceptions Saxon HE with .NET - Added by Katharina Zeiringer over 8 years ago

Thre could be a problem with Logging class. Try to change the path of the log in ConfigSettings. If it doesnt help, delete the whole class Logging. There are only a few lines in code that have to be removed too afterwards.

Besides I just found out, that the exception is not thrown, when the project is run with vs15 on a windows 7 computer only with vs13 and windows 8 I think.

RE: Exceptions Saxon HE with .NET - Added by O'Neil Delpratt over 8 years ago

With vs15 on Windows 7 I get the following output:

Der Befund ---C:\CASMed\CDALetters\ELGA-Befund_bildgebende_Diagnostik_EIS-FullSupport.xml ---
ist nach dem Schema valide

ist nach dem Schematron nicht valide, weil:
(CDABildiag): Element hl7:custodian ist mandatory [min 1x].
(BefundBildgebendeDiagnostik): Element hl7:custodian ist mandatory [min 1x].

As mentioned in your last post I also confirm that the exception is not thrown. I might have to build a windows 8 virtual machine with vs13 installed to see if error is specific vs13 on Windows 8

    (1-10/10)

    Please register to reply