[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    RE: Question/Suggestion
From:       Rune_Peter_Bjørnstad <r.p.bjornstad () student ! utwente ! nl>
Date:       2004-02-17 9:39:33
Message-ID: 200402170941.KAA03861 () mail44-s ! fg ! online ! no
[Download RAW message or body]

A bit of a late response, but your suggestion worked perfectly. I was
viewing the XmlObject as the root element, and thus validating the object
Itself didn't work. With your suggestion I now have a typed
object-representation of an element, which I can serialize into a SOAP
message, using standard axis-serializers for simple-types, and a custom
XmlBeans serializer for complex-types. 

Thank you very much,

Rune.


-----Original Message-----
From: Kevin Krouse [mailto:kkrouse@bea.com] 
Sent: 7. februar 2004 02:13
To: xmlbeans-dev@xml.apache.org
Subject: Re: Question/Suggestion

On Thu, 2004-02-05 at 12:55, Rune Peter Bjørnstad wrote:

>      1. Parse the user string into an XmlObject and Validate it
>         against the type Name. This will not work in the current
>         design?? Because the element input is not defined. This should
>         not be a requirement. What I want is to validate that the
>         element input is of type Name.

Unfortunately, in v1 there is straight forward way to force an element
to be a particular schema type like you can with documents.  It might be
feature in v2...

So for now, the easiest thing to do is have another schema which defines
the input element as the "Name" type where you can parse and validate. 
An alternative is to get the contents of an XmlObject, create a copy,
and set the type to what you want:

        XmlObject o = XmlObject.Factory.parse(inputXml);
        XmlCursor c = o.newCursor();
        c.toFirstChild();
        o = c.getObject();
        o = o.copy();
        o = o.changeType(NameType.type);
        o.validate();

give that a try and let me know how it works for you...

--k

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/




- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic