willemdj / erlsom

XML parser for Erlang
GNU Lesser General Public License v3.0
264 stars 103 forks source link

Build multi xsd file with perfix #62

Closed laipham closed 7 years ago

laipham commented 7 years ago

Dear you, I try to build a hrl file with many xsd files. I include xsd files in only one xsd file and run function "write_xsd_hrl_file/3" but i cannot not custom prefix for each xsd. For example In my main xsd i put:

How can i edit this xsd with prefix "cp". ( When i build , it's become the prefix "P".

willemdj commented 7 years ago

Hi,

Did you try the 'include_files' option?

From the reference documentation:

"if the 'includes_files' option is present, the list provided with this option will be searched for a matching namespace. If this is found, the specified prefix will be used. If a file is also specified, then this file will be used. If no file is specified (value is undefined), then the 'location' attribute and the 'include_dirs' option will be used to locate the file."

laipham commented 7 years ago

Hi, Thanks your reply, "include_files" option is a option of xsd format or erlsom. If erlsom, i cannot find any info in folder "doc". If xsd format, may be it is the tap ?

willemdj commented 7 years ago

It is an erlsom option. Please see https://github.com/willemdj/erlsom/blob/master/doc/reference.md#compile_xsd_2. These options can also be passed to "write_xsd_hrl_file/3", see https://github.com/willemdj/erlsom/blob/master/doc/reference.md#write_xsd_hrl_file

laipham commented 7 years ago

Could you give me a example syntax how to use "include_files" with prefix in "compile_xsd" plz ?

laipham commented 7 years ago

Ex: I have file A.xsd with prefix is"ss", file B.xsd with prefix "cp". I include A.xsd and B.xsd in C.xsd. But when i write hrl from C.xsd, i only got prefix "P".

laipham commented 7 years ago

Hi, thanks for you source code and your document, i edit a little code in the source code and done, thank you so much.