Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » particle.getElement()
particle.getElement() [message #55570] Tue, 30 November 2004 14:45 Go to next message
Eclipse UserFriend
Originally posted by: ooi.ibm.com

Hi,

I have a question.when reading out a schema, the return type of a particle
as a child from the sequence tag below is of type
org.apache.xerces.dom.DeferredElementNSImpl
but not org.w3c.dom.Element as I have expected it to be.

<element name="ServiceProperties">
<complexType>
<sequence>
<element ref="tns:OtherEnabledState" />
........

what is the reason for that? I have also tried to set the content of a
XSDModelGroup instance to this DeferredElementNSImpl but it doesnt work.

Thank you.
Re: particle.getElement() [message #55598 is a reply to message #55570] Tue, 30 November 2004 14:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

HT,

That implementation class implements Element, so this should not be a
problem. You're not very clear on what you tried to do. In general, I
would not expect you to call setElement on anything but an XSDSchema...


HT Ooi wrote:

> Hi,
>
> I have a question.when reading out a schema, the return type of a
> particle as a child from the sequence tag below is of type
> org.apache.xerces.dom.DeferredElementNSImpl but not
> org.w3c.dom.Element as I have expected it to be.
>
> <element name="ServiceProperties">
> <complexType>
> <sequence>
> <element ref="tns:OtherEnabledState" /> .......
>
> what is the reason for that? I have also tried to set the content of
> a XSDModelGroup instance to this DeferredElementNSImpl but it doesnt
> work.
>
> Thank you.
>
Re: particle.getElement() [message #55624 is a reply to message #55598] Tue, 30 November 2004 15:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ooi.ibm.com

Ed,

yeah,I'm an absolute newbie in xml technologies. I was meaning to say
XSDElementDeclaration instead of the dom element. sorry..
how do I go about it then? i mean i can extract DeferredElementNSImpl when
I extract using getElement() of XSDParticleImpl from a modelGroup contents
which i read out.but i don't know how to add a DeferredElementNSImpl to a
XSDParticleImpl. It doesnt work using the setContent() method.


Ed Merks wrote:

> HT,

> That implementation class implements Element, so this should not be a
> problem. You're not very clear on what you tried to do. In general, I
> would not expect you to call setElement on anything but an XSDSchema...


> HT Ooi wrote:

>> Hi,
>>
>> I have a question.when reading out a schema, the return type of a
>> particle as a child from the sequence tag below is of type
>> org.apache.xerces.dom.DeferredElementNSImpl but not
>> org.w3c.dom.Element as I have expected it to be.
>>
>> <element name="ServiceProperties">
>> <complexType>
>> <sequence>
>> <element ref="tns:OtherEnabledState" /> .......
>>
>> what is the reason for that? I have also tried to set the content of
>> a XSDModelGroup instance to this DeferredElementNSImpl but it doesnt
>> work.
>>
>> Thank you.
>>
Re: particle.getElement() [message #55650 is a reply to message #55624] Tue, 30 November 2004 16:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

HT,

You should focus on either editing the DOM directly using only DOM APIs
(the XSD model will synchronize with your changes to the DOM) or editing
the XSD model directly using only the XSD APIs (the DOM will synchronize
with the changes in the XSD model). Don't try to edit by calling
setElement; that will never work. The XSDPrototypicalSchema has samples
for how to create all the types of XSD instances bottom up, so you
should have a look at those.


HT Ooi wrote:

> Ed,
>
> yeah,I'm an absolute newbie in xml technologies. I was meaning to say
> XSDElementDeclaration instead of the dom element. sorry..
> how do I go about it then? i mean i can extract DeferredElementNSImpl
> when I extract using getElement() of XSDParticleImpl from a modelGroup
> contents which i read out.but i don't know how to add a
> DeferredElementNSImpl to a XSDParticleImpl. It doesnt work using the
> setContent() method.
>
>
> Ed Merks wrote:
>
>> HT,
>
>
>> That implementation class implements Element, so this should not be a
>> problem. You're not very clear on what you tried to do. In general,
>> I would not expect you to call setElement on anything but an
>> XSDSchema...
>
>
>
>> HT Ooi wrote:
>
>
>>> Hi,
>>>
>>> I have a question.when reading out a schema, the return type of a
>>> particle as a child from the sequence tag below is of type
>>> org.apache.xerces.dom.DeferredElementNSImpl but not
>>> org.w3c.dom.Element as I have expected it to be.
>>>
>>> <element name="ServiceProperties">
>>> <complexType>
>>> <sequence>
>>> <element ref="tns:OtherEnabledState" /> .......
>>>
>>> what is the reason for that? I have also tried to set the content of
>>> a XSDModelGroup instance to this DeferredElementNSImpl but it
>>> doesnt work.
>>>
>>> Thank you.
>>>
>
>
Re: particle.getElement() [message #55677 is a reply to message #55650] Tue, 30 November 2004 16:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ooi.de.ibm.com

Ed,

I undertand what you mean. I am actually concentrating on the XSD API's. I
am not using any DOM API. And I have looked throught the examples on how
to create.My question is how I read a schema. Please bear with me.

I dint use setElement in the Particle,I used setContent.I use getElement
only to read it out.

what I wanted to do was to copy the elements(<element
ref="tns:OtherEnabledState" />) in

<element name="ServiceProperties">
<complexType>
<sequence>
<element ref="tns:OtherEnabledState" /> .......

and stick them in another complexType sequence. But i do not know how to
read them out properly as XSDElementDeclaration.

Thanks for your time.



> HT,

> You should focus on either editing the DOM directly using only DOM APIs
> (the XSD model will synchronize with your changes to the DOM) or editing
> the XSD model directly using only the XSD APIs (the DOM will synchronize
> with the changes in the XSD model). Don't try to edit by calling
> setElement; that will never work. The XSDPrototypicalSchema has samples
> for how to create all the types of XSD instances bottom up, so you
> should have a look at those.


> HT Ooi wrote:

>> Ed,
>>
>> yeah,I'm an absolute newbie in xml technologies. I was meaning to say
>> XSDElementDeclaration instead of the dom element. sorry..
>> how do I go about it then? i mean i can extract DeferredElementNSImpl
>> when I extract using getElement() of XSDParticleImpl from a modelGroup
>> contents which i read out.but i don't know how to add a
>> DeferredElementNSImpl to a XSDParticleImpl. It doesnt work using the
>> setContent() method.
>>
>>
>> Ed Merks wrote:
>>
>>> HT,
>>
>>
>>> That implementation class implements Element, so this should not be a
>>> problem. You're not very clear on what you tried to do. In general,
>>> I would not expect you to call setElement on anything but an
>>> XSDSchema...
>>
>>
>>
>>> HT Ooi wrote:
>>
>>
>>>> Hi,
>>>>
>>>> I have a question.when reading out a schema, the return type of a
>>>> particle as a child from the sequence tag below is of type
>>>> org.apache.xerces.dom.DeferredElementNSImpl but not
>>>> org.w3c.dom.Element as I have expected it to be.
>>>>
>>>> <element name="ServiceProperties">
>>>> <complexType>
>>>> <sequence>
>>>> <element ref="tns:OtherEnabledState" /> .......
>>>>
>>>> what is the reason for that? I have also tried to set the content of
>>>> a XSDModelGroup instance to this DeferredElementNSImpl but it
>>>> doesnt work.
>>>>
>>>> Thank you.
>>>>
>>
>>
Re: particle.getElement() [message #55704 is a reply to message #55677] Tue, 30 November 2004 17:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------060505020801040700040604
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

HT,

XSDParticle.getContent will return either an XSDModelGroupDefinition, an
XSDModelGroup, or an XSDElementDeclaration. You need to do instanceof
to check for the one you are interested in.

To *copy *the content from one particle to another, you'd do something
like this:

otherXSDParticle.setContent((XSDParticleContent)xsdParticle. getContent().cloneConcreteComponent(true,
false))

But probably you really should be moving/copying the particles
themselves, not the content ...


HT Ooi wrote:

> Ed,
>
> I undertand what you mean. I am actually concentrating on the XSD
> API's. I am not using any DOM API. And I have looked throught the
> examples on how to create.My question is how I read a schema. Please
> bear with me.
>
> I dint use setElement in the Particle,I used setContent.I use
> getElement only to read it out.
>
> what I wanted to do was to copy the elements(<element
> ref="tns:OtherEnabledState" />) in
> <element name="ServiceProperties">
> <complexType>
> <sequence>
> <element ref="tns:OtherEnabledState" /> .......
>
> and stick them in another complexType sequence. But i do not know how
> to read them out properly as XSDElementDeclaration.
> Thanks for your time.
>
>
>
>> HT,
>
>
>> You should focus on either editing the DOM directly using only DOM
>> APIs (the XSD model will synchronize with your changes to the DOM) or
>> editing the XSD model directly using only the XSD APIs (the DOM will
>> synchronize with the changes in the XSD model). Don't try to edit by
>> calling setElement; that will never work. The XSDPrototypicalSchema
>> has samples for how to create all the types of XSD instances bottom
>> up, so you should have a look at those.
>
>
>
>> HT Ooi wrote:
>
>
>>> Ed,
>>>
>>> yeah,I'm an absolute newbie in xml technologies. I was meaning to
>>> say XSDElementDeclaration instead of the dom element. sorry..
>>> how do I go about it then? i mean i can extract
>>> DeferredElementNSImpl when I extract using getElement() of
>>> XSDParticleImpl from a modelGroup contents which i read out.but i
>>> don't know how to add a DeferredElementNSImpl to a XSDParticleImpl.
>>> It doesnt work using the setContent() method.
>>>
>>>
>>> Ed Merks wrote:
>>>
>>>> HT,
>>>
>>>
>>>
>>>> That implementation class implements Element, so this should not be
>>>> a problem. You're not very clear on what you tried to do. In
>>>> general, I would not expect you to call setElement on anything but
>>>> an XSDSchema...
>>>
>>>
>>>
>>>
>>>> HT Ooi wrote:
>>>
>>>
>>>
>>>>> Hi,
>>>>>
>>>>> I have a question.when reading out a schema, the return type of a
>>>>> particle as a child from the sequence tag below is of type
>>>>> org.apache.xerces.dom.DeferredElementNSImpl but not
>>>>> org.w3c.dom.Element as I have expected it to be.
>>>>>
>>>>> <element name="ServiceProperties">
>>>>> <complexType>
>>>>> <sequence>
>>>>> <element ref="tns:OtherEnabledState" /> .......
>>>>>
>>>>> what is the reason for that? I have also tried to set the content
>>>>> of a XSDModelGroup instance to this DeferredElementNSImpl but it
>>>>> doesnt work.
>>>>>
>>>>> Thank you.
>>>>>
>>>
>>>
>
>


--------------060505020801040700040604
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
HT,<br>
<br>
XSDParticle.getContent will return either an XSDModelGroupDefinition,
an XSDModelGroup, or an XSDElementDeclaration.
Re: particle.getElement() [message #55731 is a reply to message #55704] Wed, 01 December 2004 13:18 Go to previous message
Eclipse UserFriend
Originally posted by: ooi.de.ibm.com

Tried moving the particles instead.It a good idea.. Thanks Ed.

Ed Merks wrote:

> HT,

> XSDParticle.getContent will return either an XSDModelGroupDefinition, an
> XSDModelGroup, or an XSDElementDeclaration. You need to do instanceof
> to check for the one you are interested in.

> To *copy *the content from one particle to another, you'd do something
> like this:

>
otherXSDParticle.setContent((XSDParticleContent)xsdParticle. getContent().cloneConcreteComponent(true,
> false))

> But probably you really should be moving/copying the particles
> themselves, not the content ...


> HT Ooi wrote:

>> Ed,
>>
>> I undertand what you mean. I am actually concentrating on the XSD
>> API's. I am not using any DOM API. And I have looked throught the
>> examples on how to create.My question is how I read a schema. Please
>> bear with me.
>>
>> I dint use setElement in the Particle,I used setContent.I use
>> getElement only to read it out.
>>
>> what I wanted to do was to copy the elements(<element
>> ref="tns:OtherEnabledState" />) in
>> <element name="ServiceProperties">
>> <complexType>
>> <sequence>
>> <element ref="tns:OtherEnabledState" /> .......
>>
>> and stick them in another complexType sequence. But i do not know how
>> to read them out properly as XSDElementDeclaration.
>> Thanks for your time.
>>
>>
>>
>>> HT,
>>
>>
>>> You should focus on either editing the DOM directly using only DOM
>>> APIs (the XSD model will synchronize with your changes to the DOM) or
>>> editing the XSD model directly using only the XSD APIs (the DOM will
>>> synchronize with the changes in the XSD model). Don't try to edit by
>>> calling setElement; that will never work. The XSDPrototypicalSchema
>>> has samples for how to create all the types of XSD instances bottom
>>> up, so you should have a look at those.
>>
>>
>>
>>> HT Ooi wrote:
>>
>>
>>>> Ed,
>>>>
>>>> yeah,I'm an absolute newbie in xml technologies. I was meaning to
>>>> say XSDElementDeclaration instead of the dom element. sorry..
>>>> how do I go about it then? i mean i can extract
>>>> DeferredElementNSImpl when I extract using getElement() of
>>>> XSDParticleImpl from a modelGroup contents which i read out.but i
>>>> don't know how to add a DeferredElementNSImpl to a XSDParticleImpl.
>>>> It doesnt work using the setContent() method.
>>>>
>>>>
>>>> Ed Merks wrote:
>>>>
>>>>> HT,
>>>>
>>>>
>>>>
>>>>> That implementation class implements Element, so this should not be
>>>>> a problem. You're not very clear on what you tried to do. In
>>>>> general, I would not expect you to call setElement on anything but
>>>>> an XSDSchema...
>>>>
>>>>
>>>>
>>>>
>>>>> HT Ooi wrote:
>>>>
>>>>
>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have a question.when reading out a schema, the return type of a
>>>>>> particle as a child from the sequence tag below is of type
>>>>>> org.apache.xerces.dom.DeferredElementNSImpl but not
>>>>>> org.w3c.dom.Element as I have expected it to be.
>>>>>>
>>>>>> <element name="ServiceProperties">
>>>>>> <complexType>
>>>>>> <sequence>
>>>>>> <element ref="tns:OtherEnabledState" /> .......
>>>>>>
>>>>>> what is the reason for that? I have also tried to set the content
>>>>>> of a XSDModelGroup instance to this DeferredElementNSImpl but it
>>>>>> doesnt work.
>>>>>>
>>>>>> Thank you.
>>>>>>
>>>>
>>>>
>>
>>
Re: particle.getElement() [message #592872 is a reply to message #55570] Tue, 30 November 2004 14:54 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
HT,

That implementation class implements Element, so this should not be a
problem. You're not very clear on what you tried to do. In general, I
would not expect you to call setElement on anything but an XSDSchema...


HT Ooi wrote:

> Hi,
>
> I have a question.when reading out a schema, the return type of a
> particle as a child from the sequence tag below is of type
> org.apache.xerces.dom.DeferredElementNSImpl but not
> org.w3c.dom.Element as I have expected it to be.
>
> <element name="ServiceProperties">
> <complexType>
> <sequence>
> <element ref="tns:OtherEnabledState" /> .......
>
> what is the reason for that? I have also tried to set the content of
> a XSDModelGroup instance to this DeferredElementNSImpl but it doesnt
> work.
>
> Thank you.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: particle.getElement() [message #592885 is a reply to message #55598] Tue, 30 November 2004 15:08 Go to previous message
Eclipse UserFriend
Originally posted by: ooi.ibm.com

Ed,

yeah,I'm an absolute newbie in xml technologies. I was meaning to say
XSDElementDeclaration instead of the dom element. sorry..
how do I go about it then? i mean i can extract DeferredElementNSImpl when
I extract using getElement() of XSDParticleImpl from a modelGroup contents
which i read out.but i don't know how to add a DeferredElementNSImpl to a
XSDParticleImpl. It doesnt work using the setContent() method.


Ed Merks wrote:

> HT,

> That implementation class implements Element, so this should not be a
> problem. You're not very clear on what you tried to do. In general, I
> would not expect you to call setElement on anything but an XSDSchema...


> HT Ooi wrote:

>> Hi,
>>
>> I have a question.when reading out a schema, the return type of a
>> particle as a child from the sequence tag below is of type
>> org.apache.xerces.dom.DeferredElementNSImpl but not
>> org.w3c.dom.Element as I have expected it to be.
>>
>> <element name="ServiceProperties">
>> <complexType>
>> <sequence>
>> <element ref="tns:OtherEnabledState" /> .......
>>
>> what is the reason for that? I have also tried to set the content of
>> a XSDModelGroup instance to this DeferredElementNSImpl but it doesnt
>> work.
>>
>> Thank you.
>>
Re: particle.getElement() [message #592894 is a reply to message #55624] Tue, 30 November 2004 16:00 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
HT,

You should focus on either editing the DOM directly using only DOM APIs
(the XSD model will synchronize with your changes to the DOM) or editing
the XSD model directly using only the XSD APIs (the DOM will synchronize
with the changes in the XSD model). Don't try to edit by calling
setElement; that will never work. The XSDPrototypicalSchema has samples
for how to create all the types of XSD instances bottom up, so you
should have a look at those.


HT Ooi wrote:

> Ed,
>
> yeah,I'm an absolute newbie in xml technologies. I was meaning to say
> XSDElementDeclaration instead of the dom element. sorry..
> how do I go about it then? i mean i can extract DeferredElementNSImpl
> when I extract using getElement() of XSDParticleImpl from a modelGroup
> contents which i read out.but i don't know how to add a
> DeferredElementNSImpl to a XSDParticleImpl. It doesnt work using the
> setContent() method.
>
>
> Ed Merks wrote:
>
>> HT,
>
>
>> That implementation class implements Element, so this should not be a
>> problem. You're not very clear on what you tried to do. In general,
>> I would not expect you to call setElement on anything but an
>> XSDSchema...
>
>
>
>> HT Ooi wrote:
>
>
>>> Hi,
>>>
>>> I have a question.when reading out a schema, the return type of a
>>> particle as a child from the sequence tag below is of type
>>> org.apache.xerces.dom.DeferredElementNSImpl but not
>>> org.w3c.dom.Element as I have expected it to be.
>>>
>>> <element name="ServiceProperties">
>>> <complexType>
>>> <sequence>
>>> <element ref="tns:OtherEnabledState" /> .......
>>>
>>> what is the reason for that? I have also tried to set the content of
>>> a XSDModelGroup instance to this DeferredElementNSImpl but it
>>> doesnt work.
>>>
>>> Thank you.
>>>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: particle.getElement() [message #592907 is a reply to message #55650] Tue, 30 November 2004 16:10 Go to previous message
Eclipse UserFriend
Originally posted by: ooi.de.ibm.com

Ed,

I undertand what you mean. I am actually concentrating on the XSD API's. I
am not using any DOM API. And I have looked throught the examples on how
to create.My question is how I read a schema. Please bear with me.

I dint use setElement in the Particle,I used setContent.I use getElement
only to read it out.

what I wanted to do was to copy the elements(<element
ref="tns:OtherEnabledState" />) in

<element name="ServiceProperties">
<complexType>
<sequence>
<element ref="tns:OtherEnabledState" /> .......

and stick them in another complexType sequence. But i do not know how to
read them out properly as XSDElementDeclaration.

Thanks for your time.



> HT,

> You should focus on either editing the DOM directly using only DOM APIs
> (the XSD model will synchronize with your changes to the DOM) or editing
> the XSD model directly using only the XSD APIs (the DOM will synchronize
> with the changes in the XSD model). Don't try to edit by calling
> setElement; that will never work. The XSDPrototypicalSchema has samples
> for how to create all the types of XSD instances bottom up, so you
> should have a look at those.


> HT Ooi wrote:

>> Ed,
>>
>> yeah,I'm an absolute newbie in xml technologies. I was meaning to say
>> XSDElementDeclaration instead of the dom element. sorry..
>> how do I go about it then? i mean i can extract DeferredElementNSImpl
>> when I extract using getElement() of XSDParticleImpl from a modelGroup
>> contents which i read out.but i don't know how to add a
>> DeferredElementNSImpl to a XSDParticleImpl. It doesnt work using the
>> setContent() method.
>>
>>
>> Ed Merks wrote:
>>
>>> HT,
>>
>>
>>> That implementation class implements Element, so this should not be a
>>> problem. You're not very clear on what you tried to do. In general,
>>> I would not expect you to call setElement on anything but an
>>> XSDSchema...
>>
>>
>>
>>> HT Ooi wrote:
>>
>>
>>>> Hi,
>>>>
>>>> I have a question.when reading out a schema, the return type of a
>>>> particle as a child from the sequence tag below is of type
>>>> org.apache.xerces.dom.DeferredElementNSImpl but not
>>>> org.w3c.dom.Element as I have expected it to be.
>>>>
>>>> <element name="ServiceProperties">
>>>> <complexType>
>>>> <sequence>
>>>> <element ref="tns:OtherEnabledState" /> .......
>>>>
>>>> what is the reason for that? I have also tried to set the content of
>>>> a XSDModelGroup instance to this DeferredElementNSImpl but it
>>>> doesnt work.
>>>>
>>>> Thank you.
>>>>
>>
>>
Re: particle.getElement() [message #592918 is a reply to message #55677] Tue, 30 November 2004 17:35 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060505020801040700040604
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

HT,

XSDParticle.getContent will return either an XSDModelGroupDefinition, an
XSDModelGroup, or an XSDElementDeclaration. You need to do instanceof
to check for the one you are interested in.

To *copy *the content from one particle to another, you'd do something
like this:

otherXSDParticle.setContent((XSDParticleContent)xsdParticle. getContent().cloneConcreteComponent(true,
false))

But probably you really should be moving/copying the particles
themselves, not the content ...


HT Ooi wrote:

> Ed,
>
> I undertand what you mean. I am actually concentrating on the XSD
> API's. I am not using any DOM API. And I have looked throught the
> examples on how to create.My question is how I read a schema. Please
> bear with me.
>
> I dint use setElement in the Particle,I used setContent.I use
> getElement only to read it out.
>
> what I wanted to do was to copy the elements(<element
> ref="tns:OtherEnabledState" />) in
> <element name="ServiceProperties">
> <complexType>
> <sequence>
> <element ref="tns:OtherEnabledState" /> .......
>
> and stick them in another complexType sequence. But i do not know how
> to read them out properly as XSDElementDeclaration.
> Thanks for your time.
>
>
>
>> HT,
>
>
>> You should focus on either editing the DOM directly using only DOM
>> APIs (the XSD model will synchronize with your changes to the DOM) or
>> editing the XSD model directly using only the XSD APIs (the DOM will
>> synchronize with the changes in the XSD model). Don't try to edit by
>> calling setElement; that will never work. The XSDPrototypicalSchema
>> has samples for how to create all the types of XSD instances bottom
>> up, so you should have a look at those.
>
>
>
>> HT Ooi wrote:
>
>
>>> Ed,
>>>
>>> yeah,I'm an absolute newbie in xml technologies. I was meaning to
>>> say XSDElementDeclaration instead of the dom element. sorry..
>>> how do I go about it then? i mean i can extract
>>> DeferredElementNSImpl when I extract using getElement() of
>>> XSDParticleImpl from a modelGroup contents which i read out.but i
>>> don't know how to add a DeferredElementNSImpl to a XSDParticleImpl.
>>> It doesnt work using the setContent() method.
>>>
>>>
>>> Ed Merks wrote:
>>>
>>>> HT,
>>>
>>>
>>>
>>>> That implementation class implements Element, so this should not be
>>>> a problem. You're not very clear on what you tried to do. In
>>>> general, I would not expect you to call setElement on anything but
>>>> an XSDSchema...
>>>
>>>
>>>
>>>
>>>> HT Ooi wrote:
>>>
>>>
>>>
>>>>> Hi,
>>>>>
>>>>> I have a question.when reading out a schema, the return type of a
>>>>> particle as a child from the sequence tag below is of type
>>>>> org.apache.xerces.dom.DeferredElementNSImpl but not
>>>>> org.w3c.dom.Element as I have expected it to be.
>>>>>
>>>>> <element name="ServiceProperties">
>>>>> <complexType>
>>>>> <sequence>
>>>>> <element ref="tns:OtherEnabledState" /> .......
>>>>>
>>>>> what is the reason for that? I have also tried to set the content
>>>>> of a XSDModelGroup instance to this DeferredElementNSImpl but it
>>>>> doesnt work.
>>>>>
>>>>> Thank you.
>>>>>
>>>
>>>
>
>


--------------060505020801040700040604
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
HT,<br>
<br>
XSDParticle.getContent will return either an XSDModelGroupDefinition,
an XSDModelGroup, or an XSDElementDeclaration.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: particle.getElement() [message #592935 is a reply to message #55704] Wed, 01 December 2004 13:18 Go to previous message
Eclipse UserFriend
Originally posted by: ooi.de.ibm.com

Tried moving the particles instead.It a good idea.. Thanks Ed.

Ed Merks wrote:

> HT,

> XSDParticle.getContent will return either an XSDModelGroupDefinition, an
> XSDModelGroup, or an XSDElementDeclaration. You need to do instanceof
> to check for the one you are interested in.

> To *copy *the content from one particle to another, you'd do something
> like this:

>
otherXSDParticle.setContent((XSDParticleContent)xsdParticle. getContent().cloneConcreteComponent(true,
> false))

> But probably you really should be moving/copying the particles
> themselves, not the content ...


> HT Ooi wrote:

>> Ed,
>>
>> I undertand what you mean. I am actually concentrating on the XSD
>> API's. I am not using any DOM API. And I have looked throught the
>> examples on how to create.My question is how I read a schema. Please
>> bear with me.
>>
>> I dint use setElement in the Particle,I used setContent.I use
>> getElement only to read it out.
>>
>> what I wanted to do was to copy the elements(<element
>> ref="tns:OtherEnabledState" />) in
>> <element name="ServiceProperties">
>> <complexType>
>> <sequence>
>> <element ref="tns:OtherEnabledState" /> .......
>>
>> and stick them in another complexType sequence. But i do not know how
>> to read them out properly as XSDElementDeclaration.
>> Thanks for your time.
>>
>>
>>
>>> HT,
>>
>>
>>> You should focus on either editing the DOM directly using only DOM
>>> APIs (the XSD model will synchronize with your changes to the DOM) or
>>> editing the XSD model directly using only the XSD APIs (the DOM will
>>> synchronize with the changes in the XSD model). Don't try to edit by
>>> calling setElement; that will never work. The XSDPrototypicalSchema
>>> has samples for how to create all the types of XSD instances bottom
>>> up, so you should have a look at those.
>>
>>
>>
>>> HT Ooi wrote:
>>
>>
>>>> Ed,
>>>>
>>>> yeah,I'm an absolute newbie in xml technologies. I was meaning to
>>>> say XSDElementDeclaration instead of the dom element. sorry..
>>>> how do I go about it then? i mean i can extract
>>>> DeferredElementNSImpl when I extract using getElement() of
>>>> XSDParticleImpl from a modelGroup contents which i read out.but i
>>>> don't know how to add a DeferredElementNSImpl to a XSDParticleImpl.
>>>> It doesnt work using the setContent() method.
>>>>
>>>>
>>>> Ed Merks wrote:
>>>>
>>>>> HT,
>>>>
>>>>
>>>>
>>>>> That implementation class implements Element, so this should not be
>>>>> a problem. You're not very clear on what you tried to do. In
>>>>> general, I would not expect you to call setElement on anything but
>>>>> an XSDSchema...
>>>>
>>>>
>>>>
>>>>
>>>>> HT Ooi wrote:
>>>>
>>>>
>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have a question.when reading out a schema, the return type of a
>>>>>> particle as a child from the sequence tag below is of type
>>>>>> org.apache.xerces.dom.DeferredElementNSImpl but not
>>>>>> org.w3c.dom.Element as I have expected it to be.
>>>>>>
>>>>>> <element name="ServiceProperties">
>>>>>> <complexType>
>>>>>> <sequence>
>>>>>> <element ref="tns:OtherEnabledState" /> .......
>>>>>>
>>>>>> what is the reason for that? I have also tried to set the content
>>>>>> of a XSDModelGroup instance to this DeferredElementNSImpl but it
>>>>>> doesnt work.
>>>>>>
>>>>>> Thank you.
>>>>>>
>>>>
>>>>
>>
>>
Previous Topic:particle.getElement()
Next Topic:Node -> XSDConcreteComponent
Goto Forum:
  


Current Time: Fri Mar 29 10:33:36 GMT 2024

Powered by FUDForum. Page generated in 0.03110 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top