You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by Rafael Naufal <rn...@gmail.com> on 2006/10/27 16:12:54 UTC

How can I display the missing fields of a xml?

People,

suppose I have the following XML:

<?xml version='1.0' encoding='UTF-8'?>
<Address xmlns="http://ws.apache.org/jaxme/examples/misc/address">
  <Name>
    <First>AAA</First>
    <Middle>BBB</Middle>
    <Middle>CCC</Middle>
    <Last>DDD</Last>
    <Initials>ABCD</Initials>
  </Name>
</Address>

and my XSD specifies the <First> tag is required. But, I submit the
following URL to JaxMe:


<?xml version='1.0' encoding='UTF-8'?>
<Address xmlns="http://ws.apache.org/jaxme/examples/misc/address">
  <Name>
    <Middle>BBB</Middle>
    <Middle>CCC</Middle>
    <Last>DDD</Last>
    <Initials>ABCD</Initials>
  </Name>
</Address>

Not the xml above doesn't have the <First> tag. How can I show the user a
message like "The <First> tag is required"? I have to do that by
implementing the ValidationEventHandler interface and using the
ValidationEventLocator
object?

Thanks a lot,

-- 
------------------------------------------------------------------------
Rafael Naufal
"The great pleasure in life is doing what people say you cannot do"
blog: http://rnaufal.livejournal.com
------------------------------------------------------------------------

Re: How can I display the missing fields of a xml?

Posted by Jochen Wiedmann <jo...@gmail.com>.
On 10/30/06, Rafael Naufal <rn...@gmail.com> wrote:

> Yeap, but the methods getObject(), getNode() of the ValidationEventLocator
> object always return null when I supply a ValidationEventHandler
> implementation or, in some cases, an IllegalArgumentException is thrown.
> That is, the methods getObject(), getNode() never get filled.
>
> Is there a solution for this or I'm doing something wrong?

These methods aren't supported by JaxMe. (The JAXB specification
doesn't require that they are.) The only chance you have is parsing
the error message.

Jochen


-- 
My wife Mary and I have been married for forty-seven years and not
once have we had an argument serious enough to consider divorce;
murder, yes, but divorce, never.
(Jack Benny)

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: How can I display the missing fields of a xml?

Posted by Rafael Naufal <rn...@gmail.com>.
Yeap, but the methods getObject(), getNode() of the
ValidationEventLocator object
always return null when I supply a ValidationEventHandler implementation or,
in some cases, an IllegalArgumentException is thrown. That is, the
methods getObject(),
getNode() never get filled.

Is there a solution for this or I'm doing something wrong?

On 10/27/06, Jochen Wiedmann <jo...@gmail.com> wrote:
>
> On 10/27/06, Rafael Naufal <rn...@gmail.com> wrote:
>
> > Not the xml above doesn't have the <First> tag. How can I show the user
> a
> > message like "The <First> tag is required"? I have to do that by
> > implementing the ValidationEventHandler interface and using the
> > ValidationEventLocator object?
>
> Yes. Note, that the Unmarshaller can be configured witha
> ValidationEventHandler too.
>
> Jochen
>
> --
> My wife Mary and I have been married for forty-seven years and not
> once have we had an argument serious enough to consider divorce;
> murder, yes, but divorce, never.
> (Jack Benny)
>



-- 
------------------------------------------------------------------------
Rafael Naufal
"The great pleasure in life is doing what people say you cannot do"
blog: http://rnaufal.livejournal.com
------------------------------------------------------------------------

Re: How can I display the missing fields of a xml?

Posted by Jochen Wiedmann <jo...@gmail.com>.
On 10/27/06, Rafael Naufal <rn...@gmail.com> wrote:

> Not the xml above doesn't have the <First> tag. How can I show the user a
> message like "The <First> tag is required"? I have to do that by
> implementing the ValidationEventHandler interface and using the
> ValidationEventLocator object?

Yes. Note, that the Unmarshaller can be configured witha
ValidationEventHandler too.

Jochen

-- 
My wife Mary and I have been married for forty-seven years and not
once have we had an argument serious enough to consider divorce;
murder, yes, but divorce, never.
(Jack Benny)

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org