Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] [MOXy] sorting xpaths for self mapping

I have a question regarding the xml descriptor sorting functionality in the
Workbench.  I understand the basic concept of sorting the descriptors by
their xpaths.  

Say that this is the correct order of the elements:

<Container>
    <ElementOne />
    <ElementTwo />
    <ElementThree />
    <ElementFour />
</Container>

Then if I define an object named Container with all four Strings inside it:

class Container {
    String elementFour   (xpath="ElementFour")
    String elementThree (xpath="ElementThree")
    String elementTwo   (xpath="ElementTwo")
    String elementOne   (xpath="ElementOne")
}

It is easy to consult the schema and sort these attributes by their xpaths.

However, what happens when there is a helper object that uses the "self"
mapping?  Say my object model is like this:

class Container {
    String elementFour (xpath="ElementFour")
    String elementOne  (xpath="ElementOne")
    MiddleTwoElements midTwoElements (xpath=".")
}

class MiddleTwoElements {
    String elementThree (xpath="ElementThree")
    String elementTwo   (xpath="ElementTwo")
}

Does the Workbench sort across all of these xpaths so that the order of the
mappings is elementOne, midTwoElements, and elementFour?

Then what happens if the user picks some random elements to put into the
helper object like this:

class Container {
    OddElements oddElements    (xpath=".")
    EvenElements evenElements (xpath=".")
}

class OddElements {
    String elementThree (xpath="ElementThree")
    String elementOne   (xpath="ElementOne")
}

class EvenElements {
    String elementFour (xpath="ElementFour")
    String elementTwo (xpath="ElementTwo")
}

There is no way to sort these descriptors so that you get valid XML right? 
I mean Container has two XMLCompositeObjectMappings for OddElements and
EvenElements, so the best that you can get is an order of ElementOne,
ElementThree, ElementTwo, ElementFour.  

Is there a limitation that the user can only pick consecutive elements to
encapsulate into a helper object or are you doing some other magic in the
Workbench?  ;)

Thanks!
--Polly
-- 
View this message in context: http://www.nabble.com/-MOXy--sorting-xpaths-for-self-mapping-tp22669219p22669219.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top