Xml transformation without validation

Hi,
How can I carry out an xsl transformation in java without validating the xml document??
regards
anand

Well I've a DomSource and I want to transform it using a templates defined in an XSL file.
This is how I'm doing it
Source source = new DOMSource(document);
TransformerFactory.newInstance().newTransformer().transform(source, new StreamResult("temp.xml"));
The stack trace I'm getting is:
ERROR: 'The entity "bull" was referenced, but not declared.'
ERROR: 'com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The entity "bull" was referenced, but not declared.'
Exception in thread "main" javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The entity "bull" was referenced, but not declared.
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:654)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281)
     at temp.Temp.main(Temp.java:115)
Caused by: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The entity "bull" was referenced, but not declared.
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:496)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644)
     ... 2 more
Caused by: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The entity "bull" was referenced, but not declared.
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:393)
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474)
     ... 3 more
javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The entity "bull" was referenced, but not declared.
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:496)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281)
     at temp.Temp.main(Temp.java:115)
Caused by: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The entity "bull" was referenced, but not declared.
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:393)
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474)
     ... 3 more
com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The entity "bull" was referenced, but not declared.
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:393)
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281)
     at temp.Temp.main(Temp.java:115)
org.xml.sax.SAXParseException: The entity "bull" was referenced, but not declared.
     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
     at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1332)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1756)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:387)
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281)
     at temp.Temp.main(Temp.java:115)
com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The entity "bull" was referenced, but not declared.
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:393)
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281)
     at temp.Temp.main(Temp.java:115)
org.xml.sax.SAXParseException: The entity "bull" was referenced, but not declared.
     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
     at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1332)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1756)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:387)
     at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:474)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:644)
     at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281)
     at temp.Temp.main(Temp.java:115)
I don't want to resolve any entity references.
Message was edited by:
anand_nalya

