本文整理汇总了Java中org.apache.xerces.xs.XSObject类的典型用法代码示例。如果您正苦于以下问题:Java XSObject类的具体用法?Java XSObject怎么用?Java XSObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSObject类属于org.apache.xerces.xs包,在下文中一共展示了XSObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNode
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* Returns a schema element XSElementDeclaration with the given local name. (This method is not namespace aware).
*
* @param localName the local name of the node to fine.
* @return the schema element or null if there is no such named element.
*/
public XSElementDeclaration getNode(String localName) {
if (null == localName || 0 == localName.trim().length()) {
return null;
}
XSNamedMap map = schemaModel.getComponents(XSConstants.ELEMENT_DECLARATION);
if (null != map) {
for (int i = 0; i < map.getLength(); i++) {
XSObject item = map.item(i);
if (item instanceof XSElementDeclaration) {
if (localName.equals(item.getName())) {
return (XSElementDeclaration) item;
}
}
}
}
return null;
}
示例2: getSchemaElement
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* Gets an XSObject representing the named schema element.
*
* @param nodeName the name of the schema element.
*
* @return the named schema element.
*/
protected XSObject getSchemaElement(String nodeName) throws Exception {
List<XSElementDeclaration> namedNodes = new ArrayList<XSElementDeclaration>();
namedNodes.add(getNode(nodeName));
if (0 < namedNodes.size()) {
if (1 < namedNodes.size()) {
log.debug("Multiple nodes of the name '" + nodeName
+ "' found in getSchemaElement() method. Returning the last in the list.");
}
return namedNodes.get(namedNodes.size()-1);
}
else if (namedNodes.isEmpty()) {
log.warn("No element named '" + nodeName + "' was found in the schema declaration");
}
return null;
}
示例3: getNode
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* Get an XSElementDeclaration for a named element.
*
* @param nodeName the name of a node.
*
* @return the element XSElementDeclaration.
*/
protected XSElementDeclaration getNode(String nodeName) {
XSNamedMap map = xsModel.getComponents(XSConstants.ELEMENT_DECLARATION);
if (map.getLength() != 0) {
for (int i = 0; i < map.getLength(); i++) {
XSObject item = map.item(i);
if (item instanceof XSElementDeclaration) {
String nextName = item.getName();
if (nextName.equals(nodeName)) {
return (XSElementDeclaration) item;
}
}
}
}
return null;
}
示例4: expandComponents
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
private Vector expandComponents(XSObject[] components, Hashtable dependencies) {
Vector newComponents = new Vector();
for (int i=0; i<components.length; i++) {
if (!newComponents.contains(components[i])) {
newComponents.add(components[i]);
}
}
for (int i=0; i<newComponents.size(); i++) {
final XSObject component = (XSObject) newComponents.elementAt(i);
expandRelatedComponents(component, newComponents, dependencies);
}
return newComponents;
}
示例5: expandRelatedComponents
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
private void expandRelatedComponents(XSObject component, Vector componentList, Hashtable dependencies) {
short componentType = component.getType();
switch (componentType) {
case XSConstants.TYPE_DEFINITION :
expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
break;
case XSConstants.ATTRIBUTE_DECLARATION :
expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
break;
case XSConstants.ATTRIBUTE_GROUP :
expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
case XSConstants.ELEMENT_DECLARATION :
expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
break;
case XSConstants.MODEL_GROUP_DEFINITION :
expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
case XSConstants.ATTRIBUTE_USE :
//expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
case XSConstants.NOTATION_DECLARATION :
case XSConstants.IDENTITY_CONSTRAINT :
default :
break;
}
}
示例6: getGlobalElements
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
private XSObjectListImpl getGlobalElements() {
final SymbolHash[] tables = new SymbolHash[fGrammarCount];
int length = 0;
for (int i = 0; i < fGrammarCount; i++) {
tables[i] = fGrammarList[i].fAllGlobalElemDecls;
length += tables[i].getLength();
}
if (length == 0) {
return XSObjectListImpl.EMPTY_LIST;
}
final XSObject[] components = new XSObject[length];
int start = 0;
for (int i = 0; i < fGrammarCount; i++) {
tables[i].getValues(components, start);
start += tables[i].getLength();
}
return new XSObjectListImpl(components, length);
}
示例7: XSNamedMapImpl
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* Construct an XSNamedMap implementation one namespace from an array
*
* @param array containing all components
* @param length number of components
*/
public XSNamedMapImpl(XSObject[] array, int length) {
if (length == 0) {
fNamespaces = null;
fMaps = null;
fNSNum = 0;
fArray = array;
fLength = 0;
return;
}
// because all components are from the same target namesapce,
// get the namespace from the first one.
fNamespaces = new String[]{array[0].getNamespace()};
fMaps = null;
fNSNum = 1;
// copy elements to the Vector
fArray = array;
fLength = length;
}
示例8: itemByName
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* Retrieves an <code>XSObject</code> specified by local name and
* namespace URI.
* <br>Per XML Namespaces, applications must use the value <code>null</code> as the
* <code>namespace</code> parameter for methods if they wish to specify
* no namespace.
* @param namespace The namespace URI of the <code>XSObject</code> to
* retrieve, or <code>null</code> if the <code>XSObject</code> has no
* namespace.
* @param localName The local name of the <code>XSObject</code> to
* retrieve.
* @return A <code>XSObject</code> (of any type) with the specified local
* name and namespace URI, or <code>null</code> if they do not
* identify any object in this map.
*/
public XSObject itemByName(String namespace, String localName) {
for (int i = 0; i < fNSNum; i++) {
if (isEqual(namespace, fNamespaces[i])) {
// when this map is created from SymbolHash's
// get the component from SymbolHash
if (fMaps != null) {
return (XSObject)fMaps[i].get(localName);
}
// Otherwise (it's created from an array)
// go through the array to find a matching name
XSObject ret;
for (int j = 0; j < fLength; j++) {
ret = fArray[j];
if (ret.getName().equals(localName)) {
return ret;
}
}
return null;
}
}
return null;
}
示例9: item
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* Returns the <code>index</code>th item in the collection or
* <code>null</code> if <code>index</code> is greater than or equal to
* the number of objects in the list. The index starts at 0.
* @param index index into the collection.
* @return The <code>XSObject</code> at the <code>index</code>th
* position in the <code>XSObjectList</code>, or <code>null</code> if
* the index specified is not valid.
*/
public synchronized XSObject item(int index) {
if (fArray == null) {
// calculate the total number of elements
getLength();
fArray = new XSObject[fLength];
int pos = 0;
// get components from all SymbolHashes
for (int i = 0; i < fNSNum; i++) {
pos += fMaps[i].getValues(fArray, pos);
}
}
if (index < 0 || index >= fLength) {
return null;
}
return fArray[index];
}
示例10: createID
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
private String createID(XSObject obj) {
String namespace = obj.getNamespace();
String prefix = fNamespaceContext.getPrefix(obj.getNamespace());
String name = obj.getName();
String type = this.translateType(obj.getType());
// must be anonymous
if (name == null) {
name = "anon_" + fAnonNum++;
}
// no namespace
else if (namespace == null || namespace == XMLSymbols.EMPTY_STRING) {
name = name + "." + fAnonNum++;
}
if (namespace == Constants.NS_XMLSCHEMA) {
return name;
}
else {
return (prefix == null ? "" : prefix + ".") + type + "." + name;
}
}
示例11: toDefXmlTagName
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
public static String toDefXmlTagName(XSObject xs) {
String xmlName = xs.getName();
if (xmlName.endsWith(TYPE_SUFFIX)) {
xmlName = xmlName.substring(0, xmlName.length() - 4);
}
return xmlName;
}
示例12: toJavaTypeName
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
public String toJavaTypeName(XSObject xs, Map<String, NamespaceDesc> nsdMap) {
String name = xs.getName();
if (name == null) {
if (xs instanceof TypeInfo) {
name = ((TypeInfo) xs).getTypeName();
if (name != null && name.startsWith("#")) {
name = name.substring(1);
}
}
}
return model.toJavaTypeName(name, xs.getNamespace());
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:13,代码来源:XSDModelLoader.java
示例13: initialise
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* Method to initialise the object.
*
* Builds schema (children) and parent tables
*/
protected void initialise() {
XSNamedMap map = schemaModel.getComponents(XSConstants.ELEMENT_DECLARATION);
if (map.getLength() != 0) {
for (int i = 0; i < map.getLength(); i++) {
XSObject item = map.item(i);
if (item instanceof XSElementDeclaration) {
findReference((XSElementDeclaration) item);
}
}
}
}
示例14: findReferenceInParticle
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* Finds all the element and complexType references for a particle element and populates a map entry with element
* names referenced by the element.
*
* @param context the context.
* @param particle the particle.
*/
private void findReferenceInParticle(String context,
XSParticle particle) {
if (null != particle) {
XSTerm term = particle.getTerm();
if (term instanceof XSModelGroup) {
XSObjectList xsObjectList = ((XSModelGroup) term).getParticles();
for (int i = 0; i < xsObjectList.getLength(); i++) {
XSObject xsObject = xsObjectList.item(i);
if (xsObject instanceof XSParticle) {
findReferenceInParticle(context, (XSParticle) xsObject);
}
}
}
else if (term instanceof XSElementDeclaration) {
String tName = term.getName();
addToSchemaMap(context, tName);
context = tName;
if (currentNodeNames.contains(tName)) {
// cyclic reference
currentNodeNames.add(tName);
findElementReference(context, (XSElementDeclaration) term);
}
else {
currentNodeNames.add(tName);
findElementReference(context, (XSElementDeclaration) term);
}
}
// else { // XSWildcard
// String tName = term.getName();
// if (tName != null) {
// addToSchemaTable(aContext, tName);
// }
// }
}
}
示例15: getRootSchemaElement
import org.apache.xerces.xs.XSObject; //导入依赖的package包/类
/**
* Return a an XSObject representing the root schema element.
*
* @param SchemaModel the schema model as built from schema.
*
* @return the root schema element.
*
* @throws Exception if no root element can be located.
*/
protected XSObject getRootSchemaElement() throws Exception {
if (null != this.xsModel) {
List<XSElementDeclaration> rootNodes = null;
if (nodeChoiceList != null) {
if (soapEnv) {
rootNodes = referenceNodes.getNodes("Envelope");
}
else {
rootNodes = referenceNodes.getRootNodes(nodeChoiceList);
}
}
else {
rootNodes = referenceNodes.getRootNodes();
}
if (null == rootNodes || rootNodes.isEmpty()) {
log.error("Could not identify a root element.");
}
if (0 < rootNodes.size()) {
if (1 < rootNodes.size()) {
log.debug("Warning: Multiple root nodes detected in getRootSchemaElement() method. Returning the last in the list.");
}
return (XSElementDeclaration) rootNodes.get(rootNodes.size()-1);
}
}
return null;
}