Wednesday, May 13, 2015

Blueberry Cheeseball Receipe

Ingredients
  • 1 pkg. (3.5 oz.) dried blueberries
  • 1 cup boiling water
  • 8 oz. cream cheese, softened
  • ½ cup. feta cheese, crumbled
  • ¼ cup. red onion, minced
  • 2 tablespoon fresh basil, minced
  • 1 teaspoon apple cider vinegar
  • ¾ cup pecans, finely chopped and toasted
Instructions
  1. In a glass bowl, pour the boiling water over the dried blueberries and allow to sit for 5 minutes. Drain well.
  2. In the bowl of a stand mixer fitted with the paddle attachment, add the softened cream cheese, softened blueberries, feta cheese, red onion, basil and vinegar. Mix on low until well combined, then beat on medium for about one minute.
  3. Form cheese mixture into a ball shape and wrap tightly in plastic wrap. Allow to cool in the refrigerator for at least 2 hours. Can be made 1 day in advance.
  4. Before serving, roll the cheeseball in the toasted pecans until it is evenly coated. Serve with crackers.

Wednesday, April 22, 2015

NY (7-Day) Trip Planner



M – Morning, D – Day, E – Evening, N – Night, WD – Whole Day
Note: Landmark on bold need tickets.

Day 1
  1. Grand Center D
  2. UN D
  3. Rockefeller N
  4. Time Square N
Day 2
  1. Union square M/D – Farmers market every Mon/Wed/Fri/Sat 8AM-6PM
  2. Greenwich Village D
  3. Empire State Building N – If going on top go at night for bright view also need to buy ticket.
Day 3
  1. Statue of Liberty and Ellis Island WD (Ferry will take to both statue and island. But I don’t recommend Ellis island since there is nothing good to see and will save time too)
  2. Battery Park E
  3. Wall Street E/N – Go to Bulls
Day 4
  1. Brooklyn Bridge M/D/E
  2. Ground Zero D/E
  3. China Town D/E
  4. Little Italy D/E
Day 5
  1. American Museum of Natural History D
  2. Central Park E
Day 6
  1. 5th Ave – Shopping district D/E/N
  2. Bryant Park D/E/N 
Day7
  1. Extra Day

Monday, December 8, 2014

Find duplciate element ids using jquery

 $('[id]').each(function(){  
       var ids = $('[id="'+this.id+'"]');  
       if(ids.length>1 && ids[0]==this) {  
            console.warn('Multiple IDs #'+this.id);  
            console.warn($(this).attr("display"));  
       }  
 });  

Monday, September 15, 2014

View list of mapped URLs in Spring MVC app

Following controller cna be used to list out all URLs mapped in Spring MVC application. It uses a Spring's  RequestMappingHandlerMapping class which creats and instance from all @RequestMapping of the @Controller annotation.

 import java.util.Map;  
 import org.springframework.beans.factory.annotation.Autowired;  
 import org.springframework.stereotype.Controller;  
 import org.springframework.ui.Model;  
 import org.springframework.web.bind.annotation.RequestMapping;  
 import org.springframework.web.bind.annotation.RequestMethod;  
 import org.springframework.web.method.HandlerMethod;  
 import org.springframework.web.servlet.mvc.method.RequestMappingInfo;  
 import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;  
 @Controller  
 public class EndpointDocController {  
   private final RequestMappingHandlerMapping handlerMapping;  
   @Autowired  
   public EndpointDocController(RequestMappingHandlerMapping handlerMapping) {  
     this.handlerMapping = handlerMapping;  
   }  
   @RequestMapping(value = "/endpointdoc.htm", method = RequestMethod.GET)  
   public String show(Model model) {  
     Map methodList = this.handlerMapping.getHandlerMethods();  
     for (RequestMappingInfo name : methodList.keySet()) {  
       String key = name.toString();  
       String value = methodList.get(name).toString();  
       System.out.println(key + " " + value);  
     }  
     model.addAttribute("handlerMethods", this.handlerMapping.getHandlerMethods());  
     return "/view/controllerList";  
   }  
 }  
