Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Adding @type attributes.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Christian Höltje  
View profile  
 More options Mar 31 2008, 3:46 pm
From: Christian Höltje <docw...@gmail.com>
Date: Mon, 31 Mar 2008 12:46:26 -0700 (PDT)
Local: Mon, Mar 31 2008 3:46 pm
Subject: Adding @type attributes.
There are a couple cases where it isn't obvious what type of JSON
construct a bit of XML should be.

Example:
<array-or-object>
  <item>1</item>
</array-or-object>

<array-or-object-or-null/>

<string-or-number>1</string-or-number>
<string-or-boolean>true</string-or-boolean>

In these cases, I think adding a hint to xml2json would be a good
thing.  I was thinking an attribute like @type or @jsontype which
would be set to "string", "array" or "object".

Thoughts?  Is there a better way to do this?

Ciao!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
doekman  
View profile  
 More options Apr 7 2008, 7:43 am
From: doekman <doek...@gmail.com>
Date: Mon, 7 Apr 2008 04:43:18 -0700 (PDT)
Local: Mon, Apr 7 2008 7:43 am
Subject: Re: Adding @type attributes.
I have two other ideas:
- define types via xml scheme (xsd)
- do something with xslt-parameters

I favour the second one, but I haven't actually thought about how to
implement it.

Doeke

On Mar 31, 9:46 pm, Christian Höltje <docw...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Höltje  
View profile  
 More options Apr 7 2008, 10:33 am
From: Christian Höltje <docw...@gmail.com>
Date: Mon, 7 Apr 2008 07:33:45 -0700 (PDT)
Local: Mon, Apr 7 2008 10:33 am
Subject: Re: Adding @type attributes.
On Apr 7, 2008, at 7:43 AM, doekman wrote:

> I have two other ideas:
> - define types via xml scheme (xsd)
> - do something with xslt-parameters

> I favour the second one, but I haven't actually thought about how to
> implement it.

I'm not familiar with XSD at all.  I'm not sure what support it has
for semi-structured schemas, since the advantage XML2JSON has right
now is that you can define schemas as you go, to fit the data.

I don't think attributes should be allowed to be used for actual
data.  Which is why I think using attributes for out-of-band
information like type is a good idea.  It lets you define the JSON on
the fly.  It also has the good property that you set the data-type at
the same time you create the data instead of multiple places.

Using xslt-parameters is annoying because you'll have to either
generate an XPath (which can be hard, programatically, since you may
not now how far down the tree you are) or via some other mechanism
which I haven't thought of yet.

I realize that attributes are used in the JS code, but I'm not as
interested in the JS code.  I'll not break it but I don't see the use
case for it that JSON won't provide.  Worst case, you can generate
JSON and have the JS suck that in.

Ciao!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »