feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
61
jdkSrc/jdk8/com/sun/xml/internal/xsom/ForeignAttributes.java
Normal file
61
jdkSrc/jdk8/com/sun/xml/internal/xsom/ForeignAttributes.java
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.Locator;
|
||||
import org.relaxng.datatype.ValidationContext;
|
||||
|
||||
/**
|
||||
* Foreign attributes on schema elements.
|
||||
*
|
||||
* <p>
|
||||
* This is not a schema component as defined in the spec,
|
||||
* but this is often useful for a schema processing application.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public interface ForeignAttributes extends Attributes {
|
||||
/**
|
||||
* Returns context information of the element to which foreign attributes
|
||||
* are attached.
|
||||
*
|
||||
* <p>
|
||||
* For example, this can be used to resolve relative references to other resources
|
||||
* (by using {@link ValidationContext#getBaseUri()}) or to resolve
|
||||
* namespace prefixes in the attribute values (by using {@link ValidationContext#resolveNamespacePrefix(String)}.
|
||||
*
|
||||
* @return
|
||||
* always non-null.
|
||||
*/
|
||||
ValidationContext getContext();
|
||||
|
||||
/**
|
||||
* Returns the location of the element to which foreign attributes
|
||||
* are attached.
|
||||
*/
|
||||
Locator getLocator();
|
||||
}
|
||||
176
jdkSrc/jdk8/com/sun/xml/internal/xsom/SCD.java
Normal file
176
jdkSrc/jdk8/com/sun/xml/internal/xsom/SCD.java
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import com.sun.xml.internal.xsom.impl.scd.Iterators;
|
||||
import com.sun.xml.internal.xsom.impl.scd.ParseException;
|
||||
import com.sun.xml.internal.xsom.impl.scd.SCDImpl;
|
||||
import com.sun.xml.internal.xsom.impl.scd.SCDParser;
|
||||
import com.sun.xml.internal.xsom.impl.scd.Step;
|
||||
import com.sun.xml.internal.xsom.impl.scd.TokenMgrError;
|
||||
import com.sun.xml.internal.xsom.util.DeferedCollection;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Schema Component Designator (SCD).
|
||||
*
|
||||
* <p>
|
||||
* SCD for schema is what XPath is for XML. SCD allows you to select a schema component(s)
|
||||
* from a schema component(s).
|
||||
*
|
||||
* <p>
|
||||
* See <a href="http://www.w3.org/TR/2005/WD-xmlschema-ref-20050329/">XML Schema: Component Designators</a>.
|
||||
* This implementation is based on 03/29/2005 working draft.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public abstract class SCD {
|
||||
|
||||
/**
|
||||
* Parses the string representation of SCD.
|
||||
*
|
||||
* <p>
|
||||
* This method involves parsing the path expression and preparing the in-memory
|
||||
* structure, so this is useful when you plan to use the same SCD against
|
||||
* different context node multiple times.
|
||||
*
|
||||
* <p>
|
||||
* If you want to evaluate SCD just once, use {@link XSComponent#select} methods.
|
||||
*
|
||||
* @param path
|
||||
* the string representation of SCD, such as "/foo/bar".
|
||||
* @param nsContext
|
||||
* Its {@link NamespaceContext#getNamespaceURI(String)} is used
|
||||
* to resolve prefixes in the SCD to the namespace URI.
|
||||
*/
|
||||
public static SCD create(String path, NamespaceContext nsContext) throws java.text.ParseException {
|
||||
try {
|
||||
SCDParser p = new SCDParser(path,nsContext);
|
||||
List<?> list = p.RelativeSchemaComponentPath();
|
||||
return new SCDImpl(path,list.toArray(new Step[list.size()]));
|
||||
} catch (TokenMgrError e) {
|
||||
throw setCause(new java.text.ParseException(e.getMessage(), -1 ),e);
|
||||
} catch (ParseException e) {
|
||||
throw setCause(new java.text.ParseException(e.getMessage(), e.currentToken.beginColumn ),e);
|
||||
}
|
||||
}
|
||||
|
||||
private static java.text.ParseException setCause(java.text.ParseException e, Throwable x) {
|
||||
e.initCause(x);
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the SCD against the given context node and
|
||||
* returns the matched nodes.
|
||||
*
|
||||
* @return
|
||||
* could be empty but never be null.
|
||||
*/
|
||||
public final Collection<XSComponent> select(XSComponent contextNode) {
|
||||
return new DeferedCollection<XSComponent>(select(Iterators.singleton(contextNode)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the SCD against the whole schema and
|
||||
* returns the matched nodes.
|
||||
*
|
||||
* <p>
|
||||
* This method is here because {@link XSSchemaSet}
|
||||
* doesn't implement {@link XSComponent}.
|
||||
*
|
||||
* @return
|
||||
* could be empty but never be null.
|
||||
*/
|
||||
public final Collection<XSComponent> select(XSSchemaSet contextNode) {
|
||||
return select(contextNode.getSchemas());
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the SCD against the given context node and
|
||||
* returns the matched node.
|
||||
*
|
||||
* @return
|
||||
* null if the SCD didn't match anything. If the SCD matched more than one node,
|
||||
* the first one will be returned.
|
||||
*/
|
||||
public final XSComponent selectSingle(XSComponent contextNode) {
|
||||
Iterator<XSComponent> r = select(Iterators.singleton(contextNode));
|
||||
if(r.hasNext()) return r.next();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the SCD against the whole schema set and
|
||||
* returns the matched node.
|
||||
*
|
||||
* @return
|
||||
* null if the SCD didn't match anything. If the SCD matched more than one node,
|
||||
* the first one will be returned.
|
||||
*/
|
||||
public final XSComponent selectSingle(XSSchemaSet contextNode) {
|
||||
Iterator<XSComponent> r = select(contextNode.iterateSchema());
|
||||
if(r.hasNext()) return r.next();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the SCD against the given set of context nodes and
|
||||
* returns the matched nodes.
|
||||
*
|
||||
* @param contextNodes
|
||||
* {@link XSComponent}s that represent the context node against
|
||||
* which {@link SCD} is evaluated.
|
||||
*
|
||||
* @return
|
||||
* could be empty but never be null.
|
||||
*/
|
||||
public abstract Iterator<XSComponent> select(Iterator<? extends XSComponent> contextNodes);
|
||||
|
||||
/**
|
||||
* Evaluates the SCD against the given set of context nodes and
|
||||
* returns the matched nodes.
|
||||
*
|
||||
* @param contextNodes
|
||||
* {@link XSComponent}s that represent the context node against
|
||||
* which {@link SCD} is evaluated.
|
||||
*
|
||||
* @return
|
||||
* could be empty but never be null.
|
||||
*/
|
||||
public final Collection<XSComponent> select(Collection<? extends XSComponent> contextNodes) {
|
||||
return new DeferedCollection<XSComponent>(select(contextNodes.iterator()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the textual SCD representation as given to {@link SCD#create(String, NamespaceContext)}.
|
||||
*/
|
||||
public abstract String toString();
|
||||
}
|
||||
63
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSAnnotation.java
Normal file
63
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSAnnotation.java
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import org.xml.sax.Locator;
|
||||
import com.sun.xml.internal.xsom.parser.AnnotationParser;
|
||||
|
||||
/**
|
||||
* <a href="http://www.w3.org/TR/xmlschema-1/#Annotation_details">
|
||||
* XML Schema annotation</a>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface XSAnnotation
|
||||
{
|
||||
/**
|
||||
* Obtains the application-parsed annotation.
|
||||
* <p>
|
||||
* annotations are parsed by the user-specified
|
||||
* {@link AnnotationParser}.
|
||||
*
|
||||
* @return may return null
|
||||
*/
|
||||
Object getAnnotation();
|
||||
|
||||
/**
|
||||
* Sets the value to be returned by {@link #getAnnotation()}.
|
||||
*
|
||||
* @param o
|
||||
* can be null.
|
||||
* @return
|
||||
* old value that was replaced by the <tt>o</tt>.
|
||||
*/
|
||||
Object setAnnotation(Object o);
|
||||
|
||||
/**
|
||||
* Returns a location information of the annotation.
|
||||
*/
|
||||
Locator getLocator();
|
||||
}
|
||||
99
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSAttContainer.java
Normal file
99
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSAttContainer.java
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Common aspect of {@link XSComplexType} and {@link XSAttGroupDecl}
|
||||
* as the container of attribute uses/attribute groups.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSAttContainer extends XSDeclaration {
|
||||
XSWildcard getAttributeWildcard();
|
||||
|
||||
/**
|
||||
* Looks for the attribute use with the specified name from
|
||||
* all the attribute uses that are directly/indirectly
|
||||
* referenced from this component.
|
||||
*
|
||||
* <p>
|
||||
* This is the exact implementation of the "attribute use"
|
||||
* schema component.
|
||||
*/
|
||||
XSAttributeUse getAttributeUse( String nsURI, String localName );
|
||||
|
||||
/**
|
||||
* Lists all the attribute uses that are directly/indirectly
|
||||
* referenced from this component.
|
||||
*
|
||||
* <p>
|
||||
* This is the exact implementation of the "attribute use"
|
||||
* schema component.
|
||||
*/
|
||||
Iterator<? extends XSAttributeUse> iterateAttributeUses();
|
||||
|
||||
/**
|
||||
* Gets all the attribute uses.
|
||||
*/
|
||||
Collection<? extends XSAttributeUse> getAttributeUses();
|
||||
|
||||
/**
|
||||
* Looks for the attribute use with the specified name from
|
||||
* the attribute uses which are declared in this complex type.
|
||||
*
|
||||
* This does not include att uses declared in att groups that
|
||||
* are referenced from this complex type, nor does include
|
||||
* att uses declared in base types.
|
||||
*/
|
||||
XSAttributeUse getDeclaredAttributeUse( String nsURI, String localName );
|
||||
|
||||
/**
|
||||
* Lists all the attribute uses that are declared in this complex type.
|
||||
*/
|
||||
Iterator<? extends XSAttributeUse> iterateDeclaredAttributeUses();
|
||||
|
||||
/**
|
||||
* Lists all the attribute uses that are declared in this complex type.
|
||||
*/
|
||||
Collection<? extends XSAttributeUse> getDeclaredAttributeUses();
|
||||
|
||||
|
||||
/**
|
||||
* Iterates all AttGroups which are directly referenced from
|
||||
* this component.
|
||||
*/
|
||||
Iterator<? extends XSAttGroupDecl> iterateAttGroups();
|
||||
|
||||
/**
|
||||
* Iterates all AttGroups which are directly referenced from
|
||||
* this component.
|
||||
*/
|
||||
Collection<? extends XSAttGroupDecl> getAttGroups();
|
||||
}
|
||||
36
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSAttGroupDecl.java
Normal file
36
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSAttGroupDecl.java
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Attribute group declaration.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSAttGroupDecl extends XSAttContainer {
|
||||
|
||||
}
|
||||
40
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSAttributeDecl.java
Normal file
40
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSAttributeDecl.java
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Attribute declaration.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSAttributeDecl extends XSDeclaration
|
||||
{
|
||||
XSSimpleType getType();
|
||||
|
||||
XmlString getDefaultValue();
|
||||
XmlString getFixedValue();
|
||||
}
|
||||
54
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSAttributeUse.java
Normal file
54
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSAttributeUse.java
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Attribute use.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSAttributeUse extends XSComponent
|
||||
{
|
||||
boolean isRequired();
|
||||
XSAttributeDecl getDecl();
|
||||
|
||||
/**
|
||||
* Gets the default value of this attribute use, if one is specified.
|
||||
*
|
||||
* Note that if a default value is specified in the attribute
|
||||
* declaration, this method returns that value.
|
||||
*/
|
||||
XmlString getDefaultValue();
|
||||
|
||||
/**
|
||||
* Gets the fixed value of this attribute use, if one is specified.
|
||||
*
|
||||
* Note that if a fixed value is specified in the attribute
|
||||
* declaration, this method returns that value.
|
||||
*/
|
||||
XmlString getFixedValue();
|
||||
}
|
||||
119
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSComplexType.java
Normal file
119
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSComplexType.java
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Complex type.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSComplexType extends XSType, XSAttContainer
|
||||
{
|
||||
/**
|
||||
* Checks if this complex type is declared as an abstract type.
|
||||
*/
|
||||
boolean isAbstract();
|
||||
|
||||
boolean isFinal(int derivationMethod);
|
||||
/**
|
||||
* Roughly corresponds to the block attribute. But see the spec
|
||||
* for gory detail.
|
||||
*/
|
||||
boolean isSubstitutionProhibited(int method);
|
||||
|
||||
/**
|
||||
* Gets the scope of this complex type.
|
||||
* This is not a property defined in the schema spec.
|
||||
*
|
||||
* @return
|
||||
* null if this complex type is global. Otherwise
|
||||
* return the element declaration that contains this anonymous
|
||||
* complex type.
|
||||
*/
|
||||
XSElementDecl getScope();
|
||||
|
||||
/**
|
||||
* The content of this complex type.
|
||||
*
|
||||
* @return
|
||||
* always non-null.
|
||||
*/
|
||||
XSContentType getContentType();
|
||||
|
||||
/**
|
||||
* Gets the explicit content of a complex type with a complex content
|
||||
* that was derived by extension.
|
||||
*
|
||||
* <p>
|
||||
* Informally, the "explicit content" is the portion of the
|
||||
* content model added in this derivation. IOW, it's a delta between
|
||||
* the base complex type and this complex type.
|
||||
*
|
||||
* <p>
|
||||
* For example, when a complex type T2 derives fom T1, then:
|
||||
* <pre>
|
||||
* content type of T2 = SEQUENCE( content type of T1, explicit content of T2 )
|
||||
* </pre>
|
||||
*
|
||||
* @return
|
||||
* If this complex type is derived by restriction or has a
|
||||
* simple content, this method returns null.
|
||||
* IOW, this method only works for a complex type with
|
||||
* a complex content derived by extension from another complex type.
|
||||
*/
|
||||
XSContentType getExplicitContent();
|
||||
|
||||
// meaningful only if getContentType returns particles
|
||||
boolean isMixed();
|
||||
|
||||
/**
|
||||
* If this {@link XSComplexType} is redefined by another complex type,
|
||||
* return that component.
|
||||
*
|
||||
* @return null
|
||||
* if this component has not been redefined.
|
||||
*/
|
||||
public XSComplexType getRedefinedBy();
|
||||
|
||||
/**
|
||||
* Returns a list of direct subtypes of this complex type. If the type is not subtyped, returns empty list.
|
||||
* Doesn't return null.
|
||||
* Note that the complex type may be extended outside of the scope of the schemaset known to XSOM.
|
||||
* @return
|
||||
*/
|
||||
public List<XSComplexType> getSubtypes();
|
||||
|
||||
/**
|
||||
* Returns a list of element declarations of this type.
|
||||
* @return
|
||||
*/
|
||||
public List<XSElementDecl> getElementDecls();
|
||||
|
||||
}
|
||||
170
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSComponent.java
Normal file
170
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSComponent.java
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import com.sun.xml.internal.xsom.parser.SchemaDocument;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Base interface for all the schema components.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSComponent
|
||||
{
|
||||
/** Gets the annotation associated to this component, if any. */
|
||||
XSAnnotation getAnnotation();
|
||||
|
||||
/**
|
||||
* Works like {@link #getAnnotation()}, but allow a new empty {@link XSAnnotation} to be created
|
||||
* if not exist.
|
||||
*
|
||||
* @param createIfNotExist
|
||||
* true to create a new {@link XSAnnotation} if it doesn't exist already.
|
||||
* false to make this method behavel like {@link #getAnnotation()}.
|
||||
*
|
||||
* @return
|
||||
* null if <tt>createIfNotExist==false</tt> and annotation didn't exist.
|
||||
* Otherwise non-null.
|
||||
*/
|
||||
XSAnnotation getAnnotation(boolean createIfNotExist);
|
||||
|
||||
/**
|
||||
* Gets the foreign attributes on this schema component.
|
||||
*
|
||||
* <p>
|
||||
* In general, a schema component may match multiple elements
|
||||
* in a schema document, and those elements can individually
|
||||
* carry foreign attributes.
|
||||
*
|
||||
* <p>
|
||||
* This method returns a list of {@link ForeignAttributes}, where
|
||||
* each {@link ForeignAttributes} object represent foreign attributes
|
||||
* on one element.
|
||||
*
|
||||
* @return
|
||||
* can be an empty list but never be null.
|
||||
*/
|
||||
List<? extends ForeignAttributes> getForeignAttributes();
|
||||
|
||||
/**
|
||||
* Gets the foreign attribute of the given name, or null if not found.
|
||||
*
|
||||
* <p>
|
||||
* If multiple occurences of the same attribute is found,
|
||||
* this method returns the first one.
|
||||
*
|
||||
* @see #getForeignAttributes()
|
||||
*/
|
||||
String getForeignAttribute(String nsUri, String localName);
|
||||
|
||||
/**
|
||||
* Gets the locator that indicates the source location where
|
||||
* this component is created from, or null if no information is
|
||||
* available.
|
||||
*/
|
||||
Locator getLocator();
|
||||
|
||||
/**
|
||||
* Gets a reference to the {@link XSSchema} object to which this component
|
||||
* belongs.
|
||||
* <p>
|
||||
* In case of <code>XSEmpty</code> component, this method
|
||||
* returns null since there is no owner component.
|
||||
*/
|
||||
XSSchema getOwnerSchema();
|
||||
|
||||
/**
|
||||
* Gets the root schema set that includes this component.
|
||||
*
|
||||
* <p>
|
||||
* In case of <code>XSEmpty</code> component, this method
|
||||
* returns null since there is no owner component.
|
||||
*/
|
||||
XSSchemaSet getRoot();
|
||||
|
||||
/**
|
||||
* Gets the {@link SchemaDocument} that indicates which document this component
|
||||
* was defined in.
|
||||
*
|
||||
* @return
|
||||
* null for components that are built-in to XML Schema, such
|
||||
* as anyType, or "empty" {@link XSContentType}. This method also
|
||||
* returns null for {@link XSSchema}.
|
||||
* For all other user-defined
|
||||
* components this method returns non-null, even if they are local.
|
||||
*/
|
||||
SchemaDocument getSourceDocument();
|
||||
|
||||
/**
|
||||
* Evaluates a schema component designator against this schema component
|
||||
* and returns the resulting schema components.
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if SCD is syntactically incorrect.
|
||||
*
|
||||
* @param scd
|
||||
* Schema component designator. See {@link SCD} for more details.
|
||||
* @param nsContext
|
||||
* The namespace context in which SCD is evaluated. Cannot be null.
|
||||
* @return
|
||||
* Can be empty but never null.
|
||||
*/
|
||||
Collection<XSComponent> select(String scd, NamespaceContext nsContext);
|
||||
|
||||
/**
|
||||
* Evaluates a schema component designator against this schema component
|
||||
* and returns the first resulting schema component.
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if SCD is syntactically incorrect.
|
||||
*
|
||||
* @param scd
|
||||
* Schema component designator. See {@link SCD} for more details.
|
||||
* @param nsContext
|
||||
* The namespace context in which SCD is evaluated. Cannot be null.
|
||||
* @return
|
||||
* null if the SCD didn't match anything. If the SCD matched more than one node,
|
||||
* the first one will be returned.
|
||||
*/
|
||||
XSComponent selectSingle(String scd, NamespaceContext nsContext);
|
||||
|
||||
/**
|
||||
* Accepts a visitor.
|
||||
*/
|
||||
void visit( XSVisitor visitor );
|
||||
/**
|
||||
* Accepts a functor.
|
||||
*/
|
||||
<T> T apply( XSFunction<T> function );
|
||||
}
|
||||
55
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSContentType.java
Normal file
55
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSContentType.java
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import com.sun.xml.internal.xsom.visitor.XSContentTypeFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSContentTypeVisitor;
|
||||
|
||||
/**
|
||||
* Content of a complex type.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSContentType extends XSComponent
|
||||
{
|
||||
/**
|
||||
* Equivalent of <code>(this instanceof XSSimpleType)?this:null</code>
|
||||
*/
|
||||
XSSimpleType asSimpleType();
|
||||
/**
|
||||
* Equivalent of <code>(this instanceof XSParticle)?this:null</code>
|
||||
*/
|
||||
XSParticle asParticle();
|
||||
/**
|
||||
* If this content type represents the empty content, return <code>this</code>,
|
||||
* otherwise null.
|
||||
*/
|
||||
XSContentType asEmpty();
|
||||
|
||||
<T> T apply( XSContentTypeFunction<T> function );
|
||||
void visit( XSContentTypeVisitor visitor );
|
||||
}
|
||||
68
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSDeclaration.java
Normal file
68
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSDeclaration.java
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Base interface of all "declarations".
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSDeclaration extends XSComponent
|
||||
{
|
||||
/**
|
||||
* Target namespace to which this component belongs.
|
||||
* <code>""</code> is used to represent the default no namespace.
|
||||
*/
|
||||
String getTargetNamespace();
|
||||
|
||||
/**
|
||||
* Gets the (local) name of the declaration.
|
||||
*
|
||||
* @return null if this component is anonymous.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @deprecated use the isGlobal method, which always returns
|
||||
* the opposite of this function. Or the isLocal method.
|
||||
*/
|
||||
boolean isAnonymous();
|
||||
|
||||
/**
|
||||
* Returns true if this declaration is a global declaration.
|
||||
*
|
||||
* Global declarations are those declaration that can be enumerated
|
||||
* through the schema object.
|
||||
*/
|
||||
boolean isGlobal();
|
||||
|
||||
/**
|
||||
* Returns true if this declaration is a local declaration.
|
||||
* Equivalent of <code>!isGlobal()</code>
|
||||
*/
|
||||
boolean isLocal();
|
||||
}
|
||||
155
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSElementDecl.java
Normal file
155
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSElementDecl.java
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Element declaration.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSElementDecl extends XSDeclaration, XSTerm
|
||||
{
|
||||
/**
|
||||
* Gets the type of this element declaration.
|
||||
* @return
|
||||
* always non-null.
|
||||
*/
|
||||
XSType getType();
|
||||
|
||||
boolean isNillable();
|
||||
|
||||
/**
|
||||
* Gets the substitution head of this element, if any.
|
||||
* Otherwise null.
|
||||
*/
|
||||
XSElementDecl getSubstAffiliation();
|
||||
|
||||
/**
|
||||
* Returns all the {@link XSIdentityConstraint}s in this element decl.
|
||||
*
|
||||
* @return
|
||||
* never null, but can be empty.
|
||||
*/
|
||||
List<XSIdentityConstraint> getIdentityConstraints();
|
||||
|
||||
/**
|
||||
* Checks the substitution excluded property of the schema component.
|
||||
*
|
||||
* IOW, this checks the value of the <code>final</code> attribute
|
||||
* (plus <code>finalDefault</code>).
|
||||
*
|
||||
* @param method
|
||||
* Possible values are {@link XSType#EXTENSION} or
|
||||
* <code>XSType.RESTRICTION</code>.
|
||||
*/
|
||||
boolean isSubstitutionExcluded(int method);
|
||||
|
||||
/**
|
||||
* Checks the diallowed substitution property of the schema component.
|
||||
*
|
||||
* IOW, this checks the value of the <code>block</code> attribute
|
||||
* (plus <code>blockDefault</code>).
|
||||
*
|
||||
* @param method
|
||||
* Possible values are {@link XSType#EXTENSION},
|
||||
* <code>XSType.RESTRICTION</code>, or <code>XSType.SUBSTITUTION</code>
|
||||
*/
|
||||
boolean isSubstitutionDisallowed(int method);
|
||||
|
||||
boolean isAbstract();
|
||||
|
||||
/**
|
||||
* Returns the element declarations that can substitute
|
||||
* this element.
|
||||
*
|
||||
* <p>
|
||||
* IOW, this set returns all the element decls that satisfies
|
||||
* <a href="http://www.w3.org/TR/xmlschema-1/#cos-equiv-derived-ok-rec">
|
||||
* the "Substitution Group OK" constraint.
|
||||
* </a>
|
||||
*
|
||||
* @return
|
||||
* nun-null valid array. The return value always contains this element
|
||||
* decl itself.
|
||||
*
|
||||
* @deprecated
|
||||
* this method allocates a new array every time, so it could be
|
||||
* inefficient when working with a large schema. Use
|
||||
* {@link #getSubstitutables()} instead.
|
||||
*/
|
||||
XSElementDecl[] listSubstitutables();
|
||||
|
||||
/**
|
||||
* Returns the element declarations that can substitute
|
||||
* this element.
|
||||
*
|
||||
* <p>
|
||||
* IOW, this set returns all the element decls that satisfies
|
||||
* <a href="http://www.w3.org/TR/xmlschema-1/#cos-equiv-derived-ok-rec">
|
||||
* the "Substitution Group OK" constraint.
|
||||
* </a>
|
||||
*
|
||||
* <p>
|
||||
* Note that the above clause does <em>NOT</em> check for
|
||||
* abstract elements. So abstract elements may still show up
|
||||
* in the returned set.
|
||||
*
|
||||
* @return
|
||||
* nun-null unmodifiable list.
|
||||
* The returned list always contains this element decl itself.
|
||||
*/
|
||||
Set<? extends XSElementDecl> getSubstitutables();
|
||||
|
||||
/**
|
||||
* Returns true if this element declaration can be validly substituted
|
||||
* by the given declaration.
|
||||
*
|
||||
* <p>
|
||||
* Just a short cut of <tt>getSubstitutables().contain(e);</tt>
|
||||
*/
|
||||
boolean canBeSubstitutedBy(XSElementDecl e);
|
||||
|
||||
// TODO: identitiy constraints
|
||||
// TODO: scope
|
||||
|
||||
XmlString getDefaultValue();
|
||||
XmlString getFixedValue();
|
||||
|
||||
/**
|
||||
* Used for javadoc schema generation
|
||||
*
|
||||
* @return
|
||||
* null if form attribute not present,
|
||||
* true if form attribute present and set to qualified,
|
||||
* false if form attribute present and set to unqualified.
|
||||
*/
|
||||
|
||||
Boolean getForm();
|
||||
}
|
||||
59
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSFacet.java
Normal file
59
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSFacet.java
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Facet for a simple type.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSFacet extends XSComponent
|
||||
{
|
||||
/** Gets the name of the facet, such as "length". */
|
||||
String getName();
|
||||
|
||||
/** Gets the value of the facet. */
|
||||
XmlString getValue();
|
||||
|
||||
/** Returns true if this facet is "fixed". */
|
||||
boolean isFixed();
|
||||
|
||||
|
||||
// well-known facet name constants
|
||||
final static String FACET_LENGTH = "length";
|
||||
final static String FACET_MINLENGTH = "minLength";
|
||||
final static String FACET_MAXLENGTH = "maxLength";
|
||||
final static String FACET_PATTERN = "pattern";
|
||||
final static String FACET_ENUMERATION = "enumeration";
|
||||
final static String FACET_TOTALDIGITS = "totalDigits";
|
||||
final static String FACET_FRACTIONDIGITS = "fractionDigits";
|
||||
final static String FACET_MININCLUSIVE = "minInclusive";
|
||||
final static String FACET_MAXINCLUSIVE = "maxInclusive";
|
||||
final static String FACET_MINEXCLUSIVE = "minExclusive";
|
||||
final static String FACET_MAXEXCLUSIVE = "maxExclusive";
|
||||
final static String FACET_WHITESPACE = "whiteSpace";
|
||||
}
|
||||
102
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSIdentityConstraint.java
Normal file
102
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSIdentityConstraint.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Identity constraint.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public interface XSIdentityConstraint extends XSComponent {
|
||||
|
||||
/**
|
||||
* Gets the {@link XSElementDecl} that owns this identity constraint.
|
||||
*
|
||||
* @return
|
||||
* never null.
|
||||
*/
|
||||
XSElementDecl getParent();
|
||||
|
||||
/**
|
||||
* Name of the identity constraint.
|
||||
*
|
||||
* A name uniquely identifies this {@link XSIdentityConstraint} within
|
||||
* the namespace.
|
||||
*
|
||||
* @return
|
||||
* never null.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Target namespace of the identity constraint.
|
||||
*
|
||||
* Just short for <code>getParent().getTargetNamespace()</code>.
|
||||
*/
|
||||
String getTargetNamespace();
|
||||
|
||||
/**
|
||||
* Returns the type of the identity constraint.
|
||||
*
|
||||
* @return
|
||||
* either {@link #KEY},{@link #KEYREF}, or {@link #UNIQUE}.
|
||||
*/
|
||||
short getCategory();
|
||||
|
||||
final short KEY = 0;
|
||||
final short KEYREF = 1;
|
||||
final short UNIQUE = 2;
|
||||
|
||||
/**
|
||||
* Returns the selector XPath expression as string.
|
||||
*
|
||||
* @return
|
||||
* never null.
|
||||
*/
|
||||
XSXPath getSelector();
|
||||
|
||||
/**
|
||||
* Returns the list of field XPaths.
|
||||
*
|
||||
* @return
|
||||
* a non-empty read-only list of {@link String}s,
|
||||
* each representing the XPath.
|
||||
*/
|
||||
List<XSXPath> getFields();
|
||||
|
||||
/**
|
||||
* If this is {@link #KEYREF}, returns the key {@link XSIdentityConstraint}
|
||||
* being referenced.
|
||||
*
|
||||
* @return
|
||||
* always non-null (when {@link #getCategory()}=={@link #KEYREF}).
|
||||
* @throws IllegalStateException
|
||||
* if {@link #getCategory()}!={@link #KEYREF}
|
||||
*/
|
||||
XSIdentityConstraint getReferencedKey();
|
||||
}
|
||||
37
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSListSimpleType.java
Normal file
37
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSListSimpleType.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* List simple type.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSListSimpleType extends XSSimpleType
|
||||
{
|
||||
XSSimpleType getItemType();
|
||||
}
|
||||
86
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSModelGroup.java
Normal file
86
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSModelGroup.java
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Model group.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSModelGroup extends XSComponent, XSTerm, Iterable<XSParticle>
|
||||
{
|
||||
/**
|
||||
* Type-safe enumeration for kind of model groups.
|
||||
* Constants are defined in the {@link XSModelGroup} interface.
|
||||
*/
|
||||
public static enum Compositor {
|
||||
ALL("all"),CHOICE("choice"),SEQUENCE("sequence");
|
||||
|
||||
private Compositor(String _value) {
|
||||
this.value = _value;
|
||||
}
|
||||
|
||||
private final String value;
|
||||
/**
|
||||
* Returns the human-readable compositor name.
|
||||
*
|
||||
* @return
|
||||
* Either "all", "sequence", or "choice".
|
||||
*/
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A constant that represents "all" compositor.
|
||||
*/
|
||||
static final Compositor ALL = Compositor.ALL;
|
||||
/**
|
||||
* A constant that represents "sequence" compositor.
|
||||
*/
|
||||
static final Compositor SEQUENCE = Compositor.SEQUENCE;
|
||||
/**
|
||||
* A constant that represents "choice" compositor.
|
||||
*/
|
||||
static final Compositor CHOICE = Compositor.CHOICE;
|
||||
|
||||
Compositor getCompositor();
|
||||
|
||||
/**
|
||||
* Gets <i>i</i>-ith child.
|
||||
*/
|
||||
XSParticle getChild(int idx);
|
||||
/**
|
||||
* Gets the number of children.
|
||||
*/
|
||||
int getSize();
|
||||
|
||||
/**
|
||||
* Gets all the children in one array.
|
||||
*/
|
||||
XSParticle[] getChildren();
|
||||
}
|
||||
41
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSModelGroupDecl.java
Normal file
41
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSModelGroupDecl.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
|
||||
/**
|
||||
* Named model group declaration.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSModelGroupDecl extends XSDeclaration, XSTerm
|
||||
{
|
||||
/**
|
||||
* Gets the body of this declaration.
|
||||
*/
|
||||
XSModelGroup getModelGroup();
|
||||
}
|
||||
37
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSNotation.java
Normal file
37
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSNotation.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Notation declaration.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSNotation extends XSDeclaration {
|
||||
String getPublicId();
|
||||
String getSystemId();
|
||||
}
|
||||
56
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSParticle.java
Normal file
56
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSParticle.java
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import java.math.*;
|
||||
|
||||
/**
|
||||
* Particle schema component.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSParticle extends XSContentType
|
||||
{
|
||||
BigInteger getMinOccurs();
|
||||
/**
|
||||
* Gets the max occurs property.
|
||||
*
|
||||
* @return
|
||||
* {@link UNBOUNDED} will be returned if the value
|
||||
* is "unbounded".
|
||||
*/
|
||||
BigInteger getMaxOccurs();
|
||||
|
||||
/**
|
||||
* True if the maxOccurs is neither 0 or 1.
|
||||
*/
|
||||
boolean isRepeated();
|
||||
|
||||
public static final int UNBOUNDED = -1;
|
||||
|
||||
XSTerm getTerm();
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Restriction simple type.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSRestrictionSimpleType extends XSSimpleType {
|
||||
// TODO
|
||||
|
||||
/** Iterates facets that are specified in this step of derivation. */
|
||||
public Iterator<XSFacet> iterateDeclaredFacets();
|
||||
|
||||
/**
|
||||
* Gets all the facets that are declared on this restriction.
|
||||
*
|
||||
* @return
|
||||
* Can be empty but always non-null.
|
||||
*/
|
||||
public Collection<? extends XSFacet> getDeclaredFacets();
|
||||
|
||||
/**
|
||||
* Gets the declared facet object of the given name.
|
||||
*
|
||||
* <p>
|
||||
* This method returns a facet object that is added in this
|
||||
* type and does not recursively check the ancestors.
|
||||
*
|
||||
* <p>
|
||||
* For those facets that can have multiple values
|
||||
* (pattern facets and enumeration facets), this method
|
||||
* will return only the first one.
|
||||
*
|
||||
* @return
|
||||
* Null if the facet is not specified in the last step
|
||||
* of derivation.
|
||||
*/
|
||||
XSFacet getDeclaredFacet( String name );
|
||||
|
||||
/**
|
||||
* Gets the declared facets of the given name.
|
||||
*
|
||||
* This method is for those facets (such as 'pattern') that
|
||||
* can be specified multiple times on a simple type.
|
||||
*
|
||||
* @return
|
||||
* can be empty but never be null.
|
||||
*/
|
||||
List<XSFacet> getDeclaredFacets( String name );
|
||||
}
|
||||
139
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSSchema.java
Normal file
139
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSSchema.java
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import com.sun.xml.internal.xsom.parser.SchemaDocument;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Schema.
|
||||
*
|
||||
* Container of declarations that belong to the same target namespace.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSSchema extends XSComponent
|
||||
{
|
||||
/**
|
||||
* Gets the target namespace of the schema.
|
||||
*
|
||||
* @return
|
||||
* can be empty, but never be null.
|
||||
*/
|
||||
String getTargetNamespace();
|
||||
|
||||
/**
|
||||
* Gets all the {@link XSAttributeDecl}s in this schema
|
||||
* keyed by their local names.
|
||||
*/
|
||||
Map<String,XSAttributeDecl> getAttributeDecls();
|
||||
Iterator<XSAttributeDecl> iterateAttributeDecls();
|
||||
XSAttributeDecl getAttributeDecl(String localName);
|
||||
|
||||
/**
|
||||
* Gets all the {@link XSElementDecl}s in this schema.
|
||||
*/
|
||||
Map<String,XSElementDecl> getElementDecls();
|
||||
Iterator<XSElementDecl> iterateElementDecls();
|
||||
XSElementDecl getElementDecl(String localName);
|
||||
|
||||
/**
|
||||
* Gets all the {@link XSAttGroupDecl}s in this schema.
|
||||
*/
|
||||
Map<String,XSAttGroupDecl> getAttGroupDecls();
|
||||
Iterator<XSAttGroupDecl> iterateAttGroupDecls();
|
||||
XSAttGroupDecl getAttGroupDecl(String localName);
|
||||
|
||||
/**
|
||||
* Gets all the {@link XSModelGroupDecl}s in this schema.
|
||||
*/
|
||||
Map<String,XSModelGroupDecl> getModelGroupDecls();
|
||||
Iterator<XSModelGroupDecl> iterateModelGroupDecls();
|
||||
XSModelGroupDecl getModelGroupDecl(String localName);
|
||||
|
||||
/**
|
||||
* Gets all the {@link XSType}s in this schema (union of
|
||||
* {@link #getSimpleTypes()} and {@link #getComplexTypes()}
|
||||
*/
|
||||
Map<String,XSType> getTypes();
|
||||
Iterator<XSType> iterateTypes();
|
||||
XSType getType(String localName);
|
||||
|
||||
/**
|
||||
* Gets all the {@link XSSimpleType}s in this schema.
|
||||
*/
|
||||
Map<String,XSSimpleType> getSimpleTypes();
|
||||
Iterator<XSSimpleType> iterateSimpleTypes();
|
||||
XSSimpleType getSimpleType(String localName);
|
||||
|
||||
/**
|
||||
* Gets all the {@link XSComplexType}s in this schema.
|
||||
*/
|
||||
Map<String,XSComplexType> getComplexTypes();
|
||||
Iterator<XSComplexType> iterateComplexTypes();
|
||||
XSComplexType getComplexType(String localName);
|
||||
|
||||
/**
|
||||
* Gets all the {@link XSNotation}s in this schema.
|
||||
*/
|
||||
Map<String,XSNotation> getNotations();
|
||||
Iterator<XSNotation> iterateNotations();
|
||||
XSNotation getNotation(String localName);
|
||||
|
||||
/**
|
||||
* Gets all the {@link XSIdentityConstraint}s in this schema,
|
||||
* keyed by their names.
|
||||
*/
|
||||
Map<String,XSIdentityConstraint> getIdentityConstraints();
|
||||
|
||||
/**
|
||||
* Gets the identity constraint of the given name, or null if not found.
|
||||
*/
|
||||
XSIdentityConstraint getIdentityConstraint(String localName);
|
||||
|
||||
/**
|
||||
* Sine an {@link XSSchema} is not necessarily defined in
|
||||
* one schema document (for example one schema can span across
|
||||
* many documents through <xs:include>s.),
|
||||
* so this method always returns null.
|
||||
*
|
||||
* @deprecated
|
||||
* Since this method always returns null, if you are calling
|
||||
* this method from {@link XSSchema} and not from {@link XSComponent},
|
||||
* there's something wrong with your code.
|
||||
*/
|
||||
SchemaDocument getSourceDocument();
|
||||
|
||||
/**
|
||||
* Gets the root schema set that includes this schema.
|
||||
*
|
||||
* @return never null.
|
||||
*/
|
||||
XSSchemaSet getRoot();
|
||||
}
|
||||
115
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSSchemaSet.java
Normal file
115
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSSchemaSet.java
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import java.util.Iterator;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Set of {@link XSSchema} objects.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSSchemaSet
|
||||
{
|
||||
XSSchema getSchema(String targetNamespace);
|
||||
XSSchema getSchema(int idx);
|
||||
int getSchemaSize();
|
||||
Iterator<XSSchema> iterateSchema();
|
||||
|
||||
/**
|
||||
* Gets all {@link XSSchema}s in a single collection.
|
||||
*/
|
||||
Collection<XSSchema> getSchemas();
|
||||
|
||||
XSType getType(String namespaceURI, String localName);
|
||||
XSSimpleType getSimpleType(String namespaceURI, String localName);
|
||||
XSAttributeDecl getAttributeDecl(String namespaceURI, String localName);
|
||||
XSElementDecl getElementDecl(String namespaceURI, String localName);
|
||||
XSModelGroupDecl getModelGroupDecl(String namespaceURI, String localName);
|
||||
XSAttGroupDecl getAttGroupDecl(String namespaceURI, String localName);
|
||||
XSComplexType getComplexType(String namespaceURI, String localName);
|
||||
XSIdentityConstraint getIdentityConstraint(String namespaceURI, String localName);
|
||||
|
||||
/** Iterates all element declarations in all the schemas. */
|
||||
Iterator<XSElementDecl> iterateElementDecls();
|
||||
/** Iterates all type definitions in all the schemas. */
|
||||
Iterator<XSType> iterateTypes();
|
||||
/** Iterates all atribute declarations in all the schemas. */
|
||||
Iterator<XSAttributeDecl> iterateAttributeDecls();
|
||||
/** Iterates all attribute group declarations in all the schemas. */
|
||||
Iterator<XSAttGroupDecl> iterateAttGroupDecls();
|
||||
/** Iterates all model group declarations in all the schemas. */
|
||||
Iterator<XSModelGroupDecl> iterateModelGroupDecls();
|
||||
/** Iterates all simple type definitions in all the schemas. */
|
||||
Iterator<XSSimpleType> iterateSimpleTypes();
|
||||
/** Iterates all complex type definitions in all the schemas. */
|
||||
Iterator<XSComplexType> iterateComplexTypes();
|
||||
/** Iterates all notation declarations in all the schemas. */
|
||||
Iterator<XSNotation> iterateNotations();
|
||||
/**
|
||||
* Iterates all identity constraints in all the schemas.
|
||||
*/
|
||||
Iterator<XSIdentityConstraint> iterateIdentityConstraints();
|
||||
|
||||
// conceptually static methods
|
||||
XSComplexType getAnyType();
|
||||
XSSimpleType getAnySimpleType();
|
||||
XSContentType getEmpty();
|
||||
|
||||
/**
|
||||
* Evaluates a schema component designator against this schema component
|
||||
* and returns the resulting schema components.
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if SCD is syntactically incorrect.
|
||||
* @param scd
|
||||
* Schema component designator. See {@link SCD} for more details.
|
||||
* @param nsContext
|
||||
* The namespace context in which SCD is evaluated. Cannot be null.
|
||||
* @return
|
||||
* Can be empty but never null.
|
||||
*/
|
||||
Collection<XSComponent> select(String scd, NamespaceContext nsContext);
|
||||
|
||||
/**
|
||||
* Evaluates a schema component designator against this schema component
|
||||
* and returns the first resulting schema component.
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if SCD is syntactically incorrect.
|
||||
* @param scd
|
||||
* Schema component designator. See {@link SCD} for more details.
|
||||
* @param nsContext
|
||||
* The namespace context in which SCD is evaluated. Cannot be null.
|
||||
* @return
|
||||
* null if the SCD didn't match anything. If the SCD matched more than one node,
|
||||
* the first one will be returned.
|
||||
*/
|
||||
XSComponent selectSingle(String scd, NamespaceContext nsContext);
|
||||
}
|
||||
162
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSSimpleType.java
Normal file
162
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSSimpleType.java
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import com.sun.xml.internal.xsom.visitor.XSSimpleTypeFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSSimpleTypeVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Simple type.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSSimpleType extends XSType, XSContentType
|
||||
{
|
||||
/**
|
||||
* Gets the base type as XSSimpleType.
|
||||
*
|
||||
* Equivalent to
|
||||
* <code>
|
||||
* (XSSimpleType)getBaseType()
|
||||
* </code>
|
||||
* Since this is a simple type, we know that the base type
|
||||
* is also a simple type.
|
||||
*
|
||||
* The only exception is xs:anySimpleType, which has xs:anyType
|
||||
* as the base type.
|
||||
*
|
||||
* @return
|
||||
* null if this is xs:anySimpleType. Otherwise non-null.
|
||||
*/
|
||||
XSSimpleType getSimpleBaseType();
|
||||
|
||||
/**
|
||||
* Gets the variety of this simple type.
|
||||
*/
|
||||
XSVariety getVariety();
|
||||
|
||||
/**
|
||||
* Gets the ancestor primitive {@link XSSimpleType} if
|
||||
* this type is {@link XSVariety#ATOMIC atomic}.
|
||||
*
|
||||
* @return
|
||||
* null otherwise.
|
||||
*/
|
||||
XSSimpleType getPrimitiveType();
|
||||
|
||||
/**
|
||||
* Returns true if this is a primitive built-in simple type
|
||||
* (that directly derives from xs:anySimpleType, by definition.)
|
||||
*/
|
||||
boolean isPrimitive();
|
||||
|
||||
/**
|
||||
* Gets the nearest ancestor {@link XSListSimpleType} (including itself)
|
||||
* if the variety of this type is {@link XSVariety#LIST list}.
|
||||
*
|
||||
* @return otherwise return null
|
||||
*/
|
||||
XSListSimpleType getBaseListType();
|
||||
|
||||
/**
|
||||
* Gets the nearest ancestor {@link XSUnionSimpleType} (including itself)
|
||||
* if the variety of this type is {@link XSVariety#UNION union}.
|
||||
*
|
||||
* @return otherwise return null
|
||||
*/
|
||||
XSUnionSimpleType getBaseUnionType();
|
||||
|
||||
/**
|
||||
* Returns true if this type definition is marked as 'final'
|
||||
* with respect to the given {@link XSVariety}.
|
||||
*
|
||||
* @return
|
||||
* true if the type is marked final.
|
||||
*/
|
||||
boolean isFinal(XSVariety v);
|
||||
|
||||
/**
|
||||
* If this {@link XSSimpleType} is redefined by another simple type,
|
||||
* return that component.
|
||||
*
|
||||
* @return null
|
||||
* if this component has not been redefined.
|
||||
*/
|
||||
public XSSimpleType getRedefinedBy();
|
||||
|
||||
/**
|
||||
* Gets the effective facet object of the given name.
|
||||
*
|
||||
* <p>
|
||||
* For example, if a simple type "foo" is derived from
|
||||
* xs:string by restriction with the "maxLength" facet and
|
||||
* another simple type "bar" is derived from "foo" by
|
||||
* restriction with another "maxLength" facet, this method
|
||||
* will return the latter one, because that is the most
|
||||
* restrictive, effective facet.
|
||||
*
|
||||
* <p>
|
||||
* For those facets that can have multiple values
|
||||
* (pattern facets and enumeration facets), this method
|
||||
* will return only the first one.
|
||||
* TODO: allow clients to access all of them by some means.
|
||||
*
|
||||
* @return
|
||||
* If this datatype has a facet of the given name,
|
||||
* return that object. If the facet is not specified
|
||||
* anywhere in its derivation chain, null will be returned.
|
||||
*/
|
||||
XSFacet getFacet( String name );
|
||||
|
||||
/**
|
||||
* For multi-valued facets (enumeration and pattern), obtain all values.
|
||||
*
|
||||
* @see #getFacet(String)
|
||||
*
|
||||
* @return
|
||||
* can be empty but never null.
|
||||
*/
|
||||
List<XSFacet> getFacets( String name );
|
||||
|
||||
|
||||
|
||||
void visit( XSSimpleTypeVisitor visitor );
|
||||
<T> T apply( XSSimpleTypeFunction<T> function );
|
||||
|
||||
/** Returns true if <code>this instanceof XSRestrictionSimpleType</code>. */
|
||||
boolean isRestriction();
|
||||
/** Returns true if <code>this instanceof XSListSimpleType</code>. */
|
||||
boolean isList();
|
||||
/** Returns true if <code>this instanceof XSUnionSimpleType</code>. */
|
||||
boolean isUnion();
|
||||
|
||||
XSRestrictionSimpleType asRestriction();
|
||||
XSListSimpleType asList();
|
||||
XSUnionSimpleType asUnion();
|
||||
}
|
||||
70
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSTerm.java
Normal file
70
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSTerm.java
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermFunctionWithParam;
|
||||
|
||||
/**
|
||||
* A component that can be referenced from {@link XSParticle}
|
||||
*
|
||||
* This interface provides a set of type check functions (<code>isXXX</code>),
|
||||
* which are essentially:
|
||||
*
|
||||
* <pre>
|
||||
* boolean isXXX() {
|
||||
* return this instanceof XXX;
|
||||
* }
|
||||
* <pre>
|
||||
*
|
||||
* and a set of cast functions (<code>asXXX</code>), which are
|
||||
* essentially:
|
||||
*
|
||||
* <pre>
|
||||
* XXX asXXX() {
|
||||
* if(isXXX()) return (XXX)this;
|
||||
* else return null;
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public interface XSTerm extends XSComponent
|
||||
{
|
||||
void visit( XSTermVisitor visitor );
|
||||
<T> T apply( XSTermFunction<T> function );
|
||||
<T,P> T apply( XSTermFunctionWithParam<T,P> function, P param );
|
||||
|
||||
// cast functions
|
||||
boolean isWildcard();
|
||||
boolean isModelGroupDecl();
|
||||
boolean isModelGroup();
|
||||
boolean isElementDecl();
|
||||
|
||||
XSWildcard asWildcard();
|
||||
XSModelGroupDecl asModelGroupDecl();
|
||||
XSModelGroup asModelGroup();
|
||||
XSElementDecl asElementDecl();
|
||||
}
|
||||
96
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSType.java
Normal file
96
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSType.java
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Base interface for {@link XSComplexType} and {@link XSSimpleType}.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSType extends XSDeclaration {
|
||||
/**
|
||||
* Returns the base type of this type.
|
||||
*
|
||||
* Note that if this type represents <tt>xs:anyType</tt>, this method returns itself.
|
||||
* This is awkward as an API, but it follows the schema specification.
|
||||
*
|
||||
* @return always non-null.
|
||||
*/
|
||||
XSType getBaseType();
|
||||
|
||||
final static int EXTENSION = 1;
|
||||
final static int RESTRICTION = 2;
|
||||
final static int SUBSTITUTION = 4;
|
||||
|
||||
int getDerivationMethod();
|
||||
|
||||
/** Returns true if <code>this instanceof XSSimpleType</code>. */
|
||||
boolean isSimpleType();
|
||||
/** Returns true if <code>this instanceof XSComplexType</code>. */
|
||||
boolean isComplexType();
|
||||
|
||||
/**
|
||||
* Lists up types that can substitute this type by using xsi:type.
|
||||
* Includes this type itself.
|
||||
* <p>
|
||||
* This method honors the block flag.
|
||||
*/
|
||||
XSType[] listSubstitutables();
|
||||
|
||||
/**
|
||||
* If this {@link XSType} is redefined by another type,
|
||||
* return that component.
|
||||
*
|
||||
* @return null
|
||||
* if this component has not been redefined.
|
||||
*/
|
||||
XSType getRedefinedBy();
|
||||
|
||||
/**
|
||||
* Returns the number of complex types that redefine this component.
|
||||
*
|
||||
* <p>
|
||||
* For example, if A is redefined by B and B is redefined by C,
|
||||
* A.getRedefinedCount()==2, B.getRedefinedCount()==1, and
|
||||
* C.getRedefinedCount()==0.
|
||||
*/
|
||||
int getRedefinedCount();
|
||||
|
||||
|
||||
/** Casts this object to XSSimpleType if possible, otherwise returns null. */
|
||||
XSSimpleType asSimpleType();
|
||||
/** Casts this object to XSComplexType if possible, otherwise returns null. */
|
||||
XSComplexType asComplexType();
|
||||
|
||||
/**
|
||||
* Returns true if this type is derived from the specified type.
|
||||
*
|
||||
* <p>
|
||||
* Note that <tt>t.isDerivedFrom(t)</tt> returns true.
|
||||
*/
|
||||
boolean isDerivedFrom( XSType t );
|
||||
}
|
||||
38
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSUnionSimpleType.java
Normal file
38
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSUnionSimpleType.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Union simple type.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface XSUnionSimpleType extends XSSimpleType, Iterable<XSSimpleType>
|
||||
{
|
||||
XSSimpleType getMember(int idx);
|
||||
int getMemberSize();
|
||||
}
|
||||
42
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSVariety.java
Normal file
42
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSVariety.java
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Constants that represent variety of simple types.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke,kawaguchi@sun.com)
|
||||
*/
|
||||
public final class XSVariety {
|
||||
public static final XSVariety ATOMIC = new XSVariety("atomic");
|
||||
public static final XSVariety UNION = new XSVariety("union");
|
||||
public static final XSVariety LIST = new XSVariety("list");
|
||||
|
||||
private XSVariety(String _name) { this.name=_name; }
|
||||
private final String name;
|
||||
public String toString() { return name; }
|
||||
}
|
||||
95
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSWildcard.java
Normal file
95
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSWildcard.java
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sun.xml.internal.xsom.visitor.XSWildcardFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSWildcardVisitor;
|
||||
|
||||
/**
|
||||
* Wildcard schema component (used for both attribute wildcard
|
||||
* and element wildcard.)
|
||||
*
|
||||
* XSWildcard interface can always be downcasted to either
|
||||
* Any, Other, or Union.
|
||||
*/
|
||||
public interface XSWildcard extends XSComponent, XSTerm
|
||||
{
|
||||
static final int LAX = 1;
|
||||
static final int STRTICT = 2;
|
||||
static final int SKIP = 3;
|
||||
/**
|
||||
* Gets the processing mode.
|
||||
*
|
||||
* @return
|
||||
* Either LAX, STRICT, or SKIP.
|
||||
*/
|
||||
int getMode();
|
||||
|
||||
/**
|
||||
* Returns true if the specified namespace URI is valid
|
||||
* wrt this wildcard.
|
||||
*
|
||||
* @param namespaceURI
|
||||
* Use the empty string to test the default no-namespace.
|
||||
*/
|
||||
boolean acceptsNamespace(String namespaceURI);
|
||||
|
||||
/** Visitor support. */
|
||||
void visit(XSWildcardVisitor visitor);
|
||||
<T> T apply(XSWildcardFunction<T> function);
|
||||
|
||||
/**
|
||||
* <code>##any</code> wildcard.
|
||||
*/
|
||||
interface Any extends XSWildcard {
|
||||
}
|
||||
/**
|
||||
* <code>##other</code> wildcard.
|
||||
*/
|
||||
interface Other extends XSWildcard {
|
||||
/**
|
||||
* Gets the namespace URI excluded from this wildcard.
|
||||
*/
|
||||
String getOtherNamespace();
|
||||
}
|
||||
/**
|
||||
* Wildcard of a set of namespace URIs.
|
||||
*/
|
||||
interface Union extends XSWildcard {
|
||||
/**
|
||||
* Short for <code>getNamespaces().iterator()</code>
|
||||
*/
|
||||
Iterator<String> iterateNamespaces();
|
||||
|
||||
/**
|
||||
* Read-only list of namespace URIs.
|
||||
*/
|
||||
Collection<String> getNamespaces();
|
||||
}
|
||||
}
|
||||
51
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSXPath.java
Normal file
51
jdkSrc/jdk8/com/sun/xml/internal/xsom/XSXPath.java
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
/**
|
||||
* Selector or field of {@link XSIdentityConstraint}.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public interface XSXPath extends XSComponent {
|
||||
|
||||
/**
|
||||
* Returns the {@link XSIdentityConstraint} to which
|
||||
* this XPath belongs to.
|
||||
*
|
||||
* @return
|
||||
* never null.
|
||||
*/
|
||||
XSIdentityConstraint getParent();
|
||||
|
||||
/**
|
||||
* Gets the XPath as a string.
|
||||
*
|
||||
* @return
|
||||
* never null.
|
||||
*/
|
||||
XmlString getXPath();
|
||||
}
|
||||
117
jdkSrc/jdk8/com/sun/xml/internal/xsom/XmlString.java
Normal file
117
jdkSrc/jdk8/com/sun/xml/internal/xsom/XmlString.java
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom;
|
||||
|
||||
import org.relaxng.datatype.ValidationContext;
|
||||
|
||||
/**
|
||||
* String with in-scope namespace binding information.
|
||||
*
|
||||
* <p>
|
||||
* In a general case, text (PCDATA/attributes) that appear in XML schema
|
||||
* cannot be correctly interpreted unless you also have in-scope namespace
|
||||
* binding (a case in point is QName.) Therefore, it's convenient to
|
||||
* handle the lexical representation and the in-scope namespace binding
|
||||
* in a pair.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public final class XmlString {
|
||||
/**
|
||||
* Textual value. AKA lexical representation.
|
||||
*/
|
||||
public final String value;
|
||||
|
||||
/**
|
||||
* Used to resole in-scope namespace bindings.
|
||||
*/
|
||||
public final ValidationContext context;
|
||||
|
||||
/**
|
||||
* Creates a new {@link XmlString} from a lexical representation and in-scope namespaces.
|
||||
*/
|
||||
public XmlString(String value, ValidationContext context) {
|
||||
this.value = value;
|
||||
this.context = context;
|
||||
if(context==null)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link XmlString} with empty in-scope namespace bindings.
|
||||
*/
|
||||
public XmlString(String value) {
|
||||
this(value,NULL_CONTEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a namespace prefix to the corresponding namespace URI.
|
||||
*
|
||||
* This method is used for resolving prefixes in the {@link #value}
|
||||
* (such as when {@link #value} represents a QName type.)
|
||||
*
|
||||
* <p>
|
||||
* If the prefix is "" (empty string), the method
|
||||
* returns the default namespace URI.
|
||||
*
|
||||
* <p>
|
||||
* If the prefix is "xml", then the method returns
|
||||
* "http://www.w3.org/XML/1998/namespace",
|
||||
* as defined in the XML Namespaces Recommendation.
|
||||
*
|
||||
* @return
|
||||
* namespace URI of this prefix.
|
||||
* If the specified prefix is not declared,
|
||||
* the implementation returns null.
|
||||
*/
|
||||
public final String resolvePrefix(String prefix) {
|
||||
return context.resolveNamespacePrefix(prefix);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
|
||||
private static final ValidationContext NULL_CONTEXT = new ValidationContext() {
|
||||
public String resolveNamespacePrefix(String s) {
|
||||
if(s.length()==0) return "";
|
||||
if(s.equals("xml")) return "http://www.w3.org/XML/1998/namespace";
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getBaseUri() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isUnparsedEntity(String s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNotation(String s) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSAnnotation;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.helpers.LocatorImpl;
|
||||
|
||||
public class AnnotationImpl implements XSAnnotation
|
||||
{
|
||||
private Object annotation;
|
||||
public Object getAnnotation() { return annotation; }
|
||||
|
||||
public Object setAnnotation(Object o) {
|
||||
Object r = this.annotation;
|
||||
this.annotation = o;
|
||||
return r;
|
||||
}
|
||||
|
||||
private final Locator locator;
|
||||
public Locator getLocator() { return locator; }
|
||||
|
||||
public AnnotationImpl( Object o, Locator _loc ) {
|
||||
this.annotation = o;
|
||||
this.locator = _loc;
|
||||
}
|
||||
|
||||
public AnnotationImpl() {
|
||||
locator = NULL_LOCATION;
|
||||
}
|
||||
|
||||
private static class LocatorImplUnmodifiable extends LocatorImpl {
|
||||
|
||||
@Override
|
||||
public void setColumnNumber(int columnNumber) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPublicId(String publicId) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSystemId(String systemId) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineNumber(int lineNumber) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
private static final LocatorImplUnmodifiable NULL_LOCATION = new LocatorImplUnmodifiable();
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSAttGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSAttributeUse;
|
||||
import com.sun.xml.internal.xsom.XSWildcard;
|
||||
import com.sun.xml.internal.xsom.impl.parser.DelayedRef;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class AttGroupDeclImpl extends AttributesHolder implements XSAttGroupDecl
|
||||
{
|
||||
public AttGroupDeclImpl( SchemaDocumentImpl _parent, AnnotationImpl _annon,
|
||||
Locator _loc, ForeignAttributesImpl _fa, String _name, WildcardImpl _wildcard ) {
|
||||
|
||||
this(_parent,_annon,_loc,_fa,_name);
|
||||
setWildcard(_wildcard);
|
||||
}
|
||||
|
||||
public AttGroupDeclImpl( SchemaDocumentImpl _parent, AnnotationImpl _annon,
|
||||
Locator _loc, ForeignAttributesImpl _fa, String _name ) {
|
||||
|
||||
super(_parent,_annon,_loc,_fa,_name,false);
|
||||
}
|
||||
|
||||
|
||||
private WildcardImpl wildcard;
|
||||
public void setWildcard( WildcardImpl wc ) { wildcard=wc; }
|
||||
public XSWildcard getAttributeWildcard() { return wildcard; }
|
||||
|
||||
public XSAttributeUse getAttributeUse( String nsURI, String localName ) {
|
||||
UName name = new UName(nsURI,localName);
|
||||
XSAttributeUse o=null;
|
||||
|
||||
Iterator itr = iterateAttGroups();
|
||||
while(itr.hasNext() && o==null)
|
||||
o = ((XSAttGroupDecl)itr.next()).getAttributeUse(nsURI,localName);
|
||||
|
||||
if(o==null) o = attributes.get(name);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
public void redefine( AttGroupDeclImpl ag ) {
|
||||
for (Iterator itr = attGroups.iterator(); itr.hasNext();) {
|
||||
DelayedRef.AttGroup r = (DelayedRef.AttGroup) itr.next();
|
||||
r.redefine(ag);
|
||||
}
|
||||
}
|
||||
|
||||
public void visit( XSVisitor visitor ) {
|
||||
visitor.attGroupDecl(this);
|
||||
}
|
||||
public Object apply( XSFunction function ) {
|
||||
return function.attGroupDecl(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSAttributeDecl;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.XmlString;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
public class AttributeDeclImpl extends DeclarationImpl implements XSAttributeDecl, Ref.Attribute
|
||||
{
|
||||
public AttributeDeclImpl( SchemaDocumentImpl owner,
|
||||
String _targetNamespace, String _name,
|
||||
AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa, boolean _anonymous,
|
||||
XmlString _defValue, XmlString _fixedValue,
|
||||
Ref.SimpleType _type ) {
|
||||
|
||||
super(owner,_annon,_loc,_fa,_targetNamespace,_name,_anonymous);
|
||||
|
||||
if(_name==null) // assertion failed.
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
this.defaultValue = _defValue;
|
||||
this.fixedValue = _fixedValue;
|
||||
this.type = _type;
|
||||
}
|
||||
|
||||
private final Ref.SimpleType type;
|
||||
public XSSimpleType getType() { return type.getType(); }
|
||||
|
||||
private final XmlString defaultValue;
|
||||
public XmlString getDefaultValue() { return defaultValue; }
|
||||
|
||||
private final XmlString fixedValue;
|
||||
public XmlString getFixedValue() { return fixedValue; }
|
||||
|
||||
public void visit( XSVisitor visitor ) {
|
||||
visitor.attributeDecl(this);
|
||||
}
|
||||
public Object apply( XSFunction function ) {
|
||||
return function.attributeDecl(this);
|
||||
}
|
||||
|
||||
|
||||
// Ref.Attribute implementation
|
||||
public XSAttributeDecl getAttribute() { return this; }
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSAttributeDecl;
|
||||
import com.sun.xml.internal.xsom.XSAttributeUse;
|
||||
import com.sun.xml.internal.xsom.XmlString;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
public class AttributeUseImpl extends ComponentImpl implements XSAttributeUse
|
||||
{
|
||||
public AttributeUseImpl( SchemaDocumentImpl owner, AnnotationImpl ann, Locator loc, ForeignAttributesImpl fa, Ref.Attribute _decl,
|
||||
XmlString def, XmlString fixed, boolean req ) {
|
||||
|
||||
super(owner,ann,loc,fa);
|
||||
|
||||
this.att = _decl;
|
||||
this.defaultValue = def;
|
||||
this.fixedValue = fixed;
|
||||
this.required = req;
|
||||
}
|
||||
|
||||
private final Ref.Attribute att;
|
||||
public XSAttributeDecl getDecl() { return att.getAttribute(); }
|
||||
|
||||
private final XmlString defaultValue;
|
||||
public XmlString getDefaultValue() {
|
||||
if( defaultValue!=null ) return defaultValue;
|
||||
else return getDecl().getDefaultValue();
|
||||
}
|
||||
|
||||
private final XmlString fixedValue;
|
||||
public XmlString getFixedValue() {
|
||||
if( fixedValue!=null ) return fixedValue;
|
||||
else return getDecl().getFixedValue();
|
||||
}
|
||||
|
||||
private final boolean required;
|
||||
public boolean isRequired() { return required; }
|
||||
|
||||
public Object apply( XSFunction f ) {
|
||||
return f.attributeUse(this);
|
||||
}
|
||||
public void visit( XSVisitor v ) {
|
||||
v.attributeUse(this);
|
||||
}
|
||||
}
|
||||
129
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/AttributesHolder.java
Normal file
129
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/AttributesHolder.java
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSAttGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSAttributeUse;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.impl.scd.Iterators;
|
||||
import com.sun.xml.internal.xsom.impl.Ref.AttGroup;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.AbstractSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public abstract class AttributesHolder extends DeclarationImpl {
|
||||
|
||||
protected AttributesHolder( SchemaDocumentImpl _parent, AnnotationImpl _annon,
|
||||
Locator loc, ForeignAttributesImpl _fa, String _name, boolean _anonymous ) {
|
||||
|
||||
super(_parent,_annon,loc,_fa,_parent.getTargetNamespace(),_name,_anonymous);
|
||||
}
|
||||
|
||||
/** set the local wildcard. */
|
||||
public abstract void setWildcard(WildcardImpl wc);
|
||||
|
||||
/**
|
||||
* Local attribute use.
|
||||
* Use linked hash map to guarantee the iteration order, and make it close to
|
||||
* what was in the schema document.
|
||||
*/
|
||||
protected final Map<UName,AttributeUseImpl> attributes = new LinkedHashMap<UName,AttributeUseImpl>();
|
||||
public void addAttributeUse( UName name, AttributeUseImpl a ) {
|
||||
attributes.put( name, a );
|
||||
}
|
||||
/** prohibited attributes. */
|
||||
protected final Set<UName> prohibitedAtts = new HashSet<UName>();
|
||||
public void addProhibitedAttribute( UName name ) {
|
||||
prohibitedAtts.add(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the attribute uses by looking at attribute groups and etc.
|
||||
* Searching for the base type is done in {@link ComplexTypeImpl}.
|
||||
*/
|
||||
public Collection<XSAttributeUse> getAttributeUses() {
|
||||
// TODO: this is fairly inefficient
|
||||
List<XSAttributeUse> v = new ArrayList<XSAttributeUse>();
|
||||
v.addAll(attributes.values());
|
||||
for( XSAttGroupDecl agd : getAttGroups() )
|
||||
v.addAll(agd.getAttributeUses());
|
||||
return v;
|
||||
}
|
||||
public Iterator<XSAttributeUse> iterateAttributeUses() {
|
||||
return getAttributeUses().iterator();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public XSAttributeUse getDeclaredAttributeUse( String nsURI, String localName ) {
|
||||
return attributes.get(new UName(nsURI,localName));
|
||||
}
|
||||
|
||||
public Iterator<AttributeUseImpl> iterateDeclaredAttributeUses() {
|
||||
return attributes.values().iterator();
|
||||
}
|
||||
|
||||
public Collection<AttributeUseImpl> getDeclaredAttributeUses() {
|
||||
return attributes.values();
|
||||
}
|
||||
|
||||
|
||||
/** {@link Ref.AttGroup}s that are directly refered from this. */
|
||||
protected final Set<Ref.AttGroup> attGroups = new HashSet<Ref.AttGroup>();
|
||||
|
||||
public void addAttGroup( Ref.AttGroup a ) { attGroups.add(a); }
|
||||
|
||||
// Iterates all AttGroups which are directly referenced from this component
|
||||
// this does not iterate att groups referenced from the base type
|
||||
public Iterator<XSAttGroupDecl> iterateAttGroups() {
|
||||
return new Iterators.Adapter<XSAttGroupDecl,Ref.AttGroup>(attGroups.iterator()) {
|
||||
protected XSAttGroupDecl filter(AttGroup u) {
|
||||
return u.get();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Set<XSAttGroupDecl> getAttGroups() {
|
||||
return new AbstractSet<XSAttGroupDecl>() {
|
||||
public Iterator<XSAttGroupDecl> iterator() {
|
||||
return iterateAttGroups();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return attGroups.size();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
299
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/ComplexTypeImpl.java
Normal file
299
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/ComplexTypeImpl.java
Normal file
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSAttGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSAttributeDecl;
|
||||
import com.sun.xml.internal.xsom.XSAttributeUse;
|
||||
import com.sun.xml.internal.xsom.XSComplexType;
|
||||
import com.sun.xml.internal.xsom.XSContentType;
|
||||
import com.sun.xml.internal.xsom.XSElementDecl;
|
||||
import com.sun.xml.internal.xsom.XSSchema;
|
||||
import com.sun.xml.internal.xsom.XSSchemaSet;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSType;
|
||||
import com.sun.xml.internal.xsom.XSWildcard;
|
||||
import com.sun.xml.internal.xsom.impl.parser.DelayedRef;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.impl.scd.Iterators;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class ComplexTypeImpl extends AttributesHolder implements XSComplexType, Ref.ComplexType
|
||||
{
|
||||
public ComplexTypeImpl( SchemaDocumentImpl _parent,
|
||||
AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
|
||||
String _name, boolean _anonymous,
|
||||
|
||||
boolean _abstract, int _derivationMethod,
|
||||
Ref.Type _base, int _final, int _block, boolean _mixed ) {
|
||||
|
||||
super(_parent,_annon,_loc,_fa,_name,_anonymous);
|
||||
|
||||
if(_base==null)
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
this._abstract = _abstract;
|
||||
this.derivationMethod = _derivationMethod;
|
||||
this.baseType = _base;
|
||||
this.finalValue = _final;
|
||||
this.blockValue = _block;
|
||||
this.mixed = _mixed;
|
||||
}
|
||||
|
||||
public XSComplexType asComplexType(){ return this; }
|
||||
|
||||
public boolean isDerivedFrom(XSType t) {
|
||||
XSType x = this;
|
||||
while(true) {
|
||||
if(t==x)
|
||||
return true;
|
||||
XSType s = x.getBaseType();
|
||||
if(s==x)
|
||||
return false;
|
||||
x = s;
|
||||
}
|
||||
}
|
||||
|
||||
public XSSimpleType asSimpleType() { return null; }
|
||||
public final boolean isSimpleType() { return false; }
|
||||
public final boolean isComplexType(){ return true; }
|
||||
|
||||
private int derivationMethod;
|
||||
public int getDerivationMethod() { return derivationMethod; }
|
||||
|
||||
private Ref.Type baseType;
|
||||
public XSType getBaseType() { return baseType.getType(); }
|
||||
|
||||
/**
|
||||
* Called when this complex type redefines the specified complex type.
|
||||
*/
|
||||
public void redefine( ComplexTypeImpl ct ) {
|
||||
if( baseType instanceof DelayedRef )
|
||||
((DelayedRef)baseType).redefine(ct);
|
||||
else
|
||||
this.baseType = ct;
|
||||
ct.redefinedBy = this;
|
||||
redefiningCount = (short)(ct.redefiningCount+1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of times this component redefines other components.
|
||||
*/
|
||||
private short redefiningCount = 0;
|
||||
|
||||
private ComplexTypeImpl redefinedBy = null;
|
||||
|
||||
public XSComplexType getRedefinedBy() {
|
||||
return redefinedBy;
|
||||
}
|
||||
|
||||
public int getRedefinedCount() {
|
||||
int i=0;
|
||||
for( ComplexTypeImpl ct=this.redefinedBy; ct!=null; ct=ct.redefinedBy)
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
private XSElementDecl scope;
|
||||
public XSElementDecl getScope() { return scope; }
|
||||
public void setScope( XSElementDecl _scope ) { this.scope=_scope; }
|
||||
|
||||
private final boolean _abstract;
|
||||
public boolean isAbstract() { return _abstract; }
|
||||
|
||||
private WildcardImpl localAttWildcard;
|
||||
/**
|
||||
* Set the local attribute wildcard.
|
||||
*/
|
||||
public void setWildcard( WildcardImpl wc ) {
|
||||
this.localAttWildcard = wc;
|
||||
}
|
||||
public XSWildcard getAttributeWildcard() {
|
||||
WildcardImpl complete = localAttWildcard;
|
||||
|
||||
Iterator itr = iterateAttGroups();
|
||||
while( itr.hasNext() ) {
|
||||
WildcardImpl w = (WildcardImpl)((XSAttGroupDecl)itr.next()).getAttributeWildcard();
|
||||
|
||||
if(w==null) continue;
|
||||
|
||||
if(complete==null)
|
||||
complete = w;
|
||||
else
|
||||
// TODO: the spec says it's intersection,
|
||||
// but I think it has to be union.
|
||||
complete = complete.union(ownerDocument,w);
|
||||
}
|
||||
|
||||
if( getDerivationMethod()==RESTRICTION ) return complete;
|
||||
|
||||
WildcardImpl base=null;
|
||||
XSType baseType = getBaseType();
|
||||
if(baseType.asComplexType()!=null)
|
||||
base = (WildcardImpl)baseType.asComplexType().getAttributeWildcard();
|
||||
|
||||
if(complete==null) return base;
|
||||
if(base==null) return complete;
|
||||
|
||||
return complete.union(ownerDocument,base);
|
||||
}
|
||||
|
||||
private final int finalValue;
|
||||
public boolean isFinal( int derivationMethod ) {
|
||||
return (finalValue&derivationMethod)!=0;
|
||||
}
|
||||
|
||||
private final int blockValue;
|
||||
public boolean isSubstitutionProhibited( int method ) {
|
||||
return (blockValue&method)!=0;
|
||||
}
|
||||
|
||||
|
||||
private Ref.ContentType contentType;
|
||||
public void setContentType( Ref.ContentType v ) { contentType = v; }
|
||||
public XSContentType getContentType() { return contentType.getContentType(); }
|
||||
|
||||
private XSContentType explicitContent;
|
||||
public void setExplicitContent( XSContentType v ) {
|
||||
this.explicitContent = v;
|
||||
}
|
||||
public XSContentType getExplicitContent() { return explicitContent; }
|
||||
|
||||
private final boolean mixed;
|
||||
public boolean isMixed() { return mixed; }
|
||||
|
||||
|
||||
|
||||
|
||||
public XSAttributeUse getAttributeUse( String nsURI, String localName ) {
|
||||
UName name = new UName(nsURI,localName);
|
||||
|
||||
if(prohibitedAtts.contains(name)) return null;
|
||||
|
||||
XSAttributeUse o = attributes.get(name);
|
||||
|
||||
|
||||
if(o==null) {
|
||||
Iterator itr = iterateAttGroups();
|
||||
while(itr.hasNext() && o==null)
|
||||
o = ((XSAttGroupDecl)itr.next()).getAttributeUse(nsURI,localName);
|
||||
}
|
||||
|
||||
if(o==null) {
|
||||
XSType base = getBaseType();
|
||||
if(base.asComplexType()!=null)
|
||||
o = base.asComplexType().getAttributeUse(nsURI,localName);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
public Iterator<XSAttributeUse> iterateAttributeUses() {
|
||||
|
||||
XSComplexType baseType = getBaseType().asComplexType();
|
||||
|
||||
if( baseType==null ) return super.iterateAttributeUses();
|
||||
|
||||
return new Iterators.Union<XSAttributeUse>(
|
||||
new Iterators.Filter<XSAttributeUse>(baseType.iterateAttributeUses()) {
|
||||
protected boolean matches(XSAttributeUse value) {
|
||||
XSAttributeDecl u = value.getDecl();
|
||||
UName n = new UName(u.getTargetNamespace(),u.getName());
|
||||
return !prohibitedAtts.contains(n);
|
||||
}
|
||||
},
|
||||
super.iterateAttributeUses() );
|
||||
}
|
||||
|
||||
public Collection<XSAttributeUse> getAttributeUses() {
|
||||
XSComplexType baseType = getBaseType().asComplexType();
|
||||
|
||||
if( baseType==null ) return super.getAttributeUses();
|
||||
|
||||
// TODO: this is fairly inefficient
|
||||
Map<UName,XSAttributeUse> uses = new HashMap<UName, XSAttributeUse>();
|
||||
for( XSAttributeUse a : baseType.getAttributeUses())
|
||||
uses.put(new UName(a.getDecl()),a);
|
||||
|
||||
uses.keySet().removeAll(prohibitedAtts);
|
||||
|
||||
for( XSAttributeUse a : super.getAttributeUses())
|
||||
uses.put(new UName(a.getDecl()),a);
|
||||
|
||||
return uses.values();
|
||||
}
|
||||
|
||||
|
||||
public XSType[] listSubstitutables() {
|
||||
return Util.listSubstitutables(this);
|
||||
}
|
||||
|
||||
public void visit( XSVisitor visitor ) {
|
||||
visitor.complexType(this);
|
||||
}
|
||||
public <T> T apply( XSFunction<T> function ) {
|
||||
return function.complexType(this);
|
||||
}
|
||||
|
||||
// Ref.ComplexType implementation
|
||||
public XSComplexType getType() { return this; }
|
||||
|
||||
public List<XSComplexType> getSubtypes() {
|
||||
ArrayList subtypeList = new ArrayList();
|
||||
Iterator<XSComplexType> cTypes = getRoot().iterateComplexTypes();
|
||||
while (cTypes.hasNext()) {
|
||||
XSComplexType cType= cTypes.next();
|
||||
XSType base = cType.getBaseType();
|
||||
if ((base != null) && (base.equals(this))) {
|
||||
subtypeList.add(cType);
|
||||
}
|
||||
}
|
||||
return subtypeList;
|
||||
}
|
||||
|
||||
public List<XSElementDecl> getElementDecls() {
|
||||
ArrayList declList = new ArrayList();
|
||||
XSSchemaSet schemaSet = getRoot();
|
||||
for (XSSchema sch : schemaSet.getSchemas()) {
|
||||
for (XSElementDecl decl : sch.getElementDecls().values()) {
|
||||
if (decl.getType().equals(this)) {
|
||||
declList.add(decl);
|
||||
}
|
||||
}
|
||||
}
|
||||
return declList;
|
||||
}
|
||||
}
|
||||
143
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/ComponentImpl.java
Normal file
143
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/ComponentImpl.java
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.SCD;
|
||||
import com.sun.xml.internal.xsom.XSAnnotation;
|
||||
import com.sun.xml.internal.xsom.XSComponent;
|
||||
import com.sun.xml.internal.xsom.XSSchemaSet;
|
||||
import com.sun.xml.internal.xsom.util.ComponentNameFunction;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.parser.SchemaDocument;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ComponentImpl implements XSComponent
|
||||
{
|
||||
protected ComponentImpl( SchemaDocumentImpl _owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl fa ) {
|
||||
this.ownerDocument = _owner;
|
||||
this.annotation = _annon;
|
||||
this.locator = _loc;
|
||||
this.foreignAttributes = fa;
|
||||
}
|
||||
|
||||
protected final SchemaDocumentImpl ownerDocument;
|
||||
public SchemaImpl getOwnerSchema() {
|
||||
if(ownerDocument==null)
|
||||
return null;
|
||||
else
|
||||
return ownerDocument.getSchema();
|
||||
}
|
||||
|
||||
public XSSchemaSet getRoot() {
|
||||
if(ownerDocument==null)
|
||||
return null;
|
||||
else
|
||||
return getOwnerSchema().getRoot();
|
||||
}
|
||||
|
||||
public SchemaDocument getSourceDocument() {
|
||||
return ownerDocument;
|
||||
}
|
||||
|
||||
private AnnotationImpl annotation;
|
||||
public final XSAnnotation getAnnotation() { return annotation; }
|
||||
|
||||
public XSAnnotation getAnnotation(boolean createIfNotExist) {
|
||||
if(createIfNotExist && annotation==null) {
|
||||
annotation = new AnnotationImpl();
|
||||
}
|
||||
return annotation;
|
||||
}
|
||||
|
||||
private final Locator locator;
|
||||
public final Locator getLocator() { return locator; }
|
||||
|
||||
/**
|
||||
* Either {@link ForeignAttributesImpl} or {@link List}.
|
||||
*
|
||||
* Initially it's {@link ForeignAttributesImpl}, but it's lazily turned into
|
||||
* a list when necessary.
|
||||
*/
|
||||
private Object foreignAttributes;
|
||||
|
||||
public List<ForeignAttributesImpl> getForeignAttributes() {
|
||||
Object t = foreignAttributes;
|
||||
|
||||
if(t==null)
|
||||
return Collections.EMPTY_LIST;
|
||||
|
||||
if(t instanceof List)
|
||||
return (List)t;
|
||||
|
||||
t = foreignAttributes = convertToList((ForeignAttributesImpl)t);
|
||||
return (List)t;
|
||||
}
|
||||
|
||||
public String getForeignAttribute(String nsUri, String localName) {
|
||||
for( ForeignAttributesImpl fa : getForeignAttributes() ) {
|
||||
String v = fa.getValue(nsUri,localName);
|
||||
if(v!=null) return v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<ForeignAttributesImpl> convertToList(ForeignAttributesImpl fa) {
|
||||
List<ForeignAttributesImpl> lst = new ArrayList<ForeignAttributesImpl>();
|
||||
while(fa!=null) {
|
||||
lst.add(fa);
|
||||
fa = fa.next;
|
||||
}
|
||||
return Collections.unmodifiableList(lst);
|
||||
}
|
||||
|
||||
public Collection<XSComponent> select(String scd, NamespaceContext nsContext) {
|
||||
try {
|
||||
return SCD.create(scd,nsContext).select(this);
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public XSComponent selectSingle(String scd, NamespaceContext nsContext) {
|
||||
try {
|
||||
return SCD.create(scd,nsContext).selectSingle(this);
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return apply(new ComponentNameFunction());
|
||||
}
|
||||
}
|
||||
32
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/Const.java
Normal file
32
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/Const.java
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
public class Const
|
||||
{
|
||||
/** Namespace URI of XML Schema. */
|
||||
public static final String schemaNamespace = "http://www.w3.org/2001/XMLSchema";
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSContentType;
|
||||
|
||||
/**
|
||||
* Marker interface that says this implementation
|
||||
* implements XSContentType.
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public interface ContentTypeImpl extends Ref.ContentType, XSContentType {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSDeclaration;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.util.NameGetter;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
abstract class DeclarationImpl extends ComponentImpl implements XSDeclaration
|
||||
{
|
||||
DeclarationImpl( SchemaDocumentImpl owner,
|
||||
AnnotationImpl _annon, Locator loc, ForeignAttributesImpl fa,
|
||||
String _targetNamespace, String _name, boolean _anonymous ) {
|
||||
|
||||
super(owner,_annon,loc,fa);
|
||||
this.targetNamespace = _targetNamespace;
|
||||
this.name = _name;
|
||||
this.anonymous = _anonymous;
|
||||
}
|
||||
|
||||
private final String name;
|
||||
public String getName() { return name; }
|
||||
|
||||
private final String targetNamespace;
|
||||
public String getTargetNamespace() { return targetNamespace; }
|
||||
|
||||
private final boolean anonymous;
|
||||
/** @deprecated */
|
||||
public boolean isAnonymous() { return anonymous; }
|
||||
|
||||
public final boolean isGlobal() { return !isAnonymous(); }
|
||||
public final boolean isLocal() { return isAnonymous(); }
|
||||
}
|
||||
235
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/ElementDecl.java
Normal file
235
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/ElementDecl.java
Normal file
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSElementDecl;
|
||||
import com.sun.xml.internal.xsom.XSIdentityConstraint;
|
||||
import com.sun.xml.internal.xsom.XSModelGroup;
|
||||
import com.sun.xml.internal.xsom.XSModelGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSTerm;
|
||||
import com.sun.xml.internal.xsom.XSType;
|
||||
import com.sun.xml.internal.xsom.XSWildcard;
|
||||
import com.sun.xml.internal.xsom.XmlString;
|
||||
import com.sun.xml.internal.xsom.impl.parser.PatcherManager;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermFunctionWithParam;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ElementDecl extends DeclarationImpl implements XSElementDecl, Ref.Term
|
||||
{
|
||||
public ElementDecl( PatcherManager reader, SchemaDocumentImpl owner,
|
||||
AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl fa,
|
||||
String _tns, String _name, boolean _anonymous,
|
||||
|
||||
XmlString _defv, XmlString _fixedv,
|
||||
boolean _nillable, boolean _abstract, Boolean _form,
|
||||
Ref.Type _type, Ref.Element _substHead,
|
||||
int _substDisallowed, int _substExcluded,
|
||||
List<IdentityConstraintImpl> idConstraints) {
|
||||
|
||||
super(owner,_annon,_loc,fa,_tns,_name,_anonymous);
|
||||
|
||||
this.defaultValue = _defv;
|
||||
this.fixedValue = _fixedv;
|
||||
this.nillable = _nillable;
|
||||
this._abstract = _abstract;
|
||||
this.form = _form;
|
||||
this.type = _type;
|
||||
this.substHead = _substHead;
|
||||
this.substDisallowed = _substDisallowed;
|
||||
this.substExcluded = _substExcluded;
|
||||
this.idConstraints = Collections.unmodifiableList((List<? extends XSIdentityConstraint>)idConstraints);
|
||||
|
||||
for (IdentityConstraintImpl idc : idConstraints)
|
||||
idc.setParent(this);
|
||||
|
||||
if(type==null)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
private XmlString defaultValue;
|
||||
public XmlString getDefaultValue() { return defaultValue; }
|
||||
|
||||
private XmlString fixedValue;
|
||||
public XmlString getFixedValue() { return fixedValue; }
|
||||
|
||||
private boolean nillable;
|
||||
public boolean isNillable() { return nillable; }
|
||||
|
||||
private boolean _abstract;
|
||||
public boolean isAbstract() { return _abstract; }
|
||||
|
||||
private Ref.Type type;
|
||||
public XSType getType() { return type.getType(); }
|
||||
|
||||
private Ref.Element substHead;
|
||||
public XSElementDecl getSubstAffiliation() {
|
||||
if(substHead==null) return null;
|
||||
return substHead.get();
|
||||
}
|
||||
|
||||
private int substDisallowed;
|
||||
public boolean isSubstitutionDisallowed( int method ) {
|
||||
return (substDisallowed&method)!=0;
|
||||
}
|
||||
|
||||
private int substExcluded;
|
||||
public boolean isSubstitutionExcluded( int method ) {
|
||||
return (substExcluded&method)!=0;
|
||||
}
|
||||
|
||||
private final List<XSIdentityConstraint> idConstraints;
|
||||
public List<XSIdentityConstraint> getIdentityConstraints() {
|
||||
return idConstraints;
|
||||
}
|
||||
|
||||
private Boolean form;
|
||||
public Boolean getForm() {
|
||||
return form;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public XSElementDecl[] listSubstitutables() {
|
||||
Set<? extends XSElementDecl> s = getSubstitutables();
|
||||
return s.toArray(new XSElementDecl[s.size()]);
|
||||
}
|
||||
|
||||
/** Set that represents element decls that can substitute this element. */
|
||||
private Set<XSElementDecl> substitutables = null;
|
||||
|
||||
/** Unmodifieable view of {@link #substitutables}. */
|
||||
private Set<XSElementDecl> substitutablesView = null;
|
||||
|
||||
public Set<? extends XSElementDecl> getSubstitutables() {
|
||||
if( substitutables==null ) {
|
||||
// if the field is null by the time this method
|
||||
// is called, it means this element is substitutable by itself only.
|
||||
substitutables = substitutablesView = Collections.singleton((XSElementDecl)this);
|
||||
}
|
||||
return substitutablesView;
|
||||
}
|
||||
|
||||
protected void addSubstitutable( ElementDecl decl ) {
|
||||
if( substitutables==null ) {
|
||||
substitutables = new HashSet<XSElementDecl>();
|
||||
substitutables.add(this);
|
||||
substitutablesView = Collections.unmodifiableSet(substitutables);
|
||||
}
|
||||
substitutables.add(decl);
|
||||
}
|
||||
|
||||
|
||||
public void updateSubstitutabilityMap() {
|
||||
ElementDecl parent = this;
|
||||
XSType type = this.getType();
|
||||
|
||||
boolean rused = false;
|
||||
boolean eused = false;
|
||||
|
||||
while( (parent=(ElementDecl)parent.getSubstAffiliation())!=null ) {
|
||||
|
||||
if(parent.isSubstitutionDisallowed(XSType.SUBSTITUTION))
|
||||
continue;
|
||||
|
||||
boolean rd = parent.isSubstitutionDisallowed(XSType.RESTRICTION);
|
||||
boolean ed = parent.isSubstitutionDisallowed(XSType.EXTENSION);
|
||||
|
||||
if( (rd && rused) || ( ed && eused ) ) continue;
|
||||
|
||||
XSType parentType = parent.getType();
|
||||
while (type!=parentType) {
|
||||
if(type.getDerivationMethod()==XSType.RESTRICTION) rused = true;
|
||||
else eused = true;
|
||||
|
||||
type = type.getBaseType();
|
||||
if(type==null) // parentType and type doesn't share the common base type. a bug in the schema.
|
||||
break;
|
||||
|
||||
if( type.isComplexType() ) {
|
||||
rd |= type.asComplexType().isSubstitutionProhibited(XSType.RESTRICTION);
|
||||
ed |= type.asComplexType().isSubstitutionProhibited(XSType.EXTENSION);
|
||||
}
|
||||
if (getRoot().getAnyType().equals(type)) break;
|
||||
}
|
||||
|
||||
if( (rd && rused) || ( ed && eused ) ) continue;
|
||||
|
||||
// this element can substitute "parent"
|
||||
parent.addSubstitutable(this);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canBeSubstitutedBy(XSElementDecl e) {
|
||||
return getSubstitutables().contains(e);
|
||||
}
|
||||
|
||||
public boolean isWildcard() { return false; }
|
||||
public boolean isModelGroupDecl() { return false; }
|
||||
public boolean isModelGroup() { return false; }
|
||||
public boolean isElementDecl() { return true; }
|
||||
|
||||
public XSWildcard asWildcard() { return null; }
|
||||
public XSModelGroupDecl asModelGroupDecl() { return null; }
|
||||
public XSModelGroup asModelGroup() { return null; }
|
||||
public XSElementDecl asElementDecl() { return this; }
|
||||
|
||||
|
||||
|
||||
|
||||
public void visit( XSVisitor visitor ) {
|
||||
visitor.elementDecl(this);
|
||||
}
|
||||
public void visit( XSTermVisitor visitor ) {
|
||||
visitor.elementDecl(this);
|
||||
}
|
||||
public Object apply( XSTermFunction function ) {
|
||||
return function.elementDecl(this);
|
||||
}
|
||||
|
||||
public <T,P> T apply(XSTermFunctionWithParam<T, P> function, P param) {
|
||||
return function.elementDecl(this,param);
|
||||
}
|
||||
|
||||
public Object apply( XSFunction function ) {
|
||||
return function.elementDecl(this);
|
||||
}
|
||||
|
||||
|
||||
// Ref.Term implementation
|
||||
public XSTerm getTerm() { return this; }
|
||||
}
|
||||
62
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/EmptyImpl.java
Normal file
62
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/EmptyImpl.java
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSContentType;
|
||||
import com.sun.xml.internal.xsom.XSParticle;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.visitor.XSContentTypeFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSContentTypeVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public class EmptyImpl extends ComponentImpl implements ContentTypeImpl {
|
||||
public EmptyImpl() { super(null,null,null,null); }
|
||||
|
||||
public XSSimpleType asSimpleType() { return null; }
|
||||
public XSParticle asParticle() { return null; }
|
||||
public XSContentType asEmpty() { return this; }
|
||||
|
||||
public Object apply( XSContentTypeFunction function ) {
|
||||
return function.empty(this);
|
||||
}
|
||||
public Object apply( XSFunction function ) {
|
||||
return function.empty(this);
|
||||
}
|
||||
public void visit( XSVisitor visitor ) {
|
||||
visitor.empty(this);
|
||||
}
|
||||
public void visit( XSContentTypeVisitor visitor ) {
|
||||
visitor.empty(this);
|
||||
}
|
||||
|
||||
public XSContentType getContentType() { return this; }
|
||||
}
|
||||
62
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/FacetImpl.java
Normal file
62
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/FacetImpl.java
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSFacet;
|
||||
import com.sun.xml.internal.xsom.XmlString;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
public class FacetImpl extends ComponentImpl implements XSFacet {
|
||||
public FacetImpl( SchemaDocumentImpl owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
|
||||
String _name, XmlString _value, boolean _fixed ) {
|
||||
|
||||
super(owner,_annon,_loc,_fa);
|
||||
|
||||
this.name = _name;
|
||||
this.value = _value;
|
||||
this.fixed = _fixed;
|
||||
}
|
||||
|
||||
private final String name;
|
||||
public String getName() { return name; }
|
||||
|
||||
private final XmlString value;
|
||||
public XmlString getValue() { return value; }
|
||||
|
||||
private boolean fixed;
|
||||
public boolean isFixed() { return fixed; }
|
||||
|
||||
|
||||
public void visit( XSVisitor visitor ) {
|
||||
visitor.facet(this);
|
||||
}
|
||||
public Object apply( XSFunction function ) {
|
||||
return function.facet(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.ForeignAttributes;
|
||||
import org.relaxng.datatype.ValidationContext;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
/**
|
||||
* Remembers foreign attributes.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public final class ForeignAttributesImpl extends AttributesImpl implements ForeignAttributes {
|
||||
private final ValidationContext context;
|
||||
private final Locator locator;
|
||||
/**
|
||||
* {@link ForeignAttributes} forms a linked list.
|
||||
*/
|
||||
final ForeignAttributesImpl next;
|
||||
|
||||
public ForeignAttributesImpl(ValidationContext context, Locator locator, ForeignAttributesImpl next) {
|
||||
this.context = context;
|
||||
this.locator = locator;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
public ValidationContext getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public Locator getLocator() {
|
||||
return locator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSElementDecl;
|
||||
import com.sun.xml.internal.xsom.XSIdentityConstraint;
|
||||
import com.sun.xml.internal.xsom.XSXPath;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* {@link XSIdentityConstraint} implementation.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class IdentityConstraintImpl extends ComponentImpl implements XSIdentityConstraint, Ref.IdentityConstraint {
|
||||
|
||||
private XSElementDecl parent;
|
||||
private final short category;
|
||||
private final String name;
|
||||
private final XSXPath selector;
|
||||
private final List<XSXPath> fields;
|
||||
private final Ref.IdentityConstraint refer;
|
||||
|
||||
public IdentityConstraintImpl(SchemaDocumentImpl _owner, AnnotationImpl _annon, Locator _loc,
|
||||
ForeignAttributesImpl fa, short category, String name, XPathImpl selector,
|
||||
List<XPathImpl> fields, Ref.IdentityConstraint refer) {
|
||||
|
||||
super(_owner, _annon, _loc, fa);
|
||||
this.category = category;
|
||||
this.name = name;
|
||||
this.selector = selector;
|
||||
selector.setParent(this);
|
||||
this.fields = Collections.unmodifiableList((List<? extends XSXPath>)fields);
|
||||
for( XPathImpl xp : fields )
|
||||
xp.setParent(this);
|
||||
this.refer = refer;
|
||||
}
|
||||
|
||||
|
||||
public void visit(XSVisitor visitor) {
|
||||
visitor.identityConstraint(this);
|
||||
}
|
||||
|
||||
public <T> T apply(XSFunction<T> function) {
|
||||
return function.identityConstraint(this);
|
||||
}
|
||||
|
||||
public void setParent(ElementDecl parent) {
|
||||
this.parent = parent;
|
||||
parent.getOwnerSchema().addIdentityConstraint(this);
|
||||
}
|
||||
|
||||
public XSElementDecl getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getTargetNamespace() {
|
||||
return getParent().getTargetNamespace();
|
||||
}
|
||||
|
||||
public short getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public XSXPath getSelector() {
|
||||
return selector;
|
||||
}
|
||||
|
||||
public List<XSXPath> getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public XSIdentityConstraint getReferencedKey() {
|
||||
if(category==KEYREF)
|
||||
return refer.get();
|
||||
else
|
||||
throw new IllegalStateException("not a keyref");
|
||||
}
|
||||
|
||||
public XSIdentityConstraint get() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSFacet;
|
||||
import com.sun.xml.internal.xsom.XSListSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSVariety;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSSimpleTypeFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSSimpleTypeVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ListSimpleTypeImpl extends SimpleTypeImpl implements XSListSimpleType
|
||||
{
|
||||
public ListSimpleTypeImpl( SchemaDocumentImpl _parent,
|
||||
AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
|
||||
String _name, boolean _anonymous, Set<XSVariety> finalSet,
|
||||
Ref.SimpleType _itemType ) {
|
||||
|
||||
super(_parent,_annon,_loc,_fa,_name,_anonymous, finalSet,
|
||||
_parent.getSchema().parent.anySimpleType);
|
||||
|
||||
this.itemType = _itemType;
|
||||
}
|
||||
|
||||
private final Ref.SimpleType itemType;
|
||||
public XSSimpleType getItemType() { return itemType.getType(); }
|
||||
|
||||
public void visit( XSSimpleTypeVisitor visitor ) {
|
||||
visitor.listSimpleType(this);
|
||||
}
|
||||
public Object apply( XSSimpleTypeFunction function ) {
|
||||
return function.listSimpleType(this);
|
||||
}
|
||||
|
||||
// list type by itself doesn't have any facet. */
|
||||
public XSFacet getFacet( String name ) { return null; }
|
||||
public List<XSFacet> getFacets( String name ) { return Collections.EMPTY_LIST; }
|
||||
|
||||
public XSVariety getVariety() { return XSVariety.LIST; }
|
||||
|
||||
public XSSimpleType getPrimitiveType() { return null; }
|
||||
|
||||
public XSListSimpleType getBaseListType() {return this;}
|
||||
|
||||
public boolean isList() { return true; }
|
||||
public XSListSimpleType asList() { return this; }
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSElementDecl;
|
||||
import com.sun.xml.internal.xsom.XSModelGroup;
|
||||
import com.sun.xml.internal.xsom.XSModelGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSTerm;
|
||||
import com.sun.xml.internal.xsom.XSWildcard;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermFunctionWithParam;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
public class ModelGroupDeclImpl extends DeclarationImpl implements XSModelGroupDecl, Ref.Term
|
||||
{
|
||||
public ModelGroupDeclImpl( SchemaDocumentImpl owner,
|
||||
AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
|
||||
String _targetNamespace, String _name,
|
||||
ModelGroupImpl _modelGroup ) {
|
||||
|
||||
super(owner,_annon,_loc,_fa,_targetNamespace,_name,false);
|
||||
this.modelGroup = _modelGroup;
|
||||
|
||||
if(modelGroup==null)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
private final ModelGroupImpl modelGroup;
|
||||
public XSModelGroup getModelGroup() { return modelGroup; }
|
||||
|
||||
/**
|
||||
* This component is a redefinition of "oldMG". Fix up the internal state
|
||||
* as such.
|
||||
*/
|
||||
public void redefine( ModelGroupDeclImpl oldMG ) {
|
||||
modelGroup.redefine(oldMG);
|
||||
}
|
||||
|
||||
|
||||
public void visit( XSVisitor visitor ) {
|
||||
visitor.modelGroupDecl(this);
|
||||
}
|
||||
public void visit( XSTermVisitor visitor ) {
|
||||
visitor.modelGroupDecl(this);
|
||||
}
|
||||
public Object apply( XSTermFunction function ) {
|
||||
return function.modelGroupDecl(this);
|
||||
}
|
||||
|
||||
public <T,P> T apply(XSTermFunctionWithParam<T, P> function, P param) {
|
||||
return function.modelGroupDecl(this,param);
|
||||
}
|
||||
|
||||
public Object apply( XSFunction function ) {
|
||||
return function.modelGroupDecl(this);
|
||||
}
|
||||
|
||||
|
||||
public boolean isWildcard() { return false; }
|
||||
public boolean isModelGroupDecl() { return true; }
|
||||
public boolean isModelGroup() { return false; }
|
||||
public boolean isElementDecl() { return false; }
|
||||
|
||||
public XSWildcard asWildcard() { return null; }
|
||||
public XSModelGroupDecl asModelGroupDecl() { return this; }
|
||||
public XSModelGroup asModelGroup() { return null; }
|
||||
public XSElementDecl asElementDecl() { return null; }
|
||||
|
||||
|
||||
// Ref.Term implementation
|
||||
public XSTerm getTerm() { return this; }
|
||||
}
|
||||
114
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/ModelGroupImpl.java
Normal file
114
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/ModelGroupImpl.java
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSElementDecl;
|
||||
import com.sun.xml.internal.xsom.XSModelGroup;
|
||||
import com.sun.xml.internal.xsom.XSModelGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSParticle;
|
||||
import com.sun.xml.internal.xsom.XSTerm;
|
||||
import com.sun.xml.internal.xsom.XSWildcard;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermFunctionWithParam;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class ModelGroupImpl extends ComponentImpl implements XSModelGroup, Ref.Term
|
||||
{
|
||||
public ModelGroupImpl( SchemaDocumentImpl owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
|
||||
Compositor _compositor, ParticleImpl[] _children ) {
|
||||
|
||||
super(owner,_annon,_loc,_fa);
|
||||
this.compositor = _compositor;
|
||||
this.children = _children;
|
||||
|
||||
if(compositor==null)
|
||||
throw new IllegalArgumentException();
|
||||
for( int i=children.length-1; i>=0; i-- )
|
||||
if(children[i]==null)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
private final ParticleImpl[] children;
|
||||
public ParticleImpl getChild( int idx ) { return children[idx]; }
|
||||
public int getSize() { return children.length; }
|
||||
|
||||
public ParticleImpl[] getChildren() { return children; }
|
||||
|
||||
|
||||
private final Compositor compositor;
|
||||
public Compositor getCompositor() { return compositor; }
|
||||
|
||||
|
||||
public void redefine(ModelGroupDeclImpl oldMG) {
|
||||
for (ParticleImpl p : children)
|
||||
p.redefine(oldMG);
|
||||
}
|
||||
|
||||
public Iterator<XSParticle> iterator() {
|
||||
return Arrays.asList((XSParticle[])children).iterator();
|
||||
}
|
||||
|
||||
|
||||
public boolean isWildcard() { return false; }
|
||||
public boolean isModelGroupDecl() { return false; }
|
||||
public boolean isModelGroup() { return true; }
|
||||
public boolean isElementDecl() { return false; }
|
||||
|
||||
public XSWildcard asWildcard() { return null; }
|
||||
public XSModelGroupDecl asModelGroupDecl() { return null; }
|
||||
public XSModelGroup asModelGroup() { return this; }
|
||||
public XSElementDecl asElementDecl() { return null; }
|
||||
|
||||
|
||||
|
||||
public void visit( XSVisitor visitor ) {
|
||||
visitor.modelGroup(this);
|
||||
}
|
||||
public void visit( XSTermVisitor visitor ) {
|
||||
visitor.modelGroup(this);
|
||||
}
|
||||
public Object apply( XSTermFunction function ) {
|
||||
return function.modelGroup(this);
|
||||
}
|
||||
|
||||
public <T,P> T apply(XSTermFunctionWithParam<T, P> function, P param) {
|
||||
return function.modelGroup(this,param);
|
||||
}
|
||||
|
||||
public Object apply( XSFunction function ) {
|
||||
return function.modelGroup(this);
|
||||
}
|
||||
|
||||
// Ref.Term implementation
|
||||
public XSTerm getTerm() { return this; }
|
||||
}
|
||||
64
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/NotationImpl.java
Normal file
64
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/NotationImpl.java
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSNotation;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public class NotationImpl extends DeclarationImpl implements XSNotation {
|
||||
|
||||
public NotationImpl( SchemaDocumentImpl owner, AnnotationImpl _annon,
|
||||
Locator _loc, ForeignAttributesImpl _fa, String _name,
|
||||
String _publicId, String _systemId ) {
|
||||
super(owner,_annon,_loc,_fa,owner.getTargetNamespace(),_name,false);
|
||||
|
||||
this.publicId = _publicId;
|
||||
this.systemId = _systemId;
|
||||
}
|
||||
|
||||
private final String publicId;
|
||||
private final String systemId;
|
||||
|
||||
public String getPublicId() { return publicId; }
|
||||
public String getSystemId() { return systemId; }
|
||||
|
||||
public void visit(XSVisitor visitor) {
|
||||
visitor.notation(this);
|
||||
}
|
||||
|
||||
public Object apply(XSFunction function) {
|
||||
return function.notation(this);
|
||||
}
|
||||
|
||||
}
|
||||
119
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/ParticleImpl.java
Normal file
119
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/ParticleImpl.java
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSContentType;
|
||||
import com.sun.xml.internal.xsom.XSParticle;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSTerm;
|
||||
import com.sun.xml.internal.xsom.impl.parser.DelayedRef;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSContentTypeFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSContentTypeVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import java.math.BigInteger;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ParticleImpl extends ComponentImpl implements XSParticle, ContentTypeImpl
|
||||
{
|
||||
public ParticleImpl( SchemaDocumentImpl owner, AnnotationImpl _ann,
|
||||
Ref.Term _term, Locator _loc, BigInteger _maxOccurs, BigInteger _minOccurs ) {
|
||||
|
||||
super(owner,_ann,_loc,null);
|
||||
this.term = _term;
|
||||
this.maxOccurs = _maxOccurs;
|
||||
this.minOccurs = _minOccurs;
|
||||
}
|
||||
public ParticleImpl( SchemaDocumentImpl owner, AnnotationImpl _ann,
|
||||
Ref.Term _term, Locator _loc, int _maxOccurs, int _minOccurs ) {
|
||||
|
||||
super(owner,_ann,_loc,null);
|
||||
this.term = _term;
|
||||
this.maxOccurs = BigInteger.valueOf(_maxOccurs);
|
||||
this.minOccurs = BigInteger.valueOf(_minOccurs);
|
||||
}
|
||||
public ParticleImpl( SchemaDocumentImpl owner, AnnotationImpl _ann, Ref.Term _term, Locator _loc ) {
|
||||
this(owner,_ann,_term,_loc,1,1);
|
||||
}
|
||||
|
||||
private Ref.Term term;
|
||||
public XSTerm getTerm() { return term.getTerm(); }
|
||||
|
||||
private BigInteger maxOccurs;
|
||||
public BigInteger getMaxOccurs() { return maxOccurs; }
|
||||
|
||||
public boolean isRepeated() {
|
||||
return !maxOccurs.equals(BigInteger.ZERO) && !maxOccurs.equals(BigInteger.ONE);
|
||||
}
|
||||
|
||||
private BigInteger minOccurs;
|
||||
public BigInteger getMinOccurs() { return minOccurs; }
|
||||
|
||||
|
||||
public void redefine(ModelGroupDeclImpl oldMG) {
|
||||
if( term instanceof ModelGroupImpl ) {
|
||||
((ModelGroupImpl)term).redefine(oldMG);
|
||||
return;
|
||||
}
|
||||
if( term instanceof DelayedRef.ModelGroup ) {
|
||||
((DelayedRef)term).redefine(oldMG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public XSSimpleType asSimpleType() { return null; }
|
||||
public XSParticle asParticle() { return this; }
|
||||
public XSContentType asEmpty() { return null; }
|
||||
|
||||
|
||||
public final Object apply( XSFunction function ) {
|
||||
return function.particle(this);
|
||||
}
|
||||
public final Object apply( XSContentTypeFunction function ) {
|
||||
return function.particle(this);
|
||||
}
|
||||
public final void visit( XSVisitor visitor ) {
|
||||
visitor.particle(this);
|
||||
}
|
||||
public final void visit( XSContentTypeVisitor visitor ) {
|
||||
visitor.particle(this);
|
||||
}
|
||||
|
||||
// Ref.ContentType implementation
|
||||
public XSContentType getContentType() { return this; }
|
||||
|
||||
/**
|
||||
* Foreign attribuets are considered to be on terms.
|
||||
*
|
||||
* REVISIT: is this a good design?
|
||||
*/
|
||||
public List getForeignAttributes() {
|
||||
return getTerm().getForeignAttributes();
|
||||
}
|
||||
}
|
||||
99
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/Ref.java
Normal file
99
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/Ref.java
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSAttGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSAttributeDecl;
|
||||
import com.sun.xml.internal.xsom.XSComplexType;
|
||||
import com.sun.xml.internal.xsom.XSContentType;
|
||||
import com.sun.xml.internal.xsom.XSElementDecl;
|
||||
import com.sun.xml.internal.xsom.XSIdentityConstraint;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSTerm;
|
||||
import com.sun.xml.internal.xsom.XSType;
|
||||
|
||||
/**
|
||||
* Reference to other schema components.
|
||||
*
|
||||
* <p>
|
||||
* There are mainly two different types of references. One is
|
||||
* the direct reference, which is only possible when schema components
|
||||
* are already available when references are made.
|
||||
* The other is the lazy reference, which keeps references by names
|
||||
* and later look for the component by name.
|
||||
*
|
||||
* <p>
|
||||
* This class defines interfaces that define the behavior of such
|
||||
* references and classes that implement direct reference semantics.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public abstract class Ref {
|
||||
|
||||
public static interface Term {
|
||||
/** Obtains a reference as a term. */
|
||||
XSTerm getTerm();
|
||||
}
|
||||
|
||||
public static interface Type {
|
||||
/** Obtains a reference as a type. */
|
||||
XSType getType();
|
||||
}
|
||||
|
||||
public static interface ContentType {
|
||||
XSContentType getContentType();
|
||||
}
|
||||
|
||||
public static interface SimpleType extends Ref.Type {
|
||||
public XSSimpleType getType();
|
||||
}
|
||||
|
||||
public static interface ComplexType extends Ref.Type {
|
||||
public XSComplexType getType();
|
||||
}
|
||||
|
||||
public static interface Attribute {
|
||||
XSAttributeDecl getAttribute();
|
||||
}
|
||||
|
||||
public static interface AttGroup {
|
||||
XSAttGroupDecl get();
|
||||
}
|
||||
|
||||
public static interface Element extends Term {
|
||||
XSElementDecl get();
|
||||
}
|
||||
|
||||
public static interface IdentityConstraint {
|
||||
XSIdentityConstraint get();
|
||||
}
|
||||
//
|
||||
//
|
||||
// private static void _assert( boolean b ) {
|
||||
// if(!b)
|
||||
// throw new InternalError("assertion failed");
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSFacet;
|
||||
import com.sun.xml.internal.xsom.XSRestrictionSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSVariety;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSSimpleTypeFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSSimpleTypeVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class RestrictionSimpleTypeImpl extends SimpleTypeImpl implements XSRestrictionSimpleType {
|
||||
|
||||
public RestrictionSimpleTypeImpl( SchemaDocumentImpl _parent,
|
||||
AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
|
||||
String _name, boolean _anonymous, Set<XSVariety> finalSet,
|
||||
Ref.SimpleType _baseType ) {
|
||||
|
||||
super( _parent, _annon, _loc, _fa, _name, _anonymous, finalSet, _baseType );
|
||||
}
|
||||
|
||||
|
||||
private final List<XSFacet> facets = new ArrayList<XSFacet>();
|
||||
public void addFacet( XSFacet facet ) {
|
||||
facets.add(facet);
|
||||
}
|
||||
public Iterator<XSFacet> iterateDeclaredFacets() {
|
||||
return facets.iterator();
|
||||
}
|
||||
|
||||
public Collection<? extends XSFacet> getDeclaredFacets() {
|
||||
return facets;
|
||||
}
|
||||
|
||||
public XSFacet getDeclaredFacet( String name ) {
|
||||
int len = facets.size();
|
||||
for( int i=0; i<len; i++ ) {
|
||||
XSFacet f = facets.get(i);
|
||||
if(f.getName().equals(name))
|
||||
return f;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<XSFacet> getDeclaredFacets(String name) {
|
||||
List<XSFacet> r = new ArrayList<XSFacet>();
|
||||
for( XSFacet f : facets )
|
||||
if(f.getName().equals(name))
|
||||
r.add(f);
|
||||
return r;
|
||||
}
|
||||
|
||||
public XSFacet getFacet( String name ) {
|
||||
XSFacet f = getDeclaredFacet(name);
|
||||
if(f!=null) return f;
|
||||
|
||||
// none was found on this datatype. check the base type.
|
||||
return getSimpleBaseType().getFacet(name);
|
||||
}
|
||||
|
||||
public List<XSFacet> getFacets( String name ) {
|
||||
List<XSFacet> f = getDeclaredFacets(name);
|
||||
if(!f.isEmpty()) return f;
|
||||
|
||||
// none was found on this datatype. check the base type.
|
||||
return getSimpleBaseType().getFacets(name);
|
||||
}
|
||||
|
||||
public XSVariety getVariety() { return getSimpleBaseType().getVariety(); }
|
||||
|
||||
public XSSimpleType getPrimitiveType() {
|
||||
if(isPrimitive()) return this;
|
||||
return getSimpleBaseType().getPrimitiveType();
|
||||
}
|
||||
|
||||
public boolean isPrimitive() {
|
||||
return getSimpleBaseType()==getOwnerSchema().getRoot().anySimpleType;
|
||||
}
|
||||
|
||||
public void visit( XSSimpleTypeVisitor visitor ) {
|
||||
visitor.restrictionSimpleType(this);
|
||||
}
|
||||
public Object apply( XSSimpleTypeFunction function ) {
|
||||
return function.restrictionSimpleType(this);
|
||||
}
|
||||
|
||||
public boolean isRestriction() { return true; }
|
||||
public XSRestrictionSimpleType asRestriction() { return this; }
|
||||
}
|
||||
309
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/SchemaImpl.java
Normal file
309
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/SchemaImpl.java
Normal file
@@ -0,0 +1,309 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.ForeignAttributes;
|
||||
import com.sun.xml.internal.xsom.SCD;
|
||||
import com.sun.xml.internal.xsom.XSAnnotation;
|
||||
import com.sun.xml.internal.xsom.XSAttGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSAttributeDecl;
|
||||
import com.sun.xml.internal.xsom.XSComplexType;
|
||||
import com.sun.xml.internal.xsom.XSComponent;
|
||||
import com.sun.xml.internal.xsom.XSElementDecl;
|
||||
import com.sun.xml.internal.xsom.XSIdentityConstraint;
|
||||
import com.sun.xml.internal.xsom.XSModelGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSNotation;
|
||||
import com.sun.xml.internal.xsom.XSSchema;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSType;
|
||||
import com.sun.xml.internal.xsom.parser.SchemaDocument;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SchemaImpl implements XSSchema
|
||||
{
|
||||
public SchemaImpl(SchemaSetImpl _parent, Locator loc, String tns) {
|
||||
if (tns == null)
|
||||
// the empty string must be used.
|
||||
throw new IllegalArgumentException();
|
||||
this.targetNamespace = tns;
|
||||
this.parent = _parent;
|
||||
this.locator = loc;
|
||||
}
|
||||
|
||||
public SchemaDocument getSourceDocument() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public SchemaSetImpl getRoot() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
protected final SchemaSetImpl parent;
|
||||
|
||||
private final String targetNamespace;
|
||||
public String getTargetNamespace() {
|
||||
return targetNamespace;
|
||||
}
|
||||
|
||||
public XSSchema getOwnerSchema() {
|
||||
return this;
|
||||
}
|
||||
|
||||
private XSAnnotation annotation;
|
||||
public void setAnnotation(XSAnnotation a) {
|
||||
annotation = a;
|
||||
}
|
||||
public XSAnnotation getAnnotation() {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
public XSAnnotation getAnnotation(boolean createIfNotExist) {
|
||||
if(createIfNotExist && annotation==null)
|
||||
annotation = new AnnotationImpl();
|
||||
return annotation;
|
||||
}
|
||||
|
||||
// it's difficult to determine the source location for the schema
|
||||
// component as one schema can be defined across multiple files.
|
||||
// so this locator might not correctly reflect all the locations
|
||||
// where the schema is defined.
|
||||
// but partial information would be better than nothing.
|
||||
|
||||
private final Locator locator;
|
||||
public Locator getLocator() {
|
||||
return locator;
|
||||
}
|
||||
|
||||
|
||||
private final Map<String,XSAttributeDecl> atts = new HashMap<String,XSAttributeDecl>();
|
||||
private final Map<String,XSAttributeDecl> attsView = Collections.unmodifiableMap(atts);
|
||||
public void addAttributeDecl(XSAttributeDecl newDecl) {
|
||||
atts.put(newDecl.getName(), newDecl);
|
||||
}
|
||||
public Map<String,XSAttributeDecl> getAttributeDecls() {
|
||||
return attsView;
|
||||
}
|
||||
public XSAttributeDecl getAttributeDecl(String name) {
|
||||
return atts.get(name);
|
||||
}
|
||||
public Iterator<XSAttributeDecl> iterateAttributeDecls() {
|
||||
return atts.values().iterator();
|
||||
}
|
||||
|
||||
private final Map<String,XSElementDecl> elems = new HashMap<String,XSElementDecl>();
|
||||
private final Map<String,XSElementDecl> elemsView = Collections.unmodifiableMap(elems);
|
||||
public void addElementDecl(XSElementDecl newDecl) {
|
||||
elems.put(newDecl.getName(), newDecl);
|
||||
}
|
||||
public Map<String,XSElementDecl> getElementDecls() {
|
||||
return elemsView;
|
||||
}
|
||||
public XSElementDecl getElementDecl(String name) {
|
||||
return elems.get(name);
|
||||
}
|
||||
public Iterator<XSElementDecl> iterateElementDecls() {
|
||||
return elems.values().iterator();
|
||||
}
|
||||
|
||||
private final Map<String,XSAttGroupDecl> attGroups = new HashMap<String,XSAttGroupDecl>();
|
||||
private final Map<String,XSAttGroupDecl> attGroupsView = Collections.unmodifiableMap(attGroups);
|
||||
public void addAttGroupDecl(XSAttGroupDecl newDecl, boolean overwrite) {
|
||||
if(overwrite || !attGroups.containsKey(newDecl.getName()))
|
||||
attGroups.put(newDecl.getName(), newDecl);
|
||||
}
|
||||
public Map<String,XSAttGroupDecl> getAttGroupDecls() {
|
||||
return attGroupsView;
|
||||
}
|
||||
public XSAttGroupDecl getAttGroupDecl(String name) {
|
||||
return attGroups.get(name);
|
||||
}
|
||||
public Iterator<XSAttGroupDecl> iterateAttGroupDecls() {
|
||||
return attGroups.values().iterator();
|
||||
}
|
||||
|
||||
|
||||
private final Map<String,XSNotation> notations = new HashMap<String,XSNotation>();
|
||||
private final Map<String,XSNotation> notationsView = Collections.unmodifiableMap(notations);
|
||||
public void addNotation( XSNotation newDecl ) {
|
||||
notations.put( newDecl.getName(), newDecl );
|
||||
}
|
||||
public Map<String,XSNotation> getNotations() {
|
||||
return notationsView;
|
||||
}
|
||||
public XSNotation getNotation( String name ) {
|
||||
return notations.get(name);
|
||||
}
|
||||
public Iterator<XSNotation> iterateNotations() {
|
||||
return notations.values().iterator();
|
||||
}
|
||||
|
||||
private final Map<String,XSModelGroupDecl> modelGroups = new HashMap<String,XSModelGroupDecl>();
|
||||
private final Map<String,XSModelGroupDecl> modelGroupsView = Collections.unmodifiableMap(modelGroups);
|
||||
public void addModelGroupDecl(XSModelGroupDecl newDecl, boolean overwrite) {
|
||||
if(overwrite || !modelGroups.containsKey(newDecl.getName()))
|
||||
modelGroups.put(newDecl.getName(), newDecl);
|
||||
}
|
||||
public Map<String,XSModelGroupDecl> getModelGroupDecls() {
|
||||
return modelGroupsView;
|
||||
}
|
||||
public XSModelGroupDecl getModelGroupDecl(String name) {
|
||||
return modelGroups.get(name);
|
||||
}
|
||||
public Iterator<XSModelGroupDecl> iterateModelGroupDecls() {
|
||||
return modelGroups.values().iterator();
|
||||
}
|
||||
|
||||
|
||||
private final Map<String,XSIdentityConstraint> idConstraints = new HashMap<String,XSIdentityConstraint>();
|
||||
private final Map<String,XSIdentityConstraint> idConstraintsView = Collections.unmodifiableMap(idConstraints);
|
||||
|
||||
protected void addIdentityConstraint(IdentityConstraintImpl c) {
|
||||
idConstraints.put(c.getName(),c);
|
||||
}
|
||||
|
||||
public Map<String, XSIdentityConstraint> getIdentityConstraints() {
|
||||
return idConstraintsView;
|
||||
}
|
||||
|
||||
public XSIdentityConstraint getIdentityConstraint(String localName) {
|
||||
return idConstraints.get(localName);
|
||||
}
|
||||
|
||||
private final Map<String,XSType> allTypes = new HashMap<String,XSType>();
|
||||
private final Map<String,XSType> allTypesView = Collections.unmodifiableMap(allTypes);
|
||||
|
||||
private final Map<String,XSSimpleType> simpleTypes = new HashMap<String,XSSimpleType>();
|
||||
private final Map<String,XSSimpleType> simpleTypesView = Collections.unmodifiableMap(simpleTypes);
|
||||
public void addSimpleType(XSSimpleType newDecl, boolean overwrite) {
|
||||
if(overwrite || !simpleTypes.containsKey(newDecl.getName())) {
|
||||
simpleTypes.put(newDecl.getName(), newDecl);
|
||||
allTypes.put(newDecl.getName(), newDecl);
|
||||
}
|
||||
}
|
||||
public Map<String,XSSimpleType> getSimpleTypes() {
|
||||
return simpleTypesView;
|
||||
}
|
||||
public XSSimpleType getSimpleType(String name) {
|
||||
return simpleTypes.get(name);
|
||||
}
|
||||
public Iterator<XSSimpleType> iterateSimpleTypes() {
|
||||
return simpleTypes.values().iterator();
|
||||
}
|
||||
|
||||
private final Map<String,XSComplexType> complexTypes = new HashMap<String,XSComplexType>();
|
||||
private final Map<String,XSComplexType> complexTypesView = Collections.unmodifiableMap(complexTypes);
|
||||
public void addComplexType(XSComplexType newDecl, boolean overwrite) {
|
||||
if(overwrite || !complexTypes.containsKey(newDecl.getName())) {
|
||||
complexTypes.put(newDecl.getName(), newDecl);
|
||||
allTypes.put(newDecl.getName(), newDecl);
|
||||
}
|
||||
}
|
||||
public Map<String,XSComplexType> getComplexTypes() {
|
||||
return complexTypesView;
|
||||
}
|
||||
public XSComplexType getComplexType(String name) {
|
||||
return complexTypes.get(name);
|
||||
}
|
||||
public Iterator<XSComplexType> iterateComplexTypes() {
|
||||
return complexTypes.values().iterator();
|
||||
}
|
||||
|
||||
public Map<String,XSType> getTypes() {
|
||||
return allTypesView;
|
||||
}
|
||||
public XSType getType(String name) {
|
||||
return allTypes.get(name);
|
||||
}
|
||||
public Iterator<XSType> iterateTypes() {
|
||||
return allTypes.values().iterator();
|
||||
}
|
||||
|
||||
public void visit(XSVisitor visitor) {
|
||||
visitor.schema(this);
|
||||
}
|
||||
|
||||
public Object apply(XSFunction function) {
|
||||
return function.schema(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazily created list of {@link ForeignAttributesImpl}s.
|
||||
*/
|
||||
private List<ForeignAttributes> foreignAttributes = null;
|
||||
private List<ForeignAttributes> readOnlyForeignAttributes = null;
|
||||
|
||||
public void addForeignAttributes(ForeignAttributesImpl fa) {
|
||||
if(foreignAttributes==null)
|
||||
foreignAttributes = new ArrayList<ForeignAttributes>();
|
||||
foreignAttributes.add(fa);
|
||||
}
|
||||
|
||||
public List<ForeignAttributes> getForeignAttributes() {
|
||||
if(readOnlyForeignAttributes==null) {
|
||||
if(foreignAttributes==null)
|
||||
readOnlyForeignAttributes = Collections.EMPTY_LIST;
|
||||
else
|
||||
readOnlyForeignAttributes = Collections.unmodifiableList(foreignAttributes);
|
||||
}
|
||||
return readOnlyForeignAttributes;
|
||||
}
|
||||
|
||||
public String getForeignAttribute(String nsUri, String localName) {
|
||||
for( ForeignAttributes fa : getForeignAttributes() ) {
|
||||
String v = fa.getValue(nsUri,localName);
|
||||
if(v!=null) return v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<XSComponent> select(String scd, NamespaceContext nsContext) {
|
||||
try {
|
||||
return SCD.create(scd,nsContext).select(this);
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public XSComponent selectSingle(String scd, NamespaceContext nsContext) {
|
||||
try {
|
||||
return SCD.create(scd,nsContext).selectSingle(this);
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
394
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/SchemaSetImpl.java
Normal file
394
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/SchemaSetImpl.java
Normal file
@@ -0,0 +1,394 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.SCD;
|
||||
import com.sun.xml.internal.xsom.XSAttGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSAttributeDecl;
|
||||
import com.sun.xml.internal.xsom.XSAttributeUse;
|
||||
import com.sun.xml.internal.xsom.XSComplexType;
|
||||
import com.sun.xml.internal.xsom.XSComponent;
|
||||
import com.sun.xml.internal.xsom.XSContentType;
|
||||
import com.sun.xml.internal.xsom.XSElementDecl;
|
||||
import com.sun.xml.internal.xsom.XSFacet;
|
||||
import com.sun.xml.internal.xsom.XSIdentityConstraint;
|
||||
import com.sun.xml.internal.xsom.XSListSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSModelGroup;
|
||||
import com.sun.xml.internal.xsom.XSModelGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSNotation;
|
||||
import com.sun.xml.internal.xsom.XSParticle;
|
||||
import com.sun.xml.internal.xsom.XSRestrictionSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSSchema;
|
||||
import com.sun.xml.internal.xsom.XSSchemaSet;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSType;
|
||||
import com.sun.xml.internal.xsom.XSUnionSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSVariety;
|
||||
import com.sun.xml.internal.xsom.XSWildcard;
|
||||
import com.sun.xml.internal.xsom.impl.scd.Iterators;
|
||||
import com.sun.xml.internal.xsom.visitor.XSContentTypeFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSContentTypeVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSSimpleTypeFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSSimpleTypeVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
public class SchemaSetImpl implements XSSchemaSet
|
||||
{
|
||||
private final Map<String,XSSchema> schemas = new HashMap<String,XSSchema>();
|
||||
private final Vector<XSSchema> schemas2 = new Vector<XSSchema>();
|
||||
private final List<XSSchema> readonlySchemaList = Collections.unmodifiableList(schemas2);
|
||||
|
||||
/**
|
||||
* Gets a reference to the existing schema or creates a new one
|
||||
* if none exists yet.
|
||||
*/
|
||||
public SchemaImpl createSchema(String targetNamespace, Locator location) {
|
||||
SchemaImpl obj = (SchemaImpl)schemas.get(targetNamespace);
|
||||
if (obj == null) {
|
||||
obj = new SchemaImpl(this, location, targetNamespace);
|
||||
schemas.put(targetNamespace, obj);
|
||||
schemas2.add(obj);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
public int getSchemaSize() {
|
||||
return schemas.size();
|
||||
}
|
||||
public XSSchema getSchema(String targetNamespace) {
|
||||
return schemas.get(targetNamespace);
|
||||
}
|
||||
public XSSchema getSchema(int idx) {
|
||||
return schemas2.get(idx);
|
||||
}
|
||||
public Iterator<XSSchema> iterateSchema() {
|
||||
return schemas2.iterator();
|
||||
}
|
||||
|
||||
public final Collection<XSSchema> getSchemas() {
|
||||
return readonlySchemaList;
|
||||
}
|
||||
|
||||
public XSType getType(String ns, String localName) {
|
||||
XSSchema schema = getSchema(ns);
|
||||
if(schema==null) return null;
|
||||
|
||||
return schema.getType(localName);
|
||||
}
|
||||
|
||||
public XSSimpleType getSimpleType( String ns, String localName ) {
|
||||
XSSchema schema = getSchema(ns);
|
||||
if(schema==null) return null;
|
||||
|
||||
return schema.getSimpleType(localName);
|
||||
}
|
||||
|
||||
public XSElementDecl getElementDecl( String ns, String localName ) {
|
||||
XSSchema schema = getSchema(ns);
|
||||
if(schema==null) return null;
|
||||
|
||||
return schema.getElementDecl(localName);
|
||||
}
|
||||
|
||||
public XSAttributeDecl getAttributeDecl( String ns, String localName ) {
|
||||
XSSchema schema = getSchema(ns);
|
||||
if(schema==null) return null;
|
||||
|
||||
return schema.getAttributeDecl(localName);
|
||||
}
|
||||
|
||||
public XSModelGroupDecl getModelGroupDecl( String ns, String localName ) {
|
||||
XSSchema schema = getSchema(ns);
|
||||
if(schema==null) return null;
|
||||
|
||||
return schema.getModelGroupDecl(localName);
|
||||
}
|
||||
|
||||
public XSAttGroupDecl getAttGroupDecl( String ns, String localName ) {
|
||||
XSSchema schema = getSchema(ns);
|
||||
if(schema==null) return null;
|
||||
|
||||
return schema.getAttGroupDecl(localName);
|
||||
}
|
||||
|
||||
public XSComplexType getComplexType( String ns, String localName ) {
|
||||
XSSchema schema = getSchema(ns);
|
||||
if(schema==null) return null;
|
||||
|
||||
return schema.getComplexType(localName);
|
||||
}
|
||||
|
||||
public XSIdentityConstraint getIdentityConstraint(String ns, String localName) {
|
||||
XSSchema schema = getSchema(ns);
|
||||
if(schema==null) return null;
|
||||
|
||||
return schema.getIdentityConstraint(localName);
|
||||
}
|
||||
|
||||
public Iterator<XSElementDecl> iterateElementDecls() {
|
||||
return new Iterators.Map<XSElementDecl,XSSchema>(iterateSchema()) {
|
||||
protected Iterator<XSElementDecl> apply(XSSchema u) {
|
||||
return u.iterateElementDecls();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Iterator<XSType> iterateTypes() {
|
||||
return new Iterators.Map<XSType,XSSchema>(iterateSchema()) {
|
||||
protected Iterator<XSType> apply(XSSchema u) {
|
||||
return u.iterateTypes();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Iterator<XSAttributeDecl> iterateAttributeDecls() {
|
||||
return new Iterators.Map<XSAttributeDecl,XSSchema>(iterateSchema()) {
|
||||
protected Iterator<XSAttributeDecl> apply(XSSchema u) {
|
||||
return u.iterateAttributeDecls();
|
||||
}
|
||||
};
|
||||
}
|
||||
public Iterator<XSAttGroupDecl> iterateAttGroupDecls() {
|
||||
return new Iterators.Map<XSAttGroupDecl,XSSchema>(iterateSchema()) {
|
||||
protected Iterator<XSAttGroupDecl> apply(XSSchema u) {
|
||||
return u.iterateAttGroupDecls();
|
||||
}
|
||||
};
|
||||
}
|
||||
public Iterator<XSModelGroupDecl> iterateModelGroupDecls() {
|
||||
return new Iterators.Map<XSModelGroupDecl,XSSchema>(iterateSchema()) {
|
||||
protected Iterator<XSModelGroupDecl> apply(XSSchema u) {
|
||||
return u.iterateModelGroupDecls();
|
||||
}
|
||||
};
|
||||
}
|
||||
public Iterator<XSSimpleType> iterateSimpleTypes() {
|
||||
return new Iterators.Map<XSSimpleType,XSSchema>(iterateSchema()) {
|
||||
protected Iterator<XSSimpleType> apply(XSSchema u) {
|
||||
return u.iterateSimpleTypes();
|
||||
}
|
||||
};
|
||||
}
|
||||
public Iterator<XSComplexType> iterateComplexTypes() {
|
||||
return new Iterators.Map<XSComplexType,XSSchema>(iterateSchema()) {
|
||||
protected Iterator<XSComplexType> apply(XSSchema u) {
|
||||
return u.iterateComplexTypes();
|
||||
}
|
||||
};
|
||||
}
|
||||
public Iterator<XSNotation> iterateNotations() {
|
||||
return new Iterators.Map<XSNotation,XSSchema>(iterateSchema()) {
|
||||
protected Iterator<XSNotation> apply(XSSchema u) {
|
||||
return u.iterateNotations();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Iterator<XSIdentityConstraint> iterateIdentityConstraints() {
|
||||
return new Iterators.Map<XSIdentityConstraint,XSSchema>(iterateSchema()) {
|
||||
protected Iterator<XSIdentityConstraint> apply(XSSchema u) {
|
||||
return u.getIdentityConstraints().values().iterator();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Collection<XSComponent> select(String scd, NamespaceContext nsContext) {
|
||||
try {
|
||||
return SCD.create(scd,nsContext).select(this);
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public XSComponent selectSingle(String scd, NamespaceContext nsContext) {
|
||||
try {
|
||||
return SCD.create(scd,nsContext).selectSingle(this);
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public final EmptyImpl empty = new EmptyImpl();
|
||||
public XSContentType getEmpty() { return empty; }
|
||||
|
||||
public XSSimpleType getAnySimpleType() { return anySimpleType; }
|
||||
public final AnySimpleType anySimpleType = new AnySimpleType();
|
||||
private class AnySimpleType extends DeclarationImpl
|
||||
implements XSRestrictionSimpleType, Ref.SimpleType {
|
||||
|
||||
AnySimpleType() {
|
||||
super(null,null,null,null,"http://www.w3.org/2001/XMLSchema","anySimpleType",false);
|
||||
}
|
||||
public SchemaImpl getOwnerSchema() {
|
||||
return createSchema("http://www.w3.org/2001/XMLSchema",null);
|
||||
}
|
||||
public XSSimpleType asSimpleType() { return this; }
|
||||
public XSComplexType asComplexType() { return null; }
|
||||
|
||||
public boolean isDerivedFrom(XSType t) {
|
||||
return t==this || t==anyType;
|
||||
}
|
||||
|
||||
public boolean isSimpleType() { return true; }
|
||||
public boolean isComplexType() { return false; }
|
||||
public XSContentType asEmpty() { return null; }
|
||||
public XSParticle asParticle() { return null; }
|
||||
public XSType getBaseType() { return anyType; }
|
||||
public XSSimpleType getSimpleBaseType() { return null; }
|
||||
public int getDerivationMethod() { return RESTRICTION; }
|
||||
public Iterator<XSFacet> iterateDeclaredFacets() { return Iterators.empty(); }
|
||||
public Collection<? extends XSFacet> getDeclaredFacets() { return Collections.EMPTY_LIST; }
|
||||
public void visit( XSSimpleTypeVisitor visitor ) {visitor.restrictionSimpleType(this); }
|
||||
public void visit( XSContentTypeVisitor visitor ) {visitor.simpleType(this); }
|
||||
public void visit( XSVisitor visitor ) {visitor.simpleType(this); }
|
||||
public <T> T apply( XSSimpleTypeFunction<T> f ) {return f.restrictionSimpleType(this); }
|
||||
public <T> T apply( XSContentTypeFunction<T> f ) { return f.simpleType(this); }
|
||||
public <T> T apply( XSFunction<T> f ) { return f.simpleType(this); }
|
||||
public XSVariety getVariety() { return XSVariety.ATOMIC; }
|
||||
public XSSimpleType getPrimitiveType() {return this;}
|
||||
public boolean isPrimitive() {return true;}
|
||||
public XSListSimpleType getBaseListType() {return null;}
|
||||
public XSUnionSimpleType getBaseUnionType() {return null;}
|
||||
public XSFacet getFacet(String name) { return null; }
|
||||
public List<XSFacet> getFacets( String name ) { return Collections.EMPTY_LIST; }
|
||||
public XSFacet getDeclaredFacet(String name) { return null; }
|
||||
public List<XSFacet> getDeclaredFacets(String name) { return Collections.EMPTY_LIST; }
|
||||
|
||||
public boolean isRestriction() { return true; }
|
||||
public boolean isList() { return false; }
|
||||
public boolean isUnion() { return false; }
|
||||
public boolean isFinal(XSVariety v) { return false; }
|
||||
public XSRestrictionSimpleType asRestriction() { return this; }
|
||||
public XSListSimpleType asList() { return null; }
|
||||
public XSUnionSimpleType asUnion() { return null; }
|
||||
public XSSimpleType getType() { return this; } // Ref.SimpleType implementation
|
||||
public XSSimpleType getRedefinedBy() { return null; }
|
||||
public int getRedefinedCount() { return 0; }
|
||||
|
||||
public XSType[] listSubstitutables() {
|
||||
return Util.listSubstitutables(this);
|
||||
}
|
||||
}
|
||||
|
||||
public XSComplexType getAnyType() { return anyType; }
|
||||
public final AnyType anyType = new AnyType();
|
||||
private class AnyType extends DeclarationImpl implements XSComplexType, Ref.Type {
|
||||
AnyType() {
|
||||
super(null,null,null,null,"http://www.w3.org/2001/XMLSchema","anyType",false);
|
||||
}
|
||||
public SchemaImpl getOwnerSchema() {
|
||||
return createSchema("http://www.w3.org/2001/XMLSchema",null);
|
||||
}
|
||||
public boolean isAbstract() { return false; }
|
||||
public XSWildcard getAttributeWildcard() { return anyWildcard; }
|
||||
public XSAttributeUse getAttributeUse( String nsURI, String localName ) { return null; }
|
||||
public Iterator<XSAttributeUse> iterateAttributeUses() { return Iterators.empty(); }
|
||||
public XSAttributeUse getDeclaredAttributeUse( String nsURI, String localName ) { return null; }
|
||||
public Iterator<XSAttributeUse> iterateDeclaredAttributeUses() { return Iterators.empty(); }
|
||||
public Iterator<XSAttGroupDecl> iterateAttGroups() { return Iterators.empty(); }
|
||||
public Collection<XSAttributeUse> getAttributeUses() { return Collections.EMPTY_LIST; }
|
||||
public Collection<? extends XSAttributeUse> getDeclaredAttributeUses() { return Collections.EMPTY_LIST; }
|
||||
public Collection<? extends XSAttGroupDecl> getAttGroups() { return Collections.EMPTY_LIST; }
|
||||
public boolean isFinal( int i ) { return false; }
|
||||
public boolean isSubstitutionProhibited( int i ) { return false; }
|
||||
public boolean isMixed() { return true; }
|
||||
public XSContentType getContentType() { return contentType; }
|
||||
public XSContentType getExplicitContent() { return null; }
|
||||
public XSType getBaseType() { return this; }
|
||||
public XSSimpleType asSimpleType() { return null; }
|
||||
public XSComplexType asComplexType() { return this; }
|
||||
|
||||
public boolean isDerivedFrom(XSType t) {
|
||||
return t==this;
|
||||
}
|
||||
|
||||
public boolean isSimpleType() { return false; }
|
||||
public boolean isComplexType() { return true; }
|
||||
public XSContentType asEmpty() { return null; }
|
||||
public int getDerivationMethod() { return XSType.RESTRICTION; }
|
||||
|
||||
public XSElementDecl getScope() { return null; }
|
||||
public void visit( XSVisitor visitor ) { visitor.complexType(this); }
|
||||
public <T> T apply( XSFunction<T> f ) { return f.complexType(this); }
|
||||
|
||||
public XSType getType() { return this; } // Ref.Type implementation
|
||||
|
||||
public XSComplexType getRedefinedBy() { return null; }
|
||||
public int getRedefinedCount() { return 0; }
|
||||
|
||||
public XSType[] listSubstitutables() {
|
||||
return Util.listSubstitutables(this);
|
||||
}
|
||||
|
||||
private final WildcardImpl anyWildcard = new WildcardImpl.Any(null,null,null,null,XSWildcard.SKIP);
|
||||
private final XSContentType contentType = new ParticleImpl( null, null,
|
||||
new ModelGroupImpl(null, null, null, null,XSModelGroup.SEQUENCE, new ParticleImpl[]{
|
||||
new ParticleImpl( null, null,
|
||||
anyWildcard, null,
|
||||
XSParticle.UNBOUNDED, 0 )
|
||||
})
|
||||
,null,1,1);
|
||||
public List<XSComplexType> getSubtypes() {
|
||||
ArrayList subtypeList = new ArrayList();
|
||||
Iterator<XSComplexType> cTypes = getRoot().iterateComplexTypes();
|
||||
while (cTypes.hasNext()) {
|
||||
XSComplexType cType= cTypes.next();
|
||||
XSType base = cType.getBaseType();
|
||||
if ((base != null) && (base.equals(this))) {
|
||||
subtypeList.add(cType);
|
||||
}
|
||||
}
|
||||
return subtypeList;
|
||||
}
|
||||
|
||||
public List<XSElementDecl> getElementDecls() {
|
||||
ArrayList declList = new ArrayList();
|
||||
XSSchemaSet schemaSet = getRoot();
|
||||
for (XSSchema sch : schemaSet.getSchemas()) {
|
||||
for (XSElementDecl decl : sch.getElementDecls().values()) {
|
||||
if (decl.getType().equals(this)) {
|
||||
declList.add(decl);
|
||||
}
|
||||
}
|
||||
}
|
||||
return declList;
|
||||
}
|
||||
}
|
||||
}
|
||||
165
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/SimpleTypeImpl.java
Normal file
165
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/SimpleTypeImpl.java
Normal file
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSComplexType;
|
||||
import com.sun.xml.internal.xsom.XSContentType;
|
||||
import com.sun.xml.internal.xsom.XSListSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSParticle;
|
||||
import com.sun.xml.internal.xsom.XSRestrictionSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSType;
|
||||
import com.sun.xml.internal.xsom.XSUnionSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSVariety;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSContentTypeFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSContentTypeVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class SimpleTypeImpl extends DeclarationImpl
|
||||
implements XSSimpleType, ContentTypeImpl, Ref.SimpleType
|
||||
{
|
||||
SimpleTypeImpl(
|
||||
SchemaDocumentImpl _parent,
|
||||
AnnotationImpl _annon,
|
||||
Locator _loc,
|
||||
ForeignAttributesImpl _fa,
|
||||
String _name,
|
||||
boolean _anonymous,
|
||||
Set<XSVariety> finalSet,
|
||||
Ref.SimpleType _baseType) {
|
||||
|
||||
super(_parent, _annon, _loc, _fa, _parent.getTargetNamespace(), _name, _anonymous);
|
||||
|
||||
this.baseType = _baseType;
|
||||
this.finalSet = finalSet;
|
||||
}
|
||||
|
||||
private Ref.SimpleType baseType;
|
||||
|
||||
public XSType[] listSubstitutables() {
|
||||
return Util.listSubstitutables(this);
|
||||
}
|
||||
|
||||
public void redefine( SimpleTypeImpl st ) {
|
||||
baseType = st;
|
||||
st.redefinedBy = this;
|
||||
redefiningCount = (short)(st.redefiningCount+1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of times this component redefines other components.
|
||||
*/
|
||||
private short redefiningCount = 0;
|
||||
|
||||
private SimpleTypeImpl redefinedBy = null;
|
||||
|
||||
public XSSimpleType getRedefinedBy() {
|
||||
return redefinedBy;
|
||||
}
|
||||
|
||||
public int getRedefinedCount() {
|
||||
int i=0;
|
||||
for( SimpleTypeImpl st =this.redefinedBy; st !=null; st =st.redefinedBy)
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
public XSType getBaseType() { return baseType.getType(); }
|
||||
public XSSimpleType getSimpleBaseType() { return baseType.getType(); }
|
||||
public boolean isPrimitive() { return false; }
|
||||
|
||||
public XSListSimpleType getBaseListType() {
|
||||
return getSimpleBaseType().getBaseListType();
|
||||
}
|
||||
|
||||
public XSUnionSimpleType getBaseUnionType() {
|
||||
return getSimpleBaseType().getBaseUnionType();
|
||||
}
|
||||
|
||||
private final Set<XSVariety> finalSet;
|
||||
|
||||
public boolean isFinal(XSVariety v) {
|
||||
return finalSet.contains(v);
|
||||
}
|
||||
|
||||
|
||||
public final int getDerivationMethod() { return XSType.RESTRICTION; }
|
||||
|
||||
|
||||
public final XSSimpleType asSimpleType() { return this; }
|
||||
public final XSComplexType asComplexType(){ return null; }
|
||||
|
||||
public boolean isDerivedFrom(XSType t) {
|
||||
XSType x = this;
|
||||
while(true) {
|
||||
if(t==x)
|
||||
return true;
|
||||
XSType s = x.getBaseType();
|
||||
if(s==x)
|
||||
return false;
|
||||
x = s;
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isSimpleType() { return true; }
|
||||
public final boolean isComplexType() { return false; }
|
||||
public final XSParticle asParticle() { return null; }
|
||||
public final XSContentType asEmpty() { return null; }
|
||||
|
||||
|
||||
public boolean isRestriction() { return false; }
|
||||
public boolean isList() { return false; }
|
||||
public boolean isUnion() { return false; }
|
||||
public XSRestrictionSimpleType asRestriction() { return null; }
|
||||
public XSListSimpleType asList() { return null; }
|
||||
public XSUnionSimpleType asUnion() { return null; }
|
||||
|
||||
|
||||
|
||||
|
||||
public final void visit( XSVisitor visitor ) {
|
||||
visitor.simpleType(this);
|
||||
}
|
||||
public final void visit( XSContentTypeVisitor visitor ) {
|
||||
visitor.simpleType(this);
|
||||
}
|
||||
public final Object apply( XSFunction function ) {
|
||||
return function.simpleType(this);
|
||||
}
|
||||
public final Object apply( XSContentTypeFunction function ) {
|
||||
return function.simpleType(this);
|
||||
}
|
||||
|
||||
// Ref.ContentType implementation
|
||||
public XSContentType getContentType() { return this; }
|
||||
// Ref.SimpleType implementation
|
||||
public XSSimpleType getType() { return this; }
|
||||
}
|
||||
105
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/UName.java
Normal file
105
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/UName.java
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSDeclaration;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* UName.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kk@kohsuke.org)
|
||||
*/
|
||||
public final class UName {
|
||||
/**
|
||||
* @param _nsUri
|
||||
* Use "" to indicate the no namespace.
|
||||
*/
|
||||
public UName( String _nsUri, String _localName, String _qname ) {
|
||||
if(_nsUri==null || _localName==null || _qname==null) {
|
||||
throw new NullPointerException(_nsUri+" "+_localName+" "+_qname);
|
||||
}
|
||||
this.nsUri = _nsUri.intern();
|
||||
this.localName = _localName.intern();
|
||||
this.qname = _qname.intern();
|
||||
}
|
||||
|
||||
public UName( String nsUri, String localName ) {
|
||||
this(nsUri,localName,localName);
|
||||
}
|
||||
|
||||
public UName(XSDeclaration decl) {
|
||||
this(decl.getTargetNamespace(),decl.getName());
|
||||
}
|
||||
|
||||
private final String nsUri;
|
||||
private final String localName;
|
||||
private final String qname;
|
||||
|
||||
public String getName() { return localName; }
|
||||
public String getNamespaceURI() { return nsUri; }
|
||||
public String getQualifiedName() { return qname; }
|
||||
|
||||
|
||||
// Issue 540; XSComplexType.getAttributeUse(String,String) always return null
|
||||
// UName was used in HashMap without overriden equals and hashCode methods.
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj instanceof UName) {
|
||||
UName u = (UName)obj;
|
||||
|
||||
return ((this.getName().compareTo(u.getName()) == 0) &&
|
||||
(this.getNamespaceURI().compareTo(u.getNamespaceURI()) == 0) &&
|
||||
(this.getQualifiedName().compareTo(u.getQualifiedName()) == 0));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 13 * hash + (this.nsUri != null ? this.nsUri.hashCode() : 0);
|
||||
hash = 13 * hash + (this.localName != null ? this.localName.hashCode() : 0);
|
||||
hash = 13 * hash + (this.qname != null ? this.qname.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares {@link UName}s by their names.
|
||||
*/
|
||||
public static final Comparator comparator = new Comparator() {
|
||||
public int compare(Object o1, Object o2) {
|
||||
UName lhs = (UName)o1;
|
||||
UName rhs = (UName)o2;
|
||||
int r = lhs.nsUri.compareTo(rhs.nsUri);
|
||||
if(r!=0) return r;
|
||||
return lhs.localName.compareTo(rhs.localName);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSFacet;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSUnionSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSVariety;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSSimpleTypeFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSSimpleTypeVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
public class UnionSimpleTypeImpl extends SimpleTypeImpl implements XSUnionSimpleType
|
||||
{
|
||||
public UnionSimpleTypeImpl( SchemaDocumentImpl _parent,
|
||||
AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
|
||||
String _name, boolean _anonymous, Set<XSVariety> finalSet,
|
||||
Ref.SimpleType[] _members ) {
|
||||
|
||||
super(_parent,_annon,_loc,_fa,_name,_anonymous, finalSet,
|
||||
_parent.getSchema().parent.anySimpleType);
|
||||
|
||||
this.memberTypes = _members;
|
||||
}
|
||||
|
||||
private final Ref.SimpleType[] memberTypes;
|
||||
public XSSimpleType getMember( int idx ) { return memberTypes[idx].getType(); }
|
||||
public int getMemberSize() { return memberTypes.length; }
|
||||
|
||||
public Iterator<XSSimpleType> iterator() {
|
||||
return new Iterator<XSSimpleType>() {
|
||||
int idx=0;
|
||||
public boolean hasNext() {
|
||||
return idx<memberTypes.length;
|
||||
}
|
||||
|
||||
public XSSimpleType next() {
|
||||
return memberTypes[idx++].getType();
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void visit( XSSimpleTypeVisitor visitor ) {
|
||||
visitor.unionSimpleType(this);
|
||||
}
|
||||
public Object apply( XSSimpleTypeFunction function ) {
|
||||
return function.unionSimpleType(this);
|
||||
}
|
||||
|
||||
public XSUnionSimpleType getBaseUnionType() {
|
||||
return this;
|
||||
}
|
||||
|
||||
// union type by itself doesn't have any facet. */
|
||||
public XSFacet getFacet( String name ) { return null; }
|
||||
public List<XSFacet> getFacets( String name ) { return Collections.EMPTY_LIST; }
|
||||
|
||||
public XSVariety getVariety() { return XSVariety.UNION; }
|
||||
|
||||
public XSSimpleType getPrimitiveType() { return null; }
|
||||
|
||||
public boolean isUnion() { return true; }
|
||||
public XSUnionSimpleType asUnion() { return this; }
|
||||
}
|
||||
100
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/Util.java
Normal file
100
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/Util.java
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSComplexType;
|
||||
import com.sun.xml.internal.xsom.XSType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
class Util {
|
||||
private static XSType[] listDirectSubstitutables( XSType _this ) {
|
||||
ArrayList r = new ArrayList();
|
||||
|
||||
// TODO: handle @block
|
||||
Iterator itr = ((SchemaImpl)_this.getOwnerSchema()).parent.iterateTypes();
|
||||
while( itr.hasNext() ) {
|
||||
XSType t = (XSType)itr.next();
|
||||
if( t.getBaseType()==_this )
|
||||
r.add(t);
|
||||
}
|
||||
return (XSType[]) r.toArray(new XSType[r.size()]);
|
||||
}
|
||||
|
||||
public static XSType[] listSubstitutables( XSType _this ) {
|
||||
Set substitables = new HashSet();
|
||||
buildSubstitutables( _this, substitables );
|
||||
return (XSType[]) substitables.toArray(new XSType[substitables.size()]);
|
||||
}
|
||||
|
||||
public static void buildSubstitutables( XSType _this, Set substitutables ) {
|
||||
if( _this.isLocal() ) return;
|
||||
buildSubstitutables( _this, _this, substitutables );
|
||||
}
|
||||
|
||||
private static void buildSubstitutables( XSType head, XSType _this, Set substitutables ) {
|
||||
if(!isSubstitutable(head,_this))
|
||||
return; // no derived type of _this can substitute head.
|
||||
|
||||
if(substitutables.add(_this)) {
|
||||
XSType[] child = listDirectSubstitutables(_this);
|
||||
for( int i=0; i<child.length; i++ )
|
||||
buildSubstitutables( head, child[i], substitutables );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements
|
||||
* <code>Validation Rule: Schema-Validity Assessment (Element) 1.2.1.2.4</code>
|
||||
*/
|
||||
private static boolean isSubstitutable( XSType _base, XSType derived ) {
|
||||
// too ugly to the point that it's almost unbearable.
|
||||
// I mean, it's not even transitive. Thus we end up calling this method
|
||||
// for each candidate
|
||||
if( _base.isComplexType() ) {
|
||||
XSComplexType base = _base.asComplexType();
|
||||
|
||||
for( ; base!=derived; derived=derived.getBaseType() ) {
|
||||
if( base.isSubstitutionProhibited( derived.getDerivationMethod() ) )
|
||||
return false; // Type Derivation OK (Complex)-1
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// simple type don't have any @block
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
199
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/WildcardImpl.java
Normal file
199
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/WildcardImpl.java
Normal file
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSElementDecl;
|
||||
import com.sun.xml.internal.xsom.XSModelGroup;
|
||||
import com.sun.xml.internal.xsom.XSModelGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSTerm;
|
||||
import com.sun.xml.internal.xsom.XSWildcard;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermFunctionWithParam;
|
||||
import com.sun.xml.internal.xsom.visitor.XSTermVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import com.sun.xml.internal.xsom.visitor.XSWildcardFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSWildcardVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class WildcardImpl extends ComponentImpl implements XSWildcard, Ref.Term
|
||||
{
|
||||
protected WildcardImpl( SchemaDocumentImpl owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa, int _mode ) {
|
||||
super(owner,_annon,_loc,_fa);
|
||||
this.mode = _mode;
|
||||
}
|
||||
|
||||
private final int mode;
|
||||
public int getMode() { return mode; }
|
||||
|
||||
// compute the union
|
||||
public WildcardImpl union( SchemaDocumentImpl owner, WildcardImpl rhs ) {
|
||||
if(this instanceof Any || rhs instanceof Any)
|
||||
return new Any(owner,null,null,null,mode);
|
||||
|
||||
if(this instanceof Finite && rhs instanceof Finite) {
|
||||
Set<String> values = new HashSet<String>();
|
||||
values.addAll( ((Finite)this).names );
|
||||
values.addAll( ((Finite)rhs ).names );
|
||||
return new Finite(owner,null,null,null,values,mode);
|
||||
}
|
||||
|
||||
if(this instanceof Other && rhs instanceof Other) {
|
||||
if( ((Other)this).otherNamespace.equals(
|
||||
((Other)rhs).otherNamespace) )
|
||||
return new Other(owner,null,null,null, ((Other)this).otherNamespace, mode );
|
||||
else
|
||||
// this somewhat strange rule is indeed in the spec
|
||||
return new Other(owner,null,null,null, "", mode );
|
||||
}
|
||||
|
||||
Other o;
|
||||
Finite f;
|
||||
|
||||
if( this instanceof Other ) {
|
||||
o=(Other)this; f=(Finite)rhs;
|
||||
} else {
|
||||
o=(Other)rhs; f=(Finite)this;
|
||||
}
|
||||
|
||||
if(f.names.contains(o.otherNamespace))
|
||||
return new Any(owner,null,null,null,mode);
|
||||
else
|
||||
return new Other(owner,null,null,null,o.otherNamespace,mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public final static class Any extends WildcardImpl implements XSWildcard.Any {
|
||||
public Any( SchemaDocumentImpl owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa, int _mode ) {
|
||||
super(owner,_annon,_loc,_fa,_mode);
|
||||
}
|
||||
|
||||
public boolean acceptsNamespace( String namespaceURI ) {
|
||||
return true;
|
||||
}
|
||||
public void visit( XSWildcardVisitor visitor ) {
|
||||
visitor.any(this);
|
||||
}
|
||||
public Object apply( XSWildcardFunction function ) {
|
||||
return function.any(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final static class Other extends WildcardImpl implements XSWildcard.Other {
|
||||
public Other( SchemaDocumentImpl owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
|
||||
String otherNamespace, int _mode ) {
|
||||
super(owner,_annon,_loc,_fa,_mode);
|
||||
this.otherNamespace = otherNamespace;
|
||||
}
|
||||
|
||||
private final String otherNamespace;
|
||||
|
||||
public String getOtherNamespace() { return otherNamespace; }
|
||||
|
||||
public boolean acceptsNamespace( String namespaceURI ) {
|
||||
return !namespaceURI.equals(otherNamespace);
|
||||
}
|
||||
|
||||
public void visit( XSWildcardVisitor visitor ) {
|
||||
visitor.other(this);
|
||||
}
|
||||
public Object apply( XSWildcardFunction function ) {
|
||||
return function.other(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final static class Finite extends WildcardImpl implements XSWildcard.Union {
|
||||
public Finite( SchemaDocumentImpl owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
|
||||
Set<String> ns, int _mode ) {
|
||||
super(owner,_annon,_loc,_fa,_mode);
|
||||
names = ns;
|
||||
namesView = Collections.unmodifiableSet(names);
|
||||
}
|
||||
|
||||
private final Set<String> names;
|
||||
private final Set<String> namesView;
|
||||
|
||||
public Iterator<String> iterateNamespaces() {
|
||||
return names.iterator();
|
||||
}
|
||||
|
||||
public Collection<String> getNamespaces() {
|
||||
return namesView;
|
||||
}
|
||||
|
||||
public boolean acceptsNamespace( String namespaceURI ) {
|
||||
return names.contains(namespaceURI);
|
||||
}
|
||||
|
||||
public void visit( XSWildcardVisitor visitor ) {
|
||||
visitor.union(this);
|
||||
}
|
||||
public Object apply( XSWildcardFunction function ) {
|
||||
return function.union(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final void visit( XSVisitor visitor ) {
|
||||
visitor.wildcard(this);
|
||||
}
|
||||
public final void visit( XSTermVisitor visitor ) {
|
||||
visitor.wildcard(this);
|
||||
}
|
||||
public Object apply( XSTermFunction function ) {
|
||||
return function.wildcard(this);
|
||||
}
|
||||
|
||||
public <T,P> T apply(XSTermFunctionWithParam<T, P> function, P param) {
|
||||
return function.wildcard(this,param);
|
||||
}
|
||||
|
||||
public Object apply( XSFunction function ) {
|
||||
return function.wildcard(this);
|
||||
}
|
||||
|
||||
|
||||
public boolean isWildcard() { return true; }
|
||||
public boolean isModelGroupDecl() { return false; }
|
||||
public boolean isModelGroup() { return false; }
|
||||
public boolean isElementDecl() { return false; }
|
||||
|
||||
public XSWildcard asWildcard() { return this; }
|
||||
public XSModelGroupDecl asModelGroupDecl() { return null; }
|
||||
public XSModelGroup asModelGroup() { return null; }
|
||||
public XSElementDecl asElementDecl() { return null; }
|
||||
|
||||
|
||||
// Ref.Term implementation
|
||||
public XSTerm getTerm() { return this; }
|
||||
}
|
||||
67
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/XPathImpl.java
Normal file
67
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/XPathImpl.java
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSIdentityConstraint;
|
||||
import com.sun.xml.internal.xsom.XSXPath;
|
||||
import com.sun.xml.internal.xsom.XmlString;
|
||||
import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
|
||||
import com.sun.xml.internal.xsom.visitor.XSFunction;
|
||||
import com.sun.xml.internal.xsom.visitor.XSVisitor;
|
||||
import org.xml.sax.Locator;
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class XPathImpl extends ComponentImpl implements XSXPath {
|
||||
private XSIdentityConstraint parent;
|
||||
private final XmlString xpath;
|
||||
|
||||
public XPathImpl(SchemaDocumentImpl _owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl fa, XmlString xpath) {
|
||||
super(_owner, _annon, _loc, fa);
|
||||
this.xpath = xpath;
|
||||
}
|
||||
|
||||
public void setParent(XSIdentityConstraint parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public XSIdentityConstraint getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public XmlString getXPath() {
|
||||
return xpath;
|
||||
}
|
||||
|
||||
public void visit(XSVisitor visitor) {
|
||||
visitor.xpath(this);
|
||||
}
|
||||
|
||||
public <T> T apply(XSFunction<T> function) {
|
||||
return function.xpath(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import com.sun.xml.internal.xsom.impl.Ref;
|
||||
import com.sun.xml.internal.xsom.XSContentType;
|
||||
import com.sun.xml.internal.xsom.XSType;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public final class BaseContentRef implements Ref.ContentType, Patch {
|
||||
private final Ref.Type baseType;
|
||||
private final Locator loc;
|
||||
|
||||
public BaseContentRef(final NGCCRuntimeEx $runtime, Ref.Type _baseType) {
|
||||
this.baseType = _baseType;
|
||||
$runtime.addPatcher(this);
|
||||
$runtime.addErrorChecker(new Patch() {
|
||||
public void run() throws SAXException {
|
||||
XSType t = baseType.getType();
|
||||
if (t.isComplexType() && t.asComplexType().getContentType().asParticle()!=null) {
|
||||
$runtime.reportError(
|
||||
Messages.format(Messages.ERR_SIMPLE_CONTENT_EXPECTED,
|
||||
t.getTargetNamespace(), t.getName()), loc);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.loc = $runtime.copyLocator();
|
||||
}
|
||||
|
||||
public XSContentType getContentType() {
|
||||
XSType t = baseType.getType();
|
||||
if(t.asComplexType()!=null)
|
||||
return t.asComplexType().getContentType();
|
||||
else
|
||||
return t.asSimpleType();
|
||||
}
|
||||
|
||||
public void run() throws SAXException {
|
||||
if (baseType instanceof Patch)
|
||||
((Patch) baseType).run();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import com.sun.xml.internal.xsom.parser.AnnotationContext;
|
||||
import com.sun.xml.internal.xsom.parser.AnnotationParser;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
|
||||
/**
|
||||
* AnnotationParser that just ignores annotation.
|
||||
*
|
||||
* <p>
|
||||
* This class doesn't have any state. So it should be used as a singleton.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
class DefaultAnnotationParser extends AnnotationParser {
|
||||
|
||||
private DefaultAnnotationParser() {}
|
||||
|
||||
public static final AnnotationParser theInstance = new DefaultAnnotationParser();
|
||||
|
||||
public ContentHandler getContentHandler(
|
||||
AnnotationContext contest, String elementName,
|
||||
ErrorHandler errorHandler, EntityResolver entityResolver ) {
|
||||
return new DefaultHandler();
|
||||
}
|
||||
|
||||
public Object getResult( Object existing ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSAttGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSAttributeDecl;
|
||||
import com.sun.xml.internal.xsom.XSComplexType;
|
||||
import com.sun.xml.internal.xsom.XSDeclaration;
|
||||
import com.sun.xml.internal.xsom.XSElementDecl;
|
||||
import com.sun.xml.internal.xsom.XSIdentityConstraint;
|
||||
import com.sun.xml.internal.xsom.XSModelGroupDecl;
|
||||
import com.sun.xml.internal.xsom.XSSchemaSet;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.XSTerm;
|
||||
import com.sun.xml.internal.xsom.XSType;
|
||||
import com.sun.xml.internal.xsom.impl.Ref;
|
||||
import com.sun.xml.internal.xsom.impl.SchemaImpl;
|
||||
import com.sun.xml.internal.xsom.impl.UName;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Reference by name.
|
||||
*
|
||||
* UName will be later resolved to a target object,
|
||||
* after all the schemas are parsed.
|
||||
*/
|
||||
public abstract class DelayedRef implements Patch {
|
||||
DelayedRef( PatcherManager _manager, Locator _source, SchemaImpl _schema, UName _name ) {
|
||||
|
||||
this.schema = _schema.getRoot();
|
||||
this.manager = _manager;
|
||||
this.name = _name;
|
||||
this.source = _source;
|
||||
|
||||
if(name==null) throw new InternalError();
|
||||
|
||||
manager.addPatcher(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch implementation. Makes sure that the name resolves
|
||||
* to a schema component.
|
||||
*/
|
||||
public void run() throws SAXException {
|
||||
if(ref==null) // redefinition can set ref without actually resolving the reference
|
||||
resolve();
|
||||
manager = null; // avoid keeping the reference too long
|
||||
name = null;
|
||||
source = null;
|
||||
}
|
||||
|
||||
|
||||
protected final XSSchemaSet schema;
|
||||
private PatcherManager manager;
|
||||
private UName name;
|
||||
/** location in the source file where this reference was made. */
|
||||
private Locator source;
|
||||
|
||||
protected abstract Object resolveReference( UName name );
|
||||
protected abstract String getErrorProperty();
|
||||
|
||||
private Object ref=null;
|
||||
protected final Object _get() {
|
||||
if(ref==null) throw new InternalError("unresolved reference");
|
||||
return ref;
|
||||
}
|
||||
|
||||
private void resolve() throws SAXException {
|
||||
ref = resolveReference(name);
|
||||
if(ref==null)
|
||||
manager.reportError(
|
||||
Messages.format(getErrorProperty(),name.getQualifiedName()),
|
||||
source );
|
||||
}
|
||||
|
||||
/**
|
||||
* If this reference refers to the given declaration,
|
||||
* resolve the reference now. This is used to implement redefinition.
|
||||
*/
|
||||
public void redefine(XSDeclaration d) {
|
||||
if( !d.getTargetNamespace().equals(name.getNamespaceURI())
|
||||
|| !d.getName().equals(name.getName()) )
|
||||
return;
|
||||
|
||||
ref = d;
|
||||
manager = null;
|
||||
name = null;
|
||||
source = null;
|
||||
}
|
||||
|
||||
|
||||
public static class Type extends DelayedRef implements Ref.Type {
|
||||
public Type( PatcherManager manager, Locator loc, SchemaImpl schema, UName name ) {
|
||||
super(manager,loc,schema,name);
|
||||
}
|
||||
protected Object resolveReference( UName name ) {
|
||||
Object o = super.schema.getSimpleType(
|
||||
name.getNamespaceURI(), name.getName() );
|
||||
if(o!=null) return o;
|
||||
|
||||
return super.schema.getComplexType(
|
||||
name.getNamespaceURI(),
|
||||
name.getName());
|
||||
}
|
||||
protected String getErrorProperty() {
|
||||
return Messages.ERR_UNDEFINED_TYPE;
|
||||
}
|
||||
|
||||
public XSType getType() { return (XSType)super._get(); }
|
||||
}
|
||||
|
||||
public static class SimpleType extends DelayedRef implements Ref.SimpleType {
|
||||
public SimpleType( PatcherManager manager, Locator loc, SchemaImpl schema, UName name ) {
|
||||
super(manager,loc,schema,name);
|
||||
}
|
||||
public XSSimpleType getType() { return (XSSimpleType)_get(); }
|
||||
|
||||
protected Object resolveReference( UName name ) {
|
||||
return super.schema.getSimpleType(
|
||||
name.getNamespaceURI(),
|
||||
name.getName());
|
||||
}
|
||||
|
||||
protected String getErrorProperty() {
|
||||
return Messages.ERR_UNDEFINED_SIMPLETYPE;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComplexType extends DelayedRef implements Ref.ComplexType {
|
||||
public ComplexType( PatcherManager manager, Locator loc, SchemaImpl schema, UName name ) {
|
||||
super(manager,loc,schema,name);
|
||||
}
|
||||
protected Object resolveReference( UName name ) {
|
||||
return super.schema.getComplexType(
|
||||
name.getNamespaceURI(),
|
||||
name.getName());
|
||||
}
|
||||
|
||||
protected String getErrorProperty() {
|
||||
return Messages.ERR_UNDEFINED_COMPLEXTYPE;
|
||||
}
|
||||
|
||||
public XSComplexType getType() { return (XSComplexType)super._get(); }
|
||||
}
|
||||
|
||||
public static class Element extends DelayedRef implements Ref.Element {
|
||||
public Element( PatcherManager manager, Locator loc, SchemaImpl schema, UName name ) {
|
||||
super(manager,loc,schema,name);
|
||||
}
|
||||
protected Object resolveReference( UName name ) {
|
||||
return super.schema.getElementDecl(
|
||||
name.getNamespaceURI(),
|
||||
name.getName());
|
||||
}
|
||||
|
||||
protected String getErrorProperty() {
|
||||
return Messages.ERR_UNDEFINED_ELEMENT;
|
||||
}
|
||||
|
||||
public XSElementDecl get() { return (XSElementDecl)super._get(); }
|
||||
public XSTerm getTerm() { return get(); }
|
||||
}
|
||||
|
||||
public static class ModelGroup extends DelayedRef implements Ref.Term {
|
||||
public ModelGroup( PatcherManager manager, Locator loc, SchemaImpl schema, UName name ) {
|
||||
super(manager,loc,schema,name);
|
||||
}
|
||||
protected Object resolveReference( UName name ) {
|
||||
return super.schema.getModelGroupDecl(
|
||||
name.getNamespaceURI(),
|
||||
name.getName());
|
||||
}
|
||||
|
||||
protected String getErrorProperty() {
|
||||
return Messages.ERR_UNDEFINED_MODELGROUP;
|
||||
}
|
||||
|
||||
public XSModelGroupDecl get() { return (XSModelGroupDecl)super._get(); }
|
||||
public XSTerm getTerm() { return get(); }
|
||||
}
|
||||
|
||||
public static class AttGroup extends DelayedRef implements Ref.AttGroup {
|
||||
public AttGroup( PatcherManager manager, Locator loc, SchemaImpl schema, UName name ) {
|
||||
super(manager,loc,schema,name);
|
||||
}
|
||||
protected Object resolveReference( UName name ) {
|
||||
return super.schema.getAttGroupDecl(
|
||||
name.getNamespaceURI(),
|
||||
name.getName());
|
||||
}
|
||||
|
||||
protected String getErrorProperty() {
|
||||
return Messages.ERR_UNDEFINED_ATTRIBUTEGROUP;
|
||||
}
|
||||
|
||||
public XSAttGroupDecl get() { return (XSAttGroupDecl)super._get(); }
|
||||
}
|
||||
|
||||
public static class Attribute extends DelayedRef implements Ref.Attribute {
|
||||
public Attribute( PatcherManager manager, Locator loc, SchemaImpl schema, UName name ) {
|
||||
super(manager,loc,schema,name);
|
||||
}
|
||||
protected Object resolveReference( UName name ) {
|
||||
return super.schema.getAttributeDecl(
|
||||
name.getNamespaceURI(),
|
||||
name.getName());
|
||||
}
|
||||
|
||||
protected String getErrorProperty() {
|
||||
return Messages.ERR_UNDEFINED_ATTRIBUTE;
|
||||
}
|
||||
|
||||
public XSAttributeDecl getAttribute() { return (XSAttributeDecl)super._get(); }
|
||||
}
|
||||
|
||||
public static class IdentityConstraint extends DelayedRef implements Ref.IdentityConstraint {
|
||||
public IdentityConstraint( PatcherManager manager, Locator loc, SchemaImpl schema, UName name ) {
|
||||
super(manager,loc,schema,name);
|
||||
}
|
||||
protected Object resolveReference( UName name ) {
|
||||
return super.schema.getIdentityConstraint(
|
||||
name.getNamespaceURI(),
|
||||
name.getName());
|
||||
}
|
||||
|
||||
protected String getErrorProperty() {
|
||||
return Messages.ERR_UNDEFINED_IDENTITY_CONSTRAINT;
|
||||
}
|
||||
|
||||
public XSIdentityConstraint get() { return (XSIdentityConstraint)super._get(); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Formats error messages.
|
||||
*/
|
||||
public class Messages
|
||||
{
|
||||
/** Loads a string resource and formats it with specified arguments. */
|
||||
public static String format( String property, Object... args ) {
|
||||
String text = ResourceBundle.getBundle(
|
||||
Messages.class.getName()).getString(property);
|
||||
return MessageFormat.format(text,args);
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// Message resources
|
||||
//
|
||||
//
|
||||
public static final String ERR_UNDEFINED_SIMPLETYPE =
|
||||
"UndefinedSimpleType"; // arg:1
|
||||
public static final String ERR_UNDEFINED_COMPLEXTYPE =
|
||||
"UndefinedCompplexType"; // arg:1
|
||||
public static final String ERR_UNDEFINED_TYPE =
|
||||
"UndefinedType"; // arg:1
|
||||
public static final String ERR_UNDEFINED_ELEMENT =
|
||||
"UndefinedElement"; // arg:1
|
||||
public static final String ERR_UNDEFINED_MODELGROUP =
|
||||
"UndefinedModelGroup"; // arg:1
|
||||
public static final String ERR_UNDEFINED_ATTRIBUTE =
|
||||
"UndefinedAttribute"; // arg:1
|
||||
public static final String ERR_UNDEFINED_ATTRIBUTEGROUP =
|
||||
"UndefinedAttributeGroup"; // arg:1
|
||||
public static final String ERR_UNDEFINED_IDENTITY_CONSTRAINT =
|
||||
"UndefinedIdentityConstraint"; // arg:1
|
||||
public static final String ERR_UNDEFINED_PREFIX =
|
||||
"UndefinedPrefix"; // arg:1
|
||||
|
||||
public static final String ERR_DOUBLE_DEFINITION =
|
||||
"DoubleDefinition"; // arg:1
|
||||
public static final String ERR_DOUBLE_DEFINITION_ORIGINAL =
|
||||
"DoubleDefinition.Original"; // arg:0
|
||||
|
||||
public static final String ERR_MISSING_SCHEMALOCATION =
|
||||
"MissingSchemaLocation"; // arg:0
|
||||
|
||||
public static final String ERR_ENTITY_RESOLUTION_FAILURE =
|
||||
"EntityResolutionFailure"; // arg:2
|
||||
|
||||
public static final String ERR_SIMPLE_CONTENT_EXPECTED =
|
||||
"SimpleContentExpected"; // arg:2
|
||||
|
||||
public static final String JAXP_UNSUPPORTED_PROPERTY =
|
||||
"JAXPUnsupportedProperty"; // arg:1
|
||||
|
||||
public static final String JAXP_SUPPORTED_PROPERTY =
|
||||
"JAXPSupportedProperty"; // arg:1
|
||||
}
|
||||
@@ -0,0 +1,516 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSDeclaration;
|
||||
import com.sun.xml.internal.xsom.XmlString;
|
||||
import com.sun.xml.internal.xsom.XSSimpleType;
|
||||
import com.sun.xml.internal.xsom.impl.ForeignAttributesImpl;
|
||||
import com.sun.xml.internal.xsom.impl.SchemaImpl;
|
||||
import com.sun.xml.internal.xsom.impl.UName;
|
||||
import com.sun.xml.internal.xsom.impl.Const;
|
||||
import com.sun.xml.internal.xsom.impl.parser.state.NGCCRuntime;
|
||||
import com.sun.xml.internal.xsom.impl.parser.state.Schema;
|
||||
import com.sun.xml.internal.xsom.impl.util.Uri;
|
||||
import com.sun.xml.internal.xsom.parser.AnnotationParser;
|
||||
import org.relaxng.datatype.ValidationContext;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
import org.xml.sax.helpers.LocatorImpl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Stack;
|
||||
|
||||
/**
|
||||
* NGCCRuntime extended with various utility methods for
|
||||
* parsing XML Schema.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public class NGCCRuntimeEx extends NGCCRuntime implements PatcherManager {
|
||||
|
||||
/** coordinator. */
|
||||
public final ParserContext parser;
|
||||
|
||||
/** The schema currently being parsed. */
|
||||
public SchemaImpl currentSchema;
|
||||
|
||||
/** The @finalDefault value of the current schema. */
|
||||
public int finalDefault = 0;
|
||||
/** The @blockDefault value of the current schema. */
|
||||
public int blockDefault = 0;
|
||||
|
||||
/**
|
||||
* The @elementFormDefault value of the current schema.
|
||||
* True if local elements are qualified by default.
|
||||
*/
|
||||
public boolean elementFormDefault = false;
|
||||
|
||||
/**
|
||||
* The @attributeFormDefault value of the current schema.
|
||||
* True if local attributes are qualified by default.
|
||||
*/
|
||||
public boolean attributeFormDefault = false;
|
||||
|
||||
/**
|
||||
* True if the current schema is in a chameleon mode.
|
||||
* This changes the way QNames are interpreted.
|
||||
*
|
||||
* Life is very miserable with XML Schema, as you see.
|
||||
*/
|
||||
public boolean chameleonMode = false;
|
||||
|
||||
/**
|
||||
* URI that identifies the schema document.
|
||||
* Maybe null if the system ID is not available.
|
||||
*/
|
||||
private String documentSystemId;
|
||||
|
||||
/**
|
||||
* Keep the local name of elements encountered so far.
|
||||
* This information is passed to AnnotationParser as
|
||||
* context information
|
||||
*/
|
||||
private final Stack<String> elementNames = new Stack<String>();
|
||||
|
||||
/**
|
||||
* Points to the schema document (the parser of it) that included/imported
|
||||
* this schema.
|
||||
*/
|
||||
private final NGCCRuntimeEx referer;
|
||||
|
||||
/**
|
||||
* Points to the {@link SchemaDocumentImpl} that represents the
|
||||
* schema document being parsed.
|
||||
*/
|
||||
public SchemaDocumentImpl document;
|
||||
|
||||
NGCCRuntimeEx( ParserContext _parser ) {
|
||||
this(_parser,false,null);
|
||||
}
|
||||
|
||||
private NGCCRuntimeEx( ParserContext _parser, boolean chameleonMode, NGCCRuntimeEx referer ) {
|
||||
this.parser = _parser;
|
||||
this.chameleonMode = chameleonMode;
|
||||
this.referer = referer;
|
||||
|
||||
// set up the default namespace binding
|
||||
currentContext = new Context("","",null);
|
||||
currentContext = new Context("xml","http://www.w3.org/XML/1998/namespace",currentContext);
|
||||
}
|
||||
|
||||
public void checkDoubleDefError( XSDeclaration c ) throws SAXException {
|
||||
if(c==null || ignorableDuplicateComponent(c)) return;
|
||||
|
||||
reportError( Messages.format(Messages.ERR_DOUBLE_DEFINITION,c.getName()) );
|
||||
reportError( Messages.format(Messages.ERR_DOUBLE_DEFINITION_ORIGINAL), c.getLocator() );
|
||||
}
|
||||
|
||||
public static boolean ignorableDuplicateComponent(XSDeclaration c) {
|
||||
if(c.getTargetNamespace().equals(Const.schemaNamespace)) {
|
||||
if(c instanceof XSSimpleType)
|
||||
// hide artificial "double definitions" on simple types
|
||||
return true;
|
||||
if(c.isGlobal() && c.getName().equals("anyType"))
|
||||
return true; // ditto for anyType
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* registers a patcher that will run after all the parsing has finished. */
|
||||
public void addPatcher( Patch patcher ) {
|
||||
parser.patcherManager.addPatcher(patcher);
|
||||
}
|
||||
public void addErrorChecker( Patch patcher ) {
|
||||
parser.patcherManager.addErrorChecker(patcher);
|
||||
}
|
||||
public void reportError( String msg, Locator loc ) throws SAXException {
|
||||
parser.patcherManager.reportError(msg,loc);
|
||||
}
|
||||
public void reportError( String msg ) throws SAXException {
|
||||
reportError(msg,getLocator());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resolves relative URI found in the document.
|
||||
*
|
||||
* @param namespaceURI
|
||||
* passed to the entity resolver.
|
||||
* @param relativeUri
|
||||
* value of the schemaLocation attribute. Can be null.
|
||||
*
|
||||
* @return
|
||||
* non-null if {@link EntityResolver} returned an {@link InputSource},
|
||||
* or if the relativeUri parameter seems to be pointing to something.
|
||||
* Otherwise it returns null, in which case import/include should be abandoned.
|
||||
*/
|
||||
private InputSource resolveRelativeURL( String namespaceURI, String relativeUri ) throws SAXException {
|
||||
try {
|
||||
String baseUri = getLocator().getSystemId();
|
||||
if(baseUri==null)
|
||||
// if the base URI is not available, the document system ID is
|
||||
// better than nothing.
|
||||
baseUri=documentSystemId;
|
||||
|
||||
EntityResolver er = parser.getEntityResolver();
|
||||
String systemId = null;
|
||||
|
||||
if (relativeUri!=null)
|
||||
systemId = Uri.resolve(baseUri,relativeUri);
|
||||
|
||||
if (er!=null) {
|
||||
InputSource is = er.resolveEntity(namespaceURI,systemId);
|
||||
if (is == null) {
|
||||
try {
|
||||
String normalizedSystemId = URI.create(systemId).normalize().toASCIIString();
|
||||
is = er.resolveEntity(namespaceURI,normalizedSystemId);
|
||||
} catch (Exception e) {
|
||||
// just ignore, this is a second try, return the fallback if this breaks
|
||||
}
|
||||
}
|
||||
if (is != null) {
|
||||
return is;
|
||||
}
|
||||
}
|
||||
|
||||
if (systemId!=null)
|
||||
return new InputSource(systemId);
|
||||
else
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
SAXParseException se = new SAXParseException(e.getMessage(),getLocator(),e);
|
||||
parser.errorHandler.error(se);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Includes the specified schema. */
|
||||
public void includeSchema( String schemaLocation ) throws SAXException {
|
||||
NGCCRuntimeEx runtime = new NGCCRuntimeEx(parser,chameleonMode,this);
|
||||
runtime.currentSchema = this.currentSchema;
|
||||
runtime.blockDefault = this.blockDefault;
|
||||
runtime.finalDefault = this.finalDefault;
|
||||
|
||||
if( schemaLocation==null ) {
|
||||
SAXParseException e = new SAXParseException(
|
||||
Messages.format( Messages.ERR_MISSING_SCHEMALOCATION ), getLocator() );
|
||||
parser.errorHandler.fatalError(e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
runtime.parseEntity( resolveRelativeURL(null,schemaLocation),
|
||||
true, currentSchema.getTargetNamespace(), getLocator() );
|
||||
}
|
||||
|
||||
/** Imports the specified schema. */
|
||||
public void importSchema( String ns, String schemaLocation ) throws SAXException {
|
||||
NGCCRuntimeEx newRuntime = new NGCCRuntimeEx(parser,false,this);
|
||||
InputSource source = resolveRelativeURL(ns,schemaLocation);
|
||||
if(source!=null)
|
||||
newRuntime.parseEntity( source, false, ns, getLocator() );
|
||||
// if source == null,
|
||||
// we can't locate this document. Let's just hope that
|
||||
// we already have the schema components for this schema
|
||||
// or we will receive them in the future.
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a new document is being parsed and checks
|
||||
* if the document has already been parsed before.
|
||||
*
|
||||
* <p>
|
||||
* Used to avoid recursive inclusion. Note that the same
|
||||
* document will be parsed multiple times if they are for different
|
||||
* target namespaces.
|
||||
*
|
||||
* <h2>Document Graph Model</h2>
|
||||
* <p>
|
||||
* The challenge we are facing here is that you have a graph of
|
||||
* documents that reference each other. Each document has an unique
|
||||
* URI to identify themselves, and references are done by using those.
|
||||
* The graph may contain cycles.
|
||||
*
|
||||
* <p>
|
||||
* Our goal here is to parse all the documents in the graph, without
|
||||
* parsing the same document twice. This method implements this check.
|
||||
*
|
||||
* <p>
|
||||
* One complication is the chameleon schema; a document can be parsed
|
||||
* multiple times if they are under different target namespaces.
|
||||
*
|
||||
* <p>
|
||||
* Also, note that when you resolve relative URIs in the @schemaLocation,
|
||||
* their base URI is *NOT* the URI of the document.
|
||||
*
|
||||
* @return true if the document has already been processed and thus
|
||||
* needs to be skipped.
|
||||
*/
|
||||
public boolean hasAlreadyBeenRead() {
|
||||
if( documentSystemId!=null ) {
|
||||
if( documentSystemId.startsWith("file:///") )
|
||||
// change file:///abc to file:/abc
|
||||
// JDK File.toURL method produces the latter, but according to RFC
|
||||
// I don't think that's a valid URL. Since two different ways of
|
||||
// producing URLs could produce those two different forms,
|
||||
// we need to canonicalize one to the other.
|
||||
documentSystemId = "file:/"+documentSystemId.substring(8);
|
||||
} else {
|
||||
// if the system Id is not provided, we can't test the identity,
|
||||
// so we have no choice but to read it.
|
||||
// the newly created SchemaDocumentImpl will be unique one
|
||||
}
|
||||
|
||||
assert document ==null;
|
||||
document = new SchemaDocumentImpl( currentSchema, documentSystemId );
|
||||
|
||||
SchemaDocumentImpl existing = parser.parsedDocuments.get(document);
|
||||
if(existing==null) {
|
||||
parser.parsedDocuments.put(document,document);
|
||||
} else {
|
||||
document = existing;
|
||||
}
|
||||
|
||||
assert document !=null;
|
||||
|
||||
if(referer!=null) {
|
||||
assert referer.document !=null : "referer "+referer.documentSystemId+" has docIdentity==null";
|
||||
referer.document.references.add(this.document);
|
||||
this.document.referers.add(referer.document);
|
||||
}
|
||||
|
||||
return existing!=null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the specified entity.
|
||||
*
|
||||
* @param importLocation
|
||||
* The source location of the import/include statement.
|
||||
* Used for reporting errors.
|
||||
*/
|
||||
public void parseEntity( InputSource source, boolean includeMode, String expectedNamespace, Locator importLocation )
|
||||
throws SAXException {
|
||||
|
||||
documentSystemId = source.getSystemId();
|
||||
try {
|
||||
Schema s = new Schema(this,includeMode,expectedNamespace);
|
||||
setRootHandler(s);
|
||||
try {
|
||||
parser.parser.parse(source,this, getErrorHandler(), parser.getEntityResolver());
|
||||
} catch( IOException fnfe ) {
|
||||
SAXParseException se = new SAXParseException(fnfe.toString(), importLocation, fnfe);
|
||||
parser.errorHandler.warning(se);
|
||||
}
|
||||
} catch( SAXException e ) {
|
||||
parser.setErrorFlag();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of annotation parser.
|
||||
*/
|
||||
public AnnotationParser createAnnotationParser() {
|
||||
if(parser.getAnnotationParserFactory()==null)
|
||||
return DefaultAnnotationParser.theInstance;
|
||||
else
|
||||
return parser.getAnnotationParserFactory().create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the element name that contains the annotation element.
|
||||
* This method works correctly only when called by the annotation handler.
|
||||
*/
|
||||
public String getAnnotationContextElementName() {
|
||||
return elementNames.get( elementNames.size()-2 );
|
||||
}
|
||||
|
||||
/** Creates a copy of the current locator object. */
|
||||
public Locator copyLocator() {
|
||||
return new LocatorImpl(getLocator());
|
||||
}
|
||||
|
||||
public ErrorHandler getErrorHandler() {
|
||||
return parser.errorHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnterElementConsumed(String uri, String localName, String qname, Attributes atts)
|
||||
throws SAXException {
|
||||
super.onEnterElementConsumed(uri, localName, qname, atts);
|
||||
elementNames.push(localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeaveElementConsumed(String uri, String localName, String qname) throws SAXException {
|
||||
super.onLeaveElementConsumed(uri, localName, qname);
|
||||
elementNames.pop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// ValidationContext implementation
|
||||
//
|
||||
//
|
||||
// this object lives longer than the parser itself,
|
||||
// so it's important for this object not to have any reference
|
||||
// to the parser.
|
||||
private static class Context implements ValidationContext {
|
||||
Context( String _prefix, String _uri, Context _context ) {
|
||||
this.previous = _context;
|
||||
this.prefix = _prefix;
|
||||
this.uri = _uri;
|
||||
}
|
||||
|
||||
public String resolveNamespacePrefix(String p) {
|
||||
if(p.equals(prefix)) return uri;
|
||||
if(previous==null) return null;
|
||||
else return previous.resolveNamespacePrefix(p);
|
||||
}
|
||||
|
||||
private final String prefix;
|
||||
private final String uri;
|
||||
private final Context previous;
|
||||
|
||||
// XSDLib don't use those methods, so we cut a corner here.
|
||||
public String getBaseUri() { return null; }
|
||||
public boolean isNotation(String arg0) { return false; }
|
||||
public boolean isUnparsedEntity(String arg0) { return false; }
|
||||
}
|
||||
|
||||
private Context currentContext=null;
|
||||
|
||||
/** Returns an immutable snapshot of the current context. */
|
||||
public ValidationContext createValidationContext() {
|
||||
return currentContext;
|
||||
}
|
||||
|
||||
public XmlString createXmlString(String value) {
|
||||
if(value==null) return null;
|
||||
else return new XmlString(value,createValidationContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startPrefixMapping( String prefix, String uri ) throws SAXException {
|
||||
super.startPrefixMapping(prefix,uri);
|
||||
currentContext = new Context(prefix,uri,currentContext);
|
||||
}
|
||||
@Override
|
||||
public void endPrefixMapping( String prefix ) throws SAXException {
|
||||
super.endPrefixMapping(prefix);
|
||||
currentContext = currentContext.previous;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// Utility functions
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
/** Parses UName under the given context. */
|
||||
public UName parseUName( String qname ) throws SAXException {
|
||||
int idx = qname.indexOf(':');
|
||||
if(idx<0) {
|
||||
String uri = resolveNamespacePrefix("");
|
||||
|
||||
// chamelon behavior. ugly...
|
||||
if( uri.equals("") && chameleonMode )
|
||||
uri = currentSchema.getTargetNamespace();
|
||||
|
||||
// this is guaranteed to resolve
|
||||
return new UName(uri,qname,qname);
|
||||
} else {
|
||||
String prefix = qname.substring(0,idx);
|
||||
String uri = currentContext.resolveNamespacePrefix(prefix);
|
||||
if(uri==null) {
|
||||
// prefix failed to resolve.
|
||||
reportError(Messages.format(
|
||||
Messages.ERR_UNDEFINED_PREFIX,prefix));
|
||||
uri="undefined"; // replace with a dummy
|
||||
}
|
||||
return new UName( uri, qname.substring(idx+1), qname );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean parseBoolean(String v) {
|
||||
if(v==null) return false;
|
||||
v=v.trim();
|
||||
return v.equals("true") || v.equals("1");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void unexpectedX(String token) throws SAXException {
|
||||
SAXParseException e = new SAXParseException(MessageFormat.format(
|
||||
"Unexpected {0} appears at line {1} column {2}",
|
||||
token,
|
||||
getLocator().getLineNumber(),
|
||||
getLocator().getColumnNumber()),
|
||||
getLocator());
|
||||
|
||||
parser.errorHandler.fatalError(e);
|
||||
throw e; // we will abort anyway
|
||||
}
|
||||
|
||||
public ForeignAttributesImpl parseForeignAttributes( ForeignAttributesImpl next ) {
|
||||
ForeignAttributesImpl impl = new ForeignAttributesImpl(createValidationContext(),copyLocator(),next);
|
||||
|
||||
Attributes atts = getCurrentAttributes();
|
||||
for( int i=0; i<atts.getLength(); i++ ) {
|
||||
if(atts.getURI(i).length()>0) {
|
||||
impl.addAttribute(
|
||||
atts.getURI(i),
|
||||
atts.getLocalName(i),
|
||||
atts.getQName(i),
|
||||
atts.getType(i),
|
||||
atts.getValue(i)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
||||
|
||||
public static final String XMLSchemaNSURI = "http://www.w3.org/2001/XMLSchema";
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSSchemaSet;
|
||||
import com.sun.xml.internal.xsom.impl.ElementDecl;
|
||||
import com.sun.xml.internal.xsom.impl.SchemaImpl;
|
||||
import com.sun.xml.internal.xsom.impl.SchemaSetImpl;
|
||||
import com.sun.xml.internal.xsom.parser.AnnotationParserFactory;
|
||||
import com.sun.xml.internal.xsom.parser.XMLParser;
|
||||
import com.sun.xml.internal.xsom.parser.XSOMParser;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Provides context information to be used by {@link NGCCRuntimeEx}s.
|
||||
*
|
||||
* <p>
|
||||
* This class does the actual processing for {@link XSOMParser},
|
||||
* but to hide the details from the public API, this class in
|
||||
* a different package.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public class ParserContext {
|
||||
|
||||
/** SchemaSet to which a newly parsed schema is put in. */
|
||||
public final SchemaSetImpl schemaSet = new SchemaSetImpl();
|
||||
|
||||
private final XSOMParser owner;
|
||||
|
||||
final XMLParser parser;
|
||||
|
||||
|
||||
private final Vector<Patch> patchers = new Vector<Patch>();
|
||||
private final Vector<Patch> errorCheckers = new Vector<Patch>();
|
||||
|
||||
/**
|
||||
* Documents that are parsed already. Used to avoid cyclic inclusion/double
|
||||
* inclusion of schemas. Set of {@link SchemaDocumentImpl}s.
|
||||
*
|
||||
* The actual data structure is map from {@link SchemaDocumentImpl} to itself,
|
||||
* so that we can access the {@link SchemaDocumentImpl} itself.
|
||||
*/
|
||||
public final Map<SchemaDocumentImpl, SchemaDocumentImpl> parsedDocuments = new HashMap<SchemaDocumentImpl, SchemaDocumentImpl>();
|
||||
|
||||
|
||||
public ParserContext( XSOMParser owner, XMLParser parser ) {
|
||||
this.owner = owner;
|
||||
this.parser = parser;
|
||||
|
||||
try {
|
||||
parse(new InputSource(ParserContext.class.getResource("datatypes.xsd").toExternalForm()));
|
||||
|
||||
SchemaImpl xs = (SchemaImpl)
|
||||
schemaSet.getSchema("http://www.w3.org/2001/XMLSchema");
|
||||
xs.addSimpleType(schemaSet.anySimpleType,true);
|
||||
xs.addComplexType(schemaSet.anyType,true);
|
||||
} catch( SAXException e ) {
|
||||
// this must be a bug of XSOM
|
||||
if(e.getException()!=null)
|
||||
e.getException().printStackTrace();
|
||||
else
|
||||
e.printStackTrace();
|
||||
throw new InternalError();
|
||||
}
|
||||
}
|
||||
|
||||
public EntityResolver getEntityResolver() {
|
||||
return owner.getEntityResolver();
|
||||
}
|
||||
|
||||
public AnnotationParserFactory getAnnotationParserFactory() {
|
||||
return owner.getAnnotationParserFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a new XML Schema document.
|
||||
*/
|
||||
public void parse( InputSource source ) throws SAXException {
|
||||
newNGCCRuntime().parseEntity(source,false,null,null);
|
||||
}
|
||||
|
||||
|
||||
public XSSchemaSet getResult() throws SAXException {
|
||||
// run all the patchers
|
||||
for (Patch patcher : patchers)
|
||||
patcher.run();
|
||||
patchers.clear();
|
||||
|
||||
// build the element substitutability map
|
||||
Iterator itr = schemaSet.iterateElementDecls();
|
||||
while(itr.hasNext())
|
||||
((ElementDecl)itr.next()).updateSubstitutabilityMap();
|
||||
|
||||
// run all the error checkers
|
||||
for (Patch patcher : errorCheckers)
|
||||
patcher.run();
|
||||
errorCheckers.clear();
|
||||
|
||||
|
||||
if(hadError) return null;
|
||||
else return schemaSet;
|
||||
}
|
||||
|
||||
public NGCCRuntimeEx newNGCCRuntime() {
|
||||
return new NGCCRuntimeEx(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Once an error is detected, this flag is set to true. */
|
||||
private boolean hadError = false;
|
||||
|
||||
/** Turns on the error flag. */
|
||||
void setErrorFlag() { hadError=true; }
|
||||
|
||||
/**
|
||||
* PatchManager implementation, which is accessible only from
|
||||
* NGCCRuntimEx.
|
||||
*/
|
||||
final PatcherManager patcherManager = new PatcherManager() {
|
||||
public void addPatcher( Patch patch ) {
|
||||
patchers.add(patch);
|
||||
}
|
||||
public void addErrorChecker( Patch patch ) {
|
||||
errorCheckers.add(patch);
|
||||
}
|
||||
public void reportError( String msg, Locator src ) throws SAXException {
|
||||
// set a flag to true to avoid returning a corrupted object.
|
||||
setErrorFlag();
|
||||
|
||||
SAXParseException e = new SAXParseException(msg,src);
|
||||
if(errorHandler==null)
|
||||
throw e;
|
||||
else
|
||||
errorHandler.error(e);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ErrorHandler proxy to turn on the hadError flag when an error
|
||||
* is found.
|
||||
*/
|
||||
final ErrorHandler errorHandler = new ErrorHandler() {
|
||||
private ErrorHandler getErrorHandler() {
|
||||
if( owner.getErrorHandler()==null )
|
||||
return noopHandler;
|
||||
else
|
||||
return owner.getErrorHandler();
|
||||
}
|
||||
|
||||
public void warning(SAXParseException e) throws SAXException {
|
||||
getErrorHandler().warning(e);
|
||||
}
|
||||
|
||||
public void error(SAXParseException e) throws SAXException {
|
||||
setErrorFlag();
|
||||
getErrorHandler().error(e);
|
||||
}
|
||||
|
||||
public void fatalError(SAXParseException e) throws SAXException {
|
||||
setErrorFlag();
|
||||
getErrorHandler().fatalError(e);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* {@link ErrorHandler} that does nothing.
|
||||
*/
|
||||
final ErrorHandler noopHandler = new ErrorHandler() {
|
||||
public void warning(SAXParseException e) {
|
||||
}
|
||||
public void error(SAXParseException e) {
|
||||
}
|
||||
public void fatalError(SAXParseException e) {
|
||||
setErrorFlag();
|
||||
}
|
||||
};
|
||||
}
|
||||
38
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/parser/Patch.java
Normal file
38
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/parser/Patch.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Patch program that runs later to "fix" references among components.
|
||||
*
|
||||
* The only difference from the Runnable interface is that this interface
|
||||
* allows the program to throw a SAXException.
|
||||
*/
|
||||
public interface Patch {
|
||||
void run() throws SAXException;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Manages patchers.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kk@kohsuke.org)
|
||||
*/
|
||||
public interface PatcherManager {
|
||||
void addPatcher( Patch p );
|
||||
void addErrorChecker( Patch p );
|
||||
/**
|
||||
* Reports an error during the parsing.
|
||||
*
|
||||
* @param source
|
||||
* location of the error in the source file, or null if
|
||||
* it's unavailable.
|
||||
*/
|
||||
void reportError( String message, Locator source ) throws SAXException;
|
||||
|
||||
|
||||
public interface Patcher {
|
||||
void run() throws SAXException;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import com.sun.xml.internal.xsom.parser.XMLParser;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.XMLFilterImpl;
|
||||
import org.xml.sax.helpers.XMLReaderAdapter;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
/**
|
||||
* {@link SAXParserFactory} implementation that ultimately
|
||||
* uses {@link XMLParser} to parse documents.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public class SAXParserFactoryAdaptor extends SAXParserFactory {
|
||||
|
||||
private final XMLParser parser;
|
||||
|
||||
public SAXParserFactoryAdaptor( XMLParser _parser ) {
|
||||
this.parser = _parser;
|
||||
}
|
||||
|
||||
public SAXParser newSAXParser() throws ParserConfigurationException, SAXException {
|
||||
return new SAXParserImpl();
|
||||
}
|
||||
|
||||
public void setFeature(String name, boolean value) {
|
||||
throw new UnsupportedOperationException("XSOM parser does not support JAXP features.");
|
||||
}
|
||||
|
||||
public boolean getFeature(String name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private class SAXParserImpl extends SAXParser
|
||||
{
|
||||
private final XMLReaderImpl reader = new XMLReaderImpl();
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public org.xml.sax.Parser getParser() throws SAXException {
|
||||
return new XMLReaderAdapter(reader);
|
||||
}
|
||||
|
||||
public XMLReader getXMLReader() throws SAXException {
|
||||
return reader;
|
||||
}
|
||||
|
||||
public boolean isNamespaceAware() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isValidating() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setProperty(String name, Object value) {
|
||||
}
|
||||
|
||||
public Object getProperty(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class XMLReaderImpl extends XMLFilterImpl
|
||||
{
|
||||
public void parse(InputSource input) throws IOException, SAXException {
|
||||
parser.parse(input,this,this,this);
|
||||
}
|
||||
|
||||
public void parse(String systemId) throws IOException, SAXException {
|
||||
parser.parse(new InputSource(systemId),this,this,this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import com.sun.xml.internal.xsom.impl.SchemaImpl;
|
||||
import com.sun.xml.internal.xsom.parser.SchemaDocument;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* {@link SchemaDocument} implementation.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public final class SchemaDocumentImpl implements SchemaDocument
|
||||
{
|
||||
private final SchemaImpl schema;
|
||||
|
||||
/**
|
||||
* URI of the schema document to be parsed. Can be null.
|
||||
*/
|
||||
private final String schemaDocumentURI;
|
||||
|
||||
/**
|
||||
* {@link SchemaDocumentImpl}s that are referenced from this document.
|
||||
*/
|
||||
final Set<SchemaDocumentImpl> references = new HashSet<SchemaDocumentImpl>();
|
||||
|
||||
/**
|
||||
* {@link SchemaDocumentImpl}s that are referencing this document.
|
||||
*/
|
||||
final Set<SchemaDocumentImpl> referers = new HashSet<SchemaDocumentImpl>();
|
||||
|
||||
protected SchemaDocumentImpl(SchemaImpl schema, String _schemaDocumentURI) {
|
||||
this.schema = schema;
|
||||
this.schemaDocumentURI = _schemaDocumentURI;
|
||||
}
|
||||
|
||||
public String getSystemId() {
|
||||
return schemaDocumentURI;
|
||||
}
|
||||
|
||||
public String getTargetNamespace() {
|
||||
return schema.getTargetNamespace();
|
||||
}
|
||||
|
||||
public SchemaImpl getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
public Set<SchemaDocument> getReferencedDocuments() {
|
||||
return Collections.<SchemaDocument>unmodifiableSet(references);
|
||||
}
|
||||
|
||||
public Set<SchemaDocument> getIncludedDocuments() {
|
||||
return getImportedDocuments(this.getTargetNamespace());
|
||||
}
|
||||
|
||||
public Set<SchemaDocument> getImportedDocuments(String targetNamespace) {
|
||||
if(targetNamespace==null)
|
||||
throw new IllegalArgumentException();
|
||||
Set<SchemaDocument> r = new HashSet<SchemaDocument>();
|
||||
for (SchemaDocumentImpl doc : references) {
|
||||
if(doc.getTargetNamespace().equals(targetNamespace))
|
||||
r.add(doc);
|
||||
}
|
||||
return Collections.unmodifiableSet(r);
|
||||
}
|
||||
|
||||
public boolean includes(SchemaDocument doc) {
|
||||
if(!references.contains(doc))
|
||||
return false;
|
||||
return doc.getSchema()==schema;
|
||||
}
|
||||
|
||||
public boolean imports(SchemaDocument doc) {
|
||||
if(!references.contains(doc))
|
||||
return false;
|
||||
return doc.getSchema()!=schema;
|
||||
}
|
||||
|
||||
public Set<SchemaDocument> getReferers() {
|
||||
return Collections.<SchemaDocument>unmodifiableSet(referers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
SchemaDocumentImpl rhs = (SchemaDocumentImpl) o;
|
||||
|
||||
if( this.schemaDocumentURI==null || rhs.schemaDocumentURI==null)
|
||||
return this==rhs;
|
||||
if(!schemaDocumentURI.equals(rhs.schemaDocumentURI) )
|
||||
return false;
|
||||
return this.schema==rhs.schema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (schemaDocumentURI==null)
|
||||
return super.hashCode();
|
||||
if (schema == null) {
|
||||
return schemaDocumentURI.hashCode();
|
||||
}
|
||||
return schemaDocumentURI.hashCode()^this.schema.hashCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser;
|
||||
|
||||
import com.sun.xml.internal.xsom.XSType;
|
||||
import com.sun.xml.internal.xsom.impl.Ref;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author
|
||||
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
|
||||
*/
|
||||
public class SubstGroupBaseTypeRef implements Ref.Type {
|
||||
private final Ref.Element e;
|
||||
|
||||
public SubstGroupBaseTypeRef( Ref.Element _e ) {
|
||||
this.e = _e;
|
||||
}
|
||||
|
||||
public XSType getType() {
|
||||
return e.get().getType();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,626 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
// AttributesImpl.java - default implementation of Attributes.
|
||||
// Written by David Megginson, sax@megginson.com
|
||||
// NO WARRANTY! This class is in the public domain.
|
||||
|
||||
// $Id: AttributesImpl.java,v 1.4 2002/09/29 02:55:48 okajima Exp $
|
||||
|
||||
//fixed bug at removeAttribute!! by Daisuke OKAJIMA 2002.4.21
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
|
||||
/**
|
||||
* Default implementation of the Attributes interface.
|
||||
*
|
||||
* <blockquote>
|
||||
* <em>This module, both source code and documentation, is in the
|
||||
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
|
||||
* </blockquote>
|
||||
*
|
||||
* <p>This class provides a default implementation of the SAX2
|
||||
* {@link org.xml.sax.Attributes Attributes} interface, with the
|
||||
* addition of manipulators so that the list can be modified or
|
||||
* reused.</p>
|
||||
*
|
||||
* <p>There are two typical uses of this class:</p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>to take a persistent snapshot of an Attributes object
|
||||
* in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or</li>
|
||||
* <li>to construct or modify an Attributes object in a SAX2 driver or filter.</li>
|
||||
* </ol>
|
||||
*
|
||||
* <p>This class replaces the now-deprecated SAX1 {@link
|
||||
* org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
|
||||
* class; in addition to supporting the updated Attributes
|
||||
* interface rather than the deprecated {@link org.xml.sax.AttributeList
|
||||
* AttributeList} interface, it also includes a much more efficient
|
||||
* implementation using a single array rather than a set of Vectors.</p>
|
||||
*
|
||||
* @since SAX 2.0
|
||||
* @author David Megginson,
|
||||
* <a href="mailto:sax@megginson.com">sax@megginson.com</a>
|
||||
* @version 2.0
|
||||
*/
|
||||
public class AttributesImpl implements Attributes
|
||||
{
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Constructors.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new, empty AttributesImpl object.
|
||||
*/
|
||||
public AttributesImpl ()
|
||||
{
|
||||
length = 0;
|
||||
data = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy an existing Attributes object.
|
||||
*
|
||||
* <p>This constructor is especially useful inside a
|
||||
* {@link org.xml.sax.ContentHandler#startElement startElement} event.</p>
|
||||
*
|
||||
* @param atts The existing Attributes object.
|
||||
*/
|
||||
public AttributesImpl (Attributes atts)
|
||||
{
|
||||
setAttributes(atts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Implementation of org.xml.sax.Attributes.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of attributes in the list.
|
||||
*
|
||||
* @return The number of attributes in the list.
|
||||
* @see org.xml.sax.Attributes#getLength
|
||||
*/
|
||||
public int getLength ()
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an attribute's Namespace URI.
|
||||
*
|
||||
* @param index The attribute's index (zero-based).
|
||||
* @return The Namespace URI, the empty string if none is
|
||||
* available, or null if the index is out of range.
|
||||
* @see org.xml.sax.Attributes#getURI
|
||||
*/
|
||||
public String getURI (int index)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
return data[index*5];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an attribute's local name.
|
||||
*
|
||||
* @param index The attribute's index (zero-based).
|
||||
* @return The attribute's local name, the empty string if
|
||||
* none is available, or null if the index if out of range.
|
||||
* @see org.xml.sax.Attributes#getLocalName
|
||||
*/
|
||||
public String getLocalName (int index)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
return data[index*5+1];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an attribute's qualified (prefixed) name.
|
||||
*
|
||||
* @param index The attribute's index (zero-based).
|
||||
* @return The attribute's qualified name, the empty string if
|
||||
* none is available, or null if the index is out of bounds.
|
||||
* @see org.xml.sax.Attributes#getQName
|
||||
*/
|
||||
public String getQName (int index)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
return data[index*5+2];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an attribute's type by index.
|
||||
*
|
||||
* @param index The attribute's index (zero-based).
|
||||
* @return The attribute's type, "CDATA" if the type is unknown, or null
|
||||
* if the index is out of bounds.
|
||||
* @see org.xml.sax.Attributes#getType(int)
|
||||
*/
|
||||
public String getType (int index)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
return data[index*5+3];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an attribute's value by index.
|
||||
*
|
||||
* @param index The attribute's index (zero-based).
|
||||
* @return The attribute's value or null if the index is out of bounds.
|
||||
* @see org.xml.sax.Attributes#getValue(int)
|
||||
*/
|
||||
public String getValue (int index)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
return data[index*5+4];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Look up an attribute's index by Namespace name.
|
||||
*
|
||||
* <p>In many cases, it will be more efficient to look up the name once and
|
||||
* use the index query methods rather than using the name query methods
|
||||
* repeatedly.</p>
|
||||
*
|
||||
* @param uri The attribute's Namespace URI, or the empty
|
||||
* string if none is available.
|
||||
* @param localName The attribute's local name.
|
||||
* @return The attribute's index, or -1 if none matches.
|
||||
* @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)
|
||||
*/
|
||||
public int getIndex (String uri, String localName)
|
||||
{
|
||||
int max = length * 5;
|
||||
for (int i = 0; i < max; i += 5) {
|
||||
if (data[i].equals(uri) && data[i+1].equals(localName)) {
|
||||
return i / 5;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Look up an attribute's index by qualified (prefixed) name.
|
||||
*
|
||||
* @param qName The qualified name.
|
||||
* @return The attribute's index, or -1 if none matches.
|
||||
* @see org.xml.sax.Attributes#getIndex(java.lang.String)
|
||||
*/
|
||||
public int getIndex (String qName)
|
||||
{
|
||||
int max = length * 5;
|
||||
for (int i = 0; i < max; i += 5) {
|
||||
if (data[i+2].equals(qName)) {
|
||||
return i / 5;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Look up an attribute's type by Namespace-qualified name.
|
||||
*
|
||||
* @param uri The Namespace URI, or the empty string for a name
|
||||
* with no explicit Namespace URI.
|
||||
* @param localName The local name.
|
||||
* @return The attribute's type, or null if there is no
|
||||
* matching attribute.
|
||||
* @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String)
|
||||
*/
|
||||
public String getType (String uri, String localName)
|
||||
{
|
||||
int max = length * 5;
|
||||
for (int i = 0; i < max; i += 5) {
|
||||
if (data[i].equals(uri) && data[i+1].equals(localName)) {
|
||||
return data[i+3];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Look up an attribute's type by qualified (prefixed) name.
|
||||
*
|
||||
* @param qName The qualified name.
|
||||
* @return The attribute's type, or null if there is no
|
||||
* matching attribute.
|
||||
* @see org.xml.sax.Attributes#getType(java.lang.String)
|
||||
*/
|
||||
public String getType (String qName)
|
||||
{
|
||||
int max = length * 5;
|
||||
for (int i = 0; i < max; i += 5) {
|
||||
if (data[i+2].equals(qName)) {
|
||||
return data[i+3];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Look up an attribute's value by Namespace-qualified name.
|
||||
*
|
||||
* @param uri The Namespace URI, or the empty string for a name
|
||||
* with no explicit Namespace URI.
|
||||
* @param localName The local name.
|
||||
* @return The attribute's value, or null if there is no
|
||||
* matching attribute.
|
||||
* @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String)
|
||||
*/
|
||||
public String getValue (String uri, String localName)
|
||||
{
|
||||
int max = length * 5;
|
||||
for (int i = 0; i < max; i += 5) {
|
||||
if (data[i].equals(uri) && data[i+1].equals(localName)) {
|
||||
return data[i+4];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Look up an attribute's value by qualified (prefixed) name.
|
||||
*
|
||||
* @param qName The qualified name.
|
||||
* @return The attribute's value, or null if there is no
|
||||
* matching attribute.
|
||||
* @see org.xml.sax.Attributes#getValue(java.lang.String)
|
||||
*/
|
||||
public String getValue (String qName)
|
||||
{
|
||||
int max = length * 5;
|
||||
for (int i = 0; i < max; i += 5) {
|
||||
if (data[i+2].equals(qName)) {
|
||||
return data[i+4];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Manipulators.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Clear the attribute list for reuse.
|
||||
*
|
||||
* <p>Note that no memory is actually freed by this call:
|
||||
* the current arrays are kept so that they can be
|
||||
* reused.</p>
|
||||
*/
|
||||
public void clear ()
|
||||
{
|
||||
length = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy an entire Attributes object.
|
||||
*
|
||||
* <p>It may be more efficient to reuse an existing object
|
||||
* rather than constantly allocating new ones.</p>
|
||||
*
|
||||
* @param atts The attributes to copy.
|
||||
*/
|
||||
public void setAttributes (Attributes atts)
|
||||
{
|
||||
clear();
|
||||
length = atts.getLength();
|
||||
data = new String[length*5];
|
||||
for (int i = 0; i < length; i++) {
|
||||
data[i*5] = atts.getURI(i);
|
||||
data[i*5+1] = atts.getLocalName(i);
|
||||
data[i*5+2] = atts.getQName(i);
|
||||
data[i*5+3] = atts.getType(i);
|
||||
data[i*5+4] = atts.getValue(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add an attribute to the end of the list.
|
||||
*
|
||||
* <p>For the sake of speed, this method does no checking
|
||||
* to see if the attribute is already in the list: that is
|
||||
* the responsibility of the application.</p>
|
||||
*
|
||||
* @param uri The Namespace URI, or the empty string if
|
||||
* none is available or Namespace processing is not
|
||||
* being performed.
|
||||
* @param localName The local name, or the empty string if
|
||||
* Namespace processing is not being performed.
|
||||
* @param qName The qualified (prefixed) name, or the empty string
|
||||
* if qualified names are not available.
|
||||
* @param type The attribute type as a string.
|
||||
* @param value The attribute value.
|
||||
*/
|
||||
public void addAttribute (String uri, String localName, String qName,
|
||||
String type, String value)
|
||||
{
|
||||
ensureCapacity(length+1);
|
||||
data[length*5] = uri;
|
||||
data[length*5+1] = localName;
|
||||
data[length*5+2] = qName;
|
||||
data[length*5+3] = type;
|
||||
data[length*5+4] = value;
|
||||
length++;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set an attribute in the list.
|
||||
*
|
||||
* <p>For the sake of speed, this method does no checking
|
||||
* for name conflicts or well-formedness: such checks are the
|
||||
* responsibility of the application.</p>
|
||||
*
|
||||
* @param index The index of the attribute (zero-based).
|
||||
* @param uri The Namespace URI, or the empty string if
|
||||
* none is available or Namespace processing is not
|
||||
* being performed.
|
||||
* @param localName The local name, or the empty string if
|
||||
* Namespace processing is not being performed.
|
||||
* @param qName The qualified name, or the empty string
|
||||
* if qualified names are not available.
|
||||
* @param type The attribute type as a string.
|
||||
* @param value The attribute value.
|
||||
* @exception java.lang.ArrayIndexOutOfBoundsException When the
|
||||
* supplied index does not point to an attribute
|
||||
* in the list.
|
||||
*/
|
||||
public void setAttribute (int index, String uri, String localName,
|
||||
String qName, String type, String value)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
data[index*5] = uri;
|
||||
data[index*5+1] = localName;
|
||||
data[index*5+2] = qName;
|
||||
data[index*5+3] = type;
|
||||
data[index*5+4] = value;
|
||||
} else {
|
||||
badIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove an attribute from the list.
|
||||
*
|
||||
* @param index The index of the attribute (zero-based).
|
||||
* @exception java.lang.ArrayIndexOutOfBoundsException When the
|
||||
* supplied index does not point to an attribute
|
||||
* in the list.
|
||||
*/
|
||||
public void removeAttribute (int index)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
if (index < length - 1) {
|
||||
System.arraycopy(data, (index+1)*5, data, index*5,
|
||||
(length-index-1)*5);
|
||||
}
|
||||
length--;
|
||||
} else {
|
||||
badIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the Namespace URI of a specific attribute.
|
||||
*
|
||||
* @param index The index of the attribute (zero-based).
|
||||
* @param uri The attribute's Namespace URI, or the empty
|
||||
* string for none.
|
||||
* @exception java.lang.ArrayIndexOutOfBoundsException When the
|
||||
* supplied index does not point to an attribute
|
||||
* in the list.
|
||||
*/
|
||||
public void setURI (int index, String uri)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
data[index*5] = uri;
|
||||
} else {
|
||||
badIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the local name of a specific attribute.
|
||||
*
|
||||
* @param index The index of the attribute (zero-based).
|
||||
* @param localName The attribute's local name, or the empty
|
||||
* string for none.
|
||||
* @exception java.lang.ArrayIndexOutOfBoundsException When the
|
||||
* supplied index does not point to an attribute
|
||||
* in the list.
|
||||
*/
|
||||
public void setLocalName (int index, String localName)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
data[index*5+1] = localName;
|
||||
} else {
|
||||
badIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the qualified name of a specific attribute.
|
||||
*
|
||||
* @param index The index of the attribute (zero-based).
|
||||
* @param qName The attribute's qualified name, or the empty
|
||||
* string for none.
|
||||
* @exception java.lang.ArrayIndexOutOfBoundsException When the
|
||||
* supplied index does not point to an attribute
|
||||
* in the list.
|
||||
*/
|
||||
public void setQName (int index, String qName)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
data[index*5+2] = qName;
|
||||
} else {
|
||||
badIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the type of a specific attribute.
|
||||
*
|
||||
* @param index The index of the attribute (zero-based).
|
||||
* @param type The attribute's type.
|
||||
* @exception java.lang.ArrayIndexOutOfBoundsException When the
|
||||
* supplied index does not point to an attribute
|
||||
* in the list.
|
||||
*/
|
||||
public void setType (int index, String type)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
data[index*5+3] = type;
|
||||
} else {
|
||||
badIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the value of a specific attribute.
|
||||
*
|
||||
* @param index The index of the attribute (zero-based).
|
||||
* @param value The attribute's value.
|
||||
* @exception java.lang.ArrayIndexOutOfBoundsException When the
|
||||
* supplied index does not point to an attribute
|
||||
* in the list.
|
||||
*/
|
||||
public void setValue (int index, String value)
|
||||
{
|
||||
if (index >= 0 && index < length) {
|
||||
data[index*5+4] = value;
|
||||
} else {
|
||||
badIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Internal methods.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Ensure the internal array's capacity.
|
||||
*
|
||||
* @param n The minimum number of attributes that the array must
|
||||
* be able to hold.
|
||||
*/
|
||||
private void ensureCapacity (int n)
|
||||
{
|
||||
if (n > 0 && (data == null || data.length==0)) {
|
||||
data = new String[25];
|
||||
}
|
||||
|
||||
int max = data.length;
|
||||
if (max >= n * 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
while (max < n * 5) {
|
||||
max *= 2;
|
||||
}
|
||||
String newData[] = new String[max];
|
||||
System.arraycopy(data, 0, newData, 0, length*5);
|
||||
data = newData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Report a bad array index in a manipulator.
|
||||
*
|
||||
* @param index The index to report.
|
||||
* @exception java.lang.ArrayIndexOutOfBoundsException Always.
|
||||
*/
|
||||
private void badIndex (int index)
|
||||
throws ArrayIndexOutOfBoundsException
|
||||
{
|
||||
String msg =
|
||||
"Attempt to modify attribute at illegal index: " + index;
|
||||
throw new ArrayIndexOutOfBoundsException(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Internal state.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
int length;
|
||||
String data [];
|
||||
|
||||
}
|
||||
|
||||
// end of AttributesImpl.java
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kk@kohsuke.org)
|
||||
*/
|
||||
public interface NGCCEventReceiver {
|
||||
void enterElement(String uri, String localName, String qname,Attributes atts) throws SAXException;
|
||||
void leaveElement(String uri, String localName, String qname) throws SAXException;
|
||||
void text(String value) throws SAXException;
|
||||
void enterAttribute(String uri, String localName, String qname) throws SAXException;
|
||||
void leaveAttribute(String uri, String localName, String qname) throws SAXException;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kk@kohsuke.org)
|
||||
*/
|
||||
public interface NGCCEventSource {
|
||||
/**
|
||||
* Replaces an old handler with a new handler, and returns
|
||||
* ID of the EventReceiver thread.
|
||||
*/
|
||||
int replace( NGCCEventReceiver _old, NGCCEventReceiver _new );
|
||||
|
||||
/** Sends an enter element event to the specified EventReceiver thread. */
|
||||
void sendEnterElement( int receiverThreadId, String uri, String local, String qname, Attributes atts ) throws SAXException;
|
||||
|
||||
void sendLeaveElement( int receiverThreadId, String uri, String local, String qname ) throws SAXException;
|
||||
void sendEnterAttribute( int receiverThreadId, String uri, String local, String qname ) throws SAXException;
|
||||
void sendLeaveAttribute( int receiverThreadId, String uri, String local, String qname ) throws SAXException;
|
||||
void sendText( int receiverThreadId, String value ) throws SAXException;
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @version $Id: NGCCHandler.java,v 1.9 2002/09/29 02:55:48 okajima Exp $
|
||||
* @author Kohsuke Kawaguchi (kk@kohsuke.org)
|
||||
*/
|
||||
public abstract class NGCCHandler implements NGCCEventReceiver {
|
||||
protected NGCCHandler( NGCCEventSource source, NGCCHandler parent, int parentCookie ) {
|
||||
|
||||
_parent = parent;
|
||||
_source = source;
|
||||
_cookie = parentCookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parent NGCCHandler, if any.
|
||||
* If this is the root handler, this field will be null.
|
||||
*/
|
||||
protected final NGCCHandler _parent;
|
||||
|
||||
/**
|
||||
* Event source.
|
||||
*/
|
||||
protected final NGCCEventSource _source;
|
||||
|
||||
/**
|
||||
* This method will be implemented by the generated code
|
||||
* and returns a reference to the current runtime.
|
||||
*/
|
||||
protected abstract NGCCRuntime getRuntime();
|
||||
|
||||
/**
|
||||
* Cookie assigned by the parent.
|
||||
*
|
||||
* This value will be passed to the onChildCompleted handler
|
||||
* of the parent.
|
||||
*/
|
||||
protected final int _cookie;
|
||||
|
||||
// used to copy parameters to (enter|leave)(Element|Attribute) events.
|
||||
//protected String localName,uri,qname;
|
||||
|
||||
|
||||
/**
|
||||
* Notifies the completion of a child object.
|
||||
*
|
||||
* @param result
|
||||
* The parsing result of the child state.
|
||||
* @param cookie
|
||||
* The cookie value passed to the child object
|
||||
* when it is created.
|
||||
* @param needAttCheck
|
||||
* This flag is true when the callee needs to call the
|
||||
* processAttribute method to check attribute transitions.
|
||||
* This flag is set to false when this method is triggered by
|
||||
* attribute transition.
|
||||
*/
|
||||
protected abstract void onChildCompleted( Object result, int cookie, boolean needAttCheck ) throws SAXException;
|
||||
|
||||
//
|
||||
//
|
||||
// spawns a new child object from event handlers.
|
||||
//
|
||||
//
|
||||
public void spawnChildFromEnterElement( NGCCEventReceiver child,
|
||||
String uri, String localname, String qname, Attributes atts) throws SAXException {
|
||||
|
||||
int id = _source.replace(this,child);
|
||||
_source.sendEnterElement(id,uri,localname,qname,atts);
|
||||
}
|
||||
public void spawnChildFromEnterAttribute( NGCCEventReceiver child,
|
||||
String uri, String localname, String qname) throws SAXException {
|
||||
|
||||
int id = _source.replace(this,child);
|
||||
_source.sendEnterAttribute(id,uri,localname,qname);
|
||||
}
|
||||
public void spawnChildFromLeaveElement( NGCCEventReceiver child,
|
||||
String uri, String localname, String qname) throws SAXException {
|
||||
|
||||
int id = _source.replace(this,child);
|
||||
_source.sendLeaveElement(id,uri,localname,qname);
|
||||
}
|
||||
public void spawnChildFromLeaveAttribute( NGCCEventReceiver child,
|
||||
String uri, String localname, String qname) throws SAXException {
|
||||
|
||||
int id = _source.replace(this,child);
|
||||
_source.sendLeaveAttribute(id,uri,localname,qname);
|
||||
}
|
||||
public void spawnChildFromText( NGCCEventReceiver child,
|
||||
String value) throws SAXException {
|
||||
|
||||
int id = _source.replace(this,child);
|
||||
_source.sendText(id,value);
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// reverts to the parent object from the child handler
|
||||
//
|
||||
//
|
||||
public void revertToParentFromEnterElement( Object result, int cookie,
|
||||
String uri,String local,String qname, Attributes atts ) throws SAXException {
|
||||
|
||||
int id = _source.replace(this,_parent);
|
||||
_parent.onChildCompleted(result,cookie,true);
|
||||
_source.sendEnterElement(id,uri,local,qname,atts);
|
||||
}
|
||||
public void revertToParentFromLeaveElement( Object result, int cookie,
|
||||
String uri,String local,String qname ) throws SAXException {
|
||||
|
||||
if(uri==NGCCRuntime.IMPOSSIBLE && uri==local && uri==qname && _parent==null )
|
||||
// all the handlers are properly finalized.
|
||||
// quit now, because we don't have any more NGCCHandler.
|
||||
// see the endDocument handler for detail
|
||||
return;
|
||||
|
||||
int id = _source.replace(this,_parent);
|
||||
_parent.onChildCompleted(result,cookie,true);
|
||||
_source.sendLeaveElement(id,uri,local,qname);
|
||||
}
|
||||
public void revertToParentFromEnterAttribute( Object result, int cookie,
|
||||
String uri,String local,String qname ) throws SAXException {
|
||||
|
||||
int id = _source.replace(this,_parent);
|
||||
_parent.onChildCompleted(result,cookie,true);
|
||||
_source.sendEnterAttribute(id,uri,local,qname);
|
||||
}
|
||||
public void revertToParentFromLeaveAttribute( Object result, int cookie,
|
||||
String uri,String local,String qname ) throws SAXException {
|
||||
|
||||
int id = _source.replace(this,_parent);
|
||||
_parent.onChildCompleted(result,cookie,true);
|
||||
_source.sendLeaveAttribute(id,uri,local,qname);
|
||||
}
|
||||
public void revertToParentFromText( Object result, int cookie,
|
||||
String text ) throws SAXException {
|
||||
|
||||
int id = _source.replace(this,_parent);
|
||||
_parent.onChildCompleted(result,cookie,true);
|
||||
_source.sendText(id,text);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// error handler
|
||||
//
|
||||
//
|
||||
public void unexpectedEnterElement(String qname) throws SAXException {
|
||||
getRuntime().unexpectedX('<'+qname+'>');
|
||||
}
|
||||
public void unexpectedLeaveElement(String qname) throws SAXException {
|
||||
getRuntime().unexpectedX("</"+qname+'>');
|
||||
}
|
||||
public void unexpectedEnterAttribute(String qname) throws SAXException {
|
||||
getRuntime().unexpectedX('@'+qname);
|
||||
}
|
||||
public void unexpectedLeaveAttribute(String qname) throws SAXException {
|
||||
getRuntime().unexpectedX("/@"+qname);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,350 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Dispatches incoming events into sub handlers appropriately
|
||||
* so that the interleaving semantics will be correctly realized.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi (kk@kohsuke.org)
|
||||
*/
|
||||
public abstract class NGCCInterleaveFilter implements NGCCEventSource, NGCCEventReceiver {
|
||||
protected NGCCInterleaveFilter( NGCCHandler parent, int cookie ) {
|
||||
this._parent = parent;
|
||||
this._cookie = cookie;
|
||||
}
|
||||
|
||||
protected void setHandlers( NGCCEventReceiver[] receivers ) {
|
||||
this._receivers = receivers;
|
||||
}
|
||||
|
||||
/** event receiverse. */
|
||||
protected NGCCEventReceiver[] _receivers;
|
||||
|
||||
public int replace(NGCCEventReceiver oldHandler, NGCCEventReceiver newHandler) {
|
||||
for( int i=0; i<_receivers.length; i++ )
|
||||
if( _receivers[i]==oldHandler ) {
|
||||
_receivers[i]=newHandler;
|
||||
return i;
|
||||
}
|
||||
throw new InternalError(); // a bug in RelaxNGCC.
|
||||
}
|
||||
|
||||
|
||||
/** Parent handler. */
|
||||
private final NGCCHandler _parent;
|
||||
/** Cookie given by the parent. */
|
||||
private final int _cookie;
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// event handler
|
||||
//
|
||||
//
|
||||
/**
|
||||
* Receiver that is being locked and therefore receives all the events.
|
||||
* <pre><xmp>
|
||||
* <interleave>
|
||||
* <element name="foo"/>
|
||||
* <element name="bar">
|
||||
* <element name="foo"/>
|
||||
* </element>
|
||||
* </interlaeve>
|
||||
* </xmp></pre>
|
||||
* When processing inside the bar element, this receiver is
|
||||
* "locked" so that it can correctly receive its child foo element.
|
||||
*/
|
||||
private int lockedReceiver;
|
||||
/**
|
||||
* Nest level. Lock will be release when the lockCount becomes 0.
|
||||
*/
|
||||
private int lockCount=0;
|
||||
|
||||
public void enterElement(
|
||||
String uri, String localName, String qname,Attributes atts) throws SAXException {
|
||||
|
||||
if(isJoining) return; // ignore any token if we are joining. See joinByXXXX.
|
||||
|
||||
if(lockCount++==0) {
|
||||
lockedReceiver = findReceiverOfElement(uri,localName);
|
||||
if(lockedReceiver==-1) {
|
||||
// we can't process this token. join.
|
||||
joinByEnterElement(null,uri,localName,qname,atts);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_receivers[lockedReceiver].enterElement(uri,localName,qname,atts);
|
||||
}
|
||||
public void leaveElement(String uri, String localName, String qname) throws SAXException {
|
||||
if(isJoining) return; // ignore any token if we are joining. See joinByXXXX.
|
||||
|
||||
if( lockCount-- == 0 )
|
||||
joinByLeaveElement(null,uri,localName,qname);
|
||||
else
|
||||
_receivers[lockedReceiver].leaveElement(uri,localName,qname);
|
||||
}
|
||||
public void enterAttribute(String uri, String localName, String qname) throws SAXException {
|
||||
if(isJoining) return; // ignore any token if we are joining. See joinByXXXX.
|
||||
|
||||
if(lockCount++==0) {
|
||||
lockedReceiver = findReceiverOfAttribute(uri,localName);
|
||||
if(lockedReceiver==-1) {
|
||||
// we can't process this token. join.
|
||||
joinByEnterAttribute(null,uri,localName,qname);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_receivers[lockedReceiver].enterAttribute(uri,localName,qname);
|
||||
}
|
||||
public void leaveAttribute(String uri, String localName, String qname) throws SAXException {
|
||||
if(isJoining) return; // ignore any token if we are joining. See joinByXXXX.
|
||||
|
||||
if( lockCount-- == 0 )
|
||||
joinByLeaveAttribute(null,uri,localName,qname);
|
||||
else
|
||||
_receivers[lockedReceiver].leaveAttribute(uri,localName,qname);
|
||||
}
|
||||
public void text(String value) throws SAXException {
|
||||
if(isJoining) return; // ignore any token if we are joining. See joinByXXXX.
|
||||
|
||||
if(lockCount!=0)
|
||||
_receivers[lockedReceiver].text(value);
|
||||
else {
|
||||
int receiver = findReceiverOfText();
|
||||
if(receiver!=-1) _receivers[receiver].text(value);
|
||||
else joinByText(null,value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Implemented by the generated code to determine the handler
|
||||
* that can receive the given element.
|
||||
*
|
||||
* @return
|
||||
* Thread ID of the receiver that can handle this event,
|
||||
* or -1 if none.
|
||||
*/
|
||||
protected abstract int findReceiverOfElement( String uri, String local );
|
||||
|
||||
/**
|
||||
* Returns the handler that can receive the given attribute, or null.
|
||||
*/
|
||||
protected abstract int findReceiverOfAttribute( String uri, String local );
|
||||
|
||||
/**
|
||||
* Returns the handler that can receive text events, or null.
|
||||
*/
|
||||
protected abstract int findReceiverOfText();
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// join method
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* Set to true when this handler is in the process of
|
||||
* joining all branches.
|
||||
*/
|
||||
private boolean isJoining = false;
|
||||
|
||||
/**
|
||||
* Joins all the child receivers.
|
||||
*
|
||||
* <p>
|
||||
* This method is called by a child receiver when it sees
|
||||
* something that it cannot handle, or by this object itself
|
||||
* when it sees an event that it can't process.
|
||||
*
|
||||
* <p>
|
||||
* This method forces children to move to its final state,
|
||||
* then revert to the parent.
|
||||
*
|
||||
* @param source
|
||||
* If this method is called by one of the child receivers,
|
||||
* the receiver object. If this method is called by itself,
|
||||
* null.
|
||||
*/
|
||||
public void joinByEnterElement( NGCCEventReceiver source,
|
||||
String uri, String local, String qname, Attributes atts ) throws SAXException {
|
||||
|
||||
if(isJoining) return; // we are already in the process of joining. ignore.
|
||||
isJoining = true;
|
||||
|
||||
// send special token to the rest of the branches.
|
||||
// these branches don't understand this token, so they will
|
||||
// try to move to a final state and send the token back to us,
|
||||
// which this object will ignore (because isJoining==true)
|
||||
// Otherwise branches will find an error.
|
||||
for( int i=0; i<_receivers.length; i++ )
|
||||
if( _receivers[i]!=source )
|
||||
_receivers[i].enterElement(uri,local,qname,atts);
|
||||
|
||||
// revert to the parent
|
||||
_parent._source.replace(this,_parent);
|
||||
_parent.onChildCompleted(null,_cookie,true);
|
||||
// send this event to the parent
|
||||
_parent.enterElement(uri,local,qname,atts);
|
||||
}
|
||||
|
||||
public void joinByLeaveElement( NGCCEventReceiver source,
|
||||
String uri, String local, String qname ) throws SAXException {
|
||||
|
||||
if(isJoining) return; // we are already in the process of joining. ignore.
|
||||
isJoining = true;
|
||||
|
||||
// send special token to the rest of the branches.
|
||||
// these branches don't understand this token, so they will
|
||||
// try to move to a final state and send the token back to us,
|
||||
// which this object will ignore (because isJoining==true)
|
||||
// Otherwise branches will find an error.
|
||||
for( int i=0; i<_receivers.length; i++ )
|
||||
if( _receivers[i]!=source )
|
||||
_receivers[i].leaveElement(uri,local,qname);
|
||||
|
||||
// revert to the parent
|
||||
_parent._source.replace(this,_parent);
|
||||
_parent.onChildCompleted(null,_cookie,true);
|
||||
// send this event to the parent
|
||||
_parent.leaveElement(uri,local,qname);
|
||||
}
|
||||
|
||||
public void joinByEnterAttribute( NGCCEventReceiver source,
|
||||
String uri, String local, String qname ) throws SAXException {
|
||||
|
||||
if(isJoining) return; // we are already in the process of joining. ignore.
|
||||
isJoining = true;
|
||||
|
||||
// send special token to the rest of the branches.
|
||||
// these branches don't understand this token, so they will
|
||||
// try to move to a final state and send the token back to us,
|
||||
// which this object will ignore (because isJoining==true)
|
||||
// Otherwise branches will find an error.
|
||||
for( int i=0; i<_receivers.length; i++ )
|
||||
if( _receivers[i]!=source )
|
||||
_receivers[i].enterAttribute(uri,local,qname);
|
||||
|
||||
// revert to the parent
|
||||
_parent._source.replace(this,_parent);
|
||||
_parent.onChildCompleted(null,_cookie,true);
|
||||
// send this event to the parent
|
||||
_parent.enterAttribute(uri,local,qname);
|
||||
}
|
||||
|
||||
public void joinByLeaveAttribute( NGCCEventReceiver source,
|
||||
String uri, String local, String qname ) throws SAXException {
|
||||
|
||||
if(isJoining) return; // we are already in the process of joining. ignore.
|
||||
isJoining = true;
|
||||
|
||||
// send special token to the rest of the branches.
|
||||
// these branches don't understand this token, so they will
|
||||
// try to move to a final state and send the token back to us,
|
||||
// which this object will ignore (because isJoining==true)
|
||||
// Otherwise branches will find an error.
|
||||
for( int i=0; i<_receivers.length; i++ )
|
||||
if( _receivers[i]!=source )
|
||||
_receivers[i].leaveAttribute(uri,local,qname);
|
||||
|
||||
// revert to the parent
|
||||
_parent._source.replace(this,_parent);
|
||||
_parent.onChildCompleted(null,_cookie,true);
|
||||
// send this event to the parent
|
||||
_parent.leaveAttribute(uri,local,qname);
|
||||
}
|
||||
|
||||
public void joinByText( NGCCEventReceiver source,
|
||||
String value ) throws SAXException {
|
||||
|
||||
if(isJoining) return; // we are already in the process of joining. ignore.
|
||||
isJoining = true;
|
||||
|
||||
// send special token to the rest of the branches.
|
||||
// these branches don't understand this token, so they will
|
||||
// try to move to a final state and send the token back to us,
|
||||
// which this object will ignore (because isJoining==true)
|
||||
// Otherwise branches will find an error.
|
||||
for( int i=0; i<_receivers.length; i++ )
|
||||
if( _receivers[i]!=source )
|
||||
_receivers[i].text(value);
|
||||
|
||||
// revert to the parent
|
||||
_parent._source.replace(this,_parent);
|
||||
_parent.onChildCompleted(null,_cookie,true);
|
||||
// send this event to the parent
|
||||
_parent.text(value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// event dispatching methods
|
||||
//
|
||||
//
|
||||
|
||||
public void sendEnterAttribute( int threadId,
|
||||
String uri, String local, String qname) throws SAXException {
|
||||
|
||||
_receivers[threadId].enterAttribute(uri,local,qname);
|
||||
}
|
||||
|
||||
public void sendEnterElement( int threadId,
|
||||
String uri, String local, String qname, Attributes atts) throws SAXException {
|
||||
|
||||
_receivers[threadId].enterElement(uri,local,qname,atts);
|
||||
}
|
||||
|
||||
public void sendLeaveAttribute( int threadId,
|
||||
String uri, String local, String qname) throws SAXException {
|
||||
|
||||
_receivers[threadId].leaveAttribute(uri,local,qname);
|
||||
}
|
||||
|
||||
public void sendLeaveElement( int threadId,
|
||||
String uri, String local, String qname) throws SAXException {
|
||||
|
||||
_receivers[threadId].leaveElement(uri,local,qname);
|
||||
}
|
||||
|
||||
public void sendText(int threadId, String value) throws SAXException {
|
||||
_receivers[threadId].text(value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,555 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Stack;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
/**
|
||||
* Runtime Engine for RELAXNGCC execution.
|
||||
*
|
||||
* This class has the following functionalities:
|
||||
*
|
||||
* <ol>
|
||||
* <li>Managing a stack of NGCCHandler objects and
|
||||
* switching between them appropriately.
|
||||
*
|
||||
* <li>Keep track of all Attributes.
|
||||
*
|
||||
* <li>manage mapping between namespace URIs and prefixes.
|
||||
*
|
||||
* <li>TODO: provide support for interleaving.
|
||||
*
|
||||
* @version $Id: NGCCRuntime.java,v 1.15 2002/09/29 02:55:48 okajima Exp $
|
||||
* @author Kohsuke Kawaguchi (kk@kohsuke.org)
|
||||
*/
|
||||
public class NGCCRuntime implements ContentHandler, NGCCEventSource {
|
||||
|
||||
public NGCCRuntime() {
|
||||
reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the root handler, which will be used to parse the
|
||||
* root element.
|
||||
* <p>
|
||||
* This method can be called right after the object is created
|
||||
* or the reset method is called. You can't replace the root
|
||||
* handler while parsing is in progress.
|
||||
* <p>
|
||||
* Usually a generated class that corresponds to the <start>
|
||||
* pattern will be used as the root handler, but any NGCCHandler
|
||||
* can be a root handler.
|
||||
*
|
||||
* @exception IllegalStateException
|
||||
* If this method is called but it doesn't satisfy the
|
||||
* pre-condition stated above.
|
||||
*/
|
||||
public void setRootHandler( NGCCHandler rootHandler ) {
|
||||
if(currentHandler!=null)
|
||||
throw new IllegalStateException();
|
||||
currentHandler = rootHandler;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cleans up all the data structure so that the object can be reused later.
|
||||
* Normally, applications do not need to call this method directly,
|
||||
*
|
||||
* as the runtime resets itself after the endDocument method.
|
||||
*/
|
||||
public void reset() {
|
||||
attStack.clear();
|
||||
currentAtts = null;
|
||||
currentHandler = null;
|
||||
indent=0;
|
||||
locator = null;
|
||||
namespaces.clear();
|
||||
needIndent = true;
|
||||
redirect = null;
|
||||
redirectionDepth = 0;
|
||||
text = new StringBuffer();
|
||||
|
||||
// add a dummy attributes at the bottom as a "centinel."
|
||||
attStack.push(new AttributesImpl());
|
||||
}
|
||||
|
||||
// current content handler can be acccessed via set/getContentHandler.
|
||||
|
||||
private Locator locator;
|
||||
public void setDocumentLocator( Locator _loc ) { this.locator=_loc; }
|
||||
/**
|
||||
* Gets the source location of the current event.
|
||||
*
|
||||
* <p>
|
||||
* One can call this method from RelaxNGCC handlers to access
|
||||
* the line number information. Note that to
|
||||
*/
|
||||
public Locator getLocator() { return locator; }
|
||||
|
||||
|
||||
/** stack of {@link Attributes}. */
|
||||
private final Stack attStack = new Stack();
|
||||
/** current attributes set. always equal to attStack.peek() */
|
||||
private AttributesImpl currentAtts;
|
||||
|
||||
/**
|
||||
* Attributes that belong to the current element.
|
||||
* <p>
|
||||
* It's generally not recommended for applications to use
|
||||
* this method. RelaxNGCC internally removes processed attributes,
|
||||
* so this doesn't correctly reflect all the attributes an element
|
||||
* carries.
|
||||
*/
|
||||
public Attributes getCurrentAttributes() {
|
||||
return currentAtts;
|
||||
}
|
||||
|
||||
/** accumulated text. */
|
||||
private StringBuffer text = new StringBuffer();
|
||||
|
||||
|
||||
|
||||
|
||||
/** The current NGCCHandler. Always equals to handlerStack.peek() */
|
||||
private NGCCEventReceiver currentHandler;
|
||||
|
||||
public int replace( NGCCEventReceiver o, NGCCEventReceiver n ) {
|
||||
if(o!=currentHandler)
|
||||
throw new IllegalStateException(); // bug of RelaxNGCC
|
||||
currentHandler = n;
|
||||
|
||||
return 0; // we only have one thread.
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes buffered text.
|
||||
*
|
||||
* This method will be called by the start/endElement event to process
|
||||
* buffered text as a text event.
|
||||
*
|
||||
* <p>
|
||||
* Whitespace handling is a tricky business. Consider the following
|
||||
* schema fragment:
|
||||
*
|
||||
* <xmp>
|
||||
* <element name="foo">
|
||||
* <choice>
|
||||
* <element name="bar"><empty/></element>
|
||||
* <text/>
|
||||
* </choice>
|
||||
* </element>
|
||||
* </xmp>
|
||||
*
|
||||
* Assume we hit the following instance:
|
||||
* <xmp>
|
||||
* <foo> <bar/></foo>
|
||||
* </xmp>
|
||||
*
|
||||
* Then this first space needs to be ignored (for otherwise, we will
|
||||
* end up treating this space as the match to <text/> and won't
|
||||
* be able to process <bar>.)
|
||||
*
|
||||
* Now assume the following instance:
|
||||
* <xmp>
|
||||
* <foo/>
|
||||
* </xmp>
|
||||
*
|
||||
* This time, we need to treat this empty string as a text, for
|
||||
* otherwise we won't be able to accept this instance.
|
||||
*
|
||||
* <p>
|
||||
* This is very difficult to solve in general, but one seemingly
|
||||
* easy solution is to use the type of next event. If a text is
|
||||
* followed by a start tag, it follows from the constraint on
|
||||
* RELAX NG that that text must be either whitespaces or a match
|
||||
* to <text/>.
|
||||
*
|
||||
* <p>
|
||||
* On the contrary, if a text is followed by a end tag, then it
|
||||
* cannot be whitespace unless the content model can accept empty,
|
||||
* in which case sending a text event will be harmlessly ignored
|
||||
* by the NGCCHandler.
|
||||
*
|
||||
* <p>
|
||||
* Thus this method take one parameter, which controls the
|
||||
* behavior of this method.
|
||||
*
|
||||
* <p>
|
||||
* TODO: according to the constraint of RELAX NG, if characters
|
||||
* follow an end tag, then they must be either whitespaces or
|
||||
* must match to <text/>.
|
||||
*
|
||||
* @param possiblyWhitespace
|
||||
* True if the buffered character can be ignorabale. False if
|
||||
* it needs to be consumed.
|
||||
*/
|
||||
private void processPendingText(boolean ignorable) throws SAXException {
|
||||
if(ignorable && text.toString().trim().length()==0)
|
||||
; // ignore. See the above javadoc comment for the description
|
||||
else
|
||||
currentHandler.text(text.toString()); // otherwise consume this token
|
||||
|
||||
// truncate StringBuffer, but avoid excessive allocation.
|
||||
if(text.length()>1024) text = new StringBuffer();
|
||||
else text.setLength(0);
|
||||
}
|
||||
|
||||
public void processList( String str ) throws SAXException {
|
||||
StringTokenizer t = new StringTokenizer(str, " \t\r\n");
|
||||
while(t.hasMoreTokens())
|
||||
currentHandler.text(t.nextToken());
|
||||
}
|
||||
|
||||
public void startElement(String uri, String localname, String qname, Attributes atts)
|
||||
throws SAXException {
|
||||
|
||||
if(redirect!=null) {
|
||||
redirect.startElement(uri,localname,qname,atts);
|
||||
redirectionDepth++;
|
||||
} else {
|
||||
processPendingText(true);
|
||||
// System.out.println("startElement:"+localname+"->"+_attrStack.size());
|
||||
currentHandler.enterElement(uri, localname, qname, atts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the generated handler code when an enter element
|
||||
* event is consumed.
|
||||
*
|
||||
* <p>
|
||||
* Pushes a new attribute set.
|
||||
*
|
||||
* <p>
|
||||
* Note that attributes are NOT pushed at the startElement method,
|
||||
* because the processing of the enterElement event can trigger
|
||||
* other attribute events and etc.
|
||||
* <p>
|
||||
* This method will be called from one of handlers when it truely
|
||||
* consumes the enterElement event.
|
||||
*/
|
||||
public void onEnterElementConsumed(
|
||||
String uri, String localName, String qname,Attributes atts) throws SAXException {
|
||||
attStack.push(currentAtts=new AttributesImpl(atts));
|
||||
nsEffectiveStack.push( new Integer(nsEffectivePtr) );
|
||||
nsEffectivePtr = namespaces.size();
|
||||
}
|
||||
|
||||
public void onLeaveElementConsumed(String uri, String localName, String qname) throws SAXException {
|
||||
attStack.pop();
|
||||
if(attStack.isEmpty())
|
||||
currentAtts = null;
|
||||
else
|
||||
currentAtts = (AttributesImpl)attStack.peek();
|
||||
nsEffectivePtr = ((Integer)nsEffectiveStack.pop()).intValue();
|
||||
}
|
||||
|
||||
public void endElement(String uri, String localname, String qname)
|
||||
throws SAXException {
|
||||
|
||||
if(redirect!=null) {
|
||||
redirect.endElement(uri,localname,qname);
|
||||
redirectionDepth--;
|
||||
|
||||
if(redirectionDepth!=0)
|
||||
return;
|
||||
|
||||
// finished redirection.
|
||||
for( int i=0; i<namespaces.size(); i+=2 )
|
||||
redirect.endPrefixMapping((String)namespaces.get(i));
|
||||
redirect.endDocument();
|
||||
|
||||
redirect = null;
|
||||
// then process this element normally
|
||||
}
|
||||
|
||||
processPendingText(false);
|
||||
|
||||
currentHandler.leaveElement(uri, localname, qname);
|
||||
// System.out.println("endElement:"+localname);
|
||||
}
|
||||
|
||||
public void characters(char[] ch, int start, int length) throws SAXException {
|
||||
if(redirect!=null)
|
||||
redirect.characters(ch,start,length);
|
||||
else
|
||||
text.append(ch,start,length);
|
||||
}
|
||||
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
|
||||
if(redirect!=null)
|
||||
redirect.ignorableWhitespace(ch,start,length);
|
||||
else
|
||||
text.append(ch,start,length);
|
||||
}
|
||||
|
||||
public int getAttributeIndex(String uri, String localname) {
|
||||
return currentAtts.getIndex(uri, localname);
|
||||
}
|
||||
public void consumeAttribute(int index) throws SAXException {
|
||||
final String uri = currentAtts.getURI(index);
|
||||
final String local = currentAtts.getLocalName(index);
|
||||
final String qname = currentAtts.getQName(index);
|
||||
final String value = currentAtts.getValue(index);
|
||||
currentAtts.removeAttribute(index);
|
||||
|
||||
currentHandler.enterAttribute(uri,local,qname);
|
||||
currentHandler.text(value);
|
||||
currentHandler.leaveAttribute(uri,local,qname);
|
||||
}
|
||||
|
||||
|
||||
public void startPrefixMapping( String prefix, String uri ) throws SAXException {
|
||||
if(redirect!=null)
|
||||
redirect.startPrefixMapping(prefix,uri);
|
||||
else {
|
||||
namespaces.add(prefix);
|
||||
namespaces.add(uri);
|
||||
}
|
||||
}
|
||||
|
||||
public void endPrefixMapping( String prefix ) throws SAXException {
|
||||
if(redirect!=null)
|
||||
redirect.endPrefixMapping(prefix);
|
||||
else {
|
||||
namespaces.remove(namespaces.size()-1);
|
||||
namespaces.remove(namespaces.size()-1);
|
||||
}
|
||||
}
|
||||
|
||||
public void skippedEntity( String name ) throws SAXException {
|
||||
if(redirect!=null)
|
||||
redirect.skippedEntity(name);
|
||||
}
|
||||
|
||||
public void processingInstruction( String target, String data ) throws SAXException {
|
||||
if(redirect!=null)
|
||||
redirect.processingInstruction(target,data);
|
||||
}
|
||||
|
||||
/** Impossible token. This value can never be a valid XML name. */
|
||||
static final String IMPOSSIBLE = "\u0000";
|
||||
|
||||
public void endDocument() throws SAXException {
|
||||
// consume the special "end document" token so that all the handlers
|
||||
// currently at the stack will revert to their respective parents.
|
||||
//
|
||||
// this is necessary to handle a grammar like
|
||||
// <start><ref name="X"/></start>
|
||||
// <define name="X">
|
||||
// <element name="root"><empty/></element>
|
||||
// </define>
|
||||
//
|
||||
// With this grammar, when the endElement event is consumed, two handlers
|
||||
// are on the stack (because a child object won't revert to its parent
|
||||
// unless it sees a next event.)
|
||||
|
||||
// pass around an "impossible" token.
|
||||
currentHandler.leaveElement(IMPOSSIBLE,IMPOSSIBLE,IMPOSSIBLE);
|
||||
|
||||
reset();
|
||||
}
|
||||
public void startDocument() {}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// event dispatching methods
|
||||
//
|
||||
//
|
||||
|
||||
public void sendEnterAttribute( int threadId,
|
||||
String uri, String local, String qname) throws SAXException {
|
||||
|
||||
currentHandler.enterAttribute(uri,local,qname);
|
||||
}
|
||||
|
||||
public void sendEnterElement( int threadId,
|
||||
String uri, String local, String qname, Attributes atts) throws SAXException {
|
||||
|
||||
currentHandler.enterElement(uri,local,qname,atts);
|
||||
}
|
||||
|
||||
public void sendLeaveAttribute( int threadId,
|
||||
String uri, String local, String qname) throws SAXException {
|
||||
|
||||
currentHandler.leaveAttribute(uri,local,qname);
|
||||
}
|
||||
|
||||
public void sendLeaveElement( int threadId,
|
||||
String uri, String local, String qname) throws SAXException {
|
||||
|
||||
currentHandler.leaveElement(uri,local,qname);
|
||||
}
|
||||
|
||||
public void sendText(int threadId, String value) throws SAXException {
|
||||
currentHandler.text(value);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// redirection of SAX2 events.
|
||||
//
|
||||
//
|
||||
/** When redirecting a sub-tree, this value will be non-null. */
|
||||
private ContentHandler redirect = null;
|
||||
|
||||
/**
|
||||
* Counts the depth of the elements when we are re-directing
|
||||
* a sub-tree to another ContentHandler.
|
||||
*/
|
||||
private int redirectionDepth = 0;
|
||||
|
||||
/**
|
||||
* This method can be called only from the enterElement handler.
|
||||
* The sub-tree rooted at the new element will be redirected
|
||||
* to the specified ContentHandler.
|
||||
*
|
||||
* <p>
|
||||
* Currently active NGCCHandler will only receive the leaveElement
|
||||
* event of the newly started element.
|
||||
*
|
||||
* @param uri,local,qname
|
||||
* Parameters passed to the enter element event. Used to
|
||||
* simulate the startElement event for the new ContentHandler.
|
||||
*/
|
||||
public void redirectSubtree( ContentHandler child,
|
||||
String uri, String local, String qname ) throws SAXException {
|
||||
|
||||
redirect = child;
|
||||
redirect.setDocumentLocator(locator);
|
||||
redirect.startDocument();
|
||||
|
||||
// TODO: when a prefix is re-bound to something else,
|
||||
// the following code is potentially dangerous. It should be
|
||||
// modified to report active bindings only.
|
||||
for( int i=0; i<namespaces.size(); i+=2 )
|
||||
redirect.startPrefixMapping(
|
||||
(String)namespaces.get(i),
|
||||
(String)namespaces.get(i+1)
|
||||
);
|
||||
|
||||
redirect.startElement(uri,local,qname,currentAtts);
|
||||
redirectionDepth=1;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// validation context implementation
|
||||
//
|
||||
//
|
||||
/** in-scope namespace mapping.
|
||||
* namespaces[2n ] := prefix
|
||||
* namespaces[2n+1] := namespace URI */
|
||||
private final ArrayList namespaces = new ArrayList();
|
||||
/**
|
||||
* Index on the namespaces array, which points to
|
||||
* the top of the effective bindings. Because of the
|
||||
* timing difference between the startPrefixMapping method
|
||||
* and the execution of the corresponding actions,
|
||||
* this value can be different from <code>namespaces.size()</code>.
|
||||
* <p>
|
||||
* For example, consider the following schema:
|
||||
* <pre><xmp>
|
||||
* <oneOrMore>
|
||||
* <element name="foo"><empty/></element>
|
||||
* </oneOrMore>
|
||||
* code fragment X
|
||||
* <element name="bob"/>
|
||||
* </xmp></pre>
|
||||
* Code fragment X is executed after we see a startElement event,
|
||||
* but at this time the namespaces variable already include new
|
||||
* namespace bindings declared on "bob".
|
||||
*/
|
||||
private int nsEffectivePtr=0;
|
||||
|
||||
/**
|
||||
* Stack to preserve old nsEffectivePtr values.
|
||||
*/
|
||||
private final Stack nsEffectiveStack = new Stack();
|
||||
|
||||
public String resolveNamespacePrefix( String prefix ) {
|
||||
for( int i = nsEffectivePtr-2; i>=0; i-=2 )
|
||||
if( namespaces.get(i).equals(prefix) )
|
||||
return (String)namespaces.get(i+1);
|
||||
|
||||
// no binding was found.
|
||||
if(prefix.equals("")) return ""; // return the default no-namespace
|
||||
if(prefix.equals("xml")) // pre-defined xml prefix
|
||||
return "http://www.w3.org/XML/1998/namespace";
|
||||
else return null; // prefix undefined
|
||||
}
|
||||
|
||||
|
||||
// error reporting
|
||||
protected void unexpectedX(String token) throws SAXException {
|
||||
throw new SAXParseException(MessageFormat.format(
|
||||
"Unexpected {0} appears at line {1} column {2}",
|
||||
new Object[]{
|
||||
token,
|
||||
new Integer(getLocator().getLineNumber()),
|
||||
new Integer(getLocator().getColumnNumber()) }),
|
||||
getLocator());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// trace functions
|
||||
//
|
||||
//
|
||||
private int indent=0;
|
||||
private boolean needIndent=true;
|
||||
private void printIndent() {
|
||||
for( int i=0; i<indent; i++ )
|
||||
System.out.print(" ");
|
||||
}
|
||||
public void trace( String s ) {
|
||||
if(needIndent) {
|
||||
needIndent=false;
|
||||
printIndent();
|
||||
}
|
||||
System.out.print(s);
|
||||
}
|
||||
public void traceln( String s ) {
|
||||
trace(s);
|
||||
trace("\n");
|
||||
needIndent=true;
|
||||
}
|
||||
}
|
||||
1315
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/parser/state/Schema.java
Normal file
1315
jdkSrc/jdk8/com/sun/xml/internal/xsom/impl/parser/state/Schema.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,390 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
class SimpleType_List extends NGCCHandler {
|
||||
private Locator locator;
|
||||
private AnnotationImpl annotation;
|
||||
private String name;
|
||||
private UName itemTypeName;
|
||||
private Set finalSet;
|
||||
private ForeignAttributesImpl fa;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public SimpleType_List(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, AnnotationImpl _annotation, Locator _locator, ForeignAttributesImpl _fa, String _name, Set _finalSet) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
this.annotation = _annotation;
|
||||
this.locator = _locator;
|
||||
this.fa = _fa;
|
||||
this.name = _name;
|
||||
this.finalSet = _finalSet;
|
||||
$_ngcc_current_state = 10;
|
||||
}
|
||||
|
||||
public SimpleType_List(NGCCRuntimeEx runtime, AnnotationImpl _annotation, Locator _locator, ForeignAttributesImpl _fa, String _name, Set _finalSet) {
|
||||
this(null, runtime, runtime, -1, _annotation, _locator, _fa, _name, _finalSet);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
result = new ListSimpleTypeImpl(
|
||||
$runtime.document, annotation, locator, fa,
|
||||
name, name==null, finalSet, itemType );
|
||||
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
|
||||
itemType = new DelayedRef.SimpleType(
|
||||
$runtime, lloc, $runtime.currentSchema, itemTypeName);
|
||||
|
||||
}
|
||||
|
||||
private void action2()throws SAXException {
|
||||
lloc=$runtime.copyLocator();
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 9:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || ((($ai = $runtime.getAttributeIndex("","itemType"))>=0 && (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 266, fa);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 264, annotation,AnnotationContext.SIMPLETYPE_DECL);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action2();
|
||||
$_ngcc_current_state = 9;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","itemType"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
|
||||
NGCCHandler h = new simpleType(this, super._source, $runtime, 258);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 9:
|
||||
{
|
||||
if((($ai = $runtime.getAttributeIndex("","itemType"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list")))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 266, fa);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","itemType"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
action0();
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 9:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("itemType"))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 266, fa);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("itemType"))) {
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 7:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("itemType"))) {
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 9:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","itemType"))>=0) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 266, fa);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","itemType"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(result, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
NGCCHandler h = new qname(this, super._source, $runtime, 260);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 266:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
$_ngcc_current_state = 7;
|
||||
}
|
||||
break;
|
||||
case 264:
|
||||
{
|
||||
annotation = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
break;
|
||||
case 258:
|
||||
{
|
||||
itemType = ((SimpleTypeImpl)$__result__);
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
case 260:
|
||||
{
|
||||
itemTypeName = ((UName)$__result__);
|
||||
action1();
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
/** computed simple type object */
|
||||
private ListSimpleTypeImpl result;
|
||||
|
||||
// reference to the base type
|
||||
private Ref.SimpleType itemType;
|
||||
|
||||
// locator of <list>
|
||||
private Locator lloc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,491 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
class SimpleType_Restriction extends NGCCHandler {
|
||||
private Locator locator;
|
||||
private AnnotationImpl annotation;
|
||||
private String name;
|
||||
private UName baseTypeName;
|
||||
private Set finalSet;
|
||||
private ForeignAttributesImpl fa;
|
||||
private XSFacet facet;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public SimpleType_Restriction(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, AnnotationImpl _annotation, Locator _locator, ForeignAttributesImpl _fa, String _name, Set _finalSet) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
this.annotation = _annotation;
|
||||
this.locator = _locator;
|
||||
this.fa = _fa;
|
||||
this.name = _name;
|
||||
this.finalSet = _finalSet;
|
||||
$_ngcc_current_state = 13;
|
||||
}
|
||||
|
||||
public SimpleType_Restriction(NGCCRuntimeEx runtime, AnnotationImpl _annotation, Locator _locator, ForeignAttributesImpl _fa, String _name, Set _finalSet) {
|
||||
this(null, runtime, runtime, -1, _annotation, _locator, _fa, _name, _finalSet);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
result.addFacet(facet);
|
||||
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
|
||||
result = new RestrictionSimpleTypeImpl(
|
||||
$runtime.document, annotation, locator, fa, name, name==null, finalSet, baseType );
|
||||
|
||||
}
|
||||
|
||||
private void action2()throws SAXException {
|
||||
|
||||
baseType = new DelayedRef.SimpleType(
|
||||
$runtime, rloc, $runtime.currentSchema, baseTypeName );
|
||||
|
||||
}
|
||||
|
||||
private void action3()throws SAXException {
|
||||
rloc=$runtime.copyLocator();
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 12:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || ((($ai = $runtime.getAttributeIndex("","base"))>=0 && ((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType")) || (((((((((((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minExclusive")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxExclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("totalDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("fractionDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("length"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("enumeration"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("whiteSpace"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("pattern")))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 166, fa);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 164, annotation,AnnotationContext.SIMPLETYPE_DECL);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 5;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
action1();
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","base"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
|
||||
NGCCHandler h = new simpleType(this, super._source, $runtime, 158);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if((((((((((((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minExclusive")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxExclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("totalDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("fractionDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("length"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("enumeration"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("whiteSpace"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("pattern")))) {
|
||||
NGCCHandler h = new facet(this, super._source, $runtime, 153);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if((((((((((((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minExclusive")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxExclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("totalDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("fractionDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("length"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("enumeration"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("whiteSpace"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("pattern")))) {
|
||||
NGCCHandler h = new facet(this, super._source, $runtime, 154);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("restriction"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action3();
|
||||
$_ngcc_current_state = 12;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 12:
|
||||
{
|
||||
if((($ai = $runtime.getAttributeIndex("","base"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("restriction")))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 166, fa);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
$_ngcc_current_state = 5;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
action1();
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","base"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("restriction"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 12:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("base"))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 166, fa);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
$_ngcc_current_state = 5;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
action1();
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("base"))) {
|
||||
$_ngcc_current_state = 8;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 7:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("base"))) {
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
$_ngcc_current_state = 5;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
action1();
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 8:
|
||||
{
|
||||
NGCCHandler h = new qname(this, super._source, $runtime, 160);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","base"))>=0) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 166, fa);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
$_ngcc_current_state = 5;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
action1();
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(result, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","base"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 160:
|
||||
{
|
||||
baseTypeName = ((UName)$__result__);
|
||||
action2();
|
||||
$_ngcc_current_state = 7;
|
||||
}
|
||||
break;
|
||||
case 164:
|
||||
{
|
||||
annotation = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
break;
|
||||
case 154:
|
||||
{
|
||||
facet = ((XSFacet)$__result__);
|
||||
action0();
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
case 166:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
$_ngcc_current_state = 10;
|
||||
}
|
||||
break;
|
||||
case 158:
|
||||
{
|
||||
baseType = ((SimpleTypeImpl)$__result__);
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
break;
|
||||
case 153:
|
||||
{
|
||||
facet = ((XSFacet)$__result__);
|
||||
action0();
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
/** computed simple type object */
|
||||
private RestrictionSimpleTypeImpl result;
|
||||
|
||||
// reference to the base type
|
||||
private Ref.SimpleType baseType;
|
||||
|
||||
// location of restriction
|
||||
private Locator rloc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,465 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
class SimpleType_Union extends NGCCHandler {
|
||||
private Locator locator;
|
||||
private AnnotationImpl annotation;
|
||||
private String __text;
|
||||
private UName memberTypeName;
|
||||
private String name;
|
||||
private Set finalSet;
|
||||
private ForeignAttributesImpl fa;
|
||||
private SimpleTypeImpl anonymousMemberType;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public SimpleType_Union(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, AnnotationImpl _annotation, Locator _locator, ForeignAttributesImpl _fa, String _name, Set _finalSet) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
this.annotation = _annotation;
|
||||
this.locator = _locator;
|
||||
this.fa = _fa;
|
||||
this.name = _name;
|
||||
this.finalSet = _finalSet;
|
||||
$_ngcc_current_state = 12;
|
||||
}
|
||||
|
||||
public SimpleType_Union(NGCCRuntimeEx runtime, AnnotationImpl _annotation, Locator _locator, ForeignAttributesImpl _fa, String _name, Set _finalSet) {
|
||||
this(null, runtime, runtime, -1, _annotation, _locator, _fa, _name, _finalSet);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
result = new UnionSimpleTypeImpl(
|
||||
$runtime.document, annotation, locator, fa, name, name==null, finalSet,
|
||||
(Ref.SimpleType[])members.toArray(new Ref.SimpleType[members.size()]) );
|
||||
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
|
||||
members.add(anonymousMemberType);
|
||||
|
||||
}
|
||||
|
||||
private void action2()throws SAXException {
|
||||
|
||||
members.add( new DelayedRef.SimpleType(
|
||||
$runtime, uloc, $runtime.currentSchema, memberTypeName));
|
||||
|
||||
}
|
||||
|
||||
private void action3()throws SAXException {
|
||||
$runtime.processList(__text);}
|
||||
|
||||
private void action4()throws SAXException {
|
||||
uloc=$runtime.copyLocator();
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 4:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 183, annotation,AnnotationContext.SIMPLETYPE_DECL);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
|
||||
NGCCHandler h = new simpleType(this, super._source, $runtime, 179);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","memberTypes"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 6;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("union"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action4();
|
||||
$_ngcc_current_state = 7;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
|
||||
NGCCHandler h = new simpleType(this, super._source, $runtime, 180);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType")))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 185, fa);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("union"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
action0();
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","memberTypes"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 6;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("union"))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 185, fa);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("memberTypes"))) {
|
||||
$_ngcc_current_state = 10;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 6;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
$_ngcc_current_state = 6;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("memberTypes"))) {
|
||||
$_ngcc_current_state = 6;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
NGCCHandler h = new qname(this, super._source, $runtime, 187);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
__text = $value;
|
||||
$_ngcc_current_state = 9;
|
||||
action3();
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(result, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","memberTypes"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 6;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
NGCCHandler h = new qname(this, super._source, $runtime, 188);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 183:
|
||||
{
|
||||
annotation = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
break;
|
||||
case 187:
|
||||
{
|
||||
memberTypeName = ((UName)$__result__);
|
||||
action2();
|
||||
$_ngcc_current_state = 8;
|
||||
}
|
||||
break;
|
||||
case 179:
|
||||
{
|
||||
anonymousMemberType = ((SimpleTypeImpl)$__result__);
|
||||
action1();
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
case 188:
|
||||
{
|
||||
memberTypeName = ((UName)$__result__);
|
||||
action2();
|
||||
$_ngcc_current_state = 8;
|
||||
}
|
||||
break;
|
||||
case 185:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
break;
|
||||
case 180:
|
||||
{
|
||||
anonymousMemberType = ((SimpleTypeImpl)$__result__);
|
||||
action1();
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
/** computed simple type object */
|
||||
private UnionSimpleTypeImpl result;
|
||||
|
||||
// Vector of Ref.SimpleType
|
||||
private final Vector members = new Vector();
|
||||
|
||||
// locator of <union>
|
||||
private Locator uloc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
import com.sun.xml.internal.xsom.parser.AnnotationParser;
|
||||
|
||||
|
||||
class annotation extends NGCCHandler {
|
||||
private AnnotationContext context;
|
||||
private AnnotationImpl existing;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public annotation(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, AnnotationImpl _existing, AnnotationContext _context) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
this.existing = _existing;
|
||||
this.context = _context;
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
|
||||
public annotation(NGCCRuntimeEx runtime, AnnotationImpl _existing, AnnotationContext _context) {
|
||||
this(null, runtime, runtime, -1, _existing, _context);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
locator = $runtime.copyLocator();
|
||||
parser = $runtime.createAnnotationParser();
|
||||
$runtime.redirectSubtree(parser.getContentHandler(
|
||||
context,
|
||||
$runtime.getAnnotationContextElementName(),
|
||||
$runtime.getErrorHandler(),
|
||||
$runtime.parser.getEntityResolver()
|
||||
), $uri, $localName, $qname );
|
||||
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action0();
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(makeResult(), super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
private AnnotationParser parser;
|
||||
private Locator locator;
|
||||
|
||||
public AnnotationImpl makeResult() {
|
||||
Object e = null;
|
||||
if(existing!=null) e=existing.getAnnotation();
|
||||
|
||||
return new AnnotationImpl( parser.getResult(e),locator);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,535 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
|
||||
import com.sun.xml.internal.bind.WhiteSpaceProcessor;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
class attributeDeclBody extends NGCCHandler {
|
||||
private String name;
|
||||
private ForeignAttributesImpl fa;
|
||||
private AnnotationImpl annotation;
|
||||
private Locator locator;
|
||||
private boolean isLocal;
|
||||
private String defaultValue;
|
||||
private UName typeName;
|
||||
private String fixedValue;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public attributeDeclBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator, boolean _isLocal, String _defaultValue, String _fixedValue) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
this.locator = _locator;
|
||||
this.isLocal = _isLocal;
|
||||
this.defaultValue = _defaultValue;
|
||||
this.fixedValue = _fixedValue;
|
||||
$_ngcc_current_state = 13;
|
||||
}
|
||||
|
||||
public attributeDeclBody(NGCCRuntimeEx runtime, Locator _locator, boolean _isLocal, String _defaultValue, String _fixedValue) {
|
||||
this(null, runtime, runtime, -1, _locator, _isLocal, _defaultValue, _fixedValue);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
type = new DelayedRef.SimpleType(
|
||||
$runtime, locator, $runtime.currentSchema, typeName );
|
||||
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
formSpecified = true;
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 388, null,AnnotationContext.ATTRIBUTE_DECL);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || ((($ai = $runtime.getAttributeIndex("","type"))>=0 && (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","form"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 12;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","type"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
|
||||
NGCCHandler h = new simpleType(this, super._source, $runtime, 379);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","type"))>=0) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","form"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 12;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","type"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
$_ngcc_current_state = 11;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("type"))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("form"))) {
|
||||
$_ngcc_current_state = 15;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 12;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("type"))) {
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("form"))) {
|
||||
$_ngcc_current_state = 12;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
$_ngcc_current_state = 9;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa);
|
||||
spawnChildFromLeaveAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
$_ngcc_current_state = 12;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("type"))) {
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(makeResult(), super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","type"))>=0) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
else {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","form"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 12;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
if($value.equals("unqualified")) {
|
||||
NGCCHandler h = new qualification(this, super._source, $runtime, 395);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
else {
|
||||
if($value.equals("qualified")) {
|
||||
NGCCHandler h = new qualification(this, super._source, $runtime, 395);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","type"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
name = WhiteSpaceProcessor.collapse($value);
|
||||
$_ngcc_current_state = 10;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
NGCCHandler h = new qname(this, super._source, $runtime, 381);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 388:
|
||||
{
|
||||
annotation = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
case 379:
|
||||
{
|
||||
type = ((SimpleTypeImpl)$__result__);
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
break;
|
||||
case 390:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
$_ngcc_current_state = 7;
|
||||
}
|
||||
break;
|
||||
case 395:
|
||||
{
|
||||
form = ((Boolean)$__result__).booleanValue();
|
||||
action1();
|
||||
$_ngcc_current_state = 14;
|
||||
}
|
||||
break;
|
||||
case 381:
|
||||
{
|
||||
typeName = ((UName)$__result__);
|
||||
action0();
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return((($_ngcc_current_state == 0) || (($_ngcc_current_state == 1) || ($_ngcc_current_state == 7))));
|
||||
}
|
||||
|
||||
|
||||
private boolean form;
|
||||
private boolean formSpecified = false;
|
||||
|
||||
private AttributeDeclImpl makeResult() {
|
||||
|
||||
if(type==null)
|
||||
// type defaults to anySimpleType
|
||||
type = $runtime.parser.schemaSet.anySimpleType;
|
||||
|
||||
if(!formSpecified) form = $runtime.attributeFormDefault;
|
||||
// global attributes are always qualified
|
||||
if(!isLocal) form = true;
|
||||
|
||||
String tns;
|
||||
if(form==true) tns = $runtime.currentSchema.getTargetNamespace();
|
||||
else tns = "";
|
||||
|
||||
// proper handling of anonymous types
|
||||
return new AttributeDeclImpl( $runtime.document, tns, name,
|
||||
annotation, locator, fa, isLocal,
|
||||
$runtime.createXmlString(defaultValue),
|
||||
$runtime.createXmlString(fixedValue),
|
||||
type );
|
||||
}
|
||||
private Ref.SimpleType type;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,451 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import com.sun.xml.internal.bind.WhiteSpaceProcessor;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
class attributeGroupDecl extends NGCCHandler {
|
||||
private AnnotationImpl annotation;
|
||||
private String name;
|
||||
private ForeignAttributesImpl fa;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public attributeGroupDecl(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
$_ngcc_current_state = 14;
|
||||
}
|
||||
|
||||
public attributeGroupDecl(NGCCRuntimeEx runtime) {
|
||||
this(null, runtime, runtime, -1);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
result = new AttGroupDeclImpl(
|
||||
$runtime.document, annotation, locator, fa, name );
|
||||
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
locator=$runtime.copyLocator();
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 6:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute")))))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 246, fa);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","id"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 6;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
action0();
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute"))))) {
|
||||
NGCCHandler h = new attributeUses(this, super._source, $runtime, 241, result);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action1();
|
||||
$_ngcc_current_state = 13;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 244, null,AnnotationContext.ATTRIBUTE_GROUP);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 3;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 6:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 246, fa);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","id"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 6;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
action0();
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
|
||||
NGCCHandler h = new attributeUses(this, super._source, $runtime, 241, result);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 3;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 13:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
$_ngcc_current_state = 12;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("id"))) {
|
||||
$_ngcc_current_state = 9;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 6;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
action0();
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 3;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
$_ngcc_current_state = 6;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
action0();
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("id"))) {
|
||||
$_ngcc_current_state = 6;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
$_ngcc_current_state = 7;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 3;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 13:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(result, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","id"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 6;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
name = WhiteSpaceProcessor.collapse($value);
|
||||
$_ngcc_current_state = 11;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
$_ngcc_current_state = 8;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
action0();
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 3;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 241:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
case 246:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
break;
|
||||
case 244:
|
||||
{
|
||||
annotation = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
private AttGroupDeclImpl result;
|
||||
private Locator locator;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,962 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
class attributeUses extends NGCCHandler {
|
||||
private String use;
|
||||
private AttributesHolder owner;
|
||||
private ForeignAttributesImpl fa;
|
||||
private WildcardImpl wildcard;
|
||||
private AnnotationImpl annotation;
|
||||
private UName attDeclName;
|
||||
private AttributeDeclImpl anonymousDecl;
|
||||
private String defaultValue;
|
||||
private String fixedValue;
|
||||
private UName groupName;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public attributeUses(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, AttributesHolder _owner) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
this.owner = _owner;
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
|
||||
public attributeUses(NGCCRuntimeEx runtime, AttributesHolder _owner) {
|
||||
this(null, runtime, runtime, -1, _owner);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
owner.setWildcard(wildcard);
|
||||
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
wloc = $runtime.copyLocator();
|
||||
}
|
||||
|
||||
private void action2()throws SAXException {
|
||||
|
||||
owner.addAttGroup(new DelayedRef.AttGroup(
|
||||
$runtime, locator, $runtime.currentSchema, groupName ));
|
||||
|
||||
}
|
||||
|
||||
private void action3()throws SAXException {
|
||||
locator=$runtime.copyLocator();
|
||||
}
|
||||
|
||||
private void action4()throws SAXException {
|
||||
|
||||
if("prohibited".equals(use))
|
||||
owner.addProhibitedAttribute(attDeclName);
|
||||
else
|
||||
owner.addAttributeUse(attDeclName,
|
||||
new AttributeUseImpl( $runtime.document, annotation,locator,fa,decl,
|
||||
$runtime.createXmlString(defaultValue),
|
||||
$runtime.createXmlString(fixedValue),
|
||||
"required".equals(use)));
|
||||
|
||||
}
|
||||
|
||||
private void action5()throws SAXException {
|
||||
|
||||
decl = new DelayedRef.Attribute(
|
||||
$runtime, locator, $runtime.currentSchema, attDeclName );
|
||||
|
||||
}
|
||||
|
||||
private void action6()throws SAXException {
|
||||
|
||||
decl = anonymousDecl;
|
||||
attDeclName = new UName(
|
||||
anonymousDecl.getTargetNamespace(),
|
||||
anonymousDecl.getName());
|
||||
defaultValue = null;
|
||||
fixedValue = null;
|
||||
|
||||
}
|
||||
|
||||
private void action7()throws SAXException {
|
||||
|
||||
locator=$runtime.copyLocator();
|
||||
use=null;
|
||||
defaultValue=null;
|
||||
fixedValue=null;
|
||||
decl=null;
|
||||
annotation=null;
|
||||
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action7();
|
||||
$_ngcc_current_state = 33;
|
||||
}
|
||||
else {
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action3();
|
||||
$_ngcc_current_state = 13;
|
||||
}
|
||||
else {
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action1();
|
||||
$_ngcc_current_state = 3;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
action2();
|
||||
$_ngcc_current_state = 7;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($ai = $runtime.getAttributeIndex("","namespace"))>=0 || ($ai = $runtime.getAttributeIndex("","processContents"))>=0))) {
|
||||
NGCCHandler h = new wildcardBody(this, super._source, $runtime, 290, wloc);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
if((($ai = $runtime.getAttributeIndex("","name"))>=0 || ($ai = $runtime.getAttributeIndex("","form"))>=0)) {
|
||||
NGCCHandler h = new attributeDeclBody(this, super._source, $runtime, 315, locator,true,defaultValue,fixedValue);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
if(($ai = $runtime.getAttributeIndex("","ref"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","use"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 29;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","fixed"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 17;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 29:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","default"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 25;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 297, null,AnnotationContext.ATTRIBUTE_USE);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 8;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
action4();
|
||||
$_ngcc_current_state = 15;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action7();
|
||||
$_ngcc_current_state = 33;
|
||||
}
|
||||
else {
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action3();
|
||||
$_ngcc_current_state = 13;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","ref"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 308, null,AnnotationContext.ATTRIBUTE_USE);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 18;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
action2();
|
||||
$_ngcc_current_state = 7;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if(((($ai = $runtime.getAttributeIndex("","namespace"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute"))) || ((($ai = $runtime.getAttributeIndex("","processContents"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute"))))) {
|
||||
NGCCHandler h = new wildcardBody(this, super._source, $runtime, 290, wloc);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
if(((($ai = $runtime.getAttributeIndex("","name"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute"))) || (($ai = $runtime.getAttributeIndex("","form"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute"))))) {
|
||||
NGCCHandler h = new attributeDeclBody(this, super._source, $runtime, 315, locator,true,defaultValue,fixedValue);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
if(($ai = $runtime.getAttributeIndex("","ref"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","use"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 29;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","fixed"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 17;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 29:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","default"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 25;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
$_ngcc_current_state = 8;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
action4();
|
||||
$_ngcc_current_state = 15;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","ref"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
{
|
||||
$_ngcc_current_state = 18;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute"))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 306, null);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
action2();
|
||||
$_ngcc_current_state = 7;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if((($__uri.equals("") && $__local.equals("namespace")) || ($__uri.equals("") && $__local.equals("processContents")))) {
|
||||
NGCCHandler h = new wildcardBody(this, super._source, $runtime, 290, wloc);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
if((($__uri.equals("") && $__local.equals("name")) || ($__uri.equals("") && $__local.equals("form")))) {
|
||||
NGCCHandler h = new attributeDeclBody(this, super._source, $runtime, 315, locator,true,defaultValue,fixedValue);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
if(($__uri.equals("") && $__local.equals("ref"))) {
|
||||
$_ngcc_current_state = 22;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("use"))) {
|
||||
$_ngcc_current_state = 35;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 29;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("fixed"))) {
|
||||
$_ngcc_current_state = 27;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 17;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 29:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("default"))) {
|
||||
$_ngcc_current_state = 31;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 25;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
$_ngcc_current_state = 8;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
action4();
|
||||
$_ngcc_current_state = 15;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("ref"))) {
|
||||
$_ngcc_current_state = 12;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
{
|
||||
$_ngcc_current_state = 18;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
action2();
|
||||
$_ngcc_current_state = 7;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 34:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("use"))) {
|
||||
$_ngcc_current_state = 29;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 26:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("fixed"))) {
|
||||
$_ngcc_current_state = 17;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("ref"))) {
|
||||
$_ngcc_current_state = 9;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
{
|
||||
$_ngcc_current_state = 29;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 21:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("ref"))) {
|
||||
$_ngcc_current_state = 19;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
{
|
||||
$_ngcc_current_state = 17;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 30:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("default"))) {
|
||||
$_ngcc_current_state = 25;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 29:
|
||||
{
|
||||
$_ngcc_current_state = 25;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
$_ngcc_current_state = 8;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
action4();
|
||||
$_ngcc_current_state = 15;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
{
|
||||
$_ngcc_current_state = 18;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 31:
|
||||
{
|
||||
defaultValue = $value;
|
||||
$_ngcc_current_state = 30;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
action2();
|
||||
$_ngcc_current_state = 7;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","processContents"))>=0) {
|
||||
NGCCHandler h = new wildcardBody(this, super._source, $runtime, 290, wloc);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
else {
|
||||
if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) {
|
||||
NGCCHandler h = new wildcardBody(this, super._source, $runtime, 290, wloc);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","form"))>=0) {
|
||||
NGCCHandler h = new attributeDeclBody(this, super._source, $runtime, 315, locator,true,defaultValue,fixedValue);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
else {
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
NGCCHandler h = new attributeDeclBody(this, super._source, $runtime, 315, locator,true,defaultValue,fixedValue);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
else {
|
||||
if(($ai = $runtime.getAttributeIndex("","ref"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","use"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 29;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","fixed"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 17;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 22:
|
||||
{
|
||||
NGCCHandler h = new qname(this, super._source, $runtime, 311);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
break;
|
||||
case 29:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","default"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 25;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
NGCCHandler h = new qname(this, super._source, $runtime, 300);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
break;
|
||||
case 35:
|
||||
{
|
||||
use = $value;
|
||||
$_ngcc_current_state = 34;
|
||||
}
|
||||
break;
|
||||
case 27:
|
||||
{
|
||||
fixedValue = $value;
|
||||
$_ngcc_current_state = 26;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
$_ngcc_current_state = 8;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
action4();
|
||||
$_ngcc_current_state = 15;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","ref"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
{
|
||||
$_ngcc_current_state = 18;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(this, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 300:
|
||||
{
|
||||
groupName = ((UName)$__result__);
|
||||
$_ngcc_current_state = 11;
|
||||
}
|
||||
break;
|
||||
case 297:
|
||||
{
|
||||
$_ngcc_current_state = 8;
|
||||
}
|
||||
break;
|
||||
case 306:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
$_ngcc_current_state = 16;
|
||||
}
|
||||
break;
|
||||
case 290:
|
||||
{
|
||||
wildcard = ((WildcardImpl)$__result__);
|
||||
action0();
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
break;
|
||||
case 315:
|
||||
{
|
||||
anonymousDecl = ((AttributeDeclImpl)$__result__);
|
||||
action6();
|
||||
$_ngcc_current_state = 16;
|
||||
}
|
||||
break;
|
||||
case 311:
|
||||
{
|
||||
attDeclName = ((UName)$__result__);
|
||||
action5();
|
||||
$_ngcc_current_state = 21;
|
||||
}
|
||||
break;
|
||||
case 308:
|
||||
{
|
||||
annotation = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 18;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return((($_ngcc_current_state == 0) || (($_ngcc_current_state == 1) || ($_ngcc_current_state == 5))));
|
||||
}
|
||||
|
||||
|
||||
private Ref.Attribute decl;
|
||||
private Locator wloc; // locator for wildcards
|
||||
private Locator locator;
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
class complexType_complexContent_body extends NGCCHandler {
|
||||
private AttributesHolder owner;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public complexType_complexContent_body(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, AttributesHolder _owner) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
this.owner = _owner;
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
|
||||
public complexType_complexContent_body(NGCCRuntimeEx runtime, AttributesHolder _owner) {
|
||||
this(null, runtime, runtime, -1, _owner);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
if(particle==null)
|
||||
particle = $runtime.parser.schemaSet.empty;
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute"))))) {
|
||||
NGCCHandler h = new attributeUses(this, super._source, $runtime, 1, owner);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
NGCCHandler h = new attributeUses(this, super._source, $runtime, 1, owner);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(particle, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("element")) || (((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("any")))))) {
|
||||
NGCCHandler h = new particle(this, super._source, $runtime, 3);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
NGCCHandler h = new attributeUses(this, super._source, $runtime, 1, owner);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(particle, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
NGCCHandler h = new attributeUses(this, super._source, $runtime, 1, owner);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(particle, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
NGCCHandler h = new attributeUses(this, super._source, $runtime, 1, owner);
|
||||
spawnChildFromLeaveAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(particle, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
NGCCHandler h = new attributeUses(this, super._source, $runtime, 1, owner);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(particle, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 1:
|
||||
{
|
||||
action0();
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
particle = ((ParticleImpl)$__result__);
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
private ContentTypeImpl particle;
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
class erSet extends NGCCHandler {
|
||||
private String v;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public erSet(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
|
||||
public erSet(NGCCRuntimeEx runtime) {
|
||||
this(null, runtime, runtime, -1);
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(makeResult(), super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
v = $value;
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
private Integer makeResult() {
|
||||
if(v==null) return new Integer($runtime.finalDefault);
|
||||
|
||||
if(v.indexOf("#all")!=-1)
|
||||
return new Integer(XSType.EXTENSION|XSType.RESTRICTION);
|
||||
|
||||
int r = 0;
|
||||
|
||||
if(v.indexOf("extension")!=-1) r|=XSType.EXTENSION;
|
||||
if(v.indexOf("restriction")!=-1) r|=XSType.RESTRICTION;
|
||||
|
||||
return new Integer(r);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
class ersSet extends NGCCHandler {
|
||||
private String v;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public ersSet(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
|
||||
public ersSet(NGCCRuntimeEx runtime) {
|
||||
this(null, runtime, runtime, -1);
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(makeResult(), super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
v = $value;
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
private Integer makeResult() {
|
||||
if(v==null) return new Integer($runtime.blockDefault);
|
||||
|
||||
if(v.indexOf("#all")!=-1)
|
||||
return new Integer(
|
||||
XSType.EXTENSION|XSType.RESTRICTION|XSType.SUBSTITUTION);
|
||||
|
||||
int r = 0;
|
||||
|
||||
if(v.indexOf("extension")!=-1) r|=XSType.EXTENSION;
|
||||
if(v.indexOf("restriction")!=-1) r|=XSType.RESTRICTION;
|
||||
if(v.indexOf("substitution")!=-1) r|=XSType.SUBSTITUTION;
|
||||
|
||||
return new Integer(r);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,401 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
class facet extends NGCCHandler {
|
||||
private AnnotationImpl annotation;
|
||||
private String fixed;
|
||||
private String value;
|
||||
private ForeignAttributesImpl fa;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public facet(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
$_ngcc_current_state = 12;
|
||||
}
|
||||
|
||||
public facet(NGCCRuntimeEx runtime) {
|
||||
this(null, runtime, runtime, -1);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
result = new FacetImpl( $runtime.document,
|
||||
annotation, locator, fa, $localName/*name of the facet*/,
|
||||
$runtime.createXmlString(value), $runtime.parseBoolean(fixed) );
|
||||
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
locator=$runtime.copyLocator();
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 12:
|
||||
{
|
||||
if((((((((((((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minExclusive")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxExclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("totalDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("fractionDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("length"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("enumeration"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("whiteSpace"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("pattern")))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action1();
|
||||
$_ngcc_current_state = 11;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 230, fa);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","fixed"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","value"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 228, null,AnnotationContext.SIMPLETYPE_DECL);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 4:
|
||||
{
|
||||
if((((((((((((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minExclusive")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxExclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("totalDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("fractionDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("length"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("enumeration"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("whiteSpace"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("pattern")))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 230, fa);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","fixed"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if((((((((((((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minExclusive")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxExclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxInclusive"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("totalDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("fractionDigits"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("length"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("maxLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("minLength"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("enumeration"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("whiteSpace"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("pattern")))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
action0();
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","value"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 5:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("fixed"))) {
|
||||
$_ngcc_current_state = 7;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("value"))) {
|
||||
$_ngcc_current_state = 10;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 5:
|
||||
{
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("value"))) {
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("fixed"))) {
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 5:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","fixed"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
fixed = $value;
|
||||
$_ngcc_current_state = 6;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","value"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
value = $value;
|
||||
$_ngcc_current_state = 9;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(result, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 230:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
break;
|
||||
case 228:
|
||||
{
|
||||
annotation = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
private FacetImpl result;
|
||||
private Locator locator;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
class foreignAttributes extends NGCCHandler {
|
||||
private ForeignAttributesImpl current;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public foreignAttributes(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, ForeignAttributesImpl _current) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
this.current = _current;
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
|
||||
public foreignAttributes(NGCCRuntimeEx runtime, ForeignAttributesImpl _current) {
|
||||
this(null, runtime, runtime, -1, _current);
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(makeResult(), super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
ForeignAttributesImpl makeResult() {
|
||||
return $runtime.parseForeignAttributes(current);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,444 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
|
||||
import com.sun.xml.internal.bind.WhiteSpaceProcessor;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
class group extends NGCCHandler {
|
||||
private AnnotationImpl annotation;
|
||||
private String name;
|
||||
private ModelGroupImpl term;
|
||||
private ForeignAttributesImpl fa;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public group(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
$_ngcc_current_state = 15;
|
||||
}
|
||||
|
||||
public group(NGCCRuntimeEx runtime) {
|
||||
this(null, runtime, runtime, -1);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
result = new ModelGroupDeclImpl( $runtime.document,
|
||||
annotation, loc, fa,
|
||||
$runtime.currentSchema.getTargetNamespace(),
|
||||
name,
|
||||
term
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
|
||||
mloc = $runtime.copyLocator();
|
||||
compositorName = $localName;
|
||||
|
||||
}
|
||||
|
||||
private void action2()throws SAXException {
|
||||
loc = $runtime.copyLocator();
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 10:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 357, null);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 10;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 359, null,AnnotationContext.MODELGROUP_DECL);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 5;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
$_ngcc_current_state = 3;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action2();
|
||||
$_ngcc_current_state = 11;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("element")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("any")) || ((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))))))) {
|
||||
NGCCHandler h = new modelGroupBody(this, super._source, $runtime, 355, mloc,compositorName);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 10:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 10;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
action0();
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
$_ngcc_current_state = 5;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
|
||||
NGCCHandler h = new modelGroupBody(this, super._source, $runtime, 355, mloc,compositorName);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 10:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
$_ngcc_current_state = 9;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("ID"))) {
|
||||
$_ngcc_current_state = 13;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 10;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
$_ngcc_current_state = 5;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 11:
|
||||
{
|
||||
$_ngcc_current_state = 10;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
$_ngcc_current_state = 5;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("ID"))) {
|
||||
$_ngcc_current_state = 10;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
$_ngcc_current_state = 6;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 10:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 10;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
$_ngcc_current_state = 5;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(result, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
name = WhiteSpaceProcessor.collapse($value);
|
||||
$_ngcc_current_state = 8;
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
$_ngcc_current_state = 12;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 357:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
action1();
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
break;
|
||||
case 359:
|
||||
{
|
||||
annotation = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
break;
|
||||
case 355:
|
||||
{
|
||||
term = ((ModelGroupImpl)$__result__);
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
private ModelGroupDeclImpl result;
|
||||
private Locator loc,mloc;
|
||||
private String compositorName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,590 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
|
||||
import com.sun.xml.internal.bind.WhiteSpaceProcessor;
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
class identityConstraint extends NGCCHandler {
|
||||
private String name;
|
||||
private UName ref;
|
||||
private ForeignAttributesImpl fa;
|
||||
private AnnotationImpl ann;
|
||||
private XPathImpl field;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public identityConstraint(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
$_ngcc_current_state = 18;
|
||||
}
|
||||
|
||||
public identityConstraint(NGCCRuntimeEx runtime) {
|
||||
this(null, runtime, runtime, -1);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
fields.add(field);
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
|
||||
refer = new DelayedRef.IdentityConstraint(
|
||||
$runtime, $runtime.copyLocator(), $runtime.currentSchema, ref );
|
||||
|
||||
}
|
||||
|
||||
private void action2()throws SAXException {
|
||||
if($localName.equals("key"))
|
||||
category = XSIdentityConstraint.KEY;
|
||||
else
|
||||
if($localName.equals("keyref"))
|
||||
category = XSIdentityConstraint.KEYREF;
|
||||
else
|
||||
if($localName.equals("unique"))
|
||||
category = XSIdentityConstraint.UNIQUE;
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 16:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("field"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
$_ngcc_current_state = 3;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
if((($ai = $runtime.getAttributeIndex("","name"))>=0 && (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("selector")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 287, null);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("selector"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
$_ngcc_current_state = 6;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
{
|
||||
if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("key")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("keyref"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("unique")))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action2();
|
||||
$_ngcc_current_state = 17;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
|
||||
NGCCHandler h = new xpath(this, super._source, $runtime, 270);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("field"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
$_ngcc_current_state = 3;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 277, null,AnnotationContext.IDENTITY_CONSTRAINT);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 7;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","refer"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 8;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
|
||||
NGCCHandler h = new xpath(this, super._source, $runtime, 274);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 5:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("selector"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("key")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("keyref"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("unique")))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("field"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 287, null);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if((($ai = $runtime.getAttributeIndex("","xpath"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("field")))) {
|
||||
NGCCHandler h = new xpath(this, super._source, $runtime, 270);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
$_ngcc_current_state = 7;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","refer"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 8;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if((($ai = $runtime.getAttributeIndex("","xpath"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("selector")))) {
|
||||
NGCCHandler h = new xpath(this, super._source, $runtime, 274);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 16:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
$_ngcc_current_state = 15;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 287, null);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("xpath"))) {
|
||||
NGCCHandler h = new xpath(this, super._source, $runtime, 270);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
$_ngcc_current_state = 7;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("refer"))) {
|
||||
$_ngcc_current_state = 12;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 8;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("xpath"))) {
|
||||
NGCCHandler h = new xpath(this, super._source, $runtime, 274);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
$_ngcc_current_state = 10;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
$_ngcc_current_state = 7;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
$_ngcc_current_state = 8;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("refer"))) {
|
||||
$_ngcc_current_state = 8;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 15:
|
||||
{
|
||||
name = WhiteSpaceProcessor.collapse($value);
|
||||
$_ngcc_current_state = 14;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(makeResult(), super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
NGCCHandler h = new qname(this, super._source, $runtime, 280);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 287, null);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
|
||||
NGCCHandler h = new xpath(this, super._source, $runtime, 270);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
$_ngcc_current_state = 7;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","refer"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 8;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
|
||||
NGCCHandler h = new xpath(this, super._source, $runtime, 274);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 270:
|
||||
{
|
||||
field = ((XPathImpl)$__result__);
|
||||
action0();
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
break;
|
||||
case 287:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
$_ngcc_current_state = 16;
|
||||
}
|
||||
break;
|
||||
case 280:
|
||||
{
|
||||
ref = ((UName)$__result__);
|
||||
action1();
|
||||
$_ngcc_current_state = 11;
|
||||
}
|
||||
break;
|
||||
case 277:
|
||||
{
|
||||
ann = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 7;
|
||||
}
|
||||
break;
|
||||
case 274:
|
||||
{
|
||||
selector = ((XPathImpl)$__result__);
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
private short category;
|
||||
private List fields = new ArrayList();
|
||||
private XPathImpl selector;
|
||||
private DelayedRef.IdentityConstraint refer = null;
|
||||
|
||||
private IdentityConstraintImpl makeResult() {
|
||||
return new IdentityConstraintImpl($runtime.document,ann,$runtime.copyLocator(),fa,
|
||||
category,name,selector,fields,refer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,374 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
class importDecl extends NGCCHandler {
|
||||
private String ns;
|
||||
private String schemaLocation;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public importDecl(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
$_ngcc_current_state = 12;
|
||||
}
|
||||
|
||||
public importDecl(NGCCRuntimeEx runtime) {
|
||||
this(null, runtime, runtime, -1);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
if(ns==null) ns="";
|
||||
$runtime.importSchema( ns,schemaLocation );
|
||||
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 4:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("import"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
$_ngcc_current_state = 8;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 340, null,AnnotationContext.SCHEMA);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 4:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("import"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
action0();
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 4:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("schemaLocation"))) {
|
||||
$_ngcc_current_state = 6;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("namespace"))) {
|
||||
$_ngcc_current_state = 10;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 9:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("namespace"))) {
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("schemaLocation"))) {
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 4:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
ns = $value;
|
||||
$_ngcc_current_state = 9;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(this, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
schemaLocation = $value;
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 340:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
|
||||
class includeDecl extends NGCCHandler {
|
||||
private String schemaLocation;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public includeDecl(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
$_ngcc_current_state = 7;
|
||||
}
|
||||
|
||||
public includeDecl(NGCCRuntimeEx runtime) {
|
||||
this(null, runtime, runtime, -1);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
$runtime.includeSchema( schemaLocation );
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 372, null,AnnotationContext.SCHEMA);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("include"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
$_ngcc_current_state = 6;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("include"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
action0();
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("schemaLocation"))) {
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("schemaLocation"))) {
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(this, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
schemaLocation = $value;
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 372:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
class modelGroupBody extends NGCCHandler {
|
||||
private AnnotationImpl annotation;
|
||||
private String compositorName;
|
||||
private Locator locator;
|
||||
private ParticleImpl childParticle;
|
||||
private ForeignAttributesImpl fa;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public modelGroupBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator, String _compositorName) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
this.locator = _locator;
|
||||
this.compositorName = _compositorName;
|
||||
$_ngcc_current_state = 6;
|
||||
}
|
||||
|
||||
public modelGroupBody(NGCCRuntimeEx runtime, Locator _locator, String _compositorName) {
|
||||
this(null, runtime, runtime, -1, _locator, _compositorName);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
|
||||
XSModelGroup.Compositor compositor = null;
|
||||
if(compositorName.equals("all")) compositor = XSModelGroup.ALL;
|
||||
if(compositorName.equals("sequence")) compositor = XSModelGroup.SEQUENCE;
|
||||
if(compositorName.equals("choice")) compositor = XSModelGroup.CHOICE;
|
||||
if(compositor==null)
|
||||
throw new InternalError("unable to process "+compositorName);
|
||||
|
||||
result = new ModelGroupImpl( $runtime.document, annotation, locator, fa, compositor,
|
||||
(ParticleImpl[])particles.toArray(new ParticleImpl[0]));
|
||||
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
|
||||
particles.add(childParticle);
|
||||
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 174, null,AnnotationContext.MODELGROUP);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("element")) || (((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("any")))))) {
|
||||
NGCCHandler h = new particle(this, super._source, $runtime, 171);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("element")) || (((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("any"))))))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("element")) || (((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("any")))))) {
|
||||
NGCCHandler h = new particle(this, super._source, $runtime, 170);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
action0();
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
action0();
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
action0();
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
|
||||
spawnChildFromLeaveAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
action0();
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(result, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
action0();
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 174:
|
||||
{
|
||||
annotation = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
break;
|
||||
case 176:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
break;
|
||||
case 171:
|
||||
{
|
||||
childParticle = ((ParticleImpl)$__result__);
|
||||
action1();
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
case 170:
|
||||
{
|
||||
childParticle = ((ParticleImpl)$__result__);
|
||||
action1();
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return((($_ngcc_current_state == 1) || (($_ngcc_current_state == 2) || (($_ngcc_current_state == 4) || ($_ngcc_current_state == 0)))));
|
||||
}
|
||||
|
||||
|
||||
private ModelGroupImpl result;
|
||||
|
||||
private final List particles = new ArrayList();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,477 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
|
||||
import com.sun.xml.internal.bind.WhiteSpaceProcessor;
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
class notation extends NGCCHandler {
|
||||
private String name;
|
||||
private String pub;
|
||||
private ForeignAttributesImpl fa;
|
||||
private String sys;
|
||||
private AnnotationImpl ann;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public notation(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
$_ngcc_current_state = 16;
|
||||
}
|
||||
|
||||
public notation(NGCCRuntimeEx runtime) {
|
||||
this(null, runtime, runtime, -1);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
loc = $runtime.copyLocator();
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
|
||||
NGCCHandler h = new annotation(this, super._source, $runtime, 209, null,AnnotationContext.NOTATION);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("notation"))) {
|
||||
$runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
|
||||
action0();
|
||||
$_ngcc_current_state = 15;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
if((($ai = $runtime.getAttributeIndex("","name"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 224, null);
|
||||
spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","system"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","public"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
if((($ai = $runtime.getAttributeIndex("","name"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("notation")))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 224, null);
|
||||
spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","system"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("notation"))) {
|
||||
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","public"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
$_ngcc_current_state = 13;
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 224, null);
|
||||
spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("system"))) {
|
||||
$_ngcc_current_state = 6;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("public"))) {
|
||||
$_ngcc_current_state = 10;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("public"))) {
|
||||
$_ngcc_current_state = 4;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("name"))) {
|
||||
$_ngcc_current_state = 8;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("system"))) {
|
||||
$_ngcc_current_state = 2;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 2:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
pub = $value;
|
||||
$_ngcc_current_state = 9;
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
|
||||
NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 224, null);
|
||||
spawnChildFromText(h, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","system"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 2;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","public"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 4;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
{
|
||||
name = WhiteSpaceProcessor.collapse($value);
|
||||
$_ngcc_current_state = 12;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
sys = $value;
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(makeResult(), super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
case 209:
|
||||
{
|
||||
ann = ((AnnotationImpl)$__result__);
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
break;
|
||||
case 224:
|
||||
{
|
||||
fa = ((ForeignAttributesImpl)$__result__);
|
||||
$_ngcc_current_state = 14;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return(($_ngcc_current_state == 0));
|
||||
}
|
||||
|
||||
|
||||
private Locator loc;
|
||||
private XSNotation makeResult() {
|
||||
return new NotationImpl( $runtime.document,ann,loc,fa,name,pub,sys);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* this file is generated by RelaxNGCC */
|
||||
package com.sun.xml.internal.xsom.impl.parser.state;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.Attributes;
|
||||
import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
|
||||
|
||||
import com.sun.xml.internal.xsom.*;
|
||||
import com.sun.xml.internal.xsom.parser.*;
|
||||
import com.sun.xml.internal.xsom.impl.*;
|
||||
import com.sun.xml.internal.xsom.impl.parser.*;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.helpers.*;
|
||||
import java.util.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
class occurs extends NGCCHandler {
|
||||
private String v;
|
||||
protected final NGCCRuntimeEx $runtime;
|
||||
private int $_ngcc_current_state;
|
||||
protected String $uri;
|
||||
protected String $localName;
|
||||
protected String $qname;
|
||||
|
||||
public final NGCCRuntime getRuntime() {
|
||||
return($runtime);
|
||||
}
|
||||
|
||||
public occurs(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
|
||||
super(source, parent, cookie);
|
||||
$runtime = runtime;
|
||||
$_ngcc_current_state = 5;
|
||||
}
|
||||
|
||||
public occurs(NGCCRuntimeEx runtime) {
|
||||
this(null, runtime, runtime, -1);
|
||||
}
|
||||
|
||||
private void action0()throws SAXException {
|
||||
min = new BigInteger(v);
|
||||
}
|
||||
|
||||
private void action1()throws SAXException {
|
||||
max=BigInteger.valueOf(-1);
|
||||
}
|
||||
|
||||
private void action2()throws SAXException {
|
||||
max = new BigInteger(v);
|
||||
}
|
||||
|
||||
public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","minOccurs"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","maxOccurs"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","minOccurs"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","maxOccurs"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveElement($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("minOccurs"))) {
|
||||
$_ngcc_current_state = 3;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("maxOccurs"))) {
|
||||
$_ngcc_current_state = 7;
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedEnterAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
|
||||
int $ai;
|
||||
$uri = $__uri;
|
||||
$localName = $__local;
|
||||
$qname = $__qname;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("minOccurs"))) {
|
||||
$_ngcc_current_state = 0;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
if(($__uri.equals("") && $__local.equals("maxOccurs"))) {
|
||||
$_ngcc_current_state = 1;
|
||||
}
|
||||
else {
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
unexpectedLeaveAttribute($__qname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String $value) throws SAXException {
|
||||
int $ai;
|
||||
switch($_ngcc_current_state) {
|
||||
case 1:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","minOccurs"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 0;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
revertToParentFromText(this, super._cookie, $value);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
v = $value;
|
||||
$_ngcc_current_state = 2;
|
||||
action0();
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
if(($ai = $runtime.getAttributeIndex("","maxOccurs"))>=0) {
|
||||
$runtime.consumeAttribute($ai);
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
else {
|
||||
$_ngcc_current_state = 1;
|
||||
$runtime.sendText(super._cookie, $value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if($value.equals("unbounded")) {
|
||||
$_ngcc_current_state = 6;
|
||||
action1();
|
||||
}
|
||||
else {
|
||||
v = $value;
|
||||
$_ngcc_current_state = 6;
|
||||
action2();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
|
||||
switch($__cookie__) {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return((($_ngcc_current_state == 5) || (($_ngcc_current_state == 0) || ($_ngcc_current_state == 1))));
|
||||
}
|
||||
|
||||
|
||||
BigInteger max = BigInteger.valueOf(1);
|
||||
BigInteger min = BigInteger.valueOf(1);
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user