Above code can print the result in console itself as  well as send the result to the view. One can easily write view to iterate on Map to display result in web page.

Wednesday, January 15, 2014

Print all data model in freemarker

<p>The variables in the data-model are: 
<ul> 
  <#list .data_model?keys as key> 
    <li>${key?html} 
  </#list> 
</ul>

</p>

Saturday, January 11, 2014

Brownie Ingredients

INGREDIENTS:
2 oz (56 g) semi-sweet chocolate
6 oz (168 g) bittersweet chocolate
1/2 tbsp (7 ml) vanilla extract
1/4 tsp (1 ml) instant coffee
1/2 cup (120 g) of unsalted butter
2 eggs
1/4 cup (100 g) of sugar
1/3 cup (45 g) of flour
1/4 tsp (1 ml) salt
1/4 tsp (1 ml) baking soda
1 tbsp (15 ml) Powdered Sugar for garnish (optional)

Saturday, November 23, 2013

Understanding Servlet


  1. Servlet act as a middle layer between a request coming from a Web browser and application on the server.
  2. Advantages:
    1. Execute within the Web server address space so no need to create a separate process to handle each client request.
    2. Platform-independent as written in Java
  3. Servlet can be created using javax.servlet and javax.servlet.http packages
    1. Servlet interface – defines life cycle methods
public interface Servlet {
    public void init(ServletConfig config) throws
ServletException;
    public ServletConfig getServletConfig();
    public void service(ServletRequest req, ServletResponse
      res) throws ServletException, IOException;
    public String getServletInfo();
    public void destroy();
}
    1. GenericServlet class – provides Java Servlet API
public abstract class GenericServlet implements Servlet,
      ServletConfig, Serializable {
   public GenericServlet() { ... }
   public void destroy() { ... }
   public String getInitParameter(String name) { ... }
   public Enumeration getInitParameterNames() { ... }
   public ServletContext getServletContext() { ... }
   public String getServletInfo() { ... }
   public void init(ServletConfig config) throws
      ServletException { ... }
   public void init() throws ServletException { ... }
   public void log(String msg) { ... }
   public void log(String message, Throwable t) { ... }
   public abstract void service(ServletRequest req,
ServletResponse res) throws ServletException,
IOException;
   public String getServletName() { ... }
}
    1. HttpServlet class – provides method for handling HTTP-specific request like GET (doGet) and POST (doPost).
public abstract class HttpServlet extends GenericServlet {
   protected void doGet(HttpServletRequest req,
      HttpServletResponse resp) throws ServletException,
      IOException { ... }
   protected long getLastModified(HttpServletRequest req) {
      ... }
   protected void doHead(HttpServletRequest req,
      HttpServletResponse resp) throws ServletException,
      IOException { ... }
   protected void doPost(HttpServletRequest req,
      HttpServletResponse resp) throws ServletException,
      IOException { ...}
   protected void doPut(HttpServletRequest req,
      HttpServletResponse resp) throws ServletException,
      IOException { ...}
   protected void doDelete(HttpServletRequest req,
      HttpServletResponse resp) throws ServletException,
      IOException { ...}
   protected void doOptions(HttpServletRequest req,
      HttpServletResponse resp) throws ServletException,
      IOException { ...}
   protected void doTrace(HttpServletRequest req,
      HttpServletResponse resp) throws ServletException,
      IOException { ...}
   private static Method[] getAllDeclaredMethods(Class c)
      { ...}
   protected void service(HttpServletRequest req,
      HttpServletResponse resp) throws ServletException,
      IOException { ...}
   private void maybeSetLastModified(HttpServletResponse
      resp, long lastModified) { ...}
   public void service(ServletRequest req, ServletResponse
      res) throws ServletException, IOException { ...}
}
  1. Servlet lifecycle
    1. Initialization– Servlet is initialized by calling init() method. It is called only once when Servlet is first created. This happens when user invoke a URL corresponding to the Servlet.
    2. Service - For subsequent calls it creates a new thread and had off job to appropriate doXXX() method through service() method.
    3. Destory – Servlet is destroy at the end of lifecycle. destroy() method is called.
