I would like to convert yang to xml format.
Please let me know if any tools are available already.
I tried with pyang yin format, which provides xml format but not in desired format.
Generated xml:
Ex:
<container name="password">
<leaf name="enc-type">
<type name="enumeration">
<enum name="clear">
Requied format:
<container>
<enc-type>
</en-type>
</container>
here you have a project on github to convert yang model to xml
https://github.com/vhosakot/yang_to_xml
you can also convert xml to yang model.
YIN format is the standard XML representation of YANG models defined in the same RFC as the YANG itself. You should probably use it instead of any in-house XML format.
What you want to achieve is a strange mixture of YIN (with the container element) and instance document (enc-type element which corresponds to the leaf name). I doubt that your definition is complete enough to be sure what you really mean and I also doubt that there are any existing tools that you can use out of the box.
I'd recommend to stick to YIN or, if absolutely necessary, create own tool for this.
you can use pyang for the same.
[https://github.com/mbj4668/pyang][1]
pyang you can use, I also have this requirement, and I use the pyang is enough.
pyang -f sample-xml-skeleton --sample-xml-skeleton-defaults -o output.xml input.yang
and the pyang format help:
$ pyang -h
Usage: pyang [options] [<filename>...]
-f FORMAT, --format=FORMAT
Convert to FORMAT. Supported formats are: yang, yin,
dsdl, capability, depend, jsonxsl, jstree, jtox, name,
omni, sample-xml-skeleton, tree, uml
Sample-xml-skeleton output specific options:
--sample-xml-skeleton-doctype=DOCTYPE
Type of sample XML document (data or config).
--sample-xml-skeleton-defaults
Insert leafs with defaults values.
--sample-xml-skeleton-annotations
Add annotations as XML comments.
--sample-xml-skeleton-path=SAMPLE_PATH
Subtree to print
Related
Based on the Github page of UAModelCompiler, the docker container used for UA Model Compiler requires two inputs.
xml file
csv file
Although the XML file can easily be generated using UaModeler, I am not sure how to generate the CSV file for the same XML.
Any hints would be appreciated!
Use the 'Export NodeIds' function next to the 'Export XML' in UaModeler.
I am trying to write a new value for a XMP tag using exiftool but for some reason the tag is not being recognized.
Reading the field works:
exiftool -PropertyId /Users/user/test.jpg
Property Id : 17934
But when trying to write a value for PropertyId tag, does not work.I did try also to use -xmp:PropertyId but I get the same result:
exiftool -PropertyId=12345 /Users/user/test.jpg
Warning: Tag 'PropertyId' is not defined
Nothing to do.
Exporting the metadata shows that the field is there: (I only copied the xmp section)
exiftool -xmp -b -a /Users/user/test.jpg > data.xmp
...
<rdf:Description rdf:about=''
xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
<xmp:Brand>Brand Name</xmp:Brand>
<xmp:CreateDate>2015-07-08T11:45:21</xmp:CreateDate>
<xmp:CreatorTool>CreatorTool</xmp:CreatorTool>
<xmp:FacilityName>The Restaurant Name</xmp:FacilityName>
<xmp:MetadataDate>2015-09-14T13:12:51-06:00</xmp:MetadataDate>
<xmp:ModifyDate>2015-09-14T13:12:51-06:00</xmp:ModifyDate>
<xmp:PropertyId>00000</xmp:PropertyId>
<xmp:PropertyName>Property Name</xmp:PropertyName>
<xmp:ShootDate>2016-03-12</xmp:ShootDate>
</rdf:Description>...
I am missing something? Test file is here: test.jpg
Exiftool cannot edit metadata it does not have a definition for, as it is in this case. In fact, your example XMP shows a lot of tags which it says are part of the "xap" group but are not actually part of that (very old) standard, including Brand, FacilityName, PropertyName, and ShootDate. You'll find that none of those are directly editable by exiftool. Probably not by any other program except the one that originally wrote it.
If you want exiftool to be able to write those tags, you'll need to create definitions for those tags. See the ExifTool Example Config file for details.
Also take note, as I said, "xap" is a very old standard and has long since been replaced. Exiftool will update the tags it does know to the newer standards. For details see the XMP xmp tags entry.
I would like to convert a dataset into Project Open Data data.xml format so that I can ingest in via the DKAN harvester. I know there is data.json format but prefer to use data.xml as the data is already XML and I am comfortable transforming it.
I can't seem to find where the data.xml schema/format is defined and would be grateful for pointers.
The data.json file is created by implementing the Open Data Schema Map module in DKAN.
You have a couple of options:
Create a new endpoint at "/admin/config/services/odsm/add/api" and use XML as the output format and "Project Open Data v1.1" as the schema:
You can do the same thing in code using hook hook_open_data_schema_apis_defaults() that Open Data Schema Map DKAN uses. Copy the declaration for "data_json" in your own module and change the endpoint to "'endpoint' => 'data.xml'," and the format to xml.
You could use hook_open_data_schema_map_results_alter to alter the schema to use "data.xml" and format to XML in a custom module.
*.pbf("Protocolbuffer Binary Format") is primarily intended as an alternative to the XML format.
There are two formats of *.osm.pbf and *.vector.pbf. What tools can I use to open these files? (I know JOSM can open *.osm.pbf files, but it can't open *.vector.pbf files.)
If I want to write own *.vector.pbf files in Mapbox, how do I work for that?
Thanks!
Regarding question #2, extracting PBF data
Using GDAL's ogr2ogr is the easiest method (I found).
Given a file named 1583.vector.pbf decode it to a, for example, shapefile (folder) named output:
# cmd show prog. output format output name input name
ogr2ogr -progress -f "ESRI Shapefile" output 1583.vector.pbf
Regarding question #3, creating PBF data
Use the same command as above but swap the input/outputs and output format:
# example source: https://gdal.org/drivers/vector/mvt.html
ogr2ogr -f MVT mytileset source.gpkg -dsco MAXZOOM=10
The Vector tiles used by Mapbox are serialized as Protocol Buffers.
Protocol Buffers allow you to efficiently compress the vector data inside the tile.
The Mapbox Tile Specification is available on github.
Esri has also adopted the same specification for their products.
You can find a list of parsers, renderers & CLI utilities here: https://github.com/mapbox/awesome-vector-tiles
In the common scenario, you can use mapbox-gl-js to render the vector tiles on the client. To generate vector tiles, you can use Mapbox Studio. This will require uploading your data online in the Studio. You can also use Mapbox Studio Classic (the older version) to generate the tiles locally.
Internally, Mapbox Studio uses the tilelive API, so you can programatically generate the tiles. In the list above there are other good alternatives as well.
I am using the Cobol XML Parser to parse an xml document that originated from the HFS (USS) file system through batch JCL.
My problem is that the XML Parser is returning "XML DOCUMENT ERROR 0000000317" which seems to be an encoding issue.
Does anyone know how to get past this?
Thanks
You will need to ensure that the encoding tag on the XML declaration is valid and agrees with what the actual document is. You will also need to make sure that the LPAR you are running on has the proper code page conversions defined in Unicode Conversion Services for z/OS.