You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by RefuX Zanzeebarr <re...@hotmail.com> on 2006/06/27 22:54:37 UTC
Schema navigation
I apologize for an additional post, however I've quickly run into another
problem.
This is related to navigating the schema, I did find the QueryXS sample
which was very useful and I've also been digging about in the API docs and
in the debugger however nothing is jumping out at me, so I guess I will
bother you some more :(
Many parts of the Schema I'm working with look like this:
<xsd:complexType name="One">
<xsd:all minOccurs="0">
<xsd:element name=Two" type="TwoType" minOccurs="0" maxOccurs="1"
nillable="true" />
<xsd:element name="Three" type="ThreeType" minOccurs="0" maxOccurs="1"
nillable="true" /> </xsd:all>
</xsd:complexType>
Relating back to my previous post I want to leverage the Schema for UI
validation.
When the user in the UI entering text for element 'Three' I want to be able
to look up it's type so I can validate against it. However I can't get my
hands on this element, I can get my hands on the Complex Type 'One' however
I can't navigate to 'Three'.
I have no doubt I'm just being really dumb here, however any help would be
much appreciated!
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: More on schema navigation
Posted by Jeff Greif <jg...@alumni.princeton.edu>.
Take a look at:
http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040122/
An XSParticle has an XSTerm (accessed via getTerm) which is either an
XSElementDeclaration or an XSWildcard or an XSModelGroup (sequence,
choice or all).
It helps to read the above spec in conjunction with the XML Schema
spec because the class names reflect the terminology in the schema
spec, for the most part.
Jeff
On 6/29/06, Wax, Ed <Ed...@csgsystems.com> wrote:
> I'm attempting to read a schema so that I can ascertain the structure as
> well as data types of the elements. For complexTypes I can get close
> but can't quite get down to the elements. I can see them in a string
> representation but cannot find an API to step through them.
>
> Here's a complexType definition:
> ...
> <xsd:complexType name = "addressA">
> <xsd:sequence>
> <xsd:element ref="Line1" />
> <xsd:element ref="Line2" minOccurs="0" />
> <xsd:element ref="City"/>
> <xsd:element ref="State" />
> <xsd:element ref="PostalCode" />
> </xsd:sequence>
> </xsd:complexType>
> ...
>
> Here's the code snippet:
> ...
> // parse document
> System.out.println("Parsing " + argv[0] + "...");
> XSModel model = schemaLoader.loadURI(argv[0]);
> if (model != null) {
> XSNamedMap ccomponents =
> model.getComponents(XSTypeDefinition.COMPLEX_TYPE);
> int complexcount = ccomponents.getLength();
> XSComplexTypeDefinition complexType = null;
> XSParticle particle = null;
> for (int i = 0; i < complexcount; i++) {
> complexType = (XSComplexTypeDefinition)ccomponents.item(i);
> System.out.println("name: " + complexType.getName() +
> complexType.getParticle());
> }
> }
> ...
>
> And, here's the output:
> name:
> addressA(("":Line1),("":Line2){0-1},("":City),("":State),("":PostalCode)
> )
>
> Is there an API that will allow me to parse/navigate the
> complexType.Particle() object? If so, do I need to make yet another
> call to get the actual element definition (and its data type)?
>
> Thanks,
> Ed
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: exception with empty namespace in element
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Daniel,
defiant.challenged@theclan.nl wrote on 07/03/2006 05:39:55 AM:
<snip/>
> >> If anyone can give any insight I would be gratefull, cause I'm
running
> > out of
> >> ideas. I am also considering in mailing this to the axis user
> > mailinglist, but
> >> I read the xerces news page, so I thought I'd try it here first. I am
> > hoping
> >> that this has something todo with the newest version of xerces or
axis,
> > since
> >> axis is depending on xerces as well.
> >
> > The category element in the document has a different namespace
> > (http://ssb.ccsd.nc3a.nato.int_/react/r2d2/webservice/schemas) than
the
> > one expected (http://webservice/schemas) by your schema. I suspect
Axis or
> > XMLBeans detects the mismatch and then throws the exception.
> >
>
> hmm, yea, thats my bad, I was editing the email and got distracted. The
> namespaces are identical in both schema's. But how very perceptive of
you.
> I think, that if it has nothing to do with xerces backwards
compatability, I
> will try axis, because I have no clue what I am doing wrong.
> The strange thing is though, some methods do work properly(and they pump
xml
> back and forth), but some just don't.
If that wasn't the problem, I'm not sure what it could be. I believe
XMLBeans rolled their own schema support. Axis may also have written its
own schema code to support data binding so I wouldn't assume that Xerces
is involved in determining what content is allowed. You may want to ask
the folks on the axis-user list what's going on.
> Thanks again,
>
> Daniel Ettema
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: exception with empty namespace in element
Posted by de...@theclan.nl.
Hello Michael,
thanks for responding to my question(s).
<snip/>
>
>> When setting axis(the webservice) to debug a lot of info comes by. When
>> it comes
>> to parsing the categoryEntry element it will throw the exception.
>> That element has no namespace, so the serializer adds a empty xmlns=""
> to
>> it(which is a known fact) but when it reaches axis, it can not parse
> this
>> element.
>> I read on the news page of xerces J that this is known. Although it is
>> axis who
>> is throwing a fault, I believe the source of the problem might be with
> xerces.
>
> What known issue are you referring to? If you were reading the release
> notes and saw "Fixed a bug which caused an NPE to be thrown for a
> namespace declaration such as xmlns="" which appeared on an ancestor
> element of an <annotation>.", I can assure you that it isn't relevant.
>
I was referring to the frontpage of the J2 page of Xerces, with the headline,
backwards compatability.
http://xerces.apache.org/xerces2-j/
>> The following is what axis receives.
>>
>> <categoryObject2 xsi:type="ns1:Document"
>> xmlns="http://webservice.r2d2.react.ssb.ccsd.nc3a.nato.int_"
>> xmlns:ns1="http://xml.apache.org/xml-soap"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><sch:category
>> xmlns:sch="http://ssb.ccsd.nc3a.nato.int_/react/r2d2/webservice/schemas
>> "><categoryEntry
>>
> xmlns=""><targetNamespace>zzzz</targetNamespace><schemaElementName>zzzzz</schemaElementName></categoryEntry></sch:
>> category></categoryObject2>
>>
>> If anyone can give any insight I would be gratefull, cause I'm running
> out of
>> ideas. I am also considering in mailing this to the axis user
> mailinglist, but
>> I read the xerces news page, so I thought I'd try it here first. I am
> hoping
>> that this has something todo with the newest version of xerces or axis,
> since
>> axis is depending on xerces as well.
>
> The category element in the document has a different namespace
> (http://ssb.ccsd.nc3a.nato.int_/react/r2d2/webservice/schemas) than the
> one expected (http://webservice/schemas) by your schema. I suspect Axis or
> XMLBeans detects the mismatch and then throws the exception.
>
hmm, yea, thats my bad, I was editing the email and got distracted. The
namespaces are identical in both schema's. But how very perceptive of you.
I think, that if it has nothing to do with xerces backwards compatability, I
will try axis, because I have no clue what I am doing wrong.
The strange thing is though, some methods do work properly(and they pump xml
back and forth), but some just don't.
>> Thanks in advance,
>>
>> Daniel Ettema
>> Netherlands.
>>
>> Below is my schema:
>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> targetNamespace="http://webservice/schemas">
>> <xsd:element name="category">
>> <xsd:complexType>
>> <xsd:sequence>
>> <xsd:element name="categoryEntry" minOccurs="0" maxOccurs="1">
>> <xsd:complexType>
>> <xsd:sequence>
>> <xsd:element name="categoryName" type="xsd:string"
> minOccurs="0"
>> maxOccurs="1"/>
>> <xsd:element name="targetNamespace" type="xsd:string"
>> minOccurs="0" maxOccurs="1"/>
>> <xsd:element name="schemaElementName" type="xsd:string"
>> minOccurs="0" maxOccurs="1"/>
>> <xsd:element name="description" type="xsd:string"
> minOccurs="0"
>> maxOccurs="1"/>
>> <xsd:element name="xsddocument"
> type="xsd:anyType"minOccurs="0"
>> maxOccurs="1"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:element>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:element>
>> </xsd:schema>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: j-users-help@xerces.apache.org
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>
Thanks again,
Daniel Ettema
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: exception with empty namespace in element
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hello Daniel,
defiant.challenged@theclan.nl wrote on 06/30/2006 05:46:41 AM:
<snip/>
> The webservice throws an exception, even before it can reach my own
code.
> The exception is as follows:
> org.xml.sax.SAXException: SimpleDeserializer encountered a child
> element, which
> is NOT expected, in something it was trying to deserialize.
This error doesn't come from Xerces.
> When setting axis(the webservice) to debug a lot of info comes by. When
> it comes
> to parsing the categoryEntry element it will throw the exception.
> That element has no namespace, so the serializer adds a empty xmlns=""
to
> it(which is a known fact) but when it reaches axis, it can not parse
this
> element.
> I read on the news page of xerces J that this is known. Although it is
> axis who
> is throwing a fault, I believe the source of the problem might be with
xerces.
What known issue are you referring to? If you were reading the release
notes and saw "Fixed a bug which caused an NPE to be thrown for a
namespace declaration such as xmlns="" which appeared on an ancestor
element of an <annotation>.", I can assure you that it isn't relevant.
> The following is what axis receives.
>
> <categoryObject2 xsi:type="ns1:Document"
> xmlns="http://webservice.r2d2.react.ssb.ccsd.nc3a.nato.int_"
> xmlns:ns1="http://xml.apache.org/xml-soap"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><sch:category
> xmlns:sch="http://ssb.ccsd.nc3a.nato.int_/react/r2d2/webservice/schemas
> "><categoryEntry
>
xmlns=""><targetNamespace>zzzz</targetNamespace><schemaElementName>zzzzz</schemaElementName></categoryEntry></sch:
> category></categoryObject2>
>
> If anyone can give any insight I would be gratefull, cause I'm running
out of
> ideas. I am also considering in mailing this to the axis user
mailinglist, but
> I read the xerces news page, so I thought I'd try it here first. I am
hoping
> that this has something todo with the newest version of xerces or axis,
since
> axis is depending on xerces as well.
The category element in the document has a different namespace
(http://ssb.ccsd.nc3a.nato.int_/react/r2d2/webservice/schemas) than the
one expected (http://webservice/schemas) by your schema. I suspect Axis or
XMLBeans detects the mismatch and then throws the exception.
> Thanks in advance,
>
> Daniel Ettema
> Netherlands.
>
> Below is my schema:
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://webservice/schemas">
> <xsd:element name="category">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="categoryEntry" minOccurs="0" maxOccurs="1">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="categoryName" type="xsd:string"
minOccurs="0"
> maxOccurs="1"/>
> <xsd:element name="targetNamespace" type="xsd:string"
> minOccurs="0" maxOccurs="1"/>
> <xsd:element name="schemaElementName" type="xsd:string"
> minOccurs="0" maxOccurs="1"/>
> <xsd:element name="description" type="xsd:string"
minOccurs="0"
> maxOccurs="1"/>
> <xsd:element name="xsddocument"
type="xsd:anyType"minOccurs="0"
> maxOccurs="1"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
exception with empty namespace in element
Posted by de...@theclan.nl.
Hello,
I quite new to the mailinglist and I hope I am on the right list.
I am building a webservice in Document Literal form and I am using xml
schema's
(schema is at the bottom) to define the content structure of the message. I am
generating java like beans with XMLBeans 2.2.0 so my own client(of the
webservice) and the webservice can populate and read the message
documents. The
webservice itself is Tomcat 5.5.16 and it makes use of axis 1.4, also I
am using
xerces 2.8.0.
My client application, before it calls a webservice method, populates a
xmlbean
generated java object and transform that to a w3c document. It then calls the
webservice method.
On the webservice side.
I receive an object, I cast it to a w3c, and then transform it to a xmlbean
generated java object, so I can easily access the elements and their values.
Fine and all, you would say... well I did join the list for a reason...
The webservice throws an exception, even before it can reach my own code.
The exception is as follows:
org.xml.sax.SAXException: SimpleDeserializer encountered a child
element, which
is NOT expected, in something it was trying to deserialize.
When setting axis(the webservice) to debug a lot of info comes by. When
it comes
to parsing the categoryEntry element it will throw the exception.
That element has no namespace, so the serializer adds a empty xmlns="" to
it(which is a known fact) but when it reaches axis, it can not parse this
element.
I read on the news page of xerces J that this is known. Although it is
axis who
is throwing a fault, I believe the source of the problem might be with xerces.
The following is what axis receives.
<categoryObject2 xsi:type="ns1:Document"
xmlns="http://webservice.r2d2.react.ssb.ccsd.nc3a.nato.int_"
xmlns:ns1="http://xml.apache.org/xml-soap"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><sch:category
xmlns:sch="http://ssb.ccsd.nc3a.nato.int_/react/r2d2/webservice/schemas"><categoryEntry
xmlns=""><targetNamespace>zzzz</targetNamespace><schemaElementName>zzzzz</schemaElementName></categoryEntry></sch:category></categoryObject2>
If anyone can give any insight I would be gratefull, cause I'm running out of
ideas. I am also considering in mailing this to the axis user mailinglist, but
I read the xerces news page, so I thought I'd try it here first. I am hoping
that this has something todo with the newest version of xerces or axis, since
axis is depending on xerces as well.
Thanks in advance,
Daniel Ettema
Netherlands.
Below is my schema:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://webservice/schemas">
<xsd:element name="category">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="categoryEntry" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="categoryName" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
<xsd:element name="targetNamespace" type="xsd:string"
minOccurs="0" maxOccurs="1"/>
<xsd:element name="schemaElementName" type="xsd:string"
minOccurs="0" maxOccurs="1"/>
<xsd:element name="description" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
<xsd:element name="xsddocument" type="xsd:anyType"minOccurs="0"
maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: More on schema navigation
Posted by Dick Deneer <di...@donkeydevelopment.com>.
Hi Ed,
Do this:
XSParticle particle = complexTypeDef.getParticle();
if (particle != null)
{
processParticle(node, particle, level);
}
In the processParticle:
switch (particle.getTerm().getType()):
You wil get a modelgroup or element or wildcard.
Dick Deneer
Op 29-jun-2006, om 22:54 heeft Wax, Ed het volgende geschreven:
> I'm attempting to read a schema so that I can ascertain the
> structure as
> well as data types of the elements. For complexTypes I can get close
> but can't quite get down to the elements. I can see them in a string
> representation but cannot find an API to step through them.
>
> Here's a complexType definition:
> ...
> <xsd:complexType name = "addressA">
> <xsd:sequence>
> <xsd:element ref="Line1" />
> <xsd:element ref="Line2" minOccurs="0" />
> <xsd:element ref="City"/>
> <xsd:element ref="State" />
> <xsd:element ref="PostalCode" />
> </xsd:sequence>
> </xsd:complexType>
> ...
>
> Here's the code snippet:
> ...
> // parse document
> System.out.println("Parsing " + argv[0] + "...");
> XSModel model = schemaLoader.loadURI(argv[0]);
> if (model != null) {
> XSNamedMap ccomponents =
> model.getComponents(XSTypeDefinition.COMPLEX_TYPE);
> int complexcount = ccomponents.getLength();
> XSComplexTypeDefinition complexType = null;
> XSParticle particle = null;
> for (int i = 0; i < complexcount; i++) {
> complexType = (XSComplexTypeDefinition)ccomponents.item(i);
> System.out.println("name: " + complexType.getName() +
> complexType.getParticle());
> }
> }
> ...
>
> And, here's the output:
> name:
> addressA(("":Line1),("":Line2){0-1},("":City),("":State),
> ("":PostalCode)
> )
>
> Is there an API that will allow me to parse/navigate the
> complexType.Particle() object? If so, do I need to make yet another
> call to get the actual element definition (and its data type)?
>
> Thanks,
> Ed
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: More on schema navigation
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Ed,
"Wax, Ed" <Ed...@csgsystems.com> wrote on 06/29/2006 04:54:47 PM:
<snip/>
> Is there an API that will allow me to parse/navigate the
> complexType.Particle() object? If so, do I need to make yet another
> call to get the actual element definition (and its data type)?
XSParticle.getTerm() [1] will return an XSModelGroup for the sequence.
Walking through the XSObjectList of particles from the model group you'll
find each of the element declarations.
> Thanks,
> Ed
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
Hope that helps.
[1]
http://xerces.apache.org/xerces2-j/javadocs/xs/org/apache/xerces/xs/XSParticle.html#getTerm()
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
More on schema navigation
Posted by "Wax, Ed" <Ed...@csgsystems.com>.
I'm attempting to read a schema so that I can ascertain the structure as
well as data types of the elements. For complexTypes I can get close
but can't quite get down to the elements. I can see them in a string
representation but cannot find an API to step through them.
Here's a complexType definition:
...
<xsd:complexType name = "addressA">
<xsd:sequence>
<xsd:element ref="Line1" />
<xsd:element ref="Line2" minOccurs="0" />
<xsd:element ref="City"/>
<xsd:element ref="State" />
<xsd:element ref="PostalCode" />
</xsd:sequence>
</xsd:complexType>
...
Here's the code snippet:
...
// parse document
System.out.println("Parsing " + argv[0] + "...");
XSModel model = schemaLoader.loadURI(argv[0]);
if (model != null) {
XSNamedMap ccomponents =
model.getComponents(XSTypeDefinition.COMPLEX_TYPE);
int complexcount = ccomponents.getLength();
XSComplexTypeDefinition complexType = null;
XSParticle particle = null;
for (int i = 0; i < complexcount; i++) {
complexType = (XSComplexTypeDefinition)ccomponents.item(i);
System.out.println("name: " + complexType.getName() +
complexType.getParticle());
}
}
...
And, here's the output:
name:
addressA(("":Line1),("":Line2){0-1},("":City),("":State),("":PostalCode)
)
Is there an API that will allow me to parse/navigate the
complexType.Particle() object? If so, do I need to make yet another
call to get the actual element definition (and its data type)?
Thanks,
Ed
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: InvalidDatatypeValueException getting to the root exception
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
"RefuX Zanzeebarr" <re...@hotmail.com> wrote on 06/28/2006 05:06:09 PM:
> My next problem with my 'wanting to use schema validation for UI
validation'
> is a problem with the invalid data. The real problem is that
> InvalidDatatypeValueException is not always the correct one, for example
in
> org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl when validating facets
with
> type union any validation errors actually caught disgarded since they
> (technically) are not significant since only the net result of an
exception
> with cvc-datatype-valid.1.2.3 really matters.
> However for me having the root validation error would be incredibly
useful
> since then I can have a much more detailed error message.
>
> As you can gather I'm not particulalry familiar with xerces, how easy
would
> it be to replace the org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl
> implementation with my own so I can extend it to capture the additional
> InvalidDatatypeValueExceptions?
I suppose you could validate against each of the member types [1] yourself
though the errors you report may be a bit misleading.
> Hopefully just some property needs changing :)
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
[1]
http://xerces.apache.org/xerces2-j/javadocs/xs/org/apache/xerces/xs/XSSimpleTypeDefinition.html#getMemberTypes()
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
InvalidDatatypeValueException getting to the root exception
Posted by RefuX Zanzeebarr <re...@hotmail.com>.
My next problem with my 'wanting to use schema validation for UI validation'
is a problem with the invalid data. The real problem is that
InvalidDatatypeValueException is not always the correct one, for example in
org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl when validating facets with
type union any validation errors actually caught disgarded since they
(technically) are not significant since only the net result of an exception
with cvc-datatype-valid.1.2.3 really matters.
However for me having the root validation error would be incredibly useful
since then I can have a much more detailed error message.
As you can gather I'm not particulalry familiar with xerces, how easy would
it be to replace the org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl
implementation with my own so I can extend it to capture the additional
InvalidDatatypeValueExceptions?
Hopefully just some property needs changing :)
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Schema navigation
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
"RefuX Zanzeebarr" <re...@hotmail.com> wrote on 06/27/2006 04:54:37 PM:
> I apologize for an additional post, however I've quickly run into
another
> problem.
> This is related to navigating the schema, I did find the QueryXS sample
> which was very useful and I've also been digging about in the API docs
and
> in the debugger however nothing is jumping out at me, so I guess I will
> bother you some more :(
>
> Many parts of the Schema I'm working with look like this:
> <xsd:complexType name="One">
> <xsd:all minOccurs="0">
> <xsd:element name=Two" type="TwoType" minOccurs="0" maxOccurs="1"
> nillable="true" />
> <xsd:element name="Three" type="ThreeType" minOccurs="0"
maxOccurs="1"
> nillable="true" /> </xsd:all>
> </xsd:complexType>
>
> Relating back to my previous post I want to leverage the Schema for UI
> validation.
> When the user in the UI entering text for element 'Three' I want to be
able
> to look up it's type so I can validate against it. However I can't get
my
> hands on this element, I can get my hands on the Complex Type 'One'
however
> I can't navigate to 'Three'.
>
> I have no doubt I'm just being really dumb here, however any help would
be
> much appreciated!
The interfaces in the XML Schema API [1] are isomorphic to the schema
components described by the schema specification, so you'll have to walk
through a few particles (XSParticle) and a model group (XSModelGroup) to
get from the complex type definition to the element declaration you're
looking for.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
[1]
http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org