Similar Messages

  • Transform XML without validating

    Hi, I use Xalan to transform an XML file.
    I use Tranformer.class, I just want to tranform the XML without validating the file.
    In the parser class, you can use setValidate to avoid or not the validating action.
    Do you know how to do the same with Transformer.class
    Thanks C�dric

    This one piqued my interest, and as no one had responded
    yet I thought I'd poke around and see what's up.
    I looked at the Transfermer class, and the javadoc pointed
    me to the OutputKeys class, the only thing that looked
    remotely interesting was the "STANDALONE" feature. I wonder
    if you can set it to "true" and avoid the validation (as I
    think Standalone implies, no DTD to validate against?)
    Eric

  • File Adapte picking up XML if XSD valid without verifing the XSD in adapter

    hi',
    I am facing one issue
    I have a sample XML file which I want to read through BPEL process
    for this I have configured the file adapter with the schema and reading the file adapter with the receive activity
    next I have created one XSD file (which file adapter referes to) and one XML file,
    File adapter reads it after the XML file gets validated with the XSD which is kept in a location *'/test/xsd/emp.xsd'*,
    now the issue is that the file adapter is picking up and initiating the process without verifying the XSD mentioned in the adapter
    it is only checking the XML file with the XSD mentioned in the XML,
    for example if I have a xml file which is refering to some other schema it also gets read by file adapter without worring about what schema is mentioned in file adapter
    please advice me is this the way File adapter works in Oracle BPEL or I am doing some thing wrong
    I am using SOA suite 10.1.3.3.0 which is deployed in UNIX enviornment.
    thanks
    Yatan

    thanks Ketan ,
    as you suggested, after adding validateXML to true, the XML is getting validated to the XSD in the adapter,
    the process is getting invoked and the receive activity is throwing error of 'Invalid XML', this is perfect as I expected
    however now the issue is, the file which is invalid in terms of XSD present in the file adapter is still being archived to 'success dir' i.e. 'LogicalArchiveDirectory', ideally it should have moved to fail directory,
    but if the XML file is not complete or having some error in terms of the XSD it is refering to 'target namespace' and 'target location'
    then it will move to the fail directory and the receive activity is also showing the error,
    see this is how I have configured my bpel.xml file for the file adapter.
    <activationAgents>
    <activationAgent className="oracle.tip.adapter.fw.agent.jca.JCAActivationAgent" partnerLink="Read_Tph_ProdTrans_File">
    <property name=*"prod_trans_success_file" type="LogicalArchiveDirectory"*>/aaa/bb/ccc/wis/tph/bpl_inbound/adjust/success</property>
    <property name=*"prod_trans_incoming_file" type="LogicalDirectory"*>/aaa/bb/ccc/wis/tph/bpl_inbound/adjust/new</property>
    <property name="portType">Read_ptt</property>
    <property name="rejectedMessageHandlers">file:///aaa/bb/ccc/wis/tph/bpl_inbound/adjust/fail</property>
    </activationAgent>
    please advice how to bring this adapter to proper behaviour.
    thanks
    Yatan

  • XML transform and upload without overwriting additional variables

    I have a set of working scripts where a user calls into one application to enter their contact number. People needing to reach that first user call the second application which reads the string value entered by the first user and dials out to them. This works via a simple xml transform and upload for the first script, and an xml get in the second.
    I've been requested to do this for 40 additional people.
    I made one template with a different %variable% for each user. Via a PIN, the correct variable is transformed and a singular doc is uploaded. The problem is that this uploaded doc erases the last person's transformation and reverts it back to %variable%.
    Essentially I'm trying to avoid creating 40 different transformed xml uploads. Anybody have a clever idea? If it involves XSL please give a specific exmample; I'm not versed in that.

    Hi
    Firstly, Sam raises a very good point. This sort of thing would be much better dealt with by using a proper DB so you can independenly edit records for each user.
    However if we assume this is a low-throughput system with infrequent changes and you are happy to take the chance of two concurrent changes occurring and one being lost...
    What I do with XML mostly is read it, parse it with the built-in steps. When it  comes to writing them, you can just read the whole doc, convert it to a string, and then use DO steps with Java code to edit the XML directly once read from the repo.
    Basicallly as you need to maintain the existing data, you need to either:
    1) read each bit of data into an array and then write that back into your template along with the new data
    2) read each bit of data into an array and then write them all back by building up the XML manually with java
    3) read the whole current XML from the repo, then do a quick find/replace in it using a regex and write it back
    Aaron

  • XML SAX dtd Validation Problem

    Hi,
              I’m having problems getting an xml document to validate within Weblogic 8.1. I am trying to parse a document that references both a dtd and xsd. Both the schema and dtd reference need to be substituted so they use local paths. I specify the schema the parser should use and have created an entityResolver to change the dtd reference.
              When this runs as a standalone app from eclipse the file parses and validates without a problem. When deployed to the app server the process seems to be unable read the contents of the dtd. Its not that it cannot find the file (no FileNotFoundException is thrown but this can be created if I delete the dtd) rather it seems to find no declared elements.
              Initial thought was that the code didn’t have access to read the dtd from its location on disk, to check I moved the dtd to within the deployed war and reference as a resource. The problem still persists.
              Code Snippet:
              boolean isValid = false;
              try {
              // Create and configure factory
              SAXParserFactory factory = SAXParserFactoryImpl.newInstance();
              factory.setValidating(true);
              factory.setNamespaceAware(true);
              // To be notified of validation errors in the XML document,
              // add a custom error handler to the document builder
              PIMSFeedFileValidationHandler handler
              = new PIMSFeedFileValidationHandler();
              // Create and Configure Parser
              SAXParser parser = factory.newSAXParser();
              parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
              parser.setProperty(NAMESPACE_PROPERTY_KEY, getSchemaFilePath());
              // Set reader with entityResolver for dtd
              XMLReader xmlReader = parser.getXMLReader();
              xmlReader.setEntityResolver(new SAXEntityResolver(this.dtdPath));
              // convert file to URL, as it is a remote file
              URL url = super.getFile().toURL();
              // Open an input stream and parse
              InputStream is = url.openStream();
              xmlReader.setErrorHandler(handler);
              xmlReader.parse(new InputSource(is));
              is.close();
              // get the result of parsing the document by checking the
              // errorhandler's isValid property
              isValid = handler.isValid();
              if (!isValid) {
              LOGGER.warn(handler.getMessage());
              LOGGER.debug("XML file is valid XML? " + isValid);
              } catch (ParserConfigurationException e) {
              LOGGER.error("Error parsing file", e);
              } catch (SAXException e) {
              LOGGER.error("Error parsing file", e);
              } catch (IOException e) {
              throw new FeedException(e);
              return isValid;
              See stack trace below for a little more info.
              2005-01-28 10:24:09,217 [DEBUG] [file] - Attempting validation of file 'cw501205.wa1.xml' with schema at 'C:/pims-feeds/hansard/schema/hansard-v1-9.xsd'
              2005-01-28 10:24:09,217 [DEBUG] [file] - Entity Resolver is using DTD path file:C:/Vignette/runtime_services/8.1/install/common/nodemanager/
              VgnVCMServer/stage/pims-hansard/pims-hansard.war/WEB-INF/classes/com/morse/pims/cms/feed/sax/ISO-Entities.dtd
              2005-01-28 10:24:09,227 [DEBUG] [file] - Creating InputSource at: file:C:/Vignette/runtime_services/8.1/install/common/nodemanager/VgnVCMServer/stage/pims-hansard/pims-hansard.war/WEB-INF/classes/com/morse/pims/cms/feed/sax/ISO-Entities.dtd
              2005-01-28 10:24:09,718 [WARN ] [file] - org.xml.sax.SAXParseException: Element type "Hansard" must be declared.
              org.xml.sax.SAXParseException: Element type "Session" must be declared.
              org.xml.sax.SAXParseException: Element type "DailyRecord" must be declared.
              org.xml.sax.SAXParseException: Element type "Volume" must be declared.
              org.xml.sax.SAXParseException: Element type "Written" must be declared.
              org.xml.sax.SAXParseException: Element type "WrittenHeading" must be declared.
              org.xml.sax.SAXParseException: Element type "Introduction" must be declared.
              … continues for all the elements in the doc
              2005-01-28 10:24:10,519 [DEBUG] [file] - XML file is valid XML? false
              2005-01-28 10:24:10,519 [WARN ] [file] - Daily Part file 'cw501205.wa1.xml' was not valid XML and was not processed.
              Has anybody seen this behavior before with weblogic and if so how have you resolved the issue.
              Thanks in Advance
              Adam

    It looks like you clicked on "Post" before you got around to explaining your problem. I don't see any error messages or any description of what was supposed to happen and what happened instead.
    Now, I don't know anything about XML Schema, but just guessing at how that unique name feature might be designed, and just guessing that your unique name is actually in the <userId> element, I would suggest that this:
    <xsd:unique name="un_name"> 
      <xsd:selector xpath="USER"/> 
      <xsd:field xpath="."/> 
    </xsd:unique> is at fault because it doesn't mention the <userId> element anywhere.

  • Schema of a new Object Type: message pass the BIU without validation

    Hi,
    i've defined a new Object Type for send messages to Web Service. I've created the schema files and i've uploaded there in repository with the "Import" function of GUI. After, i've defined the XML file for the "Execute" function of the B1i GUI.
    After the load of files, in the repository the files are in correct position.
    In my BIU the definition of sender and receiver system type is correct, and also the definition of SenderMainObjectTypeID and ReceiverObjectTypeID. The message from B1 pass through the IPO chain without problems and the message is received by teh Web Service.
    If modify the file XSL into the BIU, a message with less elements than a schema pass without problem.
    If delete the schema from repository, the message pass without validation.
    I would know because the schema is bypassed...
    Thans

    Ok,
    solved with introduction of validation point in a customized IPO using a branch / unbranch atoms.
    Bye.

  • XSL problem with javax.xml.transform.sax.SAXTransformerFactory

    Dear sirs,
    I use SAXTransformerFactory in order to transform a Hashtable to SAX Event and apply a XSL.
    I try this code with the lastest version of apache parser.
    It run well.
    But, I put this software to WEBLOGIC 6.2 server and no run.
    this check is true:
              if (transFact.getFeature(javax.xml.transform.sax.SAXTransformerFactory.FEATURE)&&transFact.getFeature(javax.xml.transform.sax.SAXSource.FEATURE))
    Some one can help me.
    Thank in avance
    The code:
    java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
              com.cajarural.xml.HashtableParser parser = new com.cajarural.xml.HashtableParser(hashtable);
              // Codigo para el TansformerHandler
              // set the destination for the XSLT transformation
                   javax.xml.transform.TransformerFactory transFact = javax.xml.transform.TransformerFactory.newInstance();
                   if (transFact.getFeature(javax.xml.transform.sax.SAXTransformerFactory.FEATURE)&&transFact.getFeature(javax.xml.transform.sax.SAXSource.FEATURE))
    javax.xml.transform.sax.SAXTransformerFactory saxTransFact = (javax.xml.transform.sax.SAXTransformerFactory) transFact;
    javax.xml.transform.sax.TransformerHandler transHand = saxTransFact.newTransformerHandler(templates);
    transHand.setResult(new javax.xml.transform.stream.StreamResult(bout));
    parser.setContentHandler(transHand);
    // attach the XSLT processor to the           parser.parse();
              return new String(bout.toByteArray());

    put Xalan in your war file then try using this kind of commands:     System.setProperty("org.xml.sax.parser", "org.apache.xerces.parsers.SAXParser");
    System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl");
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
    System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl");This tells JAXP what implementations it should use without even asking your administrator to modify the WebLogic setup...
    It's what I've done with the WLS7.0 server I am using ;-)

  • XML transformation using XSLT and Resin 2.1.11

    I have the following problem:
    I'm using a servlet to transform the xml files in my web-app to html. The servlet caches the ones transformed results. For each request it checks if there exists a cached result and if the result is based on the most actual xml file version (checking the "lastModified" method of java.io.File that represents the requested file).
    This servlet works fine and without any errors.
    My web-app also has some other servlets that use the xml transformation to generate a fragment of html code (the menu structure of my "normal" servlets is defined in one xml file for all other files and servlets).
    After invoking these servlets (those that use the xml transformation to create their menu) the first described servlet (transformation of requested xml files) is not working "fine" any longer. All it results is the generated header and footer of the page (hard-coded in the XSL file). The complete content is lost.
    Any ideas how to solve this problem?
    Thanks in advance,
    Thof

    1. The cache:
    The Hashtable is a field of my servlet called XMLTransformerServlet. The cache is not removed or deleted and none of its items is removed or deleted.
    As I said: Caching works fine, wonderful, perfectly...
    That's definitively not the problem.
    2. Thread safety:
    I've made all my servlet methods thread safe (just checked this...)
    3. About the "anonymous" other servlet type that uses xml transformations:
    Some of my servlets use a (thread safe) method to generate a fragment of html code that will show a simple menu structure. Therefore my web-app uses a file called menu.xml - by that way there's only one menu to maintain what makes sure that all my pages get the same menu structure (finally also the xsl file I'm using for "normal" xml transformation imports/includes and interprets this menu.xml).
    The (thread safe) method has transforms the menu.xml file using a special xsl file (menu.xsl) and outputs the result to a StringWriter. From this StringWriter I obtain the code-fragment that will be returned by the method.
    Before I saw the class StringWriter the first time I've used a temporary file to output the transformation result. Next I red in the file and returned its content.
    Finally - this method is working fine and it's always returning the expected data.
    4. The problem:
    Sorry for repeating this all the time...
    What I'm processing:
    &#160;- requesting some xml files -> XMLTransformerServlet is invoked and works fine:
    &#160;&#160;&#160;-> doGet checks the resource (if resource doesn't exist HTTP404 will be responded)
    &#160;&#160;&#160;-> doGet checks the caching state for this resource
    &#160;&#160;&#160;&#160;&#160;&#160;a) resource is in cache and no newer version of the File exists -> return cached element
    &#160;&#160;&#160;&#160;&#160;&#160;b) resource is in cache but a newer version exists in the file system -> recache and return newly cached element
    &#160;&#160;&#160;&#160;&#160;&#160;c) resource is not in cache -> cache the resource and return the newly cached element
    &#160;- requesting one of the other servlets (those that use xml transformation for menu generation)
    &#160;&#160;&#160;-> servlets invoked work fine
    &#160;- requesting a xml file:
    &#160;&#160;&#160;a) current version in cache -> return cached element
    &#160;&#160;&#160;b) no current version in cache -> transform the xml file and cache it
    This last transformation of the requested xml file fails.
    It is not failing in the sense of "throwing an exception"... it seems to work 100% fine and results a String that could be responded to the browser.
    But stupidly it is not working fine...
    Maybe (as you wrote) this is a bug (maybe in Resins xml transformation api).
    Just thought someone else might have made a similar experience...

  • Xml vs schema validation by java multimapping: ParserException

    Hello guys,
    I was looking for an answer everywhere, but with no succes.
    Problem:
    I am using SAP NetWeaver BI 7.0
    My interface mapping looks like this:
    1 XML INPUT ---> JAVA MAPPING ---> n XML OUTPUTS
    O found out, tha by setting occurence to "0..onbounded", causes, that also input is comming as "0..onbounded" xml. That I don't understant, but OK, can live with that. In runtime it looks that on the output, my xml root element is wrapped to this structure:
    <b>Messages
    |__Message1
        |__SDS_XSD_ZPPM_POB</b>
    What is frustrated problem for me, that I need to validate on the output in my Java Mapping the xml document against the schema but I always get this error:
    <i>Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
    ERRORS :
    cvc-element : element information item '/:Messages[1]' is not associated with element declaration and do not has an attribute information item among the element information item's [attributes] whose [namespace name] is identical to http://www.w3.org/2001/XMLSchema-instance and whose [local name] is type.</i>
    This is the begin of the xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <Messages xmlns="http://xxx.sk/is_xx">
       <Message1>
          <SDS_XSD_ZPPM_POB>
    This is the begin of the schema definition:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema targetNamespace="http://sap.com/xi/XI/SplitAndMerge" xmlns:p0="http://xxx.sk/is_xx"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://sap.com/xi/XI/SplitAndMerge">
       <xsd:element name="Messages" xmlns:p0="http://xxx.sk/is_xx">
          <xsd:complexType>
             <xsd:sequence>
                <xsd:element name="Message1" form="qualified">
                   <xsd:complexType>
                      <xsd:sequence>
                         <xsd:element ref="SDS_XSD_ZPPM_POB" minOccurs="0" maxOccurs="unbounded"
                            xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
                      </xsd:sequence>
                   </xsd:complexType>
                </xsd:element>
             </xsd:sequence>
          </xsd:complexType>
       </xsd:element>
    Without validation everything works perfect.
    CAN ANYBODY HELP WITH SOME CLUE?
    Thanks a lot
    Rasto
    Message was edited by:
            Peter Guzik

    No I didn't.
    Here is the result of my fixes:
    <b>XML:</b>
    <?xml version="1.0" encoding="UTF-8"?>
    <Messages xmlns="http://sap.com/xi/XI/SplitAndMerge">
       <Message1>
          <SDS_XSD_ZPPM_POB>
             <pob>010</pob>
    <b>XSD:</b>
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema targetNamespace="http://sap.com/xi/XI/SplitAndMerge" xmlns:p0="http://xxx.sk/is_sds"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://sap.com/xi/XI/SplitAndMerge">
       <xsd:element name="Messages">
          <xsd:complexType>
             <xsd:sequence>
                <xsd:element name="Message1" form="qualified">
                   <xsd:complexType>
                      <xsd:sequence>
                         <xsd:element ref="SDS_XSD_ZPPM_POB" minOccurs="0" maxOccurs="unbounded"
                            xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
                      </xsd:sequence>
    <b>RESULT EXCEPTION:</b>
    Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
    ERRORS :
    cvc-element : element information item '/:Messages[1]/:Message1[1]/:SDS_XSD_ZPPM_POB[1]/:pob[1]' is not associated with element declaration and do not has an attribute information item among the element information item's [attributes] whose [namespace name] is identical to http://www.w3.org/2001/XMLSchema-instance and whose [local name] is type.
    cvc-element : element information item '/:Messages[1]/:Message1[1]/:SDS_XSD_ZPPM_POB[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:Messages[1]/:Message1[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:Messages[1]' is not valid with respect to it's complex type definition..
    If there is an error in xml, according this message it is impossible to find it..

  • Sign XML document without KeyPairGenerator

    Hi everyone -----> System.out.println("HEEEELP!");
    I have a problem for signing and validating an XML document, using the Apache toolkit and JWSDP.
    Example :
    XMLSignature signature = fac.unmarshalXMLSignature(valContext);
    boolean coreValidity = signature.validate(valContext);
    When I genreate keys with KeyPairGenerator, everything works fine (The KeyPairGenerator uses crt coefficient). But If I use my own RSA keys (modulus, private and public exponent), I can sign but not validate the XML document, ie the signature value of the signedInfo. Strange thing : I'm sure the keys are correct. I can encyrpt and decrypt messages using my own validation program with these keys.
    Does anyone know how to sign and validate XML documents with its own keys ?
    I can reply more details if necessary ...
    Any help would be very very appreciated :)

    You're putting words in my mouth, I never mentioned DOM.
    What I'm saying is that JAXB is not of concern to your requirements. Whatever happens to the objects after they are created from XML is up to you. It has done its job, the XML has been transformed into object set A. Perhaps at some point in time it can do some more work for you, when you have an object set B that need to be written to an XML structure. How you get from A to B, that's up to you.
    But perhaps there is a more suited tool for the job that actually deals with XML transformations (hint hint). You could probably hack something together with basic SAX. Heck, if all you want to do is replace easy to identify lines of data with other lines of data a BufferedReader/BufferedWriter could already work.

  • Using XML Transformations in CR Runtime or Viewer

    Using Crystal Reports 2008 I have created a report and written an XML Transformation to export the report when it's been run.  When I select the Export function I'm asked:
       1. The Format (XML) and Destination (Disk File)
       2. To choose and XML exporting format (my transformation)
       3. The export file name
    The file is then created
    The report is then made available to my users via the Crystal Report Runtime.  When they run the report the expected report is displayed, however, when they try to export although they can select the XML format they cannot select the destination or the XML exporting format.  The XML file that is created is empty, i.e. it has no content.
    I've also looked at using the Crystal Reports Viewer but this can't even export to XML.
    How can I enable them to select the destination and XML export format without providing them with the full Crystal Reports?

    Hi Colin,
    Your developer can fin samples here: http://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsSDKSampleApplications
    And if he posts and searches on the SDK forum he'll find samples also.
    Don

  • I am wondering if there is a way to validate XML file without using .......

    I am wondering if there is a way to validate XML file without using the <!DOCTYPE... but pass in the location of the schema/DTD file as a parameter to a validating method?
    thanks

    None that I know of. The only thing close is to use the EntityResolver interface where you can modify the location of the DTD file before it's being loaded and parsed, but that requires a <!DOCTYPE ...> in the XML file.
    Good luck.

  • Error in rendering JSR168 Portlet - javax.xml.transform.Transformer

    Hi all,
    after we have successfully deployed a JSR 168 Portlet including some libraries,
    we have an error in rendering the html. Used libs:
    while deploying : a warning occus with the json taglib
              1. Warning occurred on server 6015250 during deploy sap.com/isp12EAR : Web Model Builder: Exception occurred: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlUnmarshalException: XML Deserialization Error. XML is not valid. Node <description> child of <taglib> not described in Schema. at com.sap.engine.services.webservices.jaxrpc.encoding.GeneratedComplexType.deserialize(GeneratedComplexType.java:1455), file: isp12.war#C:\usr\sap\CE3\J00\j2ee\cluster\server0\temp\deploy\work\deploying\isp12EAR.ear1214289890546\isp12.extracted.war\WEB-INF\lib\json-taglib-0.2.jar#META-INF/json.tld, column 0, line 0, severity: warning
    Resources:
       C:\usr\sap\CE3\J00\j2ee\cluster\apps\sap.com\isp12EAR\servlet_jsp\isp12\root\WEB-INF\lib\json-lib-1.1-jdk15.jar
       C:\usr\sap\CE3\J00\j2ee\cluster\apps\sap.com\isp12EAR\servlet_jsp\isp12\root\WEB-INF\lib\json-taglib-0.2.jar
        C:\usr\sap\CE3\J00\j2ee\cluster\apps\sap.com\isp12EAR\servlet_jsp\isp12\root\WEB-INF\lib\xalan.jar
       C:\usr\sap\CE3\J00\j2ee\cluster\apps\sap.com\isp12EAR\servlet_jsp\isp12\root\WEB-INF\lib\xbean.jar
       C:\usr\sap\CE3\J00\j2ee\cluster\apps\sap.com\isp12EAR\servlet_jsp\isp12\root\WEB-INF\lib\xercesImpl.jar
       C:\usr\sap\CE3\J00\j2ee\cluster\apps\sap.com\isp12EAR\servlet_jsp\isp12\root\WEB-INF\lib\xml-apis.jar
       C:\usr\sap\CE3\J00\j2ee\cluster\apps\sap.com\isp12EAR\servlet_jsp\isp12\root\WEB-INF\lib\xom-1.1.jar
    does anybody have an idea ?
    The error on the JSR 168 Portlet is:
    Fehler:
    javax.xml.transform.TransformerConfigurationException: Die Formatvorlage konnte nicht kompiliert werden.
    Stacktrace:
    com.inubit.ibis.servlets.task.UserData.getFormToHtml(UserData.java:310)
    com.inubit.ibis.servlets.task.action.SynchronShowFormAction.perform(SynchronShowFormAction.java:37)
    com.inubit.ibis.servlets.task.Dispatcher.dispatch(Dispatcher.java:113)
    com.inubit.ibis.servlets.FormPortlet.doFormDispatcher(FormPortlet.java:25)
    com.inubit.ibis.servlets.FormPortlet.doView(FormPortlet.java:30)
    javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:235)
    com.inubit.ibis.servlets.FormPortlet.render(FormPortlet.java:50)
    com.sap.engine.services.portletcontainer.container.request.RenderDispatchHandler.service(RenderDispatchHandler.java:55)
    com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:93)
    com.sap.engine.services.portletcontainer.container.PortletContainer.render(PortletContainer.java:244)
    com.sap.portal.prt.portlet.integration.PortletProxyComponent.doContent(PortletProxyComponent.java:53)
    com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:200)
    com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
    com.sap.portal.prt.component.CachablePortalComponent.service(CachablePortalComponent.java:352)
    com.sap.portal.prt.core.RequestDispatcherFactory$PortalComponentRequestDispatcher$5.service(RequestDispatcherFactory.java:308)
    com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:93)
    com.sap.portal.prt.core.RequestDispatcherFactory$PortalComponentRequestDispatcher.service(RequestDispatcherFactory.java:298)
    com.sap.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:278)
    com.sap.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:115)
    com.sap.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:158)
    com.sap.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:216)
    com.sap.portal.prt.pom.PortalNode.service(PortalNode.java:618)
    com.sap.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:282)
    com.sap.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:115)
    com.sap.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:158)
    com.sap.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:640)
    com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:203)
    com.sap.portal.prt.dispatcher.DispatcherServlet.service(DispatcherServlet.java:122)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:66)
    com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:32)
    com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:145)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.runServlet(FilterChainImpl.java:163)
    com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:82)
    com.sap.portal.http.EnrichNavRequestFilter.doFilter(EnrichNavRequestFilter.java:49)
    com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:74)
    com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:425)
    com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:289)
    com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
    com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:376)
    com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:85)
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:160)
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:67)
    com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
    com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
    com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
    com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
    com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:309)
    com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.run(Processor.java:222)
    com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    java.security.AccessController.doPrivileged(Native Method)
    com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:152)
    com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:247)
    Any ideas? THank you a lot!

    Hi Nils,
    The problem is in the json.tld.
    In the file ther are the following lines:
    <tlib-version>1.0</tlib-version>
    <short-name>json</short-name>
      <description>JSON (JavaScript Object Notation) rendering taglib</description>
         <uri>http://www.atg.com/taglibs/json</uri>
    according to the web-jsptaglibrary_2_0.xsd the describtion element should be written first.
    As the falidation fails the taglib is not loaded and the application cannot work as expected.
    I would sujest to corect the tld definition in the json-taglib-0.2.jar.
    Regards,
    Diyan

  • Parse document without validating

    Hi all,
    I'm writing a program which will be run in a stand alone machine (i.e. no network connection). When I parse my document which contain a "DOCTYPE", it will have an exception. Also, I don't want to store the DTD file in my local machine. How can I parse a document without validating it in a SAXParser? Thx for all.
    Here is my parser code:
    SAXParserFactory factory = SAXParserFactory.newInstance();
    XMLReader reader = factory.newSAXParser().getXMLReader();
    reader.setContentHandler(new SaxParser());
    reader.parse(xml_file);
    In the XML document:
    <!DOCTYPE package PUBLIC "+//ISBN....." "http://abc.org/dtd.....">
    The exception is:
    java.net.UnknownHostException: abc.org

    how about this code?
    SAXParserFactory factory = SAXParserFactory.newInstance();
    //disable validation
    factory.setValidating(false);
    XMLReader reader = factory.newSAXParser().getXMLReader();
    reader.setContentHandler(new SaxParser());
    reader.parse(xml_file);

  • Problem with return of javax.xml.transform.Source impl from webService

    I have a web services that needs to return an XML string to the calling client. If I return the XML as a String object it gets deserialized twice and the end result is no longer XML. My research indicates that I can return an implementation of javax.xml.transform.Source and this will cause SOAP to attach the XML string to the message rather than embed it (protecting it from deserialization). The following is the effective part of my method:
    public Source[] consumeTextMessage(String id) throws RemoteException {
    try {
    MessageConsumer mc = new MessageConsumer();
    String[] messages = mc.consumeTextMessage(id);
    StreamSource[] sources = new StreamSource[messages.length];
    for(int i = 0; i < messages.length; i++) {
    sources[ i ] = new StreamSource();
    return sources;
    } catch(RemoteException e) {
    throw e;
    note: the mc.consumeTextMessage(id) call works correctly and I know that I'm not putting anything in the StreamSource objects in the loop to build the array of StreamSource objects - just trying to get SOMETHING to work
    so this deploys without problem, but when I try to get a wsdl for the webservice i get a Server 500 error; the log says this:
    javax.servlet.ServletException: WSDL Generation exception: java.lang.Exception javax.xml.transform.Source is an abstract class: cannot be instanciated
    ok.... if I change the method return type to a concrete class (StreamSource[]), redeploy and try to get a wsdl, I get this absolutely crazy error:
    javax.servlet.ServletException: WSDL Generation exception: java.lang.Exception java.io.Reader is an abstract class: cannot be instanciated
    I have NO clue why it thinks it needs a Reader.
    If I change the method return type to String[] (and make the various adjustments to the method) then it deploys ok and gives me a good WSDL (though it still doesn't work because the Strings are deserialized twice so this isn't a viable solution but it does show that my webservice config is correct).
    So... bottom line seems to be that the webService "engine" of 10g AS doesn't like Source or StreamSource.....
    Any ideas what I can do??

    Funny story here: trying to deploy a different webserivce all together and got the same error message; thought I remembered seeing it before but wasn't sure; did a google search on it and lo and behold came across my first posting in this thread.... crazy.
    Anyway, I have discovered something that answers some of the questions I had in my first post: It seems that the argument types used in a webservice signature MUST be CONCRETE classes (and I would think primitives would work too though I don't remember trying them) - they can not be Interfaces or abstract classes. Probably if I read the webservices spec it would tell me that.
    So the error I was getting before was because Source was not a concrete class, and presumably the second error was caused by some signature somewhere along the line using the Reader abstract class.
    Fun stuff.

Maybe you are looking for

  • HT3775 I have a video file that is under quick play .mov and my macbook is telling me that it cannot read the file?

    I am trying to record something on my desktop and I recorded it with an application called iscreen recorder lite. I downloaded it off of the application store thinking it would save under a file my computer would recognize. When I tried to play the r

  • Canon 5D RAW files not opening in Photoshop CS3

    Windows Vista Home Premium SP1. Hey Ho! I did a photoshoot at a friend's studio last week, using his Canon 5D as it was all set up with the lights etc etc. He saved the files for me as RAW - *.CR2 - as I am used to using with my 450D. The only differ

  • User exit on clearing in Txn: FB05

    Hi All, Is there any user exit or badi which gets invoked when we do the <b>clearing using transaction: FB05</b>. (I know the available userexits for this transaction.) <b>Please let me know the userexit which will suit my requirement.</b> Thanks in

  • Importing MPEG-2 .MOV from JVC into Premiere Pro CC

    hi all, first post on this forum, i am josh. down to business. i have been having trouble with premiere pro, i am tasked with editing footage for a promotional video for a college. the footage was recorded on two seperate cameras, first was a JVC HM1

  • Anchor, pictures problem

    I have a problem, I'm working on a website in adobe muse and I have pictures outside/over of the working area so that are shown as full screen even on full hd resolution. And when I make anchors and click on the links it goes out of the working area