8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
Reviewed-by: lancea
This commit is contained in:
parent
5fed7c392c
commit
23a1b5481b
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -51,8 +51,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Vector;
|
||||
import javax.xml.XMLConstants;
|
||||
import org.w3c.dom.DOMConfiguration;
|
||||
import org.w3c.dom.DOMErrorHandler;
|
||||
import org.w3c.dom.DOMException;
|
||||
@ -976,41 +974,40 @@ public class DOMConfigurationImpl extends ParserConfigurationSettings
|
||||
*/
|
||||
public DOMStringList getParameterNames() {
|
||||
if (fRecognizedParameters == null){
|
||||
Vector parameters = new Vector();
|
||||
ArrayList parameters = new ArrayList();
|
||||
|
||||
//Add DOM recognized parameters
|
||||
//REVISIT: Would have been nice to have a list of
|
||||
//recognized paramters.
|
||||
parameters.add(Constants.DOM_COMMENTS);
|
||||
parameters.add(Constants.DOM_DATATYPE_NORMALIZATION);
|
||||
parameters.add(Constants.DOM_CDATA_SECTIONS);
|
||||
parameters.add(Constants.DOM_ENTITIES);
|
||||
parameters.add(Constants.DOM_SPLIT_CDATA);
|
||||
parameters.add(Constants.DOM_NAMESPACES);
|
||||
parameters.add(Constants.DOM_VALIDATE);
|
||||
//Add DOM recognized parameters
|
||||
//REVISIT: Would have been nice to have a list of
|
||||
//recognized paramters.
|
||||
parameters.add(Constants.DOM_COMMENTS);
|
||||
parameters.add(Constants.DOM_DATATYPE_NORMALIZATION);
|
||||
parameters.add(Constants.DOM_CDATA_SECTIONS);
|
||||
parameters.add(Constants.DOM_ENTITIES);
|
||||
parameters.add(Constants.DOM_SPLIT_CDATA);
|
||||
parameters.add(Constants.DOM_NAMESPACES);
|
||||
parameters.add(Constants.DOM_VALIDATE);
|
||||
|
||||
parameters.add(Constants.DOM_INFOSET);
|
||||
parameters.add(Constants.DOM_NORMALIZE_CHARACTERS);
|
||||
parameters.add(Constants.DOM_CANONICAL_FORM);
|
||||
parameters.add(Constants.DOM_VALIDATE_IF_SCHEMA);
|
||||
parameters.add(Constants.DOM_CHECK_CHAR_NORMALIZATION);
|
||||
parameters.add(Constants.DOM_WELLFORMED);
|
||||
parameters.add(Constants.DOM_INFOSET);
|
||||
parameters.add(Constants.DOM_NORMALIZE_CHARACTERS);
|
||||
parameters.add(Constants.DOM_CANONICAL_FORM);
|
||||
parameters.add(Constants.DOM_VALIDATE_IF_SCHEMA);
|
||||
parameters.add(Constants.DOM_CHECK_CHAR_NORMALIZATION);
|
||||
parameters.add(Constants.DOM_WELLFORMED);
|
||||
|
||||
parameters.add(Constants.DOM_NAMESPACE_DECLARATIONS);
|
||||
parameters.add(Constants.DOM_ELEMENT_CONTENT_WHITESPACE);
|
||||
parameters.add(Constants.DOM_NAMESPACE_DECLARATIONS);
|
||||
parameters.add(Constants.DOM_ELEMENT_CONTENT_WHITESPACE);
|
||||
|
||||
parameters.add(Constants.DOM_ERROR_HANDLER);
|
||||
parameters.add(Constants.DOM_SCHEMA_TYPE);
|
||||
parameters.add(Constants.DOM_SCHEMA_LOCATION);
|
||||
parameters.add(Constants.DOM_RESOURCE_RESOLVER);
|
||||
parameters.add(Constants.DOM_ERROR_HANDLER);
|
||||
parameters.add(Constants.DOM_SCHEMA_TYPE);
|
||||
parameters.add(Constants.DOM_SCHEMA_LOCATION);
|
||||
parameters.add(Constants.DOM_RESOURCE_RESOLVER);
|
||||
|
||||
//Add recognized xerces features and properties
|
||||
parameters.add(GRAMMAR_POOL);
|
||||
parameters.add(SYMBOL_TABLE);
|
||||
parameters.add(SEND_PSVI);
|
||||
|
||||
fRecognizedParameters = new DOMStringListImpl(parameters);
|
||||
//Add recognized xerces features and properties
|
||||
parameters.add(GRAMMAR_POOL);
|
||||
parameters.add(SYMBOL_TABLE);
|
||||
parameters.add(SEND_PSVI);
|
||||
|
||||
fRecognizedParameters = new DOMStringListImpl(parameters);
|
||||
}
|
||||
|
||||
return fRecognizedParameters;
|
||||
|
@ -1,13 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2002-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,14 +17,16 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.dom;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.AttributePSVImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl;
|
||||
import com.sun.org.apache.xerces.internal.xs.*;
|
||||
import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
|
||||
import java.io.IOException;
|
||||
import java.io.NotSerializableException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
|
||||
import com.sun.org.apache.xerces.internal.xs.*;
|
||||
|
||||
/**
|
||||
* Attribute namespace implementation; stores PSVI attribute items.
|
||||
*
|
||||
@ -67,20 +66,8 @@ public class PSVIAttrNSImpl extends AttrNSImpl implements AttributePSVI {
|
||||
* value in the original document, this is true; otherwise, it is false */
|
||||
protected boolean fSpecified = true;
|
||||
|
||||
/** schema normalized value property */
|
||||
protected String fNormalizedValue = null;
|
||||
|
||||
/** schema actual value */
|
||||
protected Object fActualValue = null;
|
||||
|
||||
/** schema actual value type */
|
||||
protected short fActualValueType = XSConstants.UNAVAILABLE_DT;
|
||||
|
||||
/** actual value types if the value is a list */
|
||||
protected ShortList fItemValueTypes = null;
|
||||
|
||||
/** member type definition against which attribute was validated */
|
||||
protected XSSimpleTypeDefinition fMemberType = null;
|
||||
/** Schema value */
|
||||
protected ValidatedInfo fValue = new ValidatedInfo();
|
||||
|
||||
/** validation attempted: none, partial, full */
|
||||
protected short fValidationAttempted = AttributePSVI.VALIDATION_NONE;
|
||||
@ -91,6 +78,9 @@ public class PSVIAttrNSImpl extends AttrNSImpl implements AttributePSVI {
|
||||
/** error codes */
|
||||
protected StringList fErrorCodes = null;
|
||||
|
||||
/** error messages */
|
||||
protected StringList fErrorMessages = null;
|
||||
|
||||
/** validation context: could be QName or XPath expression*/
|
||||
protected String fValidationContext = null;
|
||||
|
||||
@ -98,6 +88,20 @@ public class PSVIAttrNSImpl extends AttrNSImpl implements AttributePSVI {
|
||||
// AttributePSVI methods
|
||||
//
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.xerces.xs.ItemPSVI#constant()
|
||||
*/
|
||||
public ItemPSVI constant() {
|
||||
return new AttributePSVImpl(true, this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.xerces.xs.ItemPSVI#isConstant()
|
||||
*/
|
||||
public boolean isConstant() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* [schema default]
|
||||
*
|
||||
@ -116,7 +120,7 @@ public class PSVIAttrNSImpl extends AttrNSImpl implements AttributePSVI {
|
||||
* @return the normalized value of this item after validation
|
||||
*/
|
||||
public String getSchemaNormalizedValue() {
|
||||
return fNormalizedValue;
|
||||
return fValue.getNormalizedValue();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,7 +161,23 @@ public class PSVIAttrNSImpl extends AttrNSImpl implements AttributePSVI {
|
||||
* @return list of error codes
|
||||
*/
|
||||
public StringList getErrorCodes() {
|
||||
return fErrorCodes;
|
||||
if (fErrorCodes != null) {
|
||||
return fErrorCodes;
|
||||
}
|
||||
return StringListImpl.EMPTY_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of error messages generated from the validation attempt or
|
||||
* an empty <code>StringList</code> if no errors occurred during the
|
||||
* validation attempt. The indices of error messages in this list are
|
||||
* aligned with those in the <code>[schema error code]</code> list.
|
||||
*/
|
||||
public StringList getErrorMessages() {
|
||||
if (fErrorMessages != null) {
|
||||
return fErrorMessages;
|
||||
}
|
||||
return StringListImpl.EMPTY_LIST;
|
||||
}
|
||||
|
||||
// This is the only information we can provide in a pipeline.
|
||||
@ -177,14 +197,14 @@ public class PSVIAttrNSImpl extends AttrNSImpl implements AttributePSVI {
|
||||
/**
|
||||
* If and only if that type definition is a simple type definition
|
||||
* with {variety} union, or a complex type definition whose {content type}
|
||||
* is a simple thype definition with {variety} union, then an item isomorphic
|
||||
* is a simple type definition with {variety} union, then an item isomorphic
|
||||
* to that member of the union's {member type definitions} which actually
|
||||
* validated the element item's normalized value.
|
||||
*
|
||||
* @return a simple type declaration
|
||||
*/
|
||||
public XSSimpleTypeDefinition getMemberTypeDefinition() {
|
||||
return fMemberType;
|
||||
return fValue.getMemberTypeDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -208,12 +228,9 @@ public class PSVIAttrNSImpl extends AttrNSImpl implements AttributePSVI {
|
||||
this.fValidity = attr.getValidity();
|
||||
this.fValidationAttempted = attr.getValidationAttempted();
|
||||
this.fErrorCodes = attr.getErrorCodes();
|
||||
this.fNormalizedValue = attr.getSchemaNormalizedValue();
|
||||
this.fActualValue = attr.getActualNormalizedValue();
|
||||
this.fActualValueType = attr.getActualNormalizedValueType();
|
||||
this.fItemValueTypes = attr.getItemValueTypes();
|
||||
this.fErrorMessages = attr.getErrorMessages();
|
||||
this.fValue.copyFrom(attr.getSchemaValue());
|
||||
this.fTypeDecl = attr.getTypeDefinition();
|
||||
this.fMemberType = attr.getMemberTypeDefinition();
|
||||
this.fSpecified = attr.getIsSchemaSpecified();
|
||||
}
|
||||
|
||||
@ -221,21 +238,28 @@ public class PSVIAttrNSImpl extends AttrNSImpl implements AttributePSVI {
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getActualNormalizedValue()
|
||||
*/
|
||||
public Object getActualNormalizedValue() {
|
||||
return this.fActualValue;
|
||||
return fValue.getActualValue();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getActualNormalizedValueType()
|
||||
*/
|
||||
public short getActualNormalizedValueType() {
|
||||
return this.fActualValueType;
|
||||
return fValue.getActualValueType();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getItemValueTypes()
|
||||
*/
|
||||
public ShortList getItemValueTypes() {
|
||||
return this.fItemValueTypes;
|
||||
return fValue.getListValueTypes();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.xerces.xs.ItemPSVI#getSchemaValue()
|
||||
*/
|
||||
public XSValue getSchemaValue() {
|
||||
return fValue;
|
||||
}
|
||||
|
||||
// REVISIT: Forbid serialization of PSVI DOM until
|
||||
|
@ -1,13 +1,10 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2002-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,14 +17,16 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.dom;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.ElementPSVImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl;
|
||||
import com.sun.org.apache.xerces.internal.xs.*;
|
||||
import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
|
||||
import java.io.IOException;
|
||||
import java.io.NotSerializableException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
|
||||
import com.sun.org.apache.xerces.internal.xs.*;
|
||||
|
||||
/**
|
||||
* Element namespace implementation; stores PSVI element items.
|
||||
*
|
||||
@ -72,24 +71,12 @@ public class PSVIElementNSImpl extends ElementNSImpl implements ElementPSVI {
|
||||
*/
|
||||
protected boolean fSpecified = true;
|
||||
|
||||
/** schema normalized value property */
|
||||
protected String fNormalizedValue = null;
|
||||
|
||||
/** schema actual value */
|
||||
protected Object fActualValue = null;
|
||||
|
||||
/** schema actual value type */
|
||||
protected short fActualValueType = XSConstants.UNAVAILABLE_DT;
|
||||
|
||||
/** actual value types if the value is a list */
|
||||
protected ShortList fItemValueTypes = null;
|
||||
/** Schema value */
|
||||
protected ValidatedInfo fValue = new ValidatedInfo();
|
||||
|
||||
/** http://www.w3.org/TR/xmlschema-1/#e-notation*/
|
||||
protected XSNotationDeclaration fNotation = null;
|
||||
|
||||
/** member type definition against which element was validated */
|
||||
protected XSSimpleTypeDefinition fMemberType = null;
|
||||
|
||||
/** validation attempted: none, partial, full */
|
||||
protected short fValidationAttempted = ElementPSVI.VALIDATION_NONE;
|
||||
|
||||
@ -99,6 +86,9 @@ public class PSVIElementNSImpl extends ElementNSImpl implements ElementPSVI {
|
||||
/** error codes */
|
||||
protected StringList fErrorCodes = null;
|
||||
|
||||
/** error messages */
|
||||
protected StringList fErrorMessages = null;
|
||||
|
||||
/** validation context: could be QName or XPath expression*/
|
||||
protected String fValidationContext = null;
|
||||
|
||||
@ -109,6 +99,20 @@ public class PSVIElementNSImpl extends ElementNSImpl implements ElementPSVI {
|
||||
// ElementPSVI methods
|
||||
//
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#constant()
|
||||
*/
|
||||
public ItemPSVI constant() {
|
||||
return new ElementPSVImpl(true, this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#isConstant()
|
||||
*/
|
||||
public boolean isConstant() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* [schema default]
|
||||
*
|
||||
@ -127,7 +131,7 @@ public class PSVIElementNSImpl extends ElementNSImpl implements ElementPSVI {
|
||||
* @return the normalized value of this item after validation
|
||||
*/
|
||||
public String getSchemaNormalizedValue() {
|
||||
return fNormalizedValue;
|
||||
return fValue.getNormalizedValue();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,9 +171,24 @@ public class PSVIElementNSImpl extends ElementNSImpl implements ElementPSVI {
|
||||
* @return Array of error codes
|
||||
*/
|
||||
public StringList getErrorCodes() {
|
||||
return fErrorCodes;
|
||||
if (fErrorCodes != null) {
|
||||
return fErrorCodes;
|
||||
}
|
||||
return StringListImpl.EMPTY_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of error messages generated from the validation attempt or
|
||||
* an empty <code>StringList</code> if no errors occurred during the
|
||||
* validation attempt. The indices of error messages in this list are
|
||||
* aligned with those in the <code>[schema error code]</code> list.
|
||||
*/
|
||||
public StringList getErrorMessages() {
|
||||
if (fErrorMessages != null) {
|
||||
return fErrorMessages;
|
||||
}
|
||||
return StringListImpl.EMPTY_LIST;
|
||||
}
|
||||
|
||||
// This is the only information we can provide in a pipeline.
|
||||
public String getValidationContext() {
|
||||
@ -213,7 +232,7 @@ public class PSVIElementNSImpl extends ElementNSImpl implements ElementPSVI {
|
||||
* @return a simple type declaration
|
||||
*/
|
||||
public XSSimpleTypeDefinition getMemberTypeDefinition() {
|
||||
return fMemberType;
|
||||
return fValue.getMemberTypeDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -239,7 +258,7 @@ public class PSVIElementNSImpl extends ElementNSImpl implements ElementPSVI {
|
||||
/**
|
||||
* Copy PSVI properties from another psvi item.
|
||||
*
|
||||
* @param attr the source of attribute PSVI items
|
||||
* @param elem the source of element PSVI items
|
||||
*/
|
||||
public void setPSVI(ElementPSVI elem) {
|
||||
this.fDeclaration = elem.getElementDeclaration();
|
||||
@ -250,11 +269,15 @@ public class PSVIElementNSImpl extends ElementNSImpl implements ElementPSVI {
|
||||
this.fValidity = elem.getValidity();
|
||||
this.fValidationAttempted = elem.getValidationAttempted();
|
||||
this.fErrorCodes = elem.getErrorCodes();
|
||||
this.fNormalizedValue = elem.getSchemaNormalizedValue();
|
||||
this.fActualValue = elem.getActualNormalizedValue();
|
||||
this.fActualValueType = elem.getActualNormalizedValueType();
|
||||
this.fItemValueTypes = elem.getItemValueTypes();
|
||||
this.fMemberType = elem.getMemberTypeDefinition();
|
||||
this.fErrorMessages = elem.getErrorMessages();
|
||||
if (fTypeDecl instanceof XSSimpleTypeDefinition ||
|
||||
fTypeDecl instanceof XSComplexTypeDefinition &&
|
||||
((XSComplexTypeDefinition)fTypeDecl).getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE) {
|
||||
this.fValue.copyFrom(elem.getSchemaValue());
|
||||
}
|
||||
else {
|
||||
this.fValue.reset();
|
||||
}
|
||||
this.fSpecified = elem.getIsSchemaSpecified();
|
||||
this.fNil = elem.getNil();
|
||||
}
|
||||
@ -263,21 +286,28 @@ public class PSVIElementNSImpl extends ElementNSImpl implements ElementPSVI {
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getActualNormalizedValue()
|
||||
*/
|
||||
public Object getActualNormalizedValue() {
|
||||
return this.fActualValue;
|
||||
return fValue.getActualValue();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getActualNormalizedValueType()
|
||||
*/
|
||||
public short getActualNormalizedValueType() {
|
||||
return this.fActualValueType;
|
||||
return fValue.getActualValueType();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getItemValueTypes()
|
||||
*/
|
||||
public ShortList getItemValueTypes() {
|
||||
return this.fItemValueTypes;
|
||||
return fValue.getListValueTypes();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getSchemaValue()
|
||||
*/
|
||||
public XSValue getSchemaValue() {
|
||||
return fValue;
|
||||
}
|
||||
|
||||
// REVISIT: Forbid serialization of PSVI DOM until
|
||||
|
@ -1,3 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -632,9 +635,12 @@ public final class Constants {
|
||||
/** Validation manager property ("internal/validation-manager"). */
|
||||
public static final String VALIDATION_MANAGER_PROPERTY = "internal/validation-manager";
|
||||
|
||||
/** Schema type of the root element in a document ("validation/schema/root-type-definition"). */
|
||||
/** Schema type for the root element in a document ("validation/schema/root-type-definition"). */
|
||||
public static final String ROOT_TYPE_DEFINITION_PROPERTY = "validation/schema/root-type-definition";
|
||||
|
||||
/** Schema element declaration for the root element in a document ("validation/schema/root-element-declaration"). */
|
||||
public static final String ROOT_ELEMENT_DECLARATION_PROPERTY = "validation/schema/root-element-declaration";
|
||||
|
||||
/** XPointer Schema property ("xpointer-schema"). */
|
||||
public static final String XPOINTER_SCHEMA_PROPERTY = "xpointer-schema";
|
||||
|
||||
@ -803,6 +809,7 @@ public final class Constants {
|
||||
BUFFER_SIZE_PROPERTY,
|
||||
SECURITY_MANAGER_PROPERTY,
|
||||
ROOT_TYPE_DEFINITION_PROPERTY,
|
||||
ROOT_ELEMENT_DECLARATION_PROPERTY,
|
||||
LOCALE_PROPERTY,
|
||||
SCHEMA_DV_FACTORY_PROPERTY,
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -22,11 +21,11 @@
|
||||
package com.sun.org.apache.xerces.internal.impl ;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
|
||||
import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader;
|
||||
import com.sun.org.apache.xerces.internal.impl.io.UCSReader;
|
||||
import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader;
|
||||
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
|
||||
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
|
||||
import com.sun.org.apache.xerces.internal.util.*;
|
||||
import com.sun.org.apache.xerces.internal.util.URI;
|
||||
@ -54,6 +53,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
|
||||
|
||||
/**
|
||||
@ -305,6 +305,11 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
/** Property Manager. This is used from Stax */
|
||||
protected PropertyManager fPropertyManager ;
|
||||
|
||||
/** StAX properties */
|
||||
boolean fSupportDTD = true;
|
||||
boolean fReplaceEntityReferences = true;
|
||||
boolean fSupportExternalEntities = true;
|
||||
|
||||
/** used to restrict external access */
|
||||
protected String fAccessExternalDTD = EXTERNAL_ACCESS_DEFAULT;
|
||||
|
||||
@ -1136,7 +1141,8 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
boolean parameter = entityName.startsWith("%");
|
||||
boolean general = !parameter;
|
||||
if (unparsed || (general && !fExternalGeneralEntities) ||
|
||||
(parameter && !fExternalParameterEntities)) {
|
||||
(parameter && !fExternalParameterEntities) ||
|
||||
!fSupportDTD || !fSupportExternalEntities) {
|
||||
|
||||
if (fEntityHandler != null) {
|
||||
fResourceIdentifier.clear();
|
||||
@ -1431,6 +1437,10 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
fStaxEntityResolver = null;
|
||||
}
|
||||
|
||||
fSupportDTD = ((Boolean)propertyManager.getProperty(XMLInputFactory.SUPPORT_DTD)).booleanValue();
|
||||
fReplaceEntityReferences = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)).booleanValue();
|
||||
fSupportExternalEntities = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)).booleanValue();
|
||||
|
||||
// Zephyr feature ignore-external-dtd is the opposite of Xerces' load-external-dtd
|
||||
fLoadExternalDTD = !((Boolean)propertyManager.getProperty(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD)).booleanValue();
|
||||
|
||||
@ -1501,7 +1511,10 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER, null);
|
||||
fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER, null);
|
||||
entityExpansionIndex = fSecurityManager.getIndex(Constants.JDK_ENTITY_EXPANSION_LIMIT);
|
||||
|
||||
//StAX Property
|
||||
fSupportDTD = true;
|
||||
fReplaceEntityReferences = true;
|
||||
fSupportExternalEntities = true;
|
||||
// JAXP 1.5 feature
|
||||
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null);
|
||||
if (spm == null) {
|
||||
|
@ -3,60 +3,20 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* The Apache Software License, Version 1.1
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Copyright (c) 1999-2004 The Apache Software Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Xerces" and "Apache Software Foundation" must
|
||||
* not be used to endorse or promote products derived from this
|
||||
* software without prior written permission. For written
|
||||
* permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* nor may "Apache" appear in their name, without prior written
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation and was
|
||||
* originally based on software copyright (c) 1999, International
|
||||
* Business Machines, Inc., http://www.apache.org. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl;
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 1999-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -51,6 +52,7 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentFilter;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* The DTD validator. The validator implements a document
|
||||
@ -334,7 +336,7 @@ public class XMLDTDValidator
|
||||
// temporary variables
|
||||
|
||||
/** Temporary element declaration. */
|
||||
private XMLElementDecl fTempElementDecl = new XMLElementDecl();
|
||||
private final XMLElementDecl fTempElementDecl = new XMLElementDecl();
|
||||
|
||||
/** Temporary atribute declaration. */
|
||||
private final XMLAttributeDecl fTempAttDecl = new XMLAttributeDecl();
|
||||
@ -2020,12 +2022,14 @@ public class XMLDTDValidator
|
||||
// IDREF and IDREFS attr (V_IDREF0)
|
||||
//
|
||||
if (fPerformValidation) {
|
||||
String value = fValidationState.checkIDRefID();
|
||||
if (value != null) {
|
||||
fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,
|
||||
"MSG_ELEMENT_WITH_ID_REQUIRED",
|
||||
new Object[]{value},
|
||||
XMLErrorReporter.SEVERITY_ERROR );
|
||||
Iterator invIdRefs = fValidationState.checkIDRefID();
|
||||
if (invIdRefs != null) {
|
||||
while (invIdRefs.hasNext()) {
|
||||
fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,
|
||||
"MSG_ELEMENT_WITH_ID_REQUIRED",
|
||||
new Object[]{invIdRefs.next()},
|
||||
XMLErrorReporter.SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -1,62 +1,21 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* The Apache Software License, Version 1.1
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Xerces" and "Apache Software Foundation" must
|
||||
* not be used to endorse or promote products derived from this
|
||||
* software without prior written permission. For written
|
||||
* permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* nor may "Apache" appear in their name, without prior written
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation and was
|
||||
* originally based on software copyright (c) 1999, International
|
||||
* Business Machines, Inc., http://www.apache.org. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.dtd.models;
|
||||
@ -125,6 +84,14 @@ public abstract class CMNode
|
||||
fMaxStates = maxStates;
|
||||
}
|
||||
|
||||
public boolean isCompactedForUPA() {
|
||||
return fCompactedForUPA;
|
||||
}
|
||||
|
||||
public void setIsCompactUPAModel(boolean value) {
|
||||
fCompactedForUPA = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the user to set arbitrary data on this content model
|
||||
* node. This is used by the a{n,m} optimization that runs
|
||||
@ -181,10 +148,16 @@ public abstract class CMNode
|
||||
// init to to -1 so it will cause an error if its used without
|
||||
// being initialized.
|
||||
// -------------------------------------------------------------------
|
||||
private int fType;
|
||||
private CMStateSet fFirstPos = null;
|
||||
private CMStateSet fFollowPos = null;
|
||||
private CMStateSet fLastPos = null;
|
||||
private int fMaxStates = -1;
|
||||
private final int fType;
|
||||
private CMStateSet fFirstPos = null;
|
||||
private CMStateSet fFollowPos = null;
|
||||
private CMStateSet fLastPos = null;
|
||||
private int fMaxStates = -1;
|
||||
private Object fUserData = null;
|
||||
/*
|
||||
* This boolean is true if the model represented by the CMNode does not represent
|
||||
* the true model from the schema, but has had its min/maxOccurs modified for a
|
||||
* more compact representation (for purposes of UPA).
|
||||
*/
|
||||
private boolean fCompactedForUPA = false;
|
||||
};
|
||||
|
@ -1,3 +1,7 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -17,8 +21,13 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.dv;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.ShortListImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.XSObjectListImpl;
|
||||
import com.sun.org.apache.xerces.internal.xs.ShortList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSObjectList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSValue;
|
||||
|
||||
/**
|
||||
* Class to get the information back after content is validated. This info
|
||||
@ -29,7 +38,7 @@ import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
* @author Neeraj Bajaj, Sun Microsystems, inc.
|
||||
*
|
||||
*/
|
||||
public class ValidatedInfo {
|
||||
public class ValidatedInfo implements XSValue {
|
||||
|
||||
/**
|
||||
* The normalized value of a string value
|
||||
@ -50,6 +59,11 @@ public class ValidatedInfo {
|
||||
*/
|
||||
public short actualValueType;
|
||||
|
||||
/**
|
||||
* The declared type of the value.
|
||||
*/
|
||||
public XSSimpleType actualType;
|
||||
|
||||
/**
|
||||
* If the type is a union type, then the member type which
|
||||
* actually validated the string value.
|
||||
@ -79,8 +93,11 @@ public class ValidatedInfo {
|
||||
public void reset() {
|
||||
this.normalizedValue = null;
|
||||
this.actualValue = null;
|
||||
this.actualValueType = XSConstants.UNAVAILABLE_DT;
|
||||
this.actualType = null;
|
||||
this.memberType = null;
|
||||
this.memberTypes = null;
|
||||
this.itemValueTypes = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,10 +105,12 @@ public class ValidatedInfo {
|
||||
* value, use toString; otherwise, use the normalized value.
|
||||
*/
|
||||
public String stringValue() {
|
||||
if (actualValue == null)
|
||||
if (actualValue == null) {
|
||||
return normalizedValue;
|
||||
else
|
||||
}
|
||||
else {
|
||||
return actualValue.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,4 +168,72 @@ public class ValidatedInfo {
|
||||
/** Other types. */
|
||||
return valueType;
|
||||
}
|
||||
|
||||
// XSValue methods
|
||||
|
||||
public Object getActualValue() {
|
||||
return actualValue;
|
||||
}
|
||||
|
||||
public short getActualValueType() {
|
||||
return actualValueType;
|
||||
}
|
||||
|
||||
public ShortList getListValueTypes() {
|
||||
return itemValueTypes == null ? ShortListImpl.EMPTY_LIST : itemValueTypes;
|
||||
}
|
||||
|
||||
public XSObjectList getMemberTypeDefinitions() {
|
||||
if (memberTypes == null) {
|
||||
return XSObjectListImpl.EMPTY_LIST;
|
||||
}
|
||||
return new XSObjectListImpl(memberTypes, memberTypes.length);
|
||||
}
|
||||
|
||||
public String getNormalizedValue() {
|
||||
return normalizedValue;
|
||||
}
|
||||
|
||||
public XSSimpleTypeDefinition getTypeDefinition() {
|
||||
return actualType;
|
||||
}
|
||||
|
||||
public XSSimpleTypeDefinition getMemberTypeDefinition() {
|
||||
return memberType;
|
||||
}
|
||||
|
||||
public void copyFrom(XSValue o) {
|
||||
if (o == null) {
|
||||
reset();
|
||||
}
|
||||
else if (o instanceof ValidatedInfo) {
|
||||
ValidatedInfo other = (ValidatedInfo)o;
|
||||
normalizedValue = other.normalizedValue;
|
||||
actualValue = other.actualValue;
|
||||
actualValueType = other.actualValueType;
|
||||
actualType = other.actualType;
|
||||
memberType = other.memberType;
|
||||
memberTypes = other.memberTypes;
|
||||
itemValueTypes = other.itemValueTypes;
|
||||
}
|
||||
else {
|
||||
normalizedValue = o.getNormalizedValue();
|
||||
actualValue = o.getActualValue();
|
||||
actualValueType = o.getActualValueType();
|
||||
actualType = (XSSimpleType)o.getTypeDefinition();
|
||||
memberType = (XSSimpleType)o.getMemberTypeDefinition();
|
||||
XSSimpleType realType = memberType == null ? actualType : memberType;
|
||||
if (realType != null && realType.getBuiltInKind() == XSConstants.LISTOFUNION_DT) {
|
||||
XSObjectList members = o.getMemberTypeDefinitions();
|
||||
memberTypes = new XSSimpleType[members.getLength()];
|
||||
for (int i = 0; i < members.getLength(); i++) {
|
||||
memberTypes[i] = (XSSimpleType)members.get(i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
memberTypes = null;
|
||||
}
|
||||
itemValueTypes = o.getListValueTypes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -17,6 +18,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.dv.util;
|
||||
|
||||
import java.util.AbstractList;
|
||||
@ -102,4 +104,10 @@ public class ByteListImpl extends AbstractList implements ByteList {
|
||||
public int size() {
|
||||
return getLength();
|
||||
}
|
||||
|
||||
public byte[] toByteArray() {
|
||||
byte[] ret = new byte[data.length];
|
||||
System.arraycopy(data, 0, ret, 0, data.length);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,11 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.dv.xs;
|
||||
|
||||
import java.util.AbstractList;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.DatatypeException;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeFacetException;
|
||||
@ -33,9 +29,10 @@ import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.XSFacets;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType;
|
||||
import com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression;
|
||||
import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;
|
||||
import com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.SchemaSymbols;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.ObjectListImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.ShortListImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.XSObjectListImpl;
|
||||
@ -48,10 +45,16 @@ import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSFacet;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSMultiValueFacet;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSObject;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSObjectList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.datatypes.ObjectList;
|
||||
import java.math.BigInteger;
|
||||
import java.util.AbstractList;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
import org.w3c.dom.TypeInfo;
|
||||
|
||||
/**
|
||||
@ -267,9 +270,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
private int fFractionDigits = -1;
|
||||
private Vector fPattern;
|
||||
private Vector fPatternStr;
|
||||
private Vector fEnumeration;
|
||||
private short[] fEnumerationType;
|
||||
private ShortList[] fEnumerationItemType; // used in case fenumerationType value is LIST or LISTOFUNION
|
||||
private ValidatedInfo[] fEnumeration;
|
||||
private int fEnumerationSize;
|
||||
private ShortList fEnumerationTypeList;
|
||||
private ObjectList fEnumerationItemTypeList;
|
||||
private StringList fLexicalPattern;
|
||||
@ -387,8 +389,7 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
fPattern = fBase.fPattern;
|
||||
fPatternStr = fBase.fPatternStr;
|
||||
fEnumeration = fBase.fEnumeration;
|
||||
fEnumerationType = fBase.fEnumerationType;
|
||||
fEnumerationItemType = fBase.fEnumerationItemType;
|
||||
fEnumerationSize = fBase.fEnumerationSize;
|
||||
fWhiteSpace = fBase.fWhiteSpace;
|
||||
fMaxExclusive = fBase.fMaxExclusive;
|
||||
fMaxInclusive = fBase.fMaxInclusive;
|
||||
@ -508,8 +509,7 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
fPattern = fBase.fPattern;
|
||||
fPatternStr = fBase.fPatternStr;
|
||||
fEnumeration = fBase.fEnumeration;
|
||||
fEnumerationType = fBase.fEnumerationType;
|
||||
fEnumerationItemType = fBase.fEnumerationItemType;
|
||||
fEnumerationSize = fBase.fEnumerationSize;
|
||||
fWhiteSpace = fBase.fWhiteSpace;
|
||||
fMaxExclusive = fBase.fMaxExclusive;
|
||||
fMaxInclusive = fBase.fMaxInclusive;
|
||||
@ -873,22 +873,20 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
if ((allowedFacet & FACET_ENUMERATION) == 0) {
|
||||
reportError("cos-applicable-facets", new Object[]{"enumeration", fTypeName});
|
||||
} else {
|
||||
fEnumeration = new Vector();
|
||||
Vector enumVals = facets.enumeration;
|
||||
fEnumerationType = new short[enumVals.size()];
|
||||
fEnumerationItemType = new ShortList[enumVals.size()];
|
||||
int size = enumVals.size();
|
||||
fEnumeration = new ValidatedInfo[size];
|
||||
Vector enumNSDecls = facets.enumNSDecls;
|
||||
ValidationContextImpl ctx = new ValidationContextImpl(context);
|
||||
enumerationAnnotations = facets.enumAnnotations;
|
||||
for (int i = 0; i < enumVals.size(); i++) {
|
||||
fEnumerationSize = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (enumNSDecls != null)
|
||||
ctx.setNSContext((NamespaceContext)enumNSDecls.elementAt(i));
|
||||
try {
|
||||
ValidatedInfo info = getActualEnumValue((String)enumVals.elementAt(i), ctx, tempInfo);
|
||||
ValidatedInfo info = getActualEnumValue((String)enumVals.elementAt(i), ctx, null);
|
||||
// check 4.3.5.c0 must: enumeration values from the value space of base
|
||||
fEnumeration.addElement(info.actualValue);
|
||||
fEnumerationType[i] = info.actualValueType;
|
||||
fEnumerationItemType[i] = info.itemValueTypes;
|
||||
fEnumeration[fEnumerationSize++] = info;
|
||||
} catch (InvalidDatatypeValueException ide) {
|
||||
reportError("enumeration-valid-restriction", new Object[]{enumVals.elementAt(i), this.getBaseType().getName()});
|
||||
}
|
||||
@ -1478,6 +1476,7 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
if ((fFacetsDefined & FACET_ENUMERATION) == 0 && (fBase.fFacetsDefined & FACET_ENUMERATION) != 0) {
|
||||
fFacetsDefined |= FACET_ENUMERATION;
|
||||
fEnumeration = fBase.fEnumeration;
|
||||
fEnumerationSize = fBase.fEnumerationSize;
|
||||
enumerationAnnotations = fBase.enumerationAnnotations;
|
||||
}
|
||||
// inherit maxExclusive
|
||||
@ -1673,16 +1672,16 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
//enumeration
|
||||
if ( ((fFacetsDefined & FACET_ENUMERATION) != 0 ) ) {
|
||||
boolean present = false;
|
||||
final int enumSize = fEnumeration.size();
|
||||
final int enumSize = fEnumerationSize;
|
||||
final short primitiveType1 = convertToPrimitiveKind(type);
|
||||
for (int i = 0; i < enumSize; i++) {
|
||||
final short primitiveType2 = convertToPrimitiveKind(fEnumerationType[i]);
|
||||
final short primitiveType2 = convertToPrimitiveKind(fEnumeration[i].actualValueType);
|
||||
if ((primitiveType1 == primitiveType2 ||
|
||||
primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
|
||||
primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT)
|
||||
&& fEnumeration.elementAt(i).equals(ob)) {
|
||||
&& fEnumeration[i].actualValue.equals(ob)) {
|
||||
if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) {
|
||||
ShortList enumItemType = fEnumerationItemType[i];
|
||||
ShortList enumItemType = fEnumeration[i].itemValueTypes;
|
||||
final int typeList1Length = itemType != null ? itemType.getLength() : 0;
|
||||
final int typeList2Length = enumItemType != null ? enumItemType.getLength() : 0;
|
||||
if (typeList1Length == typeList2Length) {
|
||||
@ -1711,8 +1710,10 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
}
|
||||
}
|
||||
if(!present){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
appendEnumString(sb);
|
||||
throw new InvalidDatatypeValueException("cvc-enumeration-valid",
|
||||
new Object [] {content, fEnumeration.toString()});
|
||||
new Object [] {content, sb.toString()});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1827,12 +1828,6 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
nvalue = content.toString();
|
||||
}
|
||||
if ( (fFacetsDefined & FACET_PATTERN ) != 0 ) {
|
||||
if (fPattern.size()==0 && nvalue.length()>0) {
|
||||
throw new InvalidDatatypeValueException("cvc-pattern-valid",
|
||||
new Object[]{content,
|
||||
"(empty string)",
|
||||
fTypeName});
|
||||
}
|
||||
RegularExpression regex;
|
||||
for (int idx = fPattern.size()-1; idx >= 0; idx--) {
|
||||
regex = (RegularExpression)fPattern.elementAt(idx);
|
||||
@ -1840,6 +1835,7 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
throw new InvalidDatatypeValueException("cvc-pattern-valid",
|
||||
new Object[]{content,
|
||||
fPatternStr.elementAt(idx),
|
||||
|
||||
fTypeName});
|
||||
}
|
||||
}
|
||||
@ -1873,6 +1869,7 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
Object avalue = fDVs[fValidationDV].getActualValue(nvalue, context);
|
||||
validatedInfo.actualValue = avalue;
|
||||
validatedInfo.actualValueType = fBuiltInKind;
|
||||
validatedInfo.actualType = this;
|
||||
|
||||
return avalue;
|
||||
|
||||
@ -1910,6 +1907,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
validatedInfo.memberTypes = memberTypes;
|
||||
validatedInfo.itemValueTypes = new ShortListImpl(itemTypes, itemTypes.length);
|
||||
validatedInfo.normalizedValue = nvalue;
|
||||
// Need to set it here or it will become the item type
|
||||
validatedInfo.actualType = this;
|
||||
|
||||
return v;
|
||||
|
||||
@ -1929,6 +1928,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
fMemberTypes[i].checkFacets(validatedInfo);
|
||||
}
|
||||
validatedInfo.memberType = fMemberTypes[i];
|
||||
// Need to set it here or it will become the member type
|
||||
validatedInfo.actualType = this;
|
||||
return aValue;
|
||||
} catch(InvalidDatatypeValueException invalidValue) {
|
||||
}
|
||||
@ -1946,14 +1947,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
}
|
||||
typesBuffer.append(decl.fTypeName);
|
||||
if(decl.fEnumeration != null) {
|
||||
Vector v = decl.fEnumeration;
|
||||
typesBuffer.append(" : [");
|
||||
for(int j = 0;j < v.size(); j++) {
|
||||
if(j != 0)
|
||||
typesBuffer.append(',');
|
||||
typesBuffer.append(v.elementAt(j));
|
||||
}
|
||||
typesBuffer.append(']');
|
||||
typesBuffer.append(" : ");
|
||||
decl.appendEnumString(typesBuffer);
|
||||
}
|
||||
}
|
||||
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.3",
|
||||
@ -2245,10 +2240,10 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
if (fLexicalEnumeration == null){
|
||||
if (fEnumeration == null)
|
||||
return StringListImpl.EMPTY_LIST;
|
||||
int size = fEnumeration.size();
|
||||
int size = fEnumerationSize;
|
||||
String[] strs = new String[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
strs[i] = fEnumeration.elementAt(i).toString();
|
||||
strs[i] = fEnumeration[i].normalizedValue;
|
||||
fLexicalEnumeration = new StringListImpl(strs, size);
|
||||
}
|
||||
return fLexicalEnumeration;
|
||||
@ -2262,16 +2257,24 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
if (fActualEnumeration == null) {
|
||||
fActualEnumeration = new AbstractObjectList() {
|
||||
public int getLength() {
|
||||
return (fEnumeration != null) ? fEnumeration.size() : 0;
|
||||
return (fEnumeration != null) ? fEnumerationSize : 0;
|
||||
}
|
||||
public boolean contains(Object item) {
|
||||
return (fEnumeration != null && fEnumeration.contains(item));
|
||||
if (fEnumeration == null) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < fEnumerationSize; i++) {
|
||||
if (fEnumeration[i].getActualValue().equals(item)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public Object item(int index) {
|
||||
if (index < 0 || index >= getLength()) {
|
||||
return null;
|
||||
}
|
||||
return fEnumeration.elementAt(index);
|
||||
return fEnumeration[index].getActualValue();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -2284,17 +2287,18 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
*/
|
||||
public ObjectList getEnumerationItemTypeList() {
|
||||
if (fEnumerationItemTypeList == null) {
|
||||
if(fEnumerationItemType == null)
|
||||
if (fEnumeration == null) {
|
||||
return null;
|
||||
}
|
||||
fEnumerationItemTypeList = new AbstractObjectList() {
|
||||
public int getLength() {
|
||||
return (fEnumerationItemType != null) ? fEnumerationItemType.length : 0;
|
||||
return (fEnumeration != null) ? fEnumerationSize : 0;
|
||||
}
|
||||
public boolean contains(Object item) {
|
||||
if(fEnumerationItemType == null || !(item instanceof ShortList))
|
||||
if (fEnumeration == null || !(item instanceof ShortList))
|
||||
return false;
|
||||
for(int i = 0;i < fEnumerationItemType.length; i++)
|
||||
if(fEnumerationItemType[i] == item)
|
||||
for (int i = 0;i < fEnumerationSize; i++)
|
||||
if (fEnumeration[i].itemValueTypes == item)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -2302,7 +2306,7 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
if (index < 0 || index >= getLength()) {
|
||||
return null;
|
||||
}
|
||||
return fEnumerationItemType[index];
|
||||
return fEnumeration[index].itemValueTypes;
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -2311,10 +2315,14 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
|
||||
public ShortList getEnumerationTypeList() {
|
||||
if (fEnumerationTypeList == null) {
|
||||
if (fEnumerationType == null) {
|
||||
if (fEnumeration == null) {
|
||||
return ShortListImpl.EMPTY_LIST;
|
||||
}
|
||||
fEnumerationTypeList = new ShortListImpl (fEnumerationType, fEnumerationType.length);
|
||||
short[] list = new short[fEnumerationSize];
|
||||
for (int i = 0; i < fEnumerationSize; i++) {
|
||||
list[i] = fEnumeration[i].actualValueType;
|
||||
}
|
||||
fEnumerationTypeList = new ShortListImpl(list, fEnumerationSize);
|
||||
}
|
||||
return fEnumerationTypeList;
|
||||
}
|
||||
@ -2978,10 +2986,11 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
fPattern = null;
|
||||
fPatternStr = null;
|
||||
fEnumeration = null;
|
||||
fEnumerationType = null;
|
||||
fEnumerationItemType = null;
|
||||
fLexicalPattern = null;
|
||||
fLexicalEnumeration = null;
|
||||
fActualEnumeration = null;
|
||||
fEnumerationTypeList = null;
|
||||
fEnumerationItemTypeList = null;
|
||||
fMaxInclusive = null;
|
||||
fMaxExclusive = null;
|
||||
fMinExclusive = null;
|
||||
@ -3043,6 +3052,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_WHITESPACE,
|
||||
WS_FACET_STRING[fWhiteSpace],
|
||||
0,
|
||||
null,
|
||||
(fFixedFacet & FACET_WHITESPACE) != 0,
|
||||
whiteSpaceAnnotation);
|
||||
count++;
|
||||
@ -3052,6 +3063,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_LENGTH,
|
||||
Integer.toString(fLength),
|
||||
fLength,
|
||||
null,
|
||||
(fFixedFacet & FACET_LENGTH) != 0,
|
||||
lengthAnnotation);
|
||||
count++;
|
||||
@ -3061,6 +3074,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_MINLENGTH,
|
||||
Integer.toString(fMinLength),
|
||||
fMinLength,
|
||||
null,
|
||||
(fFixedFacet & FACET_MINLENGTH) != 0,
|
||||
minLengthAnnotation);
|
||||
count++;
|
||||
@ -3070,6 +3085,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_MAXLENGTH,
|
||||
Integer.toString(fMaxLength),
|
||||
fMaxLength,
|
||||
null,
|
||||
(fFixedFacet & FACET_MAXLENGTH) != 0,
|
||||
maxLengthAnnotation);
|
||||
count++;
|
||||
@ -3079,6 +3096,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_TOTALDIGITS,
|
||||
Integer.toString(fTotalDigits),
|
||||
fTotalDigits,
|
||||
null,
|
||||
(fFixedFacet & FACET_TOTALDIGITS) != 0,
|
||||
totalDigitsAnnotation);
|
||||
count++;
|
||||
@ -3088,6 +3107,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_FRACTIONDIGITS,
|
||||
"0",
|
||||
0,
|
||||
null,
|
||||
true,
|
||||
fractionDigitsAnnotation);
|
||||
count++;
|
||||
@ -3097,6 +3118,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_FRACTIONDIGITS,
|
||||
Integer.toString(fFractionDigits),
|
||||
fFractionDigits,
|
||||
null,
|
||||
(fFixedFacet & FACET_FRACTIONDIGITS) != 0,
|
||||
fractionDigitsAnnotation);
|
||||
count++;
|
||||
@ -3106,6 +3129,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_MAXINCLUSIVE,
|
||||
fMaxInclusive.toString(),
|
||||
0,
|
||||
fMaxInclusive,
|
||||
(fFixedFacet & FACET_MAXINCLUSIVE) != 0,
|
||||
maxInclusiveAnnotation);
|
||||
count++;
|
||||
@ -3115,6 +3140,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_MAXEXCLUSIVE,
|
||||
fMaxExclusive.toString(),
|
||||
0,
|
||||
fMaxExclusive,
|
||||
(fFixedFacet & FACET_MAXEXCLUSIVE) != 0,
|
||||
maxExclusiveAnnotation);
|
||||
count++;
|
||||
@ -3124,6 +3151,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_MINEXCLUSIVE,
|
||||
fMinExclusive.toString(),
|
||||
0,
|
||||
fMinExclusive,
|
||||
(fFixedFacet & FACET_MINEXCLUSIVE) != 0,
|
||||
minExclusiveAnnotation);
|
||||
count++;
|
||||
@ -3133,6 +3162,8 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSFacetImpl(
|
||||
FACET_MININCLUSIVE,
|
||||
fMinInclusive.toString(),
|
||||
0,
|
||||
fMinInclusive,
|
||||
(fFixedFacet & FACET_MININCLUSIVE) != 0,
|
||||
minInclusiveAnnotation);
|
||||
count++;
|
||||
@ -3142,6 +3173,28 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
return (fFacets != null) ? fFacets : XSObjectListImpl.EMPTY_LIST;
|
||||
}
|
||||
|
||||
public XSObject getFacet(int facetType) {
|
||||
if (facetType == FACET_ENUMERATION || facetType == FACET_PATTERN) {
|
||||
XSObjectList list = getMultiValueFacets();
|
||||
for (int i = 0; i < list.getLength(); i++) {
|
||||
XSMultiValueFacet f = (XSMultiValueFacet)list.item(i);
|
||||
if (f.getFacetKind() == facetType) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
XSObjectList list = getFacets();
|
||||
for (int i = 0; i < list.getLength(); i++) {
|
||||
XSFacet f = (XSFacet)list.item(i);
|
||||
if (f.getFacetKind() == facetType) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of enumeration and pattern constraining facets if it exists,
|
||||
* otherwise an empty <code>XSObjectList</code>.
|
||||
@ -3162,6 +3215,7 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSMVFacetImpl(
|
||||
FACET_PATTERN,
|
||||
this.getLexicalPattern(),
|
||||
null,
|
||||
patternAnnotations);
|
||||
count++;
|
||||
}
|
||||
@ -3170,6 +3224,7 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
new XSMVFacetImpl(
|
||||
FACET_ENUMERATION,
|
||||
this.getLexicalEnumeration(),
|
||||
new ObjectListImpl(fEnumeration, fEnumerationSize),
|
||||
enumerationAnnotations);
|
||||
count++;
|
||||
}
|
||||
@ -3201,13 +3256,17 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
|
||||
private static final class XSFacetImpl implements XSFacet {
|
||||
final short kind;
|
||||
final String value;
|
||||
final String svalue;
|
||||
final int ivalue;
|
||||
Object avalue;
|
||||
final boolean fixed;
|
||||
final XSObjectList annotations;
|
||||
|
||||
public XSFacetImpl(short kind, String value, boolean fixed, XSAnnotation annotation) {
|
||||
public XSFacetImpl(short kind, String svalue, int ivalue, Object avalue, boolean fixed, XSAnnotation annotation) {
|
||||
this.kind = kind;
|
||||
this.value = value;
|
||||
this.svalue = svalue;
|
||||
this.ivalue = ivalue;
|
||||
this.avalue = avalue;
|
||||
this.fixed = fixed;
|
||||
|
||||
if (annotation != null) {
|
||||
@ -3254,7 +3313,24 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
* @see com.sun.org.apache.xerces.internal.xs.XSFacet#getLexicalFacetValue()
|
||||
*/
|
||||
public String getLexicalFacetValue() {
|
||||
return value;
|
||||
return svalue;
|
||||
}
|
||||
|
||||
public Object getActualFacetValue() {
|
||||
if (avalue == null) {
|
||||
if (kind == FACET_WHITESPACE) {
|
||||
avalue = svalue;
|
||||
}
|
||||
else {
|
||||
// Must a facet with an integer value. Use BigInteger.
|
||||
avalue = BigInteger.valueOf(ivalue);
|
||||
}
|
||||
}
|
||||
return avalue;
|
||||
}
|
||||
|
||||
public int getIntFacetValue() {
|
||||
return ivalue;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -3298,11 +3374,13 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
private static final class XSMVFacetImpl implements XSMultiValueFacet {
|
||||
final short kind;
|
||||
final XSObjectList annotations;
|
||||
final StringList values;
|
||||
final StringList svalues;
|
||||
final ObjectList avalues;
|
||||
|
||||
public XSMVFacetImpl(short kind, StringList values, XSObjectList annotations) {
|
||||
public XSMVFacetImpl(short kind, StringList svalues, ObjectList avalues, XSObjectList annotations) {
|
||||
this.kind = kind;
|
||||
this.values = values;
|
||||
this.svalues = svalues;
|
||||
this.avalues = avalues;
|
||||
this.annotations = (annotations != null) ? annotations : XSObjectListImpl.EMPTY_LIST;
|
||||
}
|
||||
|
||||
@ -3324,7 +3402,11 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
* @see com.sun.org.apache.xerces.internal.xs.XSMultiValueFacet#getLexicalFacetValues()
|
||||
*/
|
||||
public StringList getLexicalFacetValues() {
|
||||
return values;
|
||||
return svalues;
|
||||
}
|
||||
|
||||
public ObjectList getEnumerationValues() {
|
||||
return avalues;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -3394,4 +3476,14 @@ public class XSSimpleTypeDecl implements XSSimpleType, TypeInfo {
|
||||
return valueType;
|
||||
}
|
||||
|
||||
private void appendEnumString(StringBuffer sb) {
|
||||
sb.append('[');
|
||||
for (int i = 0; i < fEnumerationSize; i++) {
|
||||
if (i != 0) {
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(fEnumeration[i].actualValue);
|
||||
}
|
||||
sb.append(']');
|
||||
}
|
||||
} // class XSSimpleTypeDecl
|
||||
|
@ -30,6 +30,7 @@ import com.sun.org.apache.xerces.internal.impl.dv.XSFacets;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType;
|
||||
import com.sun.org.apache.xerces.internal.xs.StringList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSObject;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSObjectList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
|
||||
@ -76,6 +77,10 @@ public class XSSimpleTypeDelegate
|
||||
return type.getFacets();
|
||||
}
|
||||
|
||||
public XSObject getFacet(int facetType) {
|
||||
return type.getFacet(facetType);
|
||||
}
|
||||
|
||||
public boolean getFinite() {
|
||||
return type.getFinite();
|
||||
}
|
||||
|
@ -41,7 +41,13 @@
|
||||
cvc-complex-type.2.4.b = cvc-complex-type.2.4.b: The content of element ''{0}'' is not complete. One of ''{1}'' is expected.
|
||||
cvc-complex-type.2.4.c = cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element ''{0}''.
|
||||
cvc-complex-type.2.4.d = cvc-complex-type.2.4.d: Invalid content was found starting with element ''{0}''. No child element is expected at this point.
|
||||
cvc-complex-type.2.4.e = cvc-complex-type.2.4.d: Invalid content was found starting with element ''{0}''. No child element ''{1}'' is expected at this point.
|
||||
cvc-complex-type.2.4.d.1 = cvc-complex-type.2.4.d: Invalid content was found starting with element ''{0}''. No child element ''{1}'' is expected at this point.
|
||||
cvc-complex-type.2.4.e = cvc-complex-type.2.4.e: ''{0}'' can occur a maximum of ''{2}'' times in the current sequence. This limit was exceeded. At this point one of ''{1}'' is expected.
|
||||
cvc-complex-type.2.4.f = cvc-complex-type.2.4.f: ''{0}'' can occur a maximum of ''{1}'' times in the current sequence. This limit was exceeded. No child element is expected at this point.
|
||||
cvc-complex-type.2.4.g = cvc-complex-type.2.4.g: Invalid content was found starting with element ''{0}''. ''{1}'' is expected to occur a minimum of ''{2}'' times in the current sequence. One more instance is required to satisfy this constraint.
|
||||
cvc-complex-type.2.4.h = cvc-complex-type.2.4.h: Invalid content was found starting with element ''{0}''. ''{1}'' is expected to occur a minimum of ''{2}'' times in the current sequence. ''{3}'' more instances are required to satisfy this constraint.
|
||||
cvc-complex-type.2.4.i = cvc-complex-type.2.4.i: The content of element ''{0}'' is not complete. ''{1}'' is expected to occur a minimum of ''{2}'' times. One more instance is required to satisfy this constraint.
|
||||
cvc-complex-type.2.4.j = cvc-complex-type.2.4.j: The content of element ''{0}'' is not complete. ''{1}'' is expected to occur a minimum of ''{2}'' times. ''{3}'' more instances are required to satisfy this constraint.
|
||||
cvc-complex-type.3.1 = cvc-complex-type.3.1: Value ''{2}'' of attribute ''{1}'' of element ''{0}'' is not valid with respect to the corresponding attribute use. Attribute ''{1}'' has a fixed value of ''{3}''.
|
||||
cvc-complex-type.3.2.1 = cvc-complex-type.3.2.1: Element ''{0}'' does not have an attribute wildcard for attribute ''{1}''.
|
||||
cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: Attribute ''{1}'' is not allowed to appear in element ''{0}''.
|
||||
@ -51,7 +57,8 @@
|
||||
cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: ''{0}'' is not a valid value for ''{1}''.
|
||||
cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2: ''{0}'' is not a valid value of list type ''{1}''.
|
||||
cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3: ''{0}'' is not a valid value of union type ''{1}''.
|
||||
cvc-elt.1 = cvc-elt.1: Cannot find the declaration of element ''{0}''.
|
||||
cvc-elt.1.a = cvc-elt.1.a: Cannot find the declaration of element ''{0}''.
|
||||
cvc-elt.1.b = cvc-elt.1.b: The name of the element does not match the name of the element declaration. Saw ''{0}''. Expected ''{1}''.
|
||||
cvc-elt.2 = cvc-elt.2: The value of '{'abstract'}' in the element declaration for ''{0}'' must be false.
|
||||
cvc-elt.3.1 = cvc-elt.3.1: Attribute ''{1}'' must not appear on element ''{0}'', because the '{'nillable'}' property of ''{0}'' is false.
|
||||
cvc-elt.3.2.1 = cvc-elt.3.2.1: Element ''{0}'' cannot have character or element information [children], because ''{1}'' is specified.
|
||||
@ -289,3 +296,10 @@
|
||||
TargetNamespace.2 = TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of ''{1}''.
|
||||
UndeclaredEntity = UndeclaredEntity: Entity ''{0}'' is not declared.
|
||||
UndeclaredPrefix = UndeclaredPrefix: Cannot resolve ''{0}'' as a QName: the prefix ''{1}'' is not declared.
|
||||
|
||||
|
||||
# JAXP 1.2 schema source property errors
|
||||
|
||||
jaxp12-schema-source-type.1 = The ''http://java.sun.com/xml/jaxp/properties/schemaSource'' property cannot have a value of type ''{0}''. Possible types of the value supported are String, File, InputStream, InputSource or an array of these types.
|
||||
jaxp12-schema-source-type.2 = The ''http://java.sun.com/xml/jaxp/properties/schemaSource'' property cannot have an array value of type ''{0}''. Possible types of the array supported are Object, String, File, InputStream and InputSource.
|
||||
jaxp12-schema-source-ns = When using an array of Objects as the value of the 'http://java.sun.com/xml/jaxp/properties/schemaSource' property, it is illegal to have two schemas that share the same target namespace.
|
||||
|
@ -1,9 +1,14 @@
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -16,6 +21,8 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.validation;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* <p>An extension of ValidationState which can be configured to turn
|
||||
* off checking for ID/IDREF errors and unparsed entity errors.</p>
|
||||
@ -49,7 +56,7 @@ public final class ConfigurableValidationState extends ValidationState {
|
||||
|
||||
/**
|
||||
* Turns checking for ID/IDREF errors on and off.
|
||||
* @param setting: true to turn on error checking
|
||||
* @param setting true to turn on error checking,
|
||||
* false to turn off error checking
|
||||
*/
|
||||
public void setIdIdrefChecking(boolean setting) {
|
||||
@ -58,7 +65,7 @@ public final class ConfigurableValidationState extends ValidationState {
|
||||
|
||||
/**
|
||||
* Turns checking for unparsed entity errors on and off.
|
||||
* @param setting: true to turn on error checking
|
||||
* @param setting true to turn on error checking,
|
||||
* false to turn off error checking
|
||||
*/
|
||||
public void setUnparsedEntityChecking(boolean setting) {
|
||||
@ -70,7 +77,7 @@ public final class ConfigurableValidationState extends ValidationState {
|
||||
* @return null, if ID/IDREF checking is turned off
|
||||
* otherwise, returns the value of the super implementation
|
||||
*/
|
||||
public String checkIDRefID() {
|
||||
public Iterator checkIDRefID() {
|
||||
return (fIdIdrefChecking) ? super.checkIDRefID() : null;
|
||||
}
|
||||
|
||||
@ -103,7 +110,7 @@ public final class ConfigurableValidationState extends ValidationState {
|
||||
|
||||
/**
|
||||
* Adds the ID, if ID/IDREF checking is enabled.
|
||||
* @param the ID to add
|
||||
* @param name the ID to add
|
||||
*/
|
||||
public void addId(String name) {
|
||||
if (fIdIdrefChecking) {
|
||||
@ -113,7 +120,7 @@ public final class ConfigurableValidationState extends ValidationState {
|
||||
|
||||
/**
|
||||
* Adds the IDREF, if ID/IDREF checking is enabled.
|
||||
* @param the IDREF to add
|
||||
* @param name the IDREF to add
|
||||
*/
|
||||
public void addIdRef(String name) {
|
||||
if (fIdIdrefChecking) {
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001, 2002,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,11 +21,12 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.validation;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@ -86,25 +88,24 @@ public class ValidationState implements ValidationContext {
|
||||
|
||||
/**
|
||||
* return null if all IDREF values have a corresponding ID value;
|
||||
* otherwise return the first IDREF value without a matching ID value.
|
||||
* otherwise return an iterator for all the IDREF values without
|
||||
* a matching ID value.
|
||||
*/
|
||||
public String checkIDRefID () {
|
||||
if (fIdList == null) {
|
||||
if (fIdRefList != null) {
|
||||
return fIdRefList.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator checkIDRefID () {
|
||||
HashSet missingIDs = null;
|
||||
if (fIdRefList != null) {
|
||||
String key;
|
||||
for (int i = 0; i < fIdRefList.size(); i++) {
|
||||
key = fIdRefList.get(i);
|
||||
if (!fIdList.contains(key)) {
|
||||
return key;
|
||||
if (fIdList == null || !fIdList.contains(key)) {
|
||||
if (missingIDs == null) {
|
||||
missingIDs = new HashSet();
|
||||
}
|
||||
missingIDs.add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return (missingIDs != null) ? missingIDs.iterator() : null;
|
||||
}
|
||||
|
||||
public void reset () {
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2000-2002,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,14 +21,17 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.xs;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl;
|
||||
import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
|
||||
import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
|
||||
import com.sun.org.apache.xerces.internal.xs.ShortList;
|
||||
import com.sun.org.apache.xerces.internal.xs.StringList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSAttributeDeclaration;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl;
|
||||
import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSValue;
|
||||
|
||||
/**
|
||||
* Attribute PSV infoset augmentations implementation.
|
||||
@ -49,20 +53,8 @@ public class AttributePSVImpl implements AttributePSVI {
|
||||
* value in the original document, this is false; otherwise, it is true */
|
||||
protected boolean fSpecified = false;
|
||||
|
||||
/** schema normalized value property */
|
||||
protected String fNormalizedValue = null;
|
||||
|
||||
/** schema actual value */
|
||||
protected Object fActualValue = null;
|
||||
|
||||
/** schema actual value type */
|
||||
protected short fActualValueType = XSConstants.UNAVAILABLE_DT;
|
||||
|
||||
/** actual value types if the value is a list */
|
||||
protected ShortList fItemValueTypes = null;
|
||||
|
||||
/** member type definition against which attribute was validated */
|
||||
protected XSSimpleTypeDefinition fMemberType = null;
|
||||
/** Schema value */
|
||||
protected ValidatedInfo fValue = new ValidatedInfo();
|
||||
|
||||
/** validation attempted: none, partial, full */
|
||||
protected short fValidationAttempted = AttributePSVI.VALIDATION_NONE;
|
||||
@ -70,16 +62,67 @@ public class AttributePSVImpl implements AttributePSVI {
|
||||
/** validity: valid, invalid, unknown */
|
||||
protected short fValidity = AttributePSVI.VALIDITY_NOTKNOWN;
|
||||
|
||||
/** error codes */
|
||||
protected String[] fErrorCodes = null;
|
||||
/** error codes and error messages */
|
||||
protected String[] fErrors = null;
|
||||
|
||||
/** validation context: could be QName or XPath expression*/
|
||||
protected String fValidationContext = null;
|
||||
|
||||
/** true if this object is immutable **/
|
||||
protected boolean fIsConstant;
|
||||
|
||||
public AttributePSVImpl() {}
|
||||
|
||||
public AttributePSVImpl(boolean isConstant, AttributePSVI attrPSVI) {
|
||||
fDeclaration = attrPSVI.getAttributeDeclaration();
|
||||
fTypeDecl = attrPSVI.getTypeDefinition();
|
||||
fSpecified = attrPSVI.getIsSchemaSpecified();
|
||||
fValue.copyFrom(attrPSVI.getSchemaValue());
|
||||
fValidationAttempted = attrPSVI.getValidationAttempted();
|
||||
fValidity = attrPSVI.getValidity();
|
||||
if (attrPSVI instanceof AttributePSVImpl) {
|
||||
final AttributePSVImpl attrPSVIImpl = (AttributePSVImpl) attrPSVI;
|
||||
fErrors = (attrPSVIImpl.fErrors != null) ?
|
||||
(String[]) attrPSVIImpl.fErrors.clone() : null;
|
||||
}
|
||||
else {
|
||||
final StringList errorCodes = attrPSVI.getErrorCodes();
|
||||
final int length = errorCodes.getLength();
|
||||
if (length > 0) {
|
||||
final StringList errorMessages = attrPSVI.getErrorMessages();
|
||||
final String[] errors = new String[length << 1];
|
||||
for (int i = 0, j = 0; i < length; ++i) {
|
||||
errors[j++] = errorCodes.item(i);
|
||||
errors[j++] = errorMessages.item(i);
|
||||
}
|
||||
fErrors = errors;
|
||||
}
|
||||
}
|
||||
fValidationContext = attrPSVI.getValidationContext();
|
||||
fIsConstant = isConstant;
|
||||
}
|
||||
|
||||
//
|
||||
// AttributePSVI methods
|
||||
//
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#constant()
|
||||
*/
|
||||
public ItemPSVI constant() {
|
||||
if (isConstant()) {
|
||||
return this;
|
||||
}
|
||||
return new AttributePSVImpl(true, this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#isConstant()
|
||||
*/
|
||||
public boolean isConstant() {
|
||||
return fIsConstant;
|
||||
}
|
||||
|
||||
/**
|
||||
* [schema default]
|
||||
*
|
||||
@ -98,7 +141,7 @@ public class AttributePSVImpl implements AttributePSVI {
|
||||
* @return the normalized value of this item after validation
|
||||
*/
|
||||
public String getSchemaNormalizedValue() {
|
||||
return fNormalizedValue;
|
||||
return fValue.getNormalizedValue();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,9 +182,23 @@ public class AttributePSVImpl implements AttributePSVI {
|
||||
* @return list of error codes
|
||||
*/
|
||||
public StringList getErrorCodes() {
|
||||
if (fErrorCodes == null)
|
||||
return null;
|
||||
return new StringListImpl(fErrorCodes, fErrorCodes.length);
|
||||
if (fErrors == null || fErrors.length == 0) {
|
||||
return StringListImpl.EMPTY_LIST;
|
||||
}
|
||||
return new PSVIErrorList(fErrors, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of error messages generated from the validation attempt or
|
||||
* an empty <code>StringList</code> if no errors occurred during the
|
||||
* validation attempt. The indices of error messages in this list are
|
||||
* aligned with those in the <code>[schema error code]</code> list.
|
||||
*/
|
||||
public StringList getErrorMessages() {
|
||||
if (fErrors == null || fErrors.length == 0) {
|
||||
return StringListImpl.EMPTY_LIST;
|
||||
}
|
||||
return new PSVIErrorList(fErrors, false);
|
||||
}
|
||||
|
||||
// This is the only information we can provide in a pipeline.
|
||||
@ -168,7 +225,7 @@ public class AttributePSVImpl implements AttributePSVI {
|
||||
* @return a simple type declaration
|
||||
*/
|
||||
public XSSimpleTypeDefinition getMemberTypeDefinition() {
|
||||
return fMemberType;
|
||||
return fValue.getMemberTypeDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,38 +242,41 @@ public class AttributePSVImpl implements AttributePSVI {
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getActualNormalizedValue()
|
||||
*/
|
||||
public Object getActualNormalizedValue() {
|
||||
return this.fActualValue;
|
||||
return fValue.getActualValue();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getActualNormalizedValueType()
|
||||
*/
|
||||
public short getActualNormalizedValueType() {
|
||||
return this.fActualValueType;
|
||||
return fValue.getActualValueType();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getItemValueTypes()
|
||||
*/
|
||||
public ShortList getItemValueTypes() {
|
||||
return this.fItemValueTypes;
|
||||
return fValue.getListValueTypes();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getSchemaValue()
|
||||
*/
|
||||
public XSValue getSchemaValue() {
|
||||
return fValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset()
|
||||
*/
|
||||
public void reset() {
|
||||
fNormalizedValue = null;
|
||||
fActualValue = null;
|
||||
fActualValueType = XSConstants.UNAVAILABLE_DT;
|
||||
fItemValueTypes = null;
|
||||
fValue.reset();
|
||||
fDeclaration = null;
|
||||
fTypeDecl = null;
|
||||
fSpecified = false;
|
||||
fMemberType = null;
|
||||
fValidationAttempted = AttributePSVI.VALIDATION_NONE;
|
||||
fValidity = AttributePSVI.VALIDITY_NOTKNOWN;
|
||||
fErrorCodes = null;
|
||||
fErrors = null;
|
||||
fValidationContext = null;
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2000-2002,2004,2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,16 +21,19 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.xs;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl;
|
||||
import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
|
||||
import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
|
||||
import com.sun.org.apache.xerces.internal.xs.ShortList;
|
||||
import com.sun.org.apache.xerces.internal.xs.StringList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSElementDeclaration;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSModel;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSNotationDeclaration;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl;
|
||||
import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSValue;
|
||||
|
||||
/**
|
||||
* Element PSV infoset augmentations implementation.
|
||||
@ -61,32 +65,20 @@ public class ElementPSVImpl implements ElementPSVI {
|
||||
*/
|
||||
protected boolean fSpecified = false;
|
||||
|
||||
/** schema normalized value property */
|
||||
protected String fNormalizedValue = null;
|
||||
|
||||
/** schema actual value */
|
||||
protected Object fActualValue = null;
|
||||
|
||||
/** schema actual value type */
|
||||
protected short fActualValueType = XSConstants.UNAVAILABLE_DT;
|
||||
|
||||
/** actual value types if the value is a list */
|
||||
protected ShortList fItemValueTypes = null;
|
||||
/** Schema value */
|
||||
protected ValidatedInfo fValue = new ValidatedInfo();
|
||||
|
||||
/** http://www.w3.org/TR/xmlschema-1/#e-notation*/
|
||||
protected XSNotationDeclaration fNotation = null;
|
||||
|
||||
/** member type definition against which element was validated */
|
||||
protected XSSimpleTypeDefinition fMemberType = null;
|
||||
|
||||
/** validation attempted: none, partial, full */
|
||||
protected short fValidationAttempted = ElementPSVI.VALIDATION_NONE;
|
||||
|
||||
/** validity: valid, invalid, unknown */
|
||||
protected short fValidity = ElementPSVI.VALIDITY_NOTKNOWN;
|
||||
|
||||
/** error codes */
|
||||
protected String[] fErrorCodes = null;
|
||||
/** error codes and error messages */
|
||||
protected String[] fErrors = null;
|
||||
|
||||
/** validation context: could be QName or XPath expression*/
|
||||
protected String fValidationContext = null;
|
||||
@ -97,10 +89,65 @@ public class ElementPSVImpl implements ElementPSVI {
|
||||
/** the schema information property */
|
||||
protected XSModel fSchemaInformation = null;
|
||||
|
||||
/** true if this object is immutable **/
|
||||
protected boolean fIsConstant;
|
||||
|
||||
public ElementPSVImpl() {}
|
||||
|
||||
public ElementPSVImpl(boolean isConstant, ElementPSVI elementPSVI) {
|
||||
fDeclaration = elementPSVI.getElementDeclaration();
|
||||
fTypeDecl = elementPSVI.getTypeDefinition();
|
||||
fNil = elementPSVI.getNil();
|
||||
fSpecified = elementPSVI.getIsSchemaSpecified();
|
||||
fValue.copyFrom(elementPSVI.getSchemaValue());
|
||||
fNotation = elementPSVI.getNotation();
|
||||
fValidationAttempted = elementPSVI.getValidationAttempted();
|
||||
fValidity = elementPSVI.getValidity();
|
||||
fValidationContext = elementPSVI.getValidationContext();
|
||||
if (elementPSVI instanceof ElementPSVImpl) {
|
||||
final ElementPSVImpl elementPSVIImpl = (ElementPSVImpl) elementPSVI;
|
||||
fErrors = (elementPSVIImpl.fErrors != null) ?
|
||||
(String[]) elementPSVIImpl.fErrors.clone() : null;
|
||||
elementPSVIImpl.copySchemaInformationTo(this);
|
||||
}
|
||||
else {
|
||||
final StringList errorCodes = elementPSVI.getErrorCodes();
|
||||
final int length = errorCodes.getLength();
|
||||
if (length > 0) {
|
||||
final StringList errorMessages = elementPSVI.getErrorMessages();
|
||||
final String[] errors = new String[length << 1];
|
||||
for (int i = 0, j = 0; i < length; ++i) {
|
||||
errors[j++] = errorCodes.item(i);
|
||||
errors[j++] = errorMessages.item(i);
|
||||
}
|
||||
fErrors = errors;
|
||||
}
|
||||
fSchemaInformation = elementPSVI.getSchemaInformation();
|
||||
}
|
||||
fIsConstant = isConstant;
|
||||
}
|
||||
|
||||
//
|
||||
// ElementPSVI methods
|
||||
//
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.xerces.xs.ItemPSVI#constant()
|
||||
*/
|
||||
public ItemPSVI constant() {
|
||||
if (isConstant()) {
|
||||
return this;
|
||||
}
|
||||
return new ElementPSVImpl(true, this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.xerces.xs.ItemPSVI#isConstant()
|
||||
*/
|
||||
public boolean isConstant() {
|
||||
return fIsConstant;
|
||||
}
|
||||
|
||||
/**
|
||||
* [schema default]
|
||||
*
|
||||
@ -119,7 +166,7 @@ public class ElementPSVImpl implements ElementPSVI {
|
||||
* @return the normalized value of this item after validation
|
||||
*/
|
||||
public String getSchemaNormalizedValue() {
|
||||
return fNormalizedValue;
|
||||
return fValue.getNormalizedValue();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,11 +206,24 @@ public class ElementPSVImpl implements ElementPSVI {
|
||||
* @return Array of error codes
|
||||
*/
|
||||
public StringList getErrorCodes() {
|
||||
if (fErrorCodes == null)
|
||||
return null;
|
||||
return new StringListImpl(fErrorCodes, fErrorCodes.length);
|
||||
if (fErrors == null || fErrors.length == 0) {
|
||||
return StringListImpl.EMPTY_LIST;
|
||||
}
|
||||
return new PSVIErrorList(fErrors, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of error messages generated from the validation attempt or
|
||||
* an empty <code>StringList</code> if no errors occurred during the
|
||||
* validation attempt. The indices of error messages in this list are
|
||||
* aligned with those in the <code>[schema error code]</code> list.
|
||||
*/
|
||||
public StringList getErrorMessages() {
|
||||
if (fErrors == null || fErrors.length == 0) {
|
||||
return StringListImpl.EMPTY_LIST;
|
||||
}
|
||||
return new PSVIErrorList(fErrors, false);
|
||||
}
|
||||
|
||||
// This is the only information we can provide in a pipeline.
|
||||
public String getValidationContext() {
|
||||
@ -207,7 +267,7 @@ public class ElementPSVImpl implements ElementPSVI {
|
||||
* @return a simple type declaration
|
||||
*/
|
||||
public XSSimpleTypeDefinition getMemberTypeDefinition() {
|
||||
return fMemberType;
|
||||
return fValue.getMemberTypeDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -237,21 +297,28 @@ public class ElementPSVImpl implements ElementPSVI {
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getActualNormalizedValue()
|
||||
*/
|
||||
public Object getActualNormalizedValue() {
|
||||
return this.fActualValue;
|
||||
return fValue.getActualValue();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getActualNormalizedValueType()
|
||||
*/
|
||||
public short getActualNormalizedValueType() {
|
||||
return this.fActualValueType;
|
||||
return fValue.getActualValueType();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getItemValueTypes()
|
||||
*/
|
||||
public ShortList getItemValueTypes() {
|
||||
return this.fItemValueTypes;
|
||||
return fValue.getListValueTypes();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getSchemaValue()
|
||||
*/
|
||||
public XSValue getSchemaValue() {
|
||||
return fValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,15 +330,15 @@ public class ElementPSVImpl implements ElementPSVI {
|
||||
fNil = false;
|
||||
fSpecified = false;
|
||||
fNotation = null;
|
||||
fMemberType = null;
|
||||
fValidationAttempted = ElementPSVI.VALIDATION_NONE;
|
||||
fValidity = ElementPSVI.VALIDITY_NOTKNOWN;
|
||||
fErrorCodes = null;
|
||||
fErrors = null;
|
||||
fValidationContext = null;
|
||||
fNormalizedValue = null;
|
||||
fActualValue = null;
|
||||
fActualValueType = XSConstants.UNAVAILABLE_DT;
|
||||
fItemValueTypes = null;
|
||||
fValue.reset();
|
||||
}
|
||||
|
||||
public void copySchemaInformationTo(ElementPSVImpl target) {
|
||||
target.fGrammars = fGrammars;
|
||||
target.fSchemaInformation = fSchemaInformation;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.xs;
|
||||
|
||||
import java.util.AbstractList;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.xs.StringList;
|
||||
|
||||
/**
|
||||
* StringList implementation for schema error codes and error messages.
|
||||
*
|
||||
* @xerces.internal
|
||||
*
|
||||
* @author Michael Glavassevich, IBM
|
||||
*
|
||||
*/
|
||||
final class PSVIErrorList extends AbstractList implements StringList {
|
||||
|
||||
private final String[] fArray;
|
||||
private final int fLength;
|
||||
private final int fOffset;
|
||||
|
||||
public PSVIErrorList(String[] array, boolean even) {
|
||||
fArray = array;
|
||||
fLength = (fArray.length >> 1);
|
||||
fOffset = even ? 0 : 1;
|
||||
}
|
||||
|
||||
public boolean contains(String item) {
|
||||
if (item == null) {
|
||||
for (int i = 0; i < fLength; ++i) {
|
||||
if (fArray[(i << 1) + fOffset] == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < fLength; ++i) {
|
||||
if (item.equals(fArray[(i << 1) + fOffset])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return fLength;
|
||||
}
|
||||
|
||||
public String item(int index) {
|
||||
if (index < 0 || index >= fLength) {
|
||||
return null;
|
||||
}
|
||||
return fArray[(index << 1) + fOffset];
|
||||
}
|
||||
|
||||
/*
|
||||
* List methods
|
||||
*/
|
||||
|
||||
public Object get(int index) {
|
||||
if (index >= 0 && index < fLength) {
|
||||
return fArray[(index << 1) + fOffset];
|
||||
}
|
||||
throw new IndexOutOfBoundsException("Index: " + index);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return getLength();
|
||||
}
|
||||
|
||||
} // class PSVIErrorList
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,9 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.xs;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo;
|
||||
@ -49,6 +47,7 @@ import com.sun.org.apache.xerces.internal.xs.XSAttributeDeclaration;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSAttributeGroupDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSElementDeclaration;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSIDCDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSModel;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSModelGroupDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSNamedMap;
|
||||
@ -59,6 +58,8 @@ import com.sun.org.apache.xerces.internal.xs.XSParticle;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSWildcard;
|
||||
import com.sun.org.apache.xerces.internal.xs.datatypes.ObjectList;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.Vector;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
@ -135,7 +136,7 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
* Default constructor.
|
||||
*
|
||||
* @param targetNamespace
|
||||
* @param grammarDesc the XMLGrammarDescription corresponding to this objec
|
||||
* @param grammarDesc the XMLGrammarDescription corresponding to this object
|
||||
* at the least a systemId should always be known.
|
||||
* @param symbolTable needed for annotation support
|
||||
*/
|
||||
@ -145,35 +146,39 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
fGrammarDescription = grammarDesc;
|
||||
fSymbolTable = symbolTable;
|
||||
|
||||
// REVISIT: do we know the numbers of the following global decls
|
||||
// when creating this grammar? If so, we can pass the numbers in,
|
||||
// and use that number to initialize the following hashtables.
|
||||
fGlobalAttrDecls = new SymbolHash();
|
||||
fGlobalAttrGrpDecls = new SymbolHash();
|
||||
fGlobalElemDecls = new SymbolHash();
|
||||
fGlobalGroupDecls = new SymbolHash();
|
||||
fGlobalNotationDecls = new SymbolHash();
|
||||
fGlobalIDConstraintDecls = new SymbolHash();
|
||||
// REVISIT: the initial sizes being chosen for each SymbolHash
|
||||
// may not be ideal and could still be tuned. They were chosen
|
||||
// somewhat arbitrarily to reduce the initial footprint of
|
||||
// SymbolHash buckets from 1,515 to 177 (about 12% of the
|
||||
// default size).
|
||||
fGlobalAttrDecls = new SymbolHash(12);
|
||||
fGlobalAttrGrpDecls = new SymbolHash(5);
|
||||
fGlobalElemDecls = new SymbolHash(25);
|
||||
fGlobalGroupDecls = new SymbolHash(5);
|
||||
fGlobalNotationDecls = new SymbolHash(1);
|
||||
fGlobalIDConstraintDecls = new SymbolHash(3);
|
||||
|
||||
// Extended tables
|
||||
fGlobalAttrDeclsExt = new SymbolHash();
|
||||
fGlobalAttrGrpDeclsExt = new SymbolHash();
|
||||
fGlobalElemDeclsExt = new SymbolHash();
|
||||
fGlobalGroupDeclsExt = new SymbolHash();
|
||||
fGlobalNotationDeclsExt = new SymbolHash();
|
||||
fGlobalIDConstraintDeclsExt = new SymbolHash();
|
||||
fGlobalTypeDeclsExt = new SymbolHash();
|
||||
fGlobalAttrDeclsExt = new SymbolHash(12);
|
||||
fGlobalAttrGrpDeclsExt = new SymbolHash(5);
|
||||
fGlobalElemDeclsExt = new SymbolHash(25);
|
||||
fGlobalGroupDeclsExt = new SymbolHash(5);
|
||||
fGlobalNotationDeclsExt = new SymbolHash(1);
|
||||
fGlobalIDConstraintDeclsExt = new SymbolHash(3);
|
||||
fGlobalTypeDeclsExt = new SymbolHash(25);
|
||||
|
||||
// All global elements table
|
||||
fAllGlobalElemDecls = new SymbolHash();
|
||||
fAllGlobalElemDecls = new SymbolHash(25);
|
||||
|
||||
// if we are parsing S4S, put built-in types in first
|
||||
// they might get overwritten by the types from S4S, but that's
|
||||
// considered what the application wants to do.
|
||||
if (fTargetNamespace == SchemaSymbols.URI_SCHEMAFORSCHEMA)
|
||||
if (fTargetNamespace == SchemaSymbols.URI_SCHEMAFORSCHEMA) {
|
||||
fGlobalTypeDecls = SG_SchemaNS.fGlobalTypeDecls.makeClone();
|
||||
else
|
||||
fGlobalTypeDecls = new SymbolHash();
|
||||
}
|
||||
else {
|
||||
fGlobalTypeDecls = new SymbolHash(25);
|
||||
}
|
||||
} // <init>(String, XSDDescription)
|
||||
|
||||
// Clone an existing schema grammar
|
||||
@ -232,7 +237,7 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
fRedefinedGroupDecls = new XSGroupDecl[grammar.fRedefinedGroupDecls.length];
|
||||
fRGLocators = new SimpleLocator[grammar.fRGLocators.length];
|
||||
System.arraycopy(grammar.fRedefinedGroupDecls, 0, fRedefinedGroupDecls, 0, fRGCount);
|
||||
System.arraycopy(grammar.fRGLocators, 0, fRGLocators, 0, fRGCount);
|
||||
System.arraycopy(grammar.fRGLocators, 0, fRGLocators, 0, fRGCount/2);
|
||||
}
|
||||
|
||||
// List of imported grammars
|
||||
@ -626,19 +631,19 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
// fill complex types
|
||||
annotationType.setValues("#AnonType_" + SchemaSymbols.ELT_ANNOTATION, fTargetNamespace, SchemaGrammar.fAnyType,
|
||||
XSConstants.DERIVATION_RESTRICTION, XSConstants.DERIVATION_NONE, (short) (XSConstants.DERIVATION_EXTENSION | XSConstants.DERIVATION_RESTRICTION),
|
||||
XSComplexTypeDecl.CONTENTTYPE_ELEMENT, false, annotationAttrs, null, annotationParticle, new XSObjectListImpl(null, 0));
|
||||
XSComplexTypeDecl.CONTENTTYPE_ELEMENT, false, annotationAttrs, null, annotationParticle, XSObjectListImpl.EMPTY_LIST);
|
||||
annotationType.setName("#AnonType_" + SchemaSymbols.ELT_ANNOTATION);
|
||||
annotationType.setIsAnonymous();
|
||||
|
||||
documentationType.setValues("#AnonType_" + SchemaSymbols.ELT_DOCUMENTATION, fTargetNamespace, SchemaGrammar.fAnyType,
|
||||
XSConstants.DERIVATION_RESTRICTION, XSConstants.DERIVATION_NONE, (short) (XSConstants.DERIVATION_EXTENSION | XSConstants.DERIVATION_RESTRICTION),
|
||||
XSComplexTypeDecl.CONTENTTYPE_MIXED, false, documentationAttrs, null, anyWCSequenceParticle, new XSObjectListImpl(null, 0));
|
||||
XSComplexTypeDecl.CONTENTTYPE_MIXED, false, documentationAttrs, null, anyWCSequenceParticle, XSObjectListImpl.EMPTY_LIST);
|
||||
documentationType.setName("#AnonType_" + SchemaSymbols.ELT_DOCUMENTATION);
|
||||
documentationType.setIsAnonymous();
|
||||
|
||||
appinfoType.setValues("#AnonType_" + SchemaSymbols.ELT_APPINFO, fTargetNamespace, SchemaGrammar.fAnyType,
|
||||
XSConstants.DERIVATION_RESTRICTION, XSConstants.DERIVATION_NONE, (short) (XSConstants.DERIVATION_EXTENSION | XSConstants.DERIVATION_RESTRICTION),
|
||||
XSComplexTypeDecl.CONTENTTYPE_MIXED, false, appinfoAttrs, null, anyWCSequenceParticle, new XSObjectListImpl(null, 0));
|
||||
XSComplexTypeDecl.CONTENTTYPE_MIXED, false, appinfoAttrs, null, anyWCSequenceParticle, XSObjectListImpl.EMPTY_LIST);
|
||||
appinfoType.setName("#AnonType_" + SchemaSymbols.ELT_APPINFO);
|
||||
appinfoType.setIsAnonymous();
|
||||
|
||||
@ -1178,8 +1183,8 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
fDerivedBy = XSConstants.DERIVATION_RESTRICTION;
|
||||
fContentType = XSComplexTypeDecl.CONTENTTYPE_MIXED;
|
||||
|
||||
fParticle = null;
|
||||
fAttrGrp = null;
|
||||
fParticle = createParticle();
|
||||
fAttrGrp = createAttrGrp();
|
||||
}
|
||||
|
||||
// overridden methods
|
||||
@ -1211,11 +1216,15 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
// null implementation
|
||||
}
|
||||
|
||||
public XSObjectList getAttributeUses() {
|
||||
public XSObjectList getAnnotations() {
|
||||
return XSObjectListImpl.EMPTY_LIST;
|
||||
}
|
||||
|
||||
public XSAttributeGroupDecl getAttrGrp() {
|
||||
public XSNamespaceItem getNamespaceItem() {
|
||||
return SG_SchemaNS;
|
||||
}
|
||||
|
||||
private XSAttributeGroupDecl createAttrGrp() {
|
||||
XSWildcardDecl wildcard = new XSWildcardDecl();
|
||||
wildcard.fProcessContents = XSWildcardDecl.PC_LAX;
|
||||
XSAttributeGroupDecl attrGrp = new XSAttributeGroupDecl();
|
||||
@ -1223,13 +1232,7 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
return attrGrp;
|
||||
}
|
||||
|
||||
public XSWildcard getAttributeWildcard() {
|
||||
XSWildcardDecl wildcard = new XSWildcardDecl();
|
||||
wildcard.fProcessContents = XSWildcardDecl.PC_LAX;
|
||||
return wildcard;
|
||||
}
|
||||
|
||||
public XSParticle getParticle() {
|
||||
private XSParticleDecl createParticle() {
|
||||
// the wildcard used in anyType (content and attribute)
|
||||
// the spec will change strict to skip for anyType
|
||||
XSWildcardDecl wildcard = new XSWildcardDecl();
|
||||
@ -1253,14 +1256,6 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
|
||||
return particleG;
|
||||
}
|
||||
|
||||
public XSObjectList getAnnotations() {
|
||||
return XSObjectListImpl.EMPTY_LIST;
|
||||
}
|
||||
|
||||
public XSNamespaceItem getNamespaceItem() {
|
||||
return SG_SchemaNS;
|
||||
}
|
||||
}
|
||||
private static class BuiltinAttrDecl extends XSAttributeDecl {
|
||||
public BuiltinAttrDecl(String name, String tns,
|
||||
@ -1347,7 +1342,7 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
false, // model group
|
||||
false, // particle
|
||||
false, // wildcard
|
||||
false, // idc
|
||||
true, // idc
|
||||
true, // notation
|
||||
false, // annotation
|
||||
false, // facet
|
||||
@ -1484,6 +1479,9 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
case XSConstants.NOTATION_DECLARATION:
|
||||
table = fGlobalNotationDecls;
|
||||
break;
|
||||
case XSConstants.IDENTITY_CONSTRAINT:
|
||||
table = this.fGlobalIDConstraintDecls;
|
||||
break;
|
||||
}
|
||||
|
||||
// for complex/simple types, create a special implementation,
|
||||
@ -1533,6 +1531,9 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
case XSConstants.NOTATION_DECLARATION:
|
||||
table = fGlobalNotationDeclsExt;
|
||||
break;
|
||||
case XSConstants.IDENTITY_CONSTRAINT:
|
||||
table = this.fGlobalIDConstraintDeclsExt;
|
||||
break;
|
||||
}
|
||||
|
||||
Object[] entries = table.getEntries();
|
||||
@ -1610,6 +1611,10 @@ public class SchemaGrammar implements XSGrammar, XSNamespaceItem {
|
||||
return getGlobalNotationDecl(name);
|
||||
}
|
||||
|
||||
public XSIDCDefinition getIDCDefinition(String name) {
|
||||
return getIDConstraintDecl(name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [document location]
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -40,14 +41,14 @@ public class SubstitutionGroupHandler {
|
||||
|
||||
private static final XSElementDecl[] EMPTY_GROUP = new XSElementDecl[0];
|
||||
|
||||
// grammar resolver
|
||||
XSGrammarBucket fGrammarBucket;
|
||||
// global element declaration resolver
|
||||
private final XSElementDeclHelper fXSElementDeclHelper;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public SubstitutionGroupHandler(XSGrammarBucket grammarBucket) {
|
||||
fGrammarBucket = grammarBucket;
|
||||
public SubstitutionGroupHandler(XSElementDeclHelper elementDeclHelper) {
|
||||
fXSElementDeclHelper = elementDeclHelper;
|
||||
}
|
||||
|
||||
// 3.9.4 Element Sequence Locally Valid (Particle) 2.3.3
|
||||
@ -60,26 +61,25 @@ public class SubstitutionGroupHandler {
|
||||
|
||||
// if the exemplar is not a global element decl, then it's not possible
|
||||
// to be substituted by another element.
|
||||
if (exemplar.fScope != XSConstants.SCOPE_GLOBAL)
|
||||
if (exemplar.fScope != XSConstants.SCOPE_GLOBAL) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// if the decl blocks substitution, return false
|
||||
if ((exemplar.fBlock & XSConstants.DERIVATION_SUBSTITUTION) != 0)
|
||||
return null;
|
||||
|
||||
// get grammar of the element
|
||||
SchemaGrammar sGrammar = fGrammarBucket.getGrammar(element.uri);
|
||||
if (sGrammar == null)
|
||||
if ((exemplar.fBlock & XSConstants.DERIVATION_SUBSTITUTION) != 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// get the decl for the element
|
||||
XSElementDecl eDecl = sGrammar.getGlobalElementDecl(element.localpart);
|
||||
if (eDecl == null)
|
||||
XSElementDecl eDecl = fXSElementDeclHelper.getGlobalElementDecl(element);
|
||||
if (eDecl == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// and check by using substitutionGroup information
|
||||
if (substitutionGroupOK(eDecl, exemplar, exemplar.fBlock))
|
||||
if (substitutionGroupOK(eDecl, exemplar, exemplar.fBlock)) {
|
||||
return eDecl;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -89,13 +89,15 @@ public class SubstitutionGroupHandler {
|
||||
protected boolean substitutionGroupOK(XSElementDecl element, XSElementDecl exemplar, short blockingConstraint) {
|
||||
// For an element declaration (call it D) to be validly substitutable for another element declaration (call it C) subject to a blocking constraint (a subset of {substitution, extension, restriction}, the value of a {disallowed substitutions}) one of the following must be true:
|
||||
// 1. D and C are the same element declaration.
|
||||
if (element == exemplar)
|
||||
if (element == exemplar) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 2 All of the following must be true:
|
||||
// 2.1 The blocking constraint does not contain substitution.
|
||||
if ((blockingConstraint & XSConstants.DERIVATION_SUBSTITUTION) != 0)
|
||||
if ((blockingConstraint & XSConstants.DERIVATION_SUBSTITUTION) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2.2 There is a chain of {substitution group affiliation}s from D to C, that is, either D's {substitution group affiliation} is C, or D's {substitution group affiliation}'s {substitution group affiliation} is C, or . . .
|
||||
XSElementDecl subGroup = element.fSubGroup;
|
||||
@ -103,14 +105,16 @@ public class SubstitutionGroupHandler {
|
||||
subGroup = subGroup.fSubGroup;
|
||||
}
|
||||
|
||||
if (subGroup == null)
|
||||
if (subGroup == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2.3 The set of all {derivation method}s involved in the derivation of D's {type definition} from C's {type definition} does not intersect with the union of the blocking constraint, C's {prohibited substitutions} (if C is complex, otherwise the empty set) and the {prohibited substitutions} (respectively the empty set) of any intermediate {type definition}s in the derivation of D's {type definition} from C's {type definition}.
|
||||
// prepare the combination of {derivation method} and
|
||||
// {disallowed substitution}
|
||||
return typeDerivationOK(element.fType, exemplar.fType, blockingConstraint);
|
||||
}
|
||||
|
||||
private boolean typeDerivationOK(XSTypeDefinition derived, XSTypeDefinition base, short blockingConstraint) {
|
||||
|
||||
short devMethod = 0, blockConstraint = blockingConstraint;
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2000-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,26 +20,12 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.xs;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl;
|
||||
import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.dom.DOMStringListImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
|
||||
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.DVFactoryException;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl;
|
||||
@ -49,13 +35,16 @@ import com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler;
|
||||
import com.sun.org.apache.xerces.internal.util.DOMEntityResolverWrapper;
|
||||
import com.sun.org.apache.xerces.internal.util.DOMErrorHandlerWrapper;
|
||||
import com.sun.org.apache.xerces.internal.util.DefaultErrorHandler;
|
||||
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
|
||||
import com.sun.org.apache.xerces.internal.util.Status;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
|
||||
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
|
||||
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription;
|
||||
@ -72,14 +61,26 @@ import com.sun.org.apache.xerces.internal.xs.LSInputList;
|
||||
import com.sun.org.apache.xerces.internal.xs.StringList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSLoader;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSModel;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.WeakHashMap;
|
||||
import javax.xml.XMLConstants;
|
||||
import org.w3c.dom.DOMConfiguration;
|
||||
import org.w3c.dom.DOMError;
|
||||
import org.w3c.dom.DOMErrorHandler;
|
||||
import org.w3c.dom.DOMStringList;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.DOMStringList;
|
||||
import org.w3c.dom.ls.LSInput;
|
||||
import org.w3c.dom.ls.LSResourceResolver;
|
||||
import org.xml.sax.InputSource;
|
||||
@ -101,7 +102,7 @@ import org.xml.sax.InputSource;
|
||||
* @author Neil Graham, IBM
|
||||
*/
|
||||
|
||||
public class XMLSchemaLoader implements XMLGrammarLoader, XMLComponent,
|
||||
public class XMLSchemaLoader implements XMLGrammarLoader, XMLComponent, XSElementDeclHelper,
|
||||
// XML Component API
|
||||
XSLoader, DOMConfiguration {
|
||||
|
||||
@ -249,8 +250,7 @@ XSLoader, DOMConfiguration {
|
||||
// Data
|
||||
|
||||
// features and properties
|
||||
private ParserConfigurationSettings fLoaderConfig = new ParserConfigurationSettings();
|
||||
private SymbolTable fSymbolTable = null;
|
||||
private final ParserConfigurationSettings fLoaderConfig = new ParserConfigurationSettings();
|
||||
private XMLErrorReporter fErrorReporter = new XMLErrorReporter ();
|
||||
private XMLEntityManager fEntityManager = null;
|
||||
private XMLEntityResolver fUserEntityResolver = null;
|
||||
@ -276,7 +276,7 @@ XSLoader, DOMConfiguration {
|
||||
private XSDDescription fXSDDescription = new XSDDescription();
|
||||
private String faccessExternalSchema = Constants.EXTERNAL_ACCESS_DEFAULT;
|
||||
|
||||
private Map fJAXPCache;
|
||||
private WeakHashMap fJAXPCache;
|
||||
private Locale fLocale = Locale.getDefault();
|
||||
|
||||
// XSLoader attributes
|
||||
@ -350,8 +350,8 @@ XSLoader, DOMConfiguration {
|
||||
grammarBucket = new XSGrammarBucket();
|
||||
}
|
||||
fGrammarBucket = grammarBucket;
|
||||
if(sHandler == null) {
|
||||
sHandler = new SubstitutionGroupHandler(fGrammarBucket);
|
||||
if (sHandler == null) {
|
||||
sHandler = new SubstitutionGroupHandler(this);
|
||||
}
|
||||
fSubGroupHandler = sHandler;
|
||||
|
||||
@ -360,10 +360,7 @@ XSLoader, DOMConfiguration {
|
||||
}
|
||||
fCMBuilder = builder;
|
||||
fSchemaHandler = new XSDHandler(fGrammarBucket);
|
||||
if (fDeclPool != null) {
|
||||
fDeclPool.reset();
|
||||
}
|
||||
fJAXPCache = new HashMap();
|
||||
fJAXPCache = new WeakHashMap();
|
||||
|
||||
fSettingsChanged = true;
|
||||
}
|
||||
@ -527,8 +524,8 @@ XSLoader, DOMConfiguration {
|
||||
* Returns a Grammar object by parsing the contents of the
|
||||
* entities pointed to by sources.
|
||||
*
|
||||
* @param source[] the locations of the entity which forms
|
||||
* the staring point of the grammars to be constructed
|
||||
* @param source the locations of the entity which forms
|
||||
* the staring point of the grammars to be constructed
|
||||
* @throws IOException when a problem is encounted reading the entity
|
||||
* @throws XNIException when a condition arises (such as a FatalError) that requires parsing
|
||||
* of the entity be terminated
|
||||
@ -618,7 +615,8 @@ XSLoader, DOMConfiguration {
|
||||
return grammar;
|
||||
} // loadSchema(XSDDescription, XMLInputSource): SchemaGrammar
|
||||
|
||||
/** This method tries to resolve location of the given schema.
|
||||
/**
|
||||
* This method tries to resolve location of the given schema.
|
||||
* The loader stores the namespace/location pairs in a hashtable (use "" as the
|
||||
* namespace of absent namespace). When resolving an entity, loader first tries
|
||||
* to find in the hashtable whether there is a value for that namespace,
|
||||
@ -627,7 +625,7 @@ XSLoader, DOMConfiguration {
|
||||
* @param desc
|
||||
* @param locationPairs
|
||||
* @param entityResolver
|
||||
* @return
|
||||
* @return the XMLInputSource
|
||||
* @throws IOException
|
||||
*/
|
||||
public static XMLInputSource resolveDocument(XSDDescription desc, Map locationPairs,
|
||||
@ -671,7 +669,7 @@ XSLoader, DOMConfiguration {
|
||||
XSAttributeDecl attrDecl = SchemaGrammar.SG_XSI.getGlobalAttributeDecl(SchemaSymbols.XSI_SCHEMALOCATION);
|
||||
// validation the string value to get the list of URI's
|
||||
attrDecl.fType.validate(sl, null, null);
|
||||
if (!tokenizeSchemaLocationStr(sl, locations)) {
|
||||
if (!tokenizeSchemaLocationStr(sl, locations, null)) {
|
||||
// report warning (odd number of items)
|
||||
er.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
|
||||
"SchemaLocation",
|
||||
@ -714,7 +712,7 @@ XSLoader, DOMConfiguration {
|
||||
// @param schemaStr The schemaLocation string to tokenize
|
||||
// @param locations HashMap mapping namespaces to LocationArray objects holding lists of locaitons
|
||||
// @return true if no problems; false if string could not be tokenized
|
||||
public static boolean tokenizeSchemaLocationStr(String schemaStr, Map locations) {
|
||||
public static boolean tokenizeSchemaLocationStr(String schemaStr, Map locations, String base) {
|
||||
if (schemaStr!= null) {
|
||||
StringTokenizer t = new StringTokenizer(schemaStr, " \n\t\r");
|
||||
String namespace, location;
|
||||
@ -729,6 +727,12 @@ XSLoader, DOMConfiguration {
|
||||
la = new LocationArray();
|
||||
locations.put(namespace, la);
|
||||
}
|
||||
if (base != null) {
|
||||
try {
|
||||
location = XMLEntityManager.expandSystemId(location, base, false);
|
||||
} catch (MalformedURIException e) {
|
||||
}
|
||||
}
|
||||
la.addLocation(location);
|
||||
}
|
||||
}
|
||||
@ -756,10 +760,10 @@ XSLoader, DOMConfiguration {
|
||||
String sid = null;
|
||||
if (componentType == null) {
|
||||
// Not an array
|
||||
if(fJAXPSource instanceof InputStream ||
|
||||
if (fJAXPSource instanceof InputStream ||
|
||||
fJAXPSource instanceof InputSource) {
|
||||
SchemaGrammar g = (SchemaGrammar)fJAXPCache.get(fJAXPSource);
|
||||
if(g != null) {
|
||||
if (g != null) {
|
||||
fGrammarBucket.putGrammar(g);
|
||||
return;
|
||||
}
|
||||
@ -776,38 +780,40 @@ XSLoader, DOMConfiguration {
|
||||
}
|
||||
SchemaGrammar g = loadSchema(fXSDDescription, xis, locationPairs);
|
||||
// it is possible that we won't be able to resolve JAXP schema-source location
|
||||
if (g != null){
|
||||
if(fJAXPSource instanceof InputStream ||
|
||||
if (g != null) {
|
||||
if (fJAXPSource instanceof InputStream ||
|
||||
fJAXPSource instanceof InputSource) {
|
||||
fJAXPCache.put(fJAXPSource, g);
|
||||
if(fIsCheckedFully) {
|
||||
if (fIsCheckedFully) {
|
||||
XSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter);
|
||||
}
|
||||
}
|
||||
fGrammarBucket.putGrammar(g);
|
||||
}
|
||||
return ;
|
||||
} else if ( (componentType != Object.class) &&
|
||||
return;
|
||||
}
|
||||
else if ( (componentType != Object.class) &&
|
||||
(componentType != String.class) &&
|
||||
(componentType != File.class) &&
|
||||
(componentType != InputStream.class) &&
|
||||
(componentType != InputSource.class)
|
||||
!File.class.isAssignableFrom(componentType) &&
|
||||
!InputStream.class.isAssignableFrom(componentType) &&
|
||||
!InputSource.class.isAssignableFrom(componentType) &&
|
||||
!componentType.isInterface()
|
||||
) {
|
||||
// Not an Object[], String[], File[], InputStream[], InputSource[]
|
||||
MessageFormatter mf = fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN);
|
||||
throw new XMLConfigurationException(
|
||||
Status.NOT_SUPPORTED, "\""+JAXP_SCHEMA_SOURCE+
|
||||
"\" property cannot have an array of type {"+componentType.getName()+
|
||||
"}. Possible types of the array supported are Object, String, File, "+
|
||||
"InputStream, InputSource.");
|
||||
Status.NOT_SUPPORTED,
|
||||
mf.formatMessage(fErrorReporter.getLocale(), "jaxp12-schema-source-type.2",
|
||||
new Object [] {componentType.getName()}));
|
||||
}
|
||||
|
||||
// JAXP spec. allow []s of type String, File, InputStream,
|
||||
// InputSource also, apart from [] of type Object.
|
||||
Object[] objArr = (Object[]) fJAXPSource;
|
||||
//make local vector for storing targetn namespaces of schemasources specified in object arrays.
|
||||
Vector jaxpSchemaSourceNamespaces = new Vector() ;
|
||||
// make local array for storing target namespaces of schemasources specified in object arrays.
|
||||
ArrayList jaxpSchemaSourceNamespaces = new ArrayList();
|
||||
for (int i = 0; i < objArr.length; i++) {
|
||||
if(objArr[i] instanceof InputStream ||
|
||||
if (objArr[i] instanceof InputStream ||
|
||||
objArr[i] instanceof InputSource) {
|
||||
SchemaGrammar g = (SchemaGrammar)fJAXPCache.get(objArr[i]);
|
||||
if (g != null) {
|
||||
@ -829,18 +835,18 @@ XSLoader, DOMConfiguration {
|
||||
// load schema
|
||||
SchemaGrammar grammar = fSchemaHandler.parseSchema(xis,fXSDDescription, locationPairs);
|
||||
|
||||
if(fIsCheckedFully) {
|
||||
if (fIsCheckedFully) {
|
||||
XSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter);
|
||||
}
|
||||
if(grammar != null){
|
||||
targetNamespace = grammar.getTargetNamespace() ;
|
||||
if(jaxpSchemaSourceNamespaces.contains(targetNamespace)){
|
||||
//when an array of objects is passed it is illegal to have two schemas that share same namespace.
|
||||
throw new java.lang.IllegalArgumentException(
|
||||
" When using array of Objects as the value of SCHEMA_SOURCE property , " +
|
||||
"no two Schemas should share the same targetNamespace. " );
|
||||
if (grammar != null) {
|
||||
targetNamespace = grammar.getTargetNamespace();
|
||||
if (jaxpSchemaSourceNamespaces.contains(targetNamespace)) {
|
||||
// when an array of objects is passed it is illegal to have two schemas that share same namespace.
|
||||
MessageFormatter mf = fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN);
|
||||
throw new java.lang.IllegalArgumentException(mf.formatMessage(fErrorReporter.getLocale(),
|
||||
"jaxp12-schema-source-ns", null));
|
||||
}
|
||||
else{
|
||||
else {
|
||||
jaxpSchemaSourceNamespaces.add(targetNamespace) ;
|
||||
}
|
||||
if(objArr[i] instanceof InputStream ||
|
||||
@ -849,15 +855,13 @@ XSLoader, DOMConfiguration {
|
||||
}
|
||||
fGrammarBucket.putGrammar(grammar);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
//REVISIT: What should be the acutal behavior if grammar can't be loaded as specified in schema source?
|
||||
}
|
||||
}
|
||||
}//processJAXPSchemaSource
|
||||
|
||||
private XMLInputSource xsdToXMLInputSource(
|
||||
Object val)
|
||||
{
|
||||
private XMLInputSource xsdToXMLInputSource(Object val) {
|
||||
if (val instanceof String) {
|
||||
// String value is treated as a URI that is passed through the
|
||||
// EntityResolver
|
||||
@ -867,7 +871,8 @@ XSLoader, DOMConfiguration {
|
||||
XMLInputSource xis = null;
|
||||
try {
|
||||
xis = fEntityManager.resolveEntity(fXSDDescription);
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
catch (IOException ex) {
|
||||
fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
|
||||
"schema_reference.4",
|
||||
new Object[] { loc }, XMLErrorReporter.SEVERITY_ERROR);
|
||||
@ -878,12 +883,15 @@ XSLoader, DOMConfiguration {
|
||||
return new XMLInputSource(null, loc, null);
|
||||
}
|
||||
return xis;
|
||||
} else if (val instanceof InputSource) {
|
||||
}
|
||||
else if (val instanceof InputSource) {
|
||||
return saxToXMLInputSource((InputSource) val);
|
||||
} else if (val instanceof InputStream) {
|
||||
}
|
||||
else if (val instanceof InputStream) {
|
||||
return new XMLInputSource(null, null, null,
|
||||
(InputStream) val, null);
|
||||
} else if (val instanceof File) {
|
||||
}
|
||||
else if (val instanceof File) {
|
||||
File file = (File) val;
|
||||
InputStream is = null;
|
||||
try {
|
||||
@ -893,13 +901,13 @@ XSLoader, DOMConfiguration {
|
||||
"schema_reference.4", new Object[] { file.toString() },
|
||||
XMLErrorReporter.SEVERITY_ERROR);
|
||||
}
|
||||
return new XMLInputSource(null, null, null, is, null);
|
||||
return new XMLInputSource(null, file.toURI().toString(), null, is, null);
|
||||
}
|
||||
MessageFormatter mf = fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN);
|
||||
throw new XMLConfigurationException(
|
||||
Status.NOT_SUPPORTED, "\""+JAXP_SCHEMA_SOURCE+
|
||||
"\" property cannot have a value of type {"+val.getClass().getName()+
|
||||
"}. Possible types of the value supported are String, File, InputStream, "+
|
||||
"InputSource OR an array of these types.");
|
||||
Status.NOT_SUPPORTED,
|
||||
mf.formatMessage(fErrorReporter.getLocale(), "jaxp12-schema-source-type.1",
|
||||
new Object [] {val != null ? val.getClass().getName() : "null"}));
|
||||
}
|
||||
|
||||
|
||||
@ -999,13 +1007,22 @@ XSLoader, DOMConfiguration {
|
||||
|
||||
fSubGroupHandler.reset();
|
||||
|
||||
boolean parser_settings = componentManager.getFeature(PARSER_SETTINGS, true);
|
||||
boolean parser_settings = true;
|
||||
// If the component manager is the loader config don't bother querying it since it doesn't
|
||||
// recognize the PARSER_SETTINGS feature. Prevents an XMLConfigurationException from being
|
||||
// thrown.
|
||||
if (componentManager != fLoaderConfig) {
|
||||
parser_settings = componentManager.getFeature(PARSER_SETTINGS, true);
|
||||
}
|
||||
|
||||
if (!parser_settings || !fSettingsChanged){
|
||||
// need to reprocess JAXP schema sources
|
||||
fJAXPProcessed = false;
|
||||
// reinitialize grammar bucket
|
||||
initGrammarBucket();
|
||||
if (fDeclPool != null) {
|
||||
fDeclPool.reset();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1028,26 +1045,6 @@ XSLoader, DOMConfiguration {
|
||||
fSchemaHandler.setDVFactory(dvFactory);
|
||||
}
|
||||
|
||||
boolean psvi = componentManager.getFeature(AUGMENT_PSVI, false);
|
||||
|
||||
if (!psvi) {
|
||||
if (fDeclPool != null) {
|
||||
fDeclPool.reset();
|
||||
}
|
||||
else {
|
||||
fDeclPool = new XSDeclarationPool();
|
||||
}
|
||||
fCMBuilder.setDeclPool(fDeclPool);
|
||||
fSchemaHandler.setDeclPool(fDeclPool);
|
||||
if (dvFactory instanceof SchemaDVFactoryImpl) {
|
||||
fDeclPool.setDVFactory((SchemaDVFactoryImpl)dvFactory);
|
||||
((SchemaDVFactoryImpl)dvFactory).setDeclPool(fDeclPool);
|
||||
}
|
||||
} else {
|
||||
fCMBuilder.setDeclPool(null);
|
||||
fSchemaHandler.setDeclPool(null);
|
||||
}
|
||||
|
||||
// get schema location properties
|
||||
try {
|
||||
fExternalSchemas = (String) componentManager.getProperty(SCHEMA_LOCATION);
|
||||
@ -1064,6 +1061,36 @@ XSLoader, DOMConfiguration {
|
||||
// clear grammars, and put the one for schema namespace there
|
||||
fGrammarPool = (XMLGrammarPool) componentManager.getProperty(XMLGRAMMAR_POOL, null);
|
||||
initGrammarBucket();
|
||||
|
||||
boolean psvi = componentManager.getFeature(AUGMENT_PSVI, false);
|
||||
|
||||
// Only use the decl pool when there is no chance that the schema
|
||||
// components will be exposed or cached.
|
||||
// TODO: when someone calls loadGrammar(XMLInputSource), the schema is
|
||||
// always exposed even without the use of a grammar pool.
|
||||
// Disabling the "decl pool" feature for now until we understand when
|
||||
// it can be safely used.
|
||||
if (!psvi && fGrammarPool == null && false) {
|
||||
if (fDeclPool != null) {
|
||||
fDeclPool.reset();
|
||||
}
|
||||
else {
|
||||
fDeclPool = new XSDeclarationPool();
|
||||
}
|
||||
fCMBuilder.setDeclPool(fDeclPool);
|
||||
fSchemaHandler.setDeclPool(fDeclPool);
|
||||
if (dvFactory instanceof SchemaDVFactoryImpl) {
|
||||
fDeclPool.setDVFactory((SchemaDVFactoryImpl)dvFactory);
|
||||
((SchemaDVFactoryImpl)dvFactory).setDeclPool(fDeclPool);
|
||||
}
|
||||
} else {
|
||||
fCMBuilder.setDeclPool(null);
|
||||
fSchemaHandler.setDeclPool(null);
|
||||
if (dvFactory instanceof SchemaDVFactoryImpl) {
|
||||
((SchemaDVFactoryImpl)dvFactory).setDeclPool(null);
|
||||
}
|
||||
}
|
||||
|
||||
// get continue-after-fatal-error feature
|
||||
try {
|
||||
boolean fatalError = componentManager.getFeature(CONTINUE_AFTER_FATAL_ERROR, false);
|
||||
@ -1083,7 +1110,8 @@ XSLoader, DOMConfiguration {
|
||||
private void initGrammarBucket(){
|
||||
if(fGrammarPool != null) {
|
||||
Grammar [] initialGrammars = fGrammarPool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
|
||||
for (int i = 0; i < initialGrammars.length; i++) {
|
||||
final int length = (initialGrammars != null) ? initialGrammars.length : 0;
|
||||
for (int i = 0; i < length; ++i) {
|
||||
// put this grammar into the bucket, along with grammars
|
||||
// imported by it (directly or indirectly)
|
||||
if (!fGrammarBucket.putGrammar((SchemaGrammar)(initialGrammars[i]), true)) {
|
||||
@ -1119,7 +1147,7 @@ XSLoader, DOMConfiguration {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.XSLoader#loadInputList(com.sun.org.apache.xerces.internal.xs.DOMInputList)
|
||||
* @see com.sun.org.apache.xerces.internal.xs.XSLoader#loadInputList(com.sun.org.apache.xerces.internal.xs.LSInputList)
|
||||
*/
|
||||
public XSModel loadInputList(LSInputList is) {
|
||||
int length = is.getLength();
|
||||
@ -1250,7 +1278,7 @@ XSLoader, DOMConfiguration {
|
||||
*/
|
||||
public DOMStringList getParameterNames() {
|
||||
if (fRecognizedParameters == null){
|
||||
Vector v = new Vector();
|
||||
ArrayList v = new ArrayList();
|
||||
v.add(Constants.DOM_VALIDATE);
|
||||
v.add(Constants.DOM_ERROR_HANDLER);
|
||||
v.add(Constants.DOM_RESOURCE_RESOLVER);
|
||||
@ -1391,4 +1419,13 @@ XSLoader, DOMConfiguration {
|
||||
return xis;
|
||||
}
|
||||
|
||||
// Implements XSElementDeclHelper interface
|
||||
public XSElementDecl getGlobalElementDecl(QName element) {
|
||||
SchemaGrammar sGrammar = fGrammarBucket.getGrammar(element.uri);
|
||||
if (sGrammar != null) {
|
||||
return sGrammar.getGlobalElementDecl(element.localpart);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
} // XMLGrammarLoader
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -32,6 +33,7 @@ import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSObjectList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSValue;
|
||||
|
||||
/**
|
||||
* The XML representation for an attribute declaration
|
||||
@ -211,4 +213,8 @@ public class XSAttributeDecl implements XSAttributeDeclaration {
|
||||
fDefault.itemValueTypes;
|
||||
}
|
||||
|
||||
public XSValue getValueConstraintValue() {
|
||||
return fDefault;
|
||||
}
|
||||
|
||||
} // class XSAttributeDecl
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 1999-2002,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -28,6 +29,7 @@ import com.sun.org.apache.xerces.internal.xs.XSAttributeUse;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSObjectList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSValue;
|
||||
|
||||
/**
|
||||
* The XML representation for an attribute use
|
||||
@ -142,6 +144,10 @@ public class XSAttributeUseImpl implements XSAttributeUse {
|
||||
fDefault.itemValueTypes;
|
||||
}
|
||||
|
||||
public XSValue getValueConstraintValue() {
|
||||
return fDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Annotations.
|
||||
*/
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -77,7 +78,7 @@ public class XSComplexTypeDecl implements XSComplexTypeDefinition, TypeInfo {
|
||||
volatile XSCMValidator fCMValidator = null;
|
||||
|
||||
// the content model that's sufficient for computing UPA
|
||||
XSCMValidator fUPACMValidator = null;
|
||||
volatile XSCMValidator fUPACMValidator = null;
|
||||
|
||||
// list of annotations affiliated with this type
|
||||
XSObjectListImpl fAnnotations = null;
|
||||
@ -165,12 +166,28 @@ public class XSComplexTypeDecl implements XSComplexTypeDefinition, TypeInfo {
|
||||
fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY) {
|
||||
return null;
|
||||
}
|
||||
if (fCMValidator == null)
|
||||
synchronized (this) {
|
||||
if (fCMValidator == null) {
|
||||
fCMValidator = cmBuilder.getContentModel(this);
|
||||
if (fCMValidator == null) {
|
||||
fCMValidator = getContentModel(cmBuilder, false);
|
||||
}
|
||||
return fCMValidator;
|
||||
}
|
||||
|
||||
public synchronized XSCMValidator getContentModel(CMBuilder cmBuilder, boolean forUPA) {
|
||||
if (fCMValidator == null) {
|
||||
if (forUPA) {
|
||||
if (fUPACMValidator == null) {
|
||||
fUPACMValidator = cmBuilder.getContentModel(this, true);
|
||||
|
||||
if (fUPACMValidator != null && !fUPACMValidator.isCompactedForUPA()) {
|
||||
fCMValidator = fUPACMValidator;
|
||||
}
|
||||
}
|
||||
return fUPACMValidator;
|
||||
}
|
||||
else {
|
||||
fCMValidator = cmBuilder.getContentModel(this, false);
|
||||
}
|
||||
}
|
||||
return fCMValidator;
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 1999-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -488,7 +489,7 @@ public class XSConstraints {
|
||||
}
|
||||
// 3. UPA
|
||||
// get the content model and check UPA
|
||||
XSCMValidator cm = types[j].getContentModel(cmBuilder);
|
||||
XSCMValidator cm = types[j].getContentModel(cmBuilder, true);
|
||||
further = false;
|
||||
if (cm != null) {
|
||||
try {
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -34,6 +35,7 @@ import com.sun.org.apache.xerces.internal.xs.XSNamedMap;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSObjectList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSValue;
|
||||
|
||||
/**
|
||||
* The XML representation for an element declaration
|
||||
@ -384,4 +386,8 @@ public class XSElementDecl implements XSElementDeclaration {
|
||||
fDefault.itemValueTypes;
|
||||
}
|
||||
|
||||
public XSValue getValueConstraintValue() {
|
||||
return fDefault;
|
||||
}
|
||||
|
||||
} // class XSElementDecl
|
||||
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.xs;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
|
||||
/**
|
||||
* @xerces.internal
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface XSElementDeclHelper {
|
||||
|
||||
public XSElementDecl getGlobalElementDecl(QName element);
|
||||
}
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2002-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,13 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.xs;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.AbstractList;
|
||||
import java.util.Iterator;
|
||||
import java.util.ListIterator;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.XSNamedMap4Types;
|
||||
@ -39,6 +33,7 @@ import com.sun.org.apache.xerces.internal.xs.XSAttributeDeclaration;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSAttributeGroupDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSConstants;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSElementDeclaration;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSIDCDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSModel;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSModelGroupDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSNamedMap;
|
||||
@ -48,6 +43,12 @@ import com.sun.org.apache.xerces.internal.xs.XSNotationDeclaration;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSObject;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSObjectList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.AbstractList;
|
||||
import java.util.Iterator;
|
||||
import java.util.ListIterator;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Implements XSModel: a read-only interface that represents an XML Schema,
|
||||
@ -72,7 +73,7 @@ public final class XSModelImpl extends AbstractList implements XSModel, XSNamesp
|
||||
false, // model group
|
||||
false, // particle
|
||||
false, // wildcard
|
||||
false, // idc
|
||||
true, // idc
|
||||
true, // notation
|
||||
false, // annotation
|
||||
false, // facet
|
||||
@ -326,6 +327,9 @@ public final class XSModelImpl extends AbstractList implements XSModel, XSNamesp
|
||||
case XSConstants.NOTATION_DECLARATION:
|
||||
tables[i] = fGrammarList[i].fGlobalNotationDecls;
|
||||
break;
|
||||
case XSConstants.IDENTITY_CONSTRAINT:
|
||||
tables[i] = fGrammarList[i].fGlobalIDConstraintDecls;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// for complex/simple types, create a special implementation,
|
||||
@ -405,6 +409,9 @@ public final class XSModelImpl extends AbstractList implements XSModel, XSNamesp
|
||||
case XSConstants.NOTATION_DECLARATION:
|
||||
table = fGrammarList[i].fGlobalNotationDecls;
|
||||
break;
|
||||
case XSConstants.IDENTITY_CONSTRAINT:
|
||||
table = fGrammarList[i].fGlobalIDConstraintDecls;
|
||||
break;
|
||||
}
|
||||
|
||||
// for complex/simple types, create a special implementation,
|
||||
@ -595,6 +602,40 @@ public final class XSModelImpl extends AbstractList implements XSModel, XSNamesp
|
||||
return sg.getGlobalGroupDecl(name, loc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level model group definition.
|
||||
*
|
||||
* @param name The name of the definition.
|
||||
* @param namespace The namespace of the definition, otherwise null.
|
||||
* @return A top-level model group definition definition or null if such
|
||||
* definition does not exist.
|
||||
*/
|
||||
public XSIDCDefinition getIDCDefinition(String name, String namespace) {
|
||||
SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
|
||||
if (sg == null) {
|
||||
return null;
|
||||
}
|
||||
return (XSIDCDefinition)sg.fGlobalIDConstraintDecls.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level model group definition.
|
||||
*
|
||||
* @param name The name of the definition.
|
||||
* @param namespace The namespace of the definition, otherwise null.
|
||||
* @param loc The schema location where the component was defined
|
||||
* @return A top-level model group definition definition or null if such
|
||||
* definition does not exist.
|
||||
*/
|
||||
public XSIDCDefinition getIDCDefinition(String name, String namespace,
|
||||
String loc) {
|
||||
SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
|
||||
if (sg == null) {
|
||||
return null;
|
||||
}
|
||||
return sg.getIDConstraintDecl(name, loc);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.apache.xerces.xs.XSModel#getNotationDeclaration(String, String)
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -23,6 +24,7 @@ package com.sun.org.apache.xerces.internal.impl.xs.identity;
|
||||
import com.sun.org.apache.xerces.internal.impl.xpath.XPathException;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.util.ShortListImpl;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLChar;
|
||||
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
|
||||
import com.sun.org.apache.xerces.internal.xs.ShortList;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSComplexTypeDefinition;
|
||||
@ -43,11 +45,11 @@ public class Field {
|
||||
//
|
||||
|
||||
/** Field XPath. */
|
||||
protected Field.XPath fXPath;
|
||||
protected final Field.XPath fXPath;
|
||||
|
||||
|
||||
/** Identity constraint. */
|
||||
protected IdentityConstraint fIdentityConstraint;
|
||||
protected final IdentityConstraint fIdentityConstraint;
|
||||
|
||||
//
|
||||
// Constructors
|
||||
@ -67,7 +69,7 @@ public class Field {
|
||||
/** Returns the field XPath. */
|
||||
public com.sun.org.apache.xerces.internal.impl.xpath.XPath getXPath() {
|
||||
return fXPath;
|
||||
} // getXPath():com.sun.org.apache.xerces.internal.impl.v1.schema.identity.XPath
|
||||
} // getXPath():org.apache.xerces.impl.v1.schema.identity.XPath
|
||||
|
||||
/** Returns the identity constraint. */
|
||||
public IdentityConstraint getIdentityConstraint() {
|
||||
@ -77,8 +79,8 @@ public class Field {
|
||||
// factory method
|
||||
|
||||
/** Creates a field matcher. */
|
||||
public XPathMatcher createMatcher(FieldActivator activator, ValueStore store) {
|
||||
return new Field.Matcher(fXPath, activator, store);
|
||||
public XPathMatcher createMatcher(ValueStore store) {
|
||||
return new Field.Matcher(fXPath, store);
|
||||
} // createMatcher(ValueStore):XPathMatcher
|
||||
|
||||
//
|
||||
@ -110,15 +112,7 @@ public class Field {
|
||||
public XPath(String xpath,
|
||||
SymbolTable symbolTable,
|
||||
NamespaceContext context) throws XPathException {
|
||||
// NOTE: We have to prefix the field XPath with "./" in
|
||||
// order to handle selectors such as "@attr" that
|
||||
// select the attribute because the fields could be
|
||||
// relative to the selector element. -Ac
|
||||
// Unless xpath starts with a descendant node -Achille Fokoue
|
||||
// ... or a / or a . - NG
|
||||
super(((xpath.trim().startsWith("/") ||xpath.trim().startsWith("."))?
|
||||
xpath:"./"+xpath),
|
||||
symbolTable, context);
|
||||
super(fixupXPath(xpath), symbolTable, context);
|
||||
|
||||
// verify that only one attribute is selected per branch
|
||||
for (int i=0;i<fLocationPaths.length;i++) {
|
||||
@ -133,6 +127,73 @@ public class Field {
|
||||
}
|
||||
} // <init>(String,SymbolTable,NamespacesContext)
|
||||
|
||||
/** Fixup XPath expression. Avoid creating a new String if possible. */
|
||||
private static String fixupXPath(String xpath) {
|
||||
|
||||
final int end = xpath.length();
|
||||
int offset = 0;
|
||||
boolean whitespace = true;
|
||||
char c;
|
||||
|
||||
// NOTE: We have to prefix the field XPath with "./" in
|
||||
// order to handle selectors such as "@attr" that
|
||||
// select the attribute because the fields could be
|
||||
// relative to the selector element. -Ac
|
||||
// Unless xpath starts with a descendant node -Achille Fokoue
|
||||
// ... or a / or a . - NG
|
||||
for (; offset < end; ++offset) {
|
||||
c = xpath.charAt(offset);
|
||||
if (whitespace) {
|
||||
if (!XMLChar.isSpace(c)) {
|
||||
if (c == '.' || c == '/') {
|
||||
whitespace = false;
|
||||
}
|
||||
else if (c != '|') {
|
||||
return fixupXPath2(xpath, offset, end);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (c == '|') {
|
||||
whitespace = true;
|
||||
}
|
||||
}
|
||||
return xpath;
|
||||
|
||||
} // fixupXPath(String):String
|
||||
|
||||
private static String fixupXPath2(String xpath, int offset, final int end) {
|
||||
|
||||
StringBuffer buffer = new StringBuffer(end + 2);
|
||||
for (int i = 0; i < offset; ++i) {
|
||||
buffer.append(xpath.charAt(i));
|
||||
}
|
||||
buffer.append("./");
|
||||
|
||||
boolean whitespace = false;
|
||||
char c;
|
||||
|
||||
for (; offset < end; ++offset) {
|
||||
c = xpath.charAt(offset);
|
||||
if (whitespace) {
|
||||
if (!XMLChar.isSpace(c)) {
|
||||
if (c == '.' || c == '/') {
|
||||
whitespace = false;
|
||||
}
|
||||
else if (c != '|') {
|
||||
buffer.append("./");
|
||||
whitespace = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (c == '|') {
|
||||
whitespace = true;
|
||||
}
|
||||
buffer.append(c);
|
||||
}
|
||||
return buffer.toString();
|
||||
|
||||
} // fixupXPath2(String, int, int):String
|
||||
|
||||
} // class XPath
|
||||
|
||||
/**
|
||||
@ -147,20 +208,19 @@ public class Field {
|
||||
// Data
|
||||
//
|
||||
|
||||
/** Field activator. */
|
||||
protected FieldActivator fFieldActivator;
|
||||
|
||||
/** Value store for data values. */
|
||||
protected ValueStore fStore;
|
||||
protected final ValueStore fStore;
|
||||
|
||||
/** A flag indicating whether the field is allowed to match a value. */
|
||||
protected boolean fMayMatch = true;
|
||||
|
||||
//
|
||||
// Constructors
|
||||
//
|
||||
|
||||
/** Constructs a field matcher. */
|
||||
public Matcher(Field.XPath xpath, FieldActivator activator, ValueStore store) {
|
||||
public Matcher(Field.XPath xpath, ValueStore store) {
|
||||
super(xpath);
|
||||
fFieldActivator = activator;
|
||||
fStore = store;
|
||||
} // <init>(Field.XPath,ValueStore)
|
||||
|
||||
@ -179,11 +239,11 @@ public class Field {
|
||||
fStore.reportError(code,
|
||||
new Object[]{fIdentityConstraint.getElementName(), fIdentityConstraint.getIdentityConstraintName()});
|
||||
}
|
||||
fStore.addValue(Field.this, actualValue, convertToPrimitiveKind(valueType), convertToPrimitiveKind(itemValueType));
|
||||
fStore.addValue(Field.this, fMayMatch, actualValue, convertToPrimitiveKind(valueType), convertToPrimitiveKind(itemValueType));
|
||||
// once we've stored the value for this field, we set the mayMatch
|
||||
// member to false so that, in the same scope, we don't match any more
|
||||
// member to false so that in the same scope, we don't match any more
|
||||
// values (and throw an error instead).
|
||||
fFieldActivator.setMayMatch(Field.this, Boolean.FALSE);
|
||||
fMayMatch = false;
|
||||
} // matched(String)
|
||||
|
||||
private short convertToPrimitiveKind(short valueType) {
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001,2002,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -51,32 +52,12 @@ public interface FieldActivator {
|
||||
/**
|
||||
* Request to activate the specified field. This method returns the
|
||||
* matcher for the field.
|
||||
* It's also important for the implementor to ensure that it marks whether a Field
|
||||
* is permitted to match a value--that is, to call the setMayMatch(Field, Boolean) method.
|
||||
*
|
||||
* @param field The field to activate.
|
||||
* @param initialDepth the 0-indexed depth in the instance document at which the Selector began to match.
|
||||
*/
|
||||
public XPathMatcher activateField(Field field, int initialDepth);
|
||||
|
||||
/**
|
||||
* Sets whether the given field is permitted to match a value.
|
||||
* This should be used to catch instance documents that try
|
||||
* and match a field several times in the same scope.
|
||||
*
|
||||
* @param field The field that may be permitted to be matched.
|
||||
* @param state Boolean indiciating whether the field may be matched.
|
||||
*/
|
||||
public void setMayMatch(Field field, Boolean state);
|
||||
|
||||
/**
|
||||
* Returns whether the given field is permitted to match a value.
|
||||
*
|
||||
* @param field The field that may be permitted to be matched.
|
||||
* @return Boolean indicating whether the field may be matched.
|
||||
*/
|
||||
public Boolean mayMatch(Field field);
|
||||
|
||||
/**
|
||||
* Ends the value scope for the specified identity constraint.
|
||||
*
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001, 2002,2004,2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -54,9 +55,12 @@ public interface ValueStore {
|
||||
* @param field The field associated to the value. This reference
|
||||
* is used to ensure that each field only adds a value
|
||||
* once within a selection scope.
|
||||
* @param mayMatch a flag indiciating whether the field may be matched.
|
||||
* @param actualValue The value to add.
|
||||
* @param valueType Type of the value to add.
|
||||
* @param itemValueType If the value is a list, a list of types for each of the values in the list.
|
||||
*/
|
||||
public void addValue(Field field, Object actualValue, short valueType, ShortList itemValueType);
|
||||
public void addValue(Field field, boolean mayMatch, Object actualValue, short valueType, ShortList itemValueType);
|
||||
|
||||
/**
|
||||
* Since the valueStore will have access to an error reporter, this
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -65,9 +65,10 @@ public class CMBuilder {
|
||||
* Get content model for the a given type
|
||||
*
|
||||
* @param typeDecl get content model for which complex type
|
||||
* @param forUPA a flag indicating whether it is for UPA
|
||||
* @return a content model validator
|
||||
*/
|
||||
public XSCMValidator getContentModel(XSComplexTypeDecl typeDecl) {
|
||||
public XSCMValidator getContentModel(XSComplexTypeDecl typeDecl, boolean forUPA) {
|
||||
|
||||
// for complex type with empty or simple content,
|
||||
// there is no content model validator
|
||||
@ -92,7 +93,7 @@ public class CMBuilder {
|
||||
cmValidator = createAllCM(particle);
|
||||
}
|
||||
else {
|
||||
cmValidator = createDFACM(particle);
|
||||
cmValidator = createDFACM(particle, forUPA);
|
||||
}
|
||||
|
||||
//now we are throught building content model and have passed sucessfully of the nodecount check
|
||||
@ -124,11 +125,11 @@ public class CMBuilder {
|
||||
return allContent;
|
||||
}
|
||||
|
||||
XSCMValidator createDFACM(XSParticleDecl particle) {
|
||||
XSCMValidator createDFACM(XSParticleDecl particle, boolean forUPA) {
|
||||
fLeafCount = 0;
|
||||
fParticleCount = 0;
|
||||
// convert particle tree to CM tree
|
||||
CMNode node = useRepeatingLeafNodes(particle) ? buildCompactSyntaxTree(particle) : buildSyntaxTree(particle, true);
|
||||
CMNode node = useRepeatingLeafNodes(particle) ? buildCompactSyntaxTree(particle) : buildSyntaxTree(particle, forUPA, true);
|
||||
if (node == null)
|
||||
return null;
|
||||
// build DFA content model from the CM tree
|
||||
@ -141,10 +142,31 @@ public class CMBuilder {
|
||||
// 3. convert model groups (a, b, c, ...) or (a | b | c | ...) to
|
||||
// binary tree: (((a,b),c),...) or (((a|b)|c)|...)
|
||||
// 4. make sure each leaf node (XSCMLeaf) has a distinct position
|
||||
private CMNode buildSyntaxTree(XSParticleDecl particle, boolean optimize) {
|
||||
private CMNode buildSyntaxTree(XSParticleDecl particle, boolean forUPA, boolean optimize) {
|
||||
|
||||
int maxOccurs = particle.fMaxOccurs;
|
||||
int minOccurs = particle.fMinOccurs;
|
||||
|
||||
boolean compactedForUPA = false;
|
||||
if (forUPA) {
|
||||
// When doing UPA, we reduce the size of the minOccurs/maxOccurs values to make
|
||||
// processing the DFA faster. For UPA the exact values don't matter.
|
||||
if (minOccurs > 1) {
|
||||
if (maxOccurs > minOccurs || particle.getMaxOccursUnbounded()) {
|
||||
minOccurs = 1;
|
||||
compactedForUPA = true;
|
||||
}
|
||||
else { // maxOccurs == minOccurs
|
||||
minOccurs = 2;
|
||||
compactedForUPA = true;
|
||||
}
|
||||
}
|
||||
if (maxOccurs > 1) {
|
||||
maxOccurs = 2;
|
||||
compactedForUPA = true;
|
||||
}
|
||||
}
|
||||
|
||||
short type = particle.fType;
|
||||
CMNode nodeRet = null;
|
||||
|
||||
@ -159,6 +181,9 @@ public class CMBuilder {
|
||||
nodeRet = fNodeFactory.getCMLeafNode(particle.fType, particle.fValue, fParticleCount++, fLeafCount++);
|
||||
// (task 2) expand occurrence values
|
||||
nodeRet = expandContentModel(nodeRet, minOccurs, maxOccurs, optimize);
|
||||
if (nodeRet != null) {
|
||||
nodeRet.setIsCompactUPAModel(compactedForUPA);
|
||||
}
|
||||
}
|
||||
else if (type == XSParticleDecl.PARTICLE_MODELGROUP) {
|
||||
// (task 1,3) convert model groups to binary trees
|
||||
@ -178,12 +203,14 @@ public class CMBuilder {
|
||||
for (int i = 0; i < group.fParticleCount; i++) {
|
||||
// first convert each child to a CM tree
|
||||
temp = buildSyntaxTree(group.fParticles[i],
|
||||
forUPA,
|
||||
optimize &&
|
||||
minOccurs == 1 && maxOccurs == 1 &&
|
||||
(group.fCompositor == XSModelGroupImpl.MODELGROUP_SEQUENCE ||
|
||||
group.fParticleCount == 1));
|
||||
// then combine them using binary operation
|
||||
if (temp != null) {
|
||||
compactedForUPA |= temp.isCompactedForUPA();
|
||||
if (nodeRet == null) {
|
||||
nodeRet = temp;
|
||||
}
|
||||
@ -205,6 +232,7 @@ public class CMBuilder {
|
||||
nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ZERO_OR_ONE, nodeRet);
|
||||
}
|
||||
nodeRet = expandContentModel(nodeRet, minOccurs, maxOccurs, false);
|
||||
nodeRet.setIsCompactUPAModel(compactedForUPA);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
@ -73,14 +72,11 @@ public class CMNodeFactory {
|
||||
public CMNodeFactory() {
|
||||
}
|
||||
|
||||
public void reset(XMLComponentManager componentManager){
|
||||
public void reset(XMLComponentManager componentManager) {
|
||||
fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
|
||||
try {
|
||||
fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER);
|
||||
//we are setting the limit of number of nodes to 3times the maxOccur value..
|
||||
if(fSecurityManager != null){
|
||||
maxNodeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT) * MULTIPLICITY ;
|
||||
}
|
||||
reset();
|
||||
}
|
||||
catch (XMLConfigurationException e) {
|
||||
fSecurityManager = null;
|
||||
@ -88,6 +84,13 @@ public class CMNodeFactory {
|
||||
|
||||
}//reset()
|
||||
|
||||
public void reset() {
|
||||
// we are setting the limit of number of nodes to 3 times the maxOccurs value.
|
||||
if (fSecurityManager != null) {
|
||||
maxNodeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT) * MULTIPLICITY ;
|
||||
}
|
||||
}
|
||||
|
||||
public CMNode getCMLeafNode(int type, Object leaf, int id, int position) {
|
||||
return new XSCMLeaf(type, leaf, id, position) ;
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 1999-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -25,8 +25,6 @@ import com.sun.org.apache.xerces.internal.impl.xs.XSElementDecl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.SubstitutionGroupHandler;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaException;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.XSConstraints;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@ -202,16 +200,17 @@ public class XSAllCM implements XSCMValidator {
|
||||
* have been seen.
|
||||
*
|
||||
* @param state the current state
|
||||
* @return a Vector whose entries are instances of
|
||||
* @return a list whose entries are instances of
|
||||
* either XSWildcardDecl or XSElementDecl.
|
||||
*/
|
||||
public Vector whatCanGoHere(int[] state) {
|
||||
Vector ret = new Vector();
|
||||
public ArrayList whatCanGoHere(int[] state) {
|
||||
ArrayList ret = new ArrayList();
|
||||
for (int i = 0; i < fNumElements; i++) {
|
||||
// we only try to look for a matching decl if we have not seen
|
||||
// this element yet.
|
||||
if (state[i+1] == STATE_START)
|
||||
ret.addElement(fAllElements[i]);
|
||||
if (state[i+1] == STATE_START) {
|
||||
ret.add(fAllElements[i]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -220,4 +219,15 @@ public class XSAllCM implements XSCMValidator {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int [] occurenceInfo(int[] state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getTermName(int termId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isCompactedForUPA() {
|
||||
return false;
|
||||
}
|
||||
} // class XSAllCM
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -23,8 +23,6 @@ package com.sun.org.apache.xerces.internal.impl.xs.models;
|
||||
import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.SubstitutionGroupHandler;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaException;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@ -87,24 +85,60 @@ public interface XSCMValidator {
|
||||
* have been seen.
|
||||
*
|
||||
* @param state the current state
|
||||
* @return a Vector whose entries are instances of
|
||||
* @return a list whose entries are instances of
|
||||
* either XSWildcardDecl or XSElementDecl.
|
||||
*/
|
||||
public Vector whatCanGoHere(int[] state);
|
||||
public ArrayList whatCanGoHere(int[] state);
|
||||
|
||||
/**
|
||||
* Used by constant space algorithm for a{n,m} for n > 1 and
|
||||
* m <= unbounded. Called by a validator if validation of
|
||||
* countent model succeeds after subsuming a{n,m} to a*
|
||||
* (or a+) to check the n and m bounds.
|
||||
* Returns <code>null</code> if validation of bounds is
|
||||
*
|
||||
* @return <code>null</code> if validation of bounds is
|
||||
* successful. Returns a list of strings with error info
|
||||
* if not. Even entries in list returned are error codes
|
||||
* (used to look up properties) and odd entries are parameters
|
||||
* to be passed when formatting error message. Each parameter
|
||||
* is associated with the error code that preceeds it in
|
||||
* is associated with the error code that proceeds it in
|
||||
* the list.
|
||||
*/
|
||||
public ArrayList checkMinMaxBounds();
|
||||
|
||||
/**
|
||||
* <p>Returns an array containing information about the current repeating term
|
||||
* or <code>null</code> if no occurrence counting was being performed at the
|
||||
* current state.</p>
|
||||
*
|
||||
* <p>If an array is returned it will have a length == 4 and will contain:
|
||||
* <ul>
|
||||
* <li>a[0] :: min occurs</li>
|
||||
* <li>a[1] :: max occurs</li>
|
||||
* <li>a[2] :: current value of the counter</li>
|
||||
* <li>a[3] :: identifier for the repeating term</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @param state the current state
|
||||
* @return an array containing information about the current repeating term
|
||||
*/
|
||||
public int [] occurenceInfo(int[] state);
|
||||
|
||||
/**
|
||||
* Returns the name of the term (element or wildcard) for the given identifier.
|
||||
*
|
||||
* @param termId identifier for the element declaration or wildcard
|
||||
* @return the name of the element declaration or wildcard
|
||||
*/
|
||||
public String getTermName(int termId);
|
||||
|
||||
/**
|
||||
* Checks if this content model has had its min/maxOccurs values reduced for
|
||||
* purposes of speeding up UPA. If so, this content model should not be used
|
||||
* for any purpose other than checking unique particle attribution
|
||||
*
|
||||
* @return a boolean that says whether this content has been compacted for UPA
|
||||
*/
|
||||
public boolean isCompactedForUPA();
|
||||
} // XSCMValidator
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 1999-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -31,8 +31,6 @@ import com.sun.org.apache.xerces.internal.impl.xs.XSModelGroupImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.XSWildcardDecl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaException;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.XSConstraints;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
@ -166,6 +164,8 @@ public class XSDFACM
|
||||
*/
|
||||
private int fTransTableSize = 0;
|
||||
|
||||
private boolean fIsCompactedForUPA;
|
||||
|
||||
/**
|
||||
* Array of counters for all the for elements (or wildcards)
|
||||
* of the form a{n,m} where n > 1 and m <= unbounded. Used
|
||||
@ -1165,10 +1165,10 @@ public class XSDFACM
|
||||
* have been seen.
|
||||
*
|
||||
* @param state the current state
|
||||
* @return a Vector whose entries are instances of
|
||||
* @return a list whose entries are instances of
|
||||
* either XSWildcardDecl or XSElementDecl.
|
||||
*/
|
||||
public Vector whatCanGoHere(int[] state) {
|
||||
public ArrayList whatCanGoHere(int[] state) {
|
||||
int curState = state[0];
|
||||
if (curState < 0)
|
||||
curState = state[1];
|
||||
@ -1176,7 +1176,7 @@ public class XSDFACM
|
||||
fCountingStates[curState] : null;
|
||||
int count = state[2];
|
||||
|
||||
Vector ret = new Vector();
|
||||
ArrayList ret = new ArrayList();
|
||||
for (int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) {
|
||||
int nextState = fTransTable[curState][elemIndex];
|
||||
if (nextState != -1) {
|
||||
@ -1196,7 +1196,7 @@ public class XSDFACM
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ret.addElement(fElemMap[elemIndex]);
|
||||
ret.add(fElemMap[elemIndex]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -1231,11 +1231,38 @@ public class XSDFACM
|
||||
}
|
||||
if (maxOccurs != -1 && count > maxOccurs) {
|
||||
if (result == null) result = new ArrayList();
|
||||
result.add("cvc-complex-type.2.4.e");
|
||||
result.add("cvc-complex-type.2.4.d.1");
|
||||
result.add("{" + fElemMap[elemIndex] + "}");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int [] occurenceInfo(int[] state) {
|
||||
if (fCountingStates != null) {
|
||||
int curState = state[0];
|
||||
if (curState < 0) {
|
||||
curState = state[1];
|
||||
}
|
||||
Occurence o = fCountingStates[curState];
|
||||
if (o != null) {
|
||||
int [] occurenceInfo = new int[4];
|
||||
occurenceInfo[0] = o.minOccurs;
|
||||
occurenceInfo[1] = o.maxOccurs;
|
||||
occurenceInfo[2] = state[2];
|
||||
occurenceInfo[3] = o.elemIndex;
|
||||
return occurenceInfo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getTermName(int termId) {
|
||||
Object term = fElemMap[termId];
|
||||
return (term != null) ? term.toString() : null;
|
||||
}
|
||||
|
||||
public boolean isCompactedForUPA() {
|
||||
return fIsCompactedForUPA;
|
||||
}
|
||||
} // class DFAContentModel
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -18,13 +18,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.xs.models;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.SubstitutionGroupHandler;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaException;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@ -47,7 +46,7 @@ public class XSEmptyCM implements XSCMValidator {
|
||||
// start the content model: did not see any children
|
||||
private static final short STATE_START = 0;
|
||||
|
||||
private static final Vector EMPTY = new Vector(0);
|
||||
private static final ArrayList EMPTY = new ArrayList(0);
|
||||
|
||||
//
|
||||
// Data
|
||||
@ -126,10 +125,10 @@ public class XSEmptyCM implements XSCMValidator {
|
||||
* have been seen.
|
||||
*
|
||||
* @param state the current state
|
||||
* @return a Vector whose entries are instances of
|
||||
* @return a list whose entries are instances of
|
||||
* either XSWildcardDecl or XSElementDecl.
|
||||
*/
|
||||
public Vector whatCanGoHere(int[] state) {
|
||||
public ArrayList whatCanGoHere(int[] state) {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
@ -137,4 +136,15 @@ public class XSEmptyCM implements XSCMValidator {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int [] occurenceInfo(int[] state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getTermName(int termId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isCompactedForUPA() {
|
||||
return false;
|
||||
}
|
||||
} // class XSEmptyCM
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -24,9 +25,7 @@ import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeFacetException;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.xs.XSSimpleTypeDecl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.SchemaSymbols;
|
||||
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.impl.xs.util;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.xs.XSSimpleTypeDecl;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.XSComplexTypeDecl;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition;
|
||||
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
|
||||
|
||||
/**
|
||||
* Class defining utility/helper methods to support XML Schema 1.0 implementation.
|
||||
*
|
||||
* @xerces.internal
|
||||
*
|
||||
* @author Mukul Gandhi, IBM
|
||||
*/
|
||||
public class XS10TypeHelper {
|
||||
|
||||
/*
|
||||
* Class constructor.
|
||||
*/
|
||||
private XS10TypeHelper() {
|
||||
// a private constructor, to prohibit instantiating this class from an outside class/application.
|
||||
// this is a good practice, since all methods of this class are "static".
|
||||
}
|
||||
|
||||
/*
|
||||
* Get name of an XSD type definition as a string value (which will typically be the value of "name" attribute of a
|
||||
* type definition, or an internal name determined by the validator for anonymous types).
|
||||
*/
|
||||
public static String getSchemaTypeName(XSTypeDefinition typeDefn) {
|
||||
|
||||
String typeNameStr;
|
||||
if (typeDefn instanceof XSSimpleTypeDefinition) {
|
||||
typeNameStr = ((XSSimpleTypeDecl) typeDefn).getTypeName();
|
||||
}
|
||||
else {
|
||||
typeNameStr = ((XSComplexTypeDecl) typeDefn).getTypeName();
|
||||
}
|
||||
|
||||
return typeNameStr;
|
||||
|
||||
} // getSchemaTypeName
|
||||
|
||||
|
||||
} // class XS10TypeHelper
|
@ -1,3 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -529,6 +532,7 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin
|
||||
fComponents.put(LOCALE, null);
|
||||
|
||||
// Restore initial security manager
|
||||
fInitSecurityManager.setSecureProcessing(true);
|
||||
fComponents.put(SECURITY_MANAGER, fInitSecurityManager);
|
||||
|
||||
// Set the Locale back to null.
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2000-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,12 +20,6 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.parsers;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.Locale;
|
||||
import java.util.Stack;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl;
|
||||
import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.dom.DOMStringListImpl;
|
||||
@ -55,7 +49,11 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
|
||||
import com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfiguration;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Stack;
|
||||
import java.util.StringTokenizer;
|
||||
import org.w3c.dom.DOMConfiguration;
|
||||
import org.w3c.dom.DOMError;
|
||||
import org.w3c.dom.DOMErrorHandler;
|
||||
@ -152,7 +150,6 @@ extends AbstractDOMParser implements LSParser, DOMConfiguration {
|
||||
|
||||
protected final static boolean DEBUG = false;
|
||||
|
||||
private Vector fSchemaLocations = new Vector ();
|
||||
private String fSchemaLocation = null;
|
||||
private DOMStringList fRecognizedParameters;
|
||||
|
||||
@ -286,17 +283,17 @@ extends AbstractDOMParser implements LSParser, DOMConfiguration {
|
||||
* @throws SAXException Thrown on initialization error.
|
||||
*/
|
||||
public void reset () {
|
||||
super.reset ();
|
||||
super.reset();
|
||||
|
||||
// get state of namespace-declarations parameter.
|
||||
fNamespaceDeclarations =
|
||||
fConfiguration.getFeature(Constants.DOM_NAMESPACE_DECLARATIONS);
|
||||
|
||||
// DOM Filter
|
||||
if (fSkippedElemStack!=null) {
|
||||
fSkippedElemStack.removeAllElements ();
|
||||
if (fSkippedElemStack != null) {
|
||||
fSkippedElemStack.removeAllElements();
|
||||
}
|
||||
fSchemaLocations.clear ();
|
||||
|
||||
fRejectedElementDepth = 0;
|
||||
fFilterReject = false;
|
||||
fSchemaType = null;
|
||||
@ -521,15 +518,15 @@ extends AbstractDOMParser implements LSParser, DOMConfiguration {
|
||||
// map DOM schema-location to JAXP schemaSource property
|
||||
// tokenize location string
|
||||
StringTokenizer t = new StringTokenizer (fSchemaLocation, " \n\t\r");
|
||||
if (t.hasMoreTokens ()){
|
||||
fSchemaLocations.clear ();
|
||||
fSchemaLocations.add (t.nextToken ());
|
||||
while (t.hasMoreTokens ()) {
|
||||
fSchemaLocations.add (t.nextToken ());
|
||||
if (t.hasMoreTokens()) {
|
||||
ArrayList locations = new ArrayList();
|
||||
locations.add (t.nextToken());
|
||||
while (t.hasMoreTokens()) {
|
||||
locations.add (t.nextToken());
|
||||
}
|
||||
fConfiguration.setProperty (
|
||||
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_SOURCE,
|
||||
fSchemaLocations.toArray ());
|
||||
locations.toArray());
|
||||
}
|
||||
else {
|
||||
fConfiguration.setProperty (
|
||||
@ -865,7 +862,7 @@ extends AbstractDOMParser implements LSParser, DOMConfiguration {
|
||||
*/
|
||||
public DOMStringList getParameterNames () {
|
||||
if (fRecognizedParameters == null){
|
||||
Vector parameters = new Vector();
|
||||
ArrayList parameters = new ArrayList();
|
||||
|
||||
// REVISIT: add Xerces recognized properties/features
|
||||
parameters.add(Constants.DOM_NAMESPACES);
|
||||
@ -1116,7 +1113,7 @@ extends AbstractDOMParser implements LSParser, DOMConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.w3c.dom.ls.DOMParser#abort()
|
||||
* @see org.w3c.dom.ls.LSParser#abort()
|
||||
*/
|
||||
public void abort () {
|
||||
// If parse operation is in progress then reset it
|
||||
|
@ -1,3 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -152,6 +155,10 @@ public class StandardParserConfiguration
|
||||
protected static final String ROOT_TYPE_DEF =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.ROOT_TYPE_DEFINITION_PROPERTY;
|
||||
|
||||
/** Property identifier: root element declaration. */
|
||||
protected static final String ROOT_ELEMENT_DECL =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.ROOT_ELEMENT_DECLARATION_PROPERTY;
|
||||
|
||||
//
|
||||
// Data
|
||||
//
|
||||
@ -259,6 +266,7 @@ public class StandardParserConfiguration
|
||||
SCHEMA_LOCATION,
|
||||
SCHEMA_NONS_LOCATION,
|
||||
ROOT_TYPE_DEF,
|
||||
ROOT_ELEMENT_DECL,
|
||||
SCHEMA_DV_FACTORY,
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -282,6 +285,10 @@ public class XML11Configuration extends ParserConfigurationSettings
|
||||
protected static final String ROOT_TYPE_DEF =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.ROOT_TYPE_DEFINITION_PROPERTY;
|
||||
|
||||
/** Property identifier: root element declaration. */
|
||||
protected static final String ROOT_ELEMENT_DECL =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.ROOT_ELEMENT_DECLARATION_PROPERTY;
|
||||
|
||||
/** Property identifier: locale. */
|
||||
protected static final String LOCALE =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
|
||||
@ -553,6 +560,7 @@ public class XML11Configuration extends ParserConfigurationSettings
|
||||
SCHEMA_LOCATION,
|
||||
SCHEMA_NONS_LOCATION,
|
||||
ROOT_TYPE_DEF,
|
||||
ROOT_ELEMENT_DECL,
|
||||
LOCALE,
|
||||
SCHEMA_DV_FACTORY,
|
||||
SECURITY_MANAGER,
|
||||
|
@ -3,60 +3,20 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* The Apache Software License, Version 1.1
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Xerces" and "Apache Software Foundation" must
|
||||
* not be used to endorse or promote products derived from this
|
||||
* software without prior written permission. For written
|
||||
* permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* nor may "Apache" appear in their name, without prior written
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation and was
|
||||
* originally based on software copyright (c) 1999, International
|
||||
* Business Machines, Inc., http://www.apache.org. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.util;
|
||||
@ -222,7 +182,7 @@ implements XMLAttributes, XMLBufferListener {
|
||||
|
||||
int index;
|
||||
if (fLength < SIZE_LIMIT) {
|
||||
index = name.uri != null && !name.uri.equals("")
|
||||
index = name.uri != null && name.uri.length() != 0
|
||||
? getIndexFast(name.uri, name.localpart)
|
||||
: getIndexFast(name.rawname);
|
||||
|
||||
@ -1097,29 +1057,6 @@ implements XMLAttributes, XMLBufferListener {
|
||||
} // getURI(int,QName)
|
||||
|
||||
// Implementation methods
|
||||
public void setSchemaId(int attrIndex, boolean schemaId) {
|
||||
fAttributes[attrIndex].schemaId = schemaId;
|
||||
}
|
||||
|
||||
public boolean getSchemaId(int index) {
|
||||
if (index < 0 || index >= fLength) {
|
||||
return false;
|
||||
}
|
||||
return fAttributes[index].schemaId;
|
||||
}
|
||||
|
||||
public boolean getSchemaId(String qname) {
|
||||
int index = getIndex(qname);
|
||||
return index != -1 ? fAttributes[index].schemaId : false;
|
||||
} // getType(String):String
|
||||
|
||||
public boolean getSchemaId(String uri, String localName) {
|
||||
if (!fNamespaces) {
|
||||
return false;
|
||||
}
|
||||
int index = getIndex(uri, localName);
|
||||
return index != -1 ? fAttributes[index].schemaId : false;
|
||||
} // getType(String,String):String
|
||||
|
||||
//XMLBufferListener methods
|
||||
/**
|
||||
@ -1154,7 +1091,7 @@ implements XMLAttributes, XMLBufferListener {
|
||||
// basic info
|
||||
|
||||
/** Name. */
|
||||
public QName name = new QName();
|
||||
public final QName name = new QName();
|
||||
|
||||
/** Type. */
|
||||
public String type;
|
||||
@ -1171,8 +1108,6 @@ implements XMLAttributes, XMLBufferListener {
|
||||
/** Specified. */
|
||||
public boolean specified;
|
||||
|
||||
/** Schema ID type. */
|
||||
public boolean schemaId;
|
||||
|
||||
/**
|
||||
* Augmentations information for this attribute.
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -31,19 +32,19 @@ public interface ItemPSVI {
|
||||
*/
|
||||
public static final short VALIDITY_NOTKNOWN = 0;
|
||||
/**
|
||||
* Validity value indicating that validation has been strictly assessed
|
||||
* Validity value indicating that validation has been strictly assessed
|
||||
* and the item in question is invalid according to the rules of schema
|
||||
* validation.
|
||||
*/
|
||||
public static final short VALIDITY_INVALID = 1;
|
||||
/**
|
||||
* Validation status indicating that schema validation has been performed
|
||||
* Validation status indicating that schema validation has been performed
|
||||
* and the item in question is valid according to the rules of schema
|
||||
* validation.
|
||||
*/
|
||||
public static final short VALIDITY_VALID = 2;
|
||||
/**
|
||||
* Validation status indicating that schema validation has been performed
|
||||
* Validation status indicating that schema validation has been performed
|
||||
* and the item in question has specifically been skipped.
|
||||
*/
|
||||
public static final short VALIDATION_NONE = 0;
|
||||
@ -53,12 +54,25 @@ public interface ItemPSVI {
|
||||
*/
|
||||
public static final short VALIDATION_PARTIAL = 1;
|
||||
/**
|
||||
* Validation status indicating that full schema validation has been
|
||||
* Validation status indicating that full schema validation has been
|
||||
* performed on the item.
|
||||
*/
|
||||
public static final short VALIDATION_FULL = 2;
|
||||
|
||||
/**
|
||||
* The nearest ancestor element information item with a
|
||||
* Returns a reference to an immutable instance with the same data
|
||||
* that this instance of <code>ItemPSVI</code> currently has.
|
||||
*/
|
||||
public ItemPSVI constant();
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if this specific instance of
|
||||
* <code>ItemPSVI</code> is immutable, otherwise <code>false</code>.
|
||||
*/
|
||||
public boolean isConstant();
|
||||
|
||||
/**
|
||||
* The nearest ancestor element information item with a
|
||||
* <code>[schema information]</code> property (or this element item
|
||||
* itself if it has such a property). For more information refer to
|
||||
* element validation context and attribute validation context .
|
||||
@ -66,7 +80,7 @@ public interface ItemPSVI {
|
||||
public String getValidationContext();
|
||||
|
||||
/**
|
||||
* <code>[validity]</code>: determines the validity of the schema item
|
||||
* <code>[validity]</code>: determines the validity of the schema item
|
||||
* with respect to the validation being attempted. The value will be one
|
||||
* of the constants: <code>VALIDITY_NOTKNOWN</code>,
|
||||
* <code>VALIDITY_INVALID</code> or <code>VALIDITY_VALID</code>.
|
||||
@ -74,7 +88,7 @@ public interface ItemPSVI {
|
||||
public short getValidity();
|
||||
|
||||
/**
|
||||
* <code>[validation attempted]</code>: determines the extent to which
|
||||
* <code>[validation attempted]</code>: determines the extent to which
|
||||
* the schema item has been validated. The value will be one of the
|
||||
* constants: <code>VALIDATION_NONE</code>,
|
||||
* <code>VALIDATION_PARTIAL</code> or <code>VALIDATION_FULL</code>.
|
||||
@ -82,15 +96,25 @@ public interface ItemPSVI {
|
||||
public short getValidationAttempted();
|
||||
|
||||
/**
|
||||
* <code>[schema error code]</code>: a list of error codes generated from
|
||||
* <code>[schema error code]</code>: a list of error codes generated from
|
||||
* the validation attempt or an empty <code>StringList</code> if no
|
||||
* errors occurred during the validation attempt.
|
||||
*/
|
||||
public StringList getErrorCodes();
|
||||
|
||||
/**
|
||||
* A list of error messages generated from the validation attempt or
|
||||
* an empty <code>StringList</code> if no errors occurred during the
|
||||
* validation attempt. The indices of error messages in this list are
|
||||
* aligned with those in the <code>[schema error code]</code> list.
|
||||
*/
|
||||
public StringList getErrorMessages();
|
||||
|
||||
/**
|
||||
* <code>[schema normalized value]</code>: the normalized value of this
|
||||
* item after validation.
|
||||
*
|
||||
* @deprecated Use getSchemaValue().getNormalizedValue() instead
|
||||
*/
|
||||
public String getSchemaNormalizedValue();
|
||||
|
||||
@ -100,6 +124,8 @@ public interface ItemPSVI {
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getSchemaValue().getActualValue() instead
|
||||
*/
|
||||
public Object getActualNormalizedValue()
|
||||
throws XSException;
|
||||
@ -113,11 +139,12 @@ public interface ItemPSVI {
|
||||
* method returns <code>LISTOFUNION_DT</code>. To query the actual value
|
||||
* of the list or list of union type definitions use
|
||||
* <code>itemValueTypes</code>. If the <code>actualNormalizedValue</code>
|
||||
* is <code>null</code>, this method returns <code>UNAVAILABLE_DT</code>
|
||||
* .
|
||||
* is <code>null</code>, this method returns <code>UNAVAILABLE_DT</code>.
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getSchemaValue().getActualValueType() instead
|
||||
*/
|
||||
public short getActualNormalizedValueType()
|
||||
throws XSException;
|
||||
@ -152,12 +179,22 @@ public interface ItemPSVI {
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getSchemaValue().getListValueTypes() instead
|
||||
*/
|
||||
public ShortList getItemValueTypes()
|
||||
throws XSException;
|
||||
|
||||
/**
|
||||
* <code>[type definition]</code>: an item isomorphic to the type
|
||||
* If this item has a simple type definition or a complex type with simple
|
||||
* content, then return the value with respect to the simple type. If
|
||||
* this item doesn't have a simple-typed value, the behavior of this method
|
||||
* is not specified.
|
||||
*/
|
||||
public XSValue getSchemaValue();
|
||||
|
||||
/**
|
||||
* <code>[type definition]</code>: an item isomorphic to the type
|
||||
* definition used to validate the schema item.
|
||||
*/
|
||||
public XSTypeDefinition getTypeDefinition();
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -51,6 +52,8 @@ public interface XSAttributeDeclaration extends XSObject {
|
||||
/**
|
||||
* Value constraint: The constraint value with respect to the [type
|
||||
* definition], otherwise <code>null</code>.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getNormalizedValue() instead
|
||||
*/
|
||||
public String getConstraintValue();
|
||||
|
||||
@ -61,6 +64,8 @@ public interface XSAttributeDeclaration extends XSObject {
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getActualValue() instead
|
||||
*/
|
||||
public Object getActualVC()
|
||||
throws XSException;
|
||||
@ -78,6 +83,8 @@ public interface XSAttributeDeclaration extends XSObject {
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getActualValueType() instead
|
||||
*/
|
||||
public short getActualVCType()
|
||||
throws XSException;
|
||||
@ -94,10 +101,17 @@ public interface XSAttributeDeclaration extends XSObject {
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getListValueTypes() instead
|
||||
*/
|
||||
public ShortList getItemValueTypes()
|
||||
throws XSException;
|
||||
|
||||
/**
|
||||
* The actual value of the default or fixed value constraint.
|
||||
*/
|
||||
public XSValue getValueConstraintValue();
|
||||
|
||||
/**
|
||||
* An annotation if it exists, otherwise <code>null</code>.
|
||||
* If not null then the first [annotation] from the sequence of annotations.
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -38,12 +39,14 @@ public interface XSAttributeUse extends XSObject {
|
||||
public XSAttributeDeclaration getAttrDeclaration();
|
||||
|
||||
/**
|
||||
* Value Constraint: one of default, fixed.
|
||||
* Value Constraint: one of default, fixed, or none.
|
||||
*/
|
||||
public short getConstraintType();
|
||||
|
||||
/**
|
||||
* Value Constraint: The constraint value, otherwise <code>null</code>.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getNormalizedValue() instead
|
||||
*/
|
||||
public String getConstraintValue();
|
||||
|
||||
@ -54,6 +57,8 @@ public interface XSAttributeUse extends XSObject {
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getActualValue() instead
|
||||
*/
|
||||
public Object getActualVC()
|
||||
throws XSException;
|
||||
@ -67,11 +72,12 @@ public interface XSAttributeUse extends XSObject {
|
||||
* method returns <code>LISTOFUNION_DT</code>. To query the actual
|
||||
* constraint value of the list or list of union type definitions use
|
||||
* <code>itemValueTypes</code>. If the <code>actualNormalizedValue</code>
|
||||
* is <code>null</code>, this method returns <code>UNAVAILABLE_DT</code>
|
||||
* .
|
||||
* is <code>null</code>, this method returns <code>UNAVAILABLE_DT</code>.
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getActualValueType() instead
|
||||
*/
|
||||
public short getActualVCType()
|
||||
throws XSException;
|
||||
@ -88,10 +94,17 @@ public interface XSAttributeUse extends XSObject {
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getListValueTypes() instead
|
||||
*/
|
||||
public ShortList getItemValueTypes()
|
||||
throws XSException;
|
||||
|
||||
/**
|
||||
* The actual value of the default or fixed value constraint.
|
||||
*/
|
||||
public XSValue getValueConstraintValue();
|
||||
|
||||
/**
|
||||
* A sequence of [annotations] or an empty <code>XSObjectList</code>.
|
||||
*/
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -52,6 +53,8 @@ public interface XSElementDeclaration extends XSTerm {
|
||||
/**
|
||||
* [Value constraint]: the constraint value with respect to the [type
|
||||
* definition], otherwise <code>null</code>.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getNormalizedValue() instead
|
||||
*/
|
||||
public String getConstraintValue();
|
||||
|
||||
@ -62,6 +65,8 @@ public interface XSElementDeclaration extends XSTerm {
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getActualValue() instead
|
||||
*/
|
||||
public Object getActualVC()
|
||||
throws XSException;
|
||||
@ -75,11 +80,12 @@ public interface XSElementDeclaration extends XSTerm {
|
||||
* method returns <code>LISTOFUNION_DT</code>. To query the actual
|
||||
* constraint value of the list or list of union type definitions use
|
||||
* <code>itemValueTypes</code>. If the <code>actualNormalizedValue</code>
|
||||
* is <code>null</code>, this method returns <code>UNAVAILABLE_DT</code>
|
||||
* .
|
||||
* is <code>null</code>, this method returns <code>UNAVAILABLE_DT</code>.
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getActualValueType() instead
|
||||
*/
|
||||
public short getActualVCType()
|
||||
throws XSException;
|
||||
@ -96,10 +102,17 @@ public interface XSElementDeclaration extends XSTerm {
|
||||
* @exception XSException
|
||||
* NOT_SUPPORTED_ERR: Raised if the implementation does not support this
|
||||
* method.
|
||||
*
|
||||
* @deprecated Use getValueConstraintValue().getListValueTypes() instead
|
||||
*/
|
||||
public ShortList getItemValueTypes()
|
||||
throws XSException;
|
||||
|
||||
/**
|
||||
* The actual value of the default or fixed value constraint.
|
||||
*/
|
||||
public XSValue getValueConstraintValue();
|
||||
|
||||
/**
|
||||
* If nillable is true, then an element may also be valid if it carries
|
||||
* the namespace qualified attribute with local name <code>nil</code>
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -36,6 +37,24 @@ public interface XSFacet extends XSObject {
|
||||
*/
|
||||
public String getLexicalFacetValue();
|
||||
|
||||
/**
|
||||
* If this facet is length, minLength, maxLength, totalDigits, or
|
||||
* fractionDigits, and if the value can fit in "int", then return the value
|
||||
* of the facet as an int. If the value can't fit, return -1. Use
|
||||
* getActualFacetValue() to get the BigInteger representation. For all other
|
||||
* facets, return 0.
|
||||
*/
|
||||
public int getIntFacetValue();
|
||||
|
||||
/**
|
||||
* If this facet is minInclusive, maxInclusive, minExclusive, or
|
||||
* maxExclusive, then return the actual value of the facet. If this facet
|
||||
* is length, minLength, maxLength, totalDigits, or fractionDigits, then
|
||||
* return a BigInteger representation of the value. If this facet is
|
||||
* whiteSpace, then return the String representation of the facet.
|
||||
*/
|
||||
public Object getActualFacetValue();
|
||||
|
||||
/**
|
||||
* [Facets]: check whether a facet is fixed.
|
||||
*/
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -44,7 +45,9 @@ public interface XSModel {
|
||||
|
||||
/**
|
||||
* Returns a list of top-level components, i.e. element declarations,
|
||||
* attribute declarations, etc.
|
||||
* attribute declarations, etc. Identity-constraint definitions are also
|
||||
* considered top-level.
|
||||
*
|
||||
* @param objectType The type of the declaration, i.e.
|
||||
* <code>ELEMENT_DECLARATION</code>. Note that
|
||||
* <code>XSTypeDefinition.SIMPLE_TYPE</code> and
|
||||
@ -60,7 +63,9 @@ public interface XSModel {
|
||||
/**
|
||||
* Convenience method. Returns a list of top-level component declarations
|
||||
* that are defined within the specified namespace, i.e. element
|
||||
* declarations, attribute declarations, etc.
|
||||
* declarations, attribute declarations, etc. Identity-constraint
|
||||
* definitions are also considered top-level.
|
||||
*
|
||||
* @param objectType The type of the declaration, i.e.
|
||||
* <code>ELEMENT_DECLARATION</code>.
|
||||
* @param namespace The namespace to which the declaration belongs or
|
||||
@ -145,6 +150,17 @@ public interface XSModel {
|
||||
public XSNotationDeclaration getNotationDeclaration(String name,
|
||||
String namespace);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns an identity-constraint definition.
|
||||
* @param name The name of the definition.
|
||||
* @param namespace The namespace of the definition, otherwise
|
||||
* <code>null</code>.
|
||||
* @return An identity-constraint definition or <code>null</code> if such
|
||||
* a declaration does not exist.
|
||||
*/
|
||||
public XSIDCDefinition getIDCDefinition(String name,
|
||||
String namespace);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a list containing the members of the
|
||||
* substitution group for the given <code>XSElementDeclaration</code>
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -20,6 +21,8 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.xs;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.xs.datatypes.ObjectList;
|
||||
|
||||
/**
|
||||
* Describes a multi-value constraining facets: pattern and enumeration.
|
||||
*/
|
||||
@ -35,6 +38,11 @@ public interface XSMultiValueFacet extends XSObject {
|
||||
*/
|
||||
public StringList getLexicalFacetValues();
|
||||
|
||||
/**
|
||||
* A list of XSValue objects. The actual enumeration values.
|
||||
*/
|
||||
public ObjectList getEnumerationValues();
|
||||
|
||||
/**
|
||||
* A sequence of [annotations] or an empty <code>XSObjectList</code>.
|
||||
*/
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -33,7 +34,9 @@ public interface XSNamespaceItem {
|
||||
|
||||
/**
|
||||
* [schema components]: a list of top-level components, i.e. element
|
||||
* declarations, attribute declarations, etc.
|
||||
* declarations, attribute declarations, etc. Identity-constraint
|
||||
* definitions are also considered top-level.
|
||||
*
|
||||
* @param objectType The type of the declaration, i.e.
|
||||
* <code>ELEMENT_DECLARATION</code>. Note that
|
||||
* <code>XSTypeDefinition.SIMPLE_TYPE</code> and
|
||||
@ -101,6 +104,14 @@ public interface XSNamespaceItem {
|
||||
*/
|
||||
public XSNotationDeclaration getNotationDeclaration(String name);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns an identity-constraint definition.
|
||||
* @param name The name of the definition.
|
||||
* @return An identity-constraint definition or <code>null</code> if such
|
||||
* a declaration does not exist.
|
||||
*/
|
||||
public XSIDCDefinition getIDCDefinition(String name);
|
||||
|
||||
/**
|
||||
* [document location] - a list of location URIs for the documents that
|
||||
* contributed to the <code>XSModel</code>.
|
||||
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003,2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -234,6 +235,11 @@ public interface XSSimpleTypeDefinition extends XSTypeDefinition {
|
||||
*/
|
||||
public XSObjectList getMultiValueFacets();
|
||||
|
||||
/**
|
||||
* A constraining facet object. An instance of XSFacet or XSMultiValueFacet.
|
||||
*/
|
||||
public XSObject getFacet(int facetType);
|
||||
|
||||
/**
|
||||
* A sequence of [annotations] or an empty <code>XSObjectList</code>.
|
||||
*/
|
||||
|
@ -0,0 +1,108 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.xs;
|
||||
|
||||
/**
|
||||
* Represents an actual value of a simple type.
|
||||
*/
|
||||
public interface XSValue {
|
||||
|
||||
/**
|
||||
* The schema normalized value.
|
||||
* @return The normalized value.
|
||||
*/
|
||||
public String getNormalizedValue();
|
||||
|
||||
/**
|
||||
* The actual value. <code>null</code> if the value is in error.
|
||||
* @return The actual value.
|
||||
*/
|
||||
public Object getActualValue();
|
||||
|
||||
/**
|
||||
* The declared simple type definition used to validate this value.
|
||||
* It can be a union type.
|
||||
* @return The declared simple type definition
|
||||
*/
|
||||
public XSSimpleTypeDefinition getTypeDefinition();
|
||||
|
||||
/**
|
||||
* If the declared simple type definition is a union, return the member
|
||||
* type actually used to validate the value. Otherwise null.
|
||||
* @return The member type
|
||||
*/
|
||||
public XSSimpleTypeDefinition getMemberTypeDefinition();
|
||||
|
||||
/**
|
||||
* If <code>getTypeDefinition()</code> returns a list type whose item type
|
||||
* is a union type, then this method returns a list with the same length
|
||||
* as the value list, for simple types that actually validated
|
||||
* the corresponding item in the value.
|
||||
* @return A list of type definitions
|
||||
*/
|
||||
public XSObjectList getMemberTypeDefinitions();
|
||||
|
||||
/**
|
||||
* The actual value built-in datatype, e.g.
|
||||
* <code>STRING_DT, SHORT_DT</code>. If the type definition of this
|
||||
* value is a list type definition, this method returns
|
||||
* <code>LIST_DT</code>. If the type definition of this value is a list
|
||||
* type definition whose item type is a union type definition, this
|
||||
* method returns <code>LISTOFUNION_DT</code>. To query the actual value
|
||||
* of the list or list of union type definitions use
|
||||
* <code>itemValueTypes()</code>.
|
||||
* @return The actual value type
|
||||
*/
|
||||
public short getActualValueType();
|
||||
|
||||
/**
|
||||
* In the case the actual value represents a list, i.e. the
|
||||
* <code>actualNormalizedValueType</code> is <code>LIST_DT</code>, the
|
||||
* returned array consists of one type kind which represents the itemType
|
||||
* . For example:
|
||||
* <pre> <simpleType name="listtype"> <list
|
||||
* itemType="positiveInteger"/> </simpleType> <element
|
||||
* name="list" type="listtype"/> ... <list>1 2 3</list> </pre>
|
||||
*
|
||||
* The <code>schemaNormalizedValue</code> value is "1 2 3", the
|
||||
* <code>actualNormalizedValueType</code> value is <code>LIST_DT</code>,
|
||||
* and the <code>itemValueTypes</code> is an array of size 1 with the
|
||||
* value <code>POSITIVEINTEGER_DT</code>.
|
||||
* <br> If the actual value represents a list type definition whose item
|
||||
* type is a union type definition, i.e. <code>LISTOFUNION_DT</code>,
|
||||
* for each actual value in the list the array contains the
|
||||
* corresponding memberType kind. For example:
|
||||
* <pre> <simpleType
|
||||
* name='union_type' memberTypes="integer string"/> <simpleType
|
||||
* name='listOfUnion'> <list itemType='union_type'/>
|
||||
* </simpleType> <element name="list" type="listOfUnion"/>
|
||||
* ... <list>1 2 foo</list> </pre>
|
||||
* The
|
||||
* <code>schemaNormalizedValue</code> value is "1 2 foo", the
|
||||
* <code>actualNormalizedValueType</code> is <code>LISTOFUNION_DT</code>
|
||||
* , and the <code>itemValueTypes</code> is an array of size 3 with the
|
||||
* following values: <code>INTEGER_DT, INTEGER_DT, STRING_DT</code>.
|
||||
* @return The list value types
|
||||
*/
|
||||
public ShortList getListValueTypes();
|
||||
|
||||
}
|
@ -3,11 +3,12 @@
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2004,2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
@ -17,6 +18,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.xs.datatypes;
|
||||
|
||||
import java.util.List;
|
||||
@ -60,4 +62,8 @@ public interface ByteList extends List {
|
||||
*/
|
||||
public byte item(int index) throws XSException;
|
||||
|
||||
/**
|
||||
* Construct and return a byte array for bytes contained in this list.
|
||||
*/
|
||||
public byte[] toByteArray();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user