Summary: One time initialization (if needed) goes in init(), all processing is done in doXXX() method, clean up (if necessary) is does in destroy() method.
  1. Architecture Diagram


                                                
  1. Sample Application
    1. Create Servlet Class
       public class HelloServlet extends HttpServlet {   
             private Integer classVariable = 1;    
         private Integer servletInitilizationValue = 100;  
         @Override  
         public void init() throws ServletException {  
           servletInitilizationValue ++;  
         }  
         protected void processRequest(HttpServletRequest request,   
                 HttpServletResponse response)  
             throws ServletException, IOException {  
           Integer processVariable = 0;  
               classVariable*=2;  
           response.setContentType("text/html;charset=UTF-8");  
           PrintWriter out = response.getWriter();  
           try {  
             out.println("<html>");  
             out.println("<head>");  
             out.println("<title>Servlet HelloServlet</title>");        
             out.println("</head>");  
             out.println("<body>");  
             out.println("<h1>Servlet HelloServlet at " +   
                      request.getContextPath() + "</h1>");  
             out.println("<h2>processVariable: " +   
                      processVariable++);  
             out.println("<h2> servletInitilizationValue: " +   
                      servletInitilizationValue);  
                 out.println("<h2>classVariable: " + classVariable);  
             out.println("</body>");  
             out.println("</html>");  
           } finally {        
             out.close();  
           }  
         }  
         @Override  
         public void destroy() {  
           System.out.println("Destroying");  
         }  
         @Override  
         protected void doGet(HttpServletRequest request,   
                 HttpServletResponse response)  
             throws ServletException, IOException {  
           processRequest(request, response);  
         }  
         @Override  
         protected void doPost(HttpServletRequest request, HttpServletResponse response)  
             throws ServletException, IOException {  
           processRequest(request, response);  
         }  
       }  
      

Output:
- For first call servletInitilizationValue will display 101 and for subsequent call it remains 101 because servletInitilizationValue++ is called only once for first time.
- processVariable will be 0 for all call even we are doing processVariable++ because every request will get there own copy of processVariable
- But classVariable will always print even number for each call because only one instance of HelloServlet is created and instance variable is shared by all request.
- From these output we can see that as Servlet is not thread safe we can safe the data if put in method level instead of instance level.

    1. Map URL to Servlet class
Add Servlet definition and mapping in web.xml file
 <servlet>  
     <servlet-name>HelloWorld</servlet-name>  
     <servlet-class>HelloWorld</servlet-class>  
   </servlet>  
   <servlet-mapping>  
     <servlet-name>HelloWorld</servlet-name>  
     <url-pattern>/HelloWorld</url-pattern>  
   </servlet-mapping>  
   
  1. Some request header
-    accept
-    accept-charset
-    accept-encoding
-    accept-language
-    content-length
-    cookie
-    host
-    if-modified-since
-    if-unmodified-since
-    referrer
-    user-agent
  1. Some of the request object methods
