I am trying to use cmd to parse a NITF file to an XML using apache daffodil.
In cmd, I run .\daffodil.bat parse --schema nitf.dfdl.xsd 2301573_3.ntf
The nitf.dfdl.xsd, nitf_common_types.dfdl.xsd, nitf_extension_types.dfdl.xsd and the NITF are contained in the same folder as the daffodil.bat file. The NITF schemas can be found here
I get the error:
[error] Schema Definition Error: Error loading schema due to org.xml.sax.SAXParseException;
DaffodilXMLLoader: Unable to resolve
schemaLocation='com/tresys/nitf/xsd/nitf_common_types.dfdl.xsd'.
Schema context: file:/C:/Users/rinat/OneDrive/Desktop/WORK%20STUFF/apache-daffodil-3.4.0-
bin/apache-daffodil-3.4.0-bin/bin/nitf.dfdl.xsd Location in
file:/C:/Users/rinat/OneDrive/Desktop/WORK STUFF/apache-daffodil-3.4.0-bin/apache-daffodil-
3.4.0-bin/bin/nitf.dfdl.xsd
How do I resolve this?
The nitf schema imports files using the full path, so it expects the imported files to be in a com/tresys/nitf/xsd/... directory on the classpath. If you are copying the files out of those expected paths, then you'll need to modify the xs:import statements to also not use those paths. For example, these lines in nitf.dfdl.xsd:
<xs:import namespace="urn:nitfCommonTypes" schemaLocation="com/tresys/nitf/xsd/nitf_common_types.dfdl.xsd" />
<xs:import namespace="urn:nitfExtensionTypes" schemaLocation="com/tresys/nitf/xsd/nitf_extension_types.dfdl.xsd" />
Need to changed to the schemaLocation attribute to this:
<xs:import namespace="urn:nitfCommonTypes" schemaLocation="nitf_common_types.dfdl.xsd" />
<xs:import namespace="urn:nitfExtensionTypes" schemaLocation="nitf_extension_types.dfdl.xsd" />
The other DFDL schema files may need a similar change.
Related
When I run the Saxon command line to validate multiple DITA files:
a) using the -s option for a folder does not work.
b) using a wildcard for the files does, but is limited to a single topic type:
C:\Users\542470>java -cp C:\Tools\SaxonEE11-3J\saxon-ee-11.3.jar com.saxonica.Validate -catalog:C:\Tools\dita-schemas\catalog-dita.xml -xi:on -xsiloc:on -xsdversion:1.1 "C:\Tools\SaxonEE11-3J\garage\tasks\*"
Saxon license expires in 25 days
Warning at xs:import on line 42 column 73 of softwareDomain.xsd:
SXWN9018 The schema document at urn:oasis:names:tc:dita:xsd:xml.xsd:1.3 is not being read
because schema components for this namespace are already available
Warning at xs:import on line 42 column 73 of uiDomain.xsd:
SXWN9018 The schema document at urn:oasis:names:tc:dita:xsd:xml.xsd:1.3 is not being read
because schema components for this namespace are already available
Warning at xs:import on line 63 column 73 of commonElementMod.xsd:
SXWN9018 The schema document at urn:oasis:names:tc:dita:xsd:xml.xsd:1.3 is not being read
because schema components for this namespace are already available
Warning at xs:import on line 31 column 78 of topicMod.xsd:
SXWN9018 The schema document at urn:oasis:names:tc:dita:xsd:ditaarch.xsd:1.3 is not being
read because schema components for this namespace are already available. To force the
schema document to be read, set --multipleSchemaImports:on
Error on line 13 column 11 of garagetaskoverview.dita:
XQDY0084 One validation error was reported: Cannot validate <Q{}**concept**>: no element
declaration available
In this case, all the topics validated with no errors, but the topic was not recognized. I am using the DITA-OT/Oxygen garage DITA samples to test the command line. Validating a single DITA file causes no problems. This only occurs when mixing the DITA topic types in the same folder.
DITA topic types used:
<concept id="taskconcept" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:concept.xsd:1.3"
xml:lang="en-US">...
<task id="changeoil" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:task.xsd:1.3"
xml:lang="en-US">...
Note: Having thousands of files eliminates the option of listing the files to validate.
All the DITA XML Schemas are in no namespace, if Saxon has some kind of schema caching, once it loads the "urn:oasis:names:tc:dita:xsd:task.xsd:1.3" schema for the first validated task, it considers that for no namespace it already has a schema so it might re-use the schema for "task.xsd" to also validate the concept file.
I do not see a setting to avoid using this schema cache in the command line. Maybe you can try to iterate all files in the folder using a "for" loop in a Windows bat file and for each file run the validation process instead of running the validation on the entire folder.
You could also ask directly on the Saxonica users list for advice about this cache.
I'm not an expert on DITA, but I think that all the DITA schema modules are compatible with each other in the sense that you can combine any selection of modules into a single schema. For example, you could write a schema document that has xs:include's for any subset of DITA modules that you want to use. I would suggest using such a composite schema in the -xsd option to the Saxon validate command.
Alternatively, try using the option --multipleSchemaImports:on - this should cause Saxon to load a schema module for a particular namespace (or for the null namespace) even if it already has a schema module for that namespace loaded. (But note this can cause failures if two schema modules have overlapping definitions - I don't know if this applies to DITA.)
However, you're going to get more control over a task like this if you write a little Java application to invoke Saxon repeatedly, rather than trying to do everything in a single command from the command line.
I finally did a "for loop" in a batch file.
command-line:
batch-validate C:\XML-WORK\repair\DITA-xsd\topics > testlog.txt 2> testerrors.txt
batch file command:
for %%i in (*) do java com.saxonica.Validate -catalog:C:\Tools\dita-schemas\catalog-dita.xml -xi:on -xsiloc:on -xsdversion:1.1 %%i
Note: Set the classpath to Saxon and change Dir (CD) to the folder to be validated before running the batch file
It took over 3 hours to validate some 4,000 files. I was using a trial version of Saxon. If this is always the expected result, using a batch file is not feasible.
I have a CSV file I generate through code. I want to import the generated CSV file into neo4j using the following cypher query.
LOAD CSV WITH HEADERS FROM 'file:////Users/{user}/Desktop/neo4j-importer/tmp/temp_data.csv'
I have changed the following config varables
Commenting out dbms.directories.import=import.
And set dbms.security.allow_csv_import_from_file_urls=true
Problem is I get thrown the following error:
Neo.ClientError.Statement.ExternalResourceFailed:
Couldn't load the external resource at:
file:/Users/{user}/Library/Application%20Support/Neo4j%20Desktop/Application/neo4jDatabases/database-c517b267-220d-4b7a-be26-813d5b64a51a/installation-3.5.3/import/Users/{user}/Desktop/neo4j-importer/tmp/temp_data.csv
I mean it is partly right just not the /Users/{user}/Library/Application%20Support/Neo4j%20Desktop/Application/neo4jDatabases/database-c517b267-220d-4b7a-be26-813d5b64a51a/installation-3.5.3/import/ bit... Any suggestions on how to fix this weird file pathing problem?
Try changing the config setting to point to the directory with your imports:
dbms.directories.import=/Users/{user}/Desktop/neo4j-importer/tmp
and then changing the Cypher query to just specify the CSV file:
LOAD CSV WITH HEADERS FROM 'file:///temp_data.csv'
...
I'm trying to use SQLite with Entity Framework 6 in my WPF application. When I create Entity Data Model in the project, I connect to *.db file using absolute path, because relative path doesn't work for some reason. So my connection looks something like
<connectionStrings>
<add name="Model1ConnectionString" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SQLite.EF6;provider connection string='data source="C:\Users\gtmaster\Documents\Visual Studio 2017\Projects\SQLiteTest\SQLiteTest\test.db"'" providerName="System.Data.EntityClient" />
</connectionStrings>
If some other developer clones reporsitory with this connection he gets unable to open database file error, because absolute path to test.db in the project is obviously different on his machine.
How can I write relative path in app.config so entity models could work without changing it everytime?
using relative path for the DB file
the source of the db file is in App.config
<add name="ProjectDBEntities" connectionString="metadata=res://*/ProjectDBModel.csdl|res://*/ProjectDBModel.ssdl|res://*/ProjectDBModel.msl;provider=System.Data.SQLite.EF6;provider connection string='data source="c:\Users\Heckl\Documents\Dropbox\Else\visual studio\SqLiteTry\ProjectDB.db"'" providerName="System.Data.EntityClient"/>
the data source must be absoulte
you can use the |DataDirectory| substitution string in App.config
<add name="ProjectDBEntities" connectionString="metadata=res://*/ProjectDBModel.csdl|res://*/ProjectDBModel.ssdl|res://*/ProjectDBModel.msl;provider=System.Data.SQLite.EF6;provider connection string='data source="|DataDirectory|ProjectDB.db"'" providerName="System.Data.EntityClient"/>
the substitution string has to be set
string executable = System.Reflection.Assembly.GetExecutingAssembly().Location;
string path = (System.IO.Path.GetDirectoryName(executable));
AppDomain.CurrentDomain.SetData("DataDirectory", path);
// ...
var db = new ProjectDBEntities()
problems:
exception at the first LINQ command
the change in App.config is not always detected by VS, you might have to rebuild solution manually
the code above set the location of the exe file in the solution\project\bin\debug folder
the db file is in the solution folder
check the value of db.Database.Connection.ConnectionString in a watch window during debug
you can copy the db file into the debug folder also
|DataDirectory| is good for production environment, but when you do update-database migrations apply to newly created database in EF packet directory, because EF cant get your project generated connection string and use self DataDirectory value.
I'm trying to convert my Win32 app into a UWP app using Project Centennial converter (i.e. Desktop bridge.)
After the app is converted, I need to adjust AppxManifest.xml file to ensure the following:
That all icon formats are configured properly.
That I properly specified app resources for: English (US), German, French and Russian languages.
So I followed this Windows 10 icon guide and created the following .png images that were all placed into the Assets folder. I got these:
And my AppxManifest.xml was structured as such:
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10">
<Identity Name="MyApp.Name" ProcessorArchitecture="x86" Publisher="CN=My Name, O=My Name, STREET="Street Address", L=City, S=State, PostalCode=12345, C=US" Version="1.2.3.4" />
<Properties>
<DisplayName>MyApp.Name</DisplayName>
<PublisherDisplayName>PublisherName</PublisherDisplayName>
<Logo>Assets\StoreLogo-50x50.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us" />
<Resource Language="de-DE" />
<Resource Language="fr-FR" />
<Resource Language="ru-RU" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14342.0" MaxVersionTested="10.0.14342.0" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
<Applications>
<Application Id="MyApp.Name" Executable="VFS\Users\ContainerAdministrator\AppData\Local\PublisherName\App Name\RunFile.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements DisplayName="My App Name" Description="My app does this ... and this ..."
BackgroundColor="#aabbcc"
Square71x71Logo="Assets\AppNameSmallTile.png"
Square150x150Logo="Assets\AppNameMedTile.png"
Square310x150Logo="Assets\AppNameWideTile.png"
Square310x310Logo="Assets\AppNameLargeTile.png"
Square44x44Logo="Assets\AppNameAppList.png"
>
<uap:DefaultTile>
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" />
<uap:ShowOn Tile="Square310x150Logo" />
<uap:ShowOn Tile="Square310x310Logo" />
</uap:ShowNameOnTiles>
</uap:DefaultTile>
</uap:VisualElements>
<Extensions />
</Application>
</Applications>
</Package>
So can someone answer these questions:
I'm somewhat confused about specifying icons for correct sizes and scaling. Did I do it correctly?
Do I need to specify scaling for Assets\StoreLogo-50x50.png icon as well?
And lastly, did I specify resources for 4 different languages correctly?
EDIT: While waiting, I tried compiling my AppxManifest.xml above with the assets I showed. But makeappx.exe tool gives me the following error:
MakeAppx : error: Error info: error C00CE015: App manifest validation
error: The app manifest must be valid as per schema: Line 22, Column
27, Reason: The attribute 'Square71x71Logo' on the element
'{http://schemas.microsoft.com/appx/manifest/uap/windows10}VisualElements'
is not defined in the DTD/Schema.
It evidently doesn't like the following icon sizes:
Square71x71Logo
Square310x150Logo
Square310x310Logo
But then even if I remove the icon sizes above from AppxManifest.xml, when I try to pack it with the following command:
"C:\Program Files (x86)\Windows Kits\10\bin\x64\makeappx.exe" pack /d "path-to-folder-to-pack" /p "path-to\MyAppxPackage.appx"
I get the following errors about naming assets for scaling:
MakeAppx : error: Manifest validation error: Line 22, Column 27,
Reason: The file name "Assets\AppNameMedTile.png" declared for element
"[local-name()='Applications']/[local-name()='Application']/[local-name()='VisualElements']"
doesn't exist in the package. If this file has multiple variations or
resource versions for language, scale, contrast, etc., use the /l
command line option to disable this validation. MakeAppx : error:
Manifest validation error: Line 23, Column 27, Reason: The file name
"Assets\AppNameAppList.png" declared for element
"[local-name()='Applications']/[local-name()='Application']/[local-name()='VisualElements']"
doesn't exist in the package. If this file has multiple variations or
resource versions for language, scale, contrast, etc., use the /l
command line option to disable this validation. MakeAppx : error:
Package creation failed. MakeAppx : error: 0x80080204 - The specified
package format is not valid: The package manifest is not valid.
Using suggested /l command as such:
"C:\Program Files (x86)\Windows Kits\10\bin\x64\makeappx.exe" pack /l /d "path-to-folder-to-pack" /p "path-to\MyAppxPackage.appx"
builds the package with a lot of warnings. But when I install it later, all icons in it seem to be blank.
There must be something that I'm missing here?
I see two main problems: you're defining tile images in the wrong place, and you don't talk at all about a resources.pri file.
The UAP schema is fairly involved, but also reasonably well documented, so make sure you respect its requirements. In particular, the uap:VisualElements element only has the image attributes Square150x150Logo and Square44x44Logo. If you want to define other sizes, they go in attributes on a child uap:DefaultTile element. Note that your uap:ShowOn elements' attributes include an incorrect Square310x150Logo that should instead be wide310x150Logo.
Once you sort that out, makeappx should succeed with your original command line, i.e., without the additional /l parameter. However this is not enough to make your alternate DPI images show up. For that you will need to create a resources.pri file. You can do this manually by using makepri.exe to create a template priconfig.xml, update it, then invoke makepri again to build the resources.pri from it.
Alternately, use a tool that will create an app package with a resources.pri for you (such as Visual Studio), and extract the resources.pri and add it to your package. Just make sure the locations you use in your package match the ones in the package created by the tool, as relative paths are stored in the resources.pri file. (As a bonus, you can look at the AppxManifest.xml that this creates to verify that your structure from the first part is correct. Just don't forget that apps using the desktop bridge will have additional namespaces and capabilities that Visual Studio won't offer.)
I have an UIMA project that uses the ConceptMapper Annotator. I would like to know how to set up the following:
How to specify the TokenizerDescriptionPath?
I have used the macro $main_root/descriptors/conceptMapper/primitive/OffsetTokenizer.xml, but when I was trying to install the pear file, the installer throws exceptions complaining that the file $main_root/descriptors/conceptMapper/primitive/OffsetTokenizer.xml could not be found
How to set up the value for the DictionaryFileName (A file containing the dictionary)?
In the GUI window for setting up this resource, I've filled the URL value with $main_root/data/dict/concepts.xml (my dictionary file) but at the installation time, the installer throws exceptions complaing that
Verification of uima-pipelines failed:
org.apache.uima.resource.ResourceInitializationException: Initialization of annotator class "org.apache.uima.conceptMapper.ConceptMapper" failed.
Caused by: org.apache.uima.resource.ResourceAccessException: The Resource /ConceptDetector/ConceptMapper/DictionaryFile requires parameters, none were specified.
at org.apache.uima.resource.impl.ResourceManager_impl.getResource(ResourceManager_impl.java:221)
at org.apache.uima.impl.UimaContext_ImplBase.getResourceObject(UimaContext_ImplBase.java:295)
at org.apache.uima.analysis_engine.impl.AnnotatorContext_impl.getResourceObject(AnnotatorContext_impl.java:175)
... 33 more
I had similar problems with the Concept Mapper. The way I solved the TokenizerDescriptorPath problem was to first create a PEAR file with the OffsetTokenizer as its main descriptor and the dependent classes. Then you can install this pear file locally and then set TokenizerDescriptorPath to: C:\path\to\your\pear\file\OffsetTokenizer_pear.xml. Otherwise there appears to be a CLASSPATH inheritance problem. The CLASSPATH does not seem to be passed from the ConceptMapper to the OffsetTokenizer once it is in the PEAR file. I found some great information on the GMANE listserver. user.uima.apache.org ConceptMapper Pear File Thread
I have set DictionaryFileName to file:dict/testDict.xml and this seems to work. To avoid getting a problem at save time you can add resources as a source folder.
When exporting the ConceptMapper to a PEAR file, I have both the resources and bin folder in the CLASSPATH. I have since expanded the Concept Mapper to have other annotators and it is working in a pipeline. It is all exportable to PEAR files which pass the verification step. It also works before export, locally in Eclipse.
Good Luck