XSD: attributes with the same name from different schemas - xsd

Is this possible to write xsds for the following xml:
<list add:type="single" view:type="multi"/>
where add and view point to different schemas? I will then use schema name to filter required attribute value.

You will use three schema documents to do this.
Schema document 1 will have a targetNamespace for add's namespace and will declare a global attribute named "type".
Schema document 2 will have a targetNamespace for view's namespace and will declare a global attribute named "type".
Schema document 3 will import the two namespaces. It will also declare a complexType that has two attributes defined using attribute references to "add:type" and "view:type". Element "list" will be of that type. You will be sure to include xmlns:add="..." and xmlns:view="..." namespace declarations in the scope of the attribute definitions.
Basically, any time you want elements or attributes from other namespaces, you have another schema document with a targetNamespace of that namespace. There, the elements or attributes for that namespace are declared globally. Then, when you wish to use these attributes or elements in some other schema document you 1) import the namespace (xs:import) 2) declare a ns prefix for the namespace and 3) use ref="nsprefix:attr_or_elem_name" to refer to the attribute or element.

Related

How to add custom property with mongoose ref

I'm trying to add custom property 'priority' so that I can map my Field collection with the Attribute collection. Here
To get output like this one But with priorities after attribute_name

How to create an object/entity XOM-BOM using lists

I need create object with an attribute that is based on a list of other objects. By default when creating a XOM using XSD, Rule Designer assigns lists as vector of java object. I need some orientation how to verbalize and instantiate the list and add the object members.
You need to create a separate Class of Objects you want to store in the list. After that you have to create a list type variable in your Request Class. "listOfMyObjects" as an example. Then, after updating your BOM instance, you will see a new member in it. You can verbolize it as you need. "{list of my objects} from {this}", where the "my object" itself have to be verbolized as well, as an example.
After that you can work with the list in your rules like that:
definition: make this object equals to any of My Object from list of my objects
if: your condition
then: add new object to list of my objects

jaxb bindings add variables to generated classes

I have a set of schemas that I generate JAXB classes from and I would like JAXB to add a new property to one of the classes for an element that doesn't exist in the schema. How can I do this?

How to allow any attributes from unknown namespaces?

I'm writing an XML Schema. It validates elements and their attributes from a single namespace.
How do I allow any attributes from other namespaces while still validating the non-prefixed attributes?
The list of other attributes and their namespaces is unknown at the time of writing the schema.
The XML is human-written and I would like to minimize the possibility of typos in attribute names. The attributes from other namespaces will used scarcely so it's ok not to validate them.
<xsd:anyAttribute namespace="##other" processContents="lax" />

Finding JAXB generated class for root element

I am new to using JAXB. I need to generate an xml file from its schema, where the schema and element values are input from the user.
My problem is, if I don't know the name of the elements beforehand, how can I use the JAXB generated classes? Is there a generic function, like getRoot() or getChildren() which I can use to traverse through the classes?

Resources