1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xerces.internal.impl.xs;
22
88 /** the schema information property */
89 protected XSModel fSchemaInformation = null;
90
91 /** true if this object is immutable **/
92 protected boolean fIsConstant;
93
94 public ElementPSVImpl() {}
95
96 public ElementPSVImpl(boolean isConstant, ElementPSVI elementPSVI) {
97 fDeclaration = elementPSVI.getElementDeclaration();
98 fTypeDecl = elementPSVI.getTypeDefinition();
99 fNil = elementPSVI.getNil();
100 fSpecified = elementPSVI.getIsSchemaSpecified();
101 fValue.copyFrom(elementPSVI.getSchemaValue());
102 fNotation = elementPSVI.getNotation();
103 fValidationAttempted = elementPSVI.getValidationAttempted();
104 fValidity = elementPSVI.getValidity();
105 fValidationContext = elementPSVI.getValidationContext();
106 if (elementPSVI instanceof ElementPSVImpl) {
107 final ElementPSVImpl elementPSVIImpl = (ElementPSVImpl) elementPSVI;
108 fErrors = (elementPSVIImpl.fErrors != null) ?
109 (String[]) elementPSVIImpl.fErrors.clone() : null;
110 elementPSVIImpl.copySchemaInformationTo(this);
111 }
112 else {
113 final StringList errorCodes = elementPSVI.getErrorCodes();
114 final int length = errorCodes.getLength();
115 if (length > 0) {
116 final StringList errorMessages = elementPSVI.getErrorMessages();
117 final String[] errors = new String[length << 1];
118 for (int i = 0, j = 0; i < length; ++i) {
119 errors[j++] = errorCodes.item(i);
120 errors[j++] = errorMessages.item(i);
121 }
122 fErrors = errors;
123 }
124 fSchemaInformation = elementPSVI.getSchemaInformation();
125 }
126 fIsConstant = isConstant;
127 }
128
129 //
|
1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Nov 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 package com.sun.org.apache.xerces.internal.impl.xs;
23
89 /** the schema information property */
90 protected XSModel fSchemaInformation = null;
91
92 /** true if this object is immutable **/
93 protected boolean fIsConstant;
94
95 public ElementPSVImpl() {}
96
97 public ElementPSVImpl(boolean isConstant, ElementPSVI elementPSVI) {
98 fDeclaration = elementPSVI.getElementDeclaration();
99 fTypeDecl = elementPSVI.getTypeDefinition();
100 fNil = elementPSVI.getNil();
101 fSpecified = elementPSVI.getIsSchemaSpecified();
102 fValue.copyFrom(elementPSVI.getSchemaValue());
103 fNotation = elementPSVI.getNotation();
104 fValidationAttempted = elementPSVI.getValidationAttempted();
105 fValidity = elementPSVI.getValidity();
106 fValidationContext = elementPSVI.getValidationContext();
107 if (elementPSVI instanceof ElementPSVImpl) {
108 final ElementPSVImpl elementPSVIImpl = (ElementPSVImpl) elementPSVI;
109 fErrors = (elementPSVIImpl.fErrors != null) ? elementPSVIImpl.fErrors.clone() : null;
110 elementPSVIImpl.copySchemaInformationTo(this);
111 }
112 else {
113 final StringList errorCodes = elementPSVI.getErrorCodes();
114 final int length = errorCodes.getLength();
115 if (length > 0) {
116 final StringList errorMessages = elementPSVI.getErrorMessages();
117 final String[] errors = new String[length << 1];
118 for (int i = 0, j = 0; i < length; ++i) {
119 errors[j++] = errorCodes.item(i);
120 errors[j++] = errorMessages.item(i);
121 }
122 fErrors = errors;
123 }
124 fSchemaInformation = elementPSVI.getSchemaInformation();
125 }
126 fIsConstant = isConstant;
127 }
128
129 //
|