1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.xsdc; 18 19 import com.android.xsdc.tag.*; 20 21 import java.util.Collections; 22 import java.util.List; 23 import java.util.Map; 24 25 public class XmlSchema { 26 final private Map<String, XsdElement> elementMap; 27 final private Map<String, XsdType> typeMap; 28 final private Map<String, XsdAttribute> attributeMap; 29 final private Map<String, XsdAttributeGroup> attributeGroupMap; 30 final private Map<String, XsdGroup> groupMap; 31 final private List<String> includeList; 32 XmlSchema(Map<String, XsdElement> elementMap, Map<String, XsdType> typeMap, Map<String, XsdAttribute> attributeMap, Map<String, XsdAttributeGroup> attributeGroupMap, Map<String, XsdGroup> groupMap, List<String> includeList)33 XmlSchema(Map<String, XsdElement> elementMap, Map<String, XsdType> typeMap, 34 Map<String, XsdAttribute> attributeMap, 35 Map<String, XsdAttributeGroup> attributeGroupMap, 36 Map<String, XsdGroup> groupMap, List<String> includeList) { 37 this.elementMap = elementMap; 38 this.typeMap = typeMap; 39 this.attributeMap = attributeMap; 40 this.attributeGroupMap = attributeGroupMap; 41 this.groupMap = groupMap; 42 this.includeList = includeList; 43 } 44 getElementMap()45 public Map<String, XsdElement> getElementMap() { 46 return elementMap; 47 } 48 getTypeMap()49 public Map<String, XsdType> getTypeMap() { 50 return typeMap; 51 } 52 getAttributeMap()53 public Map<String, XsdAttribute> getAttributeMap() { 54 return attributeMap; 55 } 56 getAttributeGroupMap()57 public Map<String, XsdAttributeGroup> getAttributeGroupMap() { 58 return attributeGroupMap; 59 } 60 getGroupMap()61 public Map<String, XsdGroup> getGroupMap() { 62 return groupMap; 63 } 64 getIncludeList()65 public List<String> getIncludeList() { 66 return includeList; 67 } 68 include(XmlSchema schema)69 public void include(XmlSchema schema) { 70 elementMap.putAll(schema.getElementMap()); 71 typeMap.putAll(schema.getTypeMap()); 72 attributeMap.putAll(schema.getAttributeMap()); 73 attributeGroupMap.putAll(schema.getAttributeGroupMap()); 74 groupMap.putAll(schema.getGroupMap()); 75 } 76 } 77