Package com.dgwave.osrs.jaxb

Examples of com.dgwave.osrs.jaxb.ObjectFactory


 
  private void initJaxb() throws OsrsException {
      if (jc != null && oj != null) return;
    try {
      this.jc = JAXBContext.newInstance("com.dgwave.osrs.jaxb");
      this.oj = new ObjectFactory();
        SAXParserFactory spf = SAXParserFactory.newInstance();
          spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
          spf.setNamespaceAware(true);
          spf.setValidating(false);
          xmlReader = spf.newSAXParser().getXMLReader();
View Full Code Here


  @Test
  public void testCreateOPSEnvelope() {
    try {
      JAXBContext jc = JAXBContext.newInstance("com.dgwave.osrs.jaxb");
      ObjectFactory objFactory = new ObjectFactory();
      OPSEnvelope opsEnvelope = objFactory.createOPSEnvelope();
      Header header = objFactory.createHeader();
      header.setVersion("0.9");
      opsEnvelope.setHeader(header);
     
      Item domain = objFactory.createItem();
      domain.setKey("domain");
      domain.setStringValue("dgwave.com");
     
      DtAssoc attrs = objFactory.createDtAssoc();
      attrs.addItem(domain);
      Item attributes = objFactory.createItem();
      attributes.setKey("attributes");
      attributes.addDtAssoc(attrs);
     
     
      Item protocol = objFactory.createItem();
      protocol.setKey("protocol");
      protocol.setStringValue("XCP");
      Item action = objFactory.createItem();
      action.setKey("action");
      action.setStringValue("belongs_to_rsp");
      Item obj = objFactory.createItem();
      obj.setKey("object");
      obj.setStringValue("domain");
     
      DtAssoc top = objFactory.createDtAssoc();
      top.addItem(protocol);
      top.addItem(action);
      top.addItem(obj);
      top.addItem(attributes);
     
      DataBlock dBlock = objFactory.createDataBlock();
      dBlock.addDtAssoc(top);
     
      Body body = objFactory.createBody();
      body.setDataBlock(dBlock);
     
      opsEnvelope.setBody(body);
     
      Marshaller m = jc.createMarshaller();
View Full Code Here

TOP

Related Classes of com.dgwave.osrs.jaxb.ObjectFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.