Thanks for your response!
In my application we use DOM API to build document.
When the schema is defined using elementFormDefault="unqualified"
I like to create document element using
org.w3c.dom.Document.createElementNS(ns, prefix:localName)
and when it is elementFormDefault="qualified" using
org.w3c.dom.Document.createElementNS(ns, localName), no prefix in this case.
Alternatively, I like to create a document element with prefix if its
local elements are not qualified otherwise no prefix.
Any suggestions on this.
Regards
Murali
Radu Preotiuc-Pietro wrote:
Hi Murali,
There is no API to get the value for that attribute, because it is
only a syntactic-level construct. Incidentally, global elements/types
are not affected at all by elementFormDefault (only local elements are).
Radu
------------------------------------------------------------------------
*From:* [email protected]
[mailto:[email protected]]
*Sent:* Wednesday, April 15, 2009 5:37 PM
*To:* [email protected]
*Subject:* Re: How to query a given element's schema attribute
"elementFormDefault" value?
Hi All,
Will you please respond to my question?
My question restated, goal is not know "elementFormDefault" value
of the schema where the global element/type is defined.
How do I do this with xmlbeans API?
Regards
Murali
Murali Pottlapelli wrote:
Hi All,
I load schema document using snippet below
File schFile = new File("c:\\tmp\\schema.xsd");
SchemaDocument schemaDoc =
SchemaDocument.Factory.parse(schFile);
XmlOptions options = new XmlOptions();
options.setCompileDownloadUrls();
SchemaTypeSystem ts = XmlBeans.compileXsd(new
SchemaDocument[] { schemaDoc }, XmlBeans.getContextTypeLoader(),
options);
SchemaTypeLoader loader = XmlBeans.typeLoaderUnion(new
SchemaTypeLoader[] { XmlBeans.getContextTypeLoader(), ts });
Query given element's definition by
SchemaGlobalElement typeADef = loader.findElement(new
QName("http://xml.netbeans.org/schema/Synchronous", "typeA"));
How do I find schema attribute "elementFormDefault" value for
this element?
By exploring API, it is possible by,
schemaDoc.getSchema().getElementFormDefault(). Is it possible to
navigate from SchemaGlobalElement object to its Schema? I could
not find an API for this.
Is there another way to do this?
My goal is to query a given element's schema attribute
"elementFormDefault"?
Thanks for your help!
Regards
Murali