source: extensions/gsdl-video/trunk/installed/cmdline/lib/ruby/1.8/wsdl/xmlSchema/simpleContent.rb@ 18425

Last change on this file since 18425 was 18425, checked in by davidb, 15 years ago

Video extension to Greenstone

File size: 1.1 KB
Line 
1# WSDL4R - XMLSchema simpleContent definition for WSDL.
2# Copyright (C) 2004, 2005 NAKAMURA, Hiroshi <[email protected]>.
3
4# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
5# redistribute it and/or modify it under the same terms of Ruby's license;
6# either the dual license version in 2003, or any later version.
7
8
9require 'wsdl/info'
10require 'xsd/namedelements'
11
12
13module WSDL
14module XMLSchema
15
16
17class SimpleContent < Info
18 attr_reader :restriction
19 attr_reader :extension
20
21 def check_lexical_format(value)
22 check(value)
23 end
24
25 def initialize
26 super
27 @restriction = nil
28 @extension = nil
29 end
30
31 def base
32 content.base
33 end
34
35 def targetnamespace
36 parent.targetnamespace
37 end
38
39 def parse_element(element)
40 case element
41 when RestrictionName
42 @restriction = SimpleRestriction.new
43 @restriction
44 when ExtensionName
45 @extension = SimpleExtension.new
46 @extension
47 end
48 end
49
50private
51
52 def content
53 @restriction || @extension
54 end
55
56 def check(value)
57 unless content.valid?(value)
58 raise XSD::ValueSpaceError.new("#{@name}: cannot accept '#{value}'")
59 end
60 end
61end
62
63
64end
65end
Note: See TracBrowser for help on using the repository browser.