|
|
Subject: Help needed with mixed content... - msg#00119
List: text.xml.xmlbeans.user
Hello,
I need to implement something like this:
<attribute name=”…” class=”…”>
<attribute name=”…”>value</attribute>
<attribute name=”…”>value</attribute>
/attribute>
and
<attribute name=”…”>value</attribute>
What I mean is that attribute element can contain sub
elements OR text. What do I need to use to implement this? Note that I need to
read document (it will be typed manually by user).
With regards,
Pavel Krupets
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
RE: where is .xsb file?
Hi Nate
The xmlbeans ant task has an attribute, classgendir, which controls
where the .xsb files get generated. You should include this directory on
your compile classpath if you are taking responsibility for compiling
the generated code yourself and on the runtime classpath as well.
.xsb files bear the same relationship to .xsd files as .class files do
to .java i.e. they are a compiled format of the schema(s). The
TypeSystemHolder class is the gateway between the .class files and the
.xsb files.
Cheers,
Lawrence
> -----Original Message-----
> From: Nate Reed [mailto:nreed@xxxxxxxxxx]
> Sent: Friday, March 24, 2006 1:31 PM
> To: user@xxxxxxxxxxxxxxxxxxx
> Subject: where is .xsb file?
>
> One of the generated schema objects appears to be looking for an
> "index.xsb"
> file, but I don't see this in the generated code.
>
> The generated source tree looks like:
>
> com/foo (our generated Java classes)
> schema/system/s18393419346C7982F9F908EC0D0397A4/TypeSystemHolder.java
>
> This was generated by the xmlbeans ant task, but when I used the
command
> line
> 'scomp' it generated a bunch of other stuff, such as .xsb files. I'm
not
> sure what this is for or how to get the ant task to generate all
these.
>
> Any ideas?
>
> Here's the exception:
>
> Caused by: java.lang.RuntimeException: Could not instantiate
> SchemaTypeSystemImpl (java.lang.reflect.InvocationTargetException): is
the
> version of xbean.jar correct?
> at
>
schema.system.s18393419346C7982F9F908EC0D0397A4.TypeSystemHolder.loadTyp
eS
> ystem(Unknown
> Source)
> at
>
schema.system.s18393419346C7982F9F908EC0D0397A4.TypeSystemHolder.<clinit
>(
> Unknown
> Source)
> ... 63 more
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> at
>
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
cc
> essorImpl.java:39)
> at
>
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
tr
> uctorAccessorImpl.java:27)
> at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> ... 65 more
> Caused by: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS
> compiled
> schema: Could not locate compiled schema resource
> schema/system/s18393419346C7982F9F908EC0D0397A4/index.xsb
> (schema.system.s18393419346C7982F9F908EC0D0397A4.index) - code 0
> at
>
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.<init>(Sc
he
> maTypeSystemImpl.java:1069)
> at
>
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(Sche
ma
> TypeSystemImpl.java:271)
> at
>
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSy
st
> emImpl.java:151)
> ... 69 more
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xxxxxxxxxxxxxxxxxxx
> For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
Next Message by Date:
click to view message preview
generated faults java names
Hi all,
I'm trying to find out the place where the WSDL fault names are
converted to Java names (and the classes arround it).
In company we want to use AXIS2 and XMLBeans. So, we have a WSDL and we
are able generate stub and beans, but there's a request to "hack" stub
generator to generate stub methods with faults as exceptions not as xml
beans.
I've played with it a bit and found way to "hack" AXIS2 stub generator
to do that, but there's "missing" the support from the XMLBeans side.
The fault type definition is something like this:
<xsd:schema targetNamespace="http://exc.pat"
elementFormDefault="qualified" attributeFormDefault="qualified">
<xsd:complexType name="Exception"/>
</xsd:schema>
</wsdl:types>
---the original package is pat.exc
The method definition is:
<wsdl:operation name="methodString">
<wsdl:input message="tns:methodStringRequest" name="methodStringRequest"/>
<wsdl:output message="tns:methodStringResponse"
name="methodStringResponse"/>
<wsdl:fault message="tns:Exception" name="Exception"/>
</wsdl:operation>
When I run XMLBeans generator the final package structure generated is:
pat.exc.Exception - an interface
pat.exc.impl.ExceptionImpl - the interface implementation
pattest.ExceptionDocument - an interface
pattest.impl.ExceptionDocumentImpl - the interface implementation
This is still acceptable. The pronlem starts in the SchemaTypeSystem,
because in the STS the bundle between QName({http://pattest}Exception)
and the real Java name contains only information about
pattest.ExceptionDocument, but I need to push the STS to return
pat.exc.Exception for the QName({http://pattest}Exception). Where is the
place to "hack" the STS - I've dabug a lot, but without luck :-\
I'm using methods STS.documentTypes().getDocumentElementName() and
STS.documentTypes().getFullJavaName() for getting QName and Java name
Can someone help me ???
Thanks to all.
Pat
Previous Message by Thread:
click to view message preview
where is .xsb file?
One of the generated schema objects appears to be looking for an "index.xsb"
file, but I don't see this in the generated code.
The generated source tree looks like:
com/foo (our generated Java classes)
schema/system/s18393419346C7982F9F908EC0D0397A4/TypeSystemHolder.java
This was generated by the xmlbeans ant task, but when I used the command line
'scomp' it generated a bunch of other stuff, such as .xsb files. I'm not
sure what this is for or how to get the ant task to generate all these.
Any ideas?
Here's the exception:
Caused by: java.lang.RuntimeException: Could not instantiate
SchemaTypeSystemImpl (java.lang.reflect.InvocationTargetException): is the
version of xbean.jar correct?
at
schema.system.s18393419346C7982F9F908EC0D0397A4.TypeSystemHolder.loadTypeSystem(Unknown
Source)
at
schema.system.s18393419346C7982F9F908EC0D0397A4.TypeSystemHolder.<clinit>(Unknown
Source)
... 63 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
... 65 more
Caused by: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled
schema: Could not locate compiled schema resource
schema/system/s18393419346C7982F9F908EC0D0397A4/index.xsb
(schema.system.s18393419346C7982F9F908EC0D0397A4.index) - code 0
at
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.<init>(SchemaTypeSystemImpl.java:1069)
at
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(SchemaTypeSystemImpl.java:271)
at
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:151)
... 69 more
Next Message by Thread:
click to view message preview
RE: Help needed with mixed content...
Hi Pavel
The content model you are referring to is
called a “mixed” content model. You specify this in your schema using
the mixed=”true” attribute: either
<complexType … mixed=”true”
>
…
</complexType>
Or
<complexType>
<complexContent mixed=”true”>
…
</complexContent>
</complexType>
See the schema spec (http://www.w3.org/TR/xmlschema-1/#Complex_Type_Definitions)
for details.
If you use XmlBeans on a schema like that then
we do not generate a gettter/setter for the text which may (or may not) be
inside the element in the instance doc. Instead you use the XmlCursor APIs.
Once you have an XmlObject (xmlo) do something like this:
XmlCursor c = xmlo.newCursor();
c.toFirstContentToken();
String s = c.getTextValue();
c.dispose();
The following links may also be useful to
you:
http://xmlbeans.apache.org/documentation/tutorial_getstarted.html
(the part labelled “Getting Started with the XML Cursor” near the
bottom)
http://xmlbeans.apache.org/docs/2.0.0/guide/conNavigatingXMLwithCursors.html
http://dev2dev.bea.com/pub/a/2003/11/traut.html
Cheers,
Lawrence
From: Pavel Krupets
[mailto:pkrupets@xxxxxxxxx]
Sent: Sunday, March 26, 2006 2:12
AM
To: user@xxxxxxxxxxxxxxxxxxx
Subject: Help needed with mixed
content...
Hello,
I need to implement something like this:
<attribute name=”…”
class=”…”>
<attribute
name=”…”>value</attribute>
<attribute
name=”…”>value</attribute>
/attribute>
and
<attribute
name=”…”>value</attribute>
What I mean is that attribute element can contain sub
elements OR text. What do I need to use to implement this? Note that I need to
read document (it will be typed manually by user).
With regards,
Pavel Krupets
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
|
|