Comments (12)
İf you write absolute path to "dsm-config-file.yaml" it will work. Problem is not related to DSM. Java can't find the file. if the file is in your class path you should use getResourceasStrram function.
Please check #11 issue. You can find example usage getResourceasStrram. İf problem isn't solved please let me know.
from dsm.
Thanks for quick response .....
i wrote absolute path to builder. builder object is created
when i am trying to create dsm object i am getting the error
here is my code..
DSMBuilder builder = new DSMBuilder(new File("C:\\Users\\SivireddyUppathi\\Downloads\\split_1580192862146\\dsmYML.yml"));
DSM dsm = builder.setType(DSMBuilder.TYPE.XML).create();
Pet pet = (Pet) dsm.toObject(new File("C:\\Users\\SivireddyUppathi\\Downloads\\split_1580192862146\\dsmXML.xml"));
error in second line...
from dsm.
can you please write the error you get.
from dsm.
run:
Exception in thread "main" java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.(File.java:418)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.addRootPath(FileSystemResourceAccessor.java:54)
at com.github.mfatihercik.dsb.resource.AbstractResourceAccessor.init(AbstractResourceAccessor.java:39)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.init(FileSystemResourceAccessor.java:47)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.(FileSystemResourceAccessor.java:27)
at com.github.mfatihercik.dsb.configloader.AbstractConfigLoader.setResourceAccessor(AbstractConfigLoader.java:89)
at com.github.mfatihercik.dsb.configloader.AbstractConfigLoader.(AbstractConfigLoader.java:32)
at com.github.mfatihercik.dsb.configloader.YamlConfigLoaderStrategy.(YamlConfigLoaderStrategy.java:11)
at com.github.mfatihercik.dsb.DSMBuilder.create(DSMBuilder.java:99)
at com.ads.ammdatatypes.vo.DSMStAX.main(DSMStAX.java:38)
C:\Users\SivireddyUppathi\AppData\Local\NetBeans\Cache\11.0\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\SivireddyUppathi\AppData\Local\NetBeans\Cache\11.0\executor-snippets\run.xml:94: Java returned: 1
BUILD FAILED (total time: 1 second)
from dsm.
When you pass File object to DSM.toObject, DSM assume file is in classpath if you didn't specified rootPath.
I suggest you to pass InputStream to toObject method. You can create InputStream from File.
from dsm.
File ymlFile = new File("C:\\Users\\SivireddyUppathi\\Downloads\\split_1580192862146\\dsmYML.yml");
InputStream ymlStream = new FileInputStream(ymlFile);
DSMBuilder builder = new DSMBuilder(ymlStream);
DSM dsm = builder.setType(DSMBuilder.TYPE.XML).create();
File xmlFile = new File("C:\\Users\\SivireddyUppathi\\Downloads\\split_1580192862146\\dsmXML.xml");
InputStream xmlStream = new FileInputStream(xmlFile);
Pet pet = (Pet) dsm.toObject(xmlStream);
this is also not working for me....
for me the exception raised at below line not at toObject method...
DSM dsm = builder.setType(DSMBuilder.TYPE.XML).create();
from dsm.
Only change toObject method to use input Stream.
Can you share exception trace
from dsm.
Exception in thread "main" java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.(File.java:418)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.addRootPath(FileSystemResourceAccessor.java:54)
at com.github.mfatihercik.dsb.resource.AbstractResourceAccessor.init(AbstractResourceAccessor.java:39)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.init(FileSystemResourceAccessor.java:47)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.(FileSystemResourceAccessor.java:27)
at com.github.mfatihercik.dsb.configloader.AbstractConfigLoader.setResourceAccessor(AbstractConfigLoader.java:89)
at com.github.mfatihercik.dsb.configloader.AbstractConfigLoader.(AbstractConfigLoader.java:32)
at com.github.mfatihercik.dsb.configloader.YamlConfigLoaderStrategy.(YamlConfigLoaderStrategy.java:11)
at com.github.mfatihercik.dsb.DSMBuilder.create(DSMBuilder.java:99)
at com.ads.ammdatatypes.vo.DSMStAX.main(DSMStAX.java:38)
C:\Users\SivireddyUppathi\AppData\Local\NetBeans\Cache\11.0\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\SivireddyUppathi\AppData\Local\NetBeans\Cache\11.0\executor-snippets\run.xml:94: Java returned: 1
from dsm.
The problem is not related the code. which java version are you using?
from dsm.
#9 close this
from dsm.
Jdk 8
from dsm.
1.0.4 released. can you try new version.
from dsm.
Related Issues (19)
- java.lang.IllegalArgumentException: URI is not hierarchical HOT 2
- How to parse XML if format in below manner? HOT 7
- Working with DSM in my project HOT 3
- Handling arrays of arrays HOT 3
- It's a great project, HOT 1
- The conversion seems a little problematic when the root node is an array HOT 2
- Can field maps support wildcards
- Can we support object to string and string to object
- The conversion function is executed correctly only if path is set for the field. Is this necessary HOT 1
- Filtering HOT 1
- help to check XML node HOT 1
- One more duplicate data exists when converting json array HOT 2
- new count type
- setParams function not work as expected
- bigDecimal dataTYpe not working
- parsing element is not merged when path is null
- dynamic fieldName
- dynamic filter - clarification - Urgent HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dsm.