Package org.apache.ws.jaxme.xs.parser

Examples of org.apache.ws.jaxme.xs.parser.XSContext


  public void endDocument() throws SAXException {
    xsSAXParser.endDocument();
    XsESchema syntaxSchema = (XsESchema) xsSAXParser.getBean();
    parser.removeSyntaxSchema();
    XSContext data = parser.getData();
    data.setCurrentContentHandler(null);

    try {
      parser.parse(syntaxSchema);
      XSSchema mySchema = parser.getSchema();
      parser.createSubstitutionGroups(mySchema);
View Full Code Here


    return result;
  }

  public XSParser newXSParser(SGFactory pController) throws SAXException {
    XSParser parser = new JAXBParser();
    XSContext context = parser.getContext();
    context.setXsObjectFactory(pController.newXsObjectFactory());
    context.setXSObjectFactory(pController.newXSObjectFactory());
    return parser;
  }
View Full Code Here

  /** <p>The XJC Schema URI: <code>http://java.sun.com/xml/ns/jaxb/xjc</code></p>
   */
  public static final String XJC_SCHEMA_URI = "http://java.sun.com/xml/ns/jaxb/xjc";

  public JAXBParser() {
    XSContext data = getContext();
    data.setXsObjectFactory(JAXB_XS_OBJECT_FACTORY);
    data.setXSObjectFactory(JAXB_OBJECT_FACTORY);
  }
View Full Code Here

      if (this instanceof XsESchema) {
        throw new IllegalStateException("The schema must have a null parent.");
      }
    }
    parent = pParent;
    XSContext context = getContext();
    if (context != null) {
      Locator loc = context.getLocator();
      locator = loc == null ? null : new LocatorImpl(getContext().getLocator());
    } else {
      locator = null;
    }
  }
View Full Code Here

  protected void setSchema(XSSchema pSchema) {
    schema = pSchema;
  }

  protected XsESchema parseSyntax(Node pNode) throws SAXException {
    XSContext data = getData();
    try {
      XsObjectFactory factory = data.getXsObjectFactory();
      XsESchema mySchema = factory.newXsESchema();
      XsSAXParser xsSAXParser = factory.newXsSAXParser(mySchema);
      addSyntaxSchema(mySchema);
      try {
        data.setCurrentContentHandler(xsSAXParser);
        DOMSerializer ds = new DOMSerializer();
        ds.serialize(pNode, xsSAXParser);
        return (XsESchema) xsSAXParser.getBean();
      } finally {
        removeSyntaxSchema();
      }
    } finally {
      data.setCurrentContentHandler(null);
    }
  }
View Full Code Here

    }
  }

  protected XsESchema parseSyntax(InputSource pSource)
      throws SAXException, IOException, ParserConfigurationException {
    XSContext data = getData();
    try {
      XsObjectFactory factory = data.getXsObjectFactory();
      XsESchema mySchema = factory.newXsESchema();
      XsSAXParser xsSAXParser = factory.newXsSAXParser(mySchema);
      addSyntaxSchema(mySchema);
      try {
        data.setCurrentContentHandler(xsSAXParser);
        XMLReader xr = factory.newXMLReader(isValidating());
        xr.setContentHandler(xsSAXParser);
        xr.parse(pSource);
        return (XsESchema) xsSAXParser.getBean();
      } finally {
        removeSyntaxSchema();
      }
    } finally {
      data.setCurrentContentHandler(null);
    }
  }
View Full Code Here

  /** <p>Redefines the given {@link XsRedefinable}.</p>
   */
  protected void redefine(XsESchema pSyntaxSchema,
                            XsERedefine pRedefine, XsRedefinable pChild) throws SAXException {
    XSSchema mySchema = getSchema();
    XSContext data = getData();
    XSObjectFactory factory = data.getXSObjectFactory();
    if (pChild instanceof XsTAttributeGroup) {
      XsTAttributeGroup attributeGroup = (XsTAttributeGroup) pChild;
      mySchema.redefine(factory.newXSAttributeGroup(mySchema, attributeGroup));
    } else if (pChild instanceof XsTNamedGroup) {
      XsTNamedGroup group = (XsTNamedGroup) pChild;
View Full Code Here

  /** <p>Adds the given object to the schema.</p>
   *
   */
  protected void add(XsESchema pSyntaxSchema, Object pChild) throws SAXException {
    XSSchema mySchema = getSchema();
    XSContext data = getData();
    XSObjectFactory factory = data.getXSObjectFactory();
    if (pChild instanceof XsEAnnotation) {
      XsEAnnotation annotation = (XsEAnnotation) pChild;
      mySchema.add(factory.newXSAnnotation(mySchema, annotation));
    } else if (pChild instanceof XsETopLevelSimpleType) {
      XsETopLevelSimpleType type = (XsETopLevelSimpleType) pChild;
View Full Code Here

   * @see #getXSContentHandler()
   */
  public XSSchema parse(InputSource pSource)
      throws ParserConfigurationException, SAXException, IOException {
    XSContentHandler contentHandler = getXSContentHandler();
    XSContext data = getData();
    XMLReader xr = data.getXsObjectFactory().newXMLReader(isValidating());
    xr.setContentHandler(contentHandler);
    xr.parse(pSource);
    return getSchema();
  }
View Full Code Here

  /** <p>Parses the given XML schema. and returns a syntactical
   * representation.</p>
   * @see #parse(InputSource)
   */
  public XsESchema parseSyntax(InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
    XSContext context = getContext();
    parser.set(this);
    try {
      XsObjectFactory factory = context.getXsObjectFactory();
      XsSAXParser xsSAXParser = factory.newXsSAXParser();
      context.setCurrentContentHandler(xsSAXParser);
      XMLReader xr = factory.newXMLReader(isValidating());
      xr.setContentHandler(xsSAXParser);
      xr.parse(pSource);
      return (XsESchema) xsSAXParser.getBean();
    } finally {
      context.setCurrentContentHandler(null);
      parser.set(null);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.parser.XSContext

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.