E
Erik Sargent
I might have the terms wrong, I'm an XML newbie, but here is what I
need to do:
I am returning an object in a webservice.
public class Profile
{
public String clinic1accountName;
public String clinic2accountName;
}
Which will return something like:
<Profile>
<clinic1accountName>1234</clinic1accountName>
<clinic2accountName>1234</clinic2accountName>
</Profile>
The trick is that each clinic has some additional metadata with it,
such as the business unit it belongs to (there are 40 clinics in 6
units) and I would like to return that as a property(?) of the node,
so it would look something like
<Profile>
<clinic1accountName org="1">1234</clinic1accountName>
<clinic2accountName org="2">1234</clinic2accountName>
</Profile>
I had guessed that I could do something with Attributes, but I haven't
found the right combination. One example was:
public class Profile
{
[System.Xml.Serialization.XmlAttribute(AttributeName = "org")]
public String clinic1accountName;
public String clinic2accountName;
}
But this eliminates accountNumber1 from the body and adds the "org" as
a property of the class' top node ("Profile"), rather than as a
property of "clinic1accountName".
<Profile org="1234">
<clinic2accountName org="2">1234</clinic2accountName>
</Profile>
I suppose there are other ways to pass the information along, but it
seemed to me that since the service knows this metadata and the
application doesn't and shouldn't, but needs to pass the value along
in some cases, that I should try to keep the information in the XML
data itself, rather than try to teach the application how to fetch it
and associate it with each account.
By the way, the org value is always the same for each
clinicAccountName, so clinic14 will always be org=5.
Thank you for reading and any ideas you may have.
need to do:
I am returning an object in a webservice.
public class Profile
{
public String clinic1accountName;
public String clinic2accountName;
}
Which will return something like:
<Profile>
<clinic1accountName>1234</clinic1accountName>
<clinic2accountName>1234</clinic2accountName>
</Profile>
The trick is that each clinic has some additional metadata with it,
such as the business unit it belongs to (there are 40 clinics in 6
units) and I would like to return that as a property(?) of the node,
so it would look something like
<Profile>
<clinic1accountName org="1">1234</clinic1accountName>
<clinic2accountName org="2">1234</clinic2accountName>
</Profile>
I had guessed that I could do something with Attributes, but I haven't
found the right combination. One example was:
public class Profile
{
[System.Xml.Serialization.XmlAttribute(AttributeName = "org")]
public String clinic1accountName;
public String clinic2accountName;
}
But this eliminates accountNumber1 from the body and adds the "org" as
a property of the class' top node ("Profile"), rather than as a
property of "clinic1accountName".
<Profile org="1234">
<clinic2accountName org="2">1234</clinic2accountName>
</Profile>
I suppose there are other ways to pass the information along, but it
seemed to me that since the service knows this metadata and the
application doesn't and shouldn't, but needs to pass the value along
in some cases, that I should try to keep the information in the XML
data itself, rather than try to teach the application how to fetch it
and associate it with each account.
By the way, the org value is always the same for each
clinicAccountName, so clinic14 will always be org=5.
Thank you for reading and any ideas you may have.