Jump to content

kevinaworkman

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About kevinaworkman

  • Rank
    Newbie

Profile Information

  • Location
    Washington, DC
  1. Understood. Everything works great now, I'm getting the strings into my java program exactly how I wanted to.However, there is one problem that I knew would pop up. Since the strings (within childOfTagInQuestion) themselves are actually a series of data separated by spaces, like this: "stringOne stringTwo stringThree", I'm gathering that XML considers them to be a list of strings, with each element separated by white space, as opposed to one longer string containing the data and spaces? So, I'm actually only getting the first part of each string that I want, and losing the data after the first space?So, I suppose that just means I have to declare childOfTagInQuestion to be a list of strings, thereby making theTagInQuestion a list of lists. Is that possible? I looked online but I can't see anywhere with an example of how to do a 2-dimensional array like that.. but probably just because it's something so simple that people don't bother creating tutorials for it!Thanks again!
  2. Thanks a ton, you've answered my question completely! Aw man, you mean I actually have to DO stuff with these message?! I might be a newbie, but I'm not that dumb. I'm using JAXB to unmarshall the data contained by the XML messages. Creating this schema was just the first step. The java stuff I can handle, but I always have a hard time wrapping my head around exactly what to do with XML.Thanks for all your help, I appreciate it!
  3. Hello,I'm very new to XML Schemas, but I'm using them to send messages between a c/c++ backend (somebody else's job) and a java frontend (my job).The system works fine so far, but we're adding some functionality that I want to make sure I have my head wrapped around. I just wanted to make sure that I'm fully understanding the process here. The backend sends me an XML file that looks something like this: <?xml version="1.0" encoding="UTF-8" standalone="no"?><programMessage xmlns="http://www.thisIsJustASample.org/program" xmlns: xsd="http://www.w3.org/2001/XMLSchema"><monitoredResource> <theTagInQuestion> <childOfTagInQuestion>string data</childOfTagInQuestion> <childOfTagInQuestion>string data</childOfTagInQuestion> <childOfTagInQuestion>string data</childOfTagInQuestion> <childOfTagInQuestion>string data</childOfTagInQuestion> <childOfTagInQuestion>string data</childOfTagInQuestion> <childOfTagInQuestion>string data</childOfTagInQuestion> <childOfTagInQuestion>string data</childOfTagInQuestion> <childOfTagInQuestion>string data</childOfTagInQuestion> </theTagInQuestion></monitoredResource> So basically, a monitoredResource contains a theTagInQuestion, which contains 8 childOfTagInQuestion. The ultimate goal is to convert the strings contained by childOfTagInQuestion into a list in java using JAXB.My question is, does this schema look correct so far? This should contain a monitoredResource, which contains a theTagInQuestion, which is a list of 8 childOfTagInQuestion, which, finally, are strings. Am I doing something wrong?The schema looks like this: <?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:pg="http://www.thisIsJustASample.org/program" xmlns="http://www.w3.org/2001/XMLSchema"><xsd:element name="monitoredResource"> <xsd:complexType> <xsd:sequence> <xsd:element ref="pg:theTagInQuestion"/> </xsd:sequence> </xsd:complexType></xsd:element><xsd:element name="theTagInQuestion"/><xsd:simpleType> <xsd:list itemType="pg:childOfTagInQuestion"/></xsd:simpleType></xsd:element><xsd:simpleType name="childOfTagInQuestion"> <xsd:restriction base="xsd:string" xsd:default="DEFAULT"> </xsd:restriction></xsd:simpleType></xsd:schema> Does this look like what I described? If not, what should I change? Also, ultimately childOfTagInQuestion might actually be a list of strings, so theTagInQuestion will actually be a list of lists. How would I go about doing that?I appreciate anybody's help on this. I'm very new to using XML (I love java, but these markup languages just confuse me), so any assistance is greatly appreciated!
×
×
  • Create New...