Hi Jacob,
I haven't seen a previous post on the list about this topic. That may
be why you didn't get an answer :)
Hmm, that would explain it, indeed.
What problems are you seeing when you try the code you list below?
If I understand your problem correctly, you have something like:
<el>1</el1> and you want to determine what type that is so you can use
somenamespace.ElDocument as your type. Is this correct?
No exactly. I think i have to be more clear (always a challenge but here it
goes .. )
I'v got the big jar that is produced when you run scomp on an xsd.
When using the code in a normal fashion one would just get an object, say
SomeRoot, and use the SomeRootDocument.Factory.someMethod() to accomplish
whatever.
Now, what i want to do is slightly different.
Rather than using SomeDocumentRootDocument explicitly i am looking for a way
to use the Class.forName(someRootAsString).newInstance() method to get my
hands on an xmlbeans document that i specify via a string. This way i don't
have to hardcode the construction of the xml but i could supply the
structure via simple strings, read via a small input file.
If this is possible one can construct any xml (sub)doc (based on the overall
xsd) without having to code for it.
Does this make sense?
Have you tried something like:
XmlObject xo = XmlObject.Factory.parse("<el>1</el1>");
and
xo.type
xo.type.getName
Since this suggests the string being an xml element i have not because i
would be looking for a className (the string thereof) to be handed of and
return with an instance of type XmlObject.
Basically i don't know where the xml is going to start so i just want to
supply a string (name of the element to denote as root of the document to be
build), create the corresponding document and build the rest of the xml-doc
in the same fashion.
the scan the classes you expect to find a matching type
if(ElDocument.type.getName == xo.type.getName){
// do something
}
-Jacobd
On 3/12/07, Fermin Da Costa Gomez <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Just started on Xmlbeans and going through the list has not yielden an
> answer to my question.
>
> Is there a way to get a hold of a SomeDocument object by using
> Class.forName("namespace.SomeDocument").newInstance() .. ?
> Or any other way by means of just using a string that refers/ points to
the
> element one is looking for?
>
> So i have got the name of a document/ node/ tag in the form of a string
and
> i'm looking for an object based on that string.
>
> Tia,
>
> Fermin DCG
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man."
- George Bernard Shaw (1856 - 1950)