XML Mappings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

XML Mappings

jtuchel
Hi,

I am having a few problems with Xml mappings and serialization of objects to XML.

1) The schema from the third party defines a namespace for all tags, but in the docs they ask to not send some portion of the xml without namespaces. Is there a way to do that using XML mapping specs or hand-written specs? The attribute mappings have a namespaceURI of nil, but the schema defines the namespace suffix for the tags.

2) When I write an XML file using abtXmlPrintOn:context:, how can I produce the leading definitions including namespace definitions? Where can I get them from. Using abtXmlPrintOn:Context:, the tags get a prefix named zmls:whatever. Can I be sure it always is "zmls"? Can I ask the mapper/output serializer or any other object for these namespaces or even the complete tags?

3) I need to map attributes of an object as a combined Subelement with Attributes. I mean I want to map two attributes of an object to a Subelement that has one of the attributes as text node and the other one as an Attribute. To clarify, I reuse an example from the VAST Users Guide:

Assuming I want to serialize a JrcCustomer like this:

<Order number="O00001" status="Open">
<Customer>
   <CustomerID number="C135">Joe Smith</CustomerID>
</Customer>
<Order.date>2000-02-14</Order.date>
</Order>


and both id and name are instance variables of teh Customer Class, how can I map this?

For the case of

<CustomerID name="Joe Smith" number="C135">


The User Guide proposes a mapping spec like this:

<ClassElementMapping ElementTagName="Customer" ClassName="JrcCustomer">
  <AttributeMapping ClassAttribute="number">
    <SubElement>CustomerID</SubElement>
      <Attribute>number</Attribute>
</AttributeMapping>
<AttributeMapping ClassAttribute="name">
<SubElement>CustomerID</SubElement>
<Attribute>name</Attribute>
</AttributeMapping>
</ClassElementMapping>



--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/lRgulXnqHNsJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: XML Mappings

jtuchel

Sorry, I somehow posted too fast...


<ClassElementMapping ElementTagName="Customer" ClassName="JrcCustomer">
  <AttributeMapping ClassAttribute="number">
    <SubElement>CustomerID</SubElement>
      <Attribute>number</Attribute>
</AttributeMapping>
<AttributeMapping ClassAttribute="name">
<SubElement>CustomerID</SubElement>
<Attribute>name</Attribute>
</AttributeMapping>
</ClassElementMapping>


but I cannot find a way to modify this to my needs. How can i make CustomerID->name the text node in the CustomerID tag?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/P7oRmg7gJJMJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: XML Mappings

jtuchel
In reply to this post by jtuchel
Sorry, bad typo:

1) The schema from the third party defines a namespace for all tags, but in the docs they ask to not send some portion of the xml without namespaces.

They ask me to send some tags without namespaces, even though their schema defines them for all tags. At least they state which ones should not have a namespace ;-)

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/QQppSE5g5KsJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: XML Mappings

Marten Feldtmann-2
That seems to indicate, that they also have troubles :-) ? Smalltalker ?
:-))))

Marten


Am 16.08.2012 08:52, schrieb [hidden email]:
>
> They ask me to send some tags without namespaces, even though their
> schema defines them for all tags. At least they state which ones
> should not have a namespace ;-)
> -

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: XML Mappings

jtuchel
Maybe using XML is asking for trouble, even outside of the Smalltalk world ;-)

But yes, it is illogical and somewhat strange. The documentation really says: Don't use any namespaces for the tags in these sections of the document.

They also ask me to not send any empty tags. A question I forgot. Ho do I prevent the XML mappers to not send a tag if the instance variable value is nil.

Oh my, I could live perfectly happy without this XML interface. My customers see it differenty... :-(

Joachim


Am Donnerstag, 16. August 2012 09:27:04 UTC+2 schrieb Marten Feldtmann:
That seems to indicate, that they also have troubles :-) ? Smalltalker ?
:-))))

Marten


Am 16.08.2012 08:52, schrieb <a href="javascript:" target="_blank" gdf-obfuscated-mailto="4q4JxkYol3AJ">jtu...@...:
>
> They ask me to send some tags without namespaces, even though their
> schema defines them for all tags. At least they state which ones
> should not have a namespace ;-)
> -

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/8lS19-WF7ZwJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.