1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21 
22 package org.apache.openoffice.ooxml.schema.model.complex;
23 
24 import org.apache.openoffice.ooxml.schema.model.base.INodeVisitor;
25 import org.apache.openoffice.ooxml.schema.model.base.Location;
26 import org.apache.openoffice.ooxml.schema.model.base.Node;
27 import org.apache.openoffice.ooxml.schema.model.base.NodeType;
28 
29 /** Representation of the 'any' XML schema element.  It specifies that its
30  *  children conform to a non-standard schema.  If it is unknown than the
31  *  children are to be ignored.
32  */
33 public class Any
34     extends Node
35 {
36     public enum ProcessContents
37     {
38         lax,
39         skip,
40         strict
41     }
42 
Any( final Node aParent, final Location aLocation, final String sProcessContents, final String sNamespace)43     public Any (
44         final Node aParent,
45         final Location aLocation,
46         final String sProcessContents,
47         final String sNamespace)
48     {
49         super(aParent, null, aLocation);
50         meProcessContents = ProcessContents.valueOf(sProcessContents);
51         maNamespaces = sNamespace.split("\\s+");
52     }
53 
54 
55 
56     @Override
GetNodeType()57     public NodeType GetNodeType ()
58     {
59         return NodeType.Any;
60     }
61 
62 
63 
64 
65     @Override
AcceptVisitor(final INodeVisitor aVisitor)66     public void AcceptVisitor (final INodeVisitor aVisitor)
67     {
68         aVisitor.Visit(this);
69     }
70 
71 
GetProcessContentsFlag()72     public ProcessContents GetProcessContentsFlag ()
73     {
74         return meProcessContents;
75     }
76 
77 
78 
79 
GetNamespaces()80     public String[] GetNamespaces ()
81     {
82         return maNamespaces;
83     }
84 
85 
86 
87 
88     @Override
toString()89     public String toString ()
90     {
91         final StringBuffer aBuffer = new StringBuffer();
92         aBuffer.append("any processContents=");
93         aBuffer.append(meProcessContents.toString());
94         aBuffer.append(", namespaces=");
95         boolean bFirst = true;
96         for (final String sNamespace : maNamespaces)
97         {
98             if (bFirst)
99                 bFirst = false;
100             else
101                 aBuffer.append('|');
102             aBuffer.append(sNamespace);
103         }
104         return aBuffer.toString();
105     }
106 
107 
108 
109 
110     private final ProcessContents meProcessContents;
111     private final String[] maNamespaces;
112 }
113