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

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


  /** <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(pSource.getSystemId());
    XSContext data = getData();
    XMLReader xr = data.getXsObjectFactory().newXMLReader(isValidating());
    runContentHandler(xr, contentHandler, 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

  }

  /** <p>Parses the given XML schema and returns a logical representation.</p>
   */
  public XSSchema parse(InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
    XSContext myData = getContext();
    parser.set(this);
    try {
      return newXSLogicalParser().parse(pSource);
    } finally {
      myData.setCurrentContentHandler(null);
      parser.set(null);
    }
  }
View Full Code Here

   *   {@link org.w3c.dom.Element}, or an instance of
   *   {@link org.w3c.dom.DocumentFragment}. In the latter case, make
   *   sure, that the fragment contains a single root element.
   */
  public XSSchema parse(Node pNode) throws SAXException {
    XSContext myData = getContext();
    parser.set(this);
    try {
      return newXSLogicalParser().parse(pNode);
    } finally {
      myData.setCurrentContentHandler(null);
      parser.set(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);
        EntityResolver entityResolver = xr.getEntityResolver();
        if (entityResolver != null) {
          InputSource iSource = entityResolver.resolveEntity(pSource.getPublicId(), pSource.getSystemId());
          if (iSource != null) {
            pSource = iSource;
          }
        }
        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

  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

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.