-    getParameter(Strring parameterName): Get value of the parameter
-    getParameterValues(): Get multiple values for same parameter (e.g checkbox)
-    getParameterNames(): Get list of all parameters.
-    getCookies()
-    getSession()
-    getLocale()
-    getAuthType()
-    getCharacterEncoding()
-    getContentType()
-    getContextPath()
-    getHeader(String name)
-    getPathInfo()
-    getProtocol()
-    getQueryString()
-    getServletPath(): part of URl that calls the JSP.
-    getRemoteAddr(): client address
-    getRemoteHost(): client host name
-    getRemoteUser(): clinet login user
-    isSecure()
-    getContentLength()
-    getServerPort(0: port number which receive this request
  1. Some response header
-    Allow
-    Cache-control
-    Connection
-    Content-encoding
-    Content-language
-    Content-length
-    Content-type
-    Expires
-    Last-modified
-    Location
-    Refresh
-    Retry-after
-    Set-cookie
  1. Some of response object methods
-    encodeRedirectURL(String)
-    encodeURL(String)
-    addCookie(Cookie cookie)
-    sendError(…)
-    sendRedirect(String)
-    setBufferSize(int)
-    setCharacterEncoding(String)
-    setContentLength(int)
-    setContentType(String)
-    setHeader(String name, String value)
-    setLocale(Locale)
-    setStatus(int)
  1. HTTP Staus codes
- 100: continue
- 101: Switching protocols
- 2xx: Successful
- 3xx: Redirection
- 4xx: Client Error
- 5xx: Server Error
  1. Related technology is Filters

Thursday, May 2, 2013

Chicago Visit


3-Day Planner



Day 1

  - Adler Planetarium
  - The Field Museum
  - Shedd Aquarium

Day2

  - Shoreline Sightseeing Architecture River Cruise
  - Navy Pier Attractions
  - Tall Ship Windy
  - Shoreline Sightseeing Skyline Boat Tour

Day3

  - Water Tower Place
  - John Hancock Observatory
  - Skydeck Chicago (Willis Tower)
  - Millennium Park


2-Day Planner


Buy tickets prior so that you don't spend time waiting in line to buy ticket. For these short 2 day trip I recommend to buy Go Card since you can select the attraction you want to go. Also don't forget to check Groupon they do have discounted tickets too. I found Go Card with 3 attractions on $65. I choose Hop On Hop Off Bus, John Handcock and Field Museum.


Day 1

- Park at Navy Pier Parking. Its usually $28 for 24 hrs. 
- Navy Pier
- John Handcock
- Millennium Park
- Grant Park
- Architecture Fireworks Tour [Saturday and Wednesday]


Day 2

- Parking at Planatrium Lot. Its usually $22 for a day
- Field Museum [Basic Admission @ $22]

Friday, February 8, 2013

Sample Spring Context File

  1. Resource mapping
  2. <mvc:resource mapping="/resources/**" location="/resources/, classpath:/META-INF/web-resources/">
  3. Scan package for auto-wire
  4. <context:component-scan base-package="com.anjib.app"/>
  5. Allow annotation programming
  6. <mvc:annotation-driven/>
  7. Interceptors
  8. <interceptors>
    <beans:bean class="org.springframework.mobile.device.DeviceResolverHandlerInterceptor/>
    <beans:bean class="org.springframework.web.servlet.mvc.WebContentInterceptor">
    <beans:property name="cacheSeconds" value="0"/>
    <beans:property name="useExpireHeader" value="true"/>
    <beans:property name="useCacheControlHeader" value="true"/>
    <beans:property name="useCacheControlNoStore" value="true"/>
    </beans:bean>
    </interceptors>
  9. View resolver
  10. <beans:bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver" id="appViewResolvers">
    <beans:property name="mediaTypes">
    <beans:map>
    <beans:entry key="html" value="text/html"/>
    <beans:entry key="json" value="application/json"/>
    <beans:entry key="atom" value="application/atom+xml">
    </beans:map>
    </beans:property>
    <beans:property name="viewResolvers">
    <beans:list>
    <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <beans:property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
    <beans:property name="prefix" value="/WEB-INF/views/"/>
    <beans:property name="suffix" value=".jsp"/>
    </beans:bean>
    </beans:list>
    </beans:property>
    <beans:property name="defaultViews">
    <beans:list>
    <beans:bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" id="jsonViewResolver">
    <beans:property name="prefixJson" value="true">
    </beans:bean>
    </beans:list>
    </beans:property>
    </beans:bean>
  11. Map properties file
  12. <util:properties id="applicationProps" location="/WEB-INF/properties/application.properties"/>
  13. Import resources (e.g. xml)
  14. <beans:import resource="/suppapp-context.xml"/>
  15. Default servlet handler
  16. <default-servlet-handler/>

     
       
         
         
         
       
     
     
       
         
           
           

         
       
     
     
       
         
           
         
       
     


Thursday, January 24, 2013

Sample POM file for spring with Open JPA


<!-- Sample pom file -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

   <modelVersion>4.0.0</modelVersion>
 
   <!-- project information -->
   <groupId>com.anjib</groupId>
   <artifactId>myproject</artifactId>
   <version>1.0.0-SNAPSHOT</version>
   <packaging>war</packaging>
   <parent>
<groupId>com.anjib</groupId>
    <artifactId>main_app</artifactId>
    <version>1.0.0</version>
   </parent>
 
   <!-- More Project Information -->
   <name>Sample Project</name>
   <description>Sample maven project</description>
   <url>http://anjib.com/sample/project1</url>
   <inceptionYear>2013</inceptionYear>
   <licenses>Self</licenses>
   <organization>Anjib Software Garment House</organization>
   <developers>Anjib Man Mulepati</developers>
   <contributors>Anjib Man Mulepati</contributors>
 
   <!-- dependency properties -->
   <properties>
<java-version>1.6</java-version>
<org.springframework-version>3.1.2.RELEASE</org.springframework-version>
<org.springframework.webflow-version>2.3.1.RELEASE</org.springframework.webflow-version>
<org.springframework.mobile-version>1.0.1.RELEASE</org.springframework.mobile-version>
<org.apache.openjpa-version>2.2.0</org.apache.openjpa-version>
<org.codehaus.jackson-version>1.9.5</org.codehaus.jackson-version>
<org.apache.tiles-version>2.2.2</org.apache.tiles-version>
<javax.servlet.jstl-version>1.2</javax.servlet.jstl-version>
<org.aspectj-version></org.aspectj-version>
<log4j-version>1.2.15</log4j-version>
<axis-version>1.4</axis-version>
<org.tuckey.urlrewrite-version>3.0.4</org.tuckey.urlrewrite-version>
   </properties>
 
   <!-- list of repositories -->
   <repositories>
<repository>
<id>source1</id>
<url>https://repo1.remote.net/maven/content/repositories/repo1</url>
<releases>
 <enabled>true</enabled>
</releases>
<snapshots>
 <enabled>true</enabled>
</snapshots>
</repository>
   </repositories>  
 
   <!-- list of plugin repositories -->
   <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <name>Central Repository</name>
      <url>http://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
    </pluginRepository>
   </pluginRepositories>
 
   <!-- Dependency Management -->
   <dependencyManagement>
    <repository>
 <id>MYAPP</id>
 </name>MYAPP</name>
 <url>https://repo.anjib.com/maven/content/repositories/MYAPP</url>
</repository>
<snapshotRepository>
 <id>MYAPP-SNAPSHOT</id>
 </name>MYAPP-SNAPSHOT</name>
 <url>https://repo.anjib.com/maven/content/repositories/MYAPP-SNAPSHOT</url>
</snapshotRepository>
  </dependencyManagement>
  <modules>...</modules>
 
  <!-- dependencies -->
  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-embedder</artifactId>
      <version>2.0</version>
 <classifier></classifier>
 <scope></scope>
      <exclusions>
        <exclusion>
          <groupId>org.apache.maven</groupId>
          <artifactId>maven-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
 
  <!-- build plugins -->
  <build>
    <directory>${project.basedir}/target</directory>
    <outputDirectory>${project.build.directory}/classes</outputDirectory>
    <finalName>${project.artifactId}-${project.version}</finalName>
    <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
    <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
    <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
    <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
    <resources>
      <resource>
        <directory>${project.basedir}/src/main/resources</directory>
<includes>
  <include>**/*.*</include>
</includes>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>${project.basedir}/src/test/resources</directory>
      </testResource>
    </testResources>
    <pluginManagement>
      <plugins>
        <plugin>
          ............
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
 
  <!-- reporting -->
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.9.1</version>
      </plugin>
    </plugins>
  </reporting>
</project>

Friday, September 21, 2012

XSD for Item Price


XSD
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">Item price at store</xsd:documentation>
</xsd:annotation>

<xsd:element name="Store" type="StoreType"/>
<xsd:element name="Address" type="USAddressType"/>
<xsd:element name="HomePage" type="HomePageType"/>

<xsd:simpleType name="valueRequired">
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="positiveNumber">
<xsd:restriction base="xsd:float">
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="positiveNonZeroNumber">
<xsd:restriction base="xsd:float">
<xsd:minExclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="StoreType">
<xsd:sequence>
<xsd:element name="Name" type="valueRequired"/>
<xsd:element ref="Address" />
<xsd:element ref="HomePage" minOccurs="0"/>
<xsd:element name="Phone" type="xsd:string" />
<xsd:element name="Date" type="xsd:date" />
<xsd:element name="Items" type="ItemsType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ItemsType">
<xsd:sequence>
<xsd:element name="Item" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="valueRequired" />
<xsd:element name="Category" type="valueRequired"/>
<xsd:element name="Quantity" type="positiveNonZeroNumber" />
<xsd:element name="Unit" type="valueRequired"/>
<xsd:element name="Price" type="positiveNumber"/>
<xsd:element name="Comment" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="USAddressType">
<xsd:sequence>
<xsd:element name="Address1" type="valueRequired"/>
<xsd:element name="Address2" type="xsd:string"/>
<xsd:element name="City" type="valueRequired"/>
<xsd:element name="State" type="USState"/>
<xsd:element name="ZipCode" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
</xsd:complexType>

<xsd:complexType name="HomePageType">
<xsd:attribute name="URL" type="xsd:string"/>
</xsd:complexType>

<xsd:simpleType name="USState">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AL"/><xsd:enumeration value="AK"/>
<xsd:enumeration value="AZ"/><xsd:enumeration value="AR"/>
<xsd:enumeration value="CA"/><xsd:enumeration value="CO"/>
<xsd:enumeration value="CT"/><xsd:enumeration value="DE"/>
<xsd:enumeration value="DC"/><xsd:enumeration value="FL"/>
<xsd:enumeration value="GA"/><xsd:enumeration value="HI"/>
<xsd:enumeration value="ID"/><xsd:enumeration value="IL"/>
<xsd:enumeration value="IN"/><xsd:enumeration value="IA"/>
<xsd:enumeration value="KS"/><xsd:enumeration value="KY"/>
<xsd:enumeration value="LA"/><xsd:enumeration value="ME"/>
<xsd:enumeration value="MD"/><xsd:enumeration value="MA"/>
<xsd:enumeration value="MI"/><xsd:enumeration value="MN"/>
<xsd:enumeration value="MS"/><xsd:enumeration value="MO"/>
<xsd:enumeration value="MT"/><xsd:enumeration value="NE"/>
<xsd:enumeration value="NV"/><xsd:enumeration value="NH"/>
<xsd:enumeration value="NJ"/><xsd:enumeration value="NM"/>
<xsd:enumeration value="NY"/><xsd:enumeration value="NC"/>
<xsd:enumeration value="ND"/><xsd:enumeration value="OH"/>
<xsd:enumeration value="OK"/><xsd:enumeration value="OR"/>
<xsd:enumeration value="PA"/><xsd:enumeration value="RI"/>
<xsd:enumeration value="SC"/><xsd:enumeration value="SD"/>
<xsd:enumeration value="TN"/><xsd:enumeration value="TX"/>
<xsd:enumeration value="UT"/><xsd:enumeration value="VT"/>
<xsd:enumeration value="VA"/><xsd:enumeration value="WA"/>
<xsd:enumeration value="WV"/><xsd:enumeration value="WI"/>
<xsd:enumeration value="WY"/>
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>

Sample XML

<Store>
  <Name>CVS</Name>
  <Address country="US">
    <Address1>123 Main St</Address1>
<Address2></Address2>
<City>New York</City>
<State>NY</State>
<ZipCode>11106</ZipCode>
  </Address>
  <Phone></Phone>
  <Date>21012-09-21</Date>
  <Items>
<Item>
<Name>Folger Coffee</Name>
<Category>Coffee</Category>
<Quantity>1</Quantity>
<Unit>lb</Unit>
<Price>9.99</Price>
<Comment>On 30% sale</Comment>
</Item>
<Item>
<Name>Prude Chicken</Name>
<Category>Chicken</Category>
<Quantity>7.5</Quantity>
<Unit>lb</Unit>
<Price>4.99</Price>
<Comment>Price is per pound</Comment>
</Item>
  </Items>
</Store>