marvin-zhao / pyang

Automatically exported from code.google.com/p/pyang
0 stars 0 forks source link

PYang XSD generator fails for cross module grouping types that are unqualified #86

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Module A has a list wich has a uses "B:X"
2.Module B has a grouping called B which has a leaf whose type is a typedef
3.Run pyang -f xsd A.yang

What is the expected output? What do you see instead?
I should get the full XSD but I get....

Traceback (most recent call last):
  File "/home/eronbar/pyang-1.2/bin/pyang", line 261, in <module>
    run()
  File "/home/eronbar/pyang-1.2/bin/pyang", line 245, in run
    emit_obj.emit(ctx, modules, fd)
  File "/home/eronbar/pyang-1.2/pyang/translators/xsd.py", line 150, in emit
    emit_xsd(ctx, module, fd)
  File "/home/eronbar/pyang-1.2/pyang/translators/xsd.py", line 433, in emit_xsd
    print_augment(ctx, module, fd, '  ', c)
  File "/home/eronbar/pyang-1.2/pyang/translators/xsd.py", line 670, in print_augment
    indent + '    ', [])
  File "/home/eronbar/pyang-1.2/pyang/translators/xsd.py", line 577, in print_children
    uniqes, indent + extindent + '  ')
  File "/home/eronbar/pyang-1.2/pyang/translators/xsd.py", line 577, in print_children
    uniqes, indent + extindent + '  ')
  File "/home/eronbar/pyang-1.2/pyang/translators/xsd.py", line 497, in print_children
    atype = '  type="%s"' % xsd_type_name(ctx, type, c)
  File "/home/eronbar/pyang-1.2/pyang/translators/xsd.py", line 634, in xsd_type_name
    return type.i_typedef.i_xsd_name
AttributeError: 'Statement' object has no attribute 'i_xsd_name'

What version of the product are you using? On what operating system?
pyang v1.2 on linux

Please provide any additional information below.

To fix the issue I must put the namespace in front of the type ref in module B. 
Then all works. This is pretty hard to find so should be fixed if possible.

Original issue reported on code.google.com by ronan.ba...@gmail.com on 25 Apr 2013 at 12:11

GoogleCodeExporter commented 9 years ago
The XSD plugin is now deprecated, and it will not be further developed.

Original comment by mbj4...@gmail.com on 23 Oct 2013 at 1:53