public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < getCount(); i++) { xml += getItem(i).toString(prefix, tab); } return xml; } }
public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < getCount(); i++) { xml += getItem(i).toString(prefix, tab); } return xml; } }
public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < getCount(); i++) { xml += getItem(i).toString(prefix, tab); } return xml; } }
public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; xml += "<" + prefix + "sequence>\n"; for (int i = 0; i < items.getCount(); i++) { xml += items.getItem(i).toString(prefix, (tab + 1)); } for (int i = 0; i < tab; i++) xml += "\t"; xml += "</" + prefix + "sequence>\n"; return xml; } }
public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; xml += "<" + prefix + "sequence>\n"; for (int i = 0; i < items.getCount(); i++) { xml += items.getItem(i).toString(prefix, (tab + 1)); } for (int i = 0; i < tab; i++) xml += "\t"; xml += "</" + prefix + "sequence>\n"; return xml; } }
public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; xml += "<" + prefix + "sequence>\n"; for (int i = 0; i < items.getCount(); i++) { xml += items.getItem(i).toString(prefix, (tab + 1)); } for (int i = 0; i < tab; i++) xml += "\t"; xml += "</" + prefix + "sequence>\n"; return xml; } }
void setupAttr(Document doc, XmlSchemaObjectCollection collectionObj, XmlSchema schema, Element container) throws XmlSchemaSerializerException { int collectionLength = collectionObj.getCount(); for (int i = 0; i < collectionLength; i++) { XmlSchemaObject obj = collectionObj.getItem(i); if (obj instanceof XmlSchemaAttribute) { XmlSchemaAttribute attr = (XmlSchemaAttribute) obj; Element attrEl = serializeAttribute(doc, attr, schema); container.appendChild(attrEl); } else if (obj instanceof XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef attr = (XmlSchemaAttributeGroupRef) obj; Element attrEl = serializeAttributeGroupRef(doc, attr, schema); container.appendChild(attrEl); } } }
void setupAttr(Document doc, XmlSchemaObjectCollection collectionObj, XmlSchema schema, Element container) throws XmlSchemaSerializerException { int collectionLength = collectionObj.getCount(); for (int i = 0; i < collectionLength; i++) { XmlSchemaObject obj = collectionObj.getItem(i); if (obj instanceof XmlSchemaAttribute) { XmlSchemaAttribute attr = (XmlSchemaAttribute) obj; Element attrEl = serializeAttribute(doc, attr, schema); container.appendChild(attrEl); } else if (obj instanceof XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef attr = (XmlSchemaAttributeGroupRef) obj; Element attrEl = serializeAttributeGroupRef(doc, attr, schema); container.appendChild(attrEl); } } }
void setupAttr(Document doc, XmlSchemaObjectCollection collectionObj, XmlSchema schema, Element container) throws XmlSchemaSerializerException { int collectionLength = collectionObj.getCount(); for (int i = 0; i < collectionLength; i++) { XmlSchemaObject obj = collectionObj.getItem(i); if (obj instanceof XmlSchemaAttribute) { XmlSchemaAttribute attr = (XmlSchemaAttribute) obj; Element attrEl = serializeAttribute(doc, attr, schema); container.appendChild(attrEl); } else if (obj instanceof XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef attr = (XmlSchemaAttributeGroupRef) obj; Element attrEl = serializeAttributeGroupRef(doc, attr, schema); container.appendChild(attrEl); } } }
public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; String typeName = name != null ? name : ""; xml += "<" + prefix + "complexType name=\"" + typeName + "\">\n"; if (particle != null) xml += particle.toString(prefix, (tab + 1)); if (contentModel != null) xml += contentModel.toString(prefix, (tab + 1)); for (int i = 0; i < attributes.getCount(); i++) { xml += attributes.getItem(i).toString(prefix, (tab + 1)); } for (int i = 0; i < tab; i++) xml += "\t"; xml += "</" + prefix + "complexType>\n"; return xml; }
public String toString(String prefix, int tab) { String xml = new String(); for (int i = 0; i < tab; i++) xml += "\t"; if (!prefix.equals("") && prefix.indexOf(":") == -1) prefix += ":"; String typeName = name != null ? name : ""; xml += "<" + prefix + "complexType name=\"" + typeName + "\">\n"; if (particle != null) xml += particle.toString(prefix, (tab + 1)); if (contentModel != null) xml += contentModel.toString(prefix, (tab + 1)); for (int i = 0; i < attributes.getCount(); i++) { xml += attributes.getItem(i).toString(prefix, (tab + 1)); } for (int i = 0; i < tab; i++) xml += "\t"; xml += "</" + prefix + "complexType>\n"; return xml; }
private static String getResultRowName(XmlSchemaComplexType wrapperSchemaComplexType) { return ((XmlSchemaElement) ((XmlSchemaSequence) wrapperSchemaComplexType .getParticle()).getItems().getItem(0)).getName(); }
private static XmlSchemaComplexType getRowNameBasedSchemaComplexType( XmlSchemaComplexType wrapperSchemaComplexType) { return (((XmlSchemaComplexType) ((XmlSchemaElement) ((XmlSchemaSequence) wrapperSchemaComplexType .getParticle()).getItems().getItem(0)).getSchemaType())); }
/** {@inheritDoc} */ public void processElement(final XmlSchema schema, final XmlSchemaElement xsdElement, final int level) throws XsdMappingException { XmlSchemaAnnotation annotation = xsdElement.getAnnotation(); if (annotation != null && annotation.getItems().getCount() > 0) { XmlSchemaAppInfo appinfo = (XmlSchemaAppInfo) annotation.getItems() .getItem(0); if (appinfo.getMarkup() != null) { for (int i = 0; i < appinfo.getMarkup().getLength(); i++) { Node node = appinfo.getMarkup().item(i); if (node instanceof Element && node.getLocalName().equals(CobolMarkup.ELEMENT) && node.getNamespaceURI().equals(CobolMarkup.NS)) { writeElement(schema, xsdElement, _writer, (Element) node, level); } } } } }
/** * Checks if the specified schema import is existent. * @param schema The target schema to be checked * @param schemaImport The schema import * @return true if the schema import is there in the given schema */ private static boolean containsSchemaImport(XmlSchema schema, XmlSchemaImport schemaImport) { XmlSchemaObjectCollection list = schema.getItems(); int c = list.getCount(); XmlSchemaObject obj; for (int i = 0; i < c; i++) { obj = list.getItem(i); if (obj instanceof XmlSchemaImport) { if (((XmlSchemaImport) obj).getNamespace().equals(schemaImport.getNamespace())) { return true; } } } return false; }
private void findImports(XmlSchema schema, Set<XmlSchema> processedImports, Set<XmlSchema> processedIncludes) { processedImports.add(schema); XmlSchemaObjectCollection includes = schema.getIncludes(); for (int i = 0; i < includes.getCount(); i++) { XmlSchemaExternal external = (XmlSchemaExternal) includes.getItem(i); if (external instanceof XmlSchemaImport) { XmlSchemaImport schemaImport = (XmlSchemaImport) external; XmlSchema importedSchema = schemaImport.getSchema(); if (!"http://www.w3.org/XML/1998/namespace".equals(schemaImport.getNamespace()) && importedSchema != null && !processedImports.contains(importedSchema)) { inlineIncludes(importedSchema, processedIncludes, processedImports); findImports(importedSchema, processedImports, processedIncludes); xmlSchemas.add(importedSchema); } // remove the schemaLocation external.setSchemaLocation(null); } } }
private void inlineIncludes(XmlSchema schema, Set<XmlSchema> processedIncludes, Set<XmlSchema> processedImports) { processedIncludes.add(schema); XmlSchemaObjectCollection schemaItems = schema.getItems(); for (int i = 0; i < schemaItems.getCount(); i++) { XmlSchemaObject schemaObject = schemaItems.getItem(i); if (schemaObject instanceof XmlSchemaInclude) { XmlSchema includedSchema = ((XmlSchemaInclude) schemaObject).getSchema(); if (!processedIncludes.contains(includedSchema)) { inlineIncludes(includedSchema, processedIncludes, processedImports); findImports(includedSchema, processedImports, processedIncludes); XmlSchemaObjectCollection includeItems = includedSchema.getItems(); for (int j = 0; j < includeItems.getCount(); j++) { XmlSchemaObject includedItem = includeItems.getItem(j); schemaItems.add(includedItem); } } // remove the <include/> schemaItems.removeAt(i); i--; } } }
private static XmlSchemaObjectCollection getSchemaObjectsFromComplexType(XmlSchemaComplexType schemaComplexType) { XmlSchemaObjectCollection collection = new XmlSchemaObjectCollection(); XmlSchemaSequence sequence = (XmlSchemaSequence) schemaComplexType.getParticle(); if (sequence != null) { XmlSchemaObjectCollection seqItems = sequence.getItems(); int c = seqItems.getCount(); for (int i = 0; i < c; i++) { // add elements collection.add(seqItems.getItem(i)); } } XmlSchemaObjectCollection attrItems = schemaComplexType.getAttributes(); int c = attrItems.getCount(); for (int i = 0; i < c; i++) { // add attributes collection.add(attrItems.getItem(i)); } return collection; }
private static boolean containsAnonymousTypes(XmlSchemaComplexType ct) { XmlSchemaGroupBase particle = (XmlSchemaGroupBase)ct.getParticle(); if (particle == null) { return false; } XmlSchemaObjectCollection items = particle.getItems(); for (int i = 0; i < items.getCount(); i++) { XmlSchemaObject item = items.getItem(i); if (item instanceof XmlSchemaElement) { XmlSchemaElement el = (XmlSchemaElement) item; if (el.getSchemaTypeName() == null) return true; } else if (item instanceof XmlSchemaElement) { XmlSchemaComplexType el = (XmlSchemaComplexType) item; if (el.getParticle() != null) return true; } } return false; }
public void fixUpMovedTypeReferences(String fromNamespace, String toNamespace, XmlSchemaObject fixUpObj, List<XmlSchema> relatedSchema){ if (!(fixUpObj instanceof XmlSchemaComplexType)){ return; } for (XmlSchema schema : relatedSchema){ int importRemoveIndex = -1; for (int i = 0; i < schema.getItems().getCount(); i++){ XmlSchemaObject obj = schema.getItems().getItem(i); processXMLSchemaObject(toNamespace, obj, fixUpObj); // remove FROM imports if (obj instanceof XmlSchemaImport && ((XmlSchemaImport)obj).getNamespace().equals(fromNamespace)){ importRemoveIndex = i; } } if (importRemoveIndex >= 0){ schema.getItems().removeAt(importRemoveIndex